DMStag
The following DMStag
routines are available:
Base.empty
— Methodempty(dm::DMStag)
return an uninitialized DMStag
struct.
PETSc.DMLocalToGlobal
— FunctionDMLocalToGlobal(
dm::DMStag,
l::AbstractVec,
mode::InsertMode,
g::AbstractVec
)
Updates global vectors from local vectors.
dm - the DM object
l - the local vector
mode - if INSERT_VALUES then no parallel communication is used, if ADD_VALUES then all ghost points from the same base point accumulate into that base point.
g - the global vector
External Links
- PETSc Manual:
DM/DMLocalToGlobal
PETSc.DMStagCreate1d
— Functiondm = DMStagCreate1d(::PetscLib,
comm::MPI.Comm,
bndx::DMBoundaryType,
M,
dofVertex,
dofCenter,
stencilType::DMStagStencilType=DMSTAG_STENCIL_BOX,
stencilWidth=2,
lx=C_NULL;
dmsetfromoptions=true,
dmsetup=true,
options...
)
Creates a 1D DMStag object. ::PetscLib - PETSc library, comm - MPI communicator bndx - boundary type: DMBOUNDARYNONE, DMBOUNDARYPERIODIC, or DMBOUNDARYGHOSTED. M - global number of grid points dofVertex - [=1] number of degrees of freedom per vertex/point/node/0-cell dofCenter - [=1] number of degrees of freedom per element/edge/1-cell stencilType - ghost/halo region type: DMSTAGSTENCILBOX or DMSTAGSTENCILNONE stencilWidth - width, in elements, of halo/ghost region lx - [Optional] Vector of local sizes, of length equal to the comm size, summing to M options... - [Optional] keyword arguments (see PETSc webpage), specifiable as staggridx=100, etc.
Creates a 1-D distributed staggered array with the options specified using keyword arguments.
If keyword argument dmsetfromoptions == true
then setfromoptions!
called. If keyword argument dmsetup == true
then setup!
is called.
External Links
- PETSc Manual:
DMSTAG/DMStagCreate1d
PETSc.DMStagCreate2d
— Functiondm = DMStagCreate2d(
::PetscLib,
comm::MPI.Comm,
bndx::DMBoundaryType,
bndy::DMBoundaryType,
M, N,
m=C_NULL, n=C_NULL,
dofVertex=1,
dofEdge=1,
dofElement=1,
stencilType::DMStagStencilType=DMSTAG_STENCIL_BOX,
stencilWidth=2,
lx=C_NULL, ly=C_NULL;
dmsetfromoptions=true,
dmsetup=true,
options...
)
Creates a 2D DMStag object.
If keyword argument dmsetfromoptions == true
then setfromoptions!
called. If keyword argument dmsetup == true
then setup!
is called.
External Links
- PETSc Manual:
DMSTAG/DMStagCreate2d
PETSc.DMStagCreate3d
— Functiondm = DMStagCreate3d(
::PetscLib,
comm::MPI.Comm,
bndx::DMBoundaryType, bndy::DMBoundaryType, bndz::DMBoundaryType,
M, N, P,
m, n, p,
dofVertex,
dofEdge,
dofFace,
dofElement,
stencilType::DMStagStencilType=DMSTAG_STENCIL_BOX,
stencilWidth,
lx, ly, lz;
dmsetfromoptions=true,
dmsetup=true,
options...
)
Creates a 3D DMStag object.
If keyword argument dmsetfromoptions == true
then setfromoptions!
called. If keyword argument dmsetup == true
then setup!
is called.
External Links
- PETSc Manual:
DMSTAG/DMStagCreate3d
PETSc.DMStagCreateCompatibleDMStag
— Functiondm = DMStagCreateCompatibleDMStag(
dm::DMStag,
dofVertex,
dofEdge,
dofFace,
dofElement;
kwargs...)
Creates a compatible DMStag with different dof/stratum
dm - the DMStag object
dofVertex - [=0] number of degrees of freedom per vertex/point/node/0-cell
dofEdge - [=0] number of degrees of freedom per edge/1-cell
dofFace - [=0] number of degrees of freedom per face/2-cell
dofElement - [=0] number of degrees of freedom per element/3-cell
kwargs... - [Optional] keyword arguments (see PETSc webpage), specifiable as stag_grid_x=100, etc.
External Links
- PETSc Manual:
DMSTAG/DMStagCreateCompatibleDMStag
PETSc.DMStagGetBoundaryTypes
— FunctionBx = DMStagGetBoundaryTypes(dm::DMStag) in 1D
Bx,By,Bz = DMStagGetBoundaryTypes(dm::DMStag) in 3D
Get boundary types.
dm - the DMStag object
Bx,By,Bz - boundary types
External Links
- PETSc Manual:
DMSTAG/DMStagGetBoundaryTypes
PETSc.DMStagGetDOF
— Functiondof0,dof1,dof2,dof3 = DMStagGetDOF(dm::DMStag)
Get number of DOF associated with each stratum of the grid.
dm - the DMStag object
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)
External Links
- PETSc Manual:
DMSTAG/DMStagGetDOF
PETSc.DMStagGetEntriesPerElement
— FunctionentriesPerElement = DMStagGetEntriesPerElement(dm::DMStag)
Get number of entries per element in the local representation.
dm - the DMStag objects
entriesPerElement - number of entries associated with each element in the local representation
External Links
- PETSc Manual:
DMSTAG/DMStagGetEntriesPerElement
PETSc.DMStagGetGhostArrayLocationSlot
— FunctionArray = DMStagGetGhostArrayLocationSlot(
dm::DMStag,
v::AbstractVec,
loc::DMStagStencilLocation,
dof::Int
)
Julia routine that extracts an array related to a certain DOF. Modifying values in the array will change them in the local PetscVec. Use LocalToGlobal to update global vector values.
Usage:
Input:
dm - the DMStag object
v,ArrayFull - the local vector as obtained with DMCreateLocalVector, can also be a local array
loc - a DMStagStencilLocation
dof - the degree of freedom on loc, which you want to extracts
Output:
Array - local array that includes the ghost points, that is linked to the vector `v`.
Modifying values in Array will update `v`
PETSc.DMStagGetGlobalSizes
— FunctionM,N,P = DMStagGetGlobalSizes(dm::DMStag)
Gets the global size of the DMStag object
dm - the DMStag object
M,N,P - size in x,y,z
External Links
- PETSc Manual:
DMSTAG/DMStagGetGlobalSizes
PETSc.DMStagGetIndices
— FunctionIndices = DMStagGetIndices(dm::DMStag)
Return indices of start and end of the central/vertex nodes of a local array built from the input dm
. This takes ghost points into account and helps
dm - the DMStag object
Indices - indices of lower and upper range of center and vertex nodes
PETSc.DMStagGetIsFirstRank
— Functionfr_X,fr_Y,fr_Z = DMStagGetIsFirstRank(dm::DMStag)
Returns boolean value to indicate whether this rank is first in each direction in the rank grid. Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
dm - the DMStag object
fr_X,fr_Y,fr_Z - whether this rank is first in each direction
External Links
- PETSc Manual:
DMSTAG/DMStagGetIsFirstRank
PETSc.DMStagGetIsLastRank
— Functionfr_X,fr_Y,fr_Z = DMStagGetIsLastRank(dm::DMStag)
Returns boolean value to indicate whether this rank is last in each direction in the rank grid.
dm - the DMStag object
fr_X,fr_Y,fr_Z - whether this rank is last in each direction
External Links
- PETSc Manual:
DMSTAG/DMStagGetIsLastRank
PETSc.DMStagGetLocalSizes
— FunctionM,N,P = DMStagGetLocalSizes(dm::DMStag)
Gets the local size of the DMStag object
dm - the DMStag object
M,N,P - size in x,y,z
External Links
- PETSc Manual:
DMSTAG/DMStagGetLocalSizes
PETSc.DMStagGetLocationSlot
— Functionslot = DMStagGetLocationSlot(
dm::DMStag,
loc::DMStagStencilLocation,
c
)
Get index to use in accessing raw local arrays.
dm - the DMStag object
loc - location relative to an element
c - component ( the degree of freedom)
slot - index to use
External Links
- PETSc Manual:
DMSTAG/DMStagGetLocationSlot
PETSc.DMStagGetNumRanks
— FunctionnRanks0 = DMStagGetNumRanks(dm::DMStag) in 1D
nRanks0,nRanks1,nRanks2 = DMStagGetNumRanks(dm::DMStag) in 3D
Get number of ranks in each direction in the global grid decomposition.
dm - the DMStag object
nRanks0,nRanks1,nRanks2 - number of ranks in each direction in the grid decomposition
External Links
- PETSc Manual:
DMSTAG/DMStagGetNumRanks
PETSc.DMStagGetProductCoordinateLocationSlot
— Functionslot = DMStagGetProductCoordinateLocationSlot(
dm::DMStag,
loc::DMStagStencilLocation
)
Get slot for use with local product coordinate arrays.
dm - the DMStag object
loc - the grid location
slot - the index to use in local arrays
External Links
- PETSc Manual:
DMSTAG/DMStagGetProductCoordinateLocationSlot
PETSc.DMStagGetStencilType
— FunctionstencilType = DMStagGetStencilType(dm::DMStag)
Get elementwise ghost/halo stencil type.
dm - the DMStag object
stencilType - the elementwise ghost stencil type: DMSTAG_STENCIL_BOX, DMSTAG_STENCIL_STAR, or DMSTAG_STENCIL_NONE
External Links
- PETSc Manual:
DMSTAG/DMStagGetStencilType
PETSc.DMStagGetStencilWidth
— FunctionstencilWidth = DMStagGetStencilWidth(dm::DMStag)
Get elementwise stencil width.
dm - the DMStag objects
stencilWidth - stencil/halo/ghost width in elements
External Links
- PETSc Manual:
DMSTAG/DMStagGetStencilWidth
PETSc.DMStagMatGetValuesStencil
— Functionval = DMStagMatGetValuesStencil(
dm::DMStag,
mat::AbstractMat{PetscScalar},
nRow,
posRow::Vector{DMStagStencil},
nCol,
posCol::Vector{DMStagStencil}
)
This reads a single value from a matrix DMStagStencil.
dm - the DMStag object
mat - the Mat
posRow - the location of the row of the set value, given by a DMStagStencil struct (as a vector)
posCol - the location of the row of the set value, given by a DMStagStencil struct (as a vector)
val - the value
External Links
- PETSc Manual:
DMSTAG/DMStagMatGetValuesStencil
PETSc.DMStagMatSetValuesStencil
— FunctionDMStagMatSetValuesStencil(
dm::DMStag,
mat::AbstractMat,
nRow,
posRow::Vector{DMStagStencil},
nCol,
posCol::Vector{DMStagStencil},
values::Vector{PetscScalar},
insertMode::InsertMode
)
This puts values inside a matrix using DMStagStencil position
dm - the DMStag object
mat - the Mat
posRow - the location of the row of the set value, given by a DMStagStencil struct (as a vector)
posCol - the location of the row of the set value, given by a DMStagStencil struct (as a vector)
val - the value to be set
insertMode - INSERT_VALUES or ADD_VALUES
External Links
- PETSc Manual:
DMSTAG/DMStagMatSetValuesStencil
PETSc.DMStagSetUniformCoordinatesExplicit
— FunctionDMStagSetUniformCoordinatesExplicit(
dm::DMStag,
xmin, xmax,
ymin=0, ymax=0,
zmin=0, zmax=0
)
Set DMStag coordinates to be a uniform grid, storing all values.
dm - the DMStag object
xmin,xmax,ymin,ymax,zmin,zmax - maximum and minimum global coordinate values
External Links
- PETSc Manual:
DMSTAG/DMStagSetUniformCoordinatesExplicit
PETSc.DMStagVecGetArray
— FunctionX1 = DMStagVecGetArray(dm::DMStag, v::Vector)
Returns a julia array from a vector v
, in the same shape as the DMSTAG, which can be used to set values.
PETSc.DMStagVecGetArrayRead
— FunctionArray = DMStagVecGetArrayRead(dm::DMStag, v::AbstractVec)
Get read-only access to a local array (including ghost points) of the DMStag
dm - the DMStag object
vec - the Vec object
Array - the read-only array
PETSc.DMStagVecGetValuesStencil
— Functionval = DMStagVecGetValuesStencil(
dm::DMStag,
vec::AbstractVec,
n,
pos::Vector{DMStagStencil}
)
Get vector values using grid indexing.
dm - the DMStag object
vec - the vector object
n - the number of values to obtain (do not fill if only one)
pos - locations to obtain values from (as an array of DMStagStencil values)
val - value at the point
External Links
- PETSc Manual:
DMSTAG/DMStagVecGetValuesStencil
PETSc.DMStagVecSetValuesStencil
— FunctionDMStagVecSetValuesStencil(
dm::DMStag,
vec::AbstractVec{PetscScalar},
n,
pos::Vector{DMStagStencil},
values::Vector{PetscScalar},
insertMode::InsertMode
)
This puts values inside a global vector using DMStagStencil
dm - the DMStag object
vec - the Vec
n - the number of values (do not fill if only 1)
pos - the location of the set values, given by a DMStagStencil struct
val - the value to be set
insertMode - INSERT_VALUES or ADD_VALUES
External Links
- PETSc Manual:
DMSTAG/DMStagVecGetValuesStencil
PETSc.LocalInGlobalIndices
— Functionindices = LocalInGlobalIndices(dm::DMStag)
Give the non-ghosted indices in the local vector that contribute to the global vector.
dm - the DMStag object
indices - local indices
PETSc.destroy
— Methoddestroy(dm::DMStag)
Destroys a DMSTAG object and releases the memory
dm - the DM object to destroy
External Links
- PETSc Manual:
DM/DMDestroy
PETSc.getcorners
— Methodgetcorners(dm::DMSTAG)
Returns a NamedTuple
with the global indices (excluding ghost points) of the lower
and upper
corners as well as the size
.
External Links
- PETSc Manual:
DMSTAG/DMStagGetCorners
PETSc.getghostcorners
— Methodgetghostcorners(dm::DMStag)
Returns a NamedTuple
with the global indices (including ghost points) of the lower
and upper
corners as well as the size
.
External Links
- PETSc Manual:
DMSTAG/DMStagGetGhostCorners
PETSc.setuniformcoordinates!
— Methodsetuniformcoordinates!(
dm::DMStag,
xyzmin::NTuple{N, Real},
xyzmax::NTuple{N, Real},
) where {N}
Set uniform coordinates for the dmstag
using the lower and upper corners defined by the NTuples
xyzmin
and xyzmax
. If N
is less than the dimension of the dm
then the value of the trailing coordinates is set to 0
.
External Links
- PETSc Manual:
DMSTAG/DMStagSetUniformCoordinatesExplicit
PETSc.setuniformcoordinatesproduct!
— Functionsetuniformcoordinatesproduct!(
dm::DMStag,
xyzmin::NTuple{N, Real},
xyzmax::NTuple{N, Real},
)
Set uniform coordinates for the dmstag
using the lower and upper corners defined by the NTuple
s xyzmin
and xyzmax
. If N
is less than the dimension of the dmstag
then the value of the trailing coordinates is set to 0
.
External Links
- PETSc Manual:
DMSTAG/DMStagSetUniformCoordinatesProduct