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