IATE.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 | Copyright (C) 2013-2016 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 "IATE.H"
27 #include "IATEsource.H"
28 #include "fvmDdt.H"
29 #include "fvmDiv.H"
30 #include "fvmSup.H"
31 #include "fvcDdt.H"
32 #include "fvcDiv.H"
33 #include "fvcAverage.H"
34 #include "fvOptions.H"
35 #include "mathematicalConstants.H"
36 #include "fundamentalConstants.H"
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace diameterModels
44 {
45  defineTypeNameAndDebug(IATE, 0);
46 
48  (
49  diameterModel,
50  IATE,
51  dictionary
52  );
53 }
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
60 (
61  const dictionary& diameterProperties,
62  const phaseModel& phase
63 )
64 :
65  diameterModel(diameterProperties, phase),
66  kappai_
67  (
68  IOobject
69  (
70  IOobject::groupName("kappai", phase.name()),
71  phase_.time().timeName(),
72  phase_.mesh(),
73  IOobject::MUST_READ,
74  IOobject::AUTO_WRITE
75  ),
76  phase_.mesh()
77  ),
78  dMax_("dMax", dimLength, diameterProperties_),
79  dMin_("dMin", dimLength, diameterProperties_),
80  residualAlpha_
81  (
82  "residualAlpha",
83  dimless,
84  diameterProperties_
85  ),
86  d_
87  (
88  IOobject
89  (
90  IOobject::groupName("d", phase.name()),
91  phase_.time().timeName(),
92  phase_.mesh(),
93  IOobject::NO_READ,
94  IOobject::AUTO_WRITE
95  ),
96  dsm()
97  ),
98  sources_
99  (
100  diameterProperties_.lookup("sources"),
101  IATEsource::iNew(*this)
102  )
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
107 
109 {}
110 
111 
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113 
114 Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::dsm() const
115 {
116  return max(6/max(kappai_, 6/dMax_), dMin_);
117 }
118 
120 {
121  volScalarField alphaAv
122  (
123  max
124  (
125  fvc::average(phase_ + phase_.oldTime()),
126  residualAlpha_
127  )
128  );
129 
130  // Initialise the accumulated source term to the dilatation effect
132  (
133  -fvm::SuSp
134  (
135  ((1.0/3.0)/alphaAv)
136  *(
137  fvc::ddt(phase_) + fvc::div(phase_.alphaPhi())
138  - phase_.continuityError()/phase_.rho()
139  ),
140  kappai_
141  )
142  );
143 
144  // Accumulate the run-time selectable sources
145  forAll(sources_, j)
146  {
147  R += sources_[j].R(alphaAv, kappai_);
148  }
149 
150  fv::options& fvOptions(fv::options::New(phase_.mesh()));
151 
152  // Construct the interfacial curvature equation
153  fvScalarMatrix kappaiEqn
154  (
155  fvm::ddt(kappai_) + fvm::div(phase_.phi(), kappai_)
156  - fvm::Sp(fvc::div(phase_.phi()), kappai_)
157  ==
158  R
159  + fvOptions(kappai_)
160  );
161 
162  kappaiEqn.relax();
163 
164  fvOptions.constrain(kappaiEqn);
165 
166  kappaiEqn.solve();
167 
168  // Update the Sauter-mean diameter
169  d_ = dsm();
170 }
171 
172 
173 bool Foam::diameterModels::IATE::read(const dictionary& phaseProperties)
174 {
175  diameterModel::read(phaseProperties);
176 
177  diameterProperties_.lookup("dMax") >> dMax_;
178  diameterProperties_.lookup("dMin") >> dMin_;
179 
180  // Re-create all the sources updating number, type and coefficients
181  PtrList<IATEsource>
182  (
183  diameterProperties_.lookup("sources"),
184  IATEsource::iNew(*this)
185  ).transfer(sources_);
186 
187  return true;
188 }
189 
190 
191 // ************************************************************************* //
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
virtual tmp< volScalarField > continuityError() const =0
Constant access the continuity error.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
virtual bool read(const dictionary &phaseProperties)=0
Read phaseProperties dictionary.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
const surfaceScalarField & phi() const
Definition: phaseModel.H:190
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
Definition: dictionary.C:1144
Fundamental dimensioned constants.
Macros for easy insertion into run-time selection tables.
fv::options & fvOptions
Area-weighted average a surfaceField creating a volField.
const surfaceScalarField & alphaPhi() const
Definition: phaseModel.H:200
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:238
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Calculate the first temporal derivative.
virtual bool read(const dictionary &phaseProperties)
Read phaseProperties dictionary.
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
virtual ~IATE()
Destructor.
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:46
Calulate the matrix for the first temporal derivative.
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
IATE(const dictionary &diameterProperties, const phaseModel &phase)
Construct from components.
word timeName
Definition: getTimeIndex.H:3
Calculate the divergence of the given field.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:46
const Mesh & mesh() const
Return mesh.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Calculate the matrix for the divergence of the given field and flux.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionedScalar & rho() const
Definition: phaseModel.H:165
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
Definition: fvcAverage.C:46
virtual void correct()
Correct the diameter field.
A class for managing temporary objects.
Definition: PtrList.H:53
static options & New(const fvMesh &mesh)
Construct fvOptions and register to datbase if not present.
Definition: fvOptions.C:103
Calculate the matrix for implicit and explicit sources.
Namespace for OpenFOAM.