|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Functions for scattering particle data (scalar or vector) onto Eulerian grid fields by averaging contributions within each cell. More...
Modules | |
| Internal Scattering Helpers | |
| Lower-level functions used by the main scattering routines. | |
Functions | |
| PetscErrorCode | GetScatterTargetInfo (UserCtx *user, const char *particleFieldName, DM *targetDM, PetscInt *expected_dof) |
| Determines the target Eulerian DM and expected DOF for scattering a given particle field. | |
| PetscErrorCode | ScatterParticleFieldToEulerField (UserCtx *user, const char *particleFieldName, Vec eulerFieldAverageVec) |
| Scatters a particle field (scalar or vector) to the corresponding Eulerian field average. | |
| PetscErrorCode | ScatterAllParticleFieldsToEulerFields (UserCtx *user) |
| Scatters a predefined set of particle fields to their corresponding Eulerian fields. | |
| static PetscErrorCode | ScatterParticleFieldToEulerField_Internal (UserCtx *user, const char *particleFieldName, DM targetDM, PetscInt expected_dof, Vec eulerFieldAverageVec) |
Internal helper implementation: ScatterParticleFieldToEulerField_Internal(). | |
Functions for scattering particle data (scalar or vector) onto Eulerian grid fields by averaging contributions within each cell.
This file provides a modular set of functions to perform particle-to-grid projection, specifically calculating cell-averaged quantities from particle properties. It assumes a PETSc environment using DMDA for the grids and DMSwarm for particles.
Key Features:
ParticleCount) for normalization.user->da for scalars, user->fda for vectors) based on standard field names ("P", "Nvert", "Ucat", "Ucont","Psi").user->P, user->Ucat,user->Psi) in place.Provides a high-level wrapper function (ScatterAllParticleFieldsToEulerFields) to easily scatter a standard set of fields.Uses only the baseSETERRQ` macro for error reporting to maximize compiler compatibility.Dependencies:
UserCtx struct (defined elsewhere, e.g., "userctx.h") containing pointers to relevant DMs (da, fda), Vecs (ParticleCount, P, Nvert, Ucat, etc.), and the DMSwarm object (swarm)."DMSwarm_CellID" (blockSize=3, type=PETSC_INT) must be registered and populated with the local cell indices for each particle.LOG_ALLOW, etc.) assumed to be defined elsewhere. | PetscErrorCode GetScatterTargetInfo | ( | UserCtx * | user, |
| const char * | particleFieldName, | ||
| DM * | targetDM, | ||
| PetscInt * | expected_dof | ||
| ) |
Determines the target Eulerian DM and expected DOF for scattering a given particle field.
Based on hardcoded rules mapping particle field names to user context DMs (da/fda). This function encapsulates the policy of where different fields should be scattered.
| [in] | user | Pointer to the UserCtx containing da and fda. |
| [in] | particleFieldName | Name of the particle field (e.g., "P", "Ucat"). |
| [out] | targetDM | Pointer to store the determined target DM (da or fda). |
| [out] | expected_dof | Pointer to store the expected DOF (1 or 3) for this field. |
Definition at line 1486 of file interpolation.c.
| PetscErrorCode ScatterParticleFieldToEulerField | ( | UserCtx * | user, |
| const char * | particleFieldName, | ||
| Vec | eulerFieldAverageVec | ||
| ) |
Scatters a particle field (scalar or vector) to the corresponding Eulerian field average.
This is the main user-facing function. It determines the target Eulerian DM based on the particleFieldName, validates the provided eulerFieldAverageVec against the target DM, and then orchestrates the scatter operation by calling the internal helper function ScatterParticleFieldToEulerField_Internal. The final averaged result is stored IN-PLACE in eulerFieldAverageVec.
| [in] | user | Pointer to UserCtx containing da, fda, swarm, ParticleCount. |
| [in] | particleFieldName | Name of the field in the DMSwarm (e.g., "P", "Ucat"). |
| [in,out] | eulerFieldAverageVec | Pre-created Vec associated with the correct target DM (implicitly da or fda). Result stored here. |
Definition at line 1895 of file interpolation.c.
| PetscErrorCode ScatterAllParticleFieldsToEulerFields | ( | UserCtx * | user | ) |
Scatters a predefined set of particle fields to their corresponding Eulerian fields.
This convenience function calls the unified ScatterParticleFieldToEulerField for a standard set of fields ("P", potentially others). It assumes the target Eulerian Vec objects (e.g., user->P, user->Ucat) exist in the UserCtx structure and are correctly associated with their respective DMs (user->da or user->fda). It zeros the target Vecs before scattering.
| [in,out] | user | Pointer to the UserCtx structure containing all required DMs, Vecs (ParticleCount, target Eulerian fields like P, Ucat), and swarm. |
Definition at line 1965 of file interpolation.c.
|
static |
Internal helper implementation: ScatterParticleFieldToEulerField_Internal().
Local to this translation unit.
Definition at line 1809 of file interpolation.c.