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 "ReactingLookupTableInjection.H"
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 template<class CloudType>
31 Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
33 const dictionary& dict,
37 InjectionModel<CloudType>(dict, owner, typeName),
38 inputFileName_(this->coeffDict().lookup("inputFile")),
39 duration_(readScalar(this->coeffDict().lookup("duration"))),
42 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
49 owner.db().time().constant(),
59 // Set/cache the injector cells
60 injectorCells_.setSize(injectors_.size());
61 injectorTetFaces_.setSize(injectors_.size());
62 injectorTetPts_.setSize(injectors_.size());
66 this->findCellAtPosition
75 // Determine volume of particles to inject
76 this->volumeTotal_ = 0.0;
79 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
81 this->volumeTotal_ *= duration_;
85 template<class CloudType>
86 Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
88 const ReactingLookupTableInjection<CloudType>& im
91 InjectionModel<CloudType>(im),
92 inputFileName_(im.inputFileName_),
93 duration_(im.duration_),
94 parcelsPerSecond_(im.parcelsPerSecond_),
95 injectors_(im.injectors_),
96 injectorCells_(im.injectorCells_),
97 injectorTetFaces_(im.injectorTetFaces_),
98 injectorTetPts_(im.injectorTetPts_)
102 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 template<class CloudType>
105 Foam::ReactingLookupTableInjection<CloudType>::~ReactingLookupTableInjection()
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 template<class CloudType>
112 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
114 return this->SOI_ + duration_;
118 template<class CloudType>
119 Foam::label Foam::ReactingLookupTableInjection<CloudType>::parcelsToInject
125 if ((time0 >= 0.0) && (time0 < duration_))
127 return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_);
136 template<class CloudType>
137 Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::volumeToInject
144 if ((time0 >= 0.0) && (time0 < duration_))
146 forAll(injectors_, i)
148 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
156 template<class CloudType>
157 void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
160 const label nParcels,
168 label injectorI = parcelI*injectorCells_.size()/nParcels;
170 position = injectors_[injectorI].x();
171 cellOwner = injectorCells_[injectorI];
172 tetFaceI = injectorTetFaces_[injectorI];
173 tetPtI = injectorTetPts_[injectorI];
177 template<class CloudType>
178 void Foam::ReactingLookupTableInjection<CloudType>::setProperties
181 const label nParcels,
183 typename CloudType::parcelType& parcel
186 label injectorI = parcelI*injectorCells_.size()/nParcels;
188 // set particle velocity
189 parcel.U() = injectors_[injectorI].U();
191 // set particle diameter
192 parcel.d() = injectors_[injectorI].d();
194 // set particle density
195 parcel.rho() = injectors_[injectorI].rho();
197 // set particle temperature
198 parcel.T() = injectors_[injectorI].T();
200 // set particle specific heat capacity
201 parcel.Cp() = injectors_[injectorI].Cp();
203 // set particle component mass fractions
204 parcel.Y() = injectors_[injectorI].Y();
208 template<class CloudType>
209 bool Foam::ReactingLookupTableInjection<CloudType>::fullyDescribed() const
215 template<class CloudType>
216 bool Foam::ReactingLookupTableInjection<CloudType>::validInjection(const label)
222 // ************************************************************************* //