# laplacian

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 26, 2011, 14:24 laplacian #1 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,195 Blog Entries: 1 Rep Power: 16 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, 06:07 #2 Senior Member   Cyprien Join Date: Feb 2010 Location: Stanford University Posts: 246 Rep Power: 10 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)) because you have the following relationship: Code: fvm::laplacian(K,T) = K*fvm::laplacian(T) + (fvc::grad(T) & fvc::grad(K)) In the programmer guide P-38 you can notice that the laplacian term is coded with the diffusion term which allow you to use a variable diffusion. Best, Cyp

 May 3, 2011, 08:51 #3 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,195 Blog Entries: 1 Rep Power: 16 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, 14:13 #4 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 16 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 00187 tmp > 00188 gaussLaplacianScheme::fvcLaplacian 00189 ( 00190 const GeometricField& gamma, 00191 const GeometricField& 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 SfGammaSn = SfGamma & Sn; 00200 surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; 00201 00202 tmp > 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 00128 tmp > 00129 gaussLaplacianScheme::fvcLaplacian 00130 ( 00131 const GeometricField& vf 00132 ) 00133 { 00134 const fvMesh& mesh = this->mesh(); 00135 00136 tmp > 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 00148 tmp > 00149 gaussLaplacianScheme::fvmLaplacian 00150 ( 00151 const GeometricField& gamma, 00152 GeometricField& 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 SfGammaSn = SfGamma & Sn; 00161 surfaceVectorField SfGammaCorr = SfGamma - SfGammaSn*Sn; 00162 00163 tmp > tfvm = fvmLaplacianUncorrected(SfGammaSn, vf); 00164 fvMatrix& fvm = tfvm(); 00165 00166 tmp > 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 } and for d, from fvmLaplacian.C Code: 00069 template 00070 tmp > 00071 laplacian 00072 ( 00073 GeometricField& 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 } from the last it is clear that d=c, with Gamma=1. Finally the correct implicit formulation in #1 is 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, 14:45 #5 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,195 Blog Entries: 1 Rep Power: 16 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, 15:32 #6 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 16 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, 16:04 #7 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,195 Blog Entries: 1 Rep Power: 16 now i add the energy equation into interFoam i even consider evaporation, im just in doubt which one of the above expression is suitable for conduction term?

 May 9, 2011, 16:06 #8 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 16 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

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Jun CFX 16 October 24, 2013 17:21 anon_c Fluent UDF and Scheme Programming 4 August 5, 2013 17:23 mlawson OpenFOAM Running, Solving & CFD 11 September 7, 2011 12:30 OFCrash OpenFOAM Running, Solving & CFD 1 February 1, 2010 08:32 novyno OpenFOAM 1 November 23, 2009 20:31

All times are GMT -4. The time now is 09:34.