LaplacianFoam with nonconstant Diffusion Coefficient
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. 
Hi,
have you tried to convert the volScalarField to a surfaceScalarField with interpolate(...)? regards treima 
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 
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. 
Converting volScalarField to dimensionedScalar
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:http://www.cfdonline.com/Forums/ope...efficient.html) 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 
Have you checked the Diff before using it in the solve (...) ?
for example using : Info << Diff; before solve? 
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! :confused: Regards, Ali 
2 Attachment(s)
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 
The problem was solved
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. :D Tanx a lot!! Regards, Ali 
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! 
2 Attachment(s)
Quote:
Find the attachment. Attachment 23515 Attachment 23516 
It works! Thanks a lot, Moslem!

Problem compiling laplacianFoam
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? 
All times are GMT 4. The time now is 19:50. 