linearTsubDiameter.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) 2018-2019 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "linearTsubDiameter.H"
30 #include "phaseSystem.H"
31 #include "saturationModel.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace diameterModels
39 {
41 
43  (
44  diameterModel,
45  linearTsub,
46  dictionary
47  );
48 }
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
55 (
56  const dictionary& diameterProperties,
57  const phaseModel& phase
58 )
59 :
60  diameterModel(diameterProperties, phase),
61  liquidPhaseName_(diameterProperties.lookup("liquidPhase")),
62  d2_("d2", dimLength, diameterProperties.getOrDefault("d2", 0.0015)),
63  Tsub2_
64  (
65  "Tsub2",
67  diameterProperties.getOrDefault("Tsub2", 0)
68  ),
69  d1_
70  (
71  "d1",
72  dimLength,
73  diameterProperties.getOrDefault("d1", 0.00015)
74  ),
75  Tsub1_
76  (
77  "Tsub1",
79  diameterProperties.getOrDefault("Tsub1", 13.5)
80  ),
81  d_
82  (
83  IOobject
84  (
85  IOobject::groupName("d", phase.name()),
86  phase_.time().timeName(),
87  phase_.mesh(),
88  IOobject::NO_READ,
89  IOobject::AUTO_WRITE
90  ),
91  phase_.mesh(),
92  d1_
93  )
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
98 
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
106 {
107  return d_;
108 }
109 
110 
112 {
113  // Lookup the fluid model
114  const phaseSystem& fluid =
115  refCast<const phaseSystem>
116  (
117  phase_.mesh().lookupObject<phaseSystem>("phaseProperties")
118  );
119 
120  const phaseModel& liquid(fluid.phases()[liquidPhaseName_]);
121 
122  if (phase_.mesh().foundObject<saturationModel>("saturationModel"))
123  {
124  const saturationModel& satModel =
125  phase_.mesh().lookupObject<saturationModel>("saturationModel");
126 
127  const volScalarField Tsub
128  (
129  liquid.thermo().T() - satModel.Tsat(liquid.thermo().p())
130  );
131 
132  d_ = max
133  (
134  d1_,
135  min
136  (
137  d2_,
138  (d1_*(Tsub - Tsub2_) + d2_*(Tsub - Tsub1_))/(Tsub2_ - Tsub1_)
139  )
140  );
141  }
142 }
143 
144 
146 {
148  diameterProperties_.readEntry("liquidPhase", liquidPhaseName_);
149  diameterProperties_.readEntry("d2", d2_);
150  diameterProperties_.readEntry("Tsub2", Tsub2_);
151  diameterProperties_.readEntry("d1", d1_);
152  diameterProperties_.readEntry("Tsub1", Tsub1_);
153 
154  return true;
155 }
156 
157 
158 // ************************************************************************* //
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
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:61
Foam::diameterModels::linearTsub::linearTsub
linearTsub(const dictionary &diameterProperties, const phaseModel &phase)
Construct from components.
Definition: linearTsubDiameter.C:55
Foam::saturationModel
Definition: saturationModel.H:53
Foam::phaseProperties
Helper class to manage multi-specie phase properties.
Definition: phaseProperties.H:60
Foam::diameterModel
Abstract base-class for dispersed-phase particle diameter models.
Definition: diameterModel.H:53
Foam::liquid
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:54
Foam::diameterModels::linearTsub::read
virtual bool read(const dictionary &phaseProperties)
Read phaseProperties dictionary.
Definition: linearTsubDiameter.C:145
fluid
twoPhaseSystem & fluid
Definition: setRegionFluidFields.H:3
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::diameterModels::linearTsub::d
virtual tmp< volScalarField > d() const
Return the diameter field.
Definition: linearTsubDiameter.C:105
saturationModel.H
Foam::diameterModels::defineTypeNameAndDebug
defineTypeNameAndDebug(constant, 0)
Foam::diameterModels::linearTsub::correct
virtual void correct()
Correct the diameter field.
Definition: linearTsubDiameter.C:111
Foam::saturationModel::Tsat
virtual tmp< volScalarField > Tsat(const volScalarField &p) const =0
Saturation temperature.
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::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:386
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::diameterModels::linearTsub::~linearTsub
virtual ~linearTsub()
Destructor.
Definition: linearTsubDiameter.C:99
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phase::name
const word & name() const
Definition: phase.H:111
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
linearTsubDiameter.H
Foam::diameterModel::read
virtual bool read(const dictionary &phaseProperties)=0
Read phaseProperties dictionary.
Definition: diameterModel.C:96
Foam::phaseSystem
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:66
Foam::diameterModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(diameterModel, constant, dictionary)
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
Foam::GeometricField< scalar, fvPatchField, volMesh >
linearTsub
Vapour bubble diameter model for modelling of condensation of vapour bubbles. Calculates bubble diame...