Loading...
Searching...
No Matches
kinematicThinFilmIBM.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
30#include "volFields.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36namespace regionModels
39{
40
41// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42
45
46// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47
49(
50 const word& modelType,
51 const fvMesh& mesh,
52 const dictionary& dict
53)
54:
57{}
58
59
60// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
61
63{
65
66 // Update the IBM models
67 immersedBoundary_.correct(Uf_);
68}
69
70
72{
74
75 auto& Ustar = immersedBoundary_.Ustar();
76
78
79 for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++)
80 {
82
83 // IBM force
84 areaVectorField f((UEqn(Ustar) - rhs) & Ustar);
85
86 // Ensure force is only applied to IBM faces
88
90
91 faVectorMatrix UsEqn(UEqn(Uf_) == f);
92
93 UsEqn.relax();
94
95 faOptions().constrain(UsEqn);
96
98 {
99 solve(UsEqn == rhs);
100 }
101
102 for (int corr=1; corr<=nCorr_; corr++)
103 {
104 areaScalarField UsA(UsEqn.A());
105
106 Uf_ = UsEqn.H()/UsA;
109
110 phif_ =
112 - fac::interpolate(1.0/(rho_*UsA))
114 + fac::interpolate(pf_/(rho_*UsA))
116
117 for (int nFilm=1; nFilm<=nFilmCorr_; nFilm++)
118 {
119 faScalarMatrix hEqn
120 (
121 fam::ddt(h_)
122 + fam::div(phif_, h_)
123 ==
125 + rhoSp_
126 );
127
128 hEqn.relax();
129 faOptions().constrain(hEqn);
130 hEqn.solve();
132
133 if (nFilm == nFilmCorr_)
134 {
135 phi2s_ = hEqn.flux();
136 }
137 }
138
139 // Bound h_
140 h_ = max(h_, h0_);
141
144 pf_.relax();
145
146 Uf_ -= (1.0/(rho_*UsA))*fac::grad(pf_*h_)
147 - (pf_/(rho_*UsA))*fac::grad(h_);
150 }
151 }
152
153 Info<< "Film h min/max = " << gMinMax(h_) << nl
154 << "Film mag(U) min/max = " << gMinMaxMag(Uf_) << endl;
155}
156
157
158// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160} // End namespace areaSurfaceFilmModels
161} // End namespace regionModels
162} // End namespace Foam
163
164// ************************************************************************* //
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
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
Thin film model with support for immersed boundary method (IBM).
kinematicThinFilmIBM(const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components and dict.
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.
dimensionedScalar h0_
Smallest film thickness.
Foam::fa::options & faOptions() noexcept
Return faOptions.
label nCorr_
Number of PISO-like inner correctors.
areaScalarField pnSp_
Normal pressure by particles.
const areaVectorField & Ustar() const noexcept
Ustar velocity.
void zeroFilter(Type &fld) const
Apply the zero filter to an area field.
const Time & time() const noexcept
Return the reference to the time database.
const faMesh & regionMesh() const
Return the region mesh database.
const fvMesh & primaryMesh() const noexcept
Return the reference to the primary mesh database.
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
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
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
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
labelList f(nPoints)
dictionary dict
CEqn solve()