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 {
43 }
44 
45 Real
47 {
48  if (_check_aux)
50  else
51  {
52  // Default criterion for now until we add a "steady-state-convergence-object" option
53  Real residual = 0;
54  for (const auto sys : _pimple_solve.systemsToSolve())
55  residual +=
56  std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2);
57  return std::sqrt(residual);
58  }
59 }
60 
61 std::set<TimeIntegrator *>
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  for (const auto sys : _pimple_solve.systemsToSolve())
68  for (const auto & ti : sys->getTimeIntegrators())
69  tis.insert(ti.get());
70  return tis;
71 }
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:62
virtual Real l2_norm() const=0
static InputParameters validParams()
Definition: PIMPLE.C:21
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
const bool _check_aux
void addClassDescription(const std::string &doc_string)
virtual Real relativeSolutionDifferenceNorm() override
Definition: PIMPLE.C:46
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)