Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
physics_subequations_solver.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2025 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_physics_subequations_solver_h
5#define lethe_physics_subequations_solver_h
6
8
9
10
11/**
12 * @brief Base class to solve subequations solved inside a physics (or auxiliary
13 * physics) that are not part of the main equations set. It contains all the
14 * common elements of a subequation solver.
15 */
17{
18public:
19 /**
20 * @brief Set up the DofHandler and the degrees of freedom associated with
21 * the equation to solve.
22 */
23 virtual void
25
26 /**
27 * @brief Assemble and solve the system.
28 */
29 virtual void
30 solve() = 0;
31};
32
33/**
34 * @brief Linear subequations solved inside a physics (or auxiliary physics)
35 * that are not part of the main set of equations.
36 */
38{
39public:
40 /**
41 * @brief Constructor for physics subequations that require the use of a
42 * linear solver within the span of the physics resolution.
43 *
44 * @param[in] pcout Parallel cout used to print the information.
45 */
46 PhysicsLinearSubequationsSolver(const ConditionalOStream &pcout)
47 : pcout(pcout)
48 {}
49
50 /**
51 * @brief Default destructor.
52 */
54
55protected:
56 /**
57 * @brief Solve the linear system associated with the equation to solve, when
58 * the equation is already linear.
59 */
60 virtual void
62
63
64 const ConditionalOStream pcout;
65};
66
67/**
68 * @brief Non-linear subequations solved inside a physics (or auxiliary physics)
69 * that are not part of the main set of equations.
70 *
71 * @tparam dim An integer that denotes the dimension of the space in which
72 * the problem is solved.
73 *
74 * @tparam VectorType The Vector type used for the solvers.
75 */
76template <int dim, typename VectorType>
78 public PhysicsSolver<VectorType>
79{
80public:
81 /**
82 * @brief Constructor for physics subequations that require the use of a
83 * non-linear solver within the span of the physics solving.
84 *
85 * @param[in] non_linear_solver_parameters Set of parameters used to construct
86 * the non-linear solver.
87 *
88 * @param[in] pcout Parallel cout used to print the information.
89 */
91 const Parameters::NonLinearSolver non_linear_solver_parameters,
92 const ConditionalOStream &pcout)
93 : PhysicsSolver<VectorType>(non_linear_solver_parameters)
94 , pcout(pcout)
95 {}
96
97 /**
98 * @brief Default destructor.
99 */
101
102 /**
103 * @brief Setup preconditioner.
104 *
105 * @note Not used for the physics subequations, but needed for the compilation
106 * of the non-linear solver.
107 */
108 void
110
111protected:
112 const ConditionalOStream pcout;
113};
114
115#endif
PhysicsLinearSubequationsSolver(const ConditionalOStream &pcout)
Constructor for physics subequations that require the use of a linear solver within the span of the p...
virtual void solve_linear_system_and_update_solution()=0
Solve the linear system associated with the equation to solve, when the equation is already linear.
virtual ~PhysicsLinearSubequationsSolver()=default
Default destructor.
virtual ~PhysicsNonlinearSubequationsSolver()=default
Default destructor.
void setup_preconditioner() override
Setup preconditioner.
PhysicsNonlinearSubequationsSolver(const Parameters::NonLinearSolver non_linear_solver_parameters, const ConditionalOStream &pcout)
Constructor for physics subequations that require the use of a non-linear solver within the span of t...
PhysicsSolver(const Parameters::NonLinearSolver non_linear_solver_parameters)
Constructor for the non-linear physics.
Base class to solve subequations solved inside a physics (or auxiliary physics) that are not part of ...
virtual void solve()=0
Assemble and solve the system.
virtual void setup_dofs()=0
Set up the DofHandler and the degrees of freedom associated with the equation to solve.
NonLinearSolver - Parameter that controls the solution of the non-linear problems.
GlobalVectorType VectorType