Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
multiphysics.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2019, 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4/**
5 * @file multiphysics.h
6 * @brief Identifiers for multiphysics modules and their solution fields.
7 *
8 * This file defines the enumerations used to identify the different physics
9 * modules available in Lethe (fluid dynamics, heat transfer, CLS, etc.) and
10 * the solution fields they produce. It also provides a utility function to
11 * convert a physics name string into its corresponding PhysicsID.
12 */
13
14#ifndef lethe_multiphysics_h
15#define lethe_multiphysics_h
16
17#include <deal.II/base/exceptions.h>
18
19#include <algorithm>
20#include <string>
21
22/**
23 * @brief Unique identifiers for each physics module in Lethe.
24 *
25 * These identifiers are used to index and refer to the different physics
26 * solvers throughout the multiphysics framework.
27 */
28enum PhysicsID : unsigned int
29{
30 /// Fluid Dynamics (Velocity,Pressure)
32 /// Heat transfer (Temperature)
34 /// Passive scalar tracer (Tracer)
35 tracer = 2,
36 /// Conservative level-set / Volume-of-Fluid (Phase indicator / phase
37 /// fraction)
38 CLS = 3,
39 /// Cahn-Hilliard (Phase indicator, Potential)
41 /// Void fraction (not an auxiliary physics). Computed by the particle
42 /// projector of the VANS solvers and registered by them in the
43 /// multiphysics interface. Only available with the VANS formulation.
45 /// Time-harmonic electromagnetics (Electric field, Magnetic field)
47 /// Euler-Euler solid phase (solid velocity, solid volume fraction)
49 /// Projected particle temperature from DEM (not an auxiliary physics). Like
50 /// the void fraction, it is computed by the particle projector of the VANS
51 /// solvers and registered by them in the multiphysics interface. Only
52 /// available with the VANS formulation in thermal CFD-DEM simulations
53 /// (solver type = dem_mp).
55 /// Quadrature method of moments (scalars and moments of the particle size
56 /// distribution)
57 qmom = 9
58};
59
60/**
61 * @brief Formulation of the fluid dynamics equations solved by a Navier-Stokes
62 * solver.
63 */
65{
66 /// Standard Navier-Stokes equations
68 /// Volume-averaged Navier-Stokes (VANS) equations
70};
71
72/**
73 * @brief Solution fields of the different physics that are used as an indicator
74 * for multiple purposes (e.g. adaptive mesh refinement, solid domain
75 * constraints).
76 */
77enum class Variable : unsigned int
78{ /// Velocity vector field from fluid dynamics
80 /// Pressure scalar field from fluid dynamics
82 /// Phase indicator scalar field from CLS
83 phase = 2,
84 /// Temperature scalar field from heat transfer
86 /// Phase order scalar field from Cahn Hilliard
88 /// Chemical potential scalar field from Cahn Hilliard
90 /// Tracer scalar field
91 tracer = 6,
92 /// Electric field vector field from electromagnetics
94 /// Magnetic field vector field from electromagnetics
96 /// Combination of both electric and magnetic fields from electromagnetics
98};
99
100/**
101 * @brief Utility function used for parsing physics-based
102 * parameters
103 *
104 */
105inline PhysicsID
106get_physics_id(const std::string &physics_name)
107{
108 if (physics_name == "fluid dynamics")
110 else if (physics_name == "heat transfer")
112 else if (physics_name == "tracer")
113 return PhysicsID::tracer;
114 else if (physics_name == "CLS")
115 return PhysicsID::CLS;
116 else if (physics_name == "cahn hilliard")
118 else if (physics_name == "void fraction")
120 else if (physics_name == "electromagnetics")
122 else if (physics_name == "continuum solid dynamics")
124 else if (physics_name == "qmom")
125 return PhysicsID::qmom;
126 else
127 AssertThrow(false,
128 dealii::StandardExceptions::ExcMessage(
129 "An unknown Physics name was requested"));
130}
131
132/**
133 * @brief Gets for every available Variable the string corresponding to the variable.
134 *
135 * @param variable Variable of interest.
136 *
137 * @return String corresponding to the variable specified:
138 * - @p "velocity"
139 * - @p "pressure"
140 * - @p "phase"
141 * - @p "temperature"
142 * - @p "phase cahn hilliard"
143 * - @p "chemical potential cahn hilliard"
144 * - @p "tracer"
145 * - @p "electric field"
146 * - @p "magnetic field"
147 * - @p "electromagnetic fields"
148 */
149inline std::string
151{
152 if (variable == Variable::velocity)
153 return "velocity";
154 else if (variable == Variable::pressure)
155 return "pressure";
156 else if (variable == Variable::phase)
157 return "phase";
158 else if (variable == Variable::temperature)
159 return "temperature";
160 else if (variable == Variable::phase_cahn_hilliard)
161 return "phase cahn hilliard";
163 return "chemical potential cahn hilliard";
164 else if (variable == Variable::tracer)
165 return "tracer";
166 else if (variable == Variable::electric_field)
167 return "electric field";
168 else if (variable == Variable::magnetic_field)
169 return "magnetic field";
170 else if (variable == Variable::electromagnetic_fields)
171 return "electromagnetic fields";
172 else
173 AssertThrow(false,
174 dealii::ExcMessage("An unknown Variable string was requested"));
175}
176
177/**
178 * @brief Gets for every available Variable the string corresponding to the variable.
179 * Words are separated by underscores to form 1-word strings used for example in
180 * column names in output .dat files.
181 *
182 * @param variable Variable of interest.
183 *
184 * @return 1-word string corresponding to the variable specified:
185 * - @p "velocity"
186 * - @p "pressure"
187 * - @p "phase"
188 * - @p "temperature"
189 * - @p "phase_cahn_hilliard"
190 * - @p "chemical_potential_cahn_hilliard"
191 * - @p "tracer"
192 * - @p "electric_field"
193 * - @p "magnetic_field"
194 * - @p "electromagnetic_fields"
195 */
196inline std::string
198{
199 std::string variable_string = get_variable_string(variable);
200 std::ranges::replace(variable_string, ' ', '_');
201
202 return variable_string;
203}
204
205#endif
Variable
Solution fields of the different physics that are used as an indicator for multiple purposes (e....
@ chemical_potential_cahn_hilliard
Chemical potential scalar field from Cahn Hilliard.
@ electromagnetic_fields
Combination of both electric and magnetic fields from electromagnetics.
@ phase_cahn_hilliard
Phase order scalar field from Cahn Hilliard.
@ tracer
Tracer scalar field.
@ phase
Phase indicator scalar field from CLS.
@ magnetic_field
Magnetic field vector field from electromagnetics.
@ electric_field
Electric field vector field from electromagnetics.
@ velocity
Velocity vector field from fluid dynamics.
@ pressure
Pressure scalar field from fluid dynamics.
@ temperature
Temperature scalar field from heat transfer.
FluidDynamicsFormulation
Formulation of the fluid dynamics equations solved by a Navier-Stokes solver.
@ VANS
Volume-averaged Navier-Stokes (VANS) equations.
@ standard
Standard Navier-Stokes equations.
PhysicsID get_physics_id(const std::string &physics_name)
Utility function used for parsing physics-based parameters.
std::string get_variable_string(Variable variable)
Gets for every available Variable the string corresponding to the variable.
std::string get_variable_string_with_underscores(Variable variable)
Gets for every available Variable the string corresponding to the variable. Words are separated by un...
PhysicsID
Unique identifiers for each physics module in Lethe.
@ fluid_dynamics
Fluid Dynamics (Velocity,Pressure).
@ qmom
@ tracer
Passive scalar tracer (Tracer).
@ continuum_solid_dynamics
Euler-Euler solid phase (solid velocity, solid volume fraction).
@ electromagnetics
Time-harmonic electromagnetics (Electric field, Magnetic field).
@ CLS
@ particle_temperature
@ void_fraction
@ heat_transfer
Heat transfer (Temperature).
@ cahn_hilliard
Cahn-Hilliard (Phase indicator, Potential).