https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PIMPLESolve.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#include "PIMPLESolve.h"
11#include "FEProblem.h"
13#include "LinearSystem.h"
14
17{
19 params.addParam<unsigned int>(
20 "num_piso_iterations",
21 0,
22 "The number of PISO iterations without recomputing the momentum matrix.");
23
24 return params;
25}
26
29 _num_piso_iterations(getParam<unsigned int>("num_piso_iterations"))
30{
31}
32
33std::pair<unsigned int, Real>
34PIMPLESolve::correctVelocity(const bool /*recompute_face_mass_flux*/,
35 const SolverParams & solver_params)
36{
37 std::pair<unsigned int, Real> residual;
38 unsigned int piso_iteration_counter = 0;
39 const bool reconstructed = _rc_uo && _rc_uo->usingReconstructedPressureGradientMethod();
40 while (piso_iteration_counter <= _num_piso_iterations)
41 {
42 const bool last_piso_corrector = piso_iteration_counter == _num_piso_iterations;
43
44 // Reconstructed candidates always need the face flux produced by their own pressure
45 // solve, so every corrector must recompute it. Ordinary (non-reconstructed) PIMPLE only
46 // needs the final corrector's flux, which feeds the advection terms for the next outer
47 // iteration/time step.
48 const bool recompute_flux = reconstructed || last_piso_corrector;
49
50 residual = LinearAssemblySegregatedSolve::correctVelocity(recompute_flux, solver_params);
51
52 // After each PISO corrector except the last, refresh only the lagged velocity gradient. H/A
53 // continues using the coupling-gradient snapshot associated with the existing momentum system.
54 if (!last_piso_corrector && reconstructed)
56
57 piso_iteration_counter++;
58 }
59
60 return residual;
61}
void ErrorVector unsigned int
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Common base class for segregated solvers for the Navier-Stokes equations with linear FV assembly rout...
virtual std::pair< unsigned int, Real > correctVelocity(const bool recompute_face_mass_flux, const SolverParams &solver_params)
Computes new velocity field based on computed pressure gradients.
RhieChowMassFlux * _rc_uo
Pointer to the segregated RhieChow interpolation object.
const unsigned int _num_piso_iterations
Number of H(u) and u iterations with fixed face flux.
Definition PIMPLESolve.h:43
virtual std::pair< unsigned int, Real > correctVelocity(const bool recompute_face_mass_flux, const SolverParams &solver_params) override
Computes new velocity field based on computed pressure gradients.
Definition PIMPLESolve.C:34
PIMPLESolve(Executioner &ex)
Definition PIMPLESolve.C:27
static InputParameters validParams()
Definition PIMPLESolve.C:16
void preparePISOCorrector()
Capture the lagged velocity gradient for another corrector using the current predictor.
bool usingReconstructedPressureGradientMethod() const
Whether the registered pressure gradient field is produced by the reconstructed method.