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"
31#include "volFields.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace regionModels
38{
39namespace areaSurfaceFilmModels
40{
41
42// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43
46
47// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48
50(
51 const word& modelType,
52 const fvPatch& patch,
53 const dictionary& dict
54)
55:
56 liquidFilmModel(modelType, patch, dict)
57{}
58
59
60// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61
63{
67
68 // Update mass exchange sources
70
71 // gas pressure map from primary region
72 ppf_ = pg();
73}
74
75
77{
78 if (debug)
79 {
81 }
82
84
85 const areaVectorField gs(g_ - ns*(ns & g_));
86
88
89 for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++)
90 {
92
93 faVectorMatrix UsEqn
94 (
97 ==
98 gs*h_
99 + turbulence_->Su(Uf_)
102 + USp_
103 );
104
105 UsEqn.relax();
106
107 faOptions().constrain(UsEqn);
108
110 {
111 solve(UsEqn == - fac::grad(pf_*h_)/rho_ + pf_*fac::grad(h_)/rho_);
112 }
113
114 for (int corr=1; corr<=nCorr_; corr++)
115 {
116 areaScalarField UsA(UsEqn.A());
117
118 Uf_ = UsEqn.H()/UsA;
121
122 phif_ =
124 - fac::interpolate(1.0/(rho_*UsA))
126 + fac::interpolate(pf_/(rho_*UsA))
128
129 for (int nFilm=1; nFilm<=nFilmCorr_; nFilm++)
130 {
131 faScalarMatrix hEqn
132 (
133 fam::ddt(h_)
134 + fam::div(phif_, h_)
135 ==
137 + rhoSp_
138 );
139
140 hEqn.relax();
141 faOptions().constrain(hEqn);
142 hEqn.solve();
144
145 if (nFilm == nFilmCorr_)
146 {
147 phi2s_ = hEqn.flux();
148 }
149 }
150
151 // Bound h_
152 h_ = max(h_, h0_);
153
156 pf_.relax();
157
158 Uf_ -= (1.0/(rho_*UsA))*fac::grad(pf_*h_)
159 - (pf_/(rho_*UsA))*fac::grad(h_);
162 }
163 }
164
165 Info<< "Film h min/max = " << min(h_).value() << ", "
166 << max(h_).value() << endl;
167
168 Info<< "Film U min/max = " << max(mag(Uf_)).value() << endl;
169}
170
171
173{
174 // Reset sources
176
177 // Correct thermo
179
180 // Correct turbulence
181 turbulence_->correct();
182}
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace areaSurfaceFilmModels
187} // End namespace regionModels
188} // End namespace Foam
189
190// ************************************************************************* //
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:126
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatrix.H:76
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: faMatrix.C:491
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
Definition: faMatrixSolve.C:55
tmp< GeometricField< Type, faePatchField, edgeMesh > > flux() const
Return the face-flux field from the matrix.
Definition: faMatrix.C:677
tmp< GeometricField< Type, faPatchField, areaMesh > > H() const
Return the H operation source.
Definition: faMatrix.C:633
tmp< areaScalarField > A() const
Return the central coefficient.
Definition: faMatrix.C:606
const edgeScalarField & magLe() const
Return edge length magnitudes.
Definition: faMesh.C:746
const edgeVectorField & Le() const
Return edge length vectors.
Definition: faMesh.C:735
const areaVectorField & faceAreaNormals() const
Return face area normals.
Definition: faMesh.C:830
void correct(GeometricField< Type, faPatchField, areaMesh > &field)
Apply correction to field.
void constrain(faMatrix< Type > &eqn)
Apply constraints to equation.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
tmp< faVectorMatrix > correct(areaVectorField &U)
Return (net) force system.
Definition: forceList.C:82
areaScalarField ppf_
Primary region pressure.
label nFilmCorr_
Number of film thickness correctors.
Foam::fa::options & faOptions()
Return faOptions.
tmp< areaScalarField > pg() const
Map primary static pressure.
dimensionedScalar h0_
Smallest numerical thickness.
forceList forces_
Transfer with the continuous phase.
areaScalarField pnSp_
Normal pressure by particles.
autoPtr< filmTurbulenceModel > turbulence_
Turbulence model.
const faMesh & regionMesh() const
Return the region mesh database.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
#define InfoInFunction
Report an information message using Foam::Info.
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLaplacian.C:47
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:47
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
tmp< faMatrix< Type > > div(const edgeScalarField &flux, const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: famDiv.C:48
tmp< faMatrix< Type > > ddt(const GeometricField< Type, faPatchField, areaMesh > &vf)
Definition: famDdt.C:48
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:47
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
dictionary dict
CEqn solve()