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 #ifndef fvMatrix_H
00038 #define fvMatrix_H
00039
00040 #include "volFields.H"
00041 #include "surfaceFields.H"
00042 #include "lduMatrix.H"
00043 #include "tmp.H"
00044 #include "autoPtr.H"
00045 #include "dimensionedTypes.H"
00046 #include "className.H"
00047
00048
00049
00050 namespace Foam
00051 {
00052
00053
00054
00055 template<class Type>
00056 class fvMatrix;
00057
00058 template<class Type>
00059 tmp<GeometricField<Type,fvPatchField,volMesh> > operator&
00060 (
00061 const fvMatrix<Type>&,
00062 const GeometricField<Type,fvPatchField,volMesh>&
00063 );
00064
00065 template<class Type>
00066 tmp<GeometricField<Type,fvPatchField,volMesh> > operator&
00067 (
00068 const fvMatrix<Type>&,
00069 const tmp<GeometricField<Type,fvPatchField,volMesh> >&
00070 );
00071
00072 template<class Type>
00073 tmp<GeometricField<Type,fvPatchField,volMesh> > operator&
00074 (
00075 const tmp<fvMatrix<Type> >&,
00076 const GeometricField<Type,fvPatchField,volMesh>&
00077 );
00078
00079 template<class Type>
00080 tmp<GeometricField<Type,fvPatchField,volMesh> > operator&
00081 (
00082 const tmp<fvMatrix<Type> >&,
00083 const tmp<GeometricField<Type,fvPatchField,volMesh> >&
00084 );
00085
00086 template<class Type>
00087 Ostream& operator<<(Ostream&, const fvMatrix<Type>&);
00088
00089
00090
00091
00092
00093
00094 template<class Type>
00095 class fvMatrix
00096 :
00097 public refCount,
00098 public lduMatrix
00099 {
00100
00101
00102
00103 GeometricField<Type, fvPatchField, volMesh>& psi_;
00104
00105
00106 dimensionSet dimensions_;
00107
00108
00109 Field<Type> source_;
00110
00111
00112
00113 FieldField<Field, Type> internalCoeffs_;
00114
00115
00116
00117 FieldField<Field, Type> boundaryCoeffs_;
00118
00119
00120
00121 mutable GeometricField<Type, fvPatchField, surfaceMesh>
00122 *faceFluxCorrectionPtr_;
00123
00124
00125
00126
00127
00128 template<class Type2>
00129 void addToInternalField
00130 (
00131 const unallocLabelList& addr,
00132 const Field<Type2>& pf,
00133 Field<Type2>& intf
00134 ) const;
00135
00136 template<class Type2>
00137 void addToInternalField
00138 (
00139 const unallocLabelList& addr,
00140 const tmp<Field<Type2> >& tpf,
00141 Field<Type2>& intf
00142 ) const;
00143
00144
00145 template<class Type2>
00146 void subtractFromInternalField
00147 (
00148 const unallocLabelList& addr,
00149 const Field<Type2>& pf,
00150 Field<Type2>& intf
00151 ) const;
00152
00153 template<class Type2>
00154 void subtractFromInternalField
00155 (
00156 const unallocLabelList& addr,
00157 const tmp<Field<Type2> >& tpf,
00158 Field<Type2>& intf
00159 ) const;
00160
00161
00162
00163
00164 void addBoundaryDiag
00165 (
00166 scalarField& diag,
00167 const direction cmpt
00168 ) const;
00169
00170 void addCmptAvBoundaryDiag(scalarField& diag) const;
00171
00172 void addBoundarySource(Field<Type>& source) const;
00173
00174 void addBoundarySource
00175 (
00176 scalarField& source,
00177 const direction cmpt
00178 ) const;
00179
00180
00181 public:
00182
00183 ClassName("fvMatrix");
00184
00185
00186
00187
00188
00189 fvMatrix
00190 (
00191 GeometricField<Type, fvPatchField, volMesh>&,
00192 const dimensionSet&
00193 );
00194
00195
00196 fvMatrix(const fvMatrix<Type>&);
00197
00198
00199 # ifdef ConstructFromTmp
00200 fvMatrix(const tmp<fvMatrix<Type> >&);
00201 # endif
00202
00203
00204 fvMatrix(GeometricField<Type, fvPatchField, volMesh>&, Istream&);
00205
00206
00207
00208
00209 virtual ~fvMatrix();
00210
00211
00212
00213
00214
00215
00216 const GeometricField<Type, fvPatchField, volMesh>& psi() const
00217 {
00218 return psi_;
00219 }
00220
00221 GeometricField<Type, fvPatchField, volMesh>& psi()
00222 {
00223 return psi_;
00224 }
00225
00226 const dimensionSet& dimensions() const
00227 {
00228 return dimensions_;
00229 }
00230
00231 Field<Type>& source()
00232 {
00233 return source_;
00234 }
00235
00236 const Field<Type>& source() const
00237 {
00238 return source_;
00239 }
00240
00241
00242
00243 FieldField<Field, Type>& internalCoeffs()
00244 {
00245 return internalCoeffs_;
00246 }
00247
00248
00249
00250 FieldField<Field, Type>& boundaryCoeffs()
00251 {
00252 return boundaryCoeffs_;
00253 }
00254
00255
00256
00257 typedef GeometricField<Type, fvPatchField, surfaceMesh>
00258 *surfaceTypeFieldPtr;
00259
00260
00261 surfaceTypeFieldPtr& faceFluxCorrectionPtr()
00262 {
00263 return faceFluxCorrectionPtr_;
00264 }
00265
00266
00267
00268
00269
00270
00271 void setValues
00272 (
00273 const labelList& cells,
00274 const Field<Type>& values
00275 );
00276
00277
00278 void setReference
00279 (
00280 const label cell,
00281 const Type& value
00282 );
00283
00284
00285
00286 void setComponentReference
00287 (
00288 const label patchi,
00289 const label facei,
00290 const direction cmpt,
00291 const scalar value
00292 );
00293
00294
00295
00296
00297
00298 void relax(const scalar alpha);
00299
00300
00301
00302 void relax();
00303
00304
00305
00306 lduMatrix::solverPerformance solve(Istream&);
00307
00308
00309
00310 lduMatrix::solverPerformance solve();
00311
00312
00313 tmp<Field<Type> > residual() const;
00314
00315
00316 tmp<scalarField> D() const;
00317
00318
00319 tmp<volScalarField> A() const;
00320
00321
00322 tmp<GeometricField<Type, fvPatchField, volMesh> > H() const;
00323
00324
00325 tmp<GeometricField<Type, fvPatchField, surfaceMesh> > flux() const;
00326
00327
00328
00329
00330 void operator=(const fvMatrix<Type>&);
00331 void operator=(const tmp<fvMatrix<Type> >&);
00332
00333 void negate();
00334
00335 void operator+=(const fvMatrix<Type>&);
00336 void operator+=(const tmp<fvMatrix<Type> >&);
00337
00338 void operator-=(const fvMatrix<Type>&);
00339 void operator-=(const tmp<fvMatrix<Type> >&);
00340
00341 void operator+=(const GeometricField<Type,fvPatchField,volMesh>&);
00342 void operator+=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
00343
00344 void operator-=(const GeometricField<Type,fvPatchField,volMesh>&);
00345 void operator-=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
00346
00347 void operator+=(const dimensioned<Type>&);
00348 void operator-=(const dimensioned<Type>&);
00349
00350 void operator*=(const volScalarField&);
00351 void operator*=(const tmp<volScalarField>&);
00352
00353 void operator*=(const dimensioned<scalar>&);
00354
00355
00356
00357
00358 friend tmp<GeometricField<Type,fvPatchField,volMesh> > operator& <Type>
00359 (
00360 const fvMatrix<Type>&,
00361 const GeometricField<Type,fvPatchField,volMesh>&
00362 );
00363
00364 friend tmp<GeometricField<Type,fvPatchField,volMesh> > operator& <Type>
00365 (
00366 const fvMatrix<Type>&,
00367 const tmp<GeometricField<Type,fvPatchField,volMesh> >&
00368 );
00369
00370 friend tmp<GeometricField<Type,fvPatchField,volMesh> > operator& <Type>
00371 (
00372 const tmp<fvMatrix<Type> >&,
00373 const GeometricField<Type,fvPatchField,volMesh>&
00374 );
00375
00376 friend tmp<GeometricField<Type,fvPatchField,volMesh> > operator& <Type>
00377 (
00378 const tmp<fvMatrix<Type> >&,
00379 const tmp<GeometricField<Type,fvPatchField,volMesh> >&
00380 );
00381
00382
00383
00384
00385 friend Ostream& operator<< <Type>
00386 (
00387 Ostream&,
00388 const fvMatrix<Type>&
00389 );
00390 };
00391
00392
00393
00394
00395 template<class Type>
00396 void checkMethod
00397 (
00398 const fvMatrix<Type>&,
00399 const fvMatrix<Type>&,
00400 const char*
00401 );
00402
00403 template<class Type>
00404 void checkMethod
00405 (
00406 const fvMatrix<Type>&,
00407 const GeometricField<Type, fvPatchField, volMesh>&,
00408 const char*
00409 );
00410
00411 template<class Type>
00412 void checkMethod
00413 (
00414 const fvMatrix<Type>&,
00415 const dimensioned<Type>&,
00416 const char*
00417 );
00418
00419
00420
00421
00422 template<class Type>
00423 lduMatrix::solverPerformance solve(fvMatrix<Type>&, Istream&);
00424
00425
00426
00427
00428
00429 template<class Type>
00430 lduMatrix::solverPerformance solve(const tmp<fvMatrix<Type> >&, Istream&);
00431
00432
00433
00434
00435 template<class Type>
00436 lduMatrix::solverPerformance solve(fvMatrix<Type>&);
00437
00438
00439
00440
00441
00442 template<class Type>
00443 lduMatrix::solverPerformance solve(const tmp<fvMatrix<Type> >&);
00444
00445
00446
00447
00448 template<class Type>
00449 tmp<fvMatrix<Type> > operator-
00450 (
00451 const fvMatrix<Type>&
00452 );
00453
00454 template<class Type>
00455 tmp<fvMatrix<Type> > operator-
00456 (
00457 const tmp<fvMatrix<Type> >&
00458 );
00459
00460 template<class Type>
00461 tmp<fvMatrix<Type> > operator+
00462 (
00463 const fvMatrix<Type>&,
00464 const fvMatrix<Type>&
00465 );
00466
00467 template<class Type>
00468 tmp<fvMatrix<Type> > operator+
00469 (
00470 const tmp<fvMatrix<Type> >&,
00471 const fvMatrix<Type>&
00472 );
00473
00474 template<class Type>
00475 tmp<fvMatrix<Type> > operator+
00476 (
00477 const fvMatrix<Type>&,
00478 const tmp<fvMatrix<Type> >&
00479 );
00480
00481 template<class Type>
00482 tmp<fvMatrix<Type> > operator+
00483 (
00484 const tmp<fvMatrix<Type> >&,
00485 const tmp<fvMatrix<Type> >&
00486 );
00487
00488 template<class Type>
00489 tmp<fvMatrix<Type> > operator-
00490 (
00491 const fvMatrix<Type>&,
00492 const fvMatrix<Type>&
00493 );
00494
00495 template<class Type>
00496 tmp<fvMatrix<Type> > operator-
00497 (
00498 const tmp<fvMatrix<Type> >&,
00499 const fvMatrix<Type>&
00500 );
00501
00502 template<class Type>
00503 tmp<fvMatrix<Type> > operator-
00504 (
00505 const fvMatrix<Type>&,
00506 const tmp<fvMatrix<Type> >&
00507 );
00508
00509 template<class Type>
00510 tmp<fvMatrix<Type> > operator-
00511 (
00512 const tmp<fvMatrix<Type> >&,
00513 const tmp<fvMatrix<Type> >&
00514 );
00515
00516 template<class Type>
00517 tmp<fvMatrix<Type> > operator==
00518 (
00519 const fvMatrix<Type>&,
00520 const fvMatrix<Type>&
00521 );
00522
00523 template<class Type>
00524 tmp<fvMatrix<Type> > operator==
00525 (
00526 const tmp<fvMatrix<Type> >&,
00527 const fvMatrix<Type>&
00528 );
00529
00530 template<class Type>
00531 tmp<fvMatrix<Type> > operator==
00532 (
00533 const fvMatrix<Type>&,
00534 const tmp<fvMatrix<Type> >&
00535 );
00536
00537 template<class Type>
00538 tmp<fvMatrix<Type> > operator==
00539 (
00540 const tmp<fvMatrix<Type> >&,
00541 const tmp<fvMatrix<Type> >&
00542 );
00543
00544 template<class Type>
00545 tmp<fvMatrix<Type> > operator+
00546 (
00547 const fvMatrix<Type>&,
00548 const GeometricField<Type, fvPatchField, volMesh>&
00549 );
00550
00551 template<class Type>
00552 tmp<fvMatrix<Type> > operator+
00553 (
00554 const tmp<fvMatrix<Type> >&,
00555 const GeometricField<Type, fvPatchField, volMesh>&
00556 );
00557
00558 template<class Type>
00559 tmp<fvMatrix<Type> > operator+
00560 (
00561 const fvMatrix<Type>&,
00562 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00563 );
00564
00565 template<class Type>
00566 tmp<fvMatrix<Type> > operator+
00567 (
00568 const tmp<fvMatrix<Type> >&,
00569 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00570 );
00571
00572 template<class Type>
00573 tmp<fvMatrix<Type> > operator+
00574 (
00575 const GeometricField<Type, fvPatchField, volMesh>&,
00576 const fvMatrix<Type>&
00577 );
00578
00579 template<class Type>
00580 tmp<fvMatrix<Type> > operator+
00581 (
00582 const GeometricField<Type, fvPatchField, volMesh>&,
00583 const tmp<fvMatrix<Type> >&
00584 );
00585
00586 template<class Type>
00587 tmp<fvMatrix<Type> > operator+
00588 (
00589 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00590 const fvMatrix<Type>&
00591 );
00592
00593 template<class Type>
00594 tmp<fvMatrix<Type> > operator+
00595 (
00596 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00597 const tmp<fvMatrix<Type> >&
00598 );
00599
00600 template<class Type>
00601 tmp<fvMatrix<Type> > operator-
00602 (
00603 const fvMatrix<Type>&,
00604 const GeometricField<Type, fvPatchField, volMesh>&
00605 );
00606
00607 template<class Type>
00608 tmp<fvMatrix<Type> > operator-
00609 (
00610 const tmp<fvMatrix<Type> >&,
00611 const GeometricField<Type, fvPatchField, volMesh>&
00612 );
00613
00614 template<class Type>
00615 tmp<fvMatrix<Type> > operator-
00616 (
00617 const fvMatrix<Type>&,
00618 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00619 );
00620
00621 template<class Type>
00622 tmp<fvMatrix<Type> > operator-
00623 (
00624 const tmp<fvMatrix<Type> >&,
00625 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00626 );
00627
00628 template<class Type>
00629 tmp<fvMatrix<Type> > operator-
00630 (
00631 const GeometricField<Type, fvPatchField, volMesh>&,
00632 const fvMatrix<Type>&
00633 );
00634
00635 template<class Type>
00636 tmp<fvMatrix<Type> > operator-
00637 (
00638 const GeometricField<Type, fvPatchField, volMesh>&,
00639 const tmp<fvMatrix<Type> >&
00640 );
00641
00642 template<class Type>
00643 tmp<fvMatrix<Type> > operator-
00644 (
00645 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00646 const fvMatrix<Type>&
00647 );
00648
00649 template<class Type>
00650 tmp<fvMatrix<Type> > operator-
00651 (
00652 const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
00653 const tmp<fvMatrix<Type> >&
00654 );
00655
00656 template<class Type>
00657 tmp<fvMatrix<Type> > operator+
00658 (
00659 const tmp<fvMatrix<Type> >&,
00660 const dimensioned<Type>&
00661 );
00662
00663 template<class Type>
00664 tmp<fvMatrix<Type> > operator+
00665 (
00666 const dimensioned<Type>&,
00667 const tmp<fvMatrix<Type> >&
00668 );
00669
00670 template<class Type>
00671 tmp<fvMatrix<Type> > operator-
00672 (
00673 const tmp<fvMatrix<Type> >&,
00674 const dimensioned<Type>&
00675 );
00676
00677 template<class Type>
00678 tmp<fvMatrix<Type> > operator-
00679 (
00680 const dimensioned<Type>&,
00681 const tmp<fvMatrix<Type> >&
00682 );
00683
00684 template<class Type>
00685 tmp<fvMatrix<Type> > operator==
00686 (
00687 const fvMatrix<Type>&,
00688 const GeometricField<Type, fvPatchField, volMesh>&
00689 );
00690
00691 template<class Type>
00692 tmp<fvMatrix<Type> > operator==
00693 (
00694 const tmp<fvMatrix<Type> >&,
00695 const GeometricField<Type, fvPatchField, volMesh>&
00696 );
00697
00698 template<class Type>
00699 tmp<fvMatrix<Type> > operator==
00700 (
00701 const fvMatrix<Type>&,
00702 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00703 );
00704
00705 template<class Type>
00706 tmp<fvMatrix<Type> > operator==
00707 (
00708 const tmp<fvMatrix<Type> >&,
00709 const tmp<GeometricField<Type, fvPatchField, volMesh> >&
00710 );
00711
00712 template<class Type>
00713 tmp<fvMatrix<Type> > operator==
00714 (
00715 const fvMatrix<Type>&,
00716 const dimensioned<Type>&
00717 );
00718
00719 template<class Type>
00720 tmp<fvMatrix<Type> > operator==
00721 (
00722 const tmp<fvMatrix<Type> >&,
00723 const dimensioned<Type>&
00724 );
00725
00726
00727 template<class Type>
00728 tmp<fvMatrix<Type> > operator*
00729 (
00730 const volScalarField&,
00731 const fvMatrix<Type>&
00732 );
00733
00734 template<class Type>
00735 tmp<fvMatrix<Type> > operator*
00736 (
00737 const volScalarField&,
00738 const tmp<fvMatrix<Type> >&
00739 );
00740
00741 template<class Type>
00742 tmp<fvMatrix<Type> > operator*
00743 (
00744 const tmp<volScalarField>&,
00745 const fvMatrix<Type>&
00746 );
00747
00748 template<class Type>
00749 tmp<fvMatrix<Type> > operator*
00750 (
00751 const tmp<volScalarField>&,
00752 const tmp<fvMatrix<Type> >&
00753 );
00754
00755
00756 template<class Type>
00757 tmp<fvMatrix<Type> > operator*
00758 (
00759 const dimensioned<scalar>&,
00760 const fvMatrix<Type>&
00761 );
00762
00763 template<class Type>
00764 tmp<fvMatrix<Type> > operator*
00765 (
00766 const dimensioned<scalar>&,
00767 const tmp<fvMatrix<Type> >&
00768 );
00769
00770
00771
00772
00773 }
00774
00775
00776
00777 #ifdef NoRepository
00778 # include "fvMatrix.C"
00779 #endif
00780
00781
00782
00783 #endif
00784
00785