|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
#include <petscpf.h>#include <petscdmswarm.h>#include <stdlib.h>#include <time.h>#include <math.h>#include <petsctime.h>#include <petscsys.h>#include <petscdmcomposite.h>#include <petscsystypes.h>#include "variables.h"#include "ParticleSwarm.h"#include "walkingsearch.h"#include "grid.h"#include "logging.h"#include "io.h"#include "interpolation.h"#include "initialcondition.h"#include "ParticleMotion.h"#include "Boundaries.h"#include "setup.h"#include "solvers.h"Go to the source code of this file.
Functions | |
| PetscErrorCode | UpdateSolverHistoryVectors (UserCtx *user) |
| Copies the current time step's solution fields into history vectors (e.g., U(t_n) -> U_o, U_o -> U_rm1) for the next time step's calculations. | |
| PetscErrorCode | AdvanceSimulation (SimCtx *simCtx) |
| Executes the main time-marching loop for the particle simulation. | |
| PetscErrorCode | PerformInitializedParticleSetup (SimCtx *simCtx) |
| Finalizes the simulation setup at t=0, ensuring a consistent state before time marching. | |
| PetscErrorCode | PerformLoadedParticleSetup (SimCtx *simCtx) |
| Finalizes the simulation state after particle and fluid data have been loaded from a restart. | |
| PetscErrorCode | FinalizeRestartState (SimCtx *simCtx) |
| Performs post-load/post-init consistency checks for a restarted simulation. | |
| PetscErrorCode UpdateSolverHistoryVectors | ( | UserCtx * | user | ) |
Copies the current time step's solution fields into history vectors (e.g., U(t_n) -> U_o, U_o -> U_rm1) for the next time step's calculations.
This function is critical for multi-step time integration schemes (like BDF2) used by the legacy solver. It must be called at the end of every time step, after the new solution has been fully computed.
The order of operations is important to avoid overwriting data prematurely.
| user | The UserCtx for a single block. The function modifies the history vectors (Ucont_o, Ucont_rm1, etc.) within this context. |
Definition at line 23 of file simulation.c.
| PetscErrorCode AdvanceSimulation | ( | SimCtx * | simCtx | ) |
Executes the main time-marching loop for the particle simulation.
This version uses the new, integrated LocateAllParticlesInGrid orchestrator and the ResetAllParticleStatuses helper for a clean, robust, and understandable workflow.
For each timestep, it performs:
| user | Pointer to the UserCtx structure.. |
Executes the main time-marching loop for the particle simulation.
This function orchestrates the advancement of the simulation from the configured StartStep to the final step. It does NOT perform the initial t=0 setup, as that is handled by InitializeEulerianState and PerformInitialSetup in main().
For each timestep, it performs the following sequence:
| user | Array of UserCtx structures for the finest grid level. |
Definition at line 307 of file simulation.c.
| PetscErrorCode PerformInitializedParticleSetup | ( | SimCtx * | simCtx | ) |
Finalizes the simulation setup at t=0, ensuring a consistent state before time marching.
This function is called from main() after the initial Eulerian and Lagrangian states have been created but before the main time loop begins. Its responsibilities are:
| simCtx | Pointer to the main simulation context structure. |
Definition at line 95 of file simulation.c.
| PetscErrorCode PerformLoadedParticleSetup | ( | SimCtx * | simCtx | ) |
Finalizes the simulation state after particle and fluid data have been loaded from a restart.
This helper function performs the critical sequence of operations required to ensure the loaded Lagrangian and Eulerian states are fully consistent and the solver is ready to proceed. This includes:
| simCtx | The main simulation context. |
Definition at line 176 of file simulation.c.
| PetscErrorCode FinalizeRestartState | ( | SimCtx * | simCtx | ) |
Performs post-load/post-init consistency checks for a restarted simulation.
This function is called from main() ONLY when a restart is being performed (i.e., StartStep > 0). It inspects the particle restart mode to determine the correct finalization procedure for the Lagrangian swarm.
mode == "load"), it verifies their locations within the grid to establish necessary runtime links.mode == "init"), it runs the full PerformInitialSetup sequence to migrate, locate, and couple the new particles with the existing fluid state.| simCtx | The main simulation context. |
Definition at line 242 of file simulation.c.