ManualInjection.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "ManualInjection.H"
00028
00029
00030
00031 template<class CloudType>
00032 Foam::label Foam::ManualInjection<CloudType>::parcelsToInject
00033 (
00034 const scalar time0,
00035 const scalar time1
00036 ) const
00037 {
00038 if ((0.0 >= time0) && (0.0 < time1))
00039 {
00040 return positions_.size();
00041 }
00042 else
00043 {
00044 return 0;
00045 }
00046 }
00047
00048
00049 template<class CloudType>
00050 Foam::scalar Foam::ManualInjection<CloudType>::volumeToInject
00051 (
00052 const scalar time0,
00053 const scalar time1
00054 ) const
00055 {
00056
00057 if ((0.0 >= time0) && (0.0 < time1))
00058 {
00059 return this->volumeTotal_;
00060 }
00061 else
00062 {
00063 return 0.0;
00064 }
00065 }
00066
00067
00068
00069
00070 template<class CloudType>
00071 Foam::ManualInjection<CloudType>::ManualInjection
00072 (
00073 const dictionary& dict,
00074 CloudType& owner
00075 )
00076 :
00077 InjectionModel<CloudType>(dict, owner, typeName),
00078 positionsFile_(this->coeffDict().lookup("positionsFile")),
00079 positions_
00080 (
00081 IOobject
00082 (
00083 positionsFile_,
00084 owner.db().time().constant(),
00085 owner.mesh(),
00086 IOobject::MUST_READ,
00087 IOobject::NO_WRITE
00088 )
00089 ),
00090 diameters_(positions_.size()),
00091 U0_(this->coeffDict().lookup("U0")),
00092 parcelPDF_
00093 (
00094 pdf::New
00095 (
00096 this->coeffDict().subDict("parcelPDF"),
00097 owner.rndGen()
00098 )
00099 )
00100 {
00101
00102 forAll(diameters_, i)
00103 {
00104 diameters_[i] = parcelPDF_->sample();
00105 }
00106
00107
00108 this->volumeTotal_ = sum(pow3(diameters_))*mathematicalConstant::pi/6.0;
00109 }
00110
00111
00112
00113
00114 template<class CloudType>
00115 Foam::ManualInjection<CloudType>::~ManualInjection()
00116 {}
00117
00118
00119
00120
00121 template<class CloudType>
00122 bool Foam::ManualInjection<CloudType>::active() const
00123 {
00124 return true;
00125 }
00126
00127
00128 template<class CloudType>
00129 Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
00130 {
00131
00132 return this->SOI_;
00133 }
00134
00135
00136 template<class CloudType>
00137 void Foam::ManualInjection<CloudType>::setPositionAndCell
00138 (
00139 const label parcelI,
00140 const label,
00141 const scalar,
00142 vector& position,
00143 label& cellOwner
00144 )
00145 {
00146 position = positions_[parcelI];
00147 this->findCellAtPosition(cellOwner, position);
00148 }
00149
00150
00151 template<class CloudType>
00152 void Foam::ManualInjection<CloudType>::setProperties
00153 (
00154 const label parcelI,
00155 const label,
00156 const scalar,
00157 typename CloudType::parcelType& parcel
00158 )
00159 {
00160
00161 parcel.U() = U0_;
00162
00163
00164 parcel.d() = diameters_[parcelI];
00165 }
00166
00167
00168 template<class CloudType>
00169 bool Foam::ManualInjection<CloudType>::fullyDescribed() const
00170 {
00171 return false;
00172 }
00173
00174
00175 template<class CloudType>
00176 bool Foam::ManualInjection<CloudType>::validInjection(const label)
00177 {
00178 return true;
00179 }
00180
00181
00182
Copyright © 2000-2009 OpenCFD Ltd