DMStag (Staggered Grids)
DMStag manages staggered grid discretizations, commonly used in computational fluid dynamics and geophysics. It handles variables defined at different locations (vertices, edges, faces, element centers).
Overview
DMStag provides:
- Staggered grid support for MAC/marker-and-cell schemes
- Multiple degrees of freedom at vertices, edges, faces, and element centers
- Efficient communication for staggered variables
- 1D, 2D, and 3D support
- Boundary type specification
Basic Usage Pattern
using PETSc, MPI
petsclib = PETSc.petsclibs[1]
PETSc.initialize(petsclib)
# Get PETSc types
PetscInt = petsclib.PetscInt
# Create a 2D staggered grid
# Velocity components on edges, pressure at cell centers
dm = LibPETSc.DMStagCreate2d(
petsclib,
MPI.COMM_WORLD,
LibPETSc.DM_BOUNDARY_NONE,
LibPETSc.DM_BOUNDARY_NONE,
PetscInt(10), PetscInt(10), # global dimensions
PetscInt(LibPETSc.PETSC_DECIDE),
PetscInt(LibPETSc.PETSC_DECIDE),
PetscInt(0), # dof per vertex
PetscInt(1), # dof per edge (velocity)
PetscInt(1), # dof per element (pressure)
LibPETSc.DMSTAG_STENCIL_BOX,
PetscInt(1), # stencil width
C_NULL, C_NULL
)
# Set up
LibPETSc.DMSetFromOptions(petsclib, dm)
LibPETSc.DMSetUp(petsclib, dm)
# Create vectors
x = LibPETSc.DMCreateGlobalVector(petsclib, dm)
# Access staggered components
# Use DMStagGetLocationSlot to get indices for each component
# Cleanup
LibPETSc.VecDestroy(petsclib, x)
LibPETSc.DMDestroy(petsclib, dm)
PETSc.finalize(petsclib)DMStag Functions
PETSc.LibPETSc.DMStagCreate1d — Method
dm::PetscDM = DMStagCreate1d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, M::PetscInt, dof0::PetscInt, dof1::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr, Vector{PetscInt}})Create an object to manage data living on the elements and vertices of a parallelized regular 1D grid.
Collective
Input Parameters:
comm- MPI communicatorbndx- boundary type:DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, orDM_BOUNDARY_GHOSTEDM- global number of elementsdof0- number of degrees of freedom per vertex/0-celldof1- number of degrees of freedom per element/1-cellstencilType- ghost/halo region type:DMSTAG_STENCIL_BOXorDMSTAG_STENCIL_NONEstencilWidth- width, in elements, of halo/ghost regionlx- array of local sizes, of length equal to the comm size, summing toMorNULL
Output Parameter:
dm- the newDMSTAGobject
Options Database Keys:
-dm_view- callsDMViewFromOptions()at the conclusion ofDMSetUp()-stag_grid_x nx- number of elements in the x direction-stag_ghost_stencil_width- width of ghost region, in elements-stag_boundary_type_x (none|ghosted|periodic)-DMBoundaryTypevalue
Level: beginner
See also: DMSTAG, DMStagCreate2d(), DMStagCreate3d(), DMDestroy(), DMView(), DMCreateGlobalVector(), DMCreateLocalVector(), DMLocalToGlobalBegin(), DMDACreate1d()
External Links
- PETSc Manual:
DMStag/DMStagCreate1d
PETSc.LibPETSc.DMStagCreate2d — Method
dm::PetscDM = DMStagCreate2d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, M::PetscInt, N::PetscInt, M_m::PetscInt, M_n::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr, Vector{PetscInt}}, ly::Union{Ptr, Vector{PetscInt}})Create an object to manage data living on the elements, faces, and vertices of a parallelized regular 2D grid.
Collective
Input Parameters:
comm- MPI communicatorbndx- x boundary type,DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, or
DM_BOUNDARY_GHOSTED
bndy- y boundary type,DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, orDM_BOUNDARY_GHOSTEDM- global number of elements in x directionN- global number of elements in y directionm- number of ranks in the x direction (may bePETSC_DECIDE)n- number of ranks in the y direction (may bePETSC_DECIDE)dof0- number of degrees of freedom per vertex/0-celldof1- number of degrees of freedom per face/1-celldof2- number of degrees of freedom per element/2-cellstencilType- ghost/halo region type:DMSTAG_STENCIL_NONE,DMSTAG_STENCIL_BOX, orDMSTAG_STENCIL_STARstencilWidth- width, in elements, of halo/ghost regionlx- array of local x element counts, of length equal tom, summing toM, orNULLly- array of local y element counts, of length equal ton, summing toN, orNULL
Output Parameter:
dm- the newDMSTAGobject
Options Database Keys:
-dm_view- callsDMViewFromOptions()at the conclusion ofDMSetUp()-stag_grid_x nx- number of elements in the x direction-stag_grid_y ny- number of elements in the y direction-stag_ranks_x rx- number of ranks in the x direction-stag_ranks_y ry- number of ranks in the y direction-stag_ghost_stencil_width- width of ghost region, in elements-stag_boundary_type_x (none|ghosted|periodic)-DMBoundaryTypevalue-stag_boundary_type_y (none|ghosted|periodic)-DMBoundaryTypevalue
Level: beginner
See also: DMSTAG, DMStagCreate1d(), DMStagCreate3d(), DMDestroy(), DMView(), DMCreateGlobalVector(), DMCreateLocalVector(), DMLocalToGlobalBegin(), DMDACreate2d()
External Links
- PETSc Manual:
DMStag/DMStagCreate2d
PETSc.LibPETSc.DMStagCreate3d — Method
dm::PetscDM = DMStagCreate3d(petsclib::PetscLibType, comm::MPI_Comm, bndx::DMBoundaryType, bndy::DMBoundaryType, bndz::DMBoundaryType, M::PetscInt, N::PetscInt, P::PetscInt, M_m::PetscInt, M_n::PetscInt, M_p::PetscInt, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt, stencilType::DMStagStencilType, stencilWidth::PetscInt, lx::Union{Ptr, Vector{PetscInt}}, ly::Union{Ptr, Vector{PetscInt}}, lz::Union{Ptr, Vector{PetscInt}})Create an object to manage data living on the elements, faces, edges, and vertices of a parallelized regular 3D grid.
Collective
Input Parameters:
comm- MPI communicatorbndx- x boundary type,DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, orDM_BOUNDARY_GHOSTEDbndy- y boundary type,DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, orDM_BOUNDARY_GHOSTEDbndz- z boundary type,DM_BOUNDARY_NONE,DM_BOUNDARY_PERIODIC, orDM_BOUNDARY_GHOSTEDM- global number of elements in x directionN- global number of elements in y directionP- global number of elements in z directionm- number of ranks in the x direction (may bePETSC_DECIDE)n- number of ranks in the y direction (may bePETSC_DECIDE)p- number of ranks in the z direction (may bePETSC_DECIDE)dof0- number of degrees of freedom per vertex/0-celldof1- number of degrees of freedom per edge/1-celldof2- number of degrees of freedom per face/2-celldof3- number of degrees of freedom per element/3-cellstencilType- ghost/halo region type:DMSTAG_STENCIL_NONE,DMSTAG_STENCIL_BOX, orDMSTAG_STENCIL_STARstencilWidth- width, in elements, of halo/ghost regionlx- array of local x element counts, of length equal tom, summing toM, orNULLly- arrays of local y element counts, of length equal ton, summing toN, orNULLlz- arrays of local z element counts, of length equal top, summing toP, orNULL
Output Parameter:
dm- the newDMSTAGobject
Options Database Keys:
-dm_view- callsDMViewFromOptions()at the conclusion ofDMSetUp()-stag_grid_x nx- number of elements in the x direction-stag_grid_y ny- number of elements in the y direction-stag_grid_z nz- number of elements in the z direction-stag_ranks_x rx- number of ranks in the x direction-stag_ranks_y ry- number of ranks in the y direction-stag_ranks_z rz- number of ranks in the z direction-stag_ghost_stencil_width- width of ghost region, in elements-stag_boundary_type x (none|ghosted|periodic)-DMBoundaryTypevalue-stag_boundary_type y (none|ghosted|periodic)-DMBoundaryTypevalue-stag_boundary_type z (none|ghosted|periodic)-DMBoundaryTypevalue
Level: beginner
See also: DMSTAG, DMStagCreate1d(), DMStagCreate2d(), DMDestroy(), DMView(), DMCreateGlobalVector(), DMCreateLocalVector(), DMLocalToGlobalBegin(), DMDACreate3d()
External Links
- PETSc Manual:
DMStag/DMStagCreate3d
PETSc.LibPETSc.DMStagCreateCompatibleDMStag — Method
newdm::PetscDM = DMStagCreateCompatibleDMStag(petsclib::PetscLibType, dm::AbstractPetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt)create a compatible DMSTAG with different dof/stratum
Collective
Input Parameters:
dm- theDMSTAGobjectdof0- number of dof on the first stratum in the newDMSTAGdof1- number of dof on the second stratum in the newDMSTAGdof2- number of dof on the third stratum in the newDMSTAGdof3- number of dof on the fourth stratum in the newDMSTAG
Output Parameter:
newdm- the new, compatibleDMSTAG
Level: intermediate
See also: DMSTAG, DMDACreateCompatibleDMDA(), DMGetCompatibility(), DMStagMigrateVec()
External Links
- PETSc Manual:
DMStag/DMStagCreateCompatibleDMStag
PETSc.LibPETSc.DMStagCreateISFromStencils — Method
is::IS = DMStagCreateISFromStencils(petsclib::PetscLibType, dm::AbstractPetscDM, n_stencil::PetscInt, stencils::Vector{DMStagStencil})Create an IS, using global numberings, for a subset of DOF in a DMSTAG object
Collective
Input Parameters:
dm- theDMSTAGobjectn_stencil- the number of stencils providedstencils- an array ofDMStagStencilobjects (i,j, andkare ignored)
Output Parameter:
is- the globalIS
See also: DMSTAG, IS, DMStagStencil, DMCreateGlobalVector
External Links
- PETSc Manual:
DMStag/DMStagCreateISFromStencils
PETSc.LibPETSc.DMStagGetBoundaryTypes — Method
boundaryTypeX::DMBoundaryType,boundaryTypeY::DMBoundaryType,boundaryTypeZ::DMBoundaryType = DMStagGetBoundaryTypes(petsclib::PetscLibType, dm::AbstractPetscDM)get boundary types
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
boundaryTypeX- boundary type for x directionboundaryTypeY- boundary type for y direction, not set for one dimensional problemsboundaryTypeZ- boundary type for z direction, not set for one and two dimensional problems
Level: intermediate
See also: DMSTAG, DMBoundaryType
External Links
- PETSc Manual:
DMStag/DMStagGetBoundaryTypes
PETSc.LibPETSc.DMStagGetCorners — Method
x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt,nExtrax::PetscInt,nExtray::PetscInt,nExtraz::PetscInt = DMStagGetCorners(petsclib::PetscLibType, dm::AbstractPetscDM)return global element indices of the local region (excluding ghost points)
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
x- starting element index in first directiony- starting element index in second directionz- starting element index in third directionm- element width in first directionn- element width in second directionp- element width in third directionnExtrax- number of extra partial elements in first directionnExtray- number of extra partial elements in second directionnExtraz- number of extra partial elements in third direction
Level: beginner
See also: DMSTAG, DMStagGetGhostCorners(), DMDAGetCorners()
External Links
- PETSc Manual:
DMStag/DMStagGetCorners
PETSc.LibPETSc.DMStagGetDOF — Method
dof0::PetscInt,dof1::PetscInt,dof2::PetscInt,dof3::PetscInt = DMStagGetDOF(petsclib::PetscLibType, dm::AbstractPetscDM)get number of DOF associated with each stratum of the grid
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
dof0- the number of points per 0-cell (vertex/node)dof1- the number of points per 1-cell (element in 1D, edge in 2D and 3D)dof2- the number of points per 2-cell (element in 2D, face in 3D)dof3- the number of points per 3-cell (element in 3D)
Level: beginner
See also: DMSTAG, DMStagGetCorners(), DMStagGetGhostCorners(), DMStagGetGlobalSizes(), DMStagGetStencilWidth(), DMStagGetBoundaryTypes(), DMStagGetLocationDOF(), DMDAGetDof()
External Links
- PETSc Manual:
DMStag/DMStagGetDOF
PETSc.LibPETSc.DMStagGetEntries — Method
entries::PetscInt = DMStagGetEntries(petsclib::PetscLibType, dm::AbstractPetscDM)get number of native entries in the global representation
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameter:
entries- number of rank-native entries in the global representation
Level: developer
See also: DMSTAG, DMStagGetDOF(), DMStagGetEntriesLocal(), DMStagGetEntriesPerElement(), DMCreateLocalVector()
External Links
- PETSc Manual:
DMStag/DMStagGetEntries
PETSc.LibPETSc.DMStagGetEntriesLocal — Method
entries::PetscInt = DMStagGetEntriesLocal(petsclib::PetscLibType, dm::AbstractPetscDM)get number of entries in the local representation
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameter:
entries- number of entries in the local representation
Level: developer
See also: DMSTAG, DMStagGetDOF(), DMStagGetEntries(), DMStagGetEntriesPerElement(), DMCreateLocalVector()
External Links
- PETSc Manual:
DMStag/DMStagGetEntriesLocal
PETSc.LibPETSc.DMStagGetEntriesPerElement — Method
entriesPerElement::PetscInt = DMStagGetEntriesPerElement(petsclib::PetscLibType, dm::AbstractPetscDM)get number of entries per element in the local representation
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameter:
entriesPerElement- number of entries associated with each element in the local representation
Level: developer
See also: DMSTAG, DMStagGetDOF()
External Links
- PETSc Manual:
DMStag/DMStagGetEntriesPerElement
PETSc.LibPETSc.DMStagGetGhostCorners — Method
x::PetscInt,y::PetscInt,z::PetscInt,m::PetscInt,n::PetscInt,p::PetscInt = DMStagGetGhostCorners(petsclib::PetscLibType, dm::AbstractPetscDM)return global element indices of the local region, including ghost points
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
x- the starting element index in the first directiony- the starting element index in the second directionz- the starting element index in the third directionm- the element width in the first directionn- the element width in the second directionp- the element width in the third direction
Level: beginner
See also: DMSTAG, DMStagGetCorners(), DMDAGetGhostCorners()
External Links
- PETSc Manual:
DMStag/DMStagGetGhostCorners
PETSc.LibPETSc.DMStagGetGlobalSizes — Method
M::PetscInt,N::PetscInt,P::PetscInt = DMStagGetGlobalSizes(petsclib::PetscLibType, dm::AbstractPetscDM)get global element counts
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
M- global element counts in the x directionN- global element counts in the y directionP- global element counts in the z direction
Level: beginner
See also: DMSTAG, DMStagGetLocalSizes(), DMDAGetInfo()
External Links
- PETSc Manual:
DMStag/DMStagGetGlobalSizes
PETSc.LibPETSc.DMStagGetIsFirstRank — Method
isFirstRank0::PetscBool,isFirstRank1::PetscBool,isFirstRank2::PetscBool = DMStagGetIsFirstRank(petsclib::PetscLibType, dm::AbstractPetscDM)get boolean value for whether this rank is first in each direction in the rank grid
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
isFirstRank0- whether this rank is first in the x directionisFirstRank1- whether this rank is first in the y directionisFirstRank2- whether this rank is first in the z direction
Level: intermediate
See also: DMSTAG, DMStagGetIsLastRank()
External Links
- PETSc Manual:
DMStag/DMStagGetIsFirstRank
PETSc.LibPETSc.DMStagGetIsLastRank — Method
isLastRank0::PetscBool,isLastRank1::PetscBool,isLastRank2::PetscBool = DMStagGetIsLastRank(petsclib::PetscLibType, dm::AbstractPetscDM)get boolean value for whether this rank is last in each direction in the rank grid
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
isLastRank0- whether this rank is last in the x directionisLastRank1- whether this rank is last in the y directionisLastRank2- whether this rank is last in the z direction
Level: intermediate
See also: DMSTAG, DMStagGetIsFirstRank()
External Links
- PETSc Manual:
DMStag/DMStagGetIsLastRank
PETSc.LibPETSc.DMStagGetLocalSizes — Method
m::PetscInt,n::PetscInt,p::PetscInt = DMStagGetLocalSizes(petsclib::PetscLibType, dm::AbstractPetscDM)get local elementwise sizes
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
m- local element counts (excluding ghosts) in the x directionn- local element counts (excluding ghosts) in the y directionp- local element counts (excluding ghosts) in the z direction
Level: beginner
See also: DMSTAG, DMStagGetGlobalSizes(), DMStagGetDOF(), DMStagGetNumRanks(), DMDAGetLocalInfo()
External Links
- PETSc Manual:
DMStag/DMStagGetLocalSizes
PETSc.LibPETSc.DMStagGetLocationDOF — Method
dof::PetscInt = DMStagGetLocationDOF(petsclib::PetscLibType, dm::AbstractPetscDM, loc::DMStagStencilLocation)Get number of DOF associated with a given point in a DMSTAG grid
Not Collective
Input Parameters:
dm- theDMSTAGobjectloc- grid point (seeDMStagStencilLocation)
Output Parameter:
dof- the number of DOF (components) living atlocindm
Level: intermediate
See also: DMSTAG, DMStagStencilLocation, DMStagStencil, DMDAGetDof()
External Links
- PETSc Manual:
DMStag/DMStagGetLocationDOF
PETSc.LibPETSc.DMStagGetLocationSlot — Method
slot::PetscInt = DMStagGetLocationSlot(petsclib::PetscLibType, dm::AbstractPetscDM, loc::DMStagStencilLocation, c::PetscInt)get index to use in accessing raw local arrays
Not Collective
Input Parameters:
dm- theDMSTAGobjectloc- location relative to an elementc- component
Output Parameter:
slot- index to use
Level: beginner
See also: DMSTAG, DMStagVecGetArray(), DMStagVecGetArrayRead(), DMStagGetDOF(), DMStagGetEntriesPerElement()
External Links
- PETSc Manual:
DMStag/DMStagGetLocationSlot
PETSc.LibPETSc.DMStagGetNumRanks — Method
nRanks0::PetscInt,nRanks1::PetscInt,nRanks2::PetscInt = DMStagGetNumRanks(petsclib::PetscLibType, dm::AbstractPetscDM)get number of ranks in each direction in the global grid decomposition
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
nRanks0- number of ranks in the x direction in the grid decompositionnRanks1- number of ranks in the y direction in the grid decompositionnRanks2- number of ranks in the z direction in the grid decomposition
Level: intermediate
See also: DMSTAG, DMStagGetGlobalSizes(), DMStagGetLocalSize(), DMStagSetNumRanks(), DMDAGetInfo()
External Links
- PETSc Manual:
DMStag/DMStagGetNumRanks
PETSc.LibPETSc.DMStagGetOwnershipRanges — Method
lx::Vector{PetscInt},ly::Vector{PetscInt},lz::Vector{PetscInt} = DMStagGetOwnershipRanges(petsclib::PetscLibType, dm::AbstractPetscDM)get elements per rank in each direction
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
lx- ownership along x direction (optional)ly- ownership along y direction (optional)lz- ownership along z direction (optional)
Level: intermediate
Notes: These correspond to the optional final arguments passed to DMStagCreate1d(), DMStagCreate2d(), and DMStagCreate3d().
Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
In C you should not free these arrays, nor change the values in them. They will only have valid values while the DMSTAG they came from still exists (has not been destroyed).
See also:
DMSTAG, DMStagSetGlobalSizes(), DMStagSetOwnershipRanges(), DMStagCreate1d(), DMStagCreate2d(), DMStagCreate3d(), DMDAGetOwnershipRanges()
External Links
- PETSc Manual:
DMStag/DMStagGetOwnershipRanges
PETSc.LibPETSc.DMStagGetProductCoordinateArrays — Method
arrX,arrY,arrZ = DMStagGetProductCoordinateArrays(petsclib::PetscLibType, dm::AbstractPetscDM)extract local product coordinate arrays, one per dimension
Logically Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
arrX- local 1D coordinate arrays for x directionarrY- local 1D coordinate arrays for y direction, not set for one dimensional problemsarrZ- local 1D coordinate arrays for z direction, not set for one and two dimensional problems
Level: intermediate
Notes: A high-level helper function to quickly extract local coordinate arrays.
Note that 2-dimensional arrays are returned. See DMStagVecGetArray(), which is called internally to produce these arrays representing coordinates on elements and vertices (element boundaries) for a 1-dimensional DMSTAG in each coordinate direction.
One should use DMStagGetProductCoordinateLocationSlot() to determine appropriate indices for the second dimension in these returned arrays. This function checks that the coordinate array is a suitable product of 1-dimensional DMSTAG objects.
See also:
DMSTAG, DMPRODUCT, DMStagGetProductCoordinateArraysRead(), DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesProduct(), DMStagGetProductCoordinateLocationSlot()
External Links
- PETSc Manual:
DMStag/DMStagGetProductCoordinateArrays
PETSc.LibPETSc.DMStagGetProductCoordinateArraysRead — Method
arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray = DMStagGetProductCoordinateArraysRead(petsclib::PetscLibType, dm::AbstractPetscDM)extract product coordinate arrays, read
Logically Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
arrX- local 1D coordinate arrays forxdirectionarrY- local 1D coordinate arrays forydirection, not set for one dimensional problemsarrZ- local 1D coordinate arrays forzdirection, not set for one and two dimensional problems
Level: intermediate
Note: See DMStagGetProductCoordinateArrays() for more information.
See also:
DMSTAG, DMPRODUCT, DMStagGetProductCoordinateArrays(), DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesProduct(), DMStagGetProductCoordinateLocationSlot()
External Links
- PETSc Manual:
DMStag/DMStagGetProductCoordinateArraysRead
PETSc.LibPETSc.DMStagGetRefinementFactor — Method
refine_x::PetscInt,refine_y::PetscInt,refine_z::PetscInt = DMStagGetRefinementFactor(petsclib::PetscLibType, dm::AbstractPetscDM)get refinement ratios in each direction
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameters:
refine_x- ratio of fine grid to coarse in x-direction (2 by default)refine_y- ratio of fine grid to coarse in y-direction (2 by default)refine_z- ratio of fine grid to coarse in z-direction (2 by default)
Level: intermediate
See also: DMSTAG, DMRefine(), DMCoarsen(), DMStagSetRefinementFactor(), DMDASetRefinementFactor()
External Links
- PETSc Manual:
DMStag/DMStagGetRefinementFactor
PETSc.LibPETSc.DMStagGetStencilType — Method
stencilType::DMStagStencilType = DMStagGetStencilType(petsclib::PetscLibType, dm::AbstractPetscDM)get elementwise ghost/halo stencil type
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameter:
stencilType- the elementwise ghost stencil type:DMSTAG_STENCIL_BOX,DMSTAG_STENCIL_STAR, orDMSTAG_STENCIL_NONE
Level: beginner
See also: DMSTAG, DMStagSetStencilType(), DMStagGetStencilWidth, DMStagStencilType
External Links
- PETSc Manual:
DMStag/DMStagGetStencilType
PETSc.LibPETSc.DMStagGetStencilWidth — Method
stencilWidth::PetscInt = DMStagGetStencilWidth(petsclib::PetscLibType, dm::AbstractPetscDM)get elementwise stencil width
Not Collective
Input Parameter:
dm- theDMSTAGobject
Output Parameter:
stencilWidth- stencil/halo/ghost width in elements
Level: beginner
See also: DMSTAG, DMStagSetStencilWidth(), DMStagGetStencilType(), DMDAGetStencilType()
External Links
- PETSc Manual:
DMStag/DMStagGetStencilWidth
PETSc.LibPETSc.DMStagMatGetValuesStencil — Method
val::Vector{PetscScalar} = DMStagMatGetValuesStencil(petsclib::PetscLibType, dm::AbstractPetscDM, mat::AbstractPetscMat, nRow::PetscInt, posRow::Vector{DMStagStencil}, nCol::PetscInt, posCol::Vector{DMStagStencil})retrieve local matrix entries using grid indexing
Not Collective
Input Parameters:
dm- theDMSTAGobjectmat- the matrixnRow- number of rowsposRow- grid locations (including components) of rowsnCol- number of columnsposCol- grid locations (including components) of columns
Output Parameter:
val- logically two-dimensional array of values
Level: advanced
See also: DMSTAG, DMStagStencil, DMStagStencilLocation, DMStagVecGetValuesStencil(), DMStagVecSetValuesStencil(), DMStagMatSetValuesStencil(), MatSetValuesStencil(), MatAssemblyBegin(), MatAssemblyEnd(), DMCreateMatrix()
External Links
- PETSc Manual:
DMStag/DMStagMatGetValuesStencil
PETSc.LibPETSc.DMStagMatSetValuesStencil — Method
DMStagMatSetValuesStencil(petsclib::PetscLibType, dm::AbstractPetscDM, mat::AbstractPetscMat, nRow::PetscInt, posRow::Vector{DMStagStencil}, nCol::PetscInt, posCol::Vector{DMStagStencil}, val::Vector{PetscScalar}, insertMode::InsertMode)insert or add matrix entries using grid indexing
Not Collective
Input Parameters:
dm- theDMSTAGobjectmat- the matrixnRow- number of rowsposRow- grid locations (including components) of rowsnCol- number of columnsposCol- grid locations (including components) of columnsval- logically two-dimensional array of valuesinsertMode-INSERT_VALUESorADD_VALUES
See also: DMSTAG, DMStagStencil, DMStagStencilLocation, DMStagVecGetValuesStencil(), DMStagVecSetValuesStencil(), DMStagMatGetValuesStencil(), MatSetValuesStencil(), MatAssemblyBegin(), MatAssemblyEnd(), DMCreateMatrix()
External Links
- PETSc Manual:
DMStag/DMStagMatSetValuesStencil
PETSc.LibPETSc.DMStagMigrateVec — Method
DMStagMigrateVec(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, dmTo::AbstractPetscDM, vecTo::AbstractPetscVec)transfer a vector associated with a DMSTAG to a vector associated with a compatible DMSTAG
Collective
Input Parameters:
dm- the sourceDMSTAGobjectvec- the source vector, compatible withdmdmTo- the compatible destinationDMSTAGobjectvecTo- the destination vector, compatible withdmTo
Level: advanced
See also: DMSTAG, DMStagCreateCompatibleDMStag(), DMGetCompatibility(), DMStagVecSplitToDMDA()
External Links
- PETSc Manual:
DMStag/DMStagMigrateVec
PETSc.LibPETSc.DMStagPopulateLocalToGlobalInjective — Method
DMStagPopulateLocalToGlobalInjective(petsclib::PetscLibType, dm::AbstractPetscDM)populate an internal 1-to-1 local-to-global map
Collective
Creates an internal object which explicitly maps a single local degree of freedom to each global degree of freedom. This is used, if populated, instead of SCATTERREVERSELOCAL with the (1-to-many, in general) global-to-local map, when DMLocalToGlobal() is called with INSERT_VALUES. This allows usage, for example, even in the periodic, 1-rank case, where the inverse of the global-to-local map, even when restricted to on-rank communication, is non-injective. This is at the cost of storing an additional VecScatter object inside each DMSTAG object.
Input Parameter:
dm- theDMSTAGobject
Level: developer
See also: DMSTAG, DMLocalToGlobal(), VecScatter
External Links
- PETSc Manual:
DMStag/DMStagPopulateLocalToGlobalInjective
PETSc.LibPETSc.DMStagRestoreProductCoordinateArrays — Method
DMStagRestoreProductCoordinateArrays(petsclib::PetscLibType, dm::AbstractPetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray)restore local array access
Logically Collective
Input Parameter:
dm- theDMSTAGobjectarrX- local 1D coordinate arrays for x directionarrY- local 1D coordinate arrays for y directionarrZ- local 1D coordinate arrays for z direction
Level: intermediate
Notes: This function does not automatically perform a local->global scatter to populate global coordinates from the local coordinates. Thus, it may be required to explicitly perform these operations in some situations, as in the following partial example:
PetscCall(DMGetCoordinateDM(dm, &cdm));
for (PetscInt d = 0; d < 3; ++d) {
DM subdm;
Vec coor, coor_local;
PetscCall(DMProductGetDM(cdm, d, &subdm));
PetscCall(DMGetCoordinates(subdm, &coor));
PetscCall(DMGetCoordinatesLocal(subdm, &coor_local));
PetscCall(DMLocalToGlobal(subdm, coor_local, INSERT_VALUES, coor));
PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Coordinates dim %" PetscInt_FMT ":
", d));
PetscCall(VecView(coor, PETSC_VIEWER_STDOUT_WORLD));
}See also:
DMSTAG, DMStagGetProductCoordinateArrays(), DMStagGetProductCoordinateArraysRead()
External Links
- PETSc Manual:
DMStag/DMStagRestoreProductCoordinateArrays
PETSc.LibPETSc.DMStagRestoreProductCoordinateArraysRead — Method
DMStagRestoreProductCoordinateArraysRead(petsclib::PetscLibType, dm::AbstractPetscDM, arrX::PetscArray, arrY::PetscArray, arrZ::PetscArray)restore local product array access, read
Logically Collective
Input Parameters:
dm- theDMSTAGobjectarrX- local 1D coordinate arrays for x directionarrY- local 1D coordinate arrays for y directionarrZ- local 1D coordinate arrays for z direction
Level: intermediate
See also:
DMSTAG, DMStagGetProductCoordinateArrays(), DMStagGetProductCoordinateArraysRead()
External Links
- PETSc Manual:
DMStag/DMStagRestoreProductCoordinateArraysRead
PETSc.LibPETSc.DMStagRestrictSimple — Method
DMStagRestrictSimple(petsclib::PetscLibType, dmf::AbstractPetscDM, xf::AbstractPetscVec, dmc::AbstractPetscDM, xc::AbstractPetscVec)restricts data from a fine to a coarse DMSTAG, in the simplest way
Values on coarse cells are averages of all fine cells that they cover. Thus, values on vertices are injected, values on edges are averages of the underlying two fine edges, and values on elements in d dimensions are averages of 2^d underlying elements.
Input Parameters:
dmf- fineDMxf- data on fineDMdmc- coarseDM
Output Parameter:
xc- data on coarseDM
Level: advanced
See also: DMSTAG, DM, DMRestrict(), DMCoarsen(), DMCreateInjection()
External Links
- PETSc Manual:
DMStag/DMStagRestrictSimple
PETSc.LibPETSc.DMStagSetBoundaryTypes — Method
DMStagSetBoundaryTypes(petsclib::PetscLibType, dm::AbstractPetscDM, boundaryType0::DMBoundaryType, boundaryType1::DMBoundaryType, boundaryType2::DMBoundaryType)set DMSTAG boundary types
Logically Collective; boundaryType0, boundaryType1, and boundaryType2 must contain common values
Input Parameters:
dm- theDMSTAGobjectboundaryType2- boundary type for x directionboundaryType1- boundary type for y direction, not set for one dimensional problemsboundaryType0- boundary type for z direction, not set for one and two dimensional problems
Level: advanced
See also: DMSTAG, DMBoundaryType, DMStagCreate1d(), DMStagCreate2d(), DMStagCreate3d(), DMDASetBoundaryType()
External Links
- PETSc Manual:
DMStag/DMStagSetBoundaryTypes
PETSc.LibPETSc.DMStagSetCoordinateDMType — Method
DMStagSetCoordinateDMType(petsclib::PetscLibType, dm::AbstractPetscDM, dmtype::String)set DM type to store coordinates
Logically Collective; dmtype must contain common value
Input Parameters:
dm- theDMSTAGobjectdmtype-DMtypefor coordinates, eitherDMSTAGorDMPRODUCT
Level: advanced
See also: DMSTAG, DMPRODUCT, DMGetCoordinateDM(), DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesExplicit(), DMStagSetUniformCoordinatesProduct(), DMType
External Links
- PETSc Manual:
DMStag/DMStagSetCoordinateDMType
PETSc.LibPETSc.DMStagSetDOF — Method
DMStagSetDOF(petsclib::PetscLibType, dm::AbstractPetscDM, dof0::PetscInt, dof1::PetscInt, dof2::PetscInt, dof3::PetscInt)set dof/stratum
Logically Collective; dof0, dof1, dof2, and dof3 must contain common values
Input Parameters:
dm- theDMSTAGobjectdof0- the number of points per 0-cell (vertex/node)dof1- the number of points per 1-cell (element in 1D, edge in 2D and 3D)dof2- the number of points per 2-cell (element in 2D, face in 3D)dof3- the number of points per 3-cell (element in 3D)
Level: advanced
See also: DMSTAG, DMDASetDof()
External Links
- PETSc Manual:
DMStag/DMStagSetDOF
PETSc.LibPETSc.DMStagSetGlobalSizes — Method
DMStagSetGlobalSizes(petsclib::PetscLibType, dm::AbstractPetscDM, N0::PetscInt, N1::PetscInt, N2::PetscInt)set global element counts in each direction
Logically Collective; N0, N1, and N2 must contain common values
Input Parameters:
dm- theDMSTAGobjectN0- global elementwise size in the x directionN1- global elementwise size in the y directionN2- global elementwise size in the z direction
Level: advanced
See also: DMSTAG, DMStagGetGlobalSizes(), DMDASetSizes()
External Links
- PETSc Manual:
DMStag/DMStagSetGlobalSizes
PETSc.LibPETSc.DMStagSetNumRanks — Method
DMStagSetNumRanks(petsclib::PetscLibType, dm::AbstractPetscDM, nRanks0::PetscInt, nRanks1::PetscInt, nRanks2::PetscInt)set ranks in each direction in the global rank grid
Logically Collective; nRanks0, nRanks1, and nRanks2 must contain common values
Input Parameters:
dm- theDMSTAGobjectnRanks0- number of ranks in the x directionnRanks1- number of ranks in the y directionnRanks2- number of ranks in the z direction
Level: developer
See also: DMSTAG, DMDASetNumProcs()
External Links
- PETSc Manual:
DMStag/DMStagSetNumRanks
PETSc.LibPETSc.DMStagSetOwnershipRanges — Method
DMStagSetOwnershipRanges(petsclib::PetscLibType, dm::AbstractPetscDM, lx::Vector{PetscInt}, ly::Vector{PetscInt}, lz::Vector{PetscInt})set elements per rank in each direction
Logically Collective; lx, ly, and lz must contain common values
Input Parameters:
dm- theDMSTAGobjectlx- element counts for each rank in the x direction, may beNULLly- element counts for each rank in the y direction, may beNULLlz- element counts for each rank in the z direction, may beNULL
Level: developer
See also: DMSTAG, DMStagSetGlobalSizes(), DMStagGetOwnershipRanges(), DMDASetOwnershipRanges()
External Links
- PETSc Manual:
DMStag/DMStagSetOwnershipRanges
PETSc.LibPETSc.DMStagSetRefinementFactor — Method
DMStagSetRefinementFactor(petsclib::PetscLibType, dm::AbstractPetscDM, refine_x::PetscInt, refine_y::PetscInt, refine_z::PetscInt)set refinement ratios in each direction
Logically Collective
Input Parameters:
dm- theDMSTAGobjectrefine_x- ratio of fine grid to coarse in x-direction (2 by default)refine_y- ratio of fine grid to coarse in y-direction (2 by default)refine_z- ratio of fine grid to coarse in z-direction (2 by default)
Level: intermediate
See also: DMSTAG, DMRefine(), DMCoarsen(), DMStagGetRefinementFactor(), DMDAGetRefinementFactor()
External Links
- PETSc Manual:
DMStag/DMStagSetRefinementFactor
PETSc.LibPETSc.DMStagSetStencilType — Method
DMStagSetStencilType(petsclib::PetscLibType, dm::AbstractPetscDM, stencilType::DMStagStencilType)set elementwise ghost/halo stencil type
Logically Collective; stencilType must contain common value
Input Parameters:
dm- theDMSTAGobjectstencilType- the elementwise ghost stencil type:DMSTAG_STENCIL_BOX,DMSTAG_STENCIL_STAR, orDMSTAG_STENCIL_NONE
Level: beginner
See also: DMSTAG, DMStagGetStencilType(), DMStagSetStencilWidth(), DMStagStencilType
External Links
- PETSc Manual:
DMStag/DMStagSetStencilType
PETSc.LibPETSc.DMStagSetStencilWidth — Method
DMStagSetStencilWidth(petsclib::PetscLibType, dm::AbstractPetscDM, stencilWidth::PetscInt)set elementwise stencil width
Logically Collective; stencilWidth must contain common value
Input Parameters:
dm- theDMSTAGobjectstencilWidth- stencil/halo/ghost width in elements
Level: beginner
See also: DMSTAG, DMStagGetStencilWidth(), DMStagGetStencilType(), DMStagStencilType
External Links
- PETSc Manual:
DMStag/DMStagSetStencilWidth
PETSc.LibPETSc.DMStagSetUniformCoordinates — Method
DMStagSetUniformCoordinates(petsclib::PetscLibType, dm::AbstractPetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal)set DMSTAG coordinates to be a uniform grid
Collective
Input Parameters:
dm- theDMSTAGobjectxmin- minimum global coordinate value in thexdirectionxmax- maximum global coordinate values in thexdirectionymin- minimum global coordinate value in theydirectionymax- maximum global coordinate value in theydirectionzmin- minimum global coordinate value in thezdirectionzmax- maximum global coordinate value in thezdirection
Level: advanced
See also: DMSTAG, DMPRODUCT, DMStagSetUniformCoordinatesExplicit(), DMStagSetUniformCoordinatesProduct(), DMStagSetCoordinateDMType(), DMGetCoordinateDM(), DMGetCoordinates(), DMDASetUniformCoordinates(), DMBoundaryType
External Links
- PETSc Manual:
DMStag/DMStagSetUniformCoordinates
PETSc.LibPETSc.DMStagSetUniformCoordinatesExplicit — Method
DMStagSetUniformCoordinatesExplicit(petsclib::PetscLibType, dm::AbstractPetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal)set DMSTAG coordinates to be a uniform grid, storing all values
Collective
Input Parameters:
dm- theDMSTAGobjectxmin- minimum global coordinate value in thexdirectionxmax- maximum global coordinate value in thexdirectionymin- minimum global coordinate value in theydirectionymax- maximum global coordinate value in theydirectionzmin- minimum global coordinate value in thezdirectionzmax- maximum global coordinate value in thezdirection
Level: beginner
See also: DMSTAG, DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesProduct(), DMStagSetCoordinateDMType()
External Links
- PETSc Manual:
DMStag/DMStagSetUniformCoordinatesExplicit
PETSc.LibPETSc.DMStagSetUniformCoordinatesProduct — Method
DMStagSetUniformCoordinatesProduct(petsclib::PetscLibType, dm::AbstractPetscDM, xmin::PetscReal, xmax::PetscReal, ymin::PetscReal, ymax::PetscReal, zmin::PetscReal, zmax::PetscReal)create uniform coordinates, as a product of 1D arrays
Set the coordinate DM to be a DMPRODUCT of 1D DMSTAG objects, each of which have a coordinate DM (also a 1d DMSTAG) holding uniform coordinates.
Collective
Input Parameters:
dm- theDMSTAGobjectxmin- minimum global coordinate value in thexdirectionxmax- maximum global coordinate value in thexdirectionymin- minimum global coordinate value in theydirectionymax- maximum global coordinate value in theydirectionzmin- minimum global coordinate value in thezdirectionzmax- maximum global coordinate value in thezdirection
Level: intermediate
See also: DMSTAG, DMPRODUCT, DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesExplicit(), DMStagSetCoordinateDMType()
External Links
- PETSc Manual:
DMStag/DMStagSetUniformCoordinatesProduct
PETSc.LibPETSc.DMStagStencilToIndexLocal — Method
ix::Vector{PetscInt} = DMStagStencilToIndexLocal(petsclib::PetscLibType, dm::AbstractPetscDM, dim::PetscInt, n::PetscInt, pos::Vector{DMStagStencil})Convert an array of DMStagStencil objects to an array of indices into a local vector.
Not Collective
Input Parameters:
dm- theDMSTAGobjectdim- the dimension of theDMSTAGobjectn- the number ofDMStagStencilobjectspos- an array ofnDMStagStencilobjects
Output Parameter:
ix- output array ofnindices
See also: DMSTAG, DMStagStencilLocation, DMStagStencil, DMGetLocalVector, DMCreateLocalVector
External Links
- PETSc Manual:
DMStag/DMStagStencilToIndexLocal
PETSc.LibPETSc.DMStagVecGetArray — Method
array::PetscArray = DMStagVecGetArray(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec)get access to local array
Logically Collective
Input Parameters:
dm- theDMSTAGobjectvec- theVecobject
Output Parameter:
array- the array
Level: beginner
Note: This function returns a (dim+1)-dimensional array for a dim-dimensional DMSTAG.
Also: in Julia we use OffsetArrays, such that index 1 (e.g. array[1] always refers to the true first point in the domain, and array[0] would be the ghost point (if available) .
The first 1-3 dimensions indicate an element in the global numbering, using the standard C ordering.
The final dimension in this array corresponds to a degree of freedom with respect to this element, for example corresponding to the element or one of its neighboring faces, edges, or vertices.
For example, for a 3D DMSTAG, indexing is array[k][j][i][idx], where k is the index in the z-direction, j is the index in the y-direction, and i is the index in the x-direction.
idx is obtained with DMStagGetLocationSlot(), since the correct offset into the (d+1)-dimensional C array for a d-dimensional DMSTAG depends on the grid size and the number of DOF stored at each location.
DMStagVecRestoreArray() must be called, once finished with the array
See also:
DMSTAG, DMStagVecGetArrayRead(), DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector(), DMDAVecGetArray(), DMDAVecGetArrayDOF()
External Links
- PETSc Manual:
DMStag/DMStagVecGetArray
PETSc.LibPETSc.DMStagVecGetArrayRead — Method
array::PetscArray = DMStagVecGetArrayRead(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec)get read
Logically Collective
See the man page for DMStagVecGetArray() for more information.
Input Parameters:
dm- theDMSTAGobjectvec- theVecobject
Output Parameter:
array- the read-only array
Level: beginner
Note: DMStagVecRestoreArrayRead() must be called, once finished with the array
See also:
DMSTAG, DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector(), DMDAVecGetArrayRead(), DMDAVecGetArrayDOFRead()
External Links
- PETSc Manual:
DMStag/DMStagVecGetArrayRead
PETSc.LibPETSc.DMStagVecGetValuesStencil — Method
val::PetscScalar = DMStagVecGetValuesStencil(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, n::PetscInt, pos::DMStagStencil)get vector values using grid indexing
Not Collective
Input Parameters:
dm- theDMSTAGobjectvec- the vector objectn- the number of values to obtainpos- locations to obtain values from (as an array ofDMStagStencilvalues)
Output Parameter:
val- value at the point
Notes: Accepts stencils which refer to global element numbers, but only allows access to entries in the local representation (including ghosts).
This approach is not as efficient as getting values directly with DMStagVecGetArray(), which is recommended for matrix-free operators.
Level: advanced
See also:
DMSTAG, DMStagStencil, DMStagStencilLocation, DMStagVecSetValuesStencil(), DMStagMatSetValuesStencil(), DMStagVecGetArray()
External Links
- PETSc Manual:
DMStag/DMStagVecGetValuesStencil
PETSc.LibPETSc.DMStagVecRestoreArray — Method
DMStagVecRestoreArray(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, array::PetscArray)restore access to a raw array
Logically Collective
Input Parameters:
dm- theDMSTAGobjectvec- theVecobject
Output Parameter:
array- the array
Level: beginner
See also:
DMSTAG, DMStagVecGetArray(), DMDAVecRestoreArray(), DMDAVecRestoreArrayDOF()
External Links
- PETSc Manual:
DMStag/DMStagVecRestoreArray
PETSc.LibPETSc.DMStagVecRestoreArrayRead — Method
DMStagVecRestoreArrayRead(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, array::PetscArray)restore read
Logically Collective
Input Parameters:
dm- theDMSTAGobjectvec- the Vec object
Output Parameter:
array- the read-only array
Level: beginner
See also:
DMSTAG, DMStagVecGetArrayRead(), DMDAVecRestoreArrayRead(), DMDAVecRestoreArrayDOFRead()
External Links
- PETSc Manual:
DMStag/DMStagVecRestoreArrayRead
PETSc.LibPETSc.DMStagVecSetValuesStencil — Method
DMStagVecSetValuesStencil(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, n::PetscInt, pos::Vector{DMStagStencil}, val::Vector{PetscScalar}, insertMode::InsertMode)Set Vec values using global grid indexing
Not Collective
Input Parameters:
dm- theDMSTAGobjectvec- theVecn- the number of values to setpos- the locations to set values, as an array ofDMStagStencilstructsval- the values to setinsertMode-INSERT_VALUESorADD_VALUES
See also: DMSTAG, Vec, DMStagStencil, DMStagStencilLocation, DMStagVecGetValuesStencil(), DMStagMatSetValuesStencil(), DMCreateGlobalVector(), DMGetLocalVector(), DMStagVecGetArray()
External Links
- PETSc Manual:
DMStag/DMStagVecSetValuesStencil
PETSc.LibPETSc.DMStagVecSplitToDMDA — Method
pda::PetscDM,pdavec::PetscVec = DMStagVecSplitToDMDA(petsclib::PetscLibType, dm::AbstractPetscDM, vec::AbstractPetscVec, loc::DMStagStencilLocation, c::PetscInt)create a DMDA and Vec from a subgrid of a DMSTAG and its Vec
Collective
Input Parameters:
dm- theDMSTAGobjectvec-Vecobject associated withdmloc- which subgrid to extract (seeDMStagStencilLocation)c- which component to extract (see note below)
Output Parameters:
pda- theDMDApdavec- the newVec
Level: advanced
See also: DMSTAG, DMDA, DMStagStencilLocation, DM, Vec, DMStagMigrateVec(), DMStagCreateCompatibleDMStag()
External Links
- PETSc Manual:
DMStag/DMStagVecSplitToDMDA