constantNucleation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018 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 "constantNucleation.H"
27 #include "phaseSystem.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace diameterModels
35 {
36 namespace nucleationModels
37 {
38  defineTypeNameAndDebug(constantNucleation, 0);
40  (
41  nucleationModel,
42  constantNucleation,
43  dictionary
44  );
45 }
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
54 (
55  const populationBalanceModel& popBal,
56  const dictionary& dict
57 )
58 :
59  nucleationModel(popBal, dict),
60  d_("departureDiameter", dimLength, dict),
61  velGroup_
62  (
63  refCast<const velocityGroup>
64  (
65  popBal.mesh().lookupObject<phaseModel>
66  (
67  IOobject::groupName
68  (
69  "alpha",
70  dict.lookup("velocityGroup")
71  )
72  ).dPtr()()
73  )
74  )
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
81 {
82  if
83  (
84  d_.value() < velGroup_.sizeGroups().first().d().value()
85  || d_.value() > velGroup_.sizeGroups().last().d().value()
86  )
87  {
89  << "Departure diameter " << d_.value() << " m outside of range ["
90  << velGroup_.sizeGroups().first().d().value() << ", "
91  << velGroup_.sizeGroups().last().d().value() << "] m" << endl
92  << " The nucleation rate is set to zero." << endl
93  << " Adjust discretization over property space to suppress this"
94  << " warning."
95  << endl;
96  }
97 }
98 
99 
100 void
102 (
103  volScalarField& nucleationRate,
104  const label i
105 )
106 {
107  const sizeGroup& fi = popBal_.sizeGroups()[i];
108  phaseModel& phase = const_cast<phaseModel&>(fi.phase());
109  volScalarField& rho = phase.thermoRef().rho();
110 
111  nucleationRate +=
112  popBal_.gamma(i, velGroup_.formFactor()*pow3(d_))
113  *(popBal_.fluid().fvOptions()(phase, rho)&rho)/rho/fi.x();
114 }
115 
116 
117 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
Macros for easy insertion into run-time selection tables.
virtual void addToNucleationRate(volScalarField &nucleationRate, const label i)
Add to nucleationRate.
virtual void correct()
Correct diameter independent expressions.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
const phaseModel & phase() const
Definition: IATEsource.H:138
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
constantNucleation(const populationBalanceModel &popBal, const dictionary &dict)
Namespace for OpenFOAM.