https://mooseframework.inl.gov
PIMPLE.C
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 // 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 
22 {
24  params.addClassDescription(
25  "Solves the transient Navier-Stokes equations using the PIMPLE algorithm and "
26  "linear finite volume variables.");
27  params += PIMPLESolve::validParams();
28 
29  return params;
30 }
31 
32 PIMPLE::PIMPLE(const InputParameters & parameters) : TransientBase(parameters), _pimple_solve(*this)
33 {
34  _fixed_point_solve->setInnerSolve(_pimple_solve);
35 }
36 
37 void
39 {
44 }
45 
46 Real
48 {
49  if (check_aux)
51  else
52  {
53  // Default criterion for now until we add a "steady-state-convergence-object" option
54  Real residual = 0;
55  for (const auto sys : _pimple_solve.systemsToSolve())
56  residual +=
57  std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2);
58  return std::sqrt(residual);
59  }
60 }
61 
62 std::set<TimeIntegrator *>
64 {
65  // We use a set because time integrators were added to every system, and we want a unique
66  std::set<TimeIntegrator *> tis;
67  // Get all time integrators from the systems in the FEProblemSolve
68  for (const auto sys : _pimple_solve.systemsToSolve())
69  for (const auto & ti : sys->getTimeIntegrators())
70  tis.insert(ti.get());
71  return tis;
72 }
const std::vector< LinearSystem * > systemsToSolve() const
Return pointers to the systems which are solved for within this object.
NumericVector< Number > & solution()
static InputParameters validParams()
virtual void init() override
Definition: PIMPLE.C:38
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
AuxiliarySystem & _aux
Real l2_norm_diff(const NumericVector< T > &other_vec) const
virtual std::set< TimeIntegrator * > getTimeIntegrators() const override
Definition: PIMPLE.C:63
virtual Real l2_norm() const=0
static InputParameters validParams()
Definition: PIMPLE.C:21
virtual Real relativeSolutionDifferenceNorm(bool check_aux) const override
Definition: PIMPLE.C:47
virtual void linkRhieChowUserObject() override
Fetch the Rhie Chow user object that is reponsible for determining face velocities and mass flux...
PIMPLE(const InputParameters &parameters)
Definition: PIMPLE.C:32
PIMPLESolve _pimple_solve
The solve object performing the PIMPLE iteration.
Definition: PIMPLE.h:35
virtual void init() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Definition: PIMPLESolve.C:18
Executioner set up to solve a transient thermal-hydraulics problem using the PIMPLE algorithm...
Definition: PIMPLE.h:20
NumericVector< Number > & solutionOld()
MooseUnits pow(const MooseUnits &, int)
void setupPressurePin()
Setup pressure pin if there is need for one.
std::unique_ptr< FixedPointSolve > _fixed_point_solve
registerMooseObject("NavierStokesApp", PIMPLE)