OGS
NumericalStabilization.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"
10
11namespace NumLib
12{
13
15 double const cutoff_velocity,
16 double const tuning_parameter,
17 std::vector<double>&& element_sizes)
18 : cutoff_velocity_(cutoff_velocity),
19 tuning_parameter_(tuning_parameter),
20 element_sizes_(std::move(element_sizes))
21{
23 {
25 "The tuning parameter value {:g} for "
26 "IsotropicDiffusion stabilization is out of range [0, 1]",
28 }
29}
30
32 std::size_t const element_id, double const velocity_norm) const
33{
34 if (velocity_norm < cutoff_velocity_)
35 {
36 return 0.0;
37 }
38 return 0.5 * tuning_parameter_ * velocity_norm * element_sizes_[element_id];
39}
40} // namespace NumLib
#define OGS_FATAL(...)
Definition Error.h:19
double computeArtificialDiffusion(std::size_t const element_id, double const velocity_norm) const
IsotropicDiffusionStabilization(double const cutoff_velocity, double const tuning_parameter, std::vector< double > &&element_sizes)
double const tuning_parameter_
The tuning parameter in the range [0,1].