LCOV - code coverage report
Current view: top level - include/executioners - LinearAssemblySegregatedSolve.h (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 1 1 100.0 %
Date: 2025-08-14 10:14:56 Functions: 0 0 -
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14