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