
[Sponsors] 
November 2, 2012, 11:58 
LaplacianFoam with nonconstant Diffusion Coefficient

#1 
New Member

Hi FOAMERS,
I want to solve the laplacian equation for heat transfer in a solid.It's a very simple problem. But I want to use a nonconstant Diffusion coefficient{fvm::ddt(T)  fvm::laplacian(Diff, T) }. It is simple too. I have add the below part to laplacianFoam.C and compile it again. There isn't any problem in compiling but when I run a case it doesn't work correctly. the problem is that the new solver doesn't consider the new Diff. I think the problem is in converting volScalarField to Diff in laplacian equation. The added part: //************************************************** ************* volScalarField Diff ( IOobject ( "Diff", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero",dimensionSet(0,2,1,0,0),0.0) ); Diff=kvan*uStar*(Depthmesh.C().component(1))*exp(1*kStar*(Depthmesh.C().component(1))); solve ( fvm::ddt(T)  fvm::laplacian(Diff, T) ); //************************************************** ********** Every opinion would be appreciated. 

November 5, 2012, 03:19 

#2 
Member
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 5 
Hi,
have you tried to convert the volScalarField to a surfaceScalarField with interpolate(...)? regards treima 

November 5, 2012, 14:55 

#3 
New Member

Dear Treima,
tanx for your post, but this parameter is a volScalarField and converting it to surfaceScalarField will not solve the problem. In addition if you have a look to this post; http://www.cfdonline.com/Forums/openfoamprogrammingdevelopment/81698nonconstantdiffusioncoefficient.html then you will accept my opinion. I am very complicated why I run the case it seems that the Diff is equal zero!!! Regards, Ali 

November 6, 2012, 14:29 

#4 
New Member
M.Sabouri
Join Date: Oct 2012
Posts: 2
Rep Power: 0 
Hi,
It is not clear what kind of error you have encountered. It seems that the code runs without any error, but you see no change in the results with respect to the original case. Is it the problem? If so, you may have forgotten to delete the first declaration for the Diff and the new Diff could be defined because of overloading capability. But the code uses the first scalar Diff. 

November 6, 2012, 17:41 
Converting volScalarField to dimensionedScalar

#5 
New Member

Dear Sab(Sboori);
Thank you for your advice. Let me explain two situations: 1 When I use DT(dimensionedScalar: a constant value) in createFields there isn't any problem and the results are OK. 2 When I use Diff(volScalarField: a nonconstant value) in createFields there isn't any problem in compiling the code but when I run a case with new solver it seems that the Diff is equal to zero.I mean the equation is solved with Diff(or DT) =0.(please see:Nonconstant Diffusion Coefficient) I don't know why but I think the problem is related to definition of Diff as a volScalarField. I am waiting for your advice. Regards, Ali 

November 6, 2012, 18:01 

#6 
New Member
M. Sabouri
Join Date: Nov 2011
Posts: 22
Rep Power: 5 
Have you checked the Diff before using it in the solve (...) ?
for example using : Info << Diff; before solve? 

November 7, 2012, 04:40 

#7 
New Member

Dear Moslem,
Tanx for your comment. In fact, when I run the new solver there isn't any result. It gives me "T" in each time step but it seems that the solver solves laplacian equation with Diff=0. I have changed the value and even its function but the problem have not been solved. I think the problem is related to the considering a volScalarField as Diff. coefficient in laplacian equation. I have checked the value of Diff in each time step and they were correct but these values were not put in laplacian equation. I am waiting for your solutions! Regards, Ali 

November 7, 2012, 06:32 

#8 
New Member
M. Sabouri
Join Date: Nov 2011
Posts: 22
Rep Power: 5 
Hi,
There is no problem with that. I tested a simple problem (rectangle of uniform initial temperature and a higher temp on the top). with: kvan=1.0 kStar=1.0 uStar=1.0 Depth=1.0 Last edited by Moslem; November 7, 2012 at 11:49. 

November 8, 2012, 05:35 
The problem was solved

#9 
New Member

Dear Moslem,
Thanks for your useful post. I checked my code few times and found the problem. The function for Diff in my code is a function of depth(z) and its value for z=0 is 0 so in the top of domain Diff=0. So there isn't any transportation of heat. so it sees that the Diff=0. I edited the the code and the problem was solved. Tanx a lot!! Regards, Ali 

July 14, 2013, 14:32 

#10 
Member
Join Date: Jun 2011
Posts: 65
Rep Power: 6 
Hi there!!
I am trying to solve the laplace's equation for a scalar phi over an arbitrary domain!! do you know how I should modify the laplacianFoam application?? I have noticed in the .C file the laplacian application has 2 inputs and I just need one of them: laplacian(phi). By the moment, the steps I have followed have been: 1) create my phi volScalarField in the same manner as T in the original laplacianFoam, and comment the rest 2) leave the original libraries in the top of the laplacianFoam.C file and modify the diffusion equation by solve ( fvm::laplacian(phi); ); It should be very easy, but I don't see the mistake! Thanks a lot! 

July 15, 2013, 13:10 

#11  
New Member
M. Sabouri
Join Date: Nov 2011
Posts: 22
Rep Power: 5 
Quote:
Find the attachment. steadyLaplacian.zip plate.zip 

July 16, 2013, 07:47 

#12 
Member
Join Date: Jun 2011
Posts: 65
Rep Power: 6 
It works! Thanks a lot, Moslem!


July 31, 2013, 02:17 
Problem compiling laplacianFoam

#13 
Member
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 4 
Hi all,
I have made some changes to laplacianfoam and I want to run it, but wmake gives following error: error: simpleControl.H could not be found Any ideas why this could be happening? 

Tags 
diffusion coefficient, laplacianfoam 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Moving mesh  Niklas Wikstrom (Wikstrom)  OpenFOAM Running, Solving & CFD  122  June 15, 2014 06:20 
How to install CGNS under windows xp?  lzgwhy  Main CFD Forum  1  January 11, 2011 19:44 
CGNS lib and Fortran compiler  manaliac  Main CFD Forum  2  November 29, 2010 07:25 
TwoPhase Buoyant Flow Issue  Miguel Baritto  CFX  4  August 31, 2006 12:02 
Species diffusion coefficient  iceabc  FLUENT  1  June 10, 2004 10:04 