OGS
CreateNumericalStabilization.cpp
Go to the documentation of this file.
1
11
12#include "BaseLib/ConfigTree.h"
13#include "BaseLib/Error.h"
14#include "MeshLib/Mesh.h"
17
18namespace NumLib
19{
21 MeshLib::Mesh const& mesh, BaseLib::ConfigTree const& config)
22{
23 auto const stabilization_config =
25 config.getConfigSubtreeOptional("numerical_stabilization");
26 if (!stabilization_config)
27 {
28 return NoStabilization{};
29 }
30
31 auto const type =
33 stabilization_config->getConfigParameter<std::string>("type");
34
35 INFO("Using {:s} numerical stabilization.", type);
36 if (type == "IsotropicDiffusion")
37 {
38 auto const cutoff_velocity =
40 stabilization_config->getConfigParameter<double>("cutoff_velocity");
41
42 auto const tuning_parameter =
44 stabilization_config->getConfigParameter<double>(
45 "tuning_parameter");
46
48 cutoff_velocity, tuning_parameter,
50 }
51 if (type == "FullUpwind")
52 {
53 auto const cutoff_velocity =
55 stabilization_config->getConfigParameter<double>("cutoff_velocity");
56
57 return FullUpwind{cutoff_velocity};
58 }
59 if (type == "FluxCorrectedTransport")
60 {
62 }
63
64 OGS_FATAL("The stabilization type {:s} is not available.", type);
65}
66} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:26
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Definition of the Mesh class.
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
std::vector< double > getMaxiumElementEdgeLengths(std::vector< Element * > const &elements)
Returns the maximum lengths of the edges for each element.
std::variant< NoStabilization, IsotropicDiffusionStabilization, FullUpwind, FluxCorrectedTransport > NumericalStabilization
NumericalStabilization createNumericalStabilization(MeshLib::Mesh const &mesh, BaseLib::ConfigTree const &config)