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 : // MOOSE includes 11 : #include "PIMPLE.h" 12 : #include "FEProblem.h" 13 : #include "AuxiliarySystem.h" 14 : #include "LinearSystem.h" 15 : 16 : using namespace libMesh; 17 : 18 : registerMooseObject("NavierStokesApp", PIMPLE); 19 : 20 : InputParameters 21 286 : PIMPLE::validParams() 22 : { 23 286 : InputParameters params = TransientBase::validParams(); 24 286 : params.addClassDescription( 25 : "Solves the transient Navier-Stokes equations using the PIMPLE algorithm and " 26 : "linear finite volume variables."); 27 286 : params += PIMPLESolve::validParams(); 28 : 29 286 : return params; 30 0 : } 31 : 32 143 : PIMPLE::PIMPLE(const InputParameters & parameters) : TransientBase(parameters), _pimple_solve(*this) 33 : { 34 143 : _fixed_point_solve->setInnerSolve(_pimple_solve); 35 143 : } 36 : 37 : void 38 141 : PIMPLE::init() 39 : { 40 141 : TransientBase::init(); 41 141 : _pimple_solve.linkRhieChowUserObject(); 42 141 : _pimple_solve.setupPressurePin(); 43 141 : } 44 : 45 : Real 46 0 : PIMPLE::relativeSolutionDifferenceNorm(bool check_aux) const 47 : { 48 0 : if (check_aux) 49 0 : return _aux.solution().l2_norm_diff(_aux.solutionOld()) / _aux.solution().l2_norm(); 50 : else 51 : { 52 : // Default criterion for now until we add a "steady-state-convergence-object" option 53 : Real residual = 0; 54 0 : for (const auto sys : _pimple_solve.systemsToSolve()) 55 0 : residual += 56 0 : std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2); 57 0 : return std::sqrt(residual); 58 : } 59 : } 60 : 61 : std::set<TimeIntegrator *> 62 1802 : PIMPLE::getTimeIntegrators() const 63 : { 64 : // We use a set because time integrators were added to every system, and we want a unique 65 : std::set<TimeIntegrator *> tis; 66 : // Get all time integrators from the systems in the FEProblemSolve 67 8729 : for (const auto sys : _pimple_solve.systemsToSolve()) 68 13854 : for (const auto & ti : sys->getTimeIntegrators()) 69 8729 : tis.insert(ti.get()); 70 1802 : return tis; 71 : }