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 | 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. | |
| PetscErrorCode | CreateVTKFileFromMetadata (const char *filename, const VTKMetaData *meta, MPI_Comm comm) |
| Creates a VTK file from prepared metadata and field payloads. | |
| 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 | 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 | GetBCParamString (BC_Param *params, const char *key, const char **value_out, PetscBool *found) |
| Searches a BC_Param linked list for a key and returns its value as a string. | |
| 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. | |
| PetscBool | CheckpointFieldIsEnabled (const SimCtx *simCtx, const FieldDescriptor *descriptor) |
| Return whether a catalogued field belongs in the current checkpoint. | |
| PetscErrorCode | PicurvPhysicalTime (const SimCtx *simCtx, PetscReal solver_time, PetscReal *physical) |
Convert a solver time to physical seconds, t * L_ref / U_ref. | |
| PetscErrorCode | PicurvFieldReferenceScale (SimCtx *simCtx, const char *field_name, PetscReal *scale, char *description, size_t description_length) |
| Physical scale one field is multiplied by to leave non-dimensional form. | |
| 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.
Definition at line 537 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.
Definition at line 636 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.
Definition at line 1202 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 521 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 2501 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.
Definition at line 1387 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.
Under EXEC_MODE_RESTART_CHECK it needs no grid: it validates the bundle and every window against the manifest, skipping only the geometry comparison and the payload reads, and returns. The CLI runs that before staging a carried restart, so an incompatible window is refused before a job is queued.
| [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 1604 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.
Definition at line 1248 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.
Definition at line 1901 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 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 1954 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 2031 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.
Definition at line 2088 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.
Definition at line 2155 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 3300 of file io.c.
| PetscErrorCode 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 172 of file vtk_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.
Definition at line 1714 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.
Definition at line 1746 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.
Definition at line 1815 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 1868 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 2635 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.
Definition at line 736 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.
Definition at line 753 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.
Definition at line 773 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.
Definition at line 793 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 719 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.
Definition at line 819 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.
Definition at line 836 of file io.c.
| PetscErrorCode GetBCParamString | ( | BC_Param * | params, |
| const char * | key, | ||
| const char ** | value_out, | ||
| PetscBool * | found | ||
| ) |
Searches a BC_Param linked list for a key and returns its value as a string.
| params | The head of the BC_Param linked list. | |
| key | The key to search for (case-insensitive). | |
| [out] | value_out | Borrowed pointer to the matching value string, or NULL if absent. |
| [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 string.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 859 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 888 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.
Definition at line 911 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.
Definition at line 1096 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 486 of file io.c.
| PetscBool CheckpointFieldIsEnabled | ( | const SimCtx * | simCtx, |
| const FieldDescriptor * | descriptor | ||
| ) |
Return whether a catalogued field belongs in the current checkpoint.
A checkpointed field whose subsystem is active (turbulence, dynamic LES, particles, wall model). These are exactly the fields a checkpoint read can load, so consumers of loaded state use the same predicate.
| [in] | simCtx | Run context whose active subsystems decide availability. |
| [in] | descriptor | Catalog entry to test. |
PETSC_TRUE when the field is checkpointed in this run.Return whether a catalogued field belongs in the current checkpoint.
Definition at line 75 of file io.c.
| PetscErrorCode PicurvPhysicalTime | ( | const SimCtx * | simCtx, |
| PetscReal | solver_time, | ||
| PetscReal * | physical | ||
| ) |
Convert a solver time to physical seconds, t * L_ref / U_ref.
Runtime diagnostics record solver time; each also reports this physical time so a history can be plotted in seconds without the case's scales at hand.
| [in] | simCtx | Context carrying the reference scales. |
| [in] | solver_time | Time in solver units. |
| [out] | physical | Time in seconds. |
Convert a solver time to physical seconds, t * L_ref / U_ref.
Definition at line 2986 of file io.c.
| PetscErrorCode PicurvFieldReferenceScale | ( | SimCtx * | simCtx, |
| const char * | field_name, | ||
| PetscReal * | scale, | ||
| char * | description, | ||
| size_t | description_length | ||
| ) |
Physical scale one field is multiplied by to leave non-dimensional form.
Each field's dimension is recorded once, on its entry in the Eulerian or particle field catalog; this resolves a name against both and applies the run's reference scales. Field dimensionalization, derived field statistics, and anything else needing a physical scale read it from here.
| [in] | simCtx | Context carrying the resolved reference scales. |
| [in] | field_name | Case-insensitive catalogued field name or alias. |
| [out] | scale | Multiplicative factor. |
| [out] | description | Optional human-readable dimension, may be NULL. |
| [in] | description_length | Capacity of description. |
PETSC_ERR_ARG_UNKNOWN_TYPE for a name in neither catalog, and PETSC_ERR_ARG_WRONGSTATE for a field without a fixed dimension (bookkeeping, or staging storage whose dimension is its source's).Physical scale one field is multiplied by to leave non-dimensional form.
The argument and return contract is documented in include/io.h.
Definition at line 3006 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.
Definition at line 3051 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 3256 of file io.c.