DMSwarmProjectFields#
Project a set of swarm fields onto another DM
Synopsis#
#include "petscdm.h"
#include "petscdmda.h"
#include "petscdmplex.h"
#include "petscdmswarm.h"
#include "petscksp.h"
PetscErrorCode DMSwarmProjectFields(DM sw, DM dm, PetscInt nfields, const char *fieldnames[], Vec fields[], ScatterMode mode)
Collective
Input Parameters#
sw - the
DMSWARM
nfields - the number of swarm fields to project
fieldnames - the textual names of the swarm fields to project
fields - an array of
Vec
’s of length nfieldsmode - if
SCATTER_FORWARD
then map particles to the continuum, and ifSCATTER_REVERSE
map the continuum to particles
Notes#
Currently, there are two available projection methods. The first is conservative projection, used for a DMPLEX
cell DM
.
The second is the averaging which is used for a DMDA
cell DM
where \(\phi_p \) is the swarm field at point \(p\), \(N_i()\) is the cell DM
basis function at vertex \(i\), \(dJ\) is the determinant of the cell Jacobian and
\(\phi_i\) is the projected vertex value of the field \(\phi\).
The user is responsible for destroying both the array and the individual Vec
objects.
For the DMPLEX
case, there is only a single vector, so the field layout in the DMPLEX
must match the requested fields from the DMSwarm
.
For averaging projection, nly swarm fields registered with data type of PETSC_REAL
can be projected onto the cell DM
, and only swarm fields of block size = 1 can currently be projected.
See Also#
DM Basics, DMSWARM
, DMSwarmSetType()
, DMSwarmSetCellDM()
, DMSwarmType
Level#
beginner
Location#
Examples#
src/dm/tutorials/ex21.c
src/dm/impls/swarm/tutorials/ex1.c
src/ksp/ksp/tutorials/ex70.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages