|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Public interface for data input/output routines. More...
Go to the source code of this file.
Functions | |
| PetscErrorCode | ReadGridGenerationInputs (UserCtx *user) |
| Parses command-line options for a programmatically generated grid for a SINGLE block. | |
| PetscErrorCode | PopulateFinestUserGridResolutionFromOptions (UserCtx *finest_users, PetscInt nblk) |
Parses grid resolution arrays (-im, -jm, -km) once and applies them to all finest-grid blocks. | |
| PetscErrorCode | ReadGridFile (UserCtx *user) |
| Sets grid dimensions from a file for a SINGLE block using a one-time read cache. | |
| PetscErrorCode | VerifyPathExistence (const char *path, PetscBool is_dir, PetscBool is_optional, const char *description, PetscBool *exists) |
| A parallel-safe helper to verify the existence of a generic file or directory path. | |
| PetscBool | ShouldWriteDataOutput (const SimCtx *simCtx, PetscInt completed_step) |
| Returns whether full field/restart output should be written for the. | |
| PetscErrorCode | WriteCheckpointBundle (SimCtx *simCtx, const char *reason) |
| Write and atomically publish one complete checkpoint bundle. | |
| PetscErrorCode | ReadSimulationFields (UserCtx *user, PetscInt ti) |
| Reads binary field data for velocity, pressure, and other required vectors. | |
| PetscErrorCode | RestoreFieldStatisticsState (SimCtx *simCtx, PetscInt ti) |
| Restores field-statistics window state and accumulators from a checkpoint. | |
| PetscErrorCode | ReadFieldData (UserCtx *user, const char *field_name, Vec field_vec, const char *ext) |
| Reads data for a specific field from a file into the provided vector. | |
| PetscErrorCode | WriteFieldData (UserCtx *user, const char *field_name, Vec field_vec, const char *ext) |
| Writes data from a specific PETSc vector to a file. | |
| PetscErrorCode | WriteSimulationFields (UserCtx *user, const char *checkpoint_directory) |
| Writes simulation fields to files. | |
| PetscErrorCode | WriteSwarmField (UserCtx *user, const char *field_name, const char *ext) |
| Writes data from a specific field in a PETSc Swarm to a file. | |
| PetscErrorCode | WriteSwarmIntField (UserCtx *user, const char *field_name, const char *ext) |
| Writes integer data from a specific PETSc Swarm field to a file. | |
| PetscErrorCode | WriteAllSwarmFields (UserCtx *user, const char *checkpoint_directory) |
| Writes a predefined set of PETSc Swarm fields to files. | |
| PetscInt | ReadDataFileToArray (const char *filename, double **data_out, PetscInt *Nout, MPI_Comm comm) |
| Reads a simple ASCII data file containing one numeric value per line. | |
| PetscInt | CreateVTKFileFromMetadata (const char *filename, const VTKMetaData *meta, MPI_Comm comm) |
| Creates a VTK file from prepared metadata and field payloads. | |
| PetscErrorCode | VecToArrayOnRank0 (Vec inVec, PetscInt *N, double **arrayOut) |
| Gathers the contents of a distributed PETSc Vec into a single array on rank 0. | |
| PetscErrorCode | SwarmFieldToArrayOnRank0 (DM swarm, const char *field_name, PetscInt *n_total_particles, PetscInt *n_components, PetscDataType *field_type_out, void **gathered_array) |
| Gathers any DMSwarm field from all ranks to a single, contiguous array on rank 0. | |
| PetscErrorCode | ReadSwarmField (UserCtx *user, const char *field_name, const char *ext) |
| Reads data from a file into a specified field of a PETSc DMSwarm. | |
| PetscErrorCode | ReadSwarmIntField (UserCtx *user, const char *field_name, const char *ext) |
| Reads integer swarm data by using ReadFieldData and casting the result. | |
| PetscErrorCode | ReadAllSwarmFields (UserCtx *user, PetscInt ti) |
| Reads multiple fields (positions, velocity, CellID, and weight) into a DMSwarm. | |
| PetscErrorCode | ReadCheckpointParticleCount (UserCtx *user, PetscInt ti, PetscInt *particle_count) |
| Read the particle count from a validated committed checkpoint. | |
| PetscErrorCode | ReadPositionsFromFile (PetscInt timeIndex, UserCtx *user, double **coordsArray, PetscInt *Ncoords) |
| Reads coordinate data (for particles) from file into a PETSc Vec, then gathers it to rank 0. | |
| PetscErrorCode | ReadFieldDataToRank0 (PetscInt timeIndex, const char *fieldName, UserCtx *user, double **scalarArray, PetscInt *Nscalars) |
| Reads a named field from file into a PETSc Vec, then gathers it to rank 0. | |
| PetscErrorCode | DisplayBanner (SimCtx *simCtx) |
| Displays a structured banner summarizing the simulation configuration. | |
| PetscErrorCode | StringToBCFace (const char *str, BCFace *face_out) |
Converts a face-token string (e.g., "-Xi", "+Eta") to the internal BCFace enum. | |
| PetscErrorCode | StringToBCType (const char *str, BCType *type_out) |
Converts a mathematical BC type string (e.g., "PERIODIC", "WALL") to BCType. | |
| PetscErrorCode | StringToBCHandlerType (const char *str, BCHandlerType *handler_out) |
Converts a BC handler token (implementation strategy) to BCHandlerType. | |
| PetscErrorCode | ValidateBCHandlerForBCType (BCType type, BCHandlerType handler) |
| Validates that a selected handler is compatible with a mathematical BC type. | |
| void | FreeBC_ParamList (BC_Param *head) |
| Frees an entire linked list of boundary-condition parameters. | |
| PetscErrorCode | GetBCParamReal (BC_Param *params, const char *key, PetscReal *value_out, PetscBool *found) |
| Searches a BC_Param linked list for a key and returns its value as a double. | |
| PetscErrorCode | GetBCParamBool (BC_Param *params, const char *key, PetscBool *value_out, PetscBool *found) |
| Searches a BC_Param linked list for a key and returns its value as a bool. | |
| PetscErrorCode | GetDrivenSeamFluxFlag (BC_Param *params, PetscBool *value_out, PetscBool *found) |
Read the driven-flow seam-flux flag, accepting its deprecated apply_trim spelling. | |
| PetscErrorCode | ParseAllBoundaryConditions (UserCtx *user, const char *bcs_input_filename) |
| Parses the boundary conditions file to configure the type, handler, and any associated parameters for all 6 global faces of the domain. | |
| PetscErrorCode | DeterminePeriodicity (SimCtx *simCtx) |
| Scans all block-specific boundary condition files to determine a globally consistent periodicity for each dimension, reusing the core type parser. | |
| void | TrimWhitespace (char *str) |
| Removes leading and trailing ASCII whitespace from a mutable string. | |
| PetscErrorCode | ParsePostProcessingSettings (SimCtx *simCtx) |
| Initializes post-processing settings from a config file and command-line overrides. | |
| PetscErrorCode | ParseScalingInformation (SimCtx *simCtx) |
| Parses physical scaling parameters from command-line options. | |
Public interface for data input/output routines.
This header declares functions responsible for parsing grid geometry information, either from command-line options for programmatically generated grids or by reading the header of a grid definition file.
Definition in file io.h.
| PetscErrorCode ReadGridGenerationInputs | ( | UserCtx * | user | ) |
Parses command-line options for a programmatically generated grid for a SINGLE block.
This function reads all per-block array options related to grid geometry, such as dimensions (-im), domain bounds (-xMins), and stretching ratios (-rxs). It then populates the fields of the provided UserCtx struct using its internal block index user->_this.
| user | Pointer to the UserCtx for a specific block. The function will populate the geometric fields (IM, Min_X, rx, etc.) within this struct. |
Parses command-line options for a programmatically generated grid for a SINGLE block.
Local to this translation unit.
Definition at line 447 of file io.c.
| PetscErrorCode PopulateFinestUserGridResolutionFromOptions | ( | UserCtx * | finest_users, |
| PetscInt | nblk | ||
| ) |
Parses grid resolution arrays (-im, -jm, -km) once and applies them to all finest-grid blocks.
This helper centralizes one-time resolution ingestion for analytical grid setup. It fills IM/JM/KM in each element of the finest-level UserCtx array.
| finest_users | Pointer to the finest-level UserCtx array (length nblk). |
| nblk | Number of blocks in the finest-level array. |
Parses grid resolution arrays (-im, -jm, -km) once and applies them to all finest-grid blocks.
Local to this translation unit.
Definition at line 532 of file io.c.
| PetscErrorCode ReadGridFile | ( | UserCtx * | user | ) |
Sets grid dimensions from a file for a SINGLE block using a one-time read cache.
This function uses a static-variable pattern to ensure the grid file header is read only once, collectively, by all processes on the first call. Subsequent calls simply retrieve the pre-loaded and broadcasted data for the specified block.
| user | Pointer to the UserCtx for a specific block. This function will populate the IM, JM, and KM fields. |
Sets grid dimensions from a file for a SINGLE block using a one-time read cache.
Local to this translation unit.
Definition at line 581 of file io.c.
| PetscErrorCode VerifyPathExistence | ( | const char * | path, |
| PetscBool | is_dir, | ||
| PetscBool | is_optional, | ||
| const char * | description, | ||
| PetscBool * | exists | ||
| ) |
A parallel-safe helper to verify the existence of a generic file or directory path.
This function centralizes the logic for checking arbitrary paths. Only Rank 0 performs the filesystem check, and the result is broadcast to all other processes. This ensures collective and synchronized decision-making across all ranks. It is intended for configuration files, source directories, etc., where the path is known completely.
| [in] | path | The full path to the file or directory to check. |
| [in] | is_dir | PETSC_TRUE if checking for a directory, PETSC_FALSE for a file. |
| [in] | is_optional | PETSC_TRUE if the path is optional (results in a warning), PETSC_FALSE if mandatory (results in an error). |
| [in] | description | A user-friendly description of the path for logging (e.g., "Grid file"). |
| [out] | exists | The result of the check (identical on all ranks). |
A parallel-safe helper to verify the existence of a generic file or directory path.
Local to this translation unit.
Definition at line 1128 of file io.c.
| PetscBool ShouldWriteDataOutput | ( | const SimCtx * | simCtx, |
| PetscInt | completed_step | ||
| ) |
Returns whether full field/restart output should be written for the.
completed timestep.
| simCtx | Simulation context controlling the operation. |
| completed_step | Completed step index used by the decision helper. |
ShouldWriteDataOutput().Returns whether full field/restart output should be written for the.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 432 of file io.c.
| PetscErrorCode WriteCheckpointBundle | ( | SimCtx * | simCtx, |
| const char * | reason | ||
| ) |
Write and atomically publish one complete checkpoint bundle.
| [in,out] | simCtx | Simulation context owning all enabled checkpoint state. |
| [in] | reason | Stable lifecycle reason such as initial, cadence, final, or signal. |
Write and atomically publish one complete checkpoint bundle.
Definition at line 2530 of file io.c.
| PetscErrorCode ReadSimulationFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Reads binary field data for velocity, pressure, and other required vectors.
Validates one committed checkpoint bundle and reads every enabled Eulerian checkpoint field through the field catalog.
| [in,out] | user | Pointer to the UserCtx structure containing the simulation context. |
| [in] | ti | Checkpoint step resolved below the configured source root. |
Reads binary field data for velocity, pressure, and other required vectors.
Local to this translation unit.
Definition at line 1463 of file io.c.
| PetscErrorCode RestoreFieldStatisticsState | ( | SimCtx * | simCtx, |
| PetscInt | ti | ||
| ) |
Restores field-statistics window state and accumulators from a checkpoint.
Resumes every configured window from the bundle at ti when continuation was requested, per 7. Checkpoints, Restart, and Continuation. Window scalars come from the bundle manifest and accumulator payloads through the same natural-ordering vector reader Eulerian fields use, so a restart on a different MPI rank count restores identical state.
Does nothing when statistics are disabled, no window is configured, or continuation was not requested. Anything else is fatal rather than silently zeroed: a window count mismatch, a renamed window, a changed definition hash, a requested end earlier than the represented span, or missing state.
| [in,out] | simCtx | Simulation context carrying the windows and accumulators. |
| [in] | ti | Step whose committed bundle supplies the state. |
Restores field-statistics window state and accumulators from a checkpoint.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 1667 of file io.c.
| PetscErrorCode ReadFieldData | ( | UserCtx * | user, |
| const char * | field_name, | ||
| Vec | field_vec, | ||
| const char * | ext | ||
| ) |
Reads data for a specific field from a file into the provided vector.
This function uses the field name to construct the file path and reads the data from the corresponding file into the provided PETSc vector.
| [in] | user | Pointer to the UserCtx structure containing simulation context. |
| [in] | field_name | Name of the field (e.g., "ufield", "vfield", "pfield"). |
| [out] | field_vec | PETSc vector to store the field data. |
| [in] | ext | File extension (e.g., "dat"). |
Reads data for a specific field from a file into the provided vector.
Local to this translation unit.
Definition at line 1174 of file io.c.
| PetscErrorCode WriteFieldData | ( | UserCtx * | user, |
| const char * | field_name, | ||
| Vec | field_vec, | ||
| const char * | ext | ||
| ) |
Writes data from a specific PETSc vector to a file.
This function uses the field name to construct the file path and writes the data from the provided PETSc vector to the corresponding file.
| [in] | user | Pointer to the UserCtx structure containing simulation context. |
| [in] | field_name | Name of the field (e.g., "ufield", "vfield", "pfield"). |
| [in] | field_vec | PETSc vector containing the field data to write. |
| [in] | ext | File extension (e.g., "dat"). |
Writes data from a specific PETSc vector to a file.
Local to this translation unit.
Definition at line 1947 of file io.c.
| PetscErrorCode WriteSimulationFields | ( | UserCtx * | user, |
| const char * | checkpoint_directory | ||
| ) |
Writes simulation fields to files.
This function writes contravariant velocity, Cartesian velocity, pressure, and node state fields to their respective binary files. It also conditionally writes LES and RANS model fields when those models are enabled.
| [in] | user | Pointer to the UserCtx structure containing simulation context. |
| [in] | checkpoint_directory | Root of the in-progress checkpoint bundle. |
Writes simulation fields to files.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 2002 of file io.c.
| PetscErrorCode WriteSwarmField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| const char * | ext | ||
| ) |
Writes data from a specific field in a PETSc Swarm to a file.
This function retrieves the Swarm from the UserCtx (i.e., user->swarm) and creates a global PETSc vector from the specified Swarm field. It then calls the existing WriteFieldData() function to handle the actual I/O operation. After writing the data, the function destroys the temporary global vector to avoid memory leaks.
| [in] | user | Pointer to the UserCtx structure containing simulation context and the PetscSwarm (as user->swarm). |
| [in] | field_name | Name of the Swarm field to be written (e.g., "my_field"). |
| [in] | ext | File extension (e.g., "dat", "bin"). |
Writes data from a specific field in a PETSc Swarm to a file.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 2076 of file io.c.
| PetscErrorCode WriteSwarmIntField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| const char * | ext | ||
| ) |
Writes integer data from a specific PETSc Swarm field to a file.
This function is designed for swarm fields that store integer data (e.g., DMSwarm_CellID), which cannot be converted to a standard PETSc Vec of PetscScalars. It accesses the raw data pointer for the field on each rank using DMSwarmGetField(), writes the local data to a rank-specific binary file, and then restores the field access.
| [in] | user | Pointer to the UserCtx structure containing the PetscSwarm. |
| [in] | field_name | Name of the integer Swarm field to be written. |
| [in] | ext | File extension (e.g., "dat", "bin"). |
Writes integer data from a specific PETSc Swarm field to a file.
Local to this translation unit.
Definition at line 2131 of file io.c.
| PetscErrorCode WriteAllSwarmFields | ( | UserCtx * | user, |
| const char * | checkpoint_directory | ||
| ) |
Writes a predefined set of PETSc Swarm fields to files.
This function iterates through checkpoint-capable particle catalog entries and delegates each payload to the existing generic swarm writer.
This function will only execute if particles are enabled in the simulation (i.e., user->simCtx->np > 0 and user->swarm is not NULL).
| [in] | user | Pointer to the UserCtx structure containing the simulation context and the PetscSwarm. |
| [in] | checkpoint_directory | Root of the in-progress checkpoint bundle. |
Writes a predefined set of PETSc Swarm fields to files.
Local to this translation unit.
Definition at line 2196 of file io.c.
| PetscInt ReadDataFileToArray | ( | const char * | filename, |
| double ** | data_out, | ||
| PetscInt * | Nout, | ||
| MPI_Comm | comm | ||
| ) |
Reads a simple ASCII data file containing one numeric value per line.
This helper performs rank-0 file I/O, broadcasts the parsed result to the rest of the communicator, and returns a replicated array on every rank.
| filename | Path to the input data file. |
| data_out | Output pointer to the allocated scalar array. |
| Nout | Output pointer storing the number of values read. |
| comm | MPI communicator used for the coordinated read/broadcast sequence. |
ReadDataFileToArray().Reads a simple ASCII data file containing one numeric value per line.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 3286 of file io.c.
| PetscInt CreateVTKFileFromMetadata | ( | const char * | filename, |
| const VTKMetaData * | meta, | ||
| MPI_Comm | comm | ||
| ) |
Creates a VTK file from prepared metadata and field payloads.
This helper dispatches to the structured-grid or polydata writer based on the metadata contents and emits the assembled VTK file on the requested communicator.
| filename | Path to the output VTK file. |
| meta | VTK metadata describing the output geometry and field payloads. |
| comm | MPI communicator used by the write operation. |
CreateVTKFileFromMetadata().Creates a VTK file from prepared metadata and field payloads.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/vtk_io.h.
Definition at line 149 of file vtk_io.c.
| PetscErrorCode VecToArrayOnRank0 | ( | Vec | inVec, |
| PetscInt * | N, | ||
| double ** | arrayOut | ||
| ) |
Gathers the contents of a distributed PETSc Vec into a single array on rank 0.
| [in] | inVec | The input (possibly distributed) Vec. |
| [out] | N | The global size of the vector. |
| [out] | arrayOut | On rank 0, points to the newly allocated array holding all data. On other ranks, it is set to NULL. |
Gathers the contents of a distributed PETSc Vec into a single array on rank 0.
Local to this translation unit.
Definition at line 2650 of file io.c.
| PetscErrorCode SwarmFieldToArrayOnRank0 | ( | DM | swarm, |
| const char * | field_name, | ||
| PetscInt * | n_total_particles, | ||
| PetscInt * | n_components, | ||
| PetscDataType * | field_type_out, | ||
| void ** | gathered_array | ||
| ) |
Gathers any DMSwarm field from all ranks to a single, contiguous array on rank 0.
This is a generic, type-aware version of SwarmFieldToArrayOnRank0. It is a COLLECTIVE operation.
| [in] | swarm | The DMSwarm to gather from. |
| [in] | field_name | The name of the field to gather. |
| [out] | n_total_particles | Total number of particles in the global swarm on every rank. |
| [out] | n_components | Number of components for the field on every rank. |
| [out] | field_type_out | PETSc storage type for the field on all ranks. |
| [out] | gathered_array | On rank 0, a newly allocated array containing the full, gathered data; NULL elsewhere. The caller is responsible for freeing this memory and for casting it to the correct type. |
Gathers any DMSwarm field from all ranks to a single, contiguous array on rank 0.
Local to this translation unit.
Definition at line 2686 of file io.c.
| PetscErrorCode ReadSwarmField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| const char * | ext | ||
| ) |
Reads data from a file into a specified field of a PETSc DMSwarm.
This function is the counterpart to WriteSwarmField(). It creates a global PETSc vector that references the specified DMSwarm field, uses ReadFieldData() to read the data from a file, and then destroys the global vector reference.
| [in] | user | Pointer to the UserCtx structure (containing user->swarm). |
| [in] | field_name | Name of the DMSwarm field to read into (must be previously declared/allocated). |
| [in] | ext | File extension (e.g., "dat" or "bin"). |
Reads data from a file into a specified field of a PETSc DMSwarm.
Local to this translation unit.
Definition at line 1767 of file io.c.
| PetscErrorCode ReadSwarmIntField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| const char * | ext | ||
| ) |
Reads integer swarm data by using ReadFieldData and casting the result.
This function is the counterpart to WriteSwarmIntField. It reads a file containing floating-point data (that was originally integer) into a temporary Vec and then casts it back to the integer swarm field. It works by:
| [in] | user | Pointer to the UserCtx structure. |
| [in] | field_name | Name of the integer Swarm field to be read. |
| [in] | ext | File extension. |
Reads integer swarm data by using ReadFieldData and casting the result.
Local to this translation unit.
Definition at line 1797 of file io.c.
| PetscErrorCode ReadAllSwarmFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Reads multiple fields (positions, velocity, CellID, and weight) into a DMSwarm.
This function is analogous to ReadSimulationFields() but targets a DMSwarm. Each Swarm field is read from a separate file using ReadSwarmField().
| [in,out] | user | Pointer to the UserCtx structure containing the DMSwarm (user->swarm). |
| [in] | ti | Time index for constructing the file name. |
Reads multiple fields (positions, velocity, CellID, and weight) into a DMSwarm.
Local to this translation unit.
Definition at line 1864 of file io.c.
| PetscErrorCode ReadCheckpointParticleCount | ( | UserCtx * | user, |
| PetscInt | ti, | ||
| PetscInt * | particle_count | ||
| ) |
Read the particle count from a validated committed checkpoint.
| [in,out] | user | Simulation context and active grid used for validation. |
| [in] | ti | Checkpoint step resolved below the configured source root. |
| [out] | particle_count | Number of particles recorded by the bundle. |
Read the particle count from a validated committed checkpoint.
Definition at line 1914 of file io.c.
| PetscErrorCode ReadPositionsFromFile | ( | PetscInt | timeIndex, |
| UserCtx * | user, | ||
| double ** | coordsArray, | ||
| PetscInt * | Ncoords | ||
| ) |
Reads coordinate data (for particles) from file into a PETSc Vec, then gathers it to rank 0.
This function uses ReadFieldData to fill a PETSc Vec with coordinate data, then leverages VecToArrayOnRank0 to gather that data into a contiguous array (valid on rank 0 only).
| [in] | timeIndex | The time index used to construct file names. |
| [in] | user | Pointer to the user context. |
| [out] | coordsArray | On rank 0, will point to a newly allocated array holding the coordinates. |
| [out] | Ncoords | On rank 0, the length of coordsArray. On other ranks, 0. |
Reads coordinate data (for particles) from file into a PETSc Vec, then gathers it to rank 0.
Local to this translation unit.
Definition at line 3418 of file io.c.
| PetscErrorCode ReadFieldDataToRank0 | ( | PetscInt | timeIndex, |
| const char * | fieldName, | ||
| UserCtx * | user, | ||
| double ** | scalarArray, | ||
| PetscInt * | Nscalars | ||
| ) |
Reads a named field from file into a PETSc Vec, then gathers it to rank 0.
This function wraps ReadFieldData and VecToArrayOnRank0 into a single step. The gathered data is stored in scalarArray on rank 0, with its length in Nscalars.
| [in] | timeIndex | The time index used to construct file names. |
| [in] | fieldName | Name of the field to be read (e.g., "velocity"). |
| [in] | user | Pointer to the user context. |
| [out] | scalarArray | On rank 0, a newly allocated array holding the field data. |
| [out] | Nscalars | On rank 0, length of scalarArray. On other ranks, 0. |
Reads a named field from file into a PETSc Vec, then gathers it to rank 0.
Local to this translation unit.
Definition at line 3456 of file io.c.
| PetscErrorCode DisplayBanner | ( | SimCtx * | simCtx | ) |
Displays a structured banner summarizing the simulation configuration.
This function prints effective key simulation parameters to standard output on MPI rank 0. It retrieves global domain bounds and block metadata from simCtx, and suppresses settings that do not apply to the selected mode. For example, Initial Pseudo-CFL (Courant) appears only for the Dual Time Picard–Jameson RK momentum solver; it is not a Newton–Krylov control. The report also identifies active logging, profiling, runtime-memory, and solution-convergence modes so the startup log records the effective observability contract.
| [in] | simCtx | Pointer to the master simulation context. |
0 on success.Displays a structured banner summarizing the simulation configuration.
Reports only configuration that applies to the selected run mode. In particular, pseudo-CFL is a Dual Time Picard–Jameson RK control and is deliberately omitted for explicit and Newton–Krylov momentum solves.
Definition at line 2776 of file io.c.
| PetscErrorCode StringToBCFace | ( | const char * | str, |
| BCFace * | face_out | ||
| ) |
Converts a face-token string (e.g., "-Xi", "+Eta") to the internal BCFace enum.
| [in] | str | Input token from configuration. |
| [out] | face_out | Parsed enum value on success. |
Converts a face-token string (e.g., "-Xi", "+Eta") to the internal BCFace enum.
Local to this translation unit.
Definition at line 679 of file io.c.
| PetscErrorCode StringToBCType | ( | const char * | str, |
| BCType * | type_out | ||
| ) |
Converts a mathematical BC type string (e.g., "PERIODIC", "WALL") to BCType.
| [in] | str | Input token from configuration. |
| [out] | type_out | Parsed enum value on success. |
Converts a mathematical BC type string (e.g., "PERIODIC", "WALL") to BCType.
Local to this translation unit.
Definition at line 694 of file io.c.
| PetscErrorCode StringToBCHandlerType | ( | const char * | str, |
| BCHandlerType * | handler_out | ||
| ) |
Converts a BC handler token (implementation strategy) to BCHandlerType.
| [in] | str | Input handler token from configuration. |
| [out] | handler_out | Parsed enum value on success. |
Converts a BC handler token (implementation strategy) to BCHandlerType.
Local to this translation unit.
Definition at line 709 of file io.c.
| PetscErrorCode ValidateBCHandlerForBCType | ( | BCType | type, |
| BCHandlerType | handler | ||
| ) |
Validates that a selected handler is compatible with a mathematical BC type.
| [in] | type | Mathematical BC type (e.g., WALL, PERIODIC). |
| [in] | handler | Selected handler implementation enum. |
Validates that a selected handler is compatible with a mathematical BC type.
Local to this translation unit.
Definition at line 727 of file io.c.
| void FreeBC_ParamList | ( | BC_Param * | head | ) |
Frees an entire linked list of boundary-condition parameters.
| [in,out] | head | Head pointer of the BC_Param list to destroy. |
Frees an entire linked list of boundary-condition parameters.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 664 of file io.c.
| PetscErrorCode GetBCParamReal | ( | BC_Param * | params, |
| const char * | key, | ||
| PetscReal * | value_out, | ||
| PetscBool * | found | ||
| ) |
Searches a BC_Param linked list for a key and returns its value as a double.
| params | The head of the BC_Param linked list. | |
| key | The key to search for (case-insensitive). | |
| [out] | value_out | The found value, converted to a PetscReal. |
| [out] | found | Set to PETSC_TRUE if the key was found, PETSC_FALSE otherwise. |
Searches a BC_Param linked list for a key and returns its value as a double.
Local to this translation unit.
Definition at line 752 of file io.c.
| PetscErrorCode GetBCParamBool | ( | BC_Param * | params, |
| const char * | key, | ||
| PetscBool * | value_out, | ||
| PetscBool * | found | ||
| ) |
Searches a BC_Param linked list for a key and returns its value as a bool.
| params | The head of the BC_Param linked list. | |
| key | The key to search for (case-insensitive). | |
| [out] | value_out | The found value, converted to a PetscBool. |
| [out] | found | Set to PETSC_TRUE if the key was found, PETSC_FALSE otherwise. |
Searches a BC_Param linked list for a key and returns its value as a bool.
Local to this translation unit.
Definition at line 773 of file io.c.
| PetscErrorCode GetDrivenSeamFluxFlag | ( | BC_Param * | params, |
| PetscBool * | value_out, | ||
| PetscBool * | found | ||
| ) |
Read the driven-flow seam-flux flag, accepting its deprecated apply_trim spelling.
| [in] | params | Parameter list for the face. |
| [out] | value_out | Resolved flag value. |
| [out] | found | Whether either spelling was present. |
Read the driven-flow seam-flux flag, accepting its deprecated apply_trim spelling.
The option was originally spelled apply_trim, which said that something was trimmed but not what or why. The canonical name is now enforce_seam_flux. Generated bcs.run files carry the canonical name, but a hand-written or archived one may still use the old spelling, so both are accepted here and the canonical name wins. The argument contract lives with the header declaration in include/io.h.
Definition at line 814 of file io.c.
| PetscErrorCode ParseAllBoundaryConditions | ( | UserCtx * | user, |
| const char * | bcs_input_filename | ||
| ) |
Parses the boundary conditions file to configure the type, handler, and any associated parameters for all 6 global faces of the domain.
This function performs the following steps:
<Face> <Type> <Handler> [param=value]... format.user->boundary_faces array identically.UserCtx.| [in,out] | user | The main UserCtx struct where the final configuration for all ranks will be stored. |
| [in] | bcs_input_filename | The path to the boundary conditions configuration file. |
Parses the boundary conditions file to configure the type, handler, and any associated parameters for all 6 global faces of the domain.
Local to this translation unit.
Definition at line 837 of file io.c.
| PetscErrorCode DeterminePeriodicity | ( | SimCtx * | simCtx | ) |
Scans all block-specific boundary condition files to determine a globally consistent periodicity for each dimension, reusing the core type parser.
This is a lightweight pre-parser intended to be called before DMDA creation. It ensures that the periodicity setting is consistent across all blocks, which is a physical requirement for the domain.
StringToBCType helper.| [in,out] | simCtx | The master SimCtx struct, containing the bcs_files list and where the final periodicity flags will be stored. |
Scans all block-specific boundary condition files to determine a globally consistent periodicity for each dimension, reusing the core type parser.
Local to this translation unit.
Definition at line 1024 of file io.c.
| void TrimWhitespace | ( | char * | str | ) |
Removes leading and trailing ASCII whitespace from a mutable string.
| [in,out] | str | NUL-terminated string compacted in place. |
Removes leading and trailing ASCII whitespace from a mutable string.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 399 of file io.c.
| PetscErrorCode ParsePostProcessingSettings | ( | SimCtx * | simCtx | ) |
Initializes post-processing settings from a config file and command-line overrides.
This function establishes the configuration for a post-processing run by:
| simCtx | The pointer to the simulation context that contains the postprocessing file and struct. |
Initializes post-processing settings from a config file and command-line overrides.
Local to this translation unit.
Definition at line 3076 of file io.c.
| PetscErrorCode ParseScalingInformation | ( | SimCtx * | simCtx | ) |
Parses physical scaling parameters from command-line options.
This function reads the reference length, velocity, and density from the PETSc options database (provided via -scaling_L_ref, etc.). It populates the simCtx->scaling struct and calculates the derived reference pressure. It sets default values of 1.0 for a fully non-dimensional case if the options are not provided.
| [in,out] | simCtx | The simulation context whose 'scaling' member will be populated. |
Parses physical scaling parameters from command-line options.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 3242 of file io.c.