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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef fvPatchField_H
00046 #define fvPatchField_H
00047
00048 #include "fvPatch.H"
00049 #include "DimensionedField.H"
00050
00051
00052
00053 namespace Foam
00054 {
00055
00056
00057
00058 class objectRegistry;
00059 class dictionary;
00060 class fvPatchFieldMapper;
00061 class volMesh;
00062
00063
00064
00065
00066 template<class Type>
00067 class fvPatchField;
00068
00069 template<class Type>
00070 class fvMatrix;
00071
00072 template<class Type>
00073 Ostream& operator<<(Ostream&, const fvPatchField<Type>&);
00074
00075
00076
00077
00078
00079
00080 template<class Type>
00081 class fvPatchField
00082 :
00083 public Field<Type>
00084 {
00085
00086
00087
00088 const fvPatch& patch_;
00089
00090
00091 const DimensionedField<Type, volMesh>& internalField_;
00092
00093
00094
00095 bool updated_;
00096
00097
00098
00099
00100 word patchType_;
00101
00102
00103 public:
00104
00105 typedef fvPatch Patch;
00106
00107
00108
00109 TypeName("fvPatchField");
00110
00111
00112 static int disallowGenericFvPatchField;
00113
00114
00115
00116
00117 declareRunTimeSelectionTable
00118 (
00119 tmp,
00120 fvPatchField,
00121 patch,
00122 (
00123 const fvPatch& p,
00124 const DimensionedField<Type, volMesh>& iF
00125 ),
00126 (p, iF)
00127 );
00128
00129 declareRunTimeSelectionTable
00130 (
00131 tmp,
00132 fvPatchField,
00133 patchMapper,
00134 (
00135 const fvPatchField<Type>& ptf,
00136 const fvPatch& p,
00137 const DimensionedField<Type, volMesh>& iF,
00138 const fvPatchFieldMapper& m
00139 ),
00140 (dynamic_cast<const fvPatchFieldType&>(ptf), p, iF, m)
00141 );
00142
00143 declareRunTimeSelectionTable
00144 (
00145 tmp,
00146 fvPatchField,
00147 dictionary,
00148 (
00149 const fvPatch& p,
00150 const DimensionedField<Type, volMesh>& iF,
00151 const dictionary& dict
00152 ),
00153 (p, iF, dict)
00154 );
00155
00156
00157
00158
00159
00160 fvPatchField
00161 (
00162 const fvPatch&,
00163 const DimensionedField<Type, volMesh>&
00164 );
00165
00166
00167 fvPatchField
00168 (
00169 const fvPatch&,
00170 const DimensionedField<Type, volMesh>&,
00171 const Field<Type>&
00172 );
00173
00174
00175 fvPatchField
00176 (
00177 const fvPatch&,
00178 const DimensionedField<Type, volMesh>&,
00179 const dictionary&,
00180 const bool valueRequired=false
00181 );
00182
00183
00184 fvPatchField
00185 (
00186 const fvPatchField<Type>&,
00187 const fvPatch&,
00188 const DimensionedField<Type, volMesh>&,
00189 const fvPatchFieldMapper&
00190 );
00191
00192
00193 fvPatchField(const fvPatchField<Type>&);
00194
00195
00196 virtual tmp<fvPatchField<Type> > clone() const
00197 {
00198 return tmp<fvPatchField<Type> >(new fvPatchField<Type>(*this));
00199 }
00200
00201
00202 fvPatchField
00203 (
00204 const fvPatchField<Type>&,
00205 const DimensionedField<Type, volMesh>&
00206 );
00207
00208
00209 virtual tmp<fvPatchField<Type> > clone
00210 (
00211 const DimensionedField<Type, volMesh>& iF
00212 ) const
00213 {
00214 return tmp<fvPatchField<Type> >(new fvPatchField<Type>(*this, iF));
00215 }
00216
00217
00218
00219
00220
00221
00222
00223 static tmp<fvPatchField<Type> > New
00224 (
00225 const word&,
00226 const fvPatch&,
00227 const DimensionedField<Type, volMesh>&
00228 );
00229
00230
00231
00232 static tmp<fvPatchField<Type> > New
00233 (
00234 const fvPatchField<Type>&,
00235 const fvPatch&,
00236 const DimensionedField<Type, volMesh>&,
00237 const fvPatchFieldMapper&
00238 );
00239
00240
00241
00242 static tmp<fvPatchField<Type> > New
00243 (
00244 const fvPatch&,
00245 const DimensionedField<Type, volMesh>&,
00246 const dictionary&
00247 );
00248
00249
00250
00251 template<class Type2>
00252 static tmp<fvPatchField<Type> > NewCalculatedType
00253 (
00254 const fvPatchField<Type2>&
00255 );
00256
00257
00258
00259
00260 virtual ~fvPatchField<Type>()
00261 {}
00262
00263
00264
00265
00266
00267
00268
00269 const objectRegistry& db() const;
00270
00271
00272 const fvPatch& patch() const
00273 {
00274 return patch_;
00275 }
00276
00277
00278 const DimensionedField<Type, volMesh>&
00279 dimensionedInternalField() const
00280 {
00281 return internalField_;
00282 }
00283
00284
00285 const Field<Type>& internalField() const
00286 {
00287 return internalField_;
00288 }
00289
00290
00291 static const word& calculatedType();
00292
00293
00294
00295
00296 virtual bool fixesValue() const
00297 {
00298 return false;
00299 }
00300
00301
00302 virtual bool coupled() const
00303 {
00304 return false;
00305 }
00306
00307
00308 bool updated() const
00309 {
00310 return updated_;
00311 }
00312
00313
00314
00315
00316
00317 virtual void autoMap
00318 (
00319 const fvPatchFieldMapper&
00320 );
00321
00322
00323 virtual void rmap
00324 (
00325 const fvPatchField<Type>&,
00326 const labelList&
00327 );
00328
00329
00330
00331
00332
00333 virtual tmp<Field<Type> > snGrad() const;
00334
00335
00336
00337 virtual void updateCoeffs()
00338 {
00339 updated_ = true;
00340 }
00341
00342
00343 virtual tmp<Field<Type> > patchInternalField() const;
00344
00345
00346 virtual tmp<Field<Type> > patchNeighbourField() const
00347 {
00348 notImplemented(type() + "patchNeighbourField()");
00349 return *this;
00350 }
00351
00352
00353 virtual void initEvaluate
00354 (
00355 const Pstream::commsTypes commsType=Pstream::blocking
00356 )
00357 {}
00358
00359
00360 virtual void evaluate
00361 (
00362 const Pstream::commsTypes commsType=Pstream::blocking
00363 );
00364
00365
00366
00367
00368 virtual tmp<Field<Type> > valueInternalCoeffs
00369 (
00370 const tmp<Field<scalar> >&
00371 ) const
00372 {
00373 notImplemented
00374 (
00375 type()
00376 + "::valueInternalCoeffs(const tmp<Field<scalar> >&)"
00377 );
00378 return *this;
00379 }
00380
00381
00382
00383 virtual tmp<Field<Type> > valueBoundaryCoeffs
00384 (
00385 const tmp<Field<scalar> >&
00386 ) const
00387 {
00388 notImplemented
00389 (
00390 type()
00391 + "::valueBoundaryCoeffs(const tmp<Field<scalar> >&)"
00392 );
00393 return *this;
00394 }
00395
00396
00397
00398 virtual tmp<Field<Type> > gradientInternalCoeffs() const
00399 {
00400 notImplemented(type() + "::gradientInternalCoeffs()");
00401 return *this;
00402 }
00403
00404
00405
00406 virtual tmp<Field<Type> > gradientBoundaryCoeffs() const
00407 {
00408 notImplemented(type() + "::gradientBoundaryCoeffs()");
00409 return *this;
00410 }
00411
00412
00413
00414 virtual void manipulateMatrix(fvMatrix<Type>& matrix);
00415
00416
00417
00418
00419
00420 virtual void write(Ostream&) const;
00421
00422
00423
00424 template<class EntryType>
00425 void writeEntryIfDifferent
00426 (
00427 Ostream& os,
00428 const word& entryName,
00429 const EntryType& value1,
00430 const EntryType& value2
00431 ) const;
00432
00433
00434
00435
00436
00437 void check(const fvPatchField<Type>&) const;
00438
00439
00440
00441
00442 virtual void operator=(const UList<Type>&);
00443
00444 virtual void operator=(const fvPatchField<Type>&);
00445 virtual void operator+=(const fvPatchField<Type>&);
00446 virtual void operator-=(const fvPatchField<Type>&);
00447 virtual void operator*=(const fvPatchField<scalar>&);
00448 virtual void operator/=(const fvPatchField<scalar>&);
00449
00450 virtual void operator+=(const Field<Type>&);
00451 virtual void operator-=(const Field<Type>&);
00452
00453 virtual void operator*=(const Field<scalar>&);
00454 virtual void operator/=(const Field<scalar>&);
00455
00456 virtual void operator=(const Type&);
00457 virtual void operator+=(const Type&);
00458 virtual void operator-=(const Type&);
00459 virtual void operator*=(const scalar);
00460 virtual void operator/=(const scalar);
00461
00462
00463
00464
00465 virtual void operator==(const fvPatchField<Type>&);
00466 virtual void operator==(const Field<Type>&);
00467 virtual void operator==(const Type&);
00468
00469
00470
00471
00472 friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
00473 };
00474
00475
00476
00477
00478 }
00479
00480
00481
00482 #ifdef NoRepository
00483 # include "fvPatchField.C"
00484 # include "calculatedFvPatchField.H"
00485 #endif
00486
00487
00488 #define makePatchTypeFieldTypeName(type) \
00489 \
00490 defineNamedTemplateTypeNameAndDebug(type, 0);
00491
00492 #define makePatchFieldsTypeName(type) \
00493 \
00494 makePatchTypeFieldTypeName(type##FvPatchScalarField); \
00495 makePatchTypeFieldTypeName(type##FvPatchVectorField); \
00496 makePatchTypeFieldTypeName(type##FvPatchSphericalTensorField); \
00497 makePatchTypeFieldTypeName(type##FvPatchSymmTensorField); \
00498 makePatchTypeFieldTypeName(type##FvPatchTensorField);
00499
00500 #define makePatchTypeField(PatchTypeField, typePatchTypeField) \
00501 \
00502 defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \
00503 \
00504 addToRunTimeSelectionTable \
00505 ( \
00506 PatchTypeField, typePatchTypeField, patch \
00507 ); \
00508 \
00509 addToRunTimeSelectionTable \
00510 ( \
00511 PatchTypeField, \
00512 typePatchTypeField, \
00513 patchMapper \
00514 ); \
00515 \
00516 addToRunTimeSelectionTable \
00517 ( \
00518 PatchTypeField, typePatchTypeField, dictionary \
00519 );
00520
00521
00522 #define makePatchFields(type) \
00523 \
00524 makePatchTypeField(fvPatchScalarField, type##FvPatchScalarField); \
00525 makePatchTypeField(fvPatchVectorField, type##FvPatchVectorField); \
00526 makePatchTypeField \
00527 ( \
00528 fvPatchSphericalTensorField, \
00529 type##FvPatchSphericalTensorField \
00530 ); \
00531 makePatchTypeField(fvPatchSymmTensorField, type##FvPatchSymmTensorField); \
00532 makePatchTypeField(fvPatchTensorField, type##FvPatchTensorField);
00533
00534
00535 #define makePatchTypeFieldTypedefs(type) \
00536 \
00537 typedef type##FvPatchField<scalar> type##FvPatchScalarField; \
00538 typedef type##FvPatchField<vector> type##FvPatchVectorField; \
00539 typedef type##FvPatchField<sphericalTensor> \
00540 type##FvPatchSphericalTensorField; \
00541 typedef type##FvPatchField<symmTensor> type##FvPatchSymmTensorField; \
00542 typedef type##FvPatchField<tensor> type##FvPatchTensorField;
00543
00544
00545
00546
00547 #endif
00548
00549