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 "ThermoLookupTableInjection.H"
28 #include "scalarIOList.H"
30 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32 template<class CloudType>
33 Foam::label Foam::ThermoLookupTableInjection<CloudType>::parcelsToInject
39 if ((time0 >= 0.0) && (time0 < duration_))
41 return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
50 template<class CloudType>
51 Foam::scalar Foam::ThermoLookupTableInjection<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::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
75 const dictionary& dict,
79 InjectionModel<CloudType>(dict, owner, typeName),
80 inputFileName_(this->coeffDict().lookup("inputFile")),
81 duration_(readScalar(this->coeffDict().lookup("duration"))),
84 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
91 owner.db().time().constant(),
99 // Set/cache the injector cells
100 injectorCells_.setSize(injectors_.size());
101 forAll(injectors_, i)
103 this->findCellAtPosition(injectorCells_[injectorI], injectors_[i].x());
106 // Determine volume of particles to inject
107 this->volumeTotal_ = 0.0;
108 forAll(injectors_, i)
110 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
112 this->volumeTotal_ *= duration_;
116 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
118 template<class CloudType>
119 Foam::ThermoLookupTableInjection<CloudType>::~ThermoLookupTableInjection()
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
125 template<class CloudType>
126 bool Foam::ThermoLookupTableInjection<CloudType>::active() const
132 template<class CloudType>
133 Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::timeEnd() const
135 return this->SOI_ + duration_;
139 template<class CloudType>
140 void Foam::ThermoLookupTableInjection<CloudType>::setPositionAndCell
143 const label nParcels,
149 label injectorI = parcelI*injectorCells_.size()/nParcels;
151 position = injectors_[injectorI].x();
152 cellOwner = injectorCells_[injectorI];
156 template<class CloudType>
157 void Foam::ThermoLookupTableInjection<CloudType>::setProperties
160 const label nParcels,
162 typename CloudType::parcelType* pPtr
165 label injectorI = parcelI*injectorCells_.size()/nParcels;
167 // set particle velocity
168 parcel.U() = injectors_[injectorI].U();
170 // set particle diameter
171 parcel.d() = injectors_[injectorI].d();
173 // set particle density
174 parcel.rho() = injectors_[injectorI].rho();
176 // set particle temperature
177 parcel.T() = injectors_[injectorI].T();
179 // set particle specific heat capacity
180 parcel.cp() = injectors_[injectorI].cp();
184 template<class CloudType>
185 bool Foam::ThermoLookupTableInjection<CloudType>::fullyDescribed() const
191 template<class CloudType>
192 bool Foam::ThermoLookupTableInjection<CloudType>::validInjection(const label)
198 // ************************************************************************* //