gaussConvectionScheme.C
Go to the documentation of this file.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 #include "gaussConvectionScheme.H"
00028 #include "fvcSurfaceIntegrate.H"
00029 #include "fvMatrices.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 namespace fv
00039 {
00040
00041
00042
00043 template<class Type>
00044 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00045 gaussConvectionScheme<Type>::interpolate
00046 (
00047 const surfaceScalarField&,
00048 const GeometricField<Type, fvPatchField, volMesh>& vf
00049 ) const
00050 {
00051 return tinterpScheme_().interpolate(vf);
00052 }
00053
00054
00055 template<class Type>
00056 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00057 gaussConvectionScheme<Type>::flux
00058 (
00059 const surfaceScalarField& faceFlux,
00060 const GeometricField<Type, fvPatchField, volMesh>& vf
00061 ) const
00062 {
00063 return faceFlux*interpolate(faceFlux, vf);
00064 }
00065
00066
00067 template<class Type>
00068 tmp<fvMatrix<Type> >
00069 gaussConvectionScheme<Type>::fvmDiv
00070 (
00071 const surfaceScalarField& faceFlux,
00072 GeometricField<Type, fvPatchField, volMesh>& vf
00073 ) const
00074 {
00075 tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf);
00076 const surfaceScalarField& weights = tweights();
00077
00078 tmp<fvMatrix<Type> > tfvm
00079 (
00080 new fvMatrix<Type>
00081 (
00082 vf,
00083 faceFlux.dimensions()*vf.dimensions()
00084 )
00085 );
00086 fvMatrix<Type>& fvm = tfvm();
00087
00088 fvm.lower() = -weights.internalField()*faceFlux.internalField();
00089 fvm.upper() = fvm.lower() + faceFlux.internalField();
00090 fvm.negSumDiag();
00091
00092 forAll(fvm.psi().boundaryField(), patchI)
00093 {
00094 const fvPatchField<Type>& psf = fvm.psi().boundaryField()[patchI];
00095 const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI];
00096 const fvsPatchScalarField& pw = weights.boundaryField()[patchI];
00097
00098 fvm.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw);
00099 fvm.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw);
00100 }
00101
00102 if (tinterpScheme_().corrected())
00103 {
00104 fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf));
00105 }
00106
00107 return tfvm;
00108 }
00109
00110
00111 template<class Type>
00112 tmp<GeometricField<Type, fvPatchField, volMesh> >
00113 gaussConvectionScheme<Type>::fvcDiv
00114 (
00115 const surfaceScalarField& faceFlux,
00116 const GeometricField<Type, fvPatchField, volMesh>& vf
00117 ) const
00118 {
00119 tmp<GeometricField<Type, fvPatchField, volMesh> > tConvection
00120 (
00121 fvc::surfaceIntegrate(flux(faceFlux, vf))
00122 );
00123
00124 tConvection().rename
00125 (
00126 "convection(" + faceFlux.name() + ',' + vf.name() + ')'
00127 );
00128
00129 return tConvection;
00130 }
00131
00132
00133
00134
00135 }
00136
00137
00138
00139 }
00140
00141
Copyright © 2000-2009 OpenCFD Ltd