PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
setup.h
Go to the documentation of this file.
1#ifndef SETUP_H
2#define SETUP_H
3
4#include <petscpf.h>
5#include <petscdmswarm.h>
6#include <stdlib.h>
7#include <time.h>
8#include <math.h>
9#include <petsctime.h>
10#include <petscsys.h>
11#include <petscdmcomposite.h>
12#include <petscsystypes.h>
13
14// Include additional headers
15#include "variables.h" // Shared type definitions
16#include "ParticleSwarm.h" // Particle swarm functions
17#include "walkingsearch.h" // Particle location functions
18#include "grid.h" // Grid functions
19#include "logging.h" // Logging macros
20#include "io.h" // Data Input and Output functions
21#include "interpolation.h" // Interpolation routines
22#include "AnalyticalSolution.h" // Analytical Solution for testing
23#include "ParticleMotion.h" // Functions related to motion of particles
24#include "Boundaries.h" // Functions related to Boundary conditions
25
26
27/* Macro to automatically select the correct allocation function */
28#define Allocate3DArray(array, nz, ny, nx) \
29 _Generic((array), \
30 PetscReal ****: Allocate3DArrayScalar, \
31 Cmpnts ****: Allocate3DArrayVector \
32 )(array, nz, ny, nx)
33
34/* Macro for deallocation */
35#define Deallocate3DArray(array, nz, ny) \
36 _Generic((array), \
37 PetscReal ***: Deallocate3DArrayScalar, \
38 Cmpnts ***: Deallocate3DArrayVector \
39 )(array, nz, ny)
40
41
42/**
43 * @brief Allocates and populates the master SimulationContext object.
44 *
45 * This function serves as the single, authoritative entry point for all
46 * simulation configuration. It merges the setup logic from both the legacy
47 * FSI/IBM solver and the modern particle solver into a unified, robust
48 * process.
49 *
50 * The function follows a strict sequence:
51 * 1. **Allocate Context & Set Defaults:** It first allocates the `SimulationContext`
52 * and populates every field with a sane, hardcoded default value. This
53 * ensures the simulation starts from a known, predictable state.
54 * 2. **Configure Logging System:** It configures the custom logging framework. It
55 * parses the `-func_config_file` option to load a list of function names
56 * allowed to produce log output. This configuration (the file path and the
57 * list of function names) is stored within the `SimulationContext` for
58 * later reference and cleanup.
59 * 3. **Parse All Options:** It performs a comprehensive pass of `PetscOptionsGet...`
60 * calls for every possible command-line flag, overriding the default
61 * values set in step 1.
62 * 4. **Log Summary:** After all options are parsed, it uses the now-active
63 * logging system to print a summary of the key simulation parameters.
64 *
65 * @param[in] argc Argument count passed from `main`.
66 * @param[in] argv Argument vector passed from `main`.
67 * @param[out] p_simCtx On success, this will point to the newly created and
68 * fully configured `SimulationContext` pointer. The caller
69 * is responsible for eventually destroying this object by
70 * calling `FinalizeSimulation()`.
71 *
72 * @return PetscErrorCode Returns 0 on success, or a non-zero PETSc error code on failure.
73 */
74PetscErrorCode CreateSimulationContext(int argc, char **argv, SimCtx **p_simCtx);
75
76/**
77 * @brief Verifies and prepares the complete I/O environment for a simulation run.
78 *
79 * This function performs a comprehensive series of checks and setup actions to
80 * ensure a valid and clean environment. It is parallel-safe; all filesystem
81 * operations and checks are performed by Rank 0, with collective error handling.
82 *
83 * The function's responsibilities include:
84 * 1. **Checking Mandatory Inputs:** Verifies existence of grid and BCs files.
85 * 2. **Checking Optional Inputs:** Warns if optional config files (whitelist, profile) are missing.
86 * 3. **Validating Run Mode Paths:** Ensures `restart_dir` or post-processing source directories exist when needed.
87 * 4. **Preparing Log Directory:** Creates the log directory and cleans it of previous logs.
88 * 5. **Preparing Output Directories:** Creates the main output directory and its required subdirectories.
89 *
90 * @param[in] simCtx The fully configured SimulationContext object.
91 *
92 * @return PetscErrorCode Returns 0 on success, or a non-zero error code if a
93 * mandatory file/directory is missing or a critical operation fails.
94 */
95PetscErrorCode SetupSimulationEnvironment(SimCtx *simCtx);
96
97/**
98 * @brief The main orchestrator for setting up all grid-related components.
99 *
100 * This function is the high-level driver for creating the entire computational
101 * domain, including the multigrid hierarchy, PETSc DMDA and Vec objects, and
102 * calculating all necessary grid metrics.
103 *
104 * @param simCtx The fully configured SimulationContext.
105 * @return PetscErrorCode
106 */
107PetscErrorCode SetupGridAndSolvers(SimCtx *simCtx);
108
109/**
110 @brief Creates and initializes all PETSc Vec objects for all fields.
111 *
112 * This function iterates through every UserCtx in the multigrid and multi-block
113 * hierarchy. For each context, it creates the comprehensive set of global and
114 * local PETSc Vecs required by the flow solver (e.g., Ucont, P, Nvert, metrics,
115 * turbulence fields, etc.). Each vector is initialized to zero.
116 *
117 * @param simCtx The master SimCtx, containing the configured UserCtx hierarchy.
118 * @return PetscErrorCode
119 */
120PetscErrorCode CreateAndInitializeAllVectors(SimCtx *simCtx);
121
122/**
123 * @brief Updates the local vector (including ghost points) from its corresponding global vector.
124 *
125 * This function identifies the correct global vector, local vector, and DM based on the
126 * provided fieldName and performs the standard PETSc DMGlobalToLocalBegin/End sequence.
127 * Includes optional debugging output (max norms before/after).
128 *
129 * @param user The UserCtx structure containing the vectors and DMs.
130 * @param fieldName The name of the field to update ("Ucat", "Ucont", "P", "Nvert", etc.).
131 *
132 * @return PetscErrorCode 0 on success, non-zero on failure.
133 *
134 * @note This function assumes the global vector associated with fieldName has already
135 * been populated with the desired data (including any boundary conditions).
136 */
137PetscErrorCode UpdateLocalGhosts(UserCtx* user, const char *fieldName);
138
139/**
140 * @brief (Orchestrator) Sets up all boundary conditions for the simulation.
141 */
142PetscErrorCode SetupBoundaryConditions(SimCtx *simCtx);
143
144/**
145 * @brief Allocates a 3D array of PetscReal values using PetscCalloc.
146 *
147 * This function dynamically allocates memory for a 3D array of PetscReal values
148 * with dimensions nz (layers) x ny (rows) x nx (columns). It uses PetscCalloc1
149 * to ensure the memory is zero-initialized.
150 *
151 * The allocation is done in three steps:
152 * 1. Allocate an array of nz pointers (one for each layer).
153 * 2. Allocate a contiguous block for nz*ny row pointers and assign each layer’s row pointers.
154 * 3. Allocate a contiguous block for all nz*ny*nx PetscReal values.
155 *
156 * This setup allows the array to be accessed as array[k][j][i], and the memory
157 * for the data is contiguous, which improves cache efficiency.
158 *
159 * @param[out] array Pointer to the 3D array to be allocated.
160 * @param[in] nz Number of layers (z-direction).
161 * @param[in] ny Number of rows (y-direction).
162 * @param[in] nx Number of columns (x-direction).
163 *
164 * @return PetscErrorCode 0 on success, nonzero on failure.
165 */
166 PetscErrorCode Allocate3DArrayScalar(PetscReal ****array, PetscInt nz, PetscInt ny, PetscInt nx);
167
168/**
169 * @brief Deallocates a 3D array of PetscReal values allocated by Allocate3DArrayScalar.
170 *
171 * This function frees the memory allocated for a 3D array of PetscReal values.
172 * It assumes the memory was allocated using Allocate3DArrayScalar, which allocated
173 * three separate memory blocks: one for the contiguous data, one for the row pointers,
174 * and one for the layer pointers.
175 *
176 * @param[in] array Pointer to the 3D array to be deallocated.
177 * @param[in] nz Number of layers (z-direction).
178 * @param[in] ny Number of rows (y-direction).
179 *
180 * @return PetscErrorCode 0 on success, nonzero on failure.
181 */
182PetscErrorCode Deallocate3DArrayScalar(PetscReal ***array, PetscInt nz, PetscInt ny);
183
184/**
185 * @brief Deallocates a 3D array of Cmpnts structures allocated by Allocate3DArrayVector.
186 *
187 * This function frees the memory allocated for a 3D array of Cmpnts structures.
188 * It assumes the memory was allocated using Allocate3DArrayVector, which created three
189 * separate memory blocks: one for the contiguous vector data, one for the row pointers,
190 * and one for the layer pointers.
191 *
192 * @param[in] array Pointer to the 3D array to be deallocated.
193 * @param[in] nz Number of layers in the z-direction.
194 * @param[in] ny Number of rows in the y-direction.
195 *
196 * @return PetscErrorCode 0 on success, nonzero on failure.
197 */
198 PetscErrorCode Allocate3DArrayVector(Cmpnts ****array, PetscInt nz, PetscInt ny, PetscInt nx);
199
200/**
201 * @brief Deallocates a 3D array of Cmpnts structures allocated by Allocate3DArrayVector.
202 *
203 * This function frees the memory allocated for a 3D array of Cmpnts structures.
204 * It assumes the memory was allocated using Allocate3DArrayVector, which created three
205 * separate memory blocks: one for the contiguous vector data, one for the row pointers,
206 * and one for the layer pointers.
207 *
208 * @param[in] array Pointer to the 3D array to be deallocated.
209 * @param[in] nz Number of layers in the z-direction.
210 * @param[in] ny Number of rows in the y-direction.
211 *
212 * @return PetscErrorCode 0 on success, nonzero on failure.
213 */
214PetscErrorCode Deallocate3DArrayVector(Cmpnts ***array, PetscInt nz, PetscInt ny);
215
216/**
217 * @brief Determines the global starting index and number of CELLS owned by the
218 * current processor in a specified dimension. Ownership is defined by the
219 * rank owning the cell's origin node (min i,j,k corner).
220 *
221 * @param[in] info_nodes Pointer to the DMDALocalInfo struct obtained from the NODE-based DMDA
222 * (e.g., user->da or user->fda, assuming they have consistent nodal partitioning
223 * for defining cell origins).
224 * @param[in] dim The dimension to compute the range for (0 for x/i, 1 for y/j, 2 for z/k).
225 * @param[out] xs_cell_global Pointer to store the starting GLOBAL CELL index owned by this process.
226 * A cell C(i) is defined by nodes N(i) and N(i+1). Its global index is i.
227 * @param[out] xm_cell_local Pointer to store the NUMBER of CELLs owned by this process in this dimension.
228 *
229 * @return PetscErrorCode 0 on success.
230 */
231PetscErrorCode GetOwnedCellRange(const DMDALocalInfo *info_nodes,
232 PetscInt dim,
233 PetscInt *xs_cell_global,
234 PetscInt *xm_cell_local);
235
236/**
237 * @brief Computes and stores the Cartesian neighbor ranks for the DMDA decomposition.
238 *
239 * This function retrieves the neighbor information from the primary DMDA (user->da)
240 * and stores the face neighbors (xm, xp, ym, yp, zm, zp) in the user->neighbors structure.
241 * It assumes a standard PETSc ordering for the neighbors array returned by DMDAGetNeighbors.
242 * Logs warnings if the assumed indices seem incorrect (e.g., center rank mismatch).
243 *
244 * @param[in,out] user Pointer to the UserCtx structure where neighbor info will be stored.
245 *
246 * @return PetscErrorCode 0 on success, non-zero on failure.
247 */
248PetscErrorCode ComputeAndStoreNeighborRanks(UserCtx *user);
249
250/**
251 * @brief Sets the processor layout for a given DMDA based on PETSc options.
252 *
253 * Reads the desired number of processors in x, y, and z directions using
254 * PETSc options (e.g., -dm_processors_x, -dm_processors_y, -dm_processors_z).
255 * If an option is not provided for a direction, PETSC_DECIDE is used for that direction.
256 * Applies the layout using DMDASetNumProcs.
257 *
258 * Also stores the retrieved/decided values in user->procs_x/y/z if user context is provided.
259 *
260 * @param dm The DMDA object to configure the layout for.
261 * @param user Pointer to the UserCtx structure (optional, used to store layout values).
262 *
263 * @return PetscErrorCode 0 on success, non-zero on failure.
264 */
265PetscErrorCode SetDMDAProcLayout(DM dm, UserCtx *user);
266
267/**
268 * @brief Sets up the full rank communication infrastructure, including neighbor ranks and bounding box exchange.
269 *
270 * This function orchestrates the following steps:
271 * 1. Compute and store the neighbor ranks in the user context.
272 * 2. Gather all local bounding boxes to rank 0.
273 * 3. Broadcast the complete bounding box list to all ranks.
274 *
275 * The final result is that each rank has access to its immediate neighbors and the bounding box information of all ranks.
276 *
277 * @param[in,out] user Pointer to the UserCtx structure (must be initialized).
278 * @param[in,out] bboxlist Pointer to BoundingBox array pointer; after this call, it will point to the broadcasted list.
279 *
280 * @return PetscErrorCode Returns 0 on success or non-zero PETSc error code.
281 */
282PetscErrorCode SetupDomainRankInfo(SimCtx *simCtx);
283
284/**
285 * @brief Reconstructs Cartesian velocity (Ucat) at cell centers from contravariant
286 * velocity (Ucont) defined on cell faces.
287 *
288 * This function performs the transformation from a contravariant velocity representation
289 * (which is natural on a curvilinear grid) to a Cartesian (x,y,z) representation.
290 * For each interior computational cell owned by the rank, it performs the following:
291 *
292 * 1. It averages the contravariant velocity components (U¹, U², U³) from the
293 * surrounding faces to get an estimate of the contravariant velocity at the cell center.
294 * 2. It averages the metric vectors (Csi, Eta, Zet) from the surrounding faces
295 * to get an estimate of the metric tensor at the cell center. This tensor forms
296 * the transformation matrix.
297 * 3. It solves the linear system `[MetricTensor] * [ucat] = [ucont]` for the
298 * Cartesian velocity vector `ucat = (u,v,w)` using Cramer's rule.
299 * 4. The computed Cartesian velocity is stored in the global `user->Ucat` vector.
300 *
301 * The function operates on local, ghosted versions of the input vectors (`user->lUcont`,
302 * `user->lCsi`, etc.) to ensure stencils are valid across processor boundaries.
303 *
304 * @param[in,out] user Pointer to the UserCtx structure. The function reads from
305 * `user->lUcont`, `user->lCsi`, `user->lEta`, `user->lZet`, `user->lNvert`
306 * and writes to the global `user->Ucat` vector.
307 *
308 * @return PetscErrorCode 0 on success.
309 *
310 * @note
311 * - This function should be called AFTER `user->lUcont` and all local metric vectors
312 * (`user->lCsi`, etc.) have been populated with up-to-date ghost values via `UpdateLocalGhosts`.
313 * - It only computes `Ucat` for interior cells (not on physical boundaries) and for
314 * cells not marked as solid/blanked by `user->lNvert`.
315 * - The caller is responsible for subsequently applying boundary conditions to `user->Ucat`
316 * and calling `UpdateLocalGhosts(user, "Ucat")` to populate `user->lUcat`.
317 */
318PetscErrorCode Contra2Cart(UserCtx *user);
319
320
321/**
322 * @brief Creates and distributes a map of the domain's cell decomposition to all ranks.
323 * @ingroup DomainInfo
324 *
325 * This function is a critical part of the simulation setup. It determines the global
326 * cell ownership for each MPI rank and makes this information available to all
327 * other ranks. This "decomposition map" is essential for the robust "Walk and Handoff"
328 * particle migration strategy, allowing any rank to quickly identify the owner of a
329 * target cell.
330 *
331 * The process involves:
332 * 1. Each rank gets its own node ownership information from the DMDA.
333 * 2. It converts this node information into cell ownership ranges using the
334 * `GetOwnedCellRange` helper function.
335 * 3. It participates in an `MPI_Allgather` collective operation to build a complete
336 * array (`user->RankCellInfoMap`) containing the ownership information for every rank.
337 *
338 * This function should be called once during initialization after the primary DMDA
339 * (user->da) has been set up.
340 *
341 * @param[in,out] user Pointer to the UserCtx structure. The function will allocate and
342 * populate `user->RankCellInfoMap` and set `user->num_ranks`.
343 *
344 * @return PetscErrorCode 0 on success, or a non-zero PETSc error code on failure.
345 * Errors can occur if input pointers are NULL or if MPI communication fails.
346 */
347PetscErrorCode SetupDomainCellDecompositionMap(UserCtx *user);
348
349/**
350 * @brief Performs a binary search for a key in a sorted array of PetscInt64.
351 *
352 * This is a standard binary search algorithm implemented as a PETSc-style helper function.
353 * It efficiently determines if a given `key` exists within a `sorted` array.
354 *
355 * @param[in] n The number of elements in the array.
356 * @param[in] arr A pointer to the sorted array of PetscInt64 values to be searched.
357 * @param[in] key The PetscInt64 value to search for.
358 * @param[out] found A pointer to a PetscBool that will be set to PETSC_TRUE if the key
359 * is found, and PETSC_FALSE otherwise.
360 *
361 * @return PetscErrorCode 0 on success, or a non-zero PETSc error code on failure.
362 *
363 * @note The input array `arr` **must** be sorted in ascending order for the algorithm
364 * to work correctly.
365 */
366PetscErrorCode BinarySearchInt64(PetscInt n, const PetscInt64 arr[], PetscInt64 key, PetscBool *found);
367
368
369PetscErrorCode ComputeDivergence(UserCtx *user);
370
371/**
372 * @brief Initializes random number generators for assigning particle properties.
373 *
374 * This function creates and configures separate PETSc random number generators for the x, y, and z coordinates.
375 *
376 * @param[in,out] user Pointer to the UserCtx structure containing simulation context.
377 * @param[out] randx Pointer to store the RNG for the x-coordinate.
378 * @param[out] randy Pointer to store the RNG for the y-coordinate.
379 * @param[out] randz Pointer to store the RNG for the z-coordinate.
380 *
381 * @return PetscErrorCode Returns 0 on success, non-zero on failure.
382 */
383PetscErrorCode InitializeRandomGenerators(UserCtx *user, PetscRandom *randx, PetscRandom *randy, PetscRandom *randz);
384
385/**
386 * @brief Initializes random number generators for logical space operations [0.0, 1.0).
387 *
388 * This function creates and configures three separate PETSc random number generators,
389 * one for each logical dimension (i, j, k or xi, eta, zeta equivalent).
390 * Each RNG is configured to produce uniformly distributed real numbers in the interval [0.0, 1.0).
391 * These are typically used for selecting owned cells or generating intra-cell logical coordinates.
392 *
393 * @param[out] rand_logic_i Pointer to store the RNG for the i-logical dimension.
394 * @param[out] rand_logic_j Pointer to store the RNG for the j-logical dimension.
395 * @param[out] rand_logic_k Pointer to store the RNG for the k-logical dimension.
396 *
397 * @return PetscErrorCode Returns 0 on success, non-zero on failure.
398 */
399PetscErrorCode InitializeLogicalSpaceRNGs(PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k);
400
401/**
402 * @brief Computes the derivatives of a cell-centered vector field at a specific grid point.
403 *
404 * This function orchestrates the calculation of spatial derivatives. It first computes
405 * the derivatives in computational space (d/dcsi, d/deta, d/dzet) using a central
406 * difference scheme and then transforms them into physical space (d/dx, d/dy, d/dz).
407 *
408 * @param user The user context for the current computational block.
409 * @param i, j, k The grid indices of the cell center where derivatives are required.
410 * @param field_data A 3D array pointer to the raw local data of the vector field (e.g., from lUcat).
411 * @param dudx Output: A Cmpnts struct storing [du/dx, du/dy, du/dz].
412 * @param dvdx Output: A Cmpnts struct storing [dv/dx, dv/dy, dv/dz].
413 * @param dwdx Output: A Cmpnts struct storing [dw/dx, dw/dy, dw/dz].
414 * @return PetscErrorCode 0 on success.
415 */
416PetscErrorCode ComputeVectorFieldDerivatives(UserCtx *user, PetscInt i, PetscInt j, PetscInt k, Cmpnts ***field_data,
417 Cmpnts *dudx, Cmpnts *dvdx, Cmpnts *dwdx);
418
419
420 #endif // SETUP_H
Header file for Particle Motion and migration related functions.
Header file for Particle Swarm management functions.
Public interface for grid, solver, and metric setup routines.
Public interface for data input/output routines.
Logging utilities and macros for PETSc-based applications.
PetscErrorCode ComputeVectorFieldDerivatives(UserCtx *user, PetscInt i, PetscInt j, PetscInt k, Cmpnts ***field_data, Cmpnts *dudx, Cmpnts *dvdx, Cmpnts *dwdx)
Computes the derivatives of a cell-centered vector field at a specific grid point.
Definition setup.c:2678
PetscErrorCode SetupDomainRankInfo(SimCtx *simCtx)
Sets up the full rank communication infrastructure, including neighbor ranks and bounding box exchang...
Definition setup.c:1981
PetscErrorCode InitializeRandomGenerators(UserCtx *user, PetscRandom *randx, PetscRandom *randy, PetscRandom *randz)
Initializes random number generators for assigning particle properties.
Definition setup.c:2549
PetscErrorCode Deallocate3DArrayVector(Cmpnts ***array, PetscInt nz, PetscInt ny)
Deallocates a 3D array of Cmpnts structures allocated by Allocate3DArrayVector.
Definition setup.c:1571
PetscErrorCode SetupGridAndSolvers(SimCtx *simCtx)
The main orchestrator for setting up all grid-related components.
Definition setup.c:857
PetscErrorCode SetupSimulationEnvironment(SimCtx *simCtx)
Verifies and prepares the complete I/O environment for a simulation run.
Definition setup.c:558
PetscErrorCode CreateAndInitializeAllVectors(SimCtx *simCtx)
Creates and initializes all PETSc Vec objects for all fields.
Definition setup.c:897
PetscErrorCode ComputeAndStoreNeighborRanks(UserCtx *user)
Computes and stores the Cartesian neighbor ranks for the DMDA decomposition.
Definition setup.c:1770
PetscErrorCode Contra2Cart(UserCtx *user)
Reconstructs Cartesian velocity (Ucat) at cell centers from contravariant velocity (Ucont) defined on...
Definition setup.c:2084
PetscErrorCode Allocate3DArrayScalar(PetscReal ****array, PetscInt nz, PetscInt ny, PetscInt nx)
Allocates a 3D array of PetscReal values using PetscCalloc.
Definition setup.c:1411
PetscErrorCode CreateSimulationContext(int argc, char **argv, SimCtx **p_simCtx)
Allocates and populates the master SimulationContext object.
Definition setup.c:44
PetscErrorCode GetOwnedCellRange(const DMDALocalInfo *info_nodes, PetscInt dim, PetscInt *xs_cell_global, PetscInt *xm_cell_local)
Determines the global starting index and number of CELLS owned by the current processor in a specifie...
Definition setup.c:1663
PetscErrorCode SetDMDAProcLayout(DM dm, UserCtx *user)
Sets the processor layout for a given DMDA based on PETSc options.
Definition setup.c:1897
PetscErrorCode InitializeLogicalSpaceRNGs(PetscRandom *rand_logic_i, PetscRandom *rand_logic_j, PetscRandom *rand_logic_k)
Initializes random number generators for logical space operations [0.0, 1.0).
Definition setup.c:2600
PetscErrorCode ComputeDivergence(UserCtx *user)
Definition setup.c:2377
PetscErrorCode BinarySearchInt64(PetscInt n, const PetscInt64 arr[], PetscInt64 key, PetscBool *found)
Performs a binary search for a key in a sorted array of PetscInt64.
Definition setup.c:2318
PetscErrorCode Allocate3DArrayVector(Cmpnts ****array, PetscInt nz, PetscInt ny, PetscInt nx)
Deallocates a 3D array of Cmpnts structures allocated by Allocate3DArrayVector.
Definition setup.c:1513
PetscErrorCode UpdateLocalGhosts(UserCtx *user, const char *fieldName)
Updates the local vector (including ghost points) from its corresponding global vector.
Definition setup.c:1091
PetscErrorCode SetupBoundaryConditions(SimCtx *simCtx)
(Orchestrator) Sets up all boundary conditions for the simulation.
Definition setup.c:1354
PetscErrorCode SetupDomainCellDecompositionMap(UserCtx *user)
Creates and distributes a map of the domain's cell decomposition to all ranks.
Definition setup.c:2242
PetscErrorCode Deallocate3DArrayScalar(PetscReal ***array, PetscInt nz, PetscInt ny)
Deallocates a 3D array of PetscReal values allocated by Allocate3DArrayScalar.
Definition setup.c:1456
Main header file for a complex fluid dynamics solver.
A 3D point or vector with PetscScalar components.
Definition variables.h:100
The master context for the entire simulation.
Definition variables.h:538
User-defined context containing data specific to a single computational grid level.
Definition variables.h:661
Header file for particle location functions using the walking search algorithm.