|
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 | ScatterParticleFieldToEulerField (UserCtx *user, ParticleFieldId particle_field_id, 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, ParticleFieldId particle_field_id, DM targetDM, PetscInt expected_dof, Vec eulerFieldAverageVec) |
| Accumulate one particle field onto the Eulerian grid using the selected scatter stencil. | |
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.ScatterAllParticleFieldsToEulerFields) to easily scatter a standard set of fields.SETERRQ 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 ScatterParticleFieldToEulerField | ( | UserCtx * | user, |
| ParticleFieldId | particle_field_id, | ||
| 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 from the particle catalog, 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] | particle_field_id | Typed identity of the DMSwarm field. |
| [in,out] | eulerFieldAverageVec | Pre-created Vec associated with the correct target DM (implicitly da or fda). Result stored here. |
Definition at line 1802 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 1888 of file interpolation.c.
|
static |
Accumulate one particle field onto the Eulerian grid using the selected scatter stencil.
Definition at line 1715 of file interpolation.c.