Header file for Particle related physics modules. More...
#include <petsc.h>#include <petscdmswarm.h>#include <stdbool.h>#include <petscsys.h>#include <math.h>#include "variables.h"#include "particle_field_catalog.h"#include "logging.h"#include "walkingsearch.h"Go to the source code of this file.
Functions | |
| PetscErrorCode | UpdateParticleField (ParticleFieldId field_id, PetscReal dt, PetscReal *psi_io, PetscReal diffusivity, PetscReal mean_val, PetscReal delta2, PetscReal C_model) |
| Updates a single particle's field based on its state and physics model. | |
| PetscErrorCode | UpdateFieldForAllParticles (UserCtx *user, ParticleFieldId field_id) |
| Loops over all local particles and updates a specified field. | |
| PetscErrorCode | UpdateAllParticleFields (UserCtx *user) |
| Orchestrates the update of all physical properties for particles. | |
| PetscErrorCode | ComputeEulerianDiffusivity (UserCtx *user) |
| Computes the effective diffusivity scalar field (Gamma_eff) on the Eulerian grid. | |
| PetscErrorCode | ComputeEulerianDiffusivityGradient (UserCtx *user) |
| Computes the Eulerian gradient of the effective diffusivity field. | |
Header file for Particle related physics modules.
This file contains declarations of functions responsible for solving for fields in the particle swarms within a simulation using PETSc's DMSwarm.
Definition in file ParticlePhysics.h.
| PetscErrorCode UpdateParticleField | ( | ParticleFieldId | field_id, |
| PetscReal | dt, | ||
| PetscReal * | psi_io, | ||
| PetscReal | diffusivity, | ||
| PetscReal | mean_val, | ||
| PetscReal | delta2, | ||
| PetscReal | C_model | ||
| ) |
Updates a single particle's field based on its state and physics model.
Implements the IEM (Interaction by Exchange with the Mean) model for scalar mixing. Physics: dPsi/dt = -Omega * (Psi - Psi_mean) Solution: Psi_new = Psi_mean + (Psi_old - Psi_mean) * exp(-Omega * dt)
| field_id | Typed particle-field identity. |
| dt | Time |
| psi_io | Pointer |
| diffusivity | Particle |
| mean_val | Local |
| delta2 | Squared mixing length: the host cell volume to the power 2/3, the volume floored at 1e-14 first. |
| C_model | Model |
Updates a single particle's field based on its state and physics model.
Definition at line 36 of file ParticlePhysics.c.
| PetscErrorCode UpdateFieldForAllParticles | ( | UserCtx * | user, |
| ParticleFieldId | field_id | ||
| ) |
Loops over all local particles and updates a specified field.
This function orchestrates the update of a single particle field across the entire local swarm. It gets access to the necessary particle data arrays and calls the UpdateParticleField kernel for each particle.
For Psi the IEM target is the host cell's limited linear reconstruction m + zeta g . (x - x_c): m and x_c are the cell's Psi mean and particle centroid weighted by each particle's relaxation weight 1 - exp(-omega_p dt), so every cell's Psi total is kept whatever the particles' rates; g is the gradient of the plain cell means; zeta in [0, 1] keeps every target within the extrema of all particles' Psi at the start of the step, so Psi stays within them. Collective for Psi.
| [in,out] | user | Pointer to the UserCtx containing the swarm and simulation context. |
| [in] | field_id | Typed identity of the field to update. |
Loops over all local particles and updates a specified field.
Definition at line 250 of file ParticlePhysics.c.
| PetscErrorCode UpdateAllParticleFields | ( | UserCtx * | user | ) |
Orchestrates the update of all physical properties for particles.
This function serves as the top-level entry point for updating particle-specific physical quantities after their position and the surrounding fluid velocity are known. It calls a sequence of more specific update routines for each property.
For example, it can be configured to update:
| [in,out] | user | Pointer to the UserCtx containing the swarm and simulation context. |
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 | ) |
Computes the effective diffusivity scalar field (Gamma_eff) on the Eulerian grid.
This function calculates the total diffusivity used to drive the stochastic motion of particles (Scalar FDF). It combines molecular diffusion and turbulent diffusion.
Formula: Gamma_eff = nu/Sc + nu_t/Sc_t
Where:
| [in,out] | user | Pointer to the user context containing grid data and simulation parameters. |
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 | ) |
Computes the Eulerian gradient of the effective diffusivity field.
Reads the scalar diffusivity field and writes a vector gradient field used by particle stochastic transport updates.
| [in,out] | user | Pointer to user context containing diffusivity vectors. |
Computes the Eulerian gradient of the effective diffusivity field.
Definition at line 565 of file ParticlePhysics.c.