gaussLaplacianSchemes.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 "gaussLaplacianScheme.H"
00028 #include "fvMesh.H"
00029
00030
00031
00032 namespace Foam
00033 {
00034 namespace fv
00035 {
00036 makeFvLaplacianScheme(gaussLaplacianScheme)
00037 }
00038 }
00039
00040 #define declareFvmLaplacianScalarGamma(Type) \
00041 \
00042 template<> \
00043 Foam::tmp<Foam::fvMatrix<Foam::Type> > \
00044 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
00045 ( \
00046 const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
00047 GeometricField<Type, fvPatchField, volMesh>& vf \
00048 ) \
00049 { \
00050 const fvMesh& mesh = this->mesh(); \
00051 \
00052 GeometricField<scalar, fvsPatchField, surfaceMesh> gammaMagSf \
00053 ( \
00054 gamma*mesh.magSf() \
00055 ); \
00056 \
00057 tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(gammaMagSf, vf); \
00058 fvMatrix<Type>& fvm = tfvm(); \
00059 \
00060 if (this->tsnGradScheme_().corrected()) \
00061 { \
00062 if (mesh.fluxRequired(vf.name())) \
00063 { \
00064 fvm.faceFluxCorrectionPtr() = new \
00065 GeometricField<Type, fvsPatchField, surfaceMesh> \
00066 ( \
00067 gammaMagSf*this->tsnGradScheme_().correction(vf) \
00068 ); \
00069 \
00070 fvm.source() -= \
00071 mesh.V()* \
00072 fvc::div \
00073 ( \
00074 *fvm.faceFluxCorrectionPtr() \
00075 )().internalField(); \
00076 } \
00077 else \
00078 { \
00079 fvm.source() -= \
00080 mesh.V()* \
00081 fvc::div \
00082 ( \
00083 gammaMagSf*this->tsnGradScheme_().correction(vf) \
00084 )().internalField(); \
00085 } \
00086 } \
00087 \
00088 return tfvm; \
00089 } \
00090 \
00091 \
00092 template<> \
00093 Foam::tmp<Foam::GeometricField<Foam::Type, Foam::fvPatchField, Foam::volMesh> >\
00094 Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvcLaplacian \
00095 ( \
00096 const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
00097 const GeometricField<Type, fvPatchField, volMesh>& vf \
00098 ) \
00099 { \
00100 const fvMesh& mesh = this->mesh(); \
00101 \
00102 tmp<GeometricField<Type, fvPatchField, volMesh> > tLaplacian \
00103 ( \
00104 fvc::div(gamma*this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) \
00105 ); \
00106 \
00107 tLaplacian().rename("laplacian(" + gamma.name() + ',' + vf.name() + ')');\
00108 \
00109 return tLaplacian; \
00110 }
00111
00112
00113 declareFvmLaplacianScalarGamma(scalar);
00114 declareFvmLaplacianScalarGamma(vector);
00115 declareFvmLaplacianScalarGamma(sphericalTensor);
00116 declareFvmLaplacianScalarGamma(symmTensor);
00117 declareFvmLaplacianScalarGamma(tensor);
00118
00119
00120
Copyright © 2000-2009 OpenCFD Ltd