1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
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 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
30 template<class CloudType>
32 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::parcelsToInject
38 if ((time0 >= 0.0) && (time0 < duration_))
40 return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
49 template<class CloudType>
51 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::volumeToInject
58 if ((time0 >= 0.0) && (time0 < duration_))
62 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 template<class CloudType>
73 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
74 ReactingMultiphaseLookupTableInjection
76 const dictionary& dict,
80 InjectionModel<CloudType>(dict, owner, typeName),
81 inputFileName_(this->coeffDict().lookup("inputFile")),
82 duration_(readScalar(this->coeffDict().lookup("duration"))),
85 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
92 owner.db().time().constant(),
100 // Set/cache the injector cells
101 injectorCells_.setSize(injectors_.size());
102 forAll(injectors_, i)
104 this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
107 // Determine volume of particles to inject
108 this->volumeTotal_ = 0.0;
109 forAll(injectors_, i)
111 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
113 this->volumeTotal_ *= duration_;
117 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
119 template<class CloudType>
120 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
121 ~ReactingMultiphaseLookupTableInjection()
125 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
127 template<class CloudType>
128 bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
134 template<class CloudType>
136 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
138 return this->SOI_ + duration_;
142 template<class CloudType>
143 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
146 const label nParcels,
152 label injectorI = parcelI*injectorCells_.size()/nParcels;
154 position = injectors_[injectorI].x();
155 cellOwner = injectorCells_[injectorI];
159 template<class CloudType>
160 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setProperties
163 const label nParcels,
165 typename CloudType::parcelType& parcel
168 label injectorI = parcelI*injectorCells_.size()/nParcels;
170 // set particle velocity
171 parcel.U() = injectors_[injectorI].U();
173 // set particle diameter
174 parcel.d() = injectors_[injectorI].d();
176 // set particle density
177 parcel.rho() = injectors_[injectorI].rho();
179 // set particle temperature
180 parcel.T() = injectors_[injectorI].T();
182 // set particle specific heat capacity
183 parcel.cp() = injectors_[injectorI].cp();
185 // set particle component mass fractions
186 parcel.Y() = injectors_[injectorI].Y();
188 // set particle gaseous component mass fractions
189 parcel.YGas() = injectors_[injectorI].YGas();
191 // set particle liquid component mass fractions
192 parcel.YLiquid() = injectors_[injectorI].YLiquid();
194 // set particle solid component mass fractions
195 parcel.YSolid() = injectors_[injectorI].YSolid();
199 template<class CloudType>
201 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::fullyDescribed() const
207 template<class CloudType>
208 bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::validInjection
217 // ************************ vim: set sw=4 sts=4 et: ************************ //