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 -------------------------------------------------------------------------------
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 "linearTsubDiameter.H"
29 #include "phaseSystem.H"
30 #include "saturationModel.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace diameterModels
38 {
40 
42  (
43  diameterModel,
44  linearTsub,
45  dictionary
46  );
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 (
55  const dictionary& diameterProperties,
56  const phaseModel& phase
57 )
58 :
59  diameterModel(diameterProperties, phase),
60  liquidPhaseName_(diameterProperties.lookup("liquidPhase")),
61  d2_("d2", dimLength, diameterProperties.lookupOrDefault("d2", 0.0015)),
62  Tsub2_
63  (
64  "Tsub2",
66  diameterProperties.lookupOrDefault("Tsub2", 0)
67  ),
68  d1_
69  (
70  "d1",
71  dimLength,
72  diameterProperties.lookupOrDefault("d1", 0.00015)
73  ),
74  Tsub1_
75  (
76  "Tsub1",
78  diameterProperties.lookupOrDefault("Tsub1", 13.5)
79  ),
80  d_
81  (
82  IOobject
83  (
84  IOobject::groupName("d", phase.name()),
85  phase_.time().timeName(),
86  phase_.mesh(),
87  IOobject::NO_READ,
88  IOobject::AUTO_WRITE
89  ),
90  phase_.mesh(),
91  d1_
92  )
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97 
99 {}
100 
101 
102 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103 
105 {
106  return d_;
107 }
108 
109 
111 {
112  // Lookup the fluid model
113  const phaseSystem& fluid =
114  refCast<const phaseSystem>
115  (
116  phase_.mesh().lookupObject<phaseSystem>("phaseProperties")
117  );
118 
119  const phaseModel& liquid(fluid.phases()[liquidPhaseName_]);
120 
121  if (phase_.mesh().foundObject<saturationModel>("saturationModel"))
122  {
123  const saturationModel& satModel =
124  phase_.mesh().lookupObject<saturationModel>("saturationModel");
125 
126  const volScalarField Tsub
127  (
128  liquid.thermo().T() - satModel.Tsat(liquid.thermo().p())
129  );
130 
131  d_ = max
132  (
133  d1_,
134  min
135  (
136  d2_,
137  (d1_*(Tsub - Tsub2_) + d2_*(Tsub - Tsub1_))/(Tsub2_ - Tsub1_)
138  )
139  );
140  }
141 }
142 
143 
145 {
147  diameterProperties_.lookup("liquidPhase") >> liquidPhaseName_;
148  diameterProperties_.lookup("d2") >> d2_;
149  diameterProperties_.lookup("Tsub2") >> Tsub2_;
150  diameterProperties_.lookup("d1") >> d1_;
151  diameterProperties_.lookup("Tsub1") >> Tsub1_;
152 
153  return true;
154 }
155 
156 
157 // ************************************************************************* //
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
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::diameterModels::linearTsub::linearTsub
linearTsub(const dictionary &diameterProperties, const phaseModel &phase)
Construct from components.
Definition: linearTsubDiameter.C:54
Foam::saturationModel
Definition: saturationModel.H:53
Foam::phaseProperties
Helper class to manage multi-specie phase properties.
Definition: phaseProperties.H:62
Foam::diameterModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(diameterModel, constant, dictionary)
Foam::diameterModel
A2stract base-class for dispersed-phase particle diameter models.
Definition: diameterModel.H:53
Foam::diameterModels::linearTsub::read
virtual bool read(const dictionary &phaseProperties)
Read phaseProperties dictionary.
Definition: linearTsubDiameter.C:144
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
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:104
saturationModel.H
Foam::diameterModels::linearTsub::correct
virtual void correct()
Correct the diameter field.
Definition: linearTsubDiameter.C:110
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:419
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::diameterModels::linearTsub::~linearTsub
virtual ~linearTsub()
Destructor.
Definition: linearTsubDiameter.C:98
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:55
linearTsubDiameter.H
Foam::diameterModel::read
virtual bool read(const dictionary &phaseProperties)=0
Read phaseProperties dictionary.
Definition: diameterModel.C:64
Foam::phaseSystem
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:69
Foam::GeometricField< scalar, fvPatchField, volMesh >
linearTsub
Vapour bubble diameter model for modelling of condensation of vapour bubbles. Calculates bubble diame...