Grid
The staggered-grid Geometry and its constructors, and the interpolation kernels between cell-center, vertex, and staggered velocity locations. See Grid generation for a narrative guide.
JustRelax.IGG Type
IGG(me, dims, nprocs, coords, comm_cart)Container for the Cartesian MPI topology returned by ImplicitGlobalGrid.init_global_grid.
This is typically created as:
igg = IGG(init_global_grid(nx, ny, nz; init_MPI = true)...)and then passed around so code can access the current rank, Cartesian coordinates, and communicator associated with the distributed grid decomposition.
sourceJustRelax.lazy_grid Method
lazy_grid(di, ni, Li; origin = ntuple(_ -> zero(T1), Val(N)))Create cell-centered and vertex coordinates for a serial uniform grid.
di gives the spacing in each direction, ni the number of cells, and Li the physical lengths of the domain.
JustRelax.lazy_grid_MPI Method
lazy_grid_MPI(di, ni; origin = ntuple(_ -> zero(T1), Val(N)))Create local cell-centered and vertex coordinates for a uniform grid distributed with ImplicitGlobalGrid.
The returned coordinates are shifted by origin and correspond to the local MPI rank.
JustRelax.legacy_uniform_grid Method
legacy_uniform_grid(ni, di)Construct a uniform Geometry from grid sizes ni and cell spacings di.
This helper preserves the older API used by some solver code. In MPI mode the physical domain lengths are reconstructed from the global grid dimensions, so the resulting geometry matches the full distributed domain rather than only the local chunk.
sourceJustRelax.velocity_grids Method
velocity_grids(xci, xvi, di)Build staggered velocity coordinates from cell-centered and vertex grids.
For each velocity component, the coordinate along that component lives on vertices, while the transverse directions are extended with one ghost point on either side. Both uniform spacings and nonuniform spacing vectors are supported in 2D and 3D.
Arguments
xci: Cell-centered coordinates in each direction.xvi: Vertex coordinates in each direction.di: Cell spacing as either scalars for a uniform grid or vectors for a nonuniform grid.
JustRelax.x_g Method
x_g(idx, dxi, nxi_or_A)Global x coordinate of local index idx on a grid with spacing dxi, given either the local axis length nxi or an array A sized along that axis. Accounts for the MPI domain decomposition and periodicity set up by init_global_grid (see IGG).
JustRelax.y_g Method
y_g(idx, dxi, nxi_or_A)Global y coordinate of local index idx, analogous to x_g.
JustRelax.z_g Method
z_g(idx, dxi, nxi_or_A)Global z coordinate of local index idx, analogous to x_g.
JustRelax.@dxi Macro
@dxi(dxi, I, J[, K])Cell spacing (dx, dy[, dz]) at grid index (I, J[, K]), reading from dxi — a tuple of per-axis spacing that may be a constant Number (uniform grid) or an AbstractVector (non-uniform grid, indexed at I/J/K).
JustRelax.Geometry Method
Geometry(TA, xvi::Vararg{<:AbstractVector, nDim})
Geometry(xvi::NTuple{nDim, <:AbstractVector})Build a staggered grid from explicit vertex coordinates along each dimension.
This constructor is useful for refined or otherwise nonuniform meshes. Cell-centered coordinates, local spacings, and staggered velocity grids are derived from the supplied vertex coordinates. TA can be used to move the generated arrays to a target array type.
Arguments
TA: Array constructor used to materialize the coordinate arrays, for exampleArrayor a backend-specific array type.xvi: One vertex-coordinate vector per dimension.
JustRelax.Geometry Method
Geometry(ni, li; origin = ntuple(_ -> 0.0, Val(nDim)))Build a uniform staggered grid with ni cells and physical domain lengths li.
When ImplicitGlobalGrid has been initialized, the grid spacing is computed from the global grid dimensions and the returned coordinates correspond to the local MPI subdomain. Otherwise a serial grid covering the full domain is created.
Arguments
ni: Number of local grid cells in each direction.li: Physical domain length in each direction.
Keywords
origin: Lower-left or lower-front corner of the domain.
Returns
- A
Geometrywith cell-centered coordinatesxci, vertex coordinatesxvi, and staggered velocity coordinatesxi_vel.
JustRelax.Geometry Type
struct Geometry{nDim,V,D,T}A staggered Cartesian grid in nDim dimensions.
Geometry stores the domain size, origin, cell spacing, cell-centered coordinates, vertex coordinates, and the staggered velocity grids used throughout JustRelax.
JustRelax.GeometryAnnulus Method
GeometryAnnulus(TA, θv, rv)
GeometryAnnulus((θv, rv))Build a staggered annular grid from explicit vertex-coordinate vectors in (θ, r) order. θv contains angular vertices and rv contains radial vertices. Cell-centered coordinates and local spacings are derived from these vectors. All values in θv must be given in radians.
TA is the array constructor used to materialize the generated coordinate arrays, such as Array or a backend-specific array type. The tuple form uses Array.
JustRelax.GeometryAnnulus Method
GeometryAnnulus(ni, li; origin = ntuple(_ -> 0.0, Val(nDim)))Build a uniform staggered annular grid in (θ, r) coordinate order.
For a two-dimensional annulus, ni = (nθ, nr), li = (lθ, lr), and origin = (θ₀, r₀). Thus, the first entries describe the angular direction and the second entries describe the radial direction. Both lθ and θ₀ must be given in radians. When ImplicitGlobalGrid is initialized, the coordinates cover the local MPI subdomain; otherwise they cover the full domain.
Arguments
ni: Number of cells in each coordinate direction, ordered as(nθ, nr).li: Coordinate extents, ordered as angular extent then radial extent.
Keywords
origin: Lower coordinate bounds, ordered as(θ₀, r₀).
Returns
- A
GeometryAnnuluswith cell-centered, vertex, and staggered velocity coordinates in(θ, r)order.
JustRelax.GeometryAnnulus Type
GeometryAnnulus{nDim,V,D,T} <: AbstractGrid{nDim,V,D,T}A staggered annular grid whose first two coordinate directions are (θ, r): angular position followed by radius. Accordingly, xci[1] and xvi[1] contain angular coordinates in radians, while xci[2] and xvi[2] contain radial coordinates.
The grid stores its cell counts, coordinate extents, origin, spacings, cell-centered coordinates, vertex coordinates, and staggered velocity grids.
sourceJustRelax.JustRelax2D.center2vertex! Method
center2vertex!(vertex, center)
center2vertex!(vertex_yz, vertex_xz, vertex_xy, center_yz, center_xz, center_xy)Interpolates the values at the cell center(s) onto vertex points. The 6-argument method interpolates the three shear-stress/strain-rate components of a 3D SymmetricTensor onto their respective face vertices.
JustRelax.JustRelax2D.interp_Vx_on_Vy! Method
interp_Vx_on_Vy!(Vx_on_Vy, Vx)Interpolates the values of Vx onto the grid points of Vy.
Arguments
Vx_on_Vy::AbstractArray:VxatVygrid points.Vx::AbstractArray:Vxat its staggered grid points.
JustRelax.JustRelax2D.shear2center! Method
shear2center!(A::SymmetricTensor)Interpolate the shear components of A onto the cell centers, in place.
JustRelax.JustRelax2D.velocity2center! Method
velocity2center!(Vx_c, Vy_c, Vx, Vy)In-place interpolation of the velocity field Vx, Vy from a staggered grid with ghost nodes onto the pre-allocated Vx_c, Vy_c 2D arrays located at the cell centers.
JustRelax.JustRelax2D.velocity2center! Method
velocity2center!(Vx_c, Vy_c, Vz_c, Vx, Vy, Vz)In-place interpolation of the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the pre-allocated Vx_c, Vy_c, Vz_c 3D arrays located at the cell centers.
JustRelax.JustRelax2D.velocity2vertex! Method
velocity2vertex!(Vx_v, Vy_v, Vx, Vy)In-place interpolation of the velocity field Vx, Vy from a staggered grid with ghost nodes onto the pre-allocated Vx_v, Vy_v 2D arrays located at the grid vertices.
JustRelax.JustRelax2D.velocity2vertex! Method
velocity2vertex!(Vx_v, Vy_v, Vz_v, Vx, Vy, Vz)In-place interpolation of the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the pre-allocated Vx_d, Vy_d, Vz_d 3D arrays located at the grid vertices.
JustRelax.JustRelax2D.velocity2vertex Method
velocity2vertex(Vx, Vy, Vz)Interpolate the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the grid vertices.
JustRelax.JustRelax2D.vertex2center! Method
vertex2center!(center, vertex)Interpolates the values at the vertex onto center points.
JustRelax.JustRelax3D.center2vertex! Method
center2vertex!(vertex, center)
center2vertex!(vertex_yz, vertex_xz, vertex_xy, center_yz, center_xz, center_xy)Interpolates the values at the cell center(s) onto vertex points. The 6-argument method interpolates the three shear-stress/strain-rate components of a 3D SymmetricTensor onto their respective face vertices.
JustRelax.JustRelax3D.interp_Vx_on_Vy! Method
interp_Vx_on_Vy!(Vx_on_Vy, Vx)Interpolates the values of Vx onto the grid points of Vy.
Arguments
Vx_on_Vy::AbstractArray:VxatVygrid points.Vx::AbstractArray:Vxat its staggered grid points.
JustRelax.JustRelax3D.shear2center! Method
shear2center!(A::SymmetricTensor)Interpolate the shear components of A onto the cell centers, in place.
JustRelax.JustRelax3D.velocity2center! Method
velocity2center!(Vx_c, Vy_c, Vx, Vy)In-place interpolation of the velocity field Vx, Vy from a staggered grid with ghost nodes onto the pre-allocated Vx_c, Vy_c 2D arrays located at the cell centers.
JustRelax.JustRelax3D.velocity2center! Method
velocity2center!(Vx_c, Vy_c, Vz_c, Vx, Vy, Vz)In-place interpolation of the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the pre-allocated Vx_c, Vy_c, Vz_c 3D arrays located at the cell centers.
JustRelax.JustRelax3D.velocity2vertex! Method
velocity2vertex!(Vx_v, Vy_v, Vx, Vy)In-place interpolation of the velocity field Vx, Vy from a staggered grid with ghost nodes onto the pre-allocated Vx_v, Vy_v 2D arrays located at the grid vertices.
JustRelax.JustRelax3D.velocity2vertex! Method
velocity2vertex!(Vx_v, Vy_v, Vz_v, Vx, Vy, Vz)In-place interpolation of the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the pre-allocated Vx_d, Vy_d, Vz_d 3D arrays located at the grid vertices.
JustRelax.JustRelax3D.velocity2vertex Method
velocity2vertex(Vx, Vy, Vz)Interpolate the velocity field Vx, Vy, Vz from a staggered grid with ghost nodes onto the grid vertices.
JustRelax.JustRelax3D.vertex2center! Method
vertex2center!(center, vertex)Interpolates the values at the vertex onto center points.