CurvilinearGrids.GridTypes.AxisymmetricGrid2DMethod
AxisymmetricGrid2D(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.CurvilinearGrid1DType

CurvilinearGrid1D

Fields

  • x: Node function, e.g. x -> f(ξ)
  • ∂x∂ξ: Derivative of x wrt ξ; ∂x∂ξ(ξ)
  • nhalo: Number of halo cells for all dims
  • nnodes: Number of nodes/vertices
  • limits: Cell loop limits based on halo cells
CurvilinearGrids.GridTypes.CurvilinearGrid1DMethod
CurvilinearGrid1D(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.CurvilinearGrid2DMethod
CurvilinearGrid2D(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.CurvilinearGrid3DType

CurvilinearGrid3D

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 metrics
  • nhalo: Number of halo cells for all dims
  • nnodes: Number of nodes/vertices
  • limits: Cell loop limits based on halo cells
CurvilinearGrids.GridTypes.AxisymmetricRThetaGridMethod
AxisymmetricRThetaGrid(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.RThetaGridFunction
RThetaGrid((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.RThetaGridFunction
RThetaGrid((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.centroidMethod

Get 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.coordMethod

Get 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_matrixMethod
jacobian_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.IndexingUtilsModule

Functions used to work on CartesianIndex and CartesianIndices to make looping and stencil creation easy for arbitary dimensions and axes

CurvilinearGrids.IndexingUtils.lower_boundary_indicesMethod

Take 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_minusMethod

Get 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.upper_boundary_indicesMethod

Take 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.δMethod

Apply 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.plus_minusMethod

Get 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))