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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
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 "IATE.H"
29 #include "IATEsource.H"
30 #include "fvmDdt.H"
31 #include "fvmDiv.H"
32 #include "fvmSup.H"
33 #include "fvcDdt.H"
34 #include "fvcDiv.H"
35 #include "fvcAverage.H"
36 #include "fvOptions.H"
37 #include "mathematicalConstants.H"
38 #include "fundamentalConstants.H"
40 
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 namespace diameterModels
46 {
47  defineTypeNameAndDebug(IATE, 0);
48 
50  (
51  diameterModel,
52  IATE,
53  dictionary
54  );
55 }
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 
62 (
63  const dictionary& diameterProperties,
64  const phaseModel& phase
65 )
66 :
67  diameterModel(diameterProperties, phase),
68  kappai_
69  (
70  IOobject
71  (
72  IOobject::groupName("kappai", phase.name()),
73  phase_.time().timeName(),
74  phase_.mesh(),
75  IOobject::MUST_READ,
76  IOobject::AUTO_WRITE
77  ),
78  phase_.mesh()
79  ),
80  dMax_("dMax", dimLength, diameterProperties_),
81  dMin_("dMin", dimLength, diameterProperties_),
82  residualAlpha_("residualAlpha", dimless, diameterProperties_),
83  d_
84  (
85  IOobject
86  (
87  IOobject::groupName("d", phase.name()),
88  phase_.time().timeName(),
89  phase_.mesh(),
90  IOobject::NO_READ,
91  IOobject::AUTO_WRITE
92  ),
93  dsm()
94  ),
95  sources_
96  (
97  diameterProperties_.lookup("sources"),
98  IATEsource::iNew(*this)
99  )
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 
106 {}
107 
108 
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 
111 Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::dsm() const
112 {
113  return max(6/max(kappai_, 6/dMax_), dMin_);
114 }
115 
117 {
118  volScalarField alphaAv
119  (
120  max
121  (
122  0.5*fvc::average(phase_ + phase_.oldTime()),
123  residualAlpha_
124  )
125  );
126 
127  // Initialise the accumulated source term to the dilatation effect
129  (
130  -fvm::SuSp
131  (
132  ((1.0/3.0)/alphaAv)
133  *(
134  fvc::ddt(phase_) + fvc::div(phase_.alphaPhi())
135  - phase_.continuityError()/phase_.rho()
136  ),
137  kappai_
138  )
139  );
140 
141  // Accumulate the run-time selectable sources
142  forAll(sources_, j)
143  {
144  R += sources_[j].R(alphaAv, kappai_);
145  }
146 
147  fv::options& fvOptions(fv::options::New(phase_.mesh()));
148 
149  // Construct the interfacial curvature equation
150  fvScalarMatrix kappaiEqn
151  (
152  fvm::ddt(kappai_) + fvm::div(phase_.phi(), kappai_)
153  - fvm::Sp(fvc::div(phase_.phi()), kappai_)
154  ==
155  R
156  + fvOptions(kappai_)
157  );
158 
159  kappaiEqn.relax();
160 
161  fvOptions.constrain(kappaiEqn);
162 
163  kappaiEqn.solve();
164 
165  // Update the Sauter-mean diameter
166  d_ = dsm();
167 }
168 
169 
171 {
173 
174  diameterProperties_.lookup("dMax") >> dMax_;
175  diameterProperties_.lookup("dMin") >> dMin_;
176 
177  // Re-create all the sources updating number, type and coefficients
179  (
180  diameterProperties_.lookup("sources"),
181  IATEsource::iNew(*this)
182  ).transfer(sources_);
183 
184  return true;
185 }
186 
187 
188 // ************************************************************************* //
Foam::diameterModels::defineTypeNameAndDebug
defineTypeNameAndDebug(constant, 0)
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:57
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
mathematicalConstants.H
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
fvOptions.H
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::phase
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:54
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::fv::options::New
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present.
Definition: fvOptions.C:104
fvcDiv.H
Calculate the divergence of the given field.
Foam::phaseProperties
Helper class to manage multi-specie phase properties.
Definition: phaseProperties.H:62
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:49
Foam::diameterModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(diameterModel, constant, dictionary)
Foam::diameterModel
A2stract base-class for dispersed-phase particle diameter models.
Definition: diameterModel.H:53
Foam::fvc::average
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
Definition: fvcAverage.C:48
fvmDiv.H
Calculate the matrix for the divergence of the given field and flux.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
IATE.H
R
#define R(A, B, C, D, E, F, K, M)
Foam::diameterModels::IATE::correct
virtual void correct()
Correct the diameter field.
Definition: IATE.C:116
Foam::fvm::SuSp
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
fvOptions
fv::options & fvOptions
Definition: setRegionFluidFields.H:23
Foam::fvMatrix::relax
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:574
Foam::diameterModels::IATE::read
virtual bool read(const dictionary &phaseProperties)
Read phaseProperties dictionary.
Definition: IATE.C:170
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:65
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::fv::options
Finite-volume options.
Definition: fvOptions.H:55
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fvmSup.H
Calculate the matrix for implicit and explicit sources.
Foam::phase::name
const word & name() const
Definition: phase.H:111
Foam::fvm::ddt
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:48
fundamentalConstants.H
Fundamental dimensioned constants.
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::diameterModels::IATEsource::iNew
Class used for the read-construction of.
Definition: IATEsource.H:90
Foam::diameterModels::IATE::~IATE
virtual ~IATE()
Destructor.
Definition: IATE.C:105
fvcDdt.H
Calculate the first temporal derivative.
Foam::diameterModel::read
virtual bool read(const dictionary &phaseProperties)=0
Read phaseProperties dictionary.
Definition: diameterModel.C:64
Foam::fvc::ddt
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:47
fvcAverage.H
Area-weighted average a surfaceField creating a volField.
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fvm::div
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:48
fvmDdt.H
Calulate the matrix for the first temporal derivative.
Foam::diameterModels::IATE::IATE
IATE(const dictionary &diameterProperties, const phaseModel &phase)
Construct from components.
Definition: IATE.C:62