1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ReactingMultiphaseLookupTableInjection.H"
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 template<class CloudType>
31 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
32 ReactingMultiphaseLookupTableInjection
34 const dictionary& dict,
38 InjectionModel<CloudType>(dict, owner, typeName),
39 inputFileName_(this->coeffDict().lookup("inputFile")),
40 duration_(readScalar(this->coeffDict().lookup("duration"))),
43 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
50 owner.db().time().constant(),
60 // Set/cache the injector cells
61 injectorCells_.setSize(injectors_.size());
62 injectorTetFaces_.setSize(injectors_.size());
63 injectorTetPts_.setSize(injectors_.size());
67 this->findCellAtPosition
76 // Determine volume of particles to inject
77 this->volumeTotal_ = 0.0;
80 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
82 this->volumeTotal_ *= duration_;
86 template<class CloudType>
87 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
88 ReactingMultiphaseLookupTableInjection
90 const ReactingMultiphaseLookupTableInjection<CloudType>& im
93 InjectionModel<CloudType>(im),
94 inputFileName_(im.inputFileName_),
95 duration_(im.duration_),
96 parcelsPerSecond_(im.parcelsPerSecond_),
97 injectors_(im.injectors_),
98 injectorCells_(im.injectorCells_),
99 injectorTetFaces_(im.injectorTetFaces_),
100 injectorTetPts_(im.injectorTetPts_)
104 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
106 template<class CloudType>
107 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
108 ~ReactingMultiphaseLookupTableInjection()
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 template<class CloudType>
116 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
118 return this->SOI_ + duration_;
122 template<class CloudType>
124 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::parcelsToInject
130 if ((time0 >= 0.0) && (time0 < duration_))
132 return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_);
141 template<class CloudType>
143 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::volumeToInject
150 if ((time0 >= 0.0) && (time0 < duration_))
152 forAll(injectors_, i)
154 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
162 template<class CloudType>
163 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
166 const label nParcels,
174 label injectorI = parcelI*injectorCells_.size()/nParcels;
176 position = injectors_[injectorI].x();
177 cellOwner = injectorCells_[injectorI];
178 tetFaceI = injectorTetFaces_[injectorI];
179 tetPtI = injectorTetPts_[injectorI];
183 template<class CloudType>
184 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setProperties
187 const label nParcels,
189 typename CloudType::parcelType& parcel
192 label injectorI = parcelI*injectorCells_.size()/nParcels;
194 // set particle velocity
195 parcel.U() = injectors_[injectorI].U();
197 // set particle diameter
198 parcel.d() = injectors_[injectorI].d();
200 // set particle density
201 parcel.rho() = injectors_[injectorI].rho();
203 // set particle temperature
204 parcel.T() = injectors_[injectorI].T();
206 // set particle specific heat capacity
207 parcel.Cp() = injectors_[injectorI].Cp();
209 // set particle component mass fractions
210 parcel.Y() = injectors_[injectorI].Y();
212 // set particle gaseous component mass fractions
213 parcel.YGas() = injectors_[injectorI].YGas();
215 // set particle liquid component mass fractions
216 parcel.YLiquid() = injectors_[injectorI].YLiquid();
218 // set particle solid component mass fractions
219 parcel.YSolid() = injectors_[injectorI].YSolid();
223 template<class CloudType>
225 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::fullyDescribed() const
231 template<class CloudType>
232 bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::validInjection
241 // ************************************************************************* //