|
[Sponsors] |
April 26, 2011, 15:24 |
laplacian
|
#1 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
hi foamer
i have a term like this in my equations del(K del (T)) K is not constant! which one of following openFOAM expression is correct for above term? 1) fvm :: laplacian ( K,T) 2)fvm::laplacian(K , T) + (fvc::grad(T) & fvc::grad(K)) |
|
April 27, 2011, 07:07 |
|
#2 |
Senior Member
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18 |
Hi Nimasam !
It is the first expression which is correct otherwise it would be : Code:
K*fvm::laplacian(T) + (fvc::grad(T) & fvc::grad(K)) Code:
fvm::laplacian(K,T) = K*fvm::laplacian(T) + (fvc::grad(T) & fvc::grad(K)) Best, Cyp |
|
May 3, 2011, 09:51 |
|
#3 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
are you sure following equation sides are equal?
fvm::laplacian(K,T) = K*fvm::laplacian(T) + (fvc::grad(T) & fvc::grad(K)) i used both of them in code and i received different answers! |
|
May 3, 2011, 15:13 |
|
#4 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
I think it depends on the kind of operation you want to, namely:
1. Implicit (fvm) 2. Explicit (fvc) 3. Mixed treatment from Programmer's Guide Table 2.2 we have for laplacian: Laplacian Implicit/Explicit \nabla^2\phi laplacian(phi) (1) \nabla\cdot\Gamma\nabla\phi laplacian(Gamma, phi) (2) then both in implicit and explicit treatment we have the operator with and without Gamma within the divergence. In the first case (1) constant gamma is assumed, in (2) laplacian(Gamma, phi) expands in the div-grad formulation intended for variable Gamma. So we have four cases, a. Explicit, variable Gamma b. Explicit, constant Gamma (no gamma within the operator) c. Implicit, variable Gamma d. Implicit, constant Gamma (no gamma within the operator) a and b give geometricField as a result and c and d fvMatrix (implying an integration). Reading the code we have in gaussLaplacianScheme.C, for a, b, c Code:
00186 template<class Type, class GType> 00187 tmp<GeometricField<Type, fvPatchField, volMesh> > 00188 gaussLaplacianScheme<Type, GType>::fvcLaplacian 00189 ( 00190 const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma, 00191 const GeometricField<Type, fvPatchField, volMesh>& vf 00192 ) 00193 { 00194 const fvMesh& mesh = this->mesh(); 00195 00196 surfaceVectorField Sn = mesh.Sf()/mesh.magSf(); 00197 00198 surfaceVectorField SfGamma = mesh.Sf() & gamma; 00199 GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn = SfGamma & Sn; 00200 surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; 00201 00202 tmp<GeometricField<Type, fvPatchField, volMesh> > tLaplacian 00203 ( 00204 fvc::div 00205 ( 00206 SfGammaSn*this->tsnGradScheme_().snGrad(vf) 00207 + gammaSnGradCorr(SfGammaCorr, vf) 00208 ) 00209 ); 00210 00211 tLaplacian().rename("laplacian(" + gamma.name() + ',' + vf.name() + ')'); 00212 00213 return tLaplacian; 00214 } 00127 template<class Type, class GType> 00128 tmp<GeometricField<Type, fvPatchField, volMesh> > 00129 gaussLaplacianScheme<Type, GType>::fvcLaplacian 00130 ( 00131 const GeometricField<Type, fvPatchField, volMesh>& vf 00132 ) 00133 { 00134 const fvMesh& mesh = this->mesh(); 00135 00136 tmp<GeometricField<Type, fvPatchField, volMesh> > tLaplacian 00137 ( 00138 fvc::div(this->tsnGradScheme_().snGrad(vf)*mesh.magSf()) 00139 ); 00140 00141 tLaplacian().rename("laplacian(" + vf.name() + ')'); 00142 00143 return tLaplacian; 00144 } 00147 template<class Type, class GType> 00148 tmp<fvMatrix<Type> > 00149 gaussLaplacianScheme<Type, GType>::fvmLaplacian 00150 ( 00151 const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma, 00152 GeometricField<Type, fvPatchField, volMesh>& vf 00153 ) 00154 { 00155 const fvMesh& mesh = this->mesh(); 00156 00157 surfaceVectorField Sn = mesh.Sf()/mesh.magSf(); 00158 00159 surfaceVectorField SfGamma = mesh.Sf() & gamma; 00160 GeometricField<scalar, fvsPatchField, surfaceMesh> SfGammaSn = SfGamma & Sn; 00161 surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; 00162 00163 tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(SfGammaSn, vf); 00164 fvMatrix<Type>& fvm = tfvm(); 00165 00166 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tfaceFluxCorrection 00167 = gammaSnGradCorr(SfGammaCorr, vf); 00168 00169 if (this->tsnGradScheme_().corrected()) 00170 { 00171 tfaceFluxCorrection() += 00172 SfGammaSn*this->tsnGradScheme_().correction(vf); 00173 } 00174 00175 fvm.source() -= mesh.V()*fvc::div(tfaceFluxCorrection())().internalField(); 00176 00177 if (mesh.fluxRequired(vf.name())) 00178 { 00179 fvm.faceFluxCorrectionPtr() = tfaceFluxCorrection.ptr(); 00180 } 00181 00182 return tfvm; 00183 } Code:
00069 template<class Type> 00070 tmp<fvMatrix<Type> > 00071 laplacian 00072 ( 00073 GeometricField<Type, fvPatchField, volMesh>& vf 00074 ) 00075 { 00076 surfaceScalarField Gamma 00077 ( 00078 IOobject 00079 ( 00080 "1", 00081 vf.time().constant(), 00082 vf.mesh(), 00083 IOobject::NO_READ 00084 ), 00085 vf.mesh(), 00086 dimensionedScalar("1", dimless, 1.0) 00087 ); 00088 00089 return fvm::laplacian 00090 ( 00091 Gamma, 00092 vf, 00093 "laplacian(" + vf.name() + ')' 00094 ); 00095 } 1) fvm::laplacian ( K,T) formulation given #3 fvm::laplacian(K,T) = K*fvm::laplacian(T) + (fvc::grad(T) & fvc::grad(K)) is a mixed one with the spatial variation of T treated implicitly and the spatial variation of K explicitly, the fvc part is put in the RHS, meanwhile fvm part contributes to the matrix, so that it is natural to hope different results (I think). Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
May 9, 2011, 15:45 |
|
#5 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
hi Santiago
thank you, for detailed response , now i find why these expressions give different numerical result now tell me which one of them i should choose for energy equation in two phase flow? when implicit manner is suitable and when explicit manner is useful? |
|
May 9, 2011, 16:32 |
|
#6 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
I think it is not very different to what is done in scalarTransportFoam solver. That includes variable scalar K (if it is tensorial things change a little bit).
Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
May 9, 2011, 17:06 |
|
#8 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
The first one.
Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
Tags |
laplacian |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modifying the laplacian operator | mlawson | OpenFOAM Running, Solving & CFD | 22 | July 16, 2018 05:56 |
How to calculate laplacian of a scalar in cfx? | Jun | CFX | 21 | March 2, 2018 10:08 |
laplacian operatorin udf | anon_c | Fluent UDF and Scheme Programming | 4 | August 5, 2013 18:23 |
why laplacian() failed | OFCrash | OpenFOAM Running, Solving & CFD | 1 | February 1, 2010 08:32 |
Probable bug with laplacian steady state | novyno | OpenFOAM | 1 | November 23, 2009 20:31 |