liquidFilmFoam.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) 2016-2017 Wikki 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
26Application
27 liquidFilmFoam
28
29Group
30 grpFiniteAreaSolvers
31
32Description
33 Transient solver for incompressible, laminar flow of Newtonian fluids in
34 liquid film formulation.
35
36Author
37 Zeljko Tukovic, FMENA
38 Hrvoje Jasak, Wikki Ltd.
39
40\*---------------------------------------------------------------------------*/
41
42#include "fvCFD.H"
43#include "faCFD.H"
44#include "loopControl.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48int main(int argc, char *argv[])
49{
50 argList::addNote
51 (
52 "Transient solver for incompressible, laminar flow"
53 " of Newtonian fluids in liquid film formulation."
54 );
55
56 #include "setRootCaseLists.H"
57 #include "createTime.H"
58 #include "createMesh.H"
59 #include "createFaMesh.H"
60 #include "readGravitationalAcceleration.H"
61 #include "readTransportProperties.H"
62 #include "createFaFields.H"
63 #include "createFvFields.H"
64 #include "createTimeControls.H"
65
66 Info<< "\nStarting time loop\n" << endl;
67
68 while (runTime.run())
69 {
70 #include "readSolutionControls.H"
71 #include "readTimeControls.H"
72 #include "surfaceCourantNo.H"
73 #include "capillaryCourantNo.H"
74 #include "setDeltaT.H"
75
76 ++runTime;
77
78 Info<< "Time = " << runTime.timeName() << nl << endl;
79
80 while (iters.loop())
81 {
82 phi2s = fac::interpolate(h)*phis;
83
84 #include "calcFrictionFactor.H"
85
86 faVectorMatrix UsEqn
87 (
88 fam::ddt(h, Us)
89 + fam::div(phi2s, Us)
90 + fam::Sp(0.0125*frictionFactor*mag(Us), Us)
91 ==
92 Gs*h
93 - fam::Sp(Sd, Us)
94 );
95
96 UsEqn.relax();
97 solve(UsEqn == - fac::grad(ps*h)/rhol + ps*fac::grad(h)/rhol);
98
99 areaScalarField UsA(UsEqn.A());
100
101 Us = UsEqn.H()/UsA;
102 Us.correctBoundaryConditions();
103
104 phis =
105 (fac::interpolate(Us) & aMesh.Le())
106 - fac::interpolate(1.0/(rhol*UsA))*fac::lnGrad(ps*h)*aMesh.magLe()
107 + fac::interpolate(ps/(rhol*UsA))*fac::lnGrad(h)*aMesh.magLe();
108
109 faScalarMatrix hEqn
110 (
111 fam::ddt(h)
112 + fam::div(phis, h)
113 ==
114 Sm
115 - fam::Sp
116 (
117 Sd/(h + dimensionedScalar("small", dimLength, SMALL)),
118 h
119 )
120 );
121
122 hEqn.relax();
123 hEqn.solve();
124
125 phi2s = hEqn.flux();
126
127 // Bound h
128 h.primitiveFieldRef() = max
129 (
130 max
131 (
132 h.primitiveField(),
133 fac::average(max(h, h0))().primitiveField()
134 *pos(h0.value() - h.primitiveField())
135 ),
136 h0.value()
137 );
138
139 ps = rhol*Gn*h - sigma*fac::laplacian(h);
140 ps.correctBoundaryConditions();
141
142 Us -= (1.0/(rhol*UsA))*fac::grad(ps*h)
143 - (ps/(rhol*UsA))*fac::grad(h);
144 Us.correctBoundaryConditions();
145 }
146
147 if (runTime.writeTime())
148 {
149 vsm.mapToVolume(h, H.boundaryFieldRef());
150 vsm.mapToVolume(Us, U.boundaryFieldRef());
151
152 runTime.write();
153 }
154
155 runTime.printExecutionTime(Info);
156 }
157
158 Info<< "End\n" << endl;
159
160 return 0;
161}
162
163
164// ************************************************************************* //
Y[inertIndex] max(0.0)
Template specialisation for scalar faMatrix.
U
Definition: pEqn.H:72
engineTime & runTime
volSurfaceMapping vsm(aMesh)
volScalarField H(IOobject("H", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimLength, Zero))
Required Variables.
Read the control parameters used by setDeltaT.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pos(const dimensionedScalar &ds)
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)
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
Definition: areaFieldsFwd.H:78
faMatrix< vector > faVectorMatrix
Definition: faMatrices.H:53
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
scalar h0
loopControl iters(runTime, aMesh.solutionDict(), "solution")
Read the control parameters used by setDeltaT.
volScalarField & h
CEqn solve()
dimensionedScalar rhol("rhol", dimDensity, transportProperties)
edgeScalarField phis(IOobject("phis", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), linearEdgeInterpolate(Us) &aMesh.Le())
Us
faMesh aMesh(mesh)
Calculates and outputs the mean and maximum Courant Numbers for the Finite Area method.