|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
#include <petscpf.h>#include <petscdmswarm.h>#include <stdlib.h>#include <time.h>#include <math.h>#include <petsctime.h>#include <petscdmcomposite.h>#include "variables.h"#include "ParticleSwarm.h"#include "walkingsearch.h"#include "grid.h"#include "logging.h"#include "io.h"#include "setup.h"#include "interpolation.h"Go to the source code of this file.
Macros | |
| #define | __FUNCT__ "AnalyticalSolutionEngine" |
Functions | |
| PetscErrorCode | SetAnalyticalGridInfo (UserCtx *user) |
| Sets the grid domain and resolution for analytical solution cases. | |
| PetscBool | AnalyticalTypeRequiresCustomGeometry (const char *analytical_type) |
| Reports whether an analytical type requires custom geometry/decomposition logic. | |
| PetscBool | AnalyticalTypeSupportsInterpolationError (const char *analytical_type) |
| Reports whether an analytical type has a non-trivial velocity field for which interpolation error measurement is meaningful. | |
| PetscErrorCode | AnalyticalSolutionEngine (SimCtx *simCtx) |
| Dispatches to the appropriate analytical solution function based on simulation settings. | |
| PetscErrorCode | SetAnalyticalSolutionForParticles (Vec tempVec, SimCtx *simCtx) |
| Applies the analytical solution to particle velocity vector. | |
| PetscErrorCode | EvaluateAnalyticalScalarProfile (const SimCtx *simCtx, PetscReal x, PetscReal y, PetscReal z, PetscReal t, PetscReal *value) |
| Evaluates the configured verification scalar profile at one physical point. | |
| PetscErrorCode | SetAnalyticalScalarFieldOnParticles (UserCtx *user, const char *swarm_field_name) |
| Writes the configured verification scalar profile onto a particle swarm scalar field. | |
| PetscErrorCode | SetAnalyticalScalarFieldAtCellCenters (UserCtx *user, Vec targetVec) |
| Writes the configured verification scalar profile at physical cell centers into a scalar Vec. | |
| #define __FUNCT__ "AnalyticalSolutionEngine" |
Definition at line 73 of file AnalyticalSolutions.h.
| 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.Grid resolution (IM/JM/KM) is expected to be pre-populated in user before this function is called.
| 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. |
Sets the grid domain and resolution for analytical solution cases.
Local to this translation unit.
Definition at line 80 of file AnalyticalSolutions.c.
| PetscBool AnalyticalTypeRequiresCustomGeometry | ( | const char * | analytical_type | ) |
Reports whether an analytical type requires custom geometry/decomposition logic.
Analytical types returning PETSC_TRUE are expected to route through SetAnalyticalGridInfo. Types returning PETSC_FALSE should use the standard programmatic grid parser fallback.
| analytical_type | Analytical solution type string. |
Reports whether an analytical type requires custom geometry/decomposition logic.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 55 of file AnalyticalSolutions.c.
| PetscBool AnalyticalTypeSupportsInterpolationError | ( | const char * | analytical_type | ) |
Reports whether an analytical type has a non-trivial velocity field for which interpolation error measurement is meaningful.
Types with identically zero velocity (e.g. ZERO_FLOW) return PETSC_FALSE because the interpolation error is trivially zero and uninformative.
| analytical_type | Analytical solution type string. |
Reports whether an analytical type has a non-trivial velocity field for which interpolation error measurement is meaningful.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 67 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 from the simulation context and calls the corresponding private implementation function (e.g., for Taylor-Green Vortex, lid-driven cavity, etc.). This design keeps the main simulation code clean and makes it easy to add new analytical test cases.
| simCtx | The main simulation context, containing configuration and state. |
Dispatches to the appropriate analytical solution function based on simulation settings.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 184 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. |
Applies the analytical solution to particle velocity vector.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 564 of file AnalyticalSolutions.c.
| PetscErrorCode EvaluateAnalyticalScalarProfile | ( | const SimCtx * | simCtx, |
| PetscReal | x, | ||
| PetscReal | y, | ||
| PetscReal | z, | ||
| PetscReal | t, | ||
| PetscReal * | value | ||
| ) |
Evaluates the configured verification scalar profile at one physical point.
| [in] | simCtx | Simulation context providing the scalar verification profile. |
| [in] | x | Physical x coordinate. |
| [in] | y | Physical y coordinate. |
| [in] | z | Physical z coordinate. |
| [in] | t | Simulation time. |
| [out] | value | Evaluated scalar value. |
Evaluates the configured verification scalar profile at one physical point.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 627 of file AnalyticalSolutions.c.
| PetscErrorCode SetAnalyticalScalarFieldOnParticles | ( | UserCtx * | user, |
| const char * | swarm_field_name | ||
| ) |
Writes the configured verification scalar profile onto a particle swarm scalar field.
| [in,out] | user | Block-local context providing particle positions. |
| [in] | swarm_field_name | Name of the scalar swarm field to overwrite. |
Writes the configured verification scalar profile onto a particle swarm scalar field.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 653 of file AnalyticalSolutions.c.
| PetscErrorCode SetAnalyticalScalarFieldAtCellCenters | ( | UserCtx * | user, |
| Vec | targetVec | ||
| ) |
Writes the configured verification scalar profile at physical cell centers into a scalar Vec.
| [in] | user | Block-local context providing the cell-center coordinates. |
| [in,out] | targetVec | Scalar Vec on user->da storage to fill with analytical reference values. |
Writes the configured verification scalar profile at physical cell centers into a scalar Vec.
Full API contract (arguments, ownership, side effects) is documented with the header declaration in include/AnalyticalSolutions.h.
Definition at line 695 of file AnalyticalSolutions.c.