OGS
CreateNumericalStabilization.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
7#include "BaseLib/Error.h"
8#include "MeshLib/Mesh.h"
11
12namespace NumLib
13{
15 MeshLib::Mesh const& mesh, BaseLib::ConfigTree const& config)
16{
17 auto const stabilization_config =
19 config.getConfigSubtreeOptional("numerical_stabilization");
20 if (!stabilization_config)
21 {
22 return NoStabilization{};
23 }
24
25 auto const type =
27 stabilization_config->getConfigParameter<std::string>("type");
28
29 INFO("Using {:s} numerical stabilization.", type);
30 if (type == "IsotropicDiffusion")
31 {
32 auto const cutoff_velocity =
34 stabilization_config->getConfigParameter<double>("cutoff_velocity");
35
36 auto const tuning_parameter =
38 stabilization_config->getConfigParameter<double>(
39 "tuning_parameter");
40
42 cutoff_velocity, tuning_parameter,
44 }
45 if (type == "FullUpwind")
46 {
47 auto const cutoff_velocity =
49 stabilization_config->getConfigParameter<double>("cutoff_velocity");
50
51 return FullUpwind{cutoff_velocity};
52 }
53 if (type == "FluxCorrectedTransport")
54 {
57 }
58
59 OGS_FATAL("The stabilization type {:s} is not available.", type);
60}
61} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:19
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:28
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:100
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)