|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Implements the analytical solution engine for initializing or driving the simulation. More...
Go to the source code of this file.
Macros | |
| #define | __FUNCT__ "SetAnalyticalGridInfo" |
| #define | __FUNCT__ "AnalyticalSolutionEngine" |
| #define | __FUNCT__ "SetAnalyticalSolution_TGV3D" |
| #define | __FUNCT__ "SetAnalyticalSolutionForParticles_TGV3D" |
| #define | __FUNCT__ "SetAnalyticalSolutionForParticles" |
Functions | |
| static PetscErrorCode | SetAnalyticalSolution_TGV3D (SimCtx *simCtx) |
| Sets the non-dimensional velocity and pressure fields to the 3D Taylor-Green Vortex solution. | |
| PetscErrorCode | SetAnalyticalGridInfo (UserCtx *user) |
| Sets the grid domain and resolution for analytical solution cases. | |
| PetscErrorCode | AnalyticalSolutionEngine (SimCtx *simCtx) |
| Dispatches to the appropriate analytical solution function based on simulation settings. | |
| static PetscErrorCode | SetAnalyticalSolutionForParticles_TGV3D (Vec tempVec, SimCtx *simCtx) |
| Sets the TGV3D analytical velocity solution for particles. | |
| PetscErrorCode | SetAnalyticalSolutionForParticles (Vec tempVec, SimCtx *simCtx) |
| Applies the analytical solution to particle velocity vector. | |
Implements the analytical solution engine for initializing or driving the simulation.
This file provides a modular and extensible framework for applying analytical solutions to the Eulerian fields. The primary entry point is AnalyticalSolutionEngine, which acts as a dispatcher based on user configuration.
— DESIGN PHILOSOPHY —
simCtx->scaling parameters are intentionally NOT used here; they are reserved for dimensionalization during I/O and post-processing only.t. This involves:Ucat, P) in the physical interior of the domain.user->Bcs.Ubcs). It does NOT implement the numerical scheme for ghost cells. Instead, after setting the physical state, it relies on the solver's standard utility functions (UpdateDummyCells, UpdateCornerNodes) to correctly populate all ghost cell layers.else if condition and a corresponding static implementation function, without modifying any other part of the solver. Definition in file AnalyticalSolutions.c.
| #define __FUNCT__ "SetAnalyticalGridInfo" |
Definition at line 38 of file AnalyticalSolutions.c.
| #define __FUNCT__ "AnalyticalSolutionEngine" |
Definition at line 38 of file AnalyticalSolutions.c.
| #define __FUNCT__ "SetAnalyticalSolution_TGV3D" |
Definition at line 38 of file AnalyticalSolutions.c.
| #define __FUNCT__ "SetAnalyticalSolutionForParticles_TGV3D" |
Definition at line 38 of file AnalyticalSolutions.c.
| #define __FUNCT__ "SetAnalyticalSolutionForParticles" |
Definition at line 38 of file AnalyticalSolutions.c.
|
static |
Sets the non-dimensional velocity and pressure fields to the 3D Taylor-Green Vortex solution.
This function implements the classical decaying Taylor-Green vortex in non-dimensional form, consistent with the solver's internal state. It is fully compatible with the solver's curvilinear, parallel, cell-centered architecture.
lxs, lxe, etc.) to iterate over ONLY the physical interior cells owned by the current MPI rank.Ucat) and pressure (P) by evaluating the analytical formula at the cell-center coordinates (read from the local user->Cent vector).user->Bcs.Ubcs) by evaluating the analytical velocity at the true physical face-center locations (read from the local user->Centx, user->Centy, and user->Centz vectors).UpdateDummyCells (for Ucat) and UpdateCornerNodes (for both Ucat and P) to finalize all ghost cell values, ensuring a fully consistent field.| [in] | simCtx | The main simulation context. |
Definition at line 251 of file AnalyticalSolutions.c.
| PetscErrorCode SetAnalyticalGridInfo | ( | UserCtx * | user | ) |
Sets the grid domain and resolution for analytical solution cases.
This function is called when eulerianSource is "analytical". It is responsible for automatically configuring the grid based on the chosen AnalyticalSolutionType.
[0, 2*PI] physical domain among the available blocks.nblk=1):** The single block is assigned the full [0, 2*PI] domain.nblk>1):** It requires that the number of blocks be a perfect square (e.g., 4, 9, 16). It then arranges the blocks in a sqrt(nblk) by sqrt(nblk) grid in the X-Y plane, partitioning the [0, 2*PI] domain in X and Y accordingly. The Z domain for all blocks remains [0, 2*PI]. If nblk is not a perfect square, the simulation is aborted with an error.After setting the domain bounds, it proceeds to read the grid resolution options (-im, -jm, -km) from the command line for the specific block.
| user | Pointer to the UserCtx for a specific block. The function will populate the geometric fields (IM, JM, KM, Min_X, Max_X, etc.) within this struct. |
Definition at line 63 of file AnalyticalSolutions.c.
| PetscErrorCode AnalyticalSolutionEngine | ( | SimCtx * | simCtx | ) |
Dispatches to the appropriate analytical solution function based on simulation settings.
This function acts as a router. It reads the AnalyticalSolutionType string from the simulation context and calls the corresponding private implementation function (e.g., for Taylor-Green Vortex). This design keeps the main simulation code clean and makes it easy to add new analytical test cases.
| [in] | simCtx | The main simulation context, containing all configuration and state. |
Definition at line 184 of file AnalyticalSolutions.c.
|
static |
Sets the TGV3D analytical velocity solution for particles.
Computes the 3D Taylor-Green Vortex velocity field at each particle position. Assumes the vector contains interleaved xyz components [x0,y0,z0, x1,y1,z1, ...].
| tempVec | The PETSc Vec containing particle positions, will be overwritten with velocities. |
| simCtx | The simulation context containing time and Reynolds number. |
Definition at line 398 of file AnalyticalSolutions.c.
| PetscErrorCode SetAnalyticalSolutionForParticles | ( | Vec | tempVec, |
| SimCtx * | simCtx | ||
| ) |
Applies the analytical solution to particle velocity vector.
Dispatcher function that calls the appropriate analytical solution based on simCtx->AnalyticalSolutionType. Supports multiple solution types.
| tempVec | The PETSc Vec containing particle positions which will be used to store velocities. |
| simCtx | The simulation context. |
Definition at line 447 of file AnalyticalSolutions.c.