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