fvCorrectPhi.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) 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 "fvCorrectPhi.H"
27 #include "CorrectPhi.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
32 (
33  surfaceScalarField& phi,
34  const volVectorField& U,
35  const volScalarField& p,
37  const autoPtr<volScalarField>& divU,
39  nonOrthogonalSolutionControl& pcorrControl
40 )
41 {
42  if (rAU.valid())
43  {
45  (
46  phi,
47  U,
48  p,
49  rAU(),
50  divU,
52  pcorrControl
53  );
54  }
55  else
56  {
58  (
59  phi,
60  U,
61  p,
63  (
64  "rAU",
65  phi.dimensions()/p.dimensions()/dimLength,
66  1
67  ),
68  divU,
70  pcorrControl
71  );
72  }
73 }
74 
75 
77 (
78  surfaceScalarField& phi,
79  const volScalarField& p,
80  const volScalarField& psi,
82  const volScalarField& divRhoU,
83  nonOrthogonalSolutionControl& pcorrControl
84 )
85 {
86  if (rAU.valid())
87  {
89  (
90  phi,
91  p,
92  psi,
93  rAU(),
94  divRhoU,
95  pcorrControl
96  );
97  }
98  else
99  {
100  CorrectPhi
101  (
102  phi,
103  p,
104  psi,
106  (
107  "rAU",
108  phi.dimensions()/p.dimensions()/dimLength,
109  1
110  ),
111  divRhoU,
112  pcorrControl
113  );
114  }
115 }
116 
117 
118 // ************************************************************************* //
Flux correction functions to ensure continuity.
const dimensionSet & dimensions() const
Return dimensions.
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Non-orthogonal solution control class. Provides non-orthogonal-loop control methods.
Provides controls for the pressure reference in closed-volume simulations.
Flux correction functions to ensure continuity.
const volScalarField & psi
volScalarField rAU(1.0/UEqn.A())
U
Definition: pEqn.H:72
void CorrectPhi(surfaceScalarField &phi, const volVectorField &U, const volScalarField &p, const RAUfType &rAU, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pcorrControl)
Definition: CorrectPhi.C:43
void correctPhi(surfaceScalarField &phi, const volVectorField &U, const volScalarField &p, const autoPtr< volScalarField > &rAU, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pcorrControl)
Definition: fvCorrectPhi.C:32
const dimensionSet dimLength
volScalarField & p