https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearAssemblySegregatedSolve.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 "RhieChowMassFlux.h"
14#include "SIMPLESolveBase.h"
15#include "CHTHandler.h"
16
24{
25public:
27
29
30 virtual void linkRhieChowUserObject() override;
31
32 virtual void initialSetup() override;
33
38 virtual bool solve() override;
39
41 const std::vector<LinearSystem *> systemsToSolve() const { return _systems_to_solve; }
42
43protected:
44 virtual std::vector<std::pair<unsigned int, Real>> solveMomentumPredictor() override;
45 virtual std::pair<unsigned int, Real> solvePressureCorrector() override;
46
52 virtual std::pair<unsigned int, Real> correctVelocity(const bool subtract_updated_pressure,
53 const bool recompute_face_mass_flux,
54 const SolverParams & solver_params);
55
67 std::pair<unsigned int, Real>
68 solveAdvectedSystem(const unsigned int system_num,
69 LinearSystem & system,
70 const Real relaxation_factor,
71 libMesh::SolverConfiguration & solver_config,
72 const Real abs_tol,
73 const bool reuse_pc,
74 const Real field_relaxation = 1.0,
75 const Real min_value_limiter = std::numeric_limits<Real>::min());
76
79 {
81 std::vector<std::pair<unsigned int, Real>> ns_residuals;
83 std::vector<Real> ns_abs_tols;
85 std::vector<std::size_t> momentum_indices;
93 std::vector<std::size_t> active_scalar_indices;
95 std::vector<std::size_t> turbulence_indices;
97 std::vector<std::size_t> pm_radiation_indices;
100 bool converged = false;
101 };
102
107
109 std::pair<unsigned int, Real> solveSolidEnergy();
110
113
115 std::vector<unsigned int> _momentum_system_numbers;
116
118 std::vector<LinearSystem *> _momentum_systems;
119
122
125
127 const unsigned int _pressure_sys_number;
128
131
138
141
143 const unsigned int _energy_sys_number;
144
147
150
153
155 const unsigned int _solid_energy_sys_number;
156
159
162
165
168
171
174
177
179 std::vector<LinearSystem *> _passive_scalar_systems;
180
182 std::vector<LinearSystem *> _pm_radiation_systems;
183
185 std::vector<LinearSystem *> _active_scalar_systems;
186
188 std::vector<LinearSystem *> _turbulence_systems;
189
192
194 std::vector<LinearSystem *> _systems_to_solve;
195
205
206 // ************************ Active Scalar Variables ************************ //
207
209 const std::vector<SolverSystemName> & _active_scalar_system_names;
210
213
214 // The number(s) of the system(s) corresponding to the active scalar equation(s)
215 std::vector<unsigned int> _active_scalar_system_numbers;
216
218 const std::vector<Real> _active_scalar_equation_relaxation;
219
222
225
229
231 const std::vector<Real> _active_scalar_absolute_tolerance;
232
235
238
240
241 // Handler object for CHT problems
243};
Common base class for segregated solvers for the Navier-Stokes equations with linear FV assembly rout...
const unsigned int _energy_sys_number
The number of the system corresponding to the energy equation.
std::pair< unsigned int, Real > solveSolidEnergy()
Solve an equation which contains the solid energy conservation.
unsigned int _turbulence_pc_solve_counter
Number of turbulence equations solves performed without recomputing the preconditioner.
unsigned int _energy_pc_solve_counter
Number of energy solves performed without recomputing the preconditioner.
std::pair< unsigned int, Real > solveAdvectedSystem(const unsigned int system_num, LinearSystem &system, const Real relaxation_factor, libMesh::SolverConfiguration &solver_config, const Real abs_tol, const bool reuse_pc, const Real field_relaxation=1.0, const Real min_value_limiter=std::numeric_limits< Real >::min())
Solve an equation which contains an advection term that depends on the solution of the segregated Nav...
virtual std::pair< unsigned int, Real > correctVelocity(const bool subtract_updated_pressure, const bool recompute_face_mass_flux, const SolverParams &solver_params)
Computes new velocity field based on computed pressure gradients.
const unsigned int _energy_pc_recompute_frequency
How often to recompute the energy equation preconditioner.
SIMPLESolverConfiguration _active_scalar_linear_control
Options for the linear solver of the active scalar equation(s)
ResidualStorage setupResidualStorage() const
Build residual/tolerance vectors and associated indices for all enabled systems.
const unsigned int _solid_energy_sys_number
The number of the system corresponding to the solid energy equation.
std::vector< LinearSystem * > _systems_to_solve
Shortcut to every linear system that we solve for here.
unsigned int _solid_energy_pc_solve_counter
Number of solid energy solves performed without recomputing the preconditioner.
const unsigned int _momentum_pc_recompute_frequency
How often to recompute the momentum equations preconditioner.
const Real _active_scalar_l_abs_tol
Absolute linear tolerance for the active scalar equation(s).
LinearSystem * _energy_system
Pointer to the linear system corresponding to the fluid energy equation.
NS::FV::CHTHandler _cht
********************** Conjugate heat transfer variables ************** //
LinearSystem * _solid_energy_system
Pointer to the linear system corresponding to the solid energy equation.
std::vector< unsigned int > _momentum_system_numbers
The number(s) of the system(s) corresponding to the momentum equation(s)
std::vector< LinearSystem * > _turbulence_systems
Pointer(s) to the system(s) corresponding to the turbulence equation(s)
virtual bool solve() override
Performs the momentum pressure coupling.
std::vector< LinearSystem * > _momentum_systems
Pointer(s) to the system(s) corresponding to the momentum equation(s)
std::vector< LinearSystem * > _pm_radiation_systems
Pointer(s) to the system(s) corresponding to the participting media radiation equation(s)
Moose::PetscSupport::PetscOptions _active_scalar_petsc_options
Options which hold the petsc settings for the active scalar equation(s)
RhieChowMassFlux * _rc_uo
Pointer to the segregated RhieChow interpolation object.
const std::vector< LinearSystem * > systemsToSolve() const
Return pointers to the systems which are solved for within this object.
const unsigned int _pressure_pc_recompute_frequency
How often (in pressure corrector solves) to recompute the pressure preconditioner.
virtual std::vector< std::pair< unsigned int, Real > > solveMomentumPredictor() override
Solve a momentum predictor step with a fixed pressure field.
unsigned int _momentum_pc_solve_counter
Number of momentum equations solves performed without recomputing the preconditioner.
const std::vector< Real > _active_scalar_equation_relaxation
The user-defined relaxation parameter(s) for the active scalar equation(s)
std::vector< LinearSystem * > _active_scalar_systems
Pointer(s) to the system(s) corresponding to the active scalar equation(s)
unsigned int _active_scalar_pc_solve_counter
Number of active scalar solves performed without recomputing the preconditioner.
unsigned int _pressure_pc_solve_counter
Number of pressure corrector solves performed without recomputing the preconditioner.
const unsigned int _active_scalar_pc_recompute_frequency
How often to recompute the active scalar equations preconditioner.
const unsigned int _turbulence_pc_recompute_frequency
How often to recompute the turbulence equations preconditioner.
virtual void linkRhieChowUserObject() override
Fetch the Rhie Chow user object that is reponsible for determining face velocities and mass flux.
LinearSystem & _pressure_system
Reference to the linear system corresponding to the pressure equation.
const std::vector< Real > _active_scalar_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in active scalars.
const bool _has_active_scalar_systems
Boolean for easy check if a active scalar systems shall be solved or not.
const unsigned int _solid_energy_pc_recompute_frequency
How often to recompute the solid energy equation preconditioner.
const std::vector< SolverSystemName > & _active_scalar_system_names
The names of the active scalar systems.
unsigned int _passive_scalar_pc_solve_counter
Number of passive scalar solves performed without recomputing the preconditioner.
const unsigned int _passive_scalar_pc_recompute_frequency
How often to recompute the passive scalar equations preconditioner.
const unsigned int _pressure_sys_number
The number of the system corresponding to the pressure equation.
std::vector< unsigned int > _active_scalar_system_numbers
virtual std::pair< unsigned int, Real > solvePressureCorrector() override
Solve a pressure corrector step.
const bool _should_solve_momentum
Flags controlling which systems are actively solved (can be used with restart to freeze flow)
std::vector< LinearSystem * > _passive_scalar_systems
Pointer(s) to the system(s) corresponding to the passive scalar equation(s)
void updatePressureGradient()
Explicitly update all registered pressure gradient fields.
This class provides an interface for managing conjugate heat transfer (CHT) between fluid and solid d...
Definition CHTHandler.h:30
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
Solve class serving as a base class for the two SIMPLE solvers that operate with different assembly a...
Solver configuration class used with the linear solvers in a SIMPLE solver.
constexpr std::size_t invalid_size_t
Aggregated storage for residuals, tolerances, and indices used in convergence checks.
std::vector< std::size_t > active_scalar_indices
Indices of active scalar equations in ns_residuals.
std::size_t pressure_index
Index of the pressure equation in ns_residuals.
std::vector< std::size_t > turbulence_indices
Indices of turbulence surrogate equations in ns_residuals.
std::size_t energy_index
Index of the energy equation in ns_residuals.
std::vector< std::pair< unsigned int, Real > > ns_residuals
(linear iterations, normalized residual) entries in the order used by NS::FV::converged()
bool converged
This will be an initial indicator if we have something to solve.
std::vector< std::size_t > pm_radiation_indices
Indices of participating media radiation equations in ns_residuals.
std::vector< std::size_t > momentum_indices
Indices of momentum equations in ns_residuals.
std::vector< Real > ns_abs_tols
Absolute tolerances matching ns_residuals.
std::size_t solid_energy_index
Index of the solid energy equation in ns_residuals.