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 | PerformInitialSetup (SimCtx *simCtx) |
Finalizes the simulation setup at t=0, ensuring a consistent state before time marching. | |
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.
[TEST VERSION]
This version uses the new, integrated LocateAllParticlesInGrid_TEST
orchestrator and the ResetAllParticleStatuses
helper for a clean, robust, and understandable workflow.
For each timestep, it performs:
LocateAllParticlesInGrid_TEST
, which handles all particle location and migration until the swarm is fully settled.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 181 of file simulation.c.
PetscErrorCode PerformInitialSetup | ( | 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.