OGS
ProcessData.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
4#include "ProcessData.h"
5
7
8namespace ProcessLib
9{
10void setEquationSystem(ProcessData const& process_data)
11{
12 auto& conv_crit = *process_data.conv_crit;
13 auto& nonlinear_solver = process_data.nonlinear_solver;
14
16 switch (process_data.nonlinear_solver_tag)
17 {
18 case Tag::Picard:
19 {
21 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
22 if (auto* nl_solver =
24 &nonlinear_solver);
25 nl_solver != nullptr)
26 {
27 nl_solver->setEquationSystem(eq_sys_, conv_crit);
28 }
29 else
30 {
32 "Could not cast nonlinear solver to Picard type solver.");
33 }
34 break;
35 }
36 case Tag::Newton:
37 {
39 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
40
41 if (auto* nl_solver =
43 &nonlinear_solver);
44 nl_solver != nullptr)
45 {
46 nl_solver->setEquationSystem(eq_sys_, conv_crit);
47 }
48#ifdef USE_PETSC
49 else if (auto* nl_solver =
50 dynamic_cast<NumLib::PETScNonlinearSolver*>(
51 &nonlinear_solver);
52 nl_solver != nullptr)
53 {
54 nl_solver->setEquationSystem(eq_sys_, conv_crit);
55 }
56#endif // USE_PETSC
57 else
58 {
60 "Could not cast nonlinear solver to Newton type solver.");
61 }
62 break;
63 }
64 }
65}
66
67} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition Types.h:13
void setEquationSystem(ProcessData const &process_data)
std::unique_ptr< NumLib::ConvergenceCriterion > conv_crit
Definition ProcessData.h:53
NumLib::NonlinearSolverBase & nonlinear_solver
Definition ProcessData.h:51
std::unique_ptr< NumLib::EquationSystem > tdisc_ode_sys
type-erased time-discretized ODE system
Definition ProcessData.h:57
NumLib::NonlinearSolverTag const nonlinear_solver_tag
Definition ProcessData.h:50