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 "ManualInjection.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32 template<class CloudType>
33 Foam::label Foam::ManualInjection<CloudType>::parcelsToInject
39 if ((0.0 >= time0) && (0.0 < time1))
41 return positions_.size();
50 template<class CloudType>
51 Foam::scalar Foam::ManualInjection<CloudType>::volumeToInject
57 // All parcels introduced at SOI
58 if ((0.0 >= time0) && (0.0 < time1))
60 return this->volumeTotal_;
69 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 template<class CloudType>
72 Foam::ManualInjection<CloudType>::ManualInjection
74 const dictionary& dict,
78 InjectionModel<CloudType>(dict, owner, typeName),
79 positionsFile_(this->coeffDict().lookup("positionsFile")),
85 owner.db().time().constant(),
91 diameters_(positions_.size()),
92 U0_(this->coeffDict().lookup("U0")),
97 this->coeffDict().subDict("parcelPDF"),
102 // Construct parcel diameters
103 forAll(diameters_, i)
105 diameters_[i] = parcelPDF_->sample();
108 // Determine volume of particles to inject
109 this->volumeTotal_ = sum(pow3(diameters_))*mathematicalConstant::pi/6.0;
113 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
115 template<class CloudType>
116 Foam::ManualInjection<CloudType>::~ManualInjection()
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 template<class CloudType>
123 bool Foam::ManualInjection<CloudType>::active() const
129 template<class CloudType>
130 Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
137 template<class CloudType>
138 void Foam::ManualInjection<CloudType>::setPositionAndCell
147 position = positions_[parcelI];
148 this->findCellAtPosition(cellOwner, position);
152 template<class CloudType>
153 void Foam::ManualInjection<CloudType>::setProperties
158 typename CloudType::parcelType& parcel
161 // set particle velocity
164 // set particle diameter
165 parcel.d() = diameters_[parcelI];
169 template<class CloudType>
170 bool Foam::ManualInjection<CloudType>::fullyDescribed() const
176 template<class CloudType>
177 bool Foam::ManualInjection<CloudType>::validInjection(const label)
183 // ************************************************************************* //