PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
ParticlePhysics.h
Go to the documentation of this file.
1/**
2 * @file ParticlePhysics.h
3 * @brief Header file for Particle related physics modules.
4 *
5 * This file contains declarations of functions responsible for solving for fields in the particle swarms within a simulation using PETSc's DMSwarm.
6 */
7
8 #ifndef PARTICLE_PHYSICS_H
9 #define PARTICLE_PHYSICS_H
10
11// Include necessary headers
12#include <petsc.h> // PETSc library header
13#include <petscdmswarm.h> // PETSc DMSwarm header
14#include <stdbool.h>
15#include <petscsys.h> // For PetscRealloc
16#include <math.h>
17#include "variables.h" // Common type definitions
18#include "logging.h" // Logging macros and definitions
19#include "walkingsearch.h" // Walking search function for particle migration
20
21/**
22 * @brief Updates a single particle's field based on its state and the specified field name.
23 *
24 * This function serves as a switchboard for various particle property calculations.
25 * Given a particle's data, it computes a new value for the specified field.
26 *
27 * Currently supported fields:
28 * - "Psi": Calculates the particle's kinetic energy (0.5 * |v|^2).
29 *
30 * @param[in] fieldName The name of the field to update (e.g., "Psi").
31 * @param[in] t The current simulation time.
32 * @param[in] pos The particle's physical position.
33 * @param[in] vel The particle's velocity.
34 * @param[in,out] psi_io A pointer to the particle's current Psi value (used for accumulation if needed).
35 *
36 * @return PetscErrorCode 0 on success.
37 */
38PetscErrorCode UpdateParticleField(const char *fieldName,
39 PetscReal t,
40 Cmpnts pos,
41 Cmpnts vel,
42 PetscReal *psi_io);
43
44
45/**
46 * @brief Loops over all local particles and updates a specified field.
47 *
48 * This function orchestrates the update of a single particle field across the entire
49 * local swarm. It gets access to the necessary particle data arrays and calls the
50 * `UpdateParticleField` kernel for each particle.
51 *
52 * @param[in,out] user Pointer to the UserCtx containing the swarm and simulation context.
53 * @param[in] fieldName The name of the field to update (e.g., "Psi").
54 *
55 * @return PetscErrorCode 0 on success.
56 */
57PetscErrorCode UpdateFieldForAllParticles(UserCtx *user, const char *fieldName);
58
59
60/**
61 * @brief Orchestrates the update of all physical properties for particles.
62 *
63 * This function serves as the top-level entry point for updating particle-specific
64 * physical quantities after their position and the surrounding fluid velocity are known.
65 * It calls a sequence of more specific update routines for each property.
66 *
67 * For example, it can be configured to update:
68 * - Particle kinetic energy (stored in "Psi")
69 * - Particle accumulated shear stress
70 * - Particle temperature
71 * - etc.
72 *
73 * @param[in,out] user Pointer to the UserCtx containing the swarm and simulation context.
74 *
75 * @return PetscErrorCode 0 on success.
76 */
77PetscErrorCode UpdateAllParticleFields(UserCtx *user);
78
79#endif // PARTICLE_PHYSICS_H
PetscErrorCode UpdateFieldForAllParticles(UserCtx *user, const char *fieldName)
Loops over all local particles and updates a specified field.
PetscErrorCode UpdateParticleField(const char *fieldName, PetscReal t, Cmpnts pos, Cmpnts vel, PetscReal *psi_io)
Updates a single particle's field based on its state and the specified field name.
PetscErrorCode UpdateAllParticleFields(UserCtx *user)
Orchestrates the update of all physical properties for particles.
Logging utilities and macros for PETSc-based applications.
Main header file for a complex fluid dynamics solver.
A 3D point or vector with PetscScalar components.
Definition variables.h:100
User-defined context containing data specific to a single computational grid level.
Definition variables.h:661
Header file for particle location functions using the walking search algorithm.