|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Implementation of data input/output routines, focusing on grid configuration. More...
#include "io.h"Go to the source code of this file.
Macros | |
| #define | __FUNCT__ "ReadGridGenerationInputs" |
| #define | __FUNCT__ "ReadGridFile" |
| #define | __FUNCT__ "ParseAllBoundaryConditions" |
| #define | __FUNCT__ "DeterminePeriodicity" |
| #define | __FUNCT__ "ReadFieldData" |
| #define | __FUNCT__ "WriteFieldData" |
| #define | __FUNCT__ "ParsePostProcessingSettings" |
| #define | __FUNCT__ "ParseScalingInformation" |
Functions | |
| void | TrimWhitespace (char *str) |
| Implementation of TrimWhitespace(). | |
| PetscBool | ShouldWriteDataOutput (const SimCtx *simCtx, PetscInt completed_step) |
| Implementation of ShouldWriteDataOutput(). | |
| PetscErrorCode | ReadGridGenerationInputs (UserCtx *user) |
Internal helper implementation: ReadGridGenerationInputs(). | |
| PetscErrorCode | PopulateFinestUserGridResolutionFromOptions (UserCtx *finest_users, PetscInt nblk) |
Internal helper implementation: PopulateFinestUserGridResolutionFromOptions(). | |
| PetscErrorCode | ReadGridFile (UserCtx *user) |
Internal helper implementation: ReadGridFile(). | |
| void | FreeBC_ParamList (BC_Param *head) |
| Implementation of FreeBC_ParamList(). | |
| PetscErrorCode | StringToBCFace (const char *str, BCFace *face_out) |
Internal helper implementation: StringToBCFace(). | |
| PetscErrorCode | StringToBCType (const char *str, BCType *type_out) |
Internal helper implementation: StringToBCType(). | |
| PetscErrorCode | StringToBCHandlerType (const char *str, BCHandlerType *handler_out) |
Internal helper implementation: StringToBCHandlerType(). | |
| PetscErrorCode | ValidateBCHandlerForBCType (BCType type, BCHandlerType handler) |
Internal helper implementation: ValidateBCHandlerForBCType(). | |
| PetscErrorCode | GetBCParamReal (BC_Param *params, const char *key, PetscReal *value_out, PetscBool *found) |
Internal helper implementation: GetBCParamReal(). | |
| PetscErrorCode | GetBCParamBool (BC_Param *params, const char *key, PetscBool *value_out, PetscBool *found) |
Internal helper implementation: GetBCParamBool(). | |
| PetscErrorCode | ParseAllBoundaryConditions (UserCtx *user, const char *bcs_input_filename) |
Internal helper implementation: ParseAllBoundaryConditions(). | |
| PetscErrorCode | DeterminePeriodicity (SimCtx *simCtx) |
Internal helper implementation: DeterminePeriodicity(). | |
| PetscErrorCode | VerifyPathExistence (const char *path, PetscBool is_dir, PetscBool is_optional, const char *description, PetscBool *exists) |
Internal helper implementation: VerifyPathExistence(). | |
| static PetscErrorCode | CheckDataFile (UserCtx *user, PetscInt ti, const char *fieldName, const char *ext, PetscBool *fileExists) |
Internal helper implementation: CheckDataFile(). | |
| static PetscErrorCode | ReadOptionalField (UserCtx *user, const char *field_name, const char *field_label, Vec field_vec, PetscInt ti, const char *ext) |
Internal helper implementation: ReadOptionalField(). | |
| static PetscErrorCode | ReadOptionalSwarmField (UserCtx *user, const char *field_name, const char *field_label, PetscInt ti, const char *ext) |
Internal helper implementation: ReadOptionalSwarmField(). | |
| PetscErrorCode | ReadFieldData (UserCtx *user, const char *field_name, Vec field_vec, PetscInt ti, const char *ext) |
Internal helper implementation: ReadFieldData(). | |
| PetscErrorCode | ReadSimulationFields (UserCtx *user, PetscInt ti) |
Internal helper implementation: ReadSimulationFields(). | |
| PetscErrorCode | ReadStatisticalFields (UserCtx *user, PetscInt ti) |
| Implementation of ReadStatisticalFields(). | |
| PetscErrorCode | ReadLESFields (UserCtx *user, PetscInt ti) |
Internal helper implementation: ReadLESFields(). | |
| PetscErrorCode | ReadRANSFields (UserCtx *user, PetscInt ti) |
Internal helper implementation: ReadRANSFields(). | |
| PetscErrorCode | ReadSwarmField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
Internal helper implementation: ReadSwarmField(). | |
| PetscErrorCode | ReadSwarmIntField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
Internal helper implementation: ReadSwarmIntField(). | |
| PetscErrorCode | ReadAllSwarmFields (UserCtx *user, PetscInt ti) |
Internal helper implementation: ReadAllSwarmFields(). | |
| PetscErrorCode | WriteFieldData (UserCtx *user, const char *field_name, Vec field_vec, PetscInt ti, const char *ext) |
Internal helper implementation: WriteFieldData(). | |
| PetscErrorCode | WriteSimulationFields (UserCtx *user) |
| Implementation of WriteSimulationFields(). | |
| PetscErrorCode | WriteStatisticalFields (UserCtx *user) |
| Implementation of WriteStatisticalFields(). | |
| PetscErrorCode | WriteLESFields (UserCtx *user) |
Internal helper implementation: WriteLESFields(). | |
| PetscErrorCode | WriteRANSFields (UserCtx *user) |
| Implementation of WriteRANSFields(). | |
| PetscErrorCode | WriteSwarmField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
| Implementation of WriteSwarmField(). | |
| PetscErrorCode | WriteSwarmIntField (UserCtx *user, const char *field_name, PetscInt ti, const char *ext) |
Internal helper implementation: WriteSwarmIntField(). | |
| PetscErrorCode | WriteAllSwarmFields (UserCtx *user) |
Internal helper implementation: WriteAllSwarmFields(). | |
| PetscErrorCode | VecToArrayOnRank0 (Vec inVec, PetscInt *N, double **arrayOut) |
Internal helper implementation: VecToArrayOnRank0(). | |
| PetscErrorCode | SwarmFieldToArrayOnRank0 (DM swarm, const char *field_name, PetscInt *n_total_particles, PetscInt *n_components, void **gathered_array) |
Internal helper implementation: SwarmFieldToArrayOnRank0(). | |
| PetscErrorCode | DisplayBanner (SimCtx *simCtx) |
Internal helper implementation: DisplayBanner(). | |
| PetscErrorCode | ParsePostProcessingSettings (SimCtx *simCtx) |
Internal helper implementation: ParsePostProcessingSettings(). | |
| PetscErrorCode | ParseScalingInformation (SimCtx *simCtx) |
| Implementation of ParseScalingInformation(). | |
| PetscInt | ReadDataFileToArray (const char *filename, double **data_out, PetscInt *Nout, MPI_Comm comm) |
| Implementation of ReadDataFileToArray(). | |
| PetscErrorCode | ReadPositionsFromFile (PetscInt timeIndex, UserCtx *user, double **coordsArray, PetscInt *Ncoords) |
Internal helper implementation: ReadPositionsFromFile(). | |
| PetscErrorCode | ReadFieldDataToRank0 (PetscInt timeIndex, const char *fieldName, UserCtx *user, double **scalarArray, PetscInt *Nscalars) |
Internal helper implementation: ReadFieldDataToRank0(). | |
Variables | |
| static PetscInt | g_nblk_from_file = 0 |
| Stores the number of blocks read from the grid file. | |
| static PetscInt * | g_IMs_from_file = NULL |
| Caches the IM dimensions for all blocks read from the grid file. | |
| static PetscInt * | g_JMs_from_file = NULL |
| Caches the JM dimensions for all blocks read from the grid file. | |
| static PetscInt * | g_KMs_from_file = NULL |
| Caches the KM dimensions for all blocks read from the grid file. | |
| static PetscBool | g_file_has_been_read = PETSC_FALSE |
| A flag to ensure the grid file is read only once. | |
Implementation of data input/output routines, focusing on grid configuration.
This module provides functions to parse 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.c.
| void TrimWhitespace | ( | char * | str | ) |
Implementation of TrimWhitespace().
Helper function to trim leading/trailing whitespace from a string.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 38 of file io.c.
| PetscBool ShouldWriteDataOutput | ( | const SimCtx * | simCtx, |
| PetscInt | completed_step | ||
| ) |
Implementation of 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 70 of file io.c.
| PetscErrorCode ReadGridGenerationInputs | ( | UserCtx * | user | ) |
Internal helper implementation: ReadGridGenerationInputs().
Parses command-line options for a programmatically generated grid for a SINGLE block.
Local to this translation unit.
Definition at line 85 of file io.c.
| PetscErrorCode PopulateFinestUserGridResolutionFromOptions | ( | UserCtx * | finest_users, |
| PetscInt | nblk | ||
| ) |
Internal helper implementation: PopulateFinestUserGridResolutionFromOptions().
Parses grid resolution arrays (-im, -jm, -km) once and applies them to all finest-grid blocks.
Local to this translation unit.
Definition at line 170 of file io.c.
| PetscErrorCode ReadGridFile | ( | UserCtx * | user | ) |
Internal helper implementation: ReadGridFile().
Sets grid dimensions from a file for a SINGLE block using a one-time read cache.
Local to this translation unit.
Definition at line 219 of file io.c.
| void FreeBC_ParamList | ( | BC_Param * | head | ) |
Implementation of FreeBC_ParamList().
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 302 of file io.c.
| PetscErrorCode StringToBCFace | ( | const char * | str, |
| BCFace * | face_out | ||
| ) |
Internal helper implementation: StringToBCFace().
Converts a face-token string (e.g., "-Xi", "+Eta") to the internal BCFace enum.
Local to this translation unit.
Definition at line 317 of file io.c.
| PetscErrorCode StringToBCType | ( | const char * | str, |
| BCType * | type_out | ||
| ) |
Internal helper implementation: StringToBCType().
Converts a mathematical BC type string (e.g., "PERIODIC", "WALL") to BCType.
Local to this translation unit.
Definition at line 332 of file io.c.
| PetscErrorCode StringToBCHandlerType | ( | const char * | str, |
| BCHandlerType * | handler_out | ||
| ) |
Internal helper implementation: StringToBCHandlerType().
Converts a BC handler token (implementation strategy) to BCHandlerType.
Local to this translation unit.
Definition at line 347 of file io.c.
| PetscErrorCode ValidateBCHandlerForBCType | ( | BCType | type, |
| BCHandlerType | handler | ||
| ) |
Internal helper implementation: ValidateBCHandlerForBCType().
Validates that a selected handler is compatible with a mathematical BC type.
Local to this translation unit.
Definition at line 364 of file io.c.
| PetscErrorCode GetBCParamReal | ( | BC_Param * | params, |
| const char * | key, | ||
| PetscReal * | value_out, | ||
| PetscBool * | found | ||
| ) |
Internal helper implementation: GetBCParamReal().
Searches a BC_Param linked list for a key and returns its value as a double.
Local to this translation unit.
Definition at line 387 of file io.c.
| PetscErrorCode GetBCParamBool | ( | BC_Param * | params, |
| const char * | key, | ||
| PetscBool * | value_out, | ||
| PetscBool * | found | ||
| ) |
Internal helper implementation: GetBCParamBool().
Searches a BC_Param linked list for a key and returns its value as a bool.
Local to this translation unit.
Definition at line 408 of file io.c.
| PetscErrorCode ParseAllBoundaryConditions | ( | UserCtx * | user, |
| const char * | bcs_input_filename | ||
| ) |
Internal helper implementation: ParseAllBoundaryConditions().
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 447 of file io.c.
| PetscErrorCode DeterminePeriodicity | ( | SimCtx * | simCtx | ) |
Internal helper implementation: DeterminePeriodicity().
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 634 of file io.c.
| PetscErrorCode VerifyPathExistence | ( | const char * | path, |
| PetscBool | is_dir, | ||
| PetscBool | is_optional, | ||
| const char * | description, | ||
| PetscBool * | exists | ||
| ) |
Internal helper implementation: VerifyPathExistence().
A parallel-safe helper to verify the existence of a generic file or directory path.
Local to this translation unit.
Definition at line 738 of file io.c.
|
static |
Internal helper implementation: CheckDataFile().
Local to this translation unit.
Definition at line 782 of file io.c.
|
static |
Internal helper implementation: ReadOptionalField().
Local to this translation unit.
Definition at line 822 of file io.c.
|
static |
Internal helper implementation: ReadOptionalSwarmField().
Local to this translation unit.
Definition at line 856 of file io.c.
| PetscErrorCode ReadFieldData | ( | UserCtx * | user, |
| const char * | field_name, | ||
| Vec | field_vec, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Internal helper implementation: ReadFieldData().
Reads data for a specific field from a file into the provided vector.
Local to this translation unit.
Definition at line 898 of file io.c.
| PetscErrorCode ReadSimulationFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Internal helper implementation: ReadSimulationFields().
Reads binary field data for velocity, pressure, and other required vectors.
Local to this translation unit.
Definition at line 1126 of file io.c.
| PetscErrorCode ReadStatisticalFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Implementation of ReadStatisticalFields().
Reads statistical fields used for time-averaged simulations.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 1205 of file io.c.
| PetscErrorCode ReadLESFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Internal helper implementation: ReadLESFields().
Reads LES-related fields used in turbulence modeling.
Local to this translation unit.
Definition at line 1229 of file io.c.
| PetscErrorCode ReadRANSFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Internal helper implementation: ReadRANSFields().
Reads RANS-related fields for turbulence modeling.
Local to this translation unit.
Definition at line 1257 of file io.c.
| PetscErrorCode ReadSwarmField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Internal helper implementation: ReadSwarmField().
Reads data from a file into a specified field of a PETSc DMSwarm.
Local to this translation unit.
Definition at line 1291 of file io.c.
| PetscErrorCode ReadSwarmIntField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Internal helper implementation: ReadSwarmIntField().
Reads integer swarm data by using ReadFieldData and casting the result.
Local to this translation unit.
Definition at line 1321 of file io.c.
| PetscErrorCode ReadAllSwarmFields | ( | UserCtx * | user, |
| PetscInt | ti | ||
| ) |
Internal helper implementation: ReadAllSwarmFields().
Reads multiple fields (positions, velocity, CellID, and weight) into a DMSwarm.
Local to this translation unit.
Definition at line 1383 of file io.c.
| PetscErrorCode WriteFieldData | ( | UserCtx * | user, |
| const char * | field_name, | ||
| Vec | field_vec, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Internal helper implementation: WriteFieldData().
Writes data from a specific PETSc vector to a file.
Local to this translation unit.
Definition at line 1448 of file io.c.
| PetscErrorCode WriteSimulationFields | ( | UserCtx * | user | ) |
Implementation of WriteSimulationFields().
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 1568 of file io.c.
| PetscErrorCode WriteStatisticalFields | ( | UserCtx * | user | ) |
Implementation of WriteStatisticalFields().
Writes statistical fields for averaging purposes.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 1627 of file io.c.
| PetscErrorCode WriteLESFields | ( | UserCtx * | user | ) |
Internal helper implementation: WriteLESFields().
Writes LES-related fields.
Local to this translation unit.
Definition at line 1649 of file io.c.
| PetscErrorCode WriteRANSFields | ( | UserCtx * | user | ) |
Implementation of WriteRANSFields().
Writes RANS-related fields.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/io.h.
Definition at line 1679 of file io.c.
| PetscErrorCode WriteSwarmField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Implementation of WriteSwarmField().
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 1700 of file io.c.
| PetscErrorCode WriteSwarmIntField | ( | UserCtx * | user, |
| const char * | field_name, | ||
| PetscInt | ti, | ||
| const char * | ext | ||
| ) |
Internal helper implementation: WriteSwarmIntField().
Writes integer data from a specific PETSc Swarm field to a file.
Local to this translation unit.
Definition at line 1755 of file io.c.
| PetscErrorCode WriteAllSwarmFields | ( | UserCtx * | user | ) |
Internal helper implementation: WriteAllSwarmFields().
Writes a predefined set of PETSc Swarm fields to files.
Local to this translation unit.
Definition at line 1815 of file io.c.
| PetscErrorCode VecToArrayOnRank0 | ( | Vec | inVec, |
| PetscInt * | N, | ||
| double ** | arrayOut | ||
| ) |
Internal helper implementation: VecToArrayOnRank0().
Gathers the contents of a distributed PETSc Vec into a single array on rank 0.
Local to this translation unit.
Definition at line 1868 of file io.c.
| PetscErrorCode SwarmFieldToArrayOnRank0 | ( | DM | swarm, |
| const char * | field_name, | ||
| PetscInt * | n_total_particles, | ||
| PetscInt * | n_components, | ||
| void ** | gathered_array | ||
| ) |
Internal helper implementation: SwarmFieldToArrayOnRank0().
Gathers any DMSwarm field from all ranks to a single, contiguous array on rank 0.
Local to this translation unit.
Definition at line 1953 of file io.c.
| PetscErrorCode DisplayBanner | ( | SimCtx * | simCtx | ) |
Internal helper implementation: DisplayBanner().
Displays a structured banner summarizing the simulation configuration.
Local to this translation unit.
Definition at line 2031 of file io.c.
| PetscErrorCode ParsePostProcessingSettings | ( | SimCtx * | simCtx | ) |
Internal helper implementation: ParsePostProcessingSettings().
Initializes post-processing settings from a config file and command-line overrides.
Local to this translation unit.
Definition at line 2209 of file io.c.
| PetscErrorCode ParseScalingInformation | ( | SimCtx * | simCtx | ) |
Implementation of ParseScalingInformation().
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 2357 of file io.c.
| PetscInt ReadDataFileToArray | ( | const char * | filename, |
| double ** | data_out, | ||
| PetscInt * | Nout, | ||
| MPI_Comm | comm | ||
| ) |
Implementation of 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 2401 of file io.c.
| PetscErrorCode ReadPositionsFromFile | ( | PetscInt | timeIndex, |
| UserCtx * | user, | ||
| double ** | coordsArray, | ||
| PetscInt * | Ncoords | ||
| ) |
Internal helper implementation: ReadPositionsFromFile().
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 2533 of file io.c.
| PetscErrorCode ReadFieldDataToRank0 | ( | PetscInt | timeIndex, |
| const char * | fieldName, | ||
| UserCtx * | user, | ||
| double ** | scalarArray, | ||
| PetscInt * | Nscalars | ||
| ) |
Internal helper implementation: ReadFieldDataToRank0().
Reads a named field from file into a PETSc Vec, then gathers it to rank 0.
Local to this translation unit.
Definition at line 2571 of file io.c.
|
static |
|
static |
|
static |
|
static |