21 params.
addParam<std::vector<SolverSystemName>>(
22 "active_scalar_systems", {},
"The solver system for each active scalar advection equation.");
27 params.
addParam<std::vector<Real>>(
"active_scalar_equation_relaxation",
29 "The relaxation which should be used for the active scalar "
30 "equations. (=1 for no relaxation, "
31 "diagonal dominance will still be enforced)");
35 "Singleton PETSc options for the active scalar equation(s)");
37 "active_scalar_petsc_options_iname",
39 "Names of PETSc name/value pairs for the active scalar equation(s)");
40 params.
addParam<std::vector<std::string>>(
41 "active_scalar_petsc_options_value",
42 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
43 "active scalar equation(s)");
45 "active_scalar_absolute_tolerance",
47 "The absolute tolerance(s) on the normalized residual(s) of the active scalar equation(s).");
50 "0.0<=active_scalar_l_tol & active_scalar_l_tol<1.0",
51 "The relative tolerance on the normalized residual in the "
52 "linear solver of the active scalar equation(s).");
55 "0.0<active_scalar_l_abs_tol",
56 "The absolute tolerance on the normalized residual in the "
57 "linear solver of the active scalar equation(s).");
59 "active_scalar_l_max_its",
61 "The maximum allowed iterations in the linear solver of the turbulence equation.");
64 "active_scalar_systems active_scalar_equation_relaxation active_scalar_petsc_options "
65 "active_scalar_petsc_options_iname "
66 "active_scalar_petsc_options_value active_scalar_petsc_options_value "
67 "active_scalar_absolute_tolerance "
68 "active_scalar_l_tol active_scalar_l_abs_tol active_scalar_l_max_its",
69 "Active Scalars Equations");
76 "should_solve_momentum",
true,
"Whether we should solve the momentum predictor/corrector.");
78 "should_solve_pressure",
true,
"Whether we should solve the pressure corrector.");
80 "should_solve_energy",
true,
"Whether we should solve the fluid energy equation.");
82 "should_solve_solid_energy",
true,
"Whether we should solve the solid energy equation.");
83 params.
addParam<
bool>(
"should_solve_turbulence",
85 "Whether we should solve the turbulence surrogate equations.");
87 "should_solve_passive_scalars",
true,
"Whether we should solve passive scalar equations.");
89 "should_solve_active_scalars",
true,
"Whether we should solve active scalar equations.");
90 params.
addParam<
bool>(
"should_solve_pm_radiation",
92 "Whether we should solve participating media radiation equations.");
94 "should_solve_solid_energy should_solve_turbulence "
95 "should_solve_passive_scalars should_solve_active_scalars",
103 const std::string recompute_frequency_explanation =
104 "The default of 1 rebuilds it on every solve. A value of N rebuilds it once every N solves "
106 "reuses it in between, which can substantially reduce the solve cost when the "
107 "preconditioner setup dominates (e.g. algebraic multigrid). Larger values trade more reuse "
108 "for a possibly staler preconditioner (more Krylov iterations); for solves where the "
109 "operator changes significantly between linear solves, prefer a smaller value.";
111 "pressure_pc_recompute_frequency",
113 "pressure_pc_recompute_frequency >= 1",
114 "How often (in pressure corrector solves) to recompute the pressure preconditioner. " +
115 recompute_frequency_explanation);
119 "momentum_pc_recompute_frequency",
121 "momentum_pc_recompute_frequency >= 1",
122 "How often (in SIMPLE iteration solves) to recompute the momentum preconditioner. " +
123 recompute_frequency_explanation);
126 "energy_pc_recompute_frequency",
128 "energy_pc_recompute_frequency >= 1",
129 "How often (in terms of CHT and SIMPLE iterations) to recompute the preconditioner. " +
130 recompute_frequency_explanation);
134 "solid_energy_pc_recompute_frequency >= 1",
135 "How often (in terms of CHT solves nested within "
136 "SIMPLE solves) to recompute the preconditioner. " +
137 recompute_frequency_explanation);
140 "passive_scalar_pc_recompute_frequency",
142 "passive_scalar_pc_recompute_frequency >= 1",
143 "How often (in advection solves) to recompute the preconditioner. " +
144 recompute_frequency_explanation);
146 "Passive Scalars Advection Equation");
148 "turbulence_pc_recompute_frequency",
150 "turbulence_pc_recompute_frequency >= 1",
151 "How often (in advection solves) to recompute the preconditioner. " +
152 recompute_frequency_explanation);
155 "active_scalar_pc_recompute_frequency",
157 "active_scalar_pc_recompute_frequency >= 1",
158 "How often (in advection solves) to recompute the preconditioner. " +
159 recompute_frequency_explanation);
172 _momentum_pc_recompute_frequency(getParam<unsigned
int>(
"momentum_pc_recompute_frequency")),
173 _momentum_pc_solve_counter(0),
174 _pressure_sys_number(_problem.linearSysNum(getParam<SolverSystemName>(
"pressure_system"))),
175 _pressure_system(_problem.getLinearSystem(_pressure_sys_number)),
176 _pressure_pc_recompute_frequency(getParam<unsigned
int>(
"pressure_pc_recompute_frequency")),
177 _pressure_pc_solve_counter(0),
178 _energy_sys_number(_has_energy_system
179 ? _problem.linearSysNum(getParam<SolverSystemName>(
"energy_system"))
181 _energy_system(_has_energy_system ? &_problem.getLinearSystem(_energy_sys_number) : nullptr),
182 _energy_pc_recompute_frequency(getParam<unsigned
int>(
"energy_pc_recompute_frequency")),
183 _energy_pc_solve_counter(0),
184 _solid_energy_sys_number(
185 _has_solid_energy_system
186 ? _problem.linearSysNum(getParam<SolverSystemName>(
"solid_energy_system"))
188 _solid_energy_system(
189 _has_solid_energy_system ? &_problem.getLinearSystem(_solid_energy_sys_number) : nullptr),
190 _solid_energy_pc_recompute_frequency(
191 getParam<unsigned
int>(
"solid_energy_pc_recompute_frequency")),
192 _solid_energy_pc_solve_counter(0),
193 _passive_scalar_pc_recompute_frequency(
194 getParam<unsigned
int>(
"passive_scalar_pc_recompute_frequency")),
195 _passive_scalar_pc_solve_counter(0),
196 _turbulence_pc_recompute_frequency(getParam<unsigned
int>(
"turbulence_pc_recompute_frequency")),
197 _turbulence_pc_solve_counter(0),
198 _should_solve_momentum(getParam<bool>(
"should_solve_momentum")),
199 _should_solve_pressure(getParam<bool>(
"should_solve_pressure")),
200 _should_solve_energy(getParam<bool>(
"should_solve_energy")),
201 _should_solve_solid_energy(getParam<bool>(
"should_solve_solid_energy")),
202 _should_solve_turbulence(getParam<bool>(
"should_solve_turbulence")),
203 _should_solve_passive_scalars(getParam<bool>(
"should_solve_passive_scalars")),
204 _should_solve_active_scalars(getParam<bool>(
"should_solve_active_scalars")),
205 _should_solve_pm_radiation(getParam<bool>(
"should_solve_pm_radiation")),
206 _active_scalar_system_names(getParam<
std::vector<SolverSystemName>>(
"active_scalar_systems")),
207 _has_active_scalar_systems(!_active_scalar_system_names.empty()),
208 _active_scalar_equation_relaxation(
209 getParam<
std::vector<Real>>(
"active_scalar_equation_relaxation")),
210 _active_scalar_l_abs_tol(getParam<Real>(
"active_scalar_l_abs_tol")),
211 _active_scalar_absolute_tolerance(
212 getParam<
std::vector<Real>>(
"active_scalar_absolute_tolerance")),
213 _active_scalar_pc_recompute_frequency(
214 getParam<unsigned
int>(
"active_scalar_pc_recompute_frequency")),
215 _active_scalar_pc_solve_counter(0),
216 _cht(ex.parameters())
220 "Pressure correction requires solving the momentum equations.");
223 "Solving momentum without a pressure corrector is not supported.");
226 "Solid energy solve cannot be enabled when the fluid energy solve is disabled.");
289 const auto & active_scalar_petsc_options =
290 getParam<MultiMooseEnum>(
"active_scalar_petsc_options");
291 const auto & active_scalar_petsc_pair_options = getParam<MooseEnumItem, std::string>(
292 "active_scalar_petsc_options_iname",
"active_scalar_petsc_options_value");
302 getParam<Real>(
"active_scalar_l_tol");
304 getParam<Real>(
"active_scalar_l_abs_tol");
306 getParam<unsigned int>(
"active_scalar_l_max_its");
310 paramError(
"active_scalar_equation_relaxation",
311 "Should be the same size as the number of systems");
316 system->system().prefix_with_name(
false);
325 "Conjugate heat transfer requires solving the fluid energy equation.");
328 "Conjugate heat transfer requires solving the solid energy equation.");
344 const_cast<RhieChowMassFlux *
>(&getUserObject<RhieChowMassFlux>(
"rhie_chow_user_object"));
354std::vector<std::pair<unsigned int, Real>>
359 std::vector<std::pair<unsigned int, Real>> its_normalized_residuals;
361 LinearImplicitSystem & momentum_system_0 =
365 cast_ref<libMesh::PetscLinearSolver<Real> &>(*momentum_system_0.get_linear_solver());
375 LinearImplicitSystem & momentum_system =
378 NumericVector<Number> & solution = *(momentum_system.solution);
379 NumericVector<Number> & rhs = *(momentum_system.rhs);
380 SparseMatrix<Number> & mmat = *(momentum_system.matrix);
382 auto diff_diagonal = solution.zero_clone();
397 LibmeshPetscCall(KSPSetNormType(momentum_solver.
ksp(), KSP_NORM_UNPRECONDITIONED));
404 auto its_resid_pair = momentum_solver.
solve(mmat, mmat, solution, rhs);
405 momentum_system.update();
412 its_normalized_residuals.push_back(
417 _console <<
" matrix when we solve " << std::endl;
419 _console <<
" rhs when we solve " << std::endl;
421 _console <<
" velocity solution component " << system_i << std::endl;
423 _console <<
"Norm factor " << norm_factor << std::endl;
430 ? std::string(
" Component ") + std::to_string(system_i + 1) + std::string(
" ")
432 << COLOR_GREEN << its_normalized_residuals[system_i].second << COLOR_DEFAULT
433 <<
" Linear its: " << its_normalized_residuals[system_i].first << std::endl;
438 LinearImplicitSystem & momentum_system =
440 _momentum_systems[system_i]->setSolution(*(momentum_system.current_local_solution));
441 _momentum_systems[system_i]->copyPreviousSolutions(Moose::SolutionIterationType::Nonlinear);
450 return its_normalized_residuals;
469std::pair<unsigned int, Real>
475 LinearImplicitSystem & pressure_system =
479 NumericVector<Number> & current_local_solution = *(pressure_system.current_local_solution);
480 NumericVector<Number> & solution = *(pressure_system.solution);
481 SparseMatrix<Number> & mmat = *(pressure_system.matrix);
482 NumericVector<Number> & rhs = *(pressure_system.rhs);
486 cast_ref<libMesh::PetscLinearSolver<Real> &>(*pressure_system.get_linear_solver());
492 _console <<
"Pressure matrix" << std::endl;
500 LibmeshPetscCall(KSPSetNormType(pressure_solver.
ksp(), KSP_NORM_UNPRECONDITIONED));
508 pressure_system.update();
516 auto its_res_pair = pressure_solver.
solve(mmat, mmat, solution, rhs);
517 pressure_system.update();
521 _console <<
" rhs when we solve pressure " << std::endl;
523 _console <<
" Pressure " << std::endl;
525 _console <<
"Norm factor " << norm_factor << std::endl;
530 const auto residuals =
533 _console <<
" Pressure equation: " << COLOR_GREEN << residuals.second << COLOR_DEFAULT
534 <<
" Linear its: " << residuals.first << std::endl;
539std::pair<unsigned int, Real>
548 NumericVector<Number> & current_local_solution = *(system.current_local_solution);
549 NumericVector<Number> & solution = *(system.solution);
550 SparseMatrix<Number> & mmat = *(system.matrix);
551 NumericVector<Number> & rhs = *(system.rhs);
555 cast_ref<libMesh::PetscLinearSolver<Real> &>(*system.get_linear_solver());
561 _console <<
"Solid energy matrix" << std::endl;
569 LibmeshPetscCall(KSPSetNormType(solver.
ksp(), KSP_NORM_UNPRECONDITIONED));
580 auto its_res_pair = solver.
solve(mmat, mmat, solution, rhs);
585 _console <<
" rhs when we solve solid energy " << std::endl;
587 _console <<
" Solid energy " << std::endl;
589 _console <<
"Norm factor " << norm_factor << std::endl;
594 const auto residuals =
597 _console <<
" Solid energy equation: " << COLOR_GREEN << residuals.second << COLOR_DEFAULT
598 <<
" Linear its: " << residuals.first << std::endl;
603std::pair<unsigned int, Real>
605 const bool recompute_face_mass_flux,
622 if (recompute_face_mass_flux)
633 pressure_old_solution = pressure_current_solution;
645std::pair<unsigned int, Real>
648 const Real relaxation_factor,
650 const Real absolute_tol,
652 const Real field_relaxation,
653 const Real min_value_limiter)
658 LinearImplicitSystem & li_system = cast_ref<LinearImplicitSystem &>(system.
system());
661 NumericVector<Number> & current_local_solution = *(li_system.current_local_solution);
662 NumericVector<Number> & solution = *(li_system.solution);
663 SparseMatrix<Number> & mmat = *(li_system.matrix);
664 NumericVector<Number> & rhs = *(li_system.rhs);
667 auto diff_diagonal = solution.zero_clone();
671 cast_ref<libMesh::PetscLinearSolver<Real> &>(*li_system.get_linear_solver());
681 _console << system.
name() <<
" system matrix" << std::endl;
689 LibmeshPetscCall(KSPSetNormType(linear_solver.
ksp(), KSP_NORM_UNPRECONDITIONED));
699 auto its_res_pair = linear_solver.
solve(mmat, mmat, solution, rhs);
704 _console <<
" rhs when we solve " << system.
name() << std::endl;
708 _console <<
" Norm factor " << norm_factor << std::endl;
712 if (min_value_limiter != std::numeric_limits<Real>::min())
716 if (field_relaxation != 1.0)
722 old_local_solution = current_local_solution;
727 const auto residuals =
730 _console <<
" Advected system: " << system.
name() <<
" " << COLOR_GREEN << residuals.second
731 << COLOR_DEFAULT <<
" Linear its: " << residuals.first << std::endl;
747 solver_params.
_type = Moose::SolveType::ST_LINEAR;
748 solver_params.
_line_search = Moose::LineSearchType::LS_NONE;
751 unsigned int simple_iteration_counter = 0;
768 const auto energy_index = residual_storage.
energy_index;
774 bool converged = residual_storage.
converged;
782 simple_iteration_counter++;
795 _console <<
"Iteration " << simple_iteration_counter <<
" Initial residual norms:" << std::endl;
801 for (
const auto system_i : index_range(momentum_residual))
802 ns_residuals[momentum_indices[system_i]] = momentum_residual[system_i];
808 ns_residuals[pressure_index] =
correctVelocity(
true,
true, solver_params);
825 ns_residuals[energy_index] =
840 ns_residuals[pm_radiation_indices[i]] =
937 bool passive_scalar_converged =
false;
938 unsigned int ps_iteration_counter = 0;
940 _console <<
"Passive scalar iteration " << ps_iteration_counter
941 <<
" Initial residual norms:" << std::endl;
943 while (ps_iteration_counter <
_num_iterations && !passive_scalar_converged)
945 ps_iteration_counter++;
946 std::vector<std::pair<unsigned int, Real>> scalar_residuals(
948 std::vector<Real> scalar_abs_tols;
950 scalar_abs_tols.push_back(scalar_tol);
969 converged = passive_scalar_converged && converged;
1006 storage.
ns_residuals.push_back(std::make_pair(0, 1.0));
1013 storage.
ns_residuals.push_back(std::make_pair(0, 1.0));
1021 storage.
ns_residuals.push_back(std::make_pair(0, 1.0));
1029 storage.
ns_residuals.push_back(std::make_pair(0, 1.0));
1037 storage.
ns_residuals.push_back(std::make_pair(0, 1.0));
const ExecFlagType EXEC_NONLINEAR
void ErrorVector unsigned int
const ConsoleStream _console
virtual void computeLinearSystemSys(libMesh::LinearImplicitSystem &sys, libMesh::SparseMatrix< libMesh::Number > &system_matrix, NumericVector< libMesh::Number > &rhs, const bool compute_gradients=true)
LinearSystem & getLinearSystem(unsigned int sys_num)
void setCurrentLinearSystem(unsigned int sys_num)
unsigned int linearSysNum(const LinearSystemName &linear_sys_name) const override
virtual MooseMesh & mesh() override
virtual void execute(const ExecFlagType &exec_type)
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 bool _should_solve_pressure
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.
const bool _should_solve_turbulence
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)
static InputParameters validParams()
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 unsigned int _pressure_pc_recompute_frequency
How often (in pressure corrector solves) to recompute the pressure preconditioner.
const bool _should_solve_pm_radiation
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.
virtual void initialSetup() override
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)
const bool _should_solve_active_scalars
const bool _should_solve_passive_scalars
unsigned int _active_scalar_pc_solve_counter
Number of active scalar solves performed without recomputing the preconditioner.
const bool _should_solve_energy
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.
LinearAssemblySegregatedSolve(Executioner &ex)
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.
const bool _should_solve_solid_energy
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.
virtual System & system() override
bool isRecovering() const
void paramError(const std::string ¶m, Args... args) const
virtual unsigned int dimension() const
void sumIntegratedFluxes()
Sum the integrated fluxes over all processors.
void printIntegratedFluxes() const
Print the integrated heat fluxes.
void resetCHTConvergence()
Reset the convergence data.
void resetIntegratedFluxes()
Reset the heat fluxes to 0.
void initializeCHTCouplingFields()
Initialize the coupling fields for the conjugate heat transfer routines.
void deduceCHTBoundaryCoupling()
Run error checks and make sure everything works.
bool converged() const
Check if CHT iteration converged.
void setupConjugateHeatTransferContainers()
Set up the boundary condition pairs, functor maps, and every other necessary structure for the conjug...
virtual bool enabled() const override final
Check if CHT treatment is needed.
static InputParameters validParams()
void updateCHTBoundaryCouplingFields(const NS::CHTSide side)
Update the coupling fields for.
void linkEnergySystems(SystemBase *solid_energy_system, SystemBase *fluid_energy_system, std::vector< SystemBase * > pm_radiation_systems)
Link energy systems.
void incrementCHTIterators()
Increment CHT iterators in the loop.
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
void linkMomentumPressureSystems(const std::vector< LinearSystem * > &momentum_systems, LinearSystem &pressure_system, const std::vector< unsigned int > &momentum_system_numbers)
Update the momentum system-related information.
void initFaceMassFlux()
Initialize the container for face velocities.
void computeHbyA(const bool with_updated_pressure, const bool verbose)
Computes the inverse of the diagonal (1/A) of the system matrix plus the H/A components for the press...
void computeCellVelocity()
Update the cell values of the velocity variables.
void computeFaceMassFlux()
Update the values of the face velocities in the containers.
void initCouplingField()
Initialize the coupling fields (HbyA and Ainv)
Solve class serving as a base class for the two SIMPLE solvers that operate with different assembly a...
const std::vector< Real > _turbulence_equation_relaxation
The user-defined relaxation parameter(s) for the turbulence equation(s)
const Real _momentum_equation_relaxation
The user-defined relaxation parameter for the momentum equation.
const bool _has_energy_system
Boolean for easy check if a fluid energy system shall be solved or not.
std::vector< unsigned int > _pm_radiation_system_numbers
dof_id_type _pressure_pin_dof
The dof ID where the pressure needs to be pinned.
const bool _has_turbulence_systems
Boolean for easy check if a turbulence scalar systems shall be solved or not.
SIMPLESolverConfiguration _pm_radiation_linear_control
Options for the linear solver of the participating media radiation equation(s)
std::vector< unsigned int > _turbulence_system_numbers
const std::vector< SolverSystemName > & _passive_scalar_system_names
The names of the passive scalar systems.
const std::vector< Real > _pm_radiation_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in participating media radiation.
std::vector< unsigned int > _passive_scalar_system_numbers
Moose::PetscSupport::PetscOptions _turbulence_petsc_options
Options which hold the petsc settings for the turbulence equation(s)
const bool _has_pm_radiation_systems
Boolean for easy check if participating media radiation systems shall be solved or not.
const Real _pressure_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in pressure.
const std::vector< SolverSystemName > & _turbulence_system_names
The names of the turbulence systems.
const Real _turbulence_l_abs_tol
Absolute linear tolerance for the turbulence equation(s).
const std::vector< Real > _passive_scalar_equation_relaxation
The user-defined relaxation parameter(s) for the passive scalar equation(s)
const Real _pressure_l_abs_tol
Absolute linear tolerance for the pressure equation.
const Real _passive_scalar_l_abs_tol
Absolute linear tolerance for the passive scalar equation(s).
const bool _has_solid_energy_system
Boolean for easy check if a solid energy system shall be solved or not.
Moose::PetscSupport::PetscOptions _passive_scalar_petsc_options
Options which hold the petsc settings for the passive scalar equation(s)
SIMPLESolverConfiguration _pressure_linear_control
Options for the linear solver of the pressure equation.
static InputParameters validParams()
std::vector< Real > _turbulence_field_relaxation
The user-defined relaxation parameter(s) for the turbulence field(s)
const std::vector< Real > _turbulence_absolute_tolerance
The user-defined absolute tolerance for determining the convergence turbulence variables.
const std::vector< Real > _momentum_absolute_tolerance
The user-defined absolute tolerance(s) for determining the convergence in momentum.
SIMPLESolverConfiguration _solid_energy_linear_control
Options for the linear solver of the energy equation.
const bool _has_passive_scalar_systems
Boolean for easy check if a passive scalar systems shall be solved or not.
std::vector< Real > _turbulence_field_min_limit
The user-defined lower limit for turbulent quantities e.g. k, eps/omega, etc..
Moose::PetscSupport::PetscOptions _pm_radiation_petsc_options
Options which hold the petsc settings for the participating media radiation equation(s)
const std::vector< SolverSystemName > & _pm_radiation_system_names
The names of the participating media radiation systems.
const Real _pm_radiation_l_abs_tol
Absolute linear tolerance for the participating media radiation equation(s).
const Real _pressure_variable_relaxation
The user-defined relaxation parameter for the pressure variable.
const Real _momentum_l_abs_tol
Absolute linear tolerance for the momentum equation(s).
Moose::PetscSupport::PetscOptions _momentum_petsc_options
Options which hold the petsc settings for the momentum equation.
SIMPLESolverConfiguration _energy_linear_control
Options for the linear solver of the energy equation.
const Real _energy_l_abs_tol
Absolute linear tolerance for the energy equations.
const Real _pressure_pin_value
The value we want to enforce for pressure.
Moose::PetscSupport::PetscOptions _solid_energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
Moose::PetscSupport::PetscOptions _pressure_petsc_options
Options which hold the petsc settings for the pressure equation.
const bool _continue_on_max_its
If solve should continue if maximum number of iterations is hit.
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.
const std::vector< Real > _passive_scalar_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in passive scalars.
SIMPLESolverConfiguration _turbulence_linear_control
Options for the linear solver of the turbulence equation(s)
const std::vector< SolverSystemName > & _momentum_system_names
The names of the momentum systems.
const Real _energy_equation_relaxation
The user-defined relaxation parameter for the energy equation.
SIMPLESolverConfiguration _momentum_linear_control
Options for the linear solver of the momentum equation.
SIMPLESolverConfiguration _passive_scalar_linear_control
Options for the linear solver of the passive scalar equation(s)
const Real _solid_energy_l_abs_tol
Absolute linear tolerance for the energy equations.
const bool _pin_pressure
If the pressure needs to be pinned.
Moose::PetscSupport::PetscOptions _energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
const std::vector< Real > _pm_radiation_equation_relaxation
The user-defined relaxation parameter(s) for the participating media radiation equation(s)
const bool _print_fields
Debug parameter which allows printing the coupling and solution vectors/matrices.
const Real _solid_energy_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in solid energy.
Moose::LineSearchType _line_search
void setSolution(const NumericVector< Number > &soln)
virtual const NumericVector< Number > * solutionPreviousNewton() const
virtual const std::string & name() const
void set_solver_configuration(SolverConfiguration &solver_configuration)
virtual void reuse_preconditioner(bool)
Real get_initial_residual()
virtual std::pair< unsigned int, Real > solve(SparseMatrix< T > &matrix_in, NumericVector< T > &solution_in, NumericVector< T > &rhs_in, const std::optional< double > tol=std::nullopt, const std::optional< unsigned int > m_its=std::nullopt) override
std::map< std::string, int > int_valued_data
std::map< std::string, Real > real_valued_data
void petscSetOptions(const PetscOptions &po, const SolverParams &solver_params, FEProblemBase *const problem=nullptr)
MultiMooseEnum getCommonPetscFlags()
MultiMooseEnum getCommonPetscKeys()
void addPetscFlagsToPetscOptions(const MultiMooseEnum &petsc_flags, std::string prefix, const ParallelParamObject ¶m_object, PetscOptions &petsc_options)
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string > > &petsc_pair_options, const unsigned int mesh_dimension, std::string prefix, const ParallelParamObject ¶m_object, PetscOptions &petsc_options)
std::string stringify(const T &t)
Real computeNormalizationFactor(const NumericVector< Number > &solution, const SparseMatrix< Number > &mat, const NumericVector< Number > &rhs)
Compute a normalization factor which is applied to the linear residual to determine convergence.
bool converged(const std::vector< std::pair< unsigned int, Real > > &residuals, const std::vector< Real > &abs_tolerances)
Based on the residuals, determine if the iterative process converged or not.
void relaxMatrix(SparseMatrix< Number > &matrix_in, const Real relaxation_parameter, NumericVector< Number > &diff_diagonal)
Relax the matrix to ensure diagonal dominance, we hold onto the difference in diagonals for later use...
void constrainSystem(SparseMatrix< Number > &mx, NumericVector< Number > &rhs, const Real desired_value, const dof_id_type dof_id)
Implicitly constrain the system by adding a factor*(u-u_desired) to it at a desired dof value.
void relaxSolutionUpdate(NumericVector< Number > &vec_new, const NumericVector< Number > &vec_old, const Real relaxation_factor)
Relax the update on a solution field using the following approach: $u = u_{old}+\lambda (u - u_{old})...
void limitSolutionUpdate(NumericVector< Number > &solution, const Real min_limit=std::numeric_limits< Real >::epsilon(), const Real max_limit=1e10)
Limit a solution to its minimum and maximum bounds: $u = min(max(u, min_limit), max_limit)$.
void relaxRightHandSide(NumericVector< Number > &rhs_in, const NumericVector< Number > &solution_in, const NumericVector< Number > &diff_diagonal)
Relax the right hand side of an equation, this needs to be called once and the system matrix has been...
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
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.