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

write out nusselt number (gradient of T, respectively) for timesteps

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2009, 22:42
Default write out nusselt number (gradient of T, respectively) for timesteps
  #1
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 16
sven is on a distinguished road
I need to calculate a nusselt number for a body in a crossflow for different time steps. Does OpenFOAM provide a function which can do that? If not, can I somehow use the probing function to write out a temperature gradient at a wall, like I can write out fields at certain points? Has anyone ever done something like this? Thanks a lot!
sven is offline   Reply With Quote

Old   November 6, 2009, 05:38
Default
  #2
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi Sven,

You can see how I modified simpleFoam and turbFoam (now its pisoFoam) for determination of Sherwood number:

http://openfoamwiki.net/index.php/Co...mpleScalarFoam
http://openfoamwiki.net/index.php/Co...turbScalarFoam

There is some coding and recompilation involved, but not too difficult. Just make sure you use the adequate dimensions for temperature in place of mass fraction.

Regards,
Jose Santos
solefire and mm.abdollahzadeh like this.
santos is offline   Reply With Quote

Old   November 6, 2009, 22:01
Default
  #3
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 16
sven is on a distinguished road
Hey Sanots,

thanks for your answer. I had a look at your source Code files, especially at simpleScalarFoam.C. I think, what I need is something similar to the following lines in your code:

Code:
// Calculates kc and Sh on each patch
         Info<< "Calculating kc and Sh" << endl;

label patchi = mesh.boundaryMesh().findPatchID("electrode1");
label patchj = mesh.boundaryMesh().findPatchID("electrode2");

// kc = 1 / Tb * D * (dT/dy)_wall
                kc.boundaryField()[patchi] =
                  1/Tb.value()*DT.value()*-T.boundaryField()[patchi].snGrad();

                kc.boundaryField()[patchj] =
                  1/Tb.value()*DT.value()*-T.boundaryField()[patchj].snGrad();
I just want to get the gradient, so I guess it should look like this:

Code:
label patchi = mesh.boundaryMesh().findPatchID("myPatch");
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
Where "myPatch" is the name of the patch for which I want to get the Temperature gradient.
and at the end of the code I need something like

Code:
volScalarField output
           (
                IOobject
                (
                    "Sh",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),

        output=gradT
           );

        runTime.write();
Is it correct like this? Thanks a lot!
sven is offline   Reply With Quote

Old   November 7, 2009, 07:48
Default
  #4
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Yes, you are on the right track. Look below for my suggestion. Regards!

Code:
volScalarField gradT
            (
                IOobject
                (
                    "gradT",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mesh,
                dimensionedVector
                (
                    "gradT",
                    T.dimensions()/dimLength,
                    0
                )
            );

label patchi = mesh.boundaryMesh().findPatchID("myPatch");
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
runTime.write();
mgg, elham usefi and Kummi like this.
santos is offline   Reply With Quote

Old   November 7, 2009, 20:55
Default
  #5
Member
 
Sven Winkler
Join Date: May 2009
Posts: 70
Rep Power: 16
sven is on a distinguished road
Thanks a lot Santos, I got it working. The solver now writes out the gradT for myPatch in every time directory. However, I want the solver to write all these data only in one file instead of several files. I think I can perhaps use the probe function, but I dont know how to probe on a patch. Do you know how this works or do you have another idea? Thank you very much! I really appreciate your help!

Sven
sven is offline   Reply With Quote

Old   November 8, 2009, 05:03
Default
  #6
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
I am not familiar with the probe function, sorry. I normally extract gradT values in one file in other way:

1 - Make your solver write gradT on the screen with the patch name, normally you want an area-averaged value. Look in the solvers I mentioned above for guidance.

2 - Launch the simulation and redirect your output to a log file
Code:
simpleScalarFoam > log &
3 - Extract gradT values to another file (here its gradTvalues):
Code:
grep <your_patch> <log_file> | awk '{print $8}' > gradTvalues
This line will look for 'your_patch' in you 'log_file' and will extract the 8th entry in that line (in my case its the gradT value, please change it accordingly).

Regards,
Jose Santos
santos is offline   Reply With Quote

Old   February 1, 2010, 12:59
Default
  #7
New Member
 
Nabil
Join Date: Dec 2009
Posts: 7
Rep Power: 16
vilop6 is on a distinguished road
hi all

i m intersseted by this topic and i will try it to calculate nusselt number, my quastion is how integrate "gradT" over the patch using any intagration method availble or not in openfoam "trapez, simpson, RkX, ..."

regards
vilop6 is offline   Reply With Quote

Old   February 29, 2012, 13:53
Default GradT
  #8
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Dear Santos,

Thanks for your help. I have written the code in the file buoyantBousseinsqSimpleFoam.C. After that when I set wmake, then I am getting error. Is this code is ok? I want to calculate GradT.
Goutam is offline   Reply With Quote

Old   March 14, 2012, 07:51
Default
  #9
New Member
 
slan
Join Date: Nov 2010
Location: Eindhoven
Posts: 19
Rep Power: 15
aaron_lan is on a distinguished road
Send a message via MSN to aaron_lan
Hi Goutam,

Have you solved your problem of calculating GradT in buoyantBousseinsqSimpleFoam? I am also very interested in this case.
aaron_lan is offline   Reply With Quote

Old   March 14, 2012, 07:58
Default
  #10
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
No. But I have calculated local and Average Nusselt number. You can see my post on this. I gave the code.
morsal and ABgabriel13 like this.
Goutam is offline   Reply With Quote

Old   April 6, 2012, 12:16
Default average Nusselt number
  #11
New Member
 
giovanni silva
Join Date: Jul 2010
Posts: 14
Rep Power: 15
giovanni10 is on a distinguished road
Quote:
Originally Posted by sven View Post
I need to calculate a nusselt number for a body in a crossflow for different time steps. Does OpenFOAM provide a function which can do that? If not, can I somehow use the probing function to write out a temperature gradient at a wall, like I can write out fields at certain points? Has anyone ever done something like this? Thanks a lot!
Dear Sven,
Did you finally find a solution to your problem? Unfortunately, I`m not an expert in C++. So, It is too difficult for me. I would like to calculate the average Nusselt number. I am working on a 2D laterally and volumetrically heated square cavity. I have seen your discussion here. Could you help me? Thanks in advance!
giovanni10 is offline   Reply With Quote

Old   May 8, 2013, 10:06
Default
  #12
New Member
 
刘朝福
Join Date: May 2013
Posts: 8
Rep Power: 12
liuchaofu is on a distinguished road
Hi Goutam.Can you tell me how to calculated local and Average Nusselt number.Thank you .
liuchaofu is offline   Reply With Quote

Old   August 31, 2014, 20:04
Default
  #13
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Quote:
Originally Posted by santos View Post
Yes, you are on the right track. Look below for my suggestion. Regards!

Code:
volScalarField gradT
            (
                IOobject
                (
                    "gradT",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mesh,
                dimensionedVector
                (
                    "gradT",
                    T.dimensions()/dimLength,
                    0
                )
            );

label patchi = mesh.boundaryMesh().findPatchID("myPatch");
gradT.boundaryField()[patchi]=T.boundaryField()[patchi].snGrad();
runTime.write();

Hi, can I ask you a question regarding gradT,

is T.boundaryField()[patchi] temperature value at boundary field?

but what is the definition of snGrad()?

Regards,
Kan
nwpukaka is offline   Reply With Quote

Old   September 1, 2014, 13:31
Default
  #14
Senior Member
 
anonymous
Join Date: Aug 2014
Posts: 205
Rep Power: 12
ssss is on a distinguished road
Why not just:


Code:
label patchi = mesh.boundaryMesh().findPatchID("myPatch");

surfaceVectorField TGrad = fvc::interpolate(fvc::grad(T));
vectorField TsurfGrad = FvolGrad.boundaryField()[patchi];
vectorField normal = patch().Sf()/patch().magSf();
scalarField snGradT = TsurfGrad & normal;
Gets the patch ID from its name. Calculates the gradient of T in all surfaces. Then gets the gradient only in the surfaces.

After that it calculates the normal in the surface and the last one gets the gradient in the normal direction of the surface(dT/dn = grad(T)*vectorNormal). Hope that is what your looking for
ssss is offline   Reply With Quote

Old   June 16, 2015, 14:54
Default Nusselt Number in OpenFOAM
  #15
New Member
 
Join Date: May 2015
Posts: 3
Rep Power: 10
AliMahmoodi is on a distinguished road
Hi every body

i add energy equation to icoFoam and it was compiled successfuly.
Now i d like to calculate Nusselt Number in duct .
Has any one known how it should be possible<
AliMahmoodi is offline   Reply With Quote

Old   August 7, 2015, 05:08
Default
  #16
Senior Member
 
Freedom
Join Date: May 2014
Posts: 209
Rep Power: 12
wenxu is on a distinguished road
Dear Jose Santos,

I searched some of your threads, and I found that your are familiar with the OF. Now I want to calculate the gradient explicitly in OF using upwind scheme. I want to calculate the sign distance function: mag(Grad(phi)) = 1.

It is not difficult to implement this on structured mesh based on FDM, but it is not easy for me to implement it on unstructured mesh based on FVM, such as OF.

Could you give me some hints? Thank you in advance!

Best regards,
Wen
wenxu is offline   Reply With Quote

Old   November 4, 2015, 11:57
Default
  #17
New Member
 
Fei
Join Date: Oct 2015
Posts: 13
Rep Power: 10
Garfield is on a distinguished road
Hi, Santos
I have a question about the bulk temperature in your files, in your files you said that we need to define the bulk temperature (Tb) in the transportProperties dictionary, but the Tb will change with location, could you tell me how to handle that?
Thanks a lot
Best
Garfield
Garfield is offline   Reply With Quote

Old   November 5, 2015, 08:30
Default
  #18
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hi Garfield,

My example does not relate to temperature, rather relates to an arbitrary scalar T (http://openfoamwiki.net/index.php/Co...mpleScalarFoam). Tb is in this case a reference value for the scalar (say reference mass fraction of a component) that is used to determine the mass transfer coefficient at the walls.

Regards,
Jose
santos is offline   Reply With Quote

Old   November 5, 2015, 09:50
Default
  #19
New Member
 
Fei
Join Date: Oct 2015
Posts: 13
Rep Power: 10
Garfield is on a distinguished road
Thanks a lot!
Garfield is offline   Reply With Quote

Old   March 7, 2016, 14:19
Default
  #20
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 10
Scram_1 is on a distinguished road
Hi Santos,
I tried compiling simpleScalarFoam but its throwing up some errors which I'm not able to correct.
This is the error I'm geting. There is no simpleScalarFoam.o file in the Make directory. I'm using OpenFOAM 2.3x on Windows (Cygwin) if that's of any help

csriram91@SRIRAM-PC /cygdrive/c/Users/csriram91/Desktop/simpleScalarFoam
$ cd /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam
$ wclean

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam
$ wmake
Making dependency files...
In file included from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZoneMesh.H:33:0,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/polyMesh.H:56,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvMesh.H:50,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvCFD.H:7,
from simpleScalarFoam.C:33:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZone.H:46:32: fatal error: primitiveFacePatch.H: No such file or directory
#include "primitiveFacePatch.H"
^
compilation terminated.
SOURCE=simpleScalarFoam.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/RAS -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o
In file included from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZoneMesh.H:33:0,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/polyMesh.H:56,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvMesh.H:50,
from /opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvCFD.H:7,
from simpleScalarFoam.C:33:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/faceZone.H:46:32: fatal error: primitiveFacePatch.H: No such file or directory
#include "primitiveFacePatch.H"
^
compilation terminated.
simpleScalarFoam.dep:3: recipe for target 'Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o' failed
make: *** [Make/cygwin64mingw-w64DPOpt/simpleScalarFoam.o] Error 1

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/solvers/incompressible/simpleScalarFoam

Thanks!
Ram
Scram_1 is offline   Reply With Quote

Reply


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
Problem with decomposePar tool vinz OpenFOAM Pre-Processing 18 January 26, 2011 02:17
UDF for Nusselt Number preibie FLUENT 1 November 16, 2010 21:28
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 09:01
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 07:36
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15


All times are GMT -4. The time now is 07:12.