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 #ifndef GeometricField_H
00041 #define GeometricField_H
00042
00043 #include "regIOobject.H"
00044 #include "dimensionedTypes.H"
00045 #include "DimensionedField.H"
00046 #include "FieldField.H"
00047 #include "lduInterfaceFieldPtrsList.H"
00048
00049
00050
00051 namespace Foam
00052 {
00053
00054 class dictionary;
00055
00056
00057
00058 template<class Type, template<class> class PatchField, class GeoMesh>
00059 class GeometricField;
00060
00061 template<class Type, template<class> class PatchField, class GeoMesh>
00062 Ostream& operator<<
00063 (
00064 Ostream&,
00065 const GeometricField<Type, PatchField, GeoMesh>&
00066 );
00067
00068 template<class Type, template<class> class PatchField, class GeoMesh>
00069 Ostream& operator<<
00070 (
00071 Ostream&,
00072 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00073 );
00074
00075
00076
00077
00078
00079
00080 template<class Type, template<class> class PatchField, class GeoMesh>
00081 class GeometricField
00082 :
00083 public DimensionedField<Type, GeoMesh>
00084 {
00085
00086
00087
00088 bool readIfPresent();
00089
00090
00091 bool readOldTimeIfPresent();
00092
00093
00094 public:
00095
00096
00097
00098 typedef typename GeoMesh::Mesh Mesh;
00099 typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
00100
00101 typedef DimensionedField<Type, GeoMesh> DimensionedInternalField;
00102 typedef Field<Type> InternalField;
00103 typedef PatchField<Type> PatchFieldType;
00104
00105
00106 class GeometricBoundaryField
00107 :
00108 public FieldField<PatchField, Type>
00109 {
00110
00111
00112
00113 const BoundaryMesh& bmesh_;
00114
00115
00116 public:
00117
00118
00119
00120
00121
00122
00123 GeometricBoundaryField
00124 (
00125 const BoundaryMesh&,
00126 const DimensionedInternalField&,
00127 const word&
00128 );
00129
00130
00131
00132
00133 GeometricBoundaryField
00134 (
00135 const BoundaryMesh&,
00136 const DimensionedInternalField&,
00137 const wordList&
00138 );
00139
00140
00141
00142
00143 GeometricBoundaryField
00144 (
00145 const BoundaryMesh&,
00146 const DimensionedInternalField&,
00147 const PtrList<PatchField<Type> >&
00148 );
00149
00150
00151 GeometricBoundaryField
00152 (
00153 const DimensionedInternalField&,
00154 const GeometricBoundaryField&
00155 );
00156
00157
00158
00159
00160
00161
00162 GeometricBoundaryField
00163 (
00164 const GeometricBoundaryField&
00165 );
00166
00167
00168 GeometricBoundaryField
00169 (
00170 const BoundaryMesh&,
00171 const DimensionedInternalField&,
00172 const dictionary&
00173 );
00174
00175
00176
00177
00178
00179 void updateCoeffs();
00180
00181
00182 void evaluate();
00183
00184
00185 wordList types() const;
00186
00187
00188
00189 GeometricBoundaryField boundaryInternalField() const;
00190
00191
00192
00193 lduInterfaceFieldPtrsList interfaces() const;
00194
00195
00196 void writeEntry(const word& keyword, Ostream& os) const;
00197
00198
00199
00200
00201
00202 void operator=(const GeometricBoundaryField&);
00203
00204
00205 void operator=(const FieldField<PatchField, Type>&);
00206
00207
00208 void operator=(const Type&);
00209
00210
00211
00212
00213 void operator==(const GeometricBoundaryField&);
00214
00215
00216 void operator==(const FieldField<PatchField, Type>&);
00217
00218
00219 void operator==(const Type&);
00220 };
00221
00222
00223 private:
00224
00225
00226
00227
00228
00229 mutable label timeIndex_;
00230
00231
00232 mutable GeometricField<Type, PatchField, GeoMesh>* field0Ptr_;
00233
00234
00235 mutable GeometricField<Type, PatchField, GeoMesh>* fieldPrevIterPtr_;
00236
00237
00238 GeometricBoundaryField boundaryField_;
00239
00240
00241
00242
00243
00244 tmp<GeometricBoundaryField> readField(Istream& is);
00245
00246
00247 public:
00248
00249
00250 TypeName("GeometricField");
00251
00252
00253
00254
00255 typedef typename Field<Type>::cmptType cmptType;
00256
00257
00258
00259
00260 inline static const GeometricField<Type, PatchField, GeoMesh>& null();
00261
00262
00263
00264
00265
00266
00267
00268 GeometricField
00269 (
00270 const IOobject&,
00271 const Mesh&,
00272 const dimensionSet&,
00273 const word& patchFieldType=PatchField<Type>::calculatedType()
00274 );
00275
00276
00277
00278
00279 GeometricField
00280 (
00281 const IOobject&,
00282 const Mesh&,
00283 const dimensionSet&,
00284 const wordList& patchFieldTypes
00285 );
00286
00287
00288 GeometricField
00289 (
00290 const IOobject&,
00291 const Mesh&,
00292 const dimensioned<Type>&,
00293 const word& patchFieldType=PatchField<Type>::calculatedType()
00294 );
00295
00296
00297 GeometricField
00298 (
00299 const IOobject&,
00300 const Mesh&,
00301 const dimensioned<Type>&,
00302 const wordList& patchFieldTypes
00303 );
00304
00305
00306 GeometricField
00307 (
00308 const IOobject&,
00309 const Mesh&,
00310 const dimensionSet&,
00311 const Field<Type>&,
00312 const PtrList<PatchField<Type> >&
00313 );
00314
00315
00316 GeometricField
00317 (
00318 const IOobject&,
00319 const Mesh&
00320 );
00321
00322
00323 GeometricField
00324 (
00325 const IOobject&,
00326 const Mesh&,
00327 Istream&
00328 );
00329
00330
00331 GeometricField
00332 (
00333 const GeometricField<Type, PatchField, GeoMesh>&
00334 );
00335
00336
00337 # ifdef ConstructFromTmp
00338 GeometricField
00339 (
00340 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00341 );
00342 # endif
00343
00344
00345 GeometricField
00346 (
00347 const IOobject&,
00348 const GeometricField<Type, PatchField, GeoMesh>&
00349 );
00350
00351
00352 GeometricField
00353 (
00354 const word& newName,
00355 const GeometricField<Type, PatchField, GeoMesh>&
00356 );
00357
00358
00359 # ifdef ConstructFromTmp
00360 GeometricField
00361 (
00362 const word& newName,
00363 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00364 );
00365 # endif
00366
00367
00368 GeometricField
00369 (
00370 const IOobject&,
00371 const GeometricField<Type, PatchField, GeoMesh>&,
00372 const word& patchFieldType
00373 );
00374
00375
00376 GeometricField
00377 (
00378 const IOobject&,
00379 const GeometricField<Type, PatchField, GeoMesh>&,
00380 const wordList& patchFieldTypes
00381 );
00382
00383
00384
00385
00386 virtual ~GeometricField();
00387
00388
00389
00390
00391
00392 DimensionedInternalField& dimensionedInternalField();
00393
00394
00395 inline const DimensionedInternalField& dimensionedInternalField() const;
00396
00397
00398 InternalField& internalField();
00399
00400
00401 inline const InternalField& internalField() const;
00402
00403
00404 GeometricBoundaryField& boundaryField();
00405
00406
00407 inline const GeometricBoundaryField& boundaryField() const;
00408
00409
00410 inline label timeIndex() const;
00411
00412
00413 inline label& timeIndex();
00414
00415
00416 void storeOldTimes() const;
00417
00418
00419 void storeOldTime() const;
00420
00421
00422 label nOldTimes() const;
00423
00424
00425 const GeometricField<Type, PatchField, GeoMesh>& oldTime() const;
00426
00427
00428
00429 GeometricField<Type, PatchField, GeoMesh>& oldTime();
00430
00431
00432 void storePrevIter() const;
00433
00434
00435 const GeometricField<Type, PatchField, GeoMesh>& prevIter() const;
00436
00437
00438 void correctBoundaryConditions();
00439
00440
00441 bool needReference() const;
00442
00443
00444 tmp<GeometricField<cmptType, PatchField, GeoMesh> > component
00445 (
00446 const direction
00447 ) const;
00448
00449
00450 bool writeData(Ostream&) const;
00451
00452
00453 tmp<GeometricField<Type, PatchField, GeoMesh> > T() const;
00454
00455
00456
00457
00458
00459 void relax(const scalar alpha);
00460
00461
00462
00463 void relax();
00464
00465
00466
00467
00468 void negate();
00469
00470 void replace
00471 (
00472 const direction,
00473 const GeometricField<cmptType, PatchField, GeoMesh>&
00474 );
00475
00476 void replace
00477 (
00478 const direction,
00479 const dimensioned<cmptType>&
00480 );
00481
00482 void max(const dimensioned<Type>&);
00483 void min(const dimensioned<Type>&);
00484
00485 void max
00486 (
00487 const GeometricField<Type, PatchField, GeoMesh>&,
00488 const dimensioned<Type>&
00489 );
00490
00491 void min
00492 (
00493 const GeometricField<Type, PatchField, GeoMesh>&,
00494 const dimensioned<Type>&
00495 );
00496
00497 void scale
00498 (
00499 const GeometricField<Type, PatchField, GeoMesh>&,
00500 const GeometricField<Type, PatchField, GeoMesh>&
00501 );
00502
00503 void scale
00504 (
00505 const GeometricField<Type, PatchField, GeoMesh>&,
00506 const dimensioned<Type>&
00507 );
00508
00509
00510
00511
00512 void operator=(const GeometricField<Type, PatchField, GeoMesh>&);
00513 void operator=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00514 void operator=(const dimensioned<Type>&);
00515
00516 void operator==(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00517 void operator==(const dimensioned<Type>&);
00518
00519 void operator+=(const GeometricField<Type, PatchField, GeoMesh>&);
00520 void operator+=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00521
00522 void operator-=(const GeometricField<Type, PatchField, GeoMesh>&);
00523 void operator-=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00524
00525 void operator*=(const GeometricField<scalar, PatchField, GeoMesh>&);
00526 void operator*=(const tmp<GeometricField<scalar,PatchField,GeoMesh> >&);
00527
00528 void operator/=(const GeometricField<scalar, PatchField, GeoMesh>&);
00529 void operator/=(const tmp<GeometricField<scalar,PatchField,GeoMesh> >&);
00530
00531 void operator+=(const dimensioned<Type>&);
00532 void operator-=(const dimensioned<Type>&);
00533
00534 void operator*=(const dimensioned<scalar>&);
00535 void operator/=(const dimensioned<scalar>&);
00536
00537
00538
00539
00540 friend Ostream& operator<< <Type, PatchField, GeoMesh>
00541 (
00542 Ostream&,
00543 const GeometricField<Type, PatchField, GeoMesh>&
00544 );
00545
00546 friend Ostream& operator<< <Type, PatchField, GeoMesh>
00547 (
00548 Ostream&,
00549 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00550 );
00551 };
00552
00553
00554 template<class Type, template<class> class PatchField, class GeoMesh>
00555 Ostream& operator<<
00556 (
00557 Ostream&,
00558 const typename GeometricField<Type, PatchField, GeoMesh>::
00559 GeometricBoundaryField&
00560 );
00561
00562
00563
00564
00565 }
00566
00567
00568
00569 #include "GeometricFieldI.H"
00570
00571 #ifdef NoRepository
00572 # include "GeometricField.C"
00573 #endif
00574
00575 #include "GeometricFieldFunctions.H"
00576
00577
00578
00579 #endif
00580
00581