PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
initialcondition.h
Go to the documentation of this file.
1#ifndef INITIALCONDITION_H
2#define INITIALCONDITION_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// Include additional headers
14#include "variables.h" // Shared type definitions
15#include "ParticleSwarm.h" // Particle swarm functions
16#include "walkingsearch.h" // Particle location functions
17#include "grid.h" // Grid functions
18#include "logging.h" // Logging macros
19#include "io.h" // Data Input and Output functions
20#include "interpolation.h" // Interpolation routines
21#include "AnalyticalSolutions.h" // Analytical Solution for testing
22#include "ParticleMotion.h" // Functions related to motion of particles
23#include "Boundaries.h" // Functions related to Boundary condition
24#include "runloop.h"
25
26/**
27 * @brief Sets the initial values for the INTERIOR of a specified Eulerian field.
28 *
29 * This function initializes the interior nodes of `Ucont` based on the mode selected
30 * by `simCtx->initialConditionMode`.
31 *
32 * Supported profiles for "Ucont":
33 * - IC_MODE_ZERO: All interior contravariant components are set to zero.
34 * - IC_MODE_CONSTANT_CARTESIAN: `UniformCart2Contra` dots the Cartesian
35 * vector `(InitialConstantContra.x/y/z)` with the local metric vectors to fill
36 * all three contravariant components correctly across the entire interior.
37 * - IC_MODE_CONSTANT_STREAMWISE: Sets only the
38 * contravariant component along the streamwise axis (from `flowDirection` or the
39 * identified INLET face) proportional to `icVelocityPhysical * |A_n|`.
40 * - IC_MODE_POISEUILLE: Separable parabolic profile in the two cross-stream index directions;
41 * centerline speed is `icVelocityPhysical`; streamwise axis from `flowDirection`
42 * or the identified INLET face.
43 *
44 * @param user The main UserCtx struct, containing all simulation data and configuration.
45 * @param fieldName A string ("Ucont" or "P") identifying which field to initialize.
46 * @return PetscErrorCode 0 on success.
47 */
48PetscErrorCode SetInitialInteriorField(UserCtx *user, const char *fieldName);
49
50/**
51 * @brief Populate Ucont for one fresh-start block from the configured IC mode.
52 *
53 * Built-in modes generate Ucont directly. File mode loads either Ucat or Ucont
54 * from the staged IC directory and converts Ucat when necessary.
55 * @param[in,out] user Block context whose velocity field is populated.
56 * @return PETSc error code.
57 */
58PetscErrorCode PopulateInitialUcont(UserCtx *user);
59
60/**
61 * @brief High-level orchestrator to set the complete initial state of the Eulerian solver.
62 *
63 * This function is called once from main() before the time loop begins. It inspects
64 * the simulation context to determine whether to perform a fresh start (t=0) or
65 * restart from saved files. It then delegates to the appropriate helper function.
66 * Finally, it initializes the solver's history vectors (Ucont_o, P_o, etc.)
67 * to ensure the first time step has the necessary data.
68 *
69 * @param simCtx Simulation context controlling the operation.
70 * @return PetscErrorCode 0 on success.
71 */
72PetscErrorCode InitializeEulerianState(SimCtx *simCtx);
73
74#endif // INITIALCONDITION_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.
PetscErrorCode SetInitialInteriorField(UserCtx *user, const char *fieldName)
Sets the initial values for the INTERIOR of a specified Eulerian field.
PetscErrorCode InitializeEulerianState(SimCtx *simCtx)
High-level orchestrator to set the complete initial state of the Eulerian solver.
PetscErrorCode PopulateInitialUcont(UserCtx *user)
Populate Ucont for one fresh-start block from the configured IC mode.
Public interface for data input/output routines.
Logging utilities and macros for PETSc-based applications.
Main header file for a complex fluid dynamics solver.
The master context for the entire simulation.
Definition variables.h:684
User-defined context containing data specific to a single computational grid level.
Definition variables.h:876
Header file for particle location functions using the walking search algorithm.