1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "ReactingMultiphaseLookupTableInjection.H"
29 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
31 template<class CloudType>
33 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::parcelsToInject
39 if ((time0 >= 0.0) && (time0 < duration_))
41 return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
50 template<class CloudType>
52 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::volumeToInject
59 if ((time0 >= 0.0) && (time0 < duration_))
63 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 template<class CloudType>
74 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
75 ReactingMultiphaseLookupTableInjection
77 const dictionary& dict,
81 InjectionModel<CloudType>(dict, owner, typeName),
82 inputFileName_(this->coeffDict().lookup("inputFile")),
83 duration_(readScalar(this->coeffDict().lookup("duration"))),
86 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
93 owner.db().time().constant(),
101 // Set/cache the injector cells
102 injectorCells_.setSize(injectors_.size());
103 forAll(injectors_, i)
105 this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
108 // Determine volume of particles to inject
109 this->volumeTotal_ = 0.0;
110 forAll(injectors_, i)
112 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
114 this->volumeTotal_ *= duration_;
118 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
120 template<class CloudType>
121 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
122 ~ReactingMultiphaseLookupTableInjection()
126 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
128 template<class CloudType>
129 bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
135 template<class CloudType>
137 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
139 return this->SOI_ + duration_;
143 template<class CloudType>
144 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
147 const label nParcels,
153 label injectorI = parcelI*injectorCells_.size()/nParcels;
155 position = injectors_[injectorI].x();
156 cellOwner = injectorCells_[injectorI];
160 template<class CloudType>
161 void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setProperties
164 const label nParcels,
166 typename CloudType::parcelType& parcel
169 label injectorI = parcelI*injectorCells_.size()/nParcels;
171 // set particle velocity
172 parcel.U() = injectors_[injectorI].U();
174 // set particle diameter
175 parcel.d() = injectors_[injectorI].d();
177 // set particle density
178 parcel.rho() = injectors_[injectorI].rho();
180 // set particle temperature
181 parcel.T() = injectors_[injectorI].T();
183 // set particle specific heat capacity
184 parcel.cp() = injectors_[injectorI].cp();
186 // set particle component mass fractions
187 parcel.Y() = injectors_[injectorI].Y();
189 // set particle gaseous component mass fractions
190 parcel.YGas() = injectors_[injectorI].YGas();
192 // set particle liquid component mass fractions
193 parcel.YLiquid() = injectors_[injectorI].YLiquid();
195 // set particle solid component mass fractions
196 parcel.YSolid() = injectors_[injectorI].YSolid();
200 template<class CloudType>
202 Foam::ReactingMultiphaseLookupTableInjection<CloudType>::fullyDescribed() const
208 template<class CloudType>
209 bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::validInjection
218 // ************************************************************************* //