DMStag

The following DMStag routines are available:

Base.emptyMethod
empty(dm::DMStag)

return an uninitialized DMStag struct.

source
PETSc.DMLocalToGlobalFunction
DMLocalToGlobal(
    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

source
PETSc.DMStagCreate1dFunction
dm = 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

source
PETSc.DMStagCreate2dFunction
dm = 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

source
PETSc.DMStagCreate3dFunction
dm = 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

source
PETSc.DMStagCreateCompatibleDMStagFunction
dm = 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

source
PETSc.DMStagGetDOFFunction
dof0,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

source
PETSc.DMStagGetGhostArrayLocationSlotFunction
Array = 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`
source
PETSc.DMStagGetIndicesFunction
Indices = 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
source
PETSc.DMStagGetIsFirstRankFunction
fr_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

source
PETSc.DMStagGetIsLastRankFunction
fr_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

source
PETSc.DMStagGetLocationSlotFunction
slot = 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

source
PETSc.DMStagGetNumRanksFunction
nRanks0 = 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

source
PETSc.DMStagGetStencilTypeFunction
stencilType = 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

source
PETSc.DMStagMatGetValuesStencilFunction
val =  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

source
PETSc.DMStagMatSetValuesStencilFunction
DMStagMatSetValuesStencil(
    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

source
PETSc.DMStagVecGetArrayFunction
X1 = 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.

source
PETSc.DMStagVecGetArrayReadFunction
Array =  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
source
PETSc.DMStagVecGetValuesStencilFunction
val = 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

source
PETSc.DMStagVecSetValuesStencilFunction
DMStagVecSetValuesStencil(
    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

source
PETSc.LocalInGlobalIndicesFunction
indices = 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
source
PETSc.destroyMethod
destroy(dm::DMStag)

Destroys a DMSTAG object and releases the memory

dm 	- the DM object to destroy

External Links

source
PETSc.getcornersMethod
getcorners(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

source
PETSc.setuniformcoordinates!Method
setuniformcoordinates!(
    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

source
PETSc.setuniformcoordinatesproduct!Function
setuniformcoordinatesproduct!(
    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 NTuples 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

source