PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
Loading...
Searching...
No Matches
rhs.h
Go to the documentation of this file.
1#ifndef RHS_H
2#define RHS_H
3
4#include "variables.h" // Provides definitions for UserCtx, SimCtx, IBMNodes, etc.
5#include "logging.h"
6#include "Metric.h"
7#include "BodyForces.h"
8
9PetscErrorCode Viscous(UserCtx *user, Vec Ucont, Vec Ucat, Vec Visc);
10
11PetscErrorCode Convection(UserCtx *user, Vec Ucont, Vec Ucat, Vec Conv);
12
13/**
14 * @brief General dispatcher for applying all active body forces (momentum sources).
15 *
16 * This function serves as a central hub for adding momentum source terms to the
17 * contravariant right-hand-side (Rct) of the momentum equations. It is called once per RHS
18 * evaluation (e.g., once per Runge-Kutta stage).
19 *
20 * It introspects the simulation configuration to determine which, if any, body
21 * forces are active and calls their specific implementation functions.
22 *
23 * @param user The UserCtx containing the simulation state for a single block.
24 * @param Rhs The PETSc Vec for the contravariant RHS, which will be modified in-place.
25 * @return PetscErrorCode 0 on success.
26 */
27PetscErrorCode ComputeBodyForces(UserCtx *user, Vec Rct);
28
29/**
30 * @brief Computes the Right-Hand Side (RHS) of the momentum equations.
31 *
32 * This function calculates the contribution of the convective and diffusive terms.
33 * It is called by the momentum solvers (e.g., RungeKutta).
34 *
35 * @param user The UserCtx for a single block.
36 * @param Rhs The PETSc Vec where the RHS result will be stored.
37 * @return PetscErrorCode 0 on success.
38 */
39extern PetscErrorCode ComputeRHS(UserCtx *user, Vec Rhs);
40/**
41 * @brief Computes the effective diffusivity scalar field ($\Gamma_{eff}$) on the Eulerian grid.
42 *
43 * This function calculates the total diffusivity used to drive the stochastic
44 * motion of particles (Scalar FDF). It combines molecular diffusion and
45 * turbulent diffusion.
46 *
47 * **Formula:**
48 * \f[
49 * \Gamma_{eff} = \underbrace{\frac{\nu}{Sc}}_{\text{Molecular}} + \underbrace{\frac{\nu_t}{Sc_t}}_{\text{Turbulent}}
50 * \f]
51 *
52 * Where:
53 * - \f$ \nu = 1/Re \f$ (Kinematic Viscosity)
54 * - \f$ \nu_t \f$ (Eddy Viscosity from LES/RANS model)
55 * - \f$ Sc \f$ (Molecular Schmidt Number, user-defined)
56 * - \f$ Sc_t \f$ (Turbulent Schmidt Number, user-defined)
57 *
58 * @note If turbulence models are disabled, \f$ \nu_t \f$ is assumed to be 0.
59 * @note This function updates the local ghost values of lDiffusivity at the end
60 * to ensure gradients can be computed correctly at subdomain boundaries.
61 *
62 * @param[in,out] user Pointer to the user context containing grid data and simulation parameters.
63 *
64 * @return PetscErrorCode 0 on success.
65 */
66PetscErrorCode ComputeEulerianDiffusivity(UserCtx *user);
67
68#endif // RHS_H
Logging utilities and macros for PETSc-based applications.
PetscErrorCode ComputeBodyForces(UserCtx *user, Vec Rct)
General dispatcher for applying all active body forces (momentum sources).
Definition rhs.c:1157
PetscErrorCode Viscous(UserCtx *user, Vec Ucont, Vec Ucat, Vec Visc)
Definition rhs.c:504
PetscErrorCode ComputeEulerianDiffusivity(UserCtx *user)
Computes the effective diffusivity scalar field ($\Gamma_{eff}$) on the Eulerian grid.
Definition rhs.c:1985
PetscErrorCode Convection(UserCtx *user, Vec Ucont, Vec Ucat, Vec Conv)
Definition rhs.c:5
PetscErrorCode ComputeRHS(UserCtx *user, Vec Rhs)
Computes the Right-Hand Side (RHS) of the momentum equations.
Definition rhs.c:1192
Main header file for a complex fluid dynamics solver.
User-defined context containing data specific to a single computational grid level.
Definition variables.h:728