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 "ReactingLookupTableInjection.H"
29 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::label Foam::ReactingLookupTableInjection<CloudType>::parcelsToInject
38 if ((time0 >= 0.0) && (time0 < duration_))
40 return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
49 template<class CloudType>
50 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::volumeToInject
57 if ((time0 >= 0.0) && (time0 < duration_))
61 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 template<class CloudType>
72 Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
74 const dictionary& dict,
78 InjectionModel<CloudType>(dict, owner, typeName),
79 inputFileName_(this->coeffDict().lookup("inputFile")),
80 duration_(readScalar(this->coeffDict().lookup("duration"))),
83 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
90 owner.db().time().constant(),
98 // Set/cache the injector cells
99 injectorCells_.setSize(injectors_.size());
100 forAll(injectors_, i)
102 this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
105 // Determine volume of particles to inject
106 this->volumeTotal_ = 0.0;
107 forAll(injectors_, i)
109 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
111 this->volumeTotal_ *= duration_;
115 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
117 template<class CloudType>
118 Foam::ReactingLookupTableInjection<CloudType>::~ReactingLookupTableInjection()
122 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 template<class CloudType>
125 bool Foam::ReactingLookupTableInjection<CloudType>::active() const
131 template<class CloudType>
132 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
134 return this->SOI_ + duration_;
138 template<class CloudType>
139 void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
142 const label nParcels,
148 label injectorI = parcelI*injectorCells_.size()/nParcels;
150 position = injectors_[injectorI].x();
151 cellOwner = injectorCells_[injectorI];
155 template<class CloudType>
156 void Foam::ReactingLookupTableInjection<CloudType>::setProperties
159 const label nParcels,
161 typename CloudType::parcelType& parcel
164 label injectorI = parcelI*injectorCells_.size()/nParcels;
166 // set particle velocity
167 parcel.U() = injectors_[injectorI].U();
169 // set particle diameter
170 parcel.d() = injectors_[injectorI].d();
172 // set particle density
173 parcel.rho() = injectors_[injectorI].rho();
175 // set particle temperature
176 parcel.T() = injectors_[injectorI].T();
178 // set particle specific heat capacity
179 parcel.cp() = injectors_[injectorI].cp();
181 // set particle component mass fractions
182 parcel.Y() = injectors_[injectorI].Y();
186 template<class CloudType>
187 bool Foam::ReactingLookupTableInjection<CloudType>::fullyDescribed() const
193 template<class CloudType>
194 bool Foam::ReactingLookupTableInjection<CloudType>::validInjection(const label)
200 // ************************************************************************* //