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