#include "ParticlePhysics.h"#include "verification_sources.h"#include "ParticleMotion.h"#include "interpolation.h"Go to the source code of this file.
Macros | |
| #define | ERROR_MSG_BUFFER_SIZE 256 |
| #define | IN_PATCH(i, j, k) ((i) >= gxs && (i) < gxs + gxm && (j) >= gys && (j) < gys + gym && (k) >= gzs && (k) < gzs + gzm) |
| #define | CELL(a, d, o) ((d) == 0 ? (a)[k][j][i + (o)] : (d) == 1 ? (a)[k][j + (o)][i] : (a)[k + (o)][j][i]) |
Functions | |
| static PetscErrorCode | ComputeCellScalarGradient (UserCtx *user, Vec lscalar, Vec lcount, Vec gradient) |
| Cartesian gradient of a cell-centred scalar at every owned physical cell. | |
| static PetscReal | IEMMixingLength2 (PetscReal aj) |
| Squared IEM mixing length of a cell: its volume to the power 2/3, from the reciprocal volume Aj, the volume floored at 1e-14 so a degenerate or cut cell cannot divide by zero. | |
| static PetscReal | IEMDecayFactor (PetscReal C_model, PetscReal diffusivity, PetscReal delta2, PetscReal dt) |
| IEM decay factor exp(-omega dt) over one step, omega = C D / delta2. | |
| PetscErrorCode | UpdateParticleField (ParticleFieldId field_id, PetscReal dt, PetscReal *psi_io, PetscReal diffusivity, PetscReal mean_val, PetscReal delta2, PetscReal C_model) |
| Implementation of UpdateParticleField(). | |
| static PetscErrorCode | ComputeIEMTargetMoments (UserCtx *user, PetscReal dt, PetscReal C_model, Vec lslope, Vec *lmoments_out, Vec *lcentroid_out) |
| Per-cell quantities of the bounded, conservative IEM target. | |
| PetscErrorCode | UpdateFieldForAllParticles (UserCtx *user, ParticleFieldId field_id) |
| Implementation of UpdateFieldForAllParticles(). | |
| PetscErrorCode | UpdateAllParticleFields (UserCtx *user) |
| Implementation of UpdateAllParticleFields(). | |
| PetscErrorCode | ComputeEulerianDiffusivity (UserCtx *user) |
| Implementation of ComputeEulerianDiffusivity(). | |
| PetscErrorCode | ComputeEulerianDiffusivityGradient (UserCtx *user) |
| Implementation of ComputeEulerianDiffusivityGradient(). | |
| #define ERROR_MSG_BUFFER_SIZE 256 |
Definition at line 7 of file ParticlePhysics.c.
| #define IN_PATCH | ( | i, | |
| j, | |||
| k | |||
| ) | ((i) >= gxs && (i) < gxs + gxm && (j) >= gys && (j) < gys + gym && (k) >= gzs && (k) < gzs + gzm) |
| #define CELL | ( | a, | |
| d, | |||
| o | |||
| ) | ((d) == 0 ? (a)[k][j][i + (o)] : (d) == 1 ? (a)[k][j + (o)][i] : (a)[k + (o)][j][i]) |
|
static |
Cartesian gradient of a cell-centred scalar at every owned physical cell.
Each computational derivative is the central difference, or at a non-periodic boundary cell the second-order one-sided difference into the domain, mapped to Cartesian components with the cell's metrics. With lcount, a derivative whose stencil reaches a cell holding no particles is zero, so an empty cell's zero mean does not enter. Writes owned entries only; local to this translation unit.
| [in] | user | Grid context. |
| [in] | lscalar | Ghosted scalar, its ghosts current. |
| [in] | lcount | Ghosted particle count, its ghosts current; or NULL. |
| [out] | gradient | Global vector on fda. |
Definition at line 502 of file ParticlePhysics.c.
|
inlinestatic |
Squared IEM mixing length of a cell: its volume to the power 2/3, from the reciprocal volume Aj, the volume floored at 1e-14 so a degenerate or cut cell cannot divide by zero.
Definition at line 16 of file ParticlePhysics.c.
|
inlinestatic |
IEM decay factor exp(-omega dt) over one step, omega = C D / delta2.
Definition at line 26 of file ParticlePhysics.c.
| PetscErrorCode UpdateParticleField | ( | ParticleFieldId | field_id, |
| PetscReal | dt, | ||
| PetscReal * | psi_io, | ||
| PetscReal | diffusivity, | ||
| PetscReal | mean_val, | ||
| PetscReal | delta2, | ||
| PetscReal | C_model | ||
| ) |
Implementation of UpdateParticleField().
Updates a single particle's field based on its state and physics model.
Definition at line 36 of file ParticlePhysics.c.
|
static |
Per-cell quantities of the bounded, conservative IEM target.
The target of particle p in cell c is t_p = m_c + zeta_c g_c . (x_p - x_c), with
lslope); any slope keeps the total;| [in] | user | Context; lPsi, lAj, ParticleCount current. |
| [in] | dt | Step. |
| [in] | C_model | IEM constant. |
| [in] | lslope | Ghosted gradient of the plain cell means, its ghosts current. |
| [out] | lmoments_out | Ghosted fda vector: (m_c, zeta_c, 0) per cell; restore with DMRestoreLocalVector. |
| [out] | lcentroid_out | Ghosted fda vector: x_c per cell; restore with DMRestoreLocalVector. |
Definition at line 81 of file ParticlePhysics.c.
| PetscErrorCode UpdateFieldForAllParticles | ( | UserCtx * | user, |
| ParticleFieldId | field_id | ||
| ) |
Implementation of UpdateFieldForAllParticles().
Loops over all local particles and updates a specified field.
Definition at line 250 of file ParticlePhysics.c.
| PetscErrorCode UpdateAllParticleFields | ( | UserCtx * | user | ) |
Implementation of UpdateAllParticleFields().
Orchestrates the update of all physical properties for particles.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticlePhysics.h.
Definition at line 400 of file ParticlePhysics.c.
| PetscErrorCode ComputeEulerianDiffusivity | ( | UserCtx * | user | ) |
Implementation of ComputeEulerianDiffusivity().
Computes the effective diffusivity scalar field (Gamma_eff) on the Eulerian grid.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticlePhysics.h.
Definition at line 437 of file ParticlePhysics.c.
| PetscErrorCode ComputeEulerianDiffusivityGradient | ( | UserCtx * | user | ) |
Implementation of ComputeEulerianDiffusivityGradient().
Computes the Eulerian gradient of the effective diffusivity field.
Definition at line 565 of file ParticlePhysics.c.