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 | ReadGridFile (UserCtx *user) |
Sets grid dimensions from a file for a SINGLE block using a one-time read cache. | |
PetscErrorCode | ReadSimulationFields (UserCtx *user, PetscInt ti) |
Reads binary field data for velocity, pressure, and other required vectors. | |
PetscErrorCode | ReadFieldData (UserCtx *user, const char *field_name, Vec field_vec, PetscInt ti, const char *ext) |
Reads data for a specific field from a file into the provided vector. | |
PetscErrorCode | ReadStatisticalFields (UserCtx *user, PetscInt ti) |
Reads statistical fields used for time-averaged simulations. | |
PetscErrorCode | ReadLESFields (UserCtx *user, PetscInt ti) |
Reads LES-related fields used in turbulence modeling. | |
PetscErrorCode | ReadRANSFields (UserCtx *user, PetscInt ti) |
Reads RANS-related fields for turbulence modeling. | |
PetscErrorCode | WriteFieldData (UserCtx *user, const char *field_name, Vec field_vec, PetscInt ti, const char *ext) |
Writes data from a specific PETSc vector to a file. | |
PetscErrorCode | WriteSimulationFields (UserCtx *user) |
Writes simulation fields to files. | |
PetscErrorCode | WriteStatisticalFields (UserCtx *user) |
Writes statistical fields for averaging purposes. | |
PetscErrorCode | WriteLESFields (UserCtx *user) |
Writes LES-related fields. | |
PetscErrorCode | WriteRANSFields (UserCtx *user) |
Writes RANS-related fields. | |
PetscErrorCode | WriteSwarmField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
Writes data from a specific field in a PETSc Swarm to a file. | |
PetscErrorCode | WriteSwarmIntField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
Writes integer data from a specific PETSc Swarm field to a file. | |
PetscErrorCode | WriteAllSwarmFields (UserCtx *user) |
Writes a predefined set of PETSc Swarm fields to files. | |
PetscInt | ReadDataFileToArray (const char *filename, double **data_out, PetscInt *Nout, MPI_Comm comm) |
PetscInt | CreateVTKFileFromMetadata (const char *filename, const VTKMetaData *meta, MPI_Comm comm) |
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, 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, PetscInt ti, const char *ext) |
Reads data from a file into a specified field of a PETSc DMSwarm. | |
PetscErrorCode | ReadSwarmIntField (UserCtx *user, const char *field_name, PetscInt ti, 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 | 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 string representation of a face to a BCFace enum. | |
PetscErrorCode | StringToBCType (const char *str, BCType *type_out) |
Converts a string representation of a BC type to a BCType enum. | |
PetscErrorCode | StringToBCHandlerType (const char *str, BCHandlerType *handler_out) |
Converts a string representation of a handler to a BCHandlerType enum. | |
PetscErrorCode | ValidateBCHandlerForBCType (BCType type, BCHandlerType handler) |
Validates that a specific handler is compatible with a general BC type. | |
void | FreeBC_ParamList (BC_Param *head) |
Frees the memory allocated for a linked list of BC_Param structs. | |
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. | |
void | TrimWhitespace (char *str) |
Helper function to trim leading/trailing whitespace from a string. | |
PetscErrorCode | ParsePostProcessingSettings (SimCtx *simCtx) |
Initializes post-processing settings from a config file and command-line overrides. | |
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. |
This function is responsible for reading all per-block array options related to grid geometry, such as dimensions (-im
), domain bounds (-xMins
, -xMaxs
), and stretching ratios (-rxs
). It reads the entire array for each option, then uses the block index stored in user->_this
to select the correct value and populate the fields of the provided UserCtx
struct.
user | Pointer to the UserCtx for a specific block. The function will populate the geometric fields (IM , Min_X , rx , etc.) within this struct. |
Definition at line 47 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. |
This function uses a static-variable pattern to ensure the grid file header is read only once, collectively, by all processes. The first time any process calls this function, it triggers a collective operation where rank 0 reads the file and broadcasts the dimensions for all blocks. This data is stored in static "cached" arrays.
On every call (including the first), the function retrieves the dimensions for the specific block (identified by user->_this
) from the cached arrays and populates the IM
, JM
, and KM
fields of the provided UserCtx
.
user | Pointer to the UserCtx for a specific block. |
Definition at line 145 of file io.c.
PetscErrorCode ReadSimulationFields | ( | UserCtx * | user, |
PetscInt | ti | ||
) |
Reads binary field data for velocity, pressure, and other required vectors.
Reads contravariant velocity (Ucont
) from vfield
, Cartesian velocity (Ucat
) from ufield
, pressure (P
), node state (Nvert_o
), and optionally statistical quantities, LES, and RANS fields from binary files. Logs missing files but continues execution.
[in,out] | user | Pointer to the UserCtx structure containing the simulation context. |
[in] | The | timestep at which the simulation field data needs to be read. |
Reads binary field data for velocity, pressure, and other required vectors.
This function reads contravariant velocity, Cartesian velocity, pressure, and node state fields from their respective binary files. It also conditionally reads LES, RANS, and statistical fields if they are enabled.
[in,out] | user | Pointer to the UserCtx structure containing simulation context. |
[in] | ti | Time index for constructing the file name. |
Definition at line 823 of file io.c.
PetscErrorCode ReadFieldData | ( | UserCtx * | user, |
const char * | field_name, | ||
Vec | field_vec, | ||
PetscInt | ti, | ||
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] | ti | Time index for constructing the file name. |
[in] | ext | File extension (e.g., "dat"). |
Definition at line 639 of file io.c.
PetscErrorCode ReadStatisticalFields | ( | UserCtx * | user, |
PetscInt | ti | ||
) |
Reads statistical fields used for time-averaged simulations.
Reads statistical quantities such as velocity sums and pressure sums. Logs missing files and initializes fields to zero if files are unavailable.
[in,out] | user | Pointer to the UserCtx structure containing the simulation context. |
[in] | The | timestep at which the simulation field data needs to be read. |
Reads statistical fields used for time-averaged simulations.
This function reads data for fields such as Ucat_sum, Ucat_cross_sum, Ucat_square_sum, and P_sum, used for statistical analysis during simulation.
[in,out] | user | Pointer to the UserCtx structure containing simulation context. |
[in] | ti | Time index for constructing the file name. |
Definition at line 884 of file io.c.
PetscErrorCode ReadLESFields | ( | UserCtx * | user, |
PetscInt | ti | ||
) |
Reads LES-related fields used in turbulence modeling.
Reads the Smagorinsky constant (Cs
) and transfers data to local vectors. Logs missing files and initializes fields to zero if files are unavailable.
[in,out] | user | Pointer to the UserCtx structure containing the simulation context. |
[in] | ti | Time index for constructing the file name. |
Reads LES-related fields used in turbulence modeling.
This function reads LES-related fields such as Cs (Smagorinsky constant) into their respective PETSc vectors.
[in,out] | user | Pointer to the UserCtx structure containing simulation context. |
[in] | ti | Time index for constructing the file name. |
Definition at line 911 of file io.c.
PetscErrorCode ReadRANSFields | ( | UserCtx * | user, |
PetscInt | ti | ||
) |
Reads RANS-related fields for turbulence modeling.
Reads K_Omega
fields (used in RANS modeling) and initializes them if files are unavailable.
[in,out] | user | Pointer to the UserCtx structure containing the simulation context. |
[in] | ti | Time index for constructing the file name. |
Reads RANS-related fields for turbulence modeling.
This function reads RANS-related fields such as K_Omega into their respective PETSc vectors.
[in,out] | user | Pointer to the UserCtx structure containing simulation context. |
[in] | ti | Time index for constructing the file name. |
Definition at line 940 of file io.c.
PetscErrorCode WriteFieldData | ( | UserCtx * | user, |
const char * | field_name, | ||
Vec | field_vec, | ||
PetscInt | ti, | ||
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] | ti | Time index for constructing the file name. |
[in] | ext | File extension (e.g., "dat"). |
Writes data from a specific PETSc vector to a file.
This function is now parallel-safe.
This ensures the output file is always in a simple, portable format.
[in] | user | Pointer to the UserCtx structure. |
[in] | field_name | Name of the field (e.g., "position"). |
[in] | field_vec | The parallel PETSc vector containing the data to write. |
[in] | ti | Time index for constructing the file name. |
[in] | ext | File extension (e.g., "dat"). |
Dump a distributed PETSc Vec to the single sequential file format used by our restart / post-processing tools.
The companion of ReadFieldData(): it always produces one file (e.g. results/ufield00006_0.dat
) regardless of how many MPI ranks are running.
Behaviour
# MPI ranks | Strategy |
---|---|
1 | Direct VecView() into the file. |
> 1 | VecScatterCreateToZero() gathers the distributed Vec onto rank 0. |
Rank 0 writes the sequential Vec; all other ranks allocate no storage. |
The routine never alters or destroys the parallel Vec passed in; the gather buffer is created and freed internally.
[in] | user | Simulation context (used only for logging). |
[in] | field_name | Logical field name (forms part of the filename). |
[in] | field_vec | Distributed PETSc Vec to write. |
[in] | ti | Timestep index used in the filename. |
[in] | ext | File extension ("dat" in our workflow). |
0
on success or a PETSc error code. Definition at line 1180 of file io.c.
PetscErrorCode WriteSimulationFields | ( | UserCtx * | user | ) |
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, RANS, and statistical fields if they are enabled.
[in] | user | Pointer to the UserCtx structure containing simulation context. |
Definition at line 1280 of file io.c.
PetscErrorCode WriteStatisticalFields | ( | UserCtx * | user | ) |
Writes statistical fields for averaging purposes.
This function writes data for fields such as Ucat_sum, Ucat_cross_sum, Ucat_square_sum, and P_sum to their respective binary files.
[in] | user | Pointer to the UserCtx structure containing simulation context. |
Definition at line 1335 of file io.c.
PetscErrorCode WriteLESFields | ( | UserCtx * | user | ) |
Writes LES-related fields.
This function writes LES-related fields such as Cs (Smagorinsky constant) to their respective binary files.
[in] | user | Pointer to the UserCtx structure containing simulation context. |
Definition at line 1363 of file io.c.
PetscErrorCode WriteRANSFields | ( | UserCtx * | user | ) |
Writes RANS-related fields.
This function writes RANS-related fields such as K_Omega to their respective binary files.
[in] | user | Pointer to the UserCtx structure containing simulation context. |
Definition at line 1393 of file io.c.
PetscErrorCode WriteSwarmField | ( | UserCtx * | user, |
const char * | field_name, | ||
PetscInt | ti, | ||
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] | ti | Time index used to construct the output file name. |
[in] | ext | File extension (e.g., "dat", "bin"). |
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] | ti | Time index used to construct the output file name. |
[in] | ext | File extension (e.g., "dat", "bin"). |
Definition at line 1427 of file io.c.
PetscErrorCode WriteSwarmIntField | ( | UserCtx * | user, |
const char * | field_name, | ||
PetscInt | ti, | ||
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] | ti | Time index used to construct the output file name. |
[in] | ext | File extension (e.g., "dat", "bin"). |
Writes integer data from a specific PETSc Swarm field to a file.
This function provides a bridge to write integer-based swarm fields (like DMSwarm_CellID) using the existing Vec-based I/O routine (WriteFieldData). It works by:
[in] | user | Pointer to the UserCtx structure. |
[in] | field_name | Name of the integer Swarm field to be written. |
[in] | ti | Time index for the output file. |
[in] | ext | File extension. |
Definition at line 1496 of file io.c.
PetscErrorCode WriteAllSwarmFields | ( | UserCtx * | user | ) |
Writes a predefined set of PETSc Swarm fields to files.
This function iterates through a hardcoded list of common swarm fields (position, velocity, etc.) and calls the WriteSwarmField() helper function for each one. This provides a straightforward way to output essential particle data at a given simulation step.
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. |
Definition at line 1568 of file io.c.
PetscInt ReadDataFileToArray | ( | const char * | filename, |
double ** | data_out, | ||
PetscInt * | Nout, | ||
MPI_Comm | comm | ||
) |
Definition at line 2050 of file io.c.
PetscInt CreateVTKFileFromMetadata | ( | const char * | filename, |
const VTKMetaData * | meta, | ||
MPI_Comm | comm | ||
) |
Definition at line 128 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.
If the Vec has a DMDA attached, the gather is performed in DMDA "natural" ordering.
[in] | inVec | The PETSc Vec (may be distributed). |
[out] | N | Global length of the Vec (includes dof). |
[out] | arrayOut | On rank 0, newly allocated buffer with the gathered values (PetscScalar-sized). On other ranks, set to NULL. |
Definition at line 1619 of file io.c.
PetscErrorCode SwarmFieldToArrayOnRank0 | ( | DM | swarm, |
const char * | field_name, | ||
PetscInt * | n_total_particles, | ||
PetscInt * | n_components, | ||
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 | (Output on rank 0) Total number of particles in the global swarm. |
[out] | n_components | (Output on rank 0) Number of components for the field. |
[out] | gathered_array | (Output on rank 0) A newly allocated array containing the full, gathered data. The caller is responsible for freeing this memory and for casting it to the correct type. |
Definition at line 1714 of file io.c.
PetscErrorCode ReadSwarmField | ( | UserCtx * | user, |
const char * | field_name, | ||
PetscInt | ti, | ||
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] | ti | Time index used to construct the input file name. |
[in] | ext | File extension (e.g., "dat" or "bin"). |
Definition at line 977 of file io.c.
PetscErrorCode ReadSwarmIntField | ( | UserCtx * | user, |
const char * | field_name, | ||
PetscInt | ti, | ||
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] | ti | Time index for the input file. |
[in] | ext | File extension. |
Definition at line 1022 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.
This function reads all necessary and optional fields for a DMSwarm for a given timestep. It assumes the swarm has already been resized to match the particle count in the input files.
The 'position' field is considered MANDATORY. If its file is missing or corrupt, the function will return a fatal error.
All other fields (velocity, CellID, weight, etc.) are OPTIONAL. If their corresponding files are not found, a warning is logged, and the function continues without error. If an optional file IS found but is corrupt or has a size mismatch, it is treated as a fatal error.
[in,out] | user | Pointer to the UserCtx structure containing the DMSwarm (user->swarm). |
[in] | ti | Time index for constructing the file names. |
Definition at line 1100 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. |
Definition at line 2192 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. |
Definition at line 2240 of file io.c.
PetscErrorCode DisplayBanner | ( | SimCtx * | simCtx | ) |
Displays a structured banner summarizing the simulation configuration.
This function prints key simulation parameters to standard output. It is intended to be called ONLY by MPI rank 0. It retrieves global domain bounds from user->global_domain_bbox
and boundary conditions for all faces from user->face_bc_types
.
[in] | user | Pointer to UserCtx structure. |
[in] | bboxlist | (If rank 0 needed to compute global_domain_bbox here, otherwise NULL) |
0
on success.This function prints key simulation parameters to standard output. It is intended to be called ONLY by MPI rank 0. It retrieves global domain bounds from user->global_domain_bbox
and boundary conditions for all faces from user->face_bc_types
.
[in] | user | Pointer to UserCtx structure. |
[in] | StartTime | Initial simulation time. |
[in] | StartStep | Starting timestep index. |
[in] | StepsToRun | Total number of timesteps to run. |
[in] | num_mpi_procs | Total number of MPI processes. |
[in] | total_num_particles | Total number of particles. |
[in] | bboxlist | (If rank 0 needed to compute global_domain_bbox here, otherwise NULL) |
0
on success. Definition at line 1807 of file io.c.
PetscErrorCode StringToBCFace | ( | const char * | str, |
BCFace * | face_out | ||
) |
Converts a string representation of a face to a BCFace enum.
str | The input string (e.g., "-Xi", "+Zeta"). Case-insensitive. | |
[out] | face_out | The resulting BCFace enum. |
Definition at line 246 of file io.c.
PetscErrorCode StringToBCType | ( | const char * | str, |
BCType * | type_out | ||
) |
Converts a string representation of a BC type to a BCType enum.
str | The input string (e.g., "WALL", "INLET"). Case-insensitive. | |
[out] | type_out | The resulting BCType enum. |
Definition at line 263 of file io.c.
PetscErrorCode StringToBCHandlerType | ( | const char * | str, |
BCHandlerType * | handler_out | ||
) |
Converts a string representation of a handler to a BCHandlerType enum.
str | The input string (e.g., "noslip", "constant_velocity"). Case-insensitive. | |
[out] | handler_out | The resulting BCHandlerType enum. |
Definition at line 280 of file io.c.
PetscErrorCode ValidateBCHandlerForBCType | ( | BCType | type, |
BCHandlerType | handler | ||
) |
Validates that a specific handler is compatible with a general BC type.
type | The general BCType. |
handler | The specific BCHandlerType. |
Definition at line 297 of file io.c.
void FreeBC_ParamList | ( | BC_Param * | head | ) |
Frees the memory allocated for a linked list of BC_Param structs.
head | A pointer to the head of the linked list to be freed. |
Definition at line 229 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.[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. |
Definition at line 339 of file io.c.
void TrimWhitespace | ( | char * | str | ) |
Helper function to trim leading/trailing whitespace from a string.
str | The string to trim in-place. |
Definition at line 1910 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. |
This function establishes the configuration for a post-processing run by:
configFile | The path to the configuration file to parse. |
pps | Pointer to the PostProcessParams struct to be populated. |
Definition at line 1935 of file io.c.