momentumPredictor.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "isothermalFluid.H"
27 #include "fvmDiv.H"
28 #include "fvcGrad.H"
29 
30 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
31 
33 {
35 
36  tUEqn =
37  (
38  fvm::ddt(rho, U) + fvm::div(phi, U)
39  + MRF.DDt(rho, U)
40  + momentumTransport->divDevTau(U)
41  ==
42  fvModels().source(rho, U)
43  );
44  fvVectorMatrix& UEqn = tUEqn.ref();
45 
46  UEqn.relax();
47 
49 
51  {
52  if (buoyancy.valid())
53  {
54  solve
55  (
56  UEqn
57  ==
58  netForce()
59  );
60  }
61  else
62  {
63  solve(UEqn == -fvc::grad(p));
64  }
65 
67  K = 0.5*magSqr(U);
68  }
69 }
70 
71 
72 // ************************************************************************* //
Generic GeometricField class.
tmp< volVectorField > DDt(const volVectorField &U) const
Return the Coriolis acceleration.
Definition: MRFZoneList.C:99
bool momentumPredictor() const
Flag to indicate to solve for momentum.
bool constrain(fvMatrix< Type > &eqn) const
Apply constraints to an equation.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Foam::fvModels & fvModels() const
Return the fvModels that are created on demand.
Definition: solver.C:85
pimpleNoLoopControl pimple
PIMPLE inner-loop controls.
Definition: solver.H:100
Foam::fvConstraints & fvConstraints() const
Return the fvConstraints that are created on demand.
Definition: solver.C:96
Buoyancy related data for the Foam::solvers::isothermalFluid solver module when solving buoyant cases...
Definition: buoyancy.H:70
const surfaceScalarField & phi
Mass-flux field.
volVectorField U_
Velocity field.
tmp< fvVectorMatrix > tUEqn
Cached momentum matrix.
tmp< volVectorField > netForce
Momentum equation net force source term.
volScalarField K
Kinetic energy field.
const volVectorField & U
Velocity field.
IOMRFZoneList MRF
MRF zone list.
virtual void momentumPredictor()
Construct and optionally solve the momentum equation.
const volScalarField & rho
Reference to the continuity density field.
const volScalarField & p
Reference to the pressure field.
autoPtr< compressible::momentumTransportModel > momentumTransport
Pointer to the momentum transport model.
fvVectorMatrix & UEqn
Definition: UEqn.H:11
Calculate the gradient of the given field.
Calculate the matrix for the divergence of the given field and flux.
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const VolField< Type > &vf, const word &name)
Definition: fvmDiv.C:48
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
Definition: fvmDdt.C:46
dimensioned< scalar > magSqr(const dimensioned< Type > &)
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.