drippingInjection.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) 2011-2017 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 "drippingInjection.H"
30 #include "fvMesh.H"
31 #include "Time.H"
32 #include "mathematicalConstants.H"
33 #include "Random.H"
34 #include "volFields.H"
35 #include "kinematicSingleLayer.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 namespace regionModels
42 {
43 namespace surfaceFilmModels
44 {
45 
46 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
47 
48 defineTypeNameAndDebug(drippingInjection, 0);
49 addToRunTimeSelectionTable(injectionModel, drippingInjection, dictionary);
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 drippingInjection::drippingInjection
54 (
56  const dictionary& dict
57 )
58 :
59  injectionModel(type(), film, dict),
60  deltaStable_(coeffDict_.get<scalar>("deltaStable")),
61  particlesPerParcel_(coeffDict_.get<scalar>("particlesPerParcel")),
62  rndGen_(),
63  parcelDistribution_
64  (
66  (
67  coeffDict_.subDict("parcelDistribution"),
68  rndGen_
69  )
70  ),
71  diameter_(film.regionMesh().nCells(), -1.0)
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
76 
78 {}
79 
80 
81 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
82 
84 (
85  scalarField& availableMass,
86  scalarField& massToInject,
87  scalarField& diameterToInject
88 )
89 {
90  const kinematicSingleLayer& film =
91  refCast<const kinematicSingleLayer>(this->film());
92 
93  const scalar pi = constant::mathematical::pi;
94 
95  // calculate available dripping mass
96  tmp<volScalarField> tgNorm(film.gNorm());
97  const scalarField& gNorm = tgNorm();
98  const scalarField& magSf = film.magSf();
99 
100  const scalarField& delta = film.delta();
101  const scalarField& rho = film.rho();
102 
103  scalarField massDrip(film.regionMesh().nCells(), Zero);
104 
105  forAll(gNorm, i)
106  {
107  if (gNorm[i] > SMALL)
108  {
109  const scalar ddelta = max(0.0, delta[i] - deltaStable_);
110  massDrip[i] +=
111  min(availableMass[i], max(0.0, ddelta*rho[i]*magSf[i]));
112  }
113  }
114 
115 
116  // Collect the data to be transferred
117  forAll(massDrip, celli)
118  {
119  if (massDrip[celli] > 0)
120  {
121  // set new particle diameter if not already set
122  if (diameter_[celli] < 0)
123  {
124  diameter_[celli] = parcelDistribution_->sample();
125  }
126 
127  scalar& diam = diameter_[celli];
128  scalar rhoc = rho[celli];
129  scalar minMass = particlesPerParcel_*rhoc*pi/6*pow3(diam);
130 
131  if (massDrip[celli] > minMass)
132  {
133  // All drip mass can be injected
134  massToInject[celli] += massDrip[celli];
135  availableMass[celli] -= massDrip[celli];
136 
137  // Set particle diameter
138  diameterToInject[celli] = diam;
139 
140  // Retrieve new particle diameter sample
141  diam = parcelDistribution_->sample();
142 
143  addToInjectedMass(massDrip[celli]);
144  }
145  else
146  {
147  // Particle mass below minimum threshold - cannot be injected
148  massToInject[celli] = 0.0;
149  diameterToInject[celli] = 0.0;
150  }
151  }
152  else
153  {
154  massToInject[celli] = 0.0;
155  diameterToInject[celli] = 0.0;
156  }
157  }
158 
160 }
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace surfaceFilmModels
166 } // End namespace regionModels
167 } // End namespace Foam
168 
169 // ************************************************************************* //
volFields.H
mathematicalConstants.H
Foam::regionModels::surfaceFilmModels::injectionModel::correct
void correct()
Correct.
Definition: injectionModel.C:81
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer
Kinematic form of single-cell layer surface film model.
Definition: kinematicSingleLayer.H:67
Foam::regionModels::surfaceFilmModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(surfaceFilmRegionModel, kinematicSingleLayer, mesh)
rho
rho
Definition: readInitialConditions.H:88
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
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::primitiveMesh::nCells
label nCells() const noexcept
Number of mesh cells.
Definition: primitiveMeshI.H:96
Foam::Field< scalar >
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::gNorm
tmp< volScalarField > gNorm() const
Return the gravity normal-to-patch component contribution.
Definition: kinematicSingleLayerI.H:212
Foam::regionModels::surfaceFilmModels::surfaceFilmRegionModel
Base class for surface film models.
Definition: surfaceFilmRegionModel.H:55
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::regionModels::singleLayerRegion::magSf
virtual const volScalarField & magSf() const
Return the face area magnitudes / [m2].
Definition: singleLayerRegion.C:223
Foam::regionModels::regionModel::regionMesh
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:64
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::regionModels::surfaceFilmModels::injectionModel
Base class for film injection models, handling mass transfer from the film.
Definition: injectionModel.H:58
kinematicSingleLayer.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Random.H
drippingInjection.H
Foam::distributionModel::New
static autoPtr< distributionModel > New(const dictionary &dict, Random &rndGen)
Selector.
Definition: distributionModelNew.C:34
Time.H
Foam::regionModels::surfaceFilmModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::regionModels::surfaceFilmModels::drippingInjection::~drippingInjection
virtual ~drippingInjection()
Destructor.
Definition: drippingInjection.C:77
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::delta
const volScalarField & delta() const
Return const access to the film thickness [m].
Definition: kinematicSingleLayerI.H:86
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::rho
virtual const volScalarField & rho() const
Return the film density [kg/m3].
Definition: kinematicSingleLayer.C:982