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 "IOobject.H"
00028 #include "dictionary.H"
00029 #include "fvMesh.H"
00030 #include "fvPatchFieldMapper.H"
00031
00032
00033
00034
00035 template<class Type>
00036 Foam::fvPatchField<Type>::fvPatchField
00037 (
00038 const fvPatch& p,
00039 const DimensionedField<Type, volMesh>& iF
00040 )
00041 :
00042 Field<Type>(p.size()),
00043 patch_(p),
00044 internalField_(iF),
00045 updated_(false),
00046 patchType_(word::null)
00047 {}
00048
00049
00050 template<class Type>
00051 Foam::fvPatchField<Type>::fvPatchField
00052 (
00053 const fvPatch& p,
00054 const DimensionedField<Type, volMesh>& iF,
00055 const Field<Type>& f
00056 )
00057 :
00058 Field<Type>(f),
00059 patch_(p),
00060 internalField_(iF),
00061 updated_(false),
00062 patchType_(word::null)
00063 {}
00064
00065
00066 template<class Type>
00067 Foam::fvPatchField<Type>::fvPatchField
00068 (
00069 const fvPatchField<Type>& ptf,
00070 const fvPatch& p,
00071 const DimensionedField<Type, volMesh>& iF,
00072 const fvPatchFieldMapper& mapper
00073 )
00074 :
00075 Field<Type>(ptf, mapper),
00076 patch_(p),
00077 internalField_(iF),
00078 updated_(false),
00079 patchType_(ptf.patchType_)
00080 {}
00081
00082
00083 template<class Type>
00084 Foam::fvPatchField<Type>::fvPatchField
00085 (
00086 const fvPatch& p,
00087 const DimensionedField<Type, volMesh>& iF,
00088 const dictionary& dict,
00089 const bool valueRequired
00090 )
00091 :
00092 Field<Type>(p.size()),
00093 patch_(p),
00094 internalField_(iF),
00095 updated_(false),
00096 patchType_(dict.lookupOrDefault<word>("patchType", word::null))
00097 {
00098 if (dict.found("value"))
00099 {
00100 fvPatchField<Type>::operator=
00101 (
00102 Field<Type>("value", dict, p.size())
00103 );
00104 }
00105 else if (!valueRequired)
00106 {
00107 fvPatchField<Type>::operator=(pTraits<Type>::zero);
00108 }
00109 else
00110 {
00111 FatalIOErrorIn
00112 (
00113 "fvPatchField<Type>::fvPatchField"
00114 "("
00115 "const fvPatch& p,"
00116 "const DimensionedField<Type, volMesh>& iF,"
00117 "const dictionary& dict,"
00118 "const bool valueRequired"
00119 ")",
00120 dict
00121 ) << "Essential entry 'value' missing"
00122 << exit(FatalIOError);
00123 }
00124 }
00125
00126
00127 template<class Type>
00128 Foam::fvPatchField<Type>::fvPatchField
00129 (
00130 const fvPatchField<Type>& ptf
00131 )
00132 :
00133 Field<Type>(ptf),
00134 patch_(ptf.patch_),
00135 internalField_(ptf.internalField_),
00136 updated_(false),
00137 patchType_(ptf.patchType_)
00138 {}
00139
00140
00141 template<class Type>
00142 Foam::fvPatchField<Type>::fvPatchField
00143 (
00144 const fvPatchField<Type>& ptf,
00145 const DimensionedField<Type, volMesh>& iF
00146 )
00147 :
00148 Field<Type>(ptf),
00149 patch_(ptf.patch_),
00150 internalField_(iF),
00151 updated_(false),
00152 patchType_(ptf.patchType_)
00153 {}
00154
00155
00156
00157
00158 template<class Type>
00159 const Foam::objectRegistry& Foam::fvPatchField<Type>::db() const
00160 {
00161 return patch_.boundaryMesh().mesh();
00162 }
00163
00164
00165 template<class Type>
00166 void Foam::fvPatchField<Type>::check(const fvPatchField<Type>& ptf) const
00167 {
00168 if (&patch_ != &(ptf.patch_))
00169 {
00170 FatalErrorIn("PatchField<Type>::check(const fvPatchField<Type>&)")
00171 << "different patches for fvPatchField<Type>s"
00172 << abort(FatalError);
00173 }
00174 }
00175
00176
00177
00178 template<class Type>
00179 Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
00180 {
00181 return (*this - patchInternalField())*patch_.deltaCoeffs();
00182 }
00183
00184
00185
00186 template<class Type>
00187 Foam::tmp<Foam::Field<Type> >
00188 Foam::fvPatchField<Type>::patchInternalField() const
00189 {
00190 return patch_.patchInternalField(internalField_);
00191 }
00192
00193
00194 template<class Type>
00195 void Foam::fvPatchField<Type>::autoMap
00196 (
00197 const fvPatchFieldMapper& m
00198 )
00199 {
00200 Field<Type>::autoMap(m);
00201 }
00202
00203
00204 template<class Type>
00205 void Foam::fvPatchField<Type>::rmap
00206 (
00207 const fvPatchField<Type>& ptf,
00208 const labelList& addr
00209 )
00210 {
00211 Field<Type>::rmap(ptf, addr);
00212 }
00213
00214
00215 template<class Type>
00216 void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes)
00217 {
00218 if (!updated_)
00219 {
00220 updateCoeffs();
00221 }
00222
00223 updated_ = false;
00224 }
00225
00226
00227 template<class Type>
00228 void Foam::fvPatchField<Type>::manipulateMatrix(fvMatrix<Type>& matrix)
00229 {
00230
00231 }
00232
00233
00234 template<class Type>
00235 void Foam::fvPatchField<Type>::write(Ostream& os) const
00236 {
00237 os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
00238
00239 if (patchType_.size())
00240 {
00241 os.writeKeyword("patchType") << patchType_
00242 << token::END_STATEMENT << nl;
00243 }
00244 }
00245
00246
00247 template<class Type>
00248 template<class EntryType>
00249 void Foam::fvPatchField<Type>::writeEntryIfDifferent
00250 (
00251 Ostream& os,
00252 const word& entryName,
00253 const EntryType& value1,
00254 const EntryType& value2
00255 ) const
00256 {
00257 if (value1 != value2)
00258 {
00259 os.writeKeyword(entryName) << value2 << token::END_STATEMENT << nl;
00260 }
00261 }
00262
00263
00264
00265
00266 template<class Type>
00267 void Foam::fvPatchField<Type>::operator=
00268 (
00269 const UList<Type>& ul
00270 )
00271 {
00272 Field<Type>::operator=(ul);
00273 }
00274
00275
00276 template<class Type>
00277 void Foam::fvPatchField<Type>::operator=
00278 (
00279 const fvPatchField<Type>& ptf
00280 )
00281 {
00282 check(ptf);
00283 Field<Type>::operator=(ptf);
00284 }
00285
00286
00287 template<class Type>
00288 void Foam::fvPatchField<Type>::operator+=
00289 (
00290 const fvPatchField<Type>& ptf
00291 )
00292 {
00293 check(ptf);
00294 Field<Type>::operator+=(ptf);
00295 }
00296
00297
00298 template<class Type>
00299 void Foam::fvPatchField<Type>::operator-=
00300 (
00301 const fvPatchField<Type>& ptf
00302 )
00303 {
00304 check(ptf);
00305 Field<Type>::operator-=(ptf);
00306 }
00307
00308
00309 template<class Type>
00310 void Foam::fvPatchField<Type>::operator*=
00311 (
00312 const fvPatchField<scalar>& ptf
00313 )
00314 {
00315 if (&patch_ != &ptf.patch())
00316 {
00317 FatalErrorIn
00318 (
00319 "PatchField<Type>::operator*=(const fvPatchField<scalar>& ptf)"
00320 ) << "incompatible patches for patch fields"
00321 << abort(FatalError);
00322 }
00323
00324 Field<Type>::operator*=(ptf);
00325 }
00326
00327
00328 template<class Type>
00329 void Foam::fvPatchField<Type>::operator/=
00330 (
00331 const fvPatchField<scalar>& ptf
00332 )
00333 {
00334 if (&patch_ != &ptf.patch())
00335 {
00336 FatalErrorIn
00337 (
00338 "PatchField<Type>::operator/=(const fvPatchField<scalar>& ptf)"
00339 ) << " incompatible patches for patch fields"
00340 << abort(FatalError);
00341 }
00342
00343 Field<Type>::operator/=(ptf);
00344 }
00345
00346
00347 template<class Type>
00348 void Foam::fvPatchField<Type>::operator+=
00349 (
00350 const Field<Type>& tf
00351 )
00352 {
00353 Field<Type>::operator+=(tf);
00354 }
00355
00356
00357 template<class Type>
00358 void Foam::fvPatchField<Type>::operator-=
00359 (
00360 const Field<Type>& tf
00361 )
00362 {
00363 Field<Type>::operator-=(tf);
00364 }
00365
00366
00367 template<class Type>
00368 void Foam::fvPatchField<Type>::operator*=
00369 (
00370 const scalarField& tf
00371 )
00372 {
00373 Field<Type>::operator*=(tf);
00374 }
00375
00376
00377 template<class Type>
00378 void Foam::fvPatchField<Type>::operator/=
00379 (
00380 const scalarField& tf
00381 )
00382 {
00383 Field<Type>::operator/=(tf);
00384 }
00385
00386
00387 template<class Type>
00388 void Foam::fvPatchField<Type>::operator=
00389 (
00390 const Type& t
00391 )
00392 {
00393 Field<Type>::operator=(t);
00394 }
00395
00396
00397 template<class Type>
00398 void Foam::fvPatchField<Type>::operator+=
00399 (
00400 const Type& t
00401 )
00402 {
00403 Field<Type>::operator+=(t);
00404 }
00405
00406
00407 template<class Type>
00408 void Foam::fvPatchField<Type>::operator-=
00409 (
00410 const Type& t
00411 )
00412 {
00413 Field<Type>::operator-=(t);
00414 }
00415
00416
00417 template<class Type>
00418 void Foam::fvPatchField<Type>::operator*=
00419 (
00420 const scalar s
00421 )
00422 {
00423 Field<Type>::operator*=(s);
00424 }
00425
00426
00427 template<class Type>
00428 void Foam::fvPatchField<Type>::operator/=
00429 (
00430 const scalar s
00431 )
00432 {
00433 Field<Type>::operator/=(s);
00434 }
00435
00436
00437
00438 template<class Type>
00439 void Foam::fvPatchField<Type>::operator==
00440 (
00441 const fvPatchField<Type>& ptf
00442 )
00443 {
00444 Field<Type>::operator=(ptf);
00445 }
00446
00447
00448 template<class Type>
00449 void Foam::fvPatchField<Type>::operator==
00450 (
00451 const Field<Type>& tf
00452 )
00453 {
00454 Field<Type>::operator=(tf);
00455 }
00456
00457
00458 template<class Type>
00459 void Foam::fvPatchField<Type>::operator==
00460 (
00461 const Type& t
00462 )
00463 {
00464 Field<Type>::operator=(t);
00465 }
00466
00467
00468
00469
00470 template<class Type>
00471 Foam::Ostream& Foam::operator<<(Ostream& os, const fvPatchField<Type>& ptf)
00472 {
00473 ptf.write(os);
00474
00475 os.check("Ostream& operator<<(Ostream&, const fvPatchField<Type>&");
00476
00477 return os;
00478 }
00479
00480
00481
00482
00483 # include "newFvPatchField.C"
00484
00485