|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
#include "ParticleSwarm.h"Go to the source code of this file.
Macros | |
| #define | INTERPOLATION_DISTANCE_TOLERANCE 1.0e-14 |
| #define | __FUNCT__ "InitializeSwarm" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "RegisterSwarmField" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "RegisterParticleFields" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "DetermineVolumetricInitializationParameters" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "InitializeParticleBasicProperties" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "InitializeSwarmFieldValue" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "AssignInitialFieldToSwarm" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "AssignInitialPropertiesToSwarm" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "DistributeParticles" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "FinalizeSwarmSetup" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "CreateParticleSwarm" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "UnpackSwarmFields" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "UpdateSwarmFields" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "IsParticleInsideBoundingBox" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "UpdateParticleWeights" |
| Initializes or loads the particle swarm based on the simulation context. | |
| #define | __FUNCT__ "InitializeParticleSwarm" |
| Initializes or loads the particle swarm based on the simulation context. | |
Functions | |
| PetscErrorCode | InitializeSwarm (UserCtx *user) |
| Implementation of InitializeSwarm(). | |
| PetscErrorCode | RegisterSwarmField (DM swarm, const char *fieldName, PetscInt fieldDim, PetscDataType dtype) |
Internal helper implementation: RegisterSwarmField(). | |
| PetscErrorCode | RegisterParticleFields (DM swarm) |
| Implementation of RegisterParticleFields(). | |
| static PetscErrorCode | DetermineVolumetricInitializationParameters (UserCtx *user, DMDALocalInfo *info, PetscInt xs_gnode, PetscInt ys_gnode, PetscInt zs_gnode, PetscRandom *rand_logic_i_ptr, PetscRandom *rand_logic_j_ptr, PetscRandom *rand_logic_k_ptr, PetscInt *ci_metric_lnode_out, PetscInt *cj_metric_lnode_out, PetscInt *ck_metric_lnode_out, PetscReal *xi_metric_logic_out, PetscReal *eta_metric_logic_out, PetscReal *zta_metric_logic_out, PetscBool *can_place_in_volume_out) |
Internal helper implementation: DetermineVolumetricInitializationParameters(). | |
| static PetscErrorCode | InitializeParticleBasicProperties (UserCtx *user, PetscInt particlesPerProcess, PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k, BoundingBox *bboxlist) |
Internal helper implementation: InitializeParticleBasicProperties(). | |
| static PetscErrorCode | InitializeSwarmFieldValue (const char *fieldName, PetscInt p, PetscInt fieldDim, PetscReal *fieldData) |
Internal helper implementation: InitializeSwarmFieldValue(). | |
| static PetscErrorCode | AssignInitialFieldToSwarm (UserCtx *user, const char *fieldName, PetscInt fieldDim) |
Internal helper implementation: AssignInitialFieldToSwarm(). | |
| PetscErrorCode | AssignInitialPropertiesToSwarm (UserCtx *user, PetscInt particlesPerProcess, PetscRandom *rand_phys_x, PetscRandom *rand_phys_y, PetscRandom *rand_phys_z, PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k, BoundingBox *bboxlist) |
Internal helper implementation: AssignInitialPropertiesToSwarm(). | |
| PetscErrorCode | DistributeParticles (PetscInt numParticles, PetscMPIInt rank, PetscMPIInt size, PetscInt *particlesPerProcess, PetscInt *remainder) |
| Implementation of DistributeParticles(). | |
| PetscErrorCode | FinalizeSwarmSetup (PetscRandom *randx, PetscRandom *randy, PetscRandom *randz, PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k) |
| Implementation of FinalizeSwarmSetup(). | |
| PetscErrorCode | CreateParticleSwarm (UserCtx *user, PetscInt numParticles, PetscInt *particlesPerProcess, BoundingBox *bboxlist) |
Internal helper implementation: CreateParticleSwarm(). | |
| PetscErrorCode | UnpackSwarmFields (PetscInt i, const PetscInt64 *PIDs, const PetscReal *weights, const PetscReal *positions, const PetscInt *cellIndices, PetscReal *velocities, PetscInt *LocStatus, PetscReal *diffusivity, Cmpnts *diffusivitygradient, PetscReal *psi, Particle *particle) |
| Implementation of UnpackSwarmFields(). | |
| PetscErrorCode | UpdateSwarmFields (PetscInt i, const Particle *particle, PetscReal *positions, PetscReal *velocities, PetscReal *weights, PetscInt *cellIndices, PetscInt *status, PetscReal *diffusivity, Cmpnts *diffusivitygradient, PetscReal *psi) |
Internal helper implementation: UpdateSwarmFields(). | |
| PetscBool | IsParticleInsideBoundingBox (const BoundingBox *bbox, const Particle *particle) |
Internal helper implementation: IsParticleInsideBoundingBox(). | |
| PetscErrorCode | UpdateParticleWeights (PetscReal *d, Particle *particle) |
Internal helper implementation: UpdateParticleWeights(). | |
| PetscErrorCode | InitializeParticleSwarm (SimCtx *simCtx) |
| Implementation of InitializeParticleSwarm(). | |
| #define INTERPOLATION_DISTANCE_TOLERANCE 1.0e-14 |
Definition at line 5 of file ParticleSwarm.c.
| #define __FUNCT__ "InitializeSwarm" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "RegisterSwarmField" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "RegisterParticleFields" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "DetermineVolumetricInitializationParameters" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "InitializeParticleBasicProperties" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "InitializeSwarmFieldValue" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "AssignInitialFieldToSwarm" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "AssignInitialPropertiesToSwarm" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "DistributeParticles" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "FinalizeSwarmSetup" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "CreateParticleSwarm" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "UnpackSwarmFields" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "UpdateSwarmFields" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "IsParticleInsideBoundingBox" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "UpdateParticleWeights" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| #define __FUNCT__ "InitializeParticleSwarm" |
Initializes or loads the particle swarm based on the simulation context.
This function is the central point for setting up the DMSwarm. Its behavior depends on the simulation context (simCtx):
simCtx->particleRestartMode is "init", a new particle population is generated, just like a fresh start. This allows injecting fresh particles into a pre-computed flow field.simCtx->particleRestartMode is "load", the particle state is loaded from restart files corresponding to the StartStep.| [in,out] | simCtx | Pointer to the main SimulationContext, which contains all configuration and provides access to the UserCtx. |
Definition at line 8 of file ParticleSwarm.c.
| PetscErrorCode InitializeSwarm | ( | UserCtx * | user | ) |
Implementation of InitializeSwarm().
Initializes the DMSwarm object within the UserCtx structure.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 15 of file ParticleSwarm.c.
| PetscErrorCode RegisterSwarmField | ( | DM | swarm, |
| const char * | fieldName, | ||
| PetscInt | fieldDim, | ||
| PetscDataType | dtype | ||
| ) |
Internal helper implementation: RegisterSwarmField().
Registers a swarm field without finalizing registration.
Local to this translation unit.
Definition at line 38 of file ParticleSwarm.c.
| PetscErrorCode RegisterParticleFields | ( | DM | swarm | ) |
Implementation of RegisterParticleFields().
Registers necessary particle fields within the DMSwarm.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 61 of file ParticleSwarm.c.
|
static |
Internal helper implementation: DetermineVolumetricInitializationParameters().
Local to this translation unit.
Definition at line 104 of file ParticleSwarm.c.
|
static |
Internal helper implementation: InitializeParticleBasicProperties().
Local to this translation unit.
Definition at line 205 of file ParticleSwarm.c.
|
static |
Internal helper implementation: InitializeSwarmFieldValue().
Local to this translation unit.
Definition at line 413 of file ParticleSwarm.c.
|
static |
Internal helper implementation: AssignInitialFieldToSwarm().
Local to this translation unit.
Definition at line 456 of file ParticleSwarm.c.
| PetscErrorCode AssignInitialPropertiesToSwarm | ( | UserCtx * | user, |
| PetscInt | particlesPerProcess, | ||
| PetscRandom * | rand_phys_x, | ||
| PetscRandom * | rand_phys_y, | ||
| PetscRandom * | rand_phys_z, | ||
| PetscRandom * | rand_logic_i, | ||
| PetscRandom * | rand_logic_j, | ||
| PetscRandom * | rand_logic_k, | ||
| BoundingBox * | bboxlist | ||
| ) |
Internal helper implementation: AssignInitialPropertiesToSwarm().
Initializes all particle properties in the swarm.
Local to this translation unit.
Definition at line 503 of file ParticleSwarm.c.
| PetscErrorCode DistributeParticles | ( | PetscInt | numParticles, |
| PetscMPIInt | rank, | ||
| PetscMPIInt | size, | ||
| PetscInt * | particlesPerProcess, | ||
| PetscInt * | remainder | ||
| ) |
Implementation of DistributeParticles().
Distributes particles evenly across MPI processes, handling any remainders.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 595 of file ParticleSwarm.c.
| PetscErrorCode FinalizeSwarmSetup | ( | PetscRandom * | randx, |
| PetscRandom * | randy, | ||
| PetscRandom * | randz, | ||
| PetscRandom * | rand_logic_i, | ||
| PetscRandom * | rand_logic_j, | ||
| PetscRandom * | rand_logic_k | ||
| ) |
Implementation of FinalizeSwarmSetup().
Finalizes the swarm setup by destroying random generators and logging completion.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 625 of file ParticleSwarm.c.
| PetscErrorCode CreateParticleSwarm | ( | UserCtx * | user, |
| PetscInt | numParticles, | ||
| PetscInt * | particlesPerProcess, | ||
| BoundingBox * | bboxlist | ||
| ) |
Internal helper implementation: CreateParticleSwarm().
Creates and initializes a Particle Swarm.
Local to this translation unit.
Definition at line 651 of file ParticleSwarm.c.
| PetscErrorCode UnpackSwarmFields | ( | PetscInt | i, |
| const PetscInt64 * | PIDs, | ||
| const PetscReal * | weights, | ||
| const PetscReal * | positions, | ||
| const PetscInt * | cellIndices, | ||
| PetscReal * | velocities, | ||
| PetscInt * | LocStatus, | ||
| PetscReal * | diffusivity, | ||
| Cmpnts * | diffusivitygradient, | ||
| PetscReal * | psi, | ||
| Particle * | particle | ||
| ) |
Implementation of UnpackSwarmFields().
Initializes a Particle struct with data from DMSwarm fields.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 722 of file ParticleSwarm.c.
| PetscErrorCode UpdateSwarmFields | ( | PetscInt | i, |
| const Particle * | particle, | ||
| PetscReal * | positions, | ||
| PetscReal * | velocities, | ||
| PetscReal * | weights, | ||
| PetscInt * | cellIndices, | ||
| PetscInt * | status, | ||
| PetscReal * | diffusivity, | ||
| Cmpnts * | diffusivitygradient, | ||
| PetscReal * | psi | ||
| ) |
Internal helper implementation: UpdateSwarmFields().
Updates DMSwarm data arrays from a Particle struct.
Local to this translation unit.
Definition at line 848 of file ParticleSwarm.c.
| PetscBool IsParticleInsideBoundingBox | ( | const BoundingBox * | bbox, |
| const Particle * | particle | ||
| ) |
Internal helper implementation: IsParticleInsideBoundingBox().
Checks if a particle's location is within a specified bounding box.
Local to this translation unit.
Definition at line 925 of file ParticleSwarm.c.
| PetscErrorCode UpdateParticleWeights | ( | PetscReal * | d, |
| Particle * | particle | ||
| ) |
Internal helper implementation: UpdateParticleWeights().
Updates a particle's interpolation weights based on distances to cell faces.
Local to this translation unit.
Definition at line 976 of file ParticleSwarm.c.
| PetscErrorCode InitializeParticleSwarm | ( | SimCtx * | simCtx | ) |
Implementation of InitializeParticleSwarm().
High-level particle initialization orchestrator for a simulation run.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/ParticleSwarm.h.
Definition at line 1049 of file ParticleSwarm.c.