https://mooseframework.inl.gov
SIMPLESolveBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // Moose includes
13 #include "SolveObject.h"
14 #include "UserObjectInterface.h"
15 #include "PetscSupport.h"
16 #include "SolverParams.h"
17 #include "SegregatedSolverUtils.h"
18 
19 // Libmesh includes
20 #include "libmesh/solver_configuration.h"
21 #include "libmesh/petsc_vector.h"
22 #include "libmesh/petsc_matrix.h"
23 #include "libmesh/equation_systems.h"
24 
29 {
33  virtual void configure_solver() override {}
34 };
35 
42 {
43 public:
45 
47 
48  virtual void setInnerSolve(SolveObject &) override
49  {
50  mooseError("Cannot set inner solve object for solves that inherit from SIMPLESolveBase");
51  }
52 
55  virtual void linkRhieChowUserObject() = 0;
56 
58  void setupPressurePin();
59 
61  virtual void checkIntegrity() {}
62 
63 protected:
64  void checkDependentParameterError(const std::string & main_parameter,
65  const std::vector<std::string> & dependent_parameters,
66  const bool should_be_defined);
67 
72  virtual std::vector<std::pair<unsigned int, Real>> solveMomentumPredictor() = 0;
73 
77  virtual std::pair<unsigned int, Real> solvePressureCorrector() = 0;
78 
79  // ************************ Momentum Eq Variables ************************ //
80 
82  const std::vector<SolverSystemName> & _momentum_system_names;
83 
86 
90 
93 
96 
97  // ************************ Pressure Eq Variables ************************ //
98 
100  const SolverSystemName & _pressure_system_name;
101 
104 
108 
111 
114 
116  const bool _pin_pressure;
117 
120 
123 
124  // ************************ Energy Eq Variables ************************** //
125 
127  const bool _has_energy_system;
128 
131 
134 
137 
141 
142  // ************************ Solid Energy Eq Variables *********************** //
143 
146 
149 
152 
156 
157  // ************************ Passive Scalar Variables ************************ //
158 
160  const std::vector<SolverSystemName> & _passive_scalar_system_names;
161 
164 
165  // The number(s) of the system(s) corresponding to the passive scalar equation(s)
166  std::vector<unsigned int> _passive_scalar_system_numbers;
167 
169  const std::vector<Real> _passive_scalar_equation_relaxation;
170 
173 
176 
180 
181  // ************************ Iteration control **************************** //
182 
185 
188 
191 
194 
196  const std::vector<Real> _passive_scalar_absolute_tolerance;
197 
199  const unsigned int _num_iterations;
200 
203 
204  // ************************ Other Variables ****************************** //
205 
207  const bool _print_fields;
208 };
SIMPLESolverConfiguration _momentum_linear_control
Options for the linear solver of the momentum equation.
const Real _energy_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in energy.
const unsigned int _num_iterations
The maximum number of momentum-pressure iterations.
SIMPLESolverConfiguration _energy_linear_control
Options for the linear solver of the energy equation.
const bool _print_fields
Debug parameter which allows printing the coupling and solution vectors/matrices. ...
const Real _solid_energy_l_abs_tol
Absolute linear tolerance for the energy equations.
const bool _has_energy_system
Boolean for easy check if a fluid energy system shall be solved or not.
const SolverSystemName & _pressure_system_name
The name of the pressure system.
const Real _passive_scalar_l_abs_tol
Absolute linear tolerance for the passive scalar equation(s).
Moose::PetscSupport::PetscOptions _solid_energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
const Real _momentum_equation_relaxation
The user-defined relaxation parameter for the momentum equation.
void checkDependentParameterError(const std::string &main_parameter, const std::vector< std::string > &dependent_parameters, const bool should_be_defined)
static InputParameters validParams()
const Real _momentum_l_abs_tol
Absolute linear tolerance for the momentum equation(s).
virtual void setInnerSolve(SolveObject &) override
virtual void linkRhieChowUserObject()=0
Fetch the Rhie Chow user object that is reponsible for determining face velocities and mass flux...
const Real _pressure_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in pressure.
const Real _pressure_variable_relaxation
The user-defined relaxation parameter for the pressure variable.
const Real _momentum_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in momentum.
const std::vector< SolverSystemName > & _passive_scalar_system_names
The names of the passive scalar systems.
virtual std::pair< unsigned int, Real > solvePressureCorrector()=0
Solve a pressure corrector step.
SIMPLESolverConfiguration _passive_scalar_linear_control
Options for the linear solver of the passive scalar equation(s)
Moose::PetscSupport::PetscOptions _energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
SIMPLESolverConfiguration _pressure_linear_control
Options for the linear solver of the pressure equation.
Moose::PetscSupport::PetscOptions _passive_scalar_petsc_options
Options which hold the petsc settings for the passive scalar equation(s)
virtual void checkIntegrity()
Check if the user defined time kernels.
Moose::PetscSupport::PetscOptions _momentum_petsc_options
Options which hold the petsc settings for the momentum equation.
const Real _pressure_l_abs_tol
Absolute linear tolerance for the pressure equation.
const std::vector< Real > _passive_scalar_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in passive scalars.
dof_id_type _pressure_pin_dof
The dof ID where the pressure needs to be pinned.
const bool _pin_pressure
If the pressure needs to be pinned.
const Real _energy_l_abs_tol
Absolute linear tolerance for the energy equations.
const std::vector< SolverSystemName > & _momentum_system_names
The names of the momentum systems.
Solver configuration class used with the linear solvers in a SIMPLE solver.
const std::vector< Real > _passive_scalar_equation_relaxation
The user-defined relaxation parameter(s) for the passive scalar equation(s)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
SIMPLESolveBase(Executioner &ex)
const Real _energy_equation_relaxation
The user-defined relaxation parameter for the energy equation.
const Real _pressure_pin_value
The value we want to enforce for pressure.
void mooseError(Args &&... args) const
Solve class serving as a base class for the two SIMPLE solvers that operate with different assembly a...
const bool _has_passive_scalar_systems
Boolean for easy check if a passive scalar systems shall be solved or not.
const Real _solid_energy_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in solid energy.
SIMPLESolverConfiguration _solid_energy_linear_control
Options for the linear solver of the energy equation.
virtual std::vector< std::pair< unsigned int, Real > > solveMomentumPredictor()=0
Solve a momentum predictor step with a fixed pressure field.
const bool _continue_on_max_its
If solve should continue if maximum number of iterations is hit.
void setupPressurePin()
Setup pressure pin if there is need for one.
std::vector< unsigned int > _passive_scalar_system_numbers
Moose::PetscSupport::PetscOptions _pressure_petsc_options
Options which hold the petsc settings for the pressure equation.
uint8_t dof_id_type
const bool _has_solid_energy_system
Boolean for easy check if a solid energy system shall be solved or not.
virtual void configure_solver() override
Override this to make sure the PETSc options are not overwritten in the linear solver.