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 "KinematicLookupTableInjection.H"
27 #include "scalarIOList.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
34 const dictionary& dict,
38 InjectionModel<CloudType>(dict, owner, typeName),
39 inputFileName_(this->coeffDict().lookup("inputFile")),
40 duration_(readScalar(this->coeffDict().lookup("duration"))),
43 readScalar(this->coeffDict().lookup("parcelsPerSecond"))
50 owner.db().time().constant(),
60 // Set/cache the injector cells
61 injectorCells_.setSize(injectors_.size());
62 injectorTetFaces_.setSize(injectors_.size());
63 injectorTetPts_.setSize(injectors_.size());
67 this->findCellAtPosition
76 // Determine volume of particles to inject
77 this->volumeTotal_ = 0.0;
80 this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
82 this->volumeTotal_ *= duration_;
86 template<class CloudType>
87 Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
89 const KinematicLookupTableInjection<CloudType>& im
92 InjectionModel<CloudType>(im),
93 inputFileName_(im.inputFileName_),
94 duration_(im.duration_),
95 parcelsPerSecond_(im.parcelsPerSecond_),
96 injectors_(im.injectors_),
97 injectorCells_(im.injectorCells_),
98 injectorTetFaces_(im.injectorTetFaces_),
99 injectorTetPts_(im.injectorTetPts_)
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
105 template<class CloudType>
106 Foam::KinematicLookupTableInjection<CloudType>::~KinematicLookupTableInjection()
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 template<class CloudType>
113 Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
115 return this->SOI_ + duration_;
119 template<class CloudType>
120 Foam::label Foam::KinematicLookupTableInjection<CloudType>::parcelsToInject
126 if ((time0 >= 0.0) && (time0 < duration_))
128 return floor(injectorCells_.size()*(time1 - time0)*parcelsPerSecond_);
137 template<class CloudType>
138 Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::volumeToInject
145 if ((time0 >= 0.0) && (time0 < duration_))
147 forAll(injectors_, i)
149 volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
157 template<class CloudType>
158 void Foam::KinematicLookupTableInjection<CloudType>::setPositionAndCell
161 const label nParcels,
169 label injectorI = parcelI*injectorCells_.size()/nParcels;
171 position = injectors_[injectorI].x();
172 cellOwner = injectorCells_[injectorI];
173 tetFaceI = injectorTetFaces_[injectorI];
174 tetPtI = injectorTetPts_[injectorI];
178 template<class CloudType>
179 void Foam::KinematicLookupTableInjection<CloudType>::setProperties
182 const label nParcels,
184 typename CloudType::parcelType& parcel
187 label injectorI = parcelI*injectorCells_.size()/nParcels;
189 // set particle velocity
190 parcel.U() = injectors_[injectorI].U();
192 // set particle diameter
193 parcel.d() = injectors_[injectorI].d();
195 // set particle density
196 parcel.rho() = injectors_[injectorI].rho();
200 template<class CloudType>
201 bool Foam::KinematicLookupTableInjection<CloudType>::fullyDescribed() const
207 template<class CloudType>
208 bool Foam::KinematicLookupTableInjection<CloudType>::validInjection
217 // ************************************************************************* //