|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Go to the source code of this file.
Data Structures | |
| struct | SolutionConvergenceDeterministicPass1 |
| struct | SolutionConvergenceDeterministicPass2 |
| struct | ProfiledFunction |
Macros | |
| #define | TMP_BUF_SIZE 128 |
| #define | __FUNCT__ "DualKSPMonitor" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | SOLUTION_CONVERGENCE_FLUID_THRESHOLD 0.1 |
| #define | SOLUTION_CONVERGENCE_REL_EPS 1.0e-30 |
| #define | __FUNCT__ "LOG_CONTINUITY_METRICS" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_FIELD_MIN_MAX" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_FIELD_ANATOMY" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_INTERPOLATION_ERROR" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_SCATTER_METRICS" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "ResetSearchMetrics" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_SEARCH_METRICS" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "CalculateAdvancedParticleMetrics" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
| #define | __FUNCT__ "LOG_PARTICLE_METRICS" |
| A custom KSP monitor that logs the true residual to a file and optionally to the console. | |
Typedefs | |
| typedef struct SolutionConvergenceDeterministicPass1 | SolutionConvergenceDeterministicPass1 |
| typedef struct SolutionConvergenceDeterministicPass2 | SolutionConvergenceDeterministicPass2 |
Functions | |
| static void | SearchMetricsReduceOp (void *invec, void *inoutvec, int *len, MPI_Datatype *datatype) |
| Internal reduction callback for packed search metrics. | |
| LogLevel | get_log_level () |
| Implementation of get_log_level(). | |
| PetscErrorCode | print_log_level (void) |
Internal helper implementation: print_log_level(). | |
| void | set_allowed_functions (const char **functionList, int count) |
| Implementation of set_allowed_functions(). | |
| PetscBool | is_function_allowed (const char *functionName) |
| Implementation of is_function_allowed(). | |
| PetscErrorCode | LOG_CELL_VERTICES (const Cell *cell, PetscMPIInt rank) |
| Implementation of LOG_CELL_VERTICES(). | |
| PetscErrorCode | LOG_FACE_DISTANCES (PetscReal *d) |
| Implementation of LOG_FACE_DISTANCES(). | |
| static void | IntToStr (int value, char *buf, size_t bufsize) |
| static void | Int64ToStr (PetscInt64 value, char *buf, size_t bufsize) |
| static void | CellToStr (const PetscInt *cell, char *buf, size_t bufsize) |
| static void | TripleRealToStr (const PetscReal *arr, char *buf, size_t bufsize) |
| static PetscErrorCode | ComputeMaxColumnWidths (PetscInt nParticles, const PetscMPIInt *ranks, const PetscInt64 *pids, const PetscInt *cellIDs, const PetscReal *positions, const PetscReal *velocities, const PetscReal *weights, int *wRank, int *wPID, int *wCell, int *wPos, int *wVel, int *wWt) |
| static void | BuildRowFormatString (PetscMPIInt wRank, PetscInt wPID, PetscInt wCell, PetscInt wPos, PetscInt wVel, PetscInt wWt, char *fmtStr, size_t bufSize) |
| static void | BuildHeaderString (char *headerStr, size_t bufSize, PetscMPIInt wRank, PetscInt wPID, PetscInt wCell, PetscInt wPos, PetscInt wVel, PetscInt wWt) |
| PetscErrorCode | LOG_PARTICLE_FIELDS (UserCtx *user, PetscInt printInterval) |
| Implementation of LOG_PARTICLE_FIELDS(). | |
| PetscBool | IsParticleConsoleSnapshotEnabled (const SimCtx *simCtx) |
| Implementation of IsParticleConsoleSnapshotEnabled(). | |
| PetscBool | ShouldEmitPeriodicParticleConsoleSnapshot (const SimCtx *simCtx, PetscInt completed_step) |
| Implementation of ShouldEmitPeriodicParticleConsoleSnapshot(). | |
| PetscErrorCode | EmitParticleConsoleSnapshot (UserCtx *user, SimCtx *simCtx, PetscInt step) |
| Implementation of EmitParticleConsoleSnapshot(). | |
| static void | trim (char *s) |
Internal helper implementation: trim(). | |
| PetscErrorCode | LoadAllowedFunctionsFromFile (const char filename[], char ***funcsOut, PetscInt *nOut) |
| Implementation of LoadAllowedFunctionsFromFile(). | |
| PetscErrorCode | FreeAllowedFunctions (char **funcs, PetscInt n) |
Internal helper implementation: FreeAllowedFunctions(). | |
| const char * | BCFaceToString (BCFace face) |
| Implementation of BCFaceToString(). | |
| const char * | FieldInitializationToString (PetscInt FieldInitialization) |
| Implementation of FieldInitializationToString(). | |
| const char * | ParticleInitializationToString (ParticleInitializationType ParticleInitialization) |
| Implementation of ParticleInitializationToString(). | |
| const char * | LESModelToString (LESModelType LESFlag) |
| Implementation of LESModelToString(). | |
| const char * | MomentumSolverTypeToString (MomentumSolverType SolverFlag) |
| Implementation of MomentumSolverTypeToString(). | |
| const char * | BCTypeToString (BCType type) |
| Implementation of BCTypeToString(). | |
| const char * | BCHandlerTypeToString (BCHandlerType handler_type) |
Internal helper implementation: BCHandlerTypeToString(). | |
| PetscErrorCode | DualMonitorDestroy (void **ctx) |
| Implementation of DualMonitorDestroy(). | |
| PetscErrorCode | DualKSPMonitor (KSP ksp, PetscInt it, PetscReal rnorm, void *ctx) |
| Implementation of DualKSPMonitor(). | |
| static PetscReal | SolutionConvergenceSafeRelative (PetscReal numerator, PetscReal denominator) |
| Forms a guarded relative metric for solution-convergence logging. | |
| static PetscErrorCode | ComputeCurrentFlowObservables (SimCtx *simCtx, PetscReal *mean_speed_out, PetscReal *mean_ke_out) |
| Computes instantaneous global flow observables for statistical mode. | |
| static PetscErrorCode | ComputeDeterministicSolutionMetrics (SimCtx *simCtx, PetscBool periodic_mode, PetscInt phase_step, PetscInt samples_before, PetscBool *has_reference_out, PetscReal *u_abs_l2_out, PetscReal *u_rel_l2_out, PetscReal *p_abs_l2_out, PetscReal *p_rel_l2_out, PetscReal *mean_speed_out, PetscReal *mean_speed_ref_out, PetscReal *mean_speed_abs_out, PetscReal *mean_speed_rel_out, PetscReal *mean_ke_out, PetscReal *mean_ke_ref_out, PetscReal *mean_ke_abs_out, PetscReal *mean_ke_rel_out) |
| Computes deterministic solution-drift metrics for the current step. | |
| static PetscReal | SolutionConvergenceHistoryGet (const PetscReal *history, PetscInt capacity, PetscInt samples_available, PetscInt offset_from_latest) |
| Reads one sample from the statistical ring buffer by age. | |
| static PetscErrorCode | AppendStatisticalObservableSample (SimCtx *simCtx, PetscInt samples_before, PetscReal mean_speed, PetscReal mean_ke) |
| Appends one timestep's scalar observables to the statistical history. | |
| static PetscErrorCode | ComputeStatisticalWindowMetrics (const SimCtx *simCtx, PetscInt samples_available, PetscBool *has_reference_out, PetscReal *mean_speed_window_out, PetscReal *mean_speed_window_prev_out, PetscReal *mean_speed_window_abs_out, PetscReal *mean_speed_window_rel_out, PetscReal *mean_speed_rms_window_out, PetscReal *mean_speed_rms_window_prev_out, PetscReal *mean_speed_rms_window_abs_out, PetscReal *mean_speed_rms_window_rel_out, PetscReal *mean_ke_window_out, PetscReal *mean_ke_window_prev_out, PetscReal *mean_ke_window_abs_out, PetscReal *mean_ke_window_rel_out, PetscReal *mean_ke_rms_window_out, PetscReal *mean_ke_rms_window_prev_out, PetscReal *mean_ke_rms_window_abs_out, PetscReal *mean_ke_rms_window_rel_out) |
| Computes adjacent-window drift metrics for statistical steady mode. | |
| static const char * | SolutionConvergenceModeToString (SolutionConvergenceMode mode) |
| Maps the internal solution-convergence mode enum to its log label. | |
| PetscErrorCode | LOG_SOLUTION_CONVERGENCE (SimCtx *simCtx) |
| Implementation of LOG_SOLUTION_CONVERGENCE(). | |
| PetscErrorCode | LOG_CONTINUITY_METRICS (UserCtx *user) |
| Implementation of LOG_CONTINUITY_METRICS(). | |
| const char * | ParticleLocationStatusToString (ParticleLocationStatus level) |
| Implementation of ParticleLocationStatusToString(). | |
| static PetscErrorCode | _FindOrCreateEntry (const char *func_name, PetscInt *idx) |
Internal helper implementation: _FindOrCreateEntry(). | |
| PetscErrorCode | ProfilingInitialize (SimCtx *simCtx) |
Internal helper implementation: ProfilingInitialize(). | |
| void | _ProfilingStart (const char *func_name) |
| Implementation of _ProfilingStart(). | |
| void | _ProfilingEnd (const char *func_name) |
| Implementation of _ProfilingEnd(). | |
| PetscErrorCode | ProfilingResetTimestepCounters (void) |
| Implementation of ProfilingResetTimestepCounters(). | |
| PetscErrorCode | ProfilingLogTimestepSummary (SimCtx *simCtx, PetscInt step) |
| Implementation of ProfilingLogTimestepSummary(). | |
| PetscErrorCode | RuntimeMemoryLogSample (SimCtx *simCtx, PetscInt step, const char *event, const char *reason) |
| Implementation of RuntimeMemoryLogSample(). | |
| static int | _CompareProfiledFunctions (const void *a, const void *b) |
Internal helper implementation: _CompareProfiledFunctions(). | |
| PetscErrorCode | ProfilingFinalize (SimCtx *simCtx) |
| Implementation of ProfilingFinalize(). | |
| void | PrintProgressBar (PetscInt step, PetscInt startStep, PetscInt totalSteps, PetscReal currentTime) |
Internal helper implementation: PrintProgressBar(). | |
| PetscErrorCode | LOG_FIELD_MIN_MAX (UserCtx *user, const char *fieldName) |
| Implementation of LOG_FIELD_MIN_MAX(). | |
| PetscErrorCode | LOG_FIELD_ANATOMY (UserCtx *user, const char *field_name, const char *stage_name) |
| Implementation of LOG_FIELD_ANATOMY(). | |
| PetscErrorCode | LOG_INTERPOLATION_ERROR (UserCtx *user) |
| Implementation of LOG_INTERPOLATION_ERROR(). | |
| PetscErrorCode | LOG_SCATTER_METRICS (UserCtx *user) |
| Implementation of LOG_SCATTER_METRICS(). | |
| PetscErrorCode | ResetSearchMetrics (SimCtx *simCtx) |
| Implementation of ResetSearchMetrics(). | |
| PetscErrorCode | LOG_SEARCH_METRICS (UserCtx *user) |
| Implementation of LOG_SEARCH_METRICS(). | |
| PetscErrorCode | CalculateAdvancedParticleMetrics (UserCtx *user) |
Internal helper implementation: CalculateAdvancedParticleMetrics(). | |
| PetscErrorCode | LOG_PARTICLE_METRICS (UserCtx *user, const char *stageName) |
| Implementation of LOG_PARTICLE_METRICS(). | |
Variables | |
| static LogLevel | current_log_level = -1 |
| Static variable to cache the current logging level. | |
| static char ** | gAllowedFunctions = NULL |
| Global/static array of function names allowed to log. | |
| static int | gNumAllowed = 0 |
| Number of entries in the gAllowedFunctions array. | |
| static ProfiledFunction * | g_profiler_registry = NULL |
| static PetscInt | g_profiler_count = 0 |
| static PetscInt | g_profiler_capacity = 0 |
| struct SolutionConvergenceDeterministicPass1 |
| struct SolutionConvergenceDeterministicPass2 |
| struct ProfiledFunction |
| #define __FUNCT__ "DualKSPMonitor" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_CONTINUITY_METRICS" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_FIELD_MIN_MAX" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_FIELD_ANATOMY" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_INTERPOLATION_ERROR" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_SCATTER_METRICS" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "ResetSearchMetrics" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_SEARCH_METRICS" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "CalculateAdvancedParticleMetrics" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| #define __FUNCT__ "LOG_PARTICLE_METRICS" |
A custom KSP monitor that logs the true residual to a file and optionally to the console.
Logs continuity metrics for a single block to a file.
This function replicates the behavior of KSPMonitorTrueResidualNorm by calculating the true residual norm ||b - Ax|| itself. It unconditionally logs to a file viewer and conditionally logs to the console based on a flag in the context.
| ksp | The Krylov subspace context. |
| it | The current iteration number. |
| rnorm | The preconditioned residual norm (ignored, we compute our own). |
| ctx | A pointer to the DualMonitorCtx structure. |
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
| user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
| anonymous enum |
Definition at line 30 of file logging.c.
|
static |
Internal reduction callback for packed search metrics.
Local to this translation unit.
Definition at line 51 of file logging.c.
| LogLevel get_log_level | ( | ) |
Implementation of get_log_level().
Retrieves the current logging level from the environment variable LOG_LEVEL.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 84 of file logging.c.
| PetscErrorCode print_log_level | ( | void | ) |
Internal helper implementation: print_log_level().
Prints the current logging level to the console.
Local to this translation unit.
Definition at line 116 of file logging.c.
| void set_allowed_functions | ( | const char ** | functionList, |
| int | count | ||
| ) |
Implementation of set_allowed_functions().
Sets the global list of function names that are allowed to log.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 152 of file logging.c.
| PetscBool is_function_allowed | ( | const char * | functionName | ) |
Implementation of is_function_allowed().
Checks if a given function is in the allow-list.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 183 of file logging.c.
| PetscErrorCode LOG_CELL_VERTICES | ( | const Cell * | cell, |
| PetscMPIInt | rank | ||
| ) |
Implementation of LOG_CELL_VERTICES().
Prints the coordinates of a cell's vertices.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 205 of file logging.c.
| PetscErrorCode LOG_FACE_DISTANCES | ( | PetscReal * | d | ) |
Implementation of LOG_FACE_DISTANCES().
Prints the signed distances to each face of the cell.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 230 of file logging.c.
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 302 of file logging.c.
|
static |
Definition at line 366 of file logging.c.
|
static |
Definition at line 379 of file logging.c.
| PetscErrorCode LOG_PARTICLE_FIELDS | ( | UserCtx * | user, |
| PetscInt | printInterval | ||
| ) |
Implementation of LOG_PARTICLE_FIELDS().
Prints particle fields in a table that automatically adjusts its column widths.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 397 of file logging.c.
| PetscBool IsParticleConsoleSnapshotEnabled | ( | const SimCtx * | simCtx | ) |
Implementation of IsParticleConsoleSnapshotEnabled().
Returns whether periodic particle console snapshots are enabled.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 525 of file logging.c.
| PetscBool ShouldEmitPeriodicParticleConsoleSnapshot | ( | const SimCtx * | simCtx, |
| PetscInt | completed_step | ||
| ) |
Implementation of ShouldEmitPeriodicParticleConsoleSnapshot().
Returns whether a particle console snapshot should be emitted for the.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 542 of file logging.c.
Implementation of EmitParticleConsoleSnapshot().
Emits one particle console snapshot into the main solver log.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 556 of file logging.c.
|
static |
Internal helper implementation: trim().
Local to this translation unit.
Definition at line 571 of file logging.c.
| PetscErrorCode LoadAllowedFunctionsFromFile | ( | const char | filename[], |
| char *** | funcsOut, | ||
| PetscInt * | nOut | ||
| ) |
Implementation of LoadAllowedFunctionsFromFile().
Load function names from a text file.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 596 of file logging.c.
| PetscErrorCode FreeAllowedFunctions | ( | char ** | funcs, |
| PetscInt | n | ||
| ) |
Internal helper implementation: FreeAllowedFunctions().
Free an array previously returned by LoadAllowedFunctionsFromFile().
Local to this translation unit.
Definition at line 650 of file logging.c.
| const char * BCFaceToString | ( | BCFace | face | ) |
Implementation of BCFaceToString().
Helper function to convert BCFace enum to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 669 of file logging.c.
| const char * FieldInitializationToString | ( | PetscInt | FieldInitialization | ) |
Implementation of FieldInitializationToString().
Helper function to convert FieldInitialization to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 687 of file logging.c.
| const char * ParticleInitializationToString | ( | ParticleInitializationType | ParticleInitialization | ) |
Implementation of ParticleInitializationToString().
Helper function to convert ParticleInitialization to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 703 of file logging.c.
| const char * LESModelToString | ( | LESModelType | LESFlag | ) |
Implementation of LESModelToString().
Helper function to convert LES Flag to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 720 of file logging.c.
| const char * MomentumSolverTypeToString | ( | MomentumSolverType | SolverFlag | ) |
Implementation of MomentumSolverTypeToString().
Helper function to convert Momentum Solver flag to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 736 of file logging.c.
| const char * BCTypeToString | ( | BCType | type | ) |
Implementation of BCTypeToString().
Helper function to convert BCType enum to a string representation.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 751 of file logging.c.
| const char * BCHandlerTypeToString | ( | BCHandlerType | handler_type | ) |
Internal helper implementation: BCHandlerTypeToString().
Converts a BCHandlerType enum to its string representation.
Local to this translation unit.
Definition at line 771 of file logging.c.
| PetscErrorCode DualMonitorDestroy | ( | void ** | ctx | ) |
Implementation of DualMonitorDestroy().
Destroys the DualMonitorCtx.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 809 of file logging.c.
| PetscErrorCode DualKSPMonitor | ( | KSP | ksp, |
| PetscInt | it, | ||
| PetscReal | rnorm, | ||
| void * | ctx | ||
| ) |
Implementation of DualKSPMonitor().
A custom KSP monitor that logs to a file and optionally to the console.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 848 of file logging.c.
|
static |
Forms a guarded relative metric for solution-convergence logging.
This helper centralizes the divide-by-nearly-zero protection used by the solution-convergence logger when turning an absolute drift into a relative one. The denominator is clamped away from zero so warmup rows, quiescent fields, and statistically small observables do not generate infinities.
| [in] | numerator | Absolute quantity or drift magnitude. |
| [in] | denominator | Reference magnitude used for normalization. |
numerator / max(|denominator|, eps). Definition at line 927 of file logging.c.
|
static |
Computes instantaneous global flow observables for statistical mode.
The statistical solution-convergence path does not compare full Eulerian fields. Instead, it tracks a compact history of global observables derived from the completed Eulerian state. This helper computes the current volume-weighted fluid-domain mean speed and mean kinetic energy from Ucat.
Only physical fluid cells contribute:
NvertEach MPI rank accumulates local partial sums and the routine reduces them to one global pair of observables.
| [in] | simCtx | Simulation context owning the finest-level flow fields. |
| [out] | mean_speed_out | Volume-weighted domain mean of |u|. |
| [out] | mean_ke_out | Volume-weighted domain mean of 0.5 |u|^2. |
Definition at line 954 of file logging.c.
|
static |
Computes deterministic solution-drift metrics for the current step.
This helper powers both steady_deterministic and periodic_deterministic solution-convergence modes. It compares the completed Eulerian state against either:
Ucat_o, P_o) for steady/transient useThe routine performs two passes over the fluid cells:
Warmup behavior is handled here. If no valid reference exists yet, all drift outputs are left at zero and has_reference_out is set to PETSC_FALSE, while current observables are still reported.
| [in] | simCtx | Simulation context owning the current state. |
| [in] | periodic_mode | PETSC_TRUE when comparing against phase-aligned periodic storage. |
| [in] | phase_step | Active phase slot for periodic mode, or -1 when unused. |
| [in] | samples_before | Number of solution-convergence samples already recorded before this timestep. |
| [out] | has_reference_out | Whether a valid comparison state existed. |
| [out] | u_abs_l2_out | Absolute L2 drift of Cartesian velocity. |
| [out] | u_rel_l2_out | Relative L2 drift of Cartesian velocity. |
| [out] | p_abs_l2_out | Gauge-invariant absolute L2 pressure drift. |
| [out] | p_rel_l2_out | Gauge-invariant relative L2 pressure drift. |
| [out] | mean_speed_out | Current volume-weighted mean speed. |
| [out] | mean_speed_ref_out | Reference volume-weighted mean speed. |
| [out] | mean_speed_abs_out | Absolute drift of mean speed. |
| [out] | mean_speed_rel_out | Relative drift of mean speed. |
| [out] | mean_ke_out | Current volume-weighted mean kinetic energy. |
| [out] | mean_ke_ref_out | Reference volume-weighted mean kinetic energy. |
| [out] | mean_ke_abs_out | Absolute drift of mean kinetic energy. |
| [out] | mean_ke_rel_out | Relative drift of mean kinetic energy. |
Definition at line 1064 of file logging.c.
|
static |
Reads one sample from the statistical ring buffer by age.
The statistical logger stores scalar observables in a compact circular buffer. This helper interprets the buffer using samples_available as the logical end of the history and returns the entry offset_from_latest steps back from the newest stored sample.
Out-of-range requests return zero so warmup handling can remain simple and deterministic.
| [in] | history | Ring-buffer storage array. |
| [in] | capacity | Total ring-buffer capacity. |
| [in] | samples_available | Number of logical samples available to read. |
| [in] | offset_from_latest | 0 means newest sample, 1 previous sample, and so on. |
0.0 if unavailable. Definition at line 1295 of file logging.c.
|
static |
Appends one timestep's scalar observables to the statistical history.
Statistical solution-convergence compares adjacent windows of scalar observables rather than full fields. This helper writes the current mean_speed and mean_ke into the rolling history arrays using the current sample count to choose the circular-buffer slot.
| [in,out] | simCtx | Simulation context owning the history arrays. |
| [in] | samples_before | Number of samples present before appending the current timestep. |
| [in] | mean_speed | Current timestep mean-speed observable. |
| [in] | mean_ke | Current timestep mean-KE observable. |
Definition at line 1330 of file logging.c.
|
static |
Computes adjacent-window drift metrics for statistical steady mode.
Once enough samples have been accumulated, this helper forms:
window_steps sampleswindow_steps samplesFrom those windows it computes means, RMS values, and absolute/relative drift for both tracked observables (mean_speed and mean_ke). When the history is still warming up:
window_steps samples: no window metrics are availablewindow_steps and 2*window_steps - 1 samples: current-window metrics are available, but no reference window exists yet| [in] | simCtx | Simulation context owning the statistical history. |
| [in] | samples_available | Number of samples available after appending the current timestep. |
| [out] | has_reference_out | Whether both adjacent windows exist and drift metrics are meaningful. |
| [out] | mean_speed_window_out | Mean speed over the current window. |
| [out] | mean_speed_window_prev_out | Mean speed over the previous window. |
| [out] | mean_speed_window_abs_out | Absolute drift between current and previous window means. |
| [out] | mean_speed_window_rel_out | Relative drift between current and previous window means. |
| [out] | mean_speed_rms_window_out | RMS of mean-speed samples in the current window. |
| [out] | mean_speed_rms_window_prev_out | RMS of mean-speed samples in the previous window. |
| [out] | mean_speed_rms_window_abs_out | Absolute drift between window RMS values. |
| [out] | mean_speed_rms_window_rel_out | Relative drift between window RMS values. |
| [out] | mean_ke_window_out | Mean kinetic energy over the current window. |
| [out] | mean_ke_window_prev_out | Mean kinetic energy over the previous window. |
| [out] | mean_ke_window_abs_out | Absolute drift between current and previous KE-window means. |
| [out] | mean_ke_window_rel_out | Relative drift between current and previous KE-window means. |
| [out] | mean_ke_rms_window_out | RMS of mean-KE samples in the current window. |
| [out] | mean_ke_rms_window_prev_out | RMS of mean-KE samples in the previous window. |
| [out] | mean_ke_rms_window_abs_out | Absolute drift between KE-window RMS values. |
| [out] | mean_ke_rms_window_rel_out | Relative drift between KE-window RMS values. |
Definition at line 1410 of file logging.c.
|
static |
Maps the internal solution-convergence mode enum to its log label.
The logger writes a human-readable mode string into the solution_convergence.log banner and mode column. This helper keeps the formatting centralized so the file output stays consistent with the accepted configuration names.
| [in] | mode | Internal solution-convergence mode selector. |
Definition at line 1543 of file logging.c.
| PetscErrorCode LOG_SOLUTION_CONVERGENCE | ( | SimCtx * | simCtx | ) |
Implementation of LOG_SOLUTION_CONVERGENCE().
Logs physical solution-convergence metrics once per completed timestep.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1560 of file logging.c.
| PetscErrorCode LOG_CONTINUITY_METRICS | ( | UserCtx * | user | ) |
Implementation of LOG_CONTINUITY_METRICS().
Logs continuity metrics for a single block to a file.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1752 of file logging.c.
| const char * ParticleLocationStatusToString | ( | ParticleLocationStatus | level | ) |
Implementation of ParticleLocationStatusToString().
A function that outputs the name of the current level in the ParticleLocation enum.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1811 of file logging.c.
|
static |
Internal helper implementation: _FindOrCreateEntry().
Local to this translation unit.
Definition at line 1846 of file logging.c.
| PetscErrorCode ProfilingInitialize | ( | SimCtx * | simCtx | ) |
Internal helper implementation: ProfilingInitialize().
Initializes the custom profiling system using configuration from SimCtx.
Local to this translation unit.
Definition at line 1882 of file logging.c.
| void _ProfilingStart | ( | const char * | func_name | ) |
Implementation of _ProfilingStart().
Internal profiling hook invoked by PROFILE_FUNCTION_BEGIN.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1906 of file logging.c.
| void _ProfilingEnd | ( | const char * | func_name | ) |
Implementation of _ProfilingEnd().
Internal profiling hook invoked by PROFILE_FUNCTION_END.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1920 of file logging.c.
| PetscErrorCode ProfilingResetTimestepCounters | ( | void | ) |
Implementation of ProfilingResetTimestepCounters().
Resets per-timestep profiling counters for the next solver step.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1942 of file logging.c.
| PetscErrorCode ProfilingLogTimestepSummary | ( | SimCtx * | simCtx, |
| PetscInt | step | ||
| ) |
Implementation of ProfilingLogTimestepSummary().
Logs the performance summary for the current timestep and resets timers.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 1959 of file logging.c.
| PetscErrorCode RuntimeMemoryLogSample | ( | SimCtx * | simCtx, |
| PetscInt | step, | ||
| const char * | event, | ||
| const char * | reason | ||
| ) |
Implementation of RuntimeMemoryLogSample().
Append a reduced runtime memory sample to the configured memory log.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2037 of file logging.c.
|
static |
Internal helper implementation: _CompareProfiledFunctions().
Local to this translation unit.
Definition at line 2132 of file logging.c.
| PetscErrorCode ProfilingFinalize | ( | SimCtx * | simCtx | ) |
Implementation of ProfilingFinalize().
the profiling excercise and build a profiling summary which is then printed to a log file.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2148 of file logging.c.
| void PrintProgressBar | ( | PetscInt | step, |
| PetscInt | startStep, | ||
| PetscInt | totalSteps, | ||
| PetscReal | currentTime | ||
| ) |
Internal helper implementation: PrintProgressBar().
Prints a progress bar to the console.
Local to this translation unit.
Definition at line 2254 of file logging.c.
| PetscErrorCode LOG_FIELD_MIN_MAX | ( | UserCtx * | user, |
| const char * | fieldName | ||
| ) |
Implementation of LOG_FIELD_MIN_MAX().
Computes and logs the local and global min/max values of a 3-component vector field.
Full API contract is documented with the header declaration in include/logging.h.
Definition at line 2301 of file logging.c.
| PetscErrorCode LOG_FIELD_ANATOMY | ( | UserCtx * | user, |
| const char * | field_name, | ||
| const char * | stage_name | ||
| ) |
Implementation of LOG_FIELD_ANATOMY().
Logs the anatomy of a specified field at key boundary locations, respecting the solver's specific grid and variable architecture.
Full API contract is documented with the header declaration in include/logging.h.
Definition at line 2449 of file logging.c.
| PetscErrorCode LOG_INTERPOLATION_ERROR | ( | UserCtx * | user | ) |
Implementation of LOG_INTERPOLATION_ERROR().
Logs the interpolation error between the analytical and computed solutions.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2719 of file logging.c.
| PetscErrorCode LOG_SCATTER_METRICS | ( | UserCtx * | user | ) |
Implementation of LOG_SCATTER_METRICS().
Logs particle-to-grid scatter verification metrics for the prescribed scalar truth path.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2795 of file logging.c.
| PetscErrorCode ResetSearchMetrics | ( | SimCtx * | simCtx | ) |
Implementation of ResetSearchMetrics().
Resets the aggregate per-timestep search instrumentation counters.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2946 of file logging.c.
| PetscErrorCode LOG_SEARCH_METRICS | ( | UserCtx * | user | ) |
Implementation of LOG_SEARCH_METRICS().
Writes compact runtime search metrics to CSV and optionally to console.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 2977 of file logging.c.
| PetscErrorCode CalculateAdvancedParticleMetrics | ( | UserCtx * | user | ) |
Internal helper implementation: CalculateAdvancedParticleMetrics().
Computes advanced particle statistics and stores them in SimCtx.
Local to this translation unit.
Definition at line 3128 of file logging.c.
| PetscErrorCode LOG_PARTICLE_METRICS | ( | UserCtx * | user, |
| const char * | stageName | ||
| ) |
Implementation of LOG_PARTICLE_METRICS().
Logs particle swarm metrics, adapting its behavior based on a boolean flag in SimCtx.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/logging.h.
Definition at line 3182 of file logging.c.
|
static |
|
static |
|
static |
|
static |