|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Test program for DMSwarm interpolation using the fdf-curvIB method. More...
#include <signal.h>#include "runloop.h"#include "statistics_window.h"#include "verification_sources.h"Go to the source code of this file.
Macros | |
| #define | __FUNCT__ "PerformInitialSetup" |
| #define | __FUNCT__ "PerformLoadedParticleSetup" |
| #define | __FUNCT__ "FinalizeRestartState" |
| #define | __FUNCT__ "AdvanceSimulation" |
Functions | |
| static void | RuntimeShutdownSignalHandler (int signum) |
| Record receipt of a termination signal for safe handling by the run loop. | |
| static void | RuntimeRequestAutoWalltimeGuard (void) |
| Request a controlled shutdown because the estimated walltime margin is exhausted. | |
| static PetscBool | RuntimeShutdownRequested (void) |
| Report whether a signal or walltime guard has requested run-loop shutdown. | |
| static PetscErrorCode | RefreshVerificationScalarScatterState (UserCtx *user) |
| Applies verification-only scalar truth and refreshes the scattered Eulerian scalar state. | |
| static const char * | RuntimeShutdownSignalName (PetscInt signum) |
| Translate a recorded termination signal into a user-facing signal name. | |
| static const char * | RuntimeShutdownReasonName (void) |
| Translate the current shutdown reason into a user-facing diagnostic label. | |
| static PetscErrorCode | RegisterRuntimeSignalHandler (int signum) |
| Install the process signal handler used to request graceful simulation shutdown. | |
| PetscErrorCode | InitializeRuntimeSignalHandlers (void) |
| Implementation of InitializeRuntimeSignalHandlers(). | |
| PetscReal | RuntimeWalltimeGuardUpdateEWMA (PetscBool has_previous, PetscReal previous_ewma_seconds, PetscReal latest_step_seconds, PetscReal alpha) |
| Implementation of RuntimeWalltimeGuardUpdateEWMA(). | |
| PetscReal | RuntimeWalltimeGuardConservativeEstimate (PetscReal warmup_average_seconds, PetscReal ewma_seconds, PetscReal latest_step_seconds) |
| Implementation of RuntimeWalltimeGuardConservativeEstimate(). | |
| PetscReal | RuntimeWalltimeGuardRequiredHeadroom (PetscReal min_seconds, PetscReal multiplier, PetscReal conservative_estimate_seconds) |
| Implementation of RuntimeWalltimeGuardRequiredHeadroom(). | |
| PetscBool | RuntimeWalltimeGuardShouldTrigger (PetscInt completed_steps, PetscInt warmup_steps, PetscReal remaining_seconds, PetscReal min_seconds, PetscReal multiplier, PetscReal warmup_average_seconds, PetscReal ewma_seconds, PetscReal latest_step_seconds, PetscReal *required_headroom_seconds_out) |
| Implementation of RuntimeWalltimeGuardShouldTrigger(). | |
| static PetscReal | RuntimeWalltimeGuardRemainingSeconds (const SimCtx *simCtx) |
| Estimate the remaining scheduler walltime after reserving the configured shutdown margin. | |
| static void | UpdateRuntimeWalltimeGuardEstimator (SimCtx *simCtx, PetscReal completed_step_seconds) |
| Update the timestep-duration estimate used by the automatic walltime guard. | |
| static PetscErrorCode | MaybeRequestRuntimeWalltimeGuardShutdown (SimCtx *simCtx, const char *checkpoint_name) |
| Request graceful shutdown when another timestep would exceed the walltime budget. | |
| static PetscErrorCode | WriteForcedTerminationOutput (SimCtx *simCtx, UserCtx *user, const char *phase) |
| Write restart-safe output when a controlled shutdown interrupts the run loop. | |
| PetscErrorCode | UpdateSolverHistoryVectors (UserCtx *user, PetscBool preserve_previous_state) |
Internal helper implementation: UpdateSolverHistoryVectors(). | |
| PetscErrorCode | PerformInitializedParticleSetup (SimCtx *simCtx) |
Internal helper implementation: PerformInitializedParticleSetup(). | |
| PetscErrorCode | PerformLoadedParticleSetup (SimCtx *simCtx) |
Internal helper implementation: PerformLoadedParticleSetup(). | |
| PetscErrorCode | FinalizeRestartState (SimCtx *simCtx) |
Internal helper implementation: FinalizeRestartState(). | |
| PetscErrorCode | AdvanceSimulation (SimCtx *simCtx) |
Internal helper implementation: AdvanceSimulation(). | |
Variables | |
| static volatile sig_atomic_t | g_runtime_shutdown_signal = 0 |
| static PetscBool | g_runtime_shutdown_auto_requested = PETSC_FALSE |
Test program for DMSwarm interpolation using the fdf-curvIB method.
Provides the setup to start any simulation with DMSwarm and DMDAs.
Definition in file runloop.c.
|
static |
Record receipt of a termination signal for safe handling by the run loop.
Definition at line 19 of file runloop.c.
|
static |
Request a controlled shutdown because the estimated walltime margin is exhausted.
Definition at line 29 of file runloop.c.
|
static |
|
static |
Applies verification-only scalar truth and refreshes the scattered Eulerian scalar state.
Local to this translation unit.
Definition at line 48 of file runloop.c.
|
static |
Translate a recorded termination signal into a user-facing signal name.
Definition at line 60 of file runloop.c.
|
static |
Translate the current shutdown reason into a user-facing diagnostic label.
Definition at line 79 of file runloop.c.
|
static |
Install the process signal handler used to request graceful simulation shutdown.
Definition at line 93 of file runloop.c.
| PetscErrorCode InitializeRuntimeSignalHandlers | ( | void | ) |
Implementation of InitializeRuntimeSignalHandlers().
Installs lightweight signal handlers for graceful shutdown requests.
Full API contract (arguments, ownership, side effects) is documented with the matching public header declaration.
Definition at line 118 of file runloop.c.
| PetscReal RuntimeWalltimeGuardUpdateEWMA | ( | PetscBool | has_previous, |
| PetscReal | previous_ewma_seconds, | ||
| PetscReal | latest_step_seconds, | ||
| PetscReal | alpha | ||
| ) |
Implementation of RuntimeWalltimeGuardUpdateEWMA().
Update an EWMA estimate for timestep wall-clock duration.
Full API contract (arguments, ownership, side effects) is documented with the matching public header declaration.
Definition at line 145 of file runloop.c.
| PetscReal RuntimeWalltimeGuardConservativeEstimate | ( | PetscReal | warmup_average_seconds, |
| PetscReal | ewma_seconds, | ||
| PetscReal | latest_step_seconds | ||
| ) |
Implementation of RuntimeWalltimeGuardConservativeEstimate().
Return the conservative timestep estimate used by the walltime guard.
Full API contract (arguments, ownership, side effects) is documented with the matching public header declaration.
Definition at line 157 of file runloop.c.
| PetscReal RuntimeWalltimeGuardRequiredHeadroom | ( | PetscReal | min_seconds, |
| PetscReal | multiplier, | ||
| PetscReal | conservative_estimate_seconds | ||
| ) |
Implementation of RuntimeWalltimeGuardRequiredHeadroom().
Compute the required shutdown headroom from timestep estimate and floor.
Full API contract (arguments, ownership, side effects) is documented with the matching public header declaration.
Definition at line 168 of file runloop.c.
| PetscBool RuntimeWalltimeGuardShouldTrigger | ( | PetscInt | completed_steps, |
| PetscInt | warmup_steps, | ||
| PetscReal | remaining_seconds, | ||
| PetscReal | min_seconds, | ||
| PetscReal | multiplier, | ||
| PetscReal | warmup_average_seconds, | ||
| PetscReal | ewma_seconds, | ||
| PetscReal | latest_step_seconds, | ||
| PetscReal * | required_headroom_seconds_out | ||
| ) |
Implementation of RuntimeWalltimeGuardShouldTrigger().
Decide whether the runtime walltime guard should stop before another step.
Full API contract (arguments, ownership, side effects) is documented with the matching public header declaration.
Definition at line 179 of file runloop.c.
|
static |
Estimate the remaining scheduler walltime after reserving the configured shutdown margin.
Definition at line 196 of file runloop.c.
|
static |
Update the timestep-duration estimate used by the automatic walltime guard.
Definition at line 207 of file runloop.c.
|
static |
Request graceful shutdown when another timestep would exceed the walltime budget.
Definition at line 234 of file runloop.c.
|
static |
Write restart-safe output when a controlled shutdown interrupts the run loop.
Definition at line 278 of file runloop.c.
| PetscErrorCode UpdateSolverHistoryVectors | ( | UserCtx * | user, |
| PetscBool | preserve_previous_state | ||
| ) |
Internal helper implementation: UpdateSolverHistoryVectors().
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.
Local to this translation unit.
Definition at line 306 of file runloop.c.
| PetscErrorCode PerformInitializedParticleSetup | ( | SimCtx * | simCtx | ) |
Internal helper implementation: PerformInitializedParticleSetup().
Finalizes the simulation setup at t=0, ensuring a consistent state before time marching.
Local to this translation unit.
Definition at line 365 of file runloop.c.
| PetscErrorCode PerformLoadedParticleSetup | ( | SimCtx * | simCtx | ) |
Internal helper implementation: PerformLoadedParticleSetup().
Finalizes the simulation state after particle and fluid data have been loaded from a restart.
Local to this translation unit.
Definition at line 437 of file runloop.c.
| PetscErrorCode FinalizeRestartState | ( | SimCtx * | simCtx | ) |
Internal helper implementation: FinalizeRestartState().
Performs post-load/post-init consistency checks for a restarted simulation.
Local to this translation unit.
Definition at line 503 of file runloop.c.
| PetscErrorCode AdvanceSimulation | ( | SimCtx * | simCtx | ) |
Internal helper implementation: AdvanceSimulation().
Executes the main time-marching loop for the particle simulation.
Local to this translation unit.
Definition at line 544 of file runloop.c.