Loading...
Searching...
No Matches
kinematicThinFilm.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "kinematicThinFilm.H"
30#include "volFields.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace regionModels
39{
40
41// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
45
46
47// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
48
50(
52)
53{
55 const areaVectorField gs(g_ - ns*(ns & g_));
56
58 (
59 fam::ddt(h_, U)
60 + fam::div(phi2s_, U)
61 ==
62 gs*h_
63 + turbulence_->Su(U)
65 + forces_.correct(U)
67 );
68}
69
70
71// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72
74(
75 const word& modelType,
76 const fvMesh& mesh,
77 const dictionary& dict
78)
80 liquidFilmModel(modelType, mesh, dict)
81{}
82
83
84// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
85
87{
91
92 // Update mass exchange sources
94
95 // gas pressure map from primary region
96 ppf_ = pg();
97}
98
99
101{
103
105
106 for (int oCorr=1; oCorr<=nOuterCorr_; ++oCorr)
107 {
109
110 faVectorMatrix UsEqn(UEqn(Uf_));
111
112 UsEqn.relax();
113
114 faOptions().constrain(UsEqn);
115
117 {
118 solve(UsEqn == -fac::grad(pf_*h_)/rho_ + pf_*fac::grad(h_)/rho_);
119 }
120
121 for (int corr=1; corr<=nCorr_; ++corr)
122 {
123 areaScalarField UsA(UsEqn.A());
124
125 Uf_ = UsEqn.H()/UsA;
128
129 phif_ =
131 - fac::interpolate(1.0/(rho_*UsA))
133 + fac::interpolate(pf_/(rho_*UsA))
135
136 for (int nFilm=1; nFilm<=nFilmCorr_; ++nFilm)
137 {
138 faScalarMatrix hEqn
139 (
140 fam::ddt(h_)
141 + fam::div(phif_, h_)
142 ==
144 + rhoSp_
145 );
146
147 hEqn.relax();
148 faOptions().constrain(hEqn);
149 hEqn.solve();
151
152 if (nFilm == nFilmCorr_)
153 {
154 phi2s_ = hEqn.flux();
155 }
156 }
157
158 // Bound h_
159 h_ = max(h_, h0_);
160
163 pf_.relax();
164
165 Uf_ -= (1.0/(rho_*UsA))*fac::grad(pf_*h_)
166 - (pf_/(rho_*UsA))*fac::grad(h_);
169 }
171
172 Info<< "Film h min/max = " << gMinMax(h_) << nl
173 << "Film mag(U) min/max = " << gMinMaxMag(Uf_) << endl;
174}
175
176
178{
179 // Reset sources
181
182 // Correct thermo
184
185 // Correct turbulence
186 turbulence_->correct();
187}
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace areaSurfaceFilmModels
192} // End namespace regionModels
193} // End namespace Foam
194
195// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void relax(const scalar alpha)
Relax field (for steady-state solution).
void storePrevIter() const
Store the field as the previous iteration value.
void correctBoundaryConditions()
Correct boundary field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition faMatrix.C:484
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux() const
Return the face-flux field from the matrix.
Definition faMatrix.C:655
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
Definition faMatrix.C:619
tmp< areaScalarField > A() const
Return the central coefficient.
Definition faMatrix.C:600
const edgeScalarField & magLe() const
Return edge length magnitudes.
Definition faMesh.C:1105
const edgeVectorField & Le() const
Return edge length vectors.
Definition faMesh.C:1094
const areaVectorField & faceAreaNormals() const
Return face area normals.
Definition faMesh.C:1189
void correct(GeometricField< Type, faPatchField, areaMesh > &field)
Apply correction to field.
void constrain(faMatrix< Type > &eqn)
Apply constraints to equation.
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
tmp< faVectorMatrix > UEqn(areaVectorField &U)
Construct a momentum equation.
kinematicThinFilm(const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components and dict.
label nFilmCorr_
Number of film thickness correctors.
Switch momentumPredictor_
Flag to enable momentum predictor.
tmp< areaScalarField > pg() const
Map primary static pressure.
dimensionedScalar h0_
Smallest film thickness.
Foam::fa::options & faOptions() noexcept
Return faOptions.
label nCorr_
Number of PISO-like inner correctors.
liquidFilmModel(const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components and dict.
areaScalarField pnSp_
Normal pressure by particles.
autoPtr< filmTurbulenceModel > turbulence_
Turbulence model.
const faMesh & regionMesh() const
Return the region mesh database.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
fvVectorMatrix & UEqn
Definition UEqn.H:13
dynamicFvMesh & mesh
#define DebugInFunction
Report an information message using Foam::Info.
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &tvf, const edgeScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< GeometricField< Type, faePatchField, edgeMesh > > lnGrad(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition facLnGrad.C:40
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition facGrad.C:51
tmp< faMatrix< Type > > div(const edgeScalarField &flux, const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition famDiv.C:41
tmp< faMatrix< Type > > ddt(const GeometricField< Type, faPatchField, areaMesh > &vf)
Definition famDdt.C:41
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimVelocity
faMatrix< scalar > faScalarMatrix
Definition faMatrices.H:46
messageStream Info
Information stream (stdout output on master, null elsewhere).
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
GeometricField< vector, faPatchField, areaMesh > areaVectorField
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
faMatrix< vector > faVectorMatrix
Definition faMatrices.H:47
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
CEqn solve()