Line data Source code
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 : 17 : /** 18 : * Common base class for segregated solvers for the Navier-Stokes 19 : * equations with linear FV assembly routines. Once the nonlinear 20 : * assembly-based routines are retired, this will be the primary base class 21 : * instead of SIMPLESolveBase. 22 : */ 23 : class LinearAssemblySegregatedSolve : public SIMPLESolveBase 24 : { 25 : public: 26 : LinearAssemblySegregatedSolve(Executioner & ex); 27 : 28 : static InputParameters validParams(); 29 : 30 : virtual void linkRhieChowUserObject() override; 31 : 32 : virtual void initialSetup() override; 33 : 34 : /** 35 : * Performs the momentum pressure coupling. 36 : * @return True if solver is converged. 37 : */ 38 : virtual bool solve() override; 39 : 40 : /// Return pointers to the systems which are solved for within this object 41 1802 : const std::vector<LinearSystem *> systemsToSolve() const { return _systems_to_solve; } 42 : 43 : protected: 44 : virtual std::vector<std::pair<unsigned int, Real>> solveMomentumPredictor() override; 45 : virtual std::pair<unsigned int, Real> solvePressureCorrector() override; 46 : 47 : /// Computes new velocity field based on computed pressure gradients 48 : /// @param subtract_updated_pressure If we need to subtract the updated 49 : /// pressure gradient from the right hand side of the system 50 : /// @param recompute_face_mass_flux If we want to recompute the face flux too 51 : /// @param solver_params Dummy solver parameter object for the linear solve 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 : 56 : /// Solve an equation which contains an advection term that depends 57 : /// on the solution of the segregated Navier-Stokes equations. 58 : /// @param system_num The number of the system which is solved 59 : /// @param system Reference to the system which is solved 60 : /// @param relaxation_factor The relaxation factor for matrix relaxation 61 : /// @param solver_config The solver configuration object for the linear solve 62 : /// @param abs_tol The scaled absolute tolerance for the linear solve 63 : /// @param field_relaxation (optional) The relaxation factor for fields if relax_fields is true. Default value is 1.0. 64 : /// @param min_value_limiter (optional) The minimum value for the solution field 65 : /// @return The normalized residual norm of the equation. 66 : std::pair<unsigned int, Real> 67 : solveAdvectedSystem(const unsigned int system_num, 68 : LinearSystem & system, 69 : const Real relaxation_factor, 70 : libMesh::SolverConfiguration & solver_config, 71 : const Real abs_tol, 72 : const Real field_relaxation = 1.0, 73 : const Real min_value_limiter = std::numeric_limits<Real>::min()); 74 : 75 : /// Solve an equation which contains the solid energy conservation. 76 : std::pair<unsigned int, Real> solveSolidEnergy(); 77 : 78 : /// The number(s) of the system(s) corresponding to the momentum equation(s) 79 : std::vector<unsigned int> _momentum_system_numbers; 80 : 81 : /// Pointer(s) to the system(s) corresponding to the momentum equation(s) 82 : std::vector<LinearSystem *> _momentum_systems; 83 : 84 : /// The number of the system corresponding to the pressure equation 85 : const unsigned int _pressure_sys_number; 86 : 87 : /// Reference to the linear system corresponding to the pressure equation 88 : LinearSystem & _pressure_system; 89 : 90 : /// The number of the system corresponding to the energy equation 91 : const unsigned int _energy_sys_number; 92 : 93 : /// Pointer to the linear system corresponding to the fluid energy equation 94 : LinearSystem * _energy_system; 95 : 96 : /// The number of the system corresponding to the solid energy equation 97 : const unsigned int _solid_energy_sys_number; 98 : 99 : /// Pointer to the linear system corresponding to the solid energy equation 100 : LinearSystem * _solid_energy_system; 101 : 102 : /// Pointer(s) to the system(s) corresponding to the passive scalar equation(s) 103 : std::vector<LinearSystem *> _passive_scalar_systems; 104 : 105 : /// Pointer(s) to the system(s) corresponding to the active scalar equation(s) 106 : std::vector<LinearSystem *> _active_scalar_systems; 107 : 108 : /// Pointer(s) to the system(s) corresponding to the turbulence equation(s) 109 : std::vector<LinearSystem *> _turbulence_systems; 110 : 111 : /// Pointer to the segregated RhieChow interpolation object 112 : RhieChowMassFlux * _rc_uo; 113 : 114 : /// Shortcut to every linear system that we solve for here 115 : std::vector<LinearSystem *> _systems_to_solve; 116 : 117 : // ************************ Active Scalar Variables ************************ // 118 : 119 : /// The names of the active scalar systems 120 : const std::vector<SolverSystemName> & _active_scalar_system_names; 121 : 122 : /// Boolean for easy check if a active scalar systems shall be solved or not 123 : const bool _has_active_scalar_systems; 124 : 125 : // The number(s) of the system(s) corresponding to the active scalar equation(s) 126 : std::vector<unsigned int> _active_scalar_system_numbers; 127 : 128 : /// The user-defined relaxation parameter(s) for the active scalar equation(s) 129 : const std::vector<Real> _active_scalar_equation_relaxation; 130 : 131 : /// Options which hold the petsc settings for the active scalar equation(s) 132 : Moose::PetscSupport::PetscOptions _active_scalar_petsc_options; 133 : 134 : /// Options for the linear solver of the active scalar equation(s) 135 : SIMPLESolverConfiguration _active_scalar_linear_control; 136 : 137 : /// Absolute linear tolerance for the active scalar equation(s). We need to store this, because 138 : /// it needs to be scaled with a representative flux. 139 : const Real _active_scalar_l_abs_tol; 140 : 141 : /// The user-defined absolute tolerance for determining the convergence in active scalars 142 : const std::vector<Real> _active_scalar_absolute_tolerance; 143 : 144 : /// ********************** Conjugate heat transfer variables ************** // 145 : 146 : // Handler object for CHT problems 147 : NS::FV::CHTHandler _cht; 148 : };