CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

LaplacianFoam with non-constant Diffusion Coefficient

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2012, 11:58
Default LaplacianFoam with non-constant Diffusion Coefficient
  #1
New Member
 
Ali Abbasi
Join Date: Apr 2012
Location: Delft, The Netherlands
Posts: 12
Rep Power: 14
aabbasi59 is on a distinguished road
Send a message via Skype™ to aabbasi59
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 non-constant 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*(Depth-mesh.C().component(1))*exp(-1*kStar*(Depth-mesh.C().component(1)));

solve
(
fvm::ddt(T) - fvm::laplacian(Diff, T)
);


//************************************************** **********
Every opinion would be appreciated.
aabbasi59 is offline   Reply With Quote

Old   November 5, 2012, 03:19
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14
treima is on a distinguished road
Hi,

have you tried to convert the volScalarField to a surfaceScalarField with interpolate(...)?


regards

treima
treima is offline   Reply With Quote

Old   November 5, 2012, 14:55
Default
  #3
New Member
 
Ali Abbasi
Join Date: Apr 2012
Location: Delft, The Netherlands
Posts: 12
Rep Power: 14
aabbasi59 is on a distinguished road
Send a message via Skype™ to aabbasi59
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.cfd-online.com/Forums/openfoam-programming-development/81698-non-constant-diffusion-coefficient.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
aabbasi59 is offline   Reply With Quote

Old   November 6, 2012, 14:29
Default
  #4
Sab
New Member
 
M.Sabouri
Join Date: Oct 2012
Posts: 2
Rep Power: 0
Sab is on a distinguished road
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.
Sab is offline   Reply With Quote

Old   November 6, 2012, 17:41
Default Converting volScalarField to dimensionedScalar
  #5
New Member
 
Ali Abbasi
Join Date: Apr 2012
Location: Delft, The Netherlands
Posts: 12
Rep Power: 14
aabbasi59 is on a distinguished road
Send a message via Skype™ to aabbasi59
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 non-constant 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.cfd-online.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
aabbasi59 is offline   Reply With Quote

Old   November 6, 2012, 18:01
Default
  #6
New Member
 
M. Sabouri
Join Date: Nov 2011
Posts: 24
Rep Power: 15
Moslem is on a distinguished road
Have you checked the Diff before using it in the solve (...) ?
for example using :
Info << Diff;
before solve?
Moslem is offline   Reply With Quote

Old   November 7, 2012, 04:40
Default
  #7
New Member
 
Ali Abbasi
Join Date: Apr 2012
Location: Delft, The Netherlands
Posts: 12
Rep Power: 14
aabbasi59 is on a distinguished road
Send a message via Skype™ to aabbasi59
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
aabbasi59 is offline   Reply With Quote

Old   November 7, 2012, 06:32
Default
  #8
New Member
 
M. Sabouri
Join Date: Nov 2011
Posts: 24
Rep Power: 15
Moslem is on a distinguished road
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
Attached Images
File Type: jpg Initial.jpg (44.0 KB, 38 views)
File Type: jpg final_T.jpg (44.0 KB, 38 views)

Last edited by Moslem; November 7, 2012 at 11:49.
Moslem is offline   Reply With Quote

Old   November 8, 2012, 05:35
Default The problem was solved
  #9
New Member
 
Ali Abbasi
Join Date: Apr 2012
Location: Delft, The Netherlands
Posts: 12
Rep Power: 14
aabbasi59 is on a distinguished road
Send a message via Skype™ to aabbasi59
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
aabbasi59 is offline   Reply With Quote

Old   July 14, 2013, 15:32
Default
  #10
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 15
maalan is on a distinguished road
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!
maalan is offline   Reply With Quote

Old   July 15, 2013, 14:10
Default
  #11
New Member
 
M. Sabouri
Join Date: Nov 2011
Posts: 24
Rep Power: 15
Moslem is on a distinguished road
Quote:
Originally Posted by maalan View Post
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!
Hi,
Find the attachment.
steadyLaplacian.zip

plate.zip
Moslem is offline   Reply With Quote

Old   July 16, 2013, 08:47
Default
  #12
Member
 
Join Date: Jun 2011
Posts: 80
Rep Power: 15
maalan is on a distinguished road
It works! Thanks a lot, Moslem!
maalan is offline   Reply With Quote

Old   July 31, 2013, 03:17
Default Problem compiling laplacianFoam
  #13
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
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?
hrushi.397 is offline   Reply With Quote

Reply

Tags
diffusion coefficient, laplacianfoam


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07: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
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 13:02
Species diffusion coefficient iceabc FLUENT 1 June 10, 2004 11:04


All times are GMT -4. The time now is 14:18.