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-2022 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 {
40  defineTypeNameAndDebug(linearTsub, 0);
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 * * * * * * * * * * * * * //
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  satModel.Tsat(liquid.thermo().p()) - liquid.thermo().T()
130  );
131 
132  d_ = max
133  (
134  d1_,
135  min
136  (
137  d2_,
138  (d1_*(Tsub - Tsub2_) - d2_*(Tsub - Tsub1_))/(Tsub1_ - Tsub2_)
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 // ************************************************************************* //
virtual bool read(const dictionary &phaseProperties)
Read phaseProperties dictionary.
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:50
twoPhaseSystem & fluid
addToRunTimeSelectionTable(diameterModel, constant, dictionary)
virtual bool read(const dictionary &phaseProperties)=0
Read phaseProperties dictionary.
Definition: diameterModel.C:89
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Helper class to manage multi-specie phase properties.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
defineTypeNameAndDebug(constant, 0)
Lookup type of boundary radiation properties.
Definition: lookup.H:57
Macros for easy insertion into run-time selection tables.
virtual tmp< volScalarField > Tsat(const volScalarField &p) const =0
Saturation temperature.
word timeName
Definition: getTimeIndex.H:3
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:69
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
Abstract base-class for dispersed-phase particle diameter models.
Definition: diameterModel.H:49
virtual void correct()
Correct the diameter field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
virtual tmp< volScalarField > d() const
Return the diameter field.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:50
linearTsub(const dictionary &diameterProperties, const phaseModel &phase)
Construct from components.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
Namespace for OpenFOAM.