|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
// Setup code for running any simulation More...
Go to the source code of this file.
Macros | |
| #define | __FUNCT__ "CreateSimulationContext" |
| #define | __FUNCT__ "PetscMkdirRecursive" |
| #define | __FUNCT__ "SetupSimulationEnvironment" |
| #define | __FUNCT__ "AllocateContextHeirarchy" |
| #define | __FUNCT__ "SetupSolverParameters" |
| #define | __FUNCT__ "SetupGridAndSolvers" |
| #define | __FUNCT__ "CreateAndInitializeAllVectors" |
| #define | __FUNCT__ "UpdateLocalGhosts" |
| #define | __FUNCT__ "SetupBoundaryConditions" |
| #define | __FUNCT__ "GetOwnedCellRange" |
| #define | __FUNCT__ "ComputeAndStoreNeighborRanks" |
| #define | __FUNCT__ "SetDMDAProcLayout" |
| #define | __FUNCT__ "SetupDomainRankInfo" |
| #define | __FUNCT__ "Contra2Cart" |
| #define | __FUNCT__ "SetupDomainCellDecompositionMap" |
| #define | __FUNCT__ "BinarySearchInt64" |
| #define | __FUNCT__ "ComputeDivergence" |
| #define | __FUNCT__ "InitializeRandomGenerators" |
| #define | __FUNCT__ "InitializeLogicalSpaceRNGs" |
| #define | __FUNCT__ "InitializeBrownianRNG" |
| #define | __FUNCT__ "TransformScalarDerivativesToPhysical" |
| #define | __FUNCT__ "TransformDerivativesToPhysical" |
| #define | __FUNCT__ "ComputeScalarFieldDerivatives" |
| #define | __FUNCT__ "ComputeVectorFieldDerivatives" |
| #define | __FUNCT__ "DestroyUserVectors" |
| #define | __FUNCT__ "DestroyUserContext" |
| #define | __FUNCT__ "FinalizeSimulation" |
Functions | |
| PetscBool | RuntimeWalltimeGuardParsePositiveSeconds (const char *text, PetscReal *seconds_out) |
| Implementation of RuntimeWalltimeGuardParsePositiveSeconds(). | |
| PetscErrorCode | InitializeSolutionConvergenceState (SimCtx *simCtx) |
| Implementation of InitializeSolutionConvergenceState(). | |
| PetscErrorCode | DestroySolutionConvergenceState (SimCtx *simCtx) |
| Implementation of DestroySolutionConvergenceState(). | |
| PetscErrorCode | CreateSimulationContext (int argc, char **argv, SimCtx **p_simCtx) |
| Implementation of CreateSimulationContext(). | |
| static PetscErrorCode | PetscMkdirRecursive (const char *path) |
Internal helper implementation: PetscMkdirRecursive(). | |
| PetscErrorCode | SetupSimulationEnvironment (SimCtx *simCtx) |
Internal helper implementation: SetupSimulationEnvironment(). | |
| static PetscErrorCode | AllocateContextHierarchy (SimCtx *simCtx) |
Internal helper implementation: AllocateContextHierarchy(). | |
| static PetscErrorCode | SetupSolverParameters (SimCtx *simCtx) |
Internal helper implementation: SetupSolverParameters(). | |
| PetscErrorCode | SetupGridAndSolvers (SimCtx *simCtx) |
| Implementation of SetupGridAndSolvers(). | |
| PetscErrorCode | CreateAndInitializeAllVectors (SimCtx *simCtx) |
Internal helper implementation: CreateAndInitializeAllVectors(). | |
| PetscErrorCode | UpdateLocalGhosts (UserCtx *user, const char *fieldName) |
Internal helper implementation: UpdateLocalGhosts(). | |
| PetscErrorCode | SetupBoundaryConditions (SimCtx *simCtx) |
Internal helper implementation: SetupBoundaryConditions(). | |
| PetscErrorCode | Allocate3DArrayScalar (PetscReal ****array, PetscInt nz, PetscInt ny, PetscInt nx) |
Internal helper implementation: Allocate3DArrayScalar(). | |
| PetscErrorCode | Deallocate3DArrayScalar (PetscReal ***array, PetscInt nz, PetscInt ny) |
Internal helper implementation: Deallocate3DArrayScalar(). | |
| PetscErrorCode | Allocate3DArrayVector (Cmpnts ****array, PetscInt nz, PetscInt ny, PetscInt nx) |
| Implementation of Allocate3DArrayVector(). | |
| PetscErrorCode | Deallocate3DArrayVector (Cmpnts ***array, PetscInt nz, PetscInt ny) |
| Implementation of Deallocate3DArrayVector(). | |
| PetscErrorCode | GetOwnedCellRange (const DMDALocalInfo *info_nodes, PetscInt dim, PetscInt *xs_cell_global_out, PetscInt *xm_cell_local_out) |
Internal helper implementation: GetOwnedCellRange(). | |
| PetscErrorCode | ComputeAndStoreNeighborRanks (UserCtx *user) |
Internal helper implementation: ComputeAndStoreNeighborRanks(). | |
| PetscErrorCode | SetDMDAProcLayout (DM dm, UserCtx *user) |
Internal helper implementation: SetDMDAProcLayout(). | |
| PetscErrorCode | SetupDomainRankInfo (SimCtx *simCtx) |
| Implementation of SetupDomainRankInfo(). | |
| PetscErrorCode | Contra2Cart (UserCtx *user) |
Internal helper implementation: Contra2Cart(). | |
| PetscErrorCode | SetupDomainCellDecompositionMap (UserCtx *user) |
Internal helper implementation: SetupDomainCellDecompositionMap(). | |
| PetscErrorCode | BinarySearchInt64 (PetscInt n, const PetscInt64 arr[], PetscInt64 key, PetscBool *found) |
| Implementation of BinarySearchInt64(). | |
| static PetscInt | Gidx (PetscInt i, PetscInt j, PetscInt k, UserCtx *user) |
Internal helper implementation: Gidx(). | |
| PetscErrorCode | ComputeDivergence (UserCtx *user) |
| Implementation of ComputeDivergence(). | |
| PetscErrorCode | InitializeRandomGenerators (UserCtx *user, PetscRandom *randx, PetscRandom *randy, PetscRandom *randz) |
| Implementation of InitializeRandomGenerators(). | |
| PetscErrorCode | InitializeLogicalSpaceRNGs (PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k) |
Internal helper implementation: InitializeLogicalSpaceRNGs(). | |
| PetscErrorCode | InitializeBrownianRNG (SimCtx *simCtx) |
Internal helper implementation: InitializeBrownianRNG(). | |
| void | TransformScalarDerivativesToPhysical (PetscReal jacobian, Cmpnts csi_metrics, Cmpnts eta_metrics, Cmpnts zet_metrics, PetscReal dPhi_dcsi, PetscReal dPhi_deta, PetscReal dPhi_dzet, Cmpnts *gradPhi) |
| Implementation of TransformScalarDerivativesToPhysical(). | |
| static void | TransformDerivativesToPhysical (PetscReal jacobian, Cmpnts csi_metrics, Cmpnts eta_metrics, Cmpnts zet_metrics, Cmpnts deriv_csi, Cmpnts deriv_eta, Cmpnts deriv_zet, Cmpnts *dudx, Cmpnts *dvdx, Cmpnts *dwdx) |
Internal helper implementation: TransformDerivativesToPhysical(). | |
| PetscErrorCode | ComputeScalarFieldDerivatives (UserCtx *user, PetscInt i, PetscInt j, PetscInt k, PetscReal ***field_data, Cmpnts *grad) |
Internal helper implementation: ComputeScalarFieldDerivatives(). | |
| PetscErrorCode | ComputeVectorFieldDerivatives (UserCtx *user, PetscInt i, PetscInt j, PetscInt k, Cmpnts ***field_data, Cmpnts *dudx, Cmpnts *dvdx, Cmpnts *dwdx) |
Internal helper implementation: ComputeVectorFieldDerivatives(). | |
| PetscErrorCode | DestroyUserVectors (UserCtx *user) |
Internal helper implementation: DestroyUserVectors(). | |
| PetscErrorCode | DestroyUserContext (UserCtx *user) |
Internal helper implementation: DestroyUserContext(). | |
| PetscErrorCode | FinalizeSimulation (SimCtx *simCtx) |
| Implementation of FinalizeSimulation(). | |
// Setup code for running any simulation
Test program for DMSwarm interpolation using the fdf-curvIB method. Provides the setup to start any simulation with DMSwarm and DMDAs.
Definition in file setup.c.
| PetscBool RuntimeWalltimeGuardParsePositiveSeconds | ( | const char * | text, |
| PetscReal * | seconds_out | ||
| ) |
Implementation of RuntimeWalltimeGuardParsePositiveSeconds().
Parse a positive floating-point seconds value from runtime metadata.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 18 of file setup.c.
| PetscErrorCode InitializeSolutionConvergenceState | ( | SimCtx * | simCtx | ) |
Implementation of InitializeSolutionConvergenceState().
Allocates any runtime storage required by solution-convergence logging.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 47 of file setup.c.
| PetscErrorCode DestroySolutionConvergenceState | ( | SimCtx * | simCtx | ) |
Implementation of DestroySolutionConvergenceState().
Frees any runtime storage allocated for solution-convergence logging.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 98 of file setup.c.
| PetscErrorCode CreateSimulationContext | ( | int | argc, |
| char ** | argv, | ||
| SimCtx ** | p_simCtx | ||
| ) |
Implementation of CreateSimulationContext().
Allocates and populates the master SimulationContext object.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 151 of file setup.c.
|
static |
Internal helper implementation: PetscMkdirRecursive().
Local to this translation unit.
Definition at line 909 of file setup.c.
| PetscErrorCode SetupSimulationEnvironment | ( | SimCtx * | simCtx | ) |
Internal helper implementation: SetupSimulationEnvironment().
Verifies and prepares the complete I/O environment for a simulation run.
Local to this translation unit.
Definition at line 961 of file setup.c.
|
static |
Internal helper implementation: AllocateContextHierarchy().
Local to this translation unit.
Definition at line 1145 of file setup.c.
|
static |
Internal helper implementation: SetupSolverParameters().
Local to this translation unit.
Definition at line 1248 of file setup.c.
| PetscErrorCode SetupGridAndSolvers | ( | SimCtx * | simCtx | ) |
Implementation of SetupGridAndSolvers().
The main orchestrator for setting up all grid-related components.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 1280 of file setup.c.
| PetscErrorCode CreateAndInitializeAllVectors | ( | SimCtx * | simCtx | ) |
Internal helper implementation: CreateAndInitializeAllVectors().
Creates and initializes all PETSc Vec objects for all fields.
Local to this translation unit.
Definition at line 1317 of file setup.c.
| PetscErrorCode UpdateLocalGhosts | ( | UserCtx * | user, |
| const char * | fieldName | ||
| ) |
Internal helper implementation: UpdateLocalGhosts().
Updates the local vector (including ghost points) from its corresponding global vector.
Local to this translation unit.
Definition at line 1510 of file setup.c.
| PetscErrorCode SetupBoundaryConditions | ( | SimCtx * | simCtx | ) |
Internal helper implementation: SetupBoundaryConditions().
(Orchestrator) Sets up all boundary conditions for the simulation.
Local to this translation unit.
Definition at line 1782 of file setup.c.
| PetscErrorCode Allocate3DArrayScalar | ( | PetscReal **** | array, |
| PetscInt | nz, | ||
| PetscInt | ny, | ||
| PetscInt | nx | ||
| ) |
Internal helper implementation: Allocate3DArrayScalar().
Allocates a 3D array of PetscReal values using PetscCalloc.
Local to this translation unit.
Definition at line 1838 of file setup.c.
| PetscErrorCode Deallocate3DArrayScalar | ( | PetscReal *** | array, |
| PetscInt | nz, | ||
| PetscInt | ny | ||
| ) |
Internal helper implementation: Deallocate3DArrayScalar().
Deallocates a 3D array of PetscReal values allocated by Allocate3DArrayScalar.
Local to this translation unit.
Definition at line 1873 of file setup.c.
| PetscErrorCode Allocate3DArrayVector | ( | Cmpnts **** | array, |
| PetscInt | nz, | ||
| PetscInt | ny, | ||
| PetscInt | nx | ||
| ) |
Implementation of Allocate3DArrayVector().
Allocates a contiguous 3D array of Cmpnts values.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 1916 of file setup.c.
| PetscErrorCode Deallocate3DArrayVector | ( | Cmpnts *** | array, |
| PetscInt | nz, | ||
| PetscInt | ny | ||
| ) |
Implementation of Deallocate3DArrayVector().
Deallocates a 3D array of Cmpnts structures allocated by Allocate3DArrayVector.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 1966 of file setup.c.
| PetscErrorCode GetOwnedCellRange | ( | const DMDALocalInfo * | info_nodes, |
| PetscInt | dim, | ||
| PetscInt * | xs_cell_global_out, | ||
| PetscInt * | xm_cell_local_out | ||
| ) |
Internal helper implementation: GetOwnedCellRange().
Determines the global starting index and number of CELLS owned by the current processor in a specified dimension.
Local to this translation unit.
Definition at line 2032 of file setup.c.
| PetscErrorCode ComputeAndStoreNeighborRanks | ( | UserCtx * | user | ) |
Internal helper implementation: ComputeAndStoreNeighborRanks().
Computes and stores the Cartesian neighbor ranks for the DMDA decomposition.
Local to this translation unit.
Definition at line 2129 of file setup.c.
| PetscErrorCode SetDMDAProcLayout | ( | DM | dm, |
| UserCtx * | user | ||
| ) |
Internal helper implementation: SetDMDAProcLayout().
Sets the processor layout for a given DMDA based on PETSc options.
Local to this translation unit.
Definition at line 2245 of file setup.c.
| PetscErrorCode SetupDomainRankInfo | ( | SimCtx * | simCtx | ) |
Implementation of SetupDomainRankInfo().
Sets up the full rank communication infrastructure, including neighbor ranks and bounding box exchange.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 2323 of file setup.c.
| PetscErrorCode Contra2Cart | ( | UserCtx * | user | ) |
Internal helper implementation: Contra2Cart().
Reconstructs Cartesian velocity (Ucat) at cell centers from contravariant velocity (Ucont) defined on cell faces.
Local to this translation unit.
Definition at line 2396 of file setup.c.
| PetscErrorCode SetupDomainCellDecompositionMap | ( | UserCtx * | user | ) |
Internal helper implementation: SetupDomainCellDecompositionMap().
Creates and distributes a map of the domain's cell decomposition to all ranks.
Local to this translation unit.
Definition at line 2532 of file setup.c.
| PetscErrorCode BinarySearchInt64 | ( | PetscInt | n, |
| const PetscInt64 | arr[], | ||
| PetscInt64 | key, | ||
| PetscBool * | found | ||
| ) |
Implementation of BinarySearchInt64().
Performs a binary search for a key in a sorted array of PetscInt64.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 2597 of file setup.c.
|
static |
Internal helper implementation: Gidx().
Local to this translation unit.
Definition at line 2641 of file setup.c.
| PetscErrorCode ComputeDivergence | ( | UserCtx * | user | ) |
Implementation of ComputeDivergence().
Computes the discrete divergence of the contravariant velocity field.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 2667 of file setup.c.
| PetscErrorCode InitializeRandomGenerators | ( | UserCtx * | user, |
| PetscRandom * | randx, | ||
| PetscRandom * | randy, | ||
| PetscRandom * | randz | ||
| ) |
Implementation of InitializeRandomGenerators().
Initializes random number generators for assigning particle properties.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 2833 of file setup.c.
| PetscErrorCode InitializeLogicalSpaceRNGs | ( | PetscRandom * | rand_logic_i, |
| PetscRandom * | rand_logic_j, | ||
| PetscRandom * | rand_logic_k | ||
| ) |
Internal helper implementation: InitializeLogicalSpaceRNGs().
Initializes random number generators for logical space operations [0.0, 1.0).
Local to this translation unit.
Definition at line 2874 of file setup.c.
| PetscErrorCode InitializeBrownianRNG | ( | SimCtx * | simCtx | ) |
Internal helper implementation: InitializeBrownianRNG().
Initializes a single master RNG for time-stepping physics (Brownian motion).
Local to this translation unit.
Definition at line 2918 of file setup.c.
| void TransformScalarDerivativesToPhysical | ( | PetscReal | jacobian, |
| Cmpnts | csi_metrics, | ||
| Cmpnts | eta_metrics, | ||
| Cmpnts | zet_metrics, | ||
| PetscReal | dPhi_dcsi, | ||
| PetscReal | dPhi_deta, | ||
| PetscReal | dPhi_dzet, | ||
| Cmpnts * | gradPhi | ||
| ) |
Implementation of TransformScalarDerivativesToPhysical().
Transforms scalar derivatives from computational space to physical space.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 2957 of file setup.c.
|
static |
Internal helper implementation: TransformDerivativesToPhysical().
Local to this translation unit.
Definition at line 2982 of file setup.c.
| PetscErrorCode ComputeScalarFieldDerivatives | ( | UserCtx * | user, |
| PetscInt | i, | ||
| PetscInt | j, | ||
| PetscInt | k, | ||
| PetscReal *** | field_data, | ||
| Cmpnts * | grad | ||
| ) |
Internal helper implementation: ComputeScalarFieldDerivatives().
Computes the gradient of a cell-centered SCALAR field at a specific grid point.
Local to this translation unit.
Definition at line 3006 of file setup.c.
| PetscErrorCode ComputeVectorFieldDerivatives | ( | UserCtx * | user, |
| PetscInt | i, | ||
| PetscInt | j, | ||
| PetscInt | k, | ||
| Cmpnts *** | field_data, | ||
| Cmpnts * | dudx, | ||
| Cmpnts * | dvdx, | ||
| Cmpnts * | dwdx | ||
| ) |
Internal helper implementation: ComputeVectorFieldDerivatives().
Computes the derivatives of a cell-centered vector field at a specific grid point.
Local to this translation unit.
Definition at line 3049 of file setup.c.
| PetscErrorCode DestroyUserVectors | ( | UserCtx * | user | ) |
Internal helper implementation: DestroyUserVectors().
Destroys all PETSc Vec objects within a single UserCtx structure.
Local to this translation unit.
Definition at line 3103 of file setup.c.
| PetscErrorCode DestroyUserContext | ( | UserCtx * | user | ) |
Internal helper implementation: DestroyUserContext().
Destroys all resources allocated within a single UserCtx structure.
Local to this translation unit.
Definition at line 3238 of file setup.c.
| PetscErrorCode FinalizeSimulation | ( | SimCtx * | simCtx | ) |
Implementation of FinalizeSimulation().
Main cleanup function for the entire simulation context.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/setup.h.
Definition at line 3337 of file setup.c.