PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
verification_sources.h
Go to the documentation of this file.
1#ifndef VERIFICATION_SOURCES_H
2#define VERIFICATION_SOURCES_H
3
4#include "variables.h"
6
7/**
8 * @brief Reports whether a verification-only diffusivity override is active.
9 *
10 * @param simCtx Simulation context.
11 * @return PETSC_TRUE when a verification diffusivity source override is enabled.
12 */
13PetscBool VerificationDiffusivityOverrideActive(const SimCtx *simCtx);
14
15/**
16 * @brief Populates the Eulerian diffusivity field from a verification-only source override.
17 *
18 * @param[in,out] user Block-local context whose `Diffusivity` vector will be filled.
19 * @return PetscErrorCode 0 on success.
20 */
22
23/**
24 * @brief Reports whether a verification-only scalar override is active.
25 *
26 * @param simCtx Simulation context.
27 * @return PETSC_TRUE when a verification scalar source override is enabled.
28 */
29PetscBool VerificationScalarOverrideActive(const SimCtx *simCtx);
30
31/**
32 * @brief Populates the particle `Psi` field from a verification-only source override.
33 *
34 * @param[in,out] user Block-local context whose particle scalar field will be filled.
35 * @return PetscErrorCode 0 on success.
36 */
38
39/**
40 * @brief Compiles a verification field's expression, in physical x, y, z and t, and enables the field.
41 * @param[in] text Expression text.
42 * @param[in,out] field Field to set; a previous expression is released.
43 * @return PETSc error code.
44 */
45PetscErrorCode VerificationFieldCompile(const char *text, VerificationFieldConfig *field);
46
47/**
48 * @brief Reads and compiles the configured verification fields (`-verification_*_expr`).
49 * @param simCtx Simulation context.
50 * @return PETSc error code; an override outside an analytical run is refused.
51 */
52PetscErrorCode VerificationFieldsCreate(SimCtx *simCtx);
53
54/**
55 * @brief Releases the compiled verification fields.
56 * @param simCtx Simulation context.
57 * @return PETSc error code.
58 */
59PetscErrorCode VerificationFieldsDestroy(SimCtx *simCtx);
60
61/**
62 * @brief Evaluates a verification field at a point.
63 * @param[in] simCtx Simulation context, for the scales.
64 * @param[in] field Enabled verification field.
65 * @param[in] point Solver-unit position.
66 * @param[in] solver_time Solver-unit time.
67 * @param[out] value The expression's physical value.
68 * @return PETSc error code.
69 */
70PetscErrorCode VerificationFieldEvaluate(const SimCtx *simCtx, const VerificationFieldConfig *field, Cmpnts point,
71 PetscReal solver_time, PetscReal *value);
72
73/**
74 * @brief Writes the configured verification scalar profile onto a particle swarm scalar field.
75 *
76 * @param[in,out] user Block-local context providing particle positions.
77 * @param[in] particle_field_id Typed identity of the scalar swarm field to overwrite.
78 * @return PetscErrorCode 0 on success.
79 */
80PetscErrorCode SetVerificationScalarOnParticles(UserCtx *user, ParticleFieldId particle_field_id);
81
82/**
83 * @brief Writes the configured verification scalar profile at physical cell centers into a scalar Vec.
84 *
85 * @param[in] user Block-local context providing the cell-center coordinates.
86 * @param[in,out] targetVec Scalar Vec on `user->da` storage to fill with analytical reference values.
87 * @return PetscErrorCode 0 on success.
88 */
89PetscErrorCode SetVerificationScalarAtCellCenters(UserCtx *user, Vec targetVec);
90
91#endif /* VERIFICATION_SOURCES_H */
Typed identities and metadata for persistent solver-particle fields.
ParticleFieldId
Compile-time identity for a persistent solver-particle field.
Main header file for a complex fluid dynamics solver.
A 3D point or vector with PetscScalar components.
Definition variables.h:144
The master context for the entire simulation.
Definition variables.h:896
User-defined context containing data specific to a single computational grid level.
Definition variables.h:1135
A verification-only prescribed field: an expression in physical x, y, z and t, enabled when set.
Definition variables.h:275
PetscErrorCode VerificationFieldCompile(const char *text, VerificationFieldConfig *field)
Compiles a verification field's expression, in physical x, y, z and t, and enables the field.
PetscErrorCode ApplyVerificationDiffusivityOverride(UserCtx *user)
Populates the Eulerian diffusivity field from a verification-only source override.
PetscErrorCode SetVerificationScalarOnParticles(UserCtx *user, ParticleFieldId particle_field_id)
Writes the configured verification scalar profile onto a particle swarm scalar field.
PetscBool VerificationDiffusivityOverrideActive(const SimCtx *simCtx)
Reports whether a verification-only diffusivity override is active.
PetscErrorCode VerificationFieldsCreate(SimCtx *simCtx)
Reads and compiles the configured verification fields (-verification_*_expr).
PetscErrorCode ApplyVerificationScalarOverrideToParticles(UserCtx *user)
Populates the particle Psi field from a verification-only source override.
PetscBool VerificationScalarOverrideActive(const SimCtx *simCtx)
Reports whether a verification-only scalar override is active.
PetscErrorCode VerificationFieldEvaluate(const SimCtx *simCtx, const VerificationFieldConfig *field, Cmpnts point, PetscReal solver_time, PetscReal *value)
Evaluates a verification field at a point.
PetscErrorCode VerificationFieldsDestroy(SimCtx *simCtx)
Releases the compiled verification fields.
PetscErrorCode SetVerificationScalarAtCellCenters(UserCtx *user, Vec targetVec)
Writes the configured verification scalar profile at physical cell centers into a scalar Vec.