OGS
CreateForwardDifferencesJacobianAssembler.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"
9
10namespace ProcessLib
11{
12std::unique_ptr<AbstractJacobianAssembler>
14{
16 config.checkConfigParameter("type", "ForwardDifferences");
17
18 // TODO: to be removed
19 {
20 std::vector<std::string> const deprecated_keys{"relative_epsilons",
21 "component_magnitudes"};
22 for (auto const& key : deprecated_keys)
23 {
24 auto const deprecated_parameter =
26 config.getConfigParameterOptional<std::vector<double>>(key);
27
28 if ((deprecated_parameter.has_value() &&
29 !deprecated_parameter->empty()))
30 {
32 "Configuration parameter <{:s}> is deprecated and no "
33 "longer supported.\n"
34 "(Removed in OGS version 6.5.6)\n\n"
35 "The numerical Jacobian assembler now uses absolute "
36 "perturbation values instead of relative scaling.\n\n"
37 "Migration required:\n"
38 " Old approach:\n"
39 " <relative_epsilons>1e-6 1e-6</relative_epsilons>\n"
40 " <component_magnitudes>1e2 1e2</component_magnitudes>\n"
41 " New approach:\n"
42 " <epsilons>1e-4 1e-4</epsilons>\n"
43 " where the epsilons are equal component-wise to "
44 "relative_epsilons * component_magnitudes",
45 key);
46 }
47 }
48 }
49
51 auto epsilons = config.getConfigParameter<std::vector<double>>("epsilons");
52
53 return std::make_unique<ForwardDifferencesJacobianAssembler>(
54 std::move(epsilons));
55}
56
57} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
std::optional< T > getConfigParameterOptional(std::string const &param) const
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< AbstractJacobianAssembler > createForwardDifferencesJacobianAssembler(BaseLib::ConfigTree const &config)