CurvilinearGrids.GridTypes.AxisymmetricGrid2D
— TypeAxisymmetricGrid2D
CurvilinearGrids.GridTypes.AxisymmetricGrid2D
— MethodAxisymmetricGrid2D(x::AbstractMatrix{T}, y::AbstractMatrix{T}, nhalo::Int, snap_to_axis::Bool, rotational_axis::Symbol; T=Float64, backend=CPU())
Create an axisymmetric 2d grid with x
and y
coordinates, with the symmetry axis rotational_axis = :x
or rotational_axis = :y
. Enforce coordinates to stay on the axis via snap_to_axis=True
. The input coordinates do not include halo / ghost data since the geometry is undefined in these regions. The nhalo
argument defines the number of halo cells along each dimension.
CurvilinearGrids.GridTypes.CurvilinearGrid1D
— TypeCurvilinearGrid1D
Fields
x
: Node function, e.g. x -> f(ξ)∂x∂ξ
: Derivative of x wrt ξ; ∂x∂ξ(ξ)nhalo
: Number of halo cells for all dimsnnodes
: Number of nodes/verticeslimits
: Cell loop limits based on halo cells
CurvilinearGrids.GridTypes.CurvilinearGrid1D
— MethodCurvilinearGrid1D(x::Function, (n_ξ,), nhalo)
Create a CurvilinearGrid1D
with a function x(ξ)
and nhalo
halo cells. n_ξ
is the total number of nodes/vertices (not including halo).
CurvilinearGrids.GridTypes.CurvilinearGrid2D
— TypeCurvilinearGrid2D
CurvilinearGrids.GridTypes.CurvilinearGrid2D
— MethodCurvilinearGrid2D(x::AbstractArray{T,2}, y::AbstractArray{T,2}, nhalo::Int, discretization_scheme=:MEG6; backend=CPU()) where {T}
Create a 2d grid with x
and y
coordinates. The input coordinates do not include halo / ghost data since the geometry is undefined in these regions. The nhalo
argument defines the number of halo cells along each dimension.
CurvilinearGrids.GridTypes.CurvilinearGrid3D
— TypeCurvilinearGrid3D
Fields
x
: Node function; e.g., x(i,j,k)y
: Node function; e.g., y(i,j,k)z
: Node function; e.g., z(i,j,k)jacobian_matrix_func
: Function to compute the jacobian matrix, e.g., J(i,j,k)conserv_metric_func
: Function to compute the conservative metricsnhalo
: Number of halo cells for all dimsnnodes
: Number of nodes/verticeslimits
: Cell loop limits based on halo cells
CurvilinearGrids.GridTypes.CurvilinearGrid3D
— MethodCurvilinearGrid3D(
x::AbstractArray{T,3}, y::AbstractArray{T,3}, z::AbstractArray{T,3}, nhalo::Int, discretization_scheme=:MEG6; backend=CPU(), ) where {T}
CurvilinearGrids.GridTypes.AxisymmetricRThetaGrid
— MethodRThetaGrid((r0, θ0), (r1, θ1), (ni_cells, nj_cells), nhalo, snap_to_axis, rotational_axis, backend=CPU(), T=Float64)
Create an equally spaced axisymmetric polar grid based on r
and θ
. The axis of rotation is set by rotational_axis
as :x
or :y
CurvilinearGrids.GridTypes.AxisymmetricRThetaGrid
— MethodAxisymmetricRThetaGrid(r, θ, nhalo, snap_to_axis, rotational_axis::Symbol, backend=CPU())
Create polar grid based on vectors of r
and θ
coordinates. The axis of rotation is set by rotational_axis
as :x
or :y
CurvilinearGrids.GridTypes.RThetaGrid
— FunctionRThetaGrid((r0, θ0), (r1, θ1), (ni_cells, nj_cells), nhalo::Int, backend=CPU(), T=Float64)
Create an equally spaced polar grid based on r
and θ
CurvilinearGrids.GridTypes.RThetaGrid
— MethodRThetaGrid(r, θ, nhalo::Int, backend=CPU())
Create polar grid based on vectors of r
and θ
coordinates
CurvilinearGrids.GridTypes.cellsize
— MethodGet the size of the grid for cell-based arrays
CurvilinearGrids.GridTypes.cellsize_withhalo
— MethodGet the size of the grid for cell-based arrays when the halo cells are included
CurvilinearGrids.GridTypes.centroid
— MethodGet the position of the centroid for the given cell index. NOTE: these indices are consistent with halo cells included. This means that if your grid has 2 halo cells, the position of the first non-halo centroid is index at coord(mesh, 3). The CurvilinearGrid
only keeps track of the number of halo cells for each dimension, whereas the grid functions have no knowledge halos. Therefore, the coord
function applies a shift to the index for you.
CurvilinearGrids.GridTypes.centroid_radius
— MethodGet the radial centroid coordinate of a axisymmetric mesh
CurvilinearGrids.GridTypes.coord
— MethodGet the position/coordinate at a given index. NOTE: these indices are consistent with halo cells included. This means that if your grid has 2 halo cells, the position of the first non-halo vertex is index at coord(mesh, 3). The CurvilinearGrid
only keeps track of the number of halo cells for each dimension, whereas the grid functions have no knowledge halos. Therefore, the coord
function applies a shift to the index for you.
CurvilinearGrids.GridTypes.jacobian
— MethodGet the Jacobian of the forward transformation (ξ,η,ζ) → (x,y,z).
CurvilinearGrids.GridTypes.jacobian
— Methodjacobian(mesh::CurvilinearGrid2D, idx)
The cell-centroid Jacobian (determinant of the Jacobian matrix)
CurvilinearGrids.GridTypes.jacobian_matrix
— MethodGet the Jacobian matrix of the forward transformation (ξ,η,ζ) → (x,y,z).
CurvilinearGrids.GridTypes.jacobian_matrix
— Methodjacobian_matrix(mesh::CurvilinearGrid2D, idx)
The cell-centroid Jacobian matrix (the forward transformation: ∂x/∂ξ, ∂y/∂ξ, ... ). Use inv(jacobian_matrix(mesh, idx))
to get the inverse transformation (∂ξ/∂x, ∂ξ/∂y, ...)
CurvilinearGrids.GridTypes.radius
— MethodGet the radial node coordinate of a axisymmetric mesh
CurvilinearGrids.GridTypes.update!
— MethodUpdate metrics after grid coordinates change
CurvilinearGrids.GridTypes.update!
— MethodUpdate metrics after grid coordinates change
CurvilinearGrids.GridTypes.update!
— MethodUpdate metrics after grid coordinates change
CurvilinearGrids.GridTypes.update!
— MethodUpdate metrics after grid coordinates change
CurvilinearGrids.IndexingUtils
— ModuleFunctions used to work on CartesianIndex and CartesianIndices to make looping and stencil creation easy for arbitary dimensions and axes
CurvilinearGrids.IndexingUtils.down
— MethodGo down by n
on a given axis
of a CartesianIndex
CurvilinearGrids.IndexingUtils.expand
— MethodExpand the CartesianIndices ranges by n
on axis
CurvilinearGrids.IndexingUtils.expand
— MethodExpand the CartesianIndices ranges by n
on all axes
CurvilinearGrids.IndexingUtils.expand_lower
— MethodExpand the CartesianIndices starting index by -n
on all axes
CurvilinearGrids.IndexingUtils.expand_upper
— MethodExpand the CartesianIndices ending index by +n
on all axes
CurvilinearGrids.IndexingUtils.lower_boundary_indices
— MethodTake a given CartesianIndices and extract only the lower boundary indices at an offset of n
along a given axis
.
Example
julia> domain = CartesianIndices((1:10, 4:8))
CartesianIndices((1:10, 4:8))
julia> lower_boundary_indices(domain, 2, 0) # select the first index on axis 2
CartesianIndices((1:10, 4:4))
CurvilinearGrids.IndexingUtils.plus_minus
— MethodGet indices of of ±n
for an arbitary axis
. For a 2d index, and and offset on the j
axis, this would be [i,j-n:j+n]. This makes it simple to generate arbitrary stencils on arbitrary axes.
Arguments
- I::CartesianIndex{N}
- axis::Int: which axis to provide the ±n to
- n::Int: how much to offset on a given axis
Example
julia> I = CartesianIndex((4,5))
CartesianIndex(4, 5)
julia> plus_minus(I, 2, 2)
CartesianIndices((4:4, 3:7))
CurvilinearGrids.IndexingUtils.up
— MethodGo up by n
on a given axis
of a CartesianIndex
CurvilinearGrids.IndexingUtils.upper_boundary_indices
— MethodTake a given CartesianIndices and extract only the upper boundary indices at an offset of n
along a given axis
.
Example
julia> domain = CartesianIndices((1:10, 4:8))
CartesianIndices((1:10, 4:8))
julia> upper_boundary_indices(domain, 2, 1)
CartesianIndices((1:10, 8:8))
CurvilinearGrids.IndexingUtils.δ
— MethodApply a delta function to the cartesian index on a specified axis. For example, δ(3, CartesianIndex(1,2,3))
will give CartesianIndex(0,0,1)
.
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils
— ModuleFunctions used to work on CartesianIndex and CartesianIndices to make looping and stencil creation easy for arbitary dimensions and axes
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.down
— MethodGo down by n
on a given axis
of a CartesianIndex
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.expand
— MethodExpand the CartesianIndices ranges by n
on axis
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.expand
— MethodExpand the CartesianIndices ranges by n
on all axes
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.expand_lower
— MethodExpand the CartesianIndices starting index by -n
on all axes
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.expand_upper
— MethodExpand the CartesianIndices ending index by +n
on all axes
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.lower_boundary_indices
— MethodTake a given CartesianIndices and extract only the lower boundary indices at an offset of n
along a given axis
.
Example
julia> domain = CartesianIndices((1:10, 4:8))
CartesianIndices((1:10, 4:8))
julia> lower_boundary_indices(domain, 2, 0) # select the first index on axis 2
CartesianIndices((1:10, 4:4))
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.plus_minus
— MethodGet indices of of ±n
for an arbitary axis
. For a 2d index, and and offset on the j
axis, this would be [i,j-n:j+n]. This makes it simple to generate arbitrary stencils on arbitrary axes.
Arguments
- I::CartesianIndex{N}
- axis::Int: which axis to provide the ±n to
- n::Int: how much to offset on a given axis
Example
julia> I = CartesianIndex((4,5))
CartesianIndex(4, 5)
julia> plus_minus(I, 2, 2)
CartesianIndices((4:4, 3:7))
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.up
— MethodGo up by n
on a given axis
of a CartesianIndex
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.upper_boundary_indices
— MethodTake a given CartesianIndices and extract only the upper boundary indices at an offset of n
along a given axis
.
Example
julia> domain = CartesianIndices((1:10, 4:8))
CartesianIndices((1:10, 4:8))
julia> upper_boundary_indices(domain, 2, 1)
CartesianIndices((1:10, 8:8))
CurvilinearGrids.MetricDiscretizationSchemes.IndexingUtils.δ
— MethodApply a delta function to the cartesian index on a specified axis. For example, δ(3, CartesianIndex(1,2,3))
will give CartesianIndex(0,0,1)
.
CurvilinearGrids.VTKOutput.save_vtk
— FunctionWrite the mesh to .VTK format