Configured initial values of particle-carried fields. More...
Go to the source code of this file.
Data Structures | |
| struct | ParticleFieldEvent |
| When and why a plan is applied. More... | |
Typedefs | |
| typedef struct ParticleFieldPlan | ParticleFieldPlan |
| Compiled initial values for every configured particle field. | |
Functions | |
| PetscErrorCode | ParticleFieldPlanCreate (const char *prefix, ParticleFieldPlan **plan) |
| Read a plan from the options database. | |
| PetscErrorCode | ParticleFieldPlanApply (UserCtx *user, ParticleFieldPlan *plan, const ParticleFieldEvent *event, PetscInt first, PetscInt end) |
Write the plan's values into swarm entries [first, end) of this rank. | |
| PetscErrorCode | ParticleFieldPlanSummarize (UserCtx *user, const ParticleFieldPlan *plan) |
| Log and record the realized initial values of every planned field. | |
| PetscErrorCode | ParticleFieldPlanDestroy (ParticleFieldPlan **plan) |
| Free a plan and its compiled expressions. | |
Configured initial values of particle-carried fields.
A plan binds each configured particle field to one compiled expression per component. Expressions are written in physical units: x, y, z are physical coordinates, t is physical time, and a value is divided by its field's catalog reference scale when written. The plan is applied to a contiguous local range of swarm entries, so the t=0 population and, later, particles injected at a boundary share one path.
The expressions are compiled and evaluated by the shared engine in expression.h.
Definition in file ParticleInitialConditions.h.
| struct ParticleFieldEvent |
When and why a plan is applied.
Definition at line 29 of file ParticleInitialConditions.h.
| Data Fields | ||
|---|---|---|
| PetscReal | physical_time | Time, in seconds, the evaluated particles appear at. |
| PetscInt64 | salt | Event identity keying random draws: 0 for the t=0 population. |
| typedef struct ParticleFieldPlan ParticleFieldPlan |
Compiled initial values for every configured particle field.
Definition at line 26 of file ParticleInitialConditions.h.
| PetscErrorCode ParticleFieldPlanCreate | ( | const char * | prefix, |
| ParticleFieldPlan ** | plan | ||
| ) |
Read a plan from the options database.
Reads -<prefix>_count, and for each field i, -<prefix>_<i>_name and one expression per component, -<prefix>_<i>_expr_<c>. Every named field must be a particle-carried field of the catalog (capability USER_INITIALIZE).
| [in] | prefix | Option prefix without its dash: particle_fields for the t=0 population, particle_inlet_<n>_fields for an inlet. |
| [out] | plan | Compiled plan, or NULL when no field is configured. |
PETSC_ERR_ARG_WRONG for an unknown or non-settable field or a malformed expression.Read a plan from the options database.
Definition at line 47 of file ParticleInitialConditions.c.
| PetscErrorCode ParticleFieldPlanApply | ( | UserCtx * | user, |
| ParticleFieldPlan * | plan, | ||
| const ParticleFieldEvent * | event, | ||
| PetscInt | first, | ||
| PetscInt | end | ||
| ) |
Write the plan's values into swarm entries [first, end) of this rank.
Each rank evaluates its own entries. Every rank calls it even with an empty range: the first call that reads a grid line's fraction or length is collective, computing them once for the plan. Those expressions need each particle's cell and weights. A value that is not finite is an error naming the particle and its position.
| [in,out] | user | Block owning the swarm. |
| [in] | plan | Plan to apply; NULL does nothing. |
| [in] | event | Time and identity of the event producing these particles. |
| [in] | first | First local entry. |
| [in] | end | One past the last local entry. |
Write the plan's values into swarm entries [first, end) of this rank.
Definition at line 124 of file ParticleInitialConditions.c.
| PetscErrorCode ParticleFieldPlanSummarize | ( | UserCtx * | user, |
| const ParticleFieldPlan * | plan | ||
| ) |
Log and record the realized initial values of every planned field.
Collective. Reports count, mean, variance, minimum, maximum, and a ten-bin histogram per field component, in physical units, to the log and to particle_initial_fields.csv in the run's metrics directory.
| [in] | user | Block owning the swarm. |
| [in] | plan | Plan whose fields are summarized; NULL does nothing. |
Log and record the realized initial values of every planned field.
Definition at line 240 of file ParticleInitialConditions.c.
| PetscErrorCode ParticleFieldPlanDestroy | ( | ParticleFieldPlan ** | plan | ) |
Free a plan and its compiled expressions.
| [in,out] | plan | Plan to free; set to NULL. |
Free a plan and its compiled expressions.
Definition at line 324 of file ParticleInitialConditions.c.