OGS
ProcessData.cpp
Go to the documentation of this file.
1
11#include "ProcessData.h"
12
14
15namespace ProcessLib
16{
17void setEquationSystem(ProcessData const& process_data)
18{
19 auto& conv_crit = *process_data.conv_crit;
20 auto& nonlinear_solver = process_data.nonlinear_solver;
21
23 switch (process_data.nonlinear_solver_tag)
24 {
25 case Tag::Picard:
26 {
28 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
29 if (auto* nl_solver =
31 &nonlinear_solver);
32 nl_solver != nullptr)
33 {
34 nl_solver->setEquationSystem(eq_sys_, conv_crit);
35 }
36 else
37 {
39 "Could not cast nonlinear solver to Picard type solver.");
40 }
41 break;
42 }
43 case Tag::Newton:
44 {
46 auto& eq_sys_ = static_cast<EqSys&>(*process_data.tdisc_ode_sys);
47
48 if (auto* nl_solver =
50 &nonlinear_solver);
51 nl_solver != nullptr)
52 {
53 nl_solver->setEquationSystem(eq_sys_, conv_crit);
54 }
55#ifdef USE_PETSC
56 else if (auto* nl_solver =
57 dynamic_cast<NumLib::PETScNonlinearSolver*>(
58 &nonlinear_solver);
59 nl_solver != nullptr)
60 {
61 nl_solver->setEquationSystem(eq_sys_, conv_crit);
62 }
63#endif // USE_PETSC
64 else
65 {
67 "Could not cast nonlinear solver to Newton type solver.");
68 }
69 break;
70 }
71 }
72}
73
74} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
NonlinearSolverTag
Tag used to specify which nonlinear solver will be used.
Definition Types.h:20
void setEquationSystem(ProcessData const &process_data)
std::unique_ptr< NumLib::ConvergenceCriterion > conv_crit
Definition ProcessData.h:60
NumLib::NonlinearSolverBase & nonlinear_solver
Definition ProcessData.h:58
std::unique_ptr< NumLib::EquationSystem > tdisc_ode_sys
type-erased time-discretized ODE system
Definition ProcessData.h:64
NumLib::NonlinearSolverTag const nonlinear_solver_tag
Definition ProcessData.h:57