trackedParticle.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 "trackedParticle.H"
00028
00029
00030
00031
00032 Foam::trackedParticle::trackedParticle
00033 (
00034 const Cloud<trackedParticle>& c,
00035 const vector& position,
00036 const label celli,
00037 const point& end,
00038 const label level,
00039 const label i,
00040 const label j
00041 )
00042 :
00043 ExactParticle<trackedParticle>(c, position, celli),
00044 end_(end),
00045 level_(level),
00046 i_(i),
00047 j_(j)
00048 {}
00049
00050
00051
00052 Foam::trackedParticle::trackedParticle
00053 (
00054 const Cloud<trackedParticle>& c,
00055 Istream& is,
00056 bool readFields
00057 )
00058 :
00059 ExactParticle<trackedParticle>(c, is, readFields)
00060 {
00061 if (readFields)
00062 {
00063 if (is.format() == IOstream::ASCII)
00064 {
00065 is >> end_;
00066 level_ = readLabel(is);
00067 i_ = readLabel(is);
00068 j_ = readLabel(is);
00069 }
00070 else
00071 {
00072 is.read
00073 (
00074 reinterpret_cast<char*>(&end_),
00075 sizeof(end_) + sizeof(level_) + sizeof(i_) + sizeof(j_)
00076 );
00077 }
00078 }
00079
00080
00081 is.check
00082 (
00083 "trackedParticle::trackedParticle"
00084 "(const Cloud<trackedParticle>&, Istream&, bool)"
00085 );
00086 }
00087
00088
00089
00090
00091 bool Foam::trackedParticle::move(trackedParticle::trackData& td)
00092 {
00093 td.switchProcessor = false;
00094 td.keepParticle = true;
00095
00096 scalar deltaT = cloud().pMesh().time().deltaT().value();
00097 scalar tEnd = (1.0 - stepFraction())*deltaT;
00098 scalar dtMax = tEnd;
00099
00100 while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
00101 {
00102
00103 scalar dt = min(dtMax, tEnd);
00104
00105
00106 td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
00107
00108 dt *= trackToFace(end_, td);
00109
00110 tEnd -= dt;
00111 stepFraction() = 1.0 - tEnd/deltaT;
00112 }
00113
00114 return td.keepParticle;
00115 }
00116
00117
00118 bool Foam::trackedParticle::hitPatch
00119 (
00120 const polyPatch&,
00121 trackedParticle::trackData& td,
00122 const label patchI
00123 )
00124 {
00125 return false;
00126 }
00127
00128
00129 bool Foam::trackedParticle::hitPatch
00130 (
00131 const polyPatch&,
00132 int&,
00133 const label
00134 )
00135 {
00136 return false;
00137 }
00138
00139
00140 void Foam::trackedParticle::hitWedgePatch
00141 (
00142 const wedgePolyPatch&,
00143 trackedParticle::trackData& td
00144 )
00145 {
00146
00147 td.keepParticle = false;
00148 }
00149
00150
00151 void Foam::trackedParticle::hitWedgePatch
00152 (
00153 const wedgePolyPatch&,
00154 int&
00155 )
00156 {}
00157
00158
00159 void Foam::trackedParticle::hitSymmetryPatch
00160 (
00161 const symmetryPolyPatch&,
00162 trackedParticle::trackData& td
00163 )
00164 {
00165
00166 td.keepParticle = false;
00167 }
00168
00169
00170 void Foam::trackedParticle::hitSymmetryPatch
00171 (
00172 const symmetryPolyPatch&,
00173 int&
00174 )
00175 {}
00176
00177
00178 void Foam::trackedParticle::hitCyclicPatch
00179 (
00180 const cyclicPolyPatch&,
00181 trackedParticle::trackData& td
00182 )
00183 {
00184
00185 td.keepParticle = false;
00186 }
00187
00188
00189 void Foam::trackedParticle::hitCyclicPatch
00190 (
00191 const cyclicPolyPatch&,
00192 int&
00193 )
00194 {}
00195
00196
00197 void Foam::trackedParticle::hitProcessorPatch
00198 (
00199 const processorPolyPatch&,
00200 trackedParticle::trackData& td
00201 )
00202 {
00203
00204 td.switchProcessor = true;
00205 }
00206
00207
00208 void Foam::trackedParticle::hitProcessorPatch
00209 (
00210 const processorPolyPatch&,
00211 int&
00212 )
00213 {}
00214
00215
00216 void Foam::trackedParticle::hitWallPatch
00217 (
00218 const wallPolyPatch& wpp,
00219 trackedParticle::trackData& td
00220 )
00221 {
00222
00223 td.keepParticle = false;
00224 }
00225
00226
00227 void Foam::trackedParticle::hitWallPatch
00228 (
00229 const wallPolyPatch& wpp,
00230 int&
00231 )
00232 {}
00233
00234
00235 void Foam::trackedParticle::hitPatch
00236 (
00237 const polyPatch& wpp,
00238 trackedParticle::trackData& td
00239 )
00240 {
00241
00242 td.keepParticle = false;
00243 }
00244
00245
00246 void Foam::trackedParticle::hitPatch
00247 (
00248 const polyPatch& wpp,
00249 int&
00250 )
00251 {}
00252
00253
00254
00255
00256 Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
00257 {
00258 if (os.format() == IOstream::ASCII)
00259 {
00260 os << static_cast<const ExactParticle<trackedParticle>&>(p)
00261 << token::SPACE << p.end_
00262 << token::SPACE << p.level_
00263 << token::SPACE << p.i_
00264 << token::SPACE << p.j_;
00265 }
00266 else
00267 {
00268 os << static_cast<const ExactParticle<trackedParticle>&>(p);
00269 os.write
00270 (
00271 reinterpret_cast<const char*>(&p.end_),
00272 sizeof(p.end_) + sizeof(p.level_) + sizeof(p.i_) + sizeof(p.j_)
00273 );
00274 }
00275
00276
00277 os.check("Ostream& operator<<(Ostream&, const trackedParticle&)");
00278
00279 return os;
00280 }
00281
00282
00283
Copyright © 2000-2009 OpenCFD Ltd