CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Code for Nusselt number

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

Like Tree6Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   February 29, 2012, 13:20
Default Code for Nusselt number
  #1
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
I have used the following code created by Johan Magnusson. It creates the tool NusseltCalc. Only problem is, when I run NusseltCalc then I got the error:

Command not found. Could you please help me?

I am adding the code as an attachment.
Attached Images
File Type: jpg 1.jpg (88.8 KB, 358 views)
File Type: jpg 2.jpg (92.1 KB, 301 views)
File Type: jpg 3.jpg (85.9 KB, 250 views)
File Type: jpg 4.jpg (78.6 KB, 219 views)
Thamali, ali-group and alexsiu like this.
Goutam is offline   Reply With Quote

Old   March 1, 2012, 13:18
Default
  #2
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
Hi,

have you correctly compiled the tool? You need to do a "wmake", see the Wiki for more information on that topic.

Markus
markusrehm is online now   Reply With Quote

Old   March 1, 2012, 13:28
Default
  #3
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
Dear Members,

This is the code for local Nusselt number:

volScalarField wall_localNusselt
(
IOobject
(
"wall_localNusselt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("wall_localNusselt ",dimless,0.0)
);

forAll(wall_localNusselt.boundaryField(),patchi)
{
wall_localNusselt.boundaryField()[patchi] = length*patchHeatFlux[patchi]/((T_hot-T_ini)*k);
}

wall_localNusselt.write();
}

I want to write a code for Average Nusselt Number.
EhsanM likes this.

Last edited by Goutam; March 3, 2012 at 09:32.
Goutam is offline   Reply With Quote

Old   March 1, 2012, 13:48
Default Solved !!!
  #4
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
The code was correct. NusseltCalc is working now.
salvo-K61IC likes this.
Goutam is offline   Reply With Quote

Old   March 1, 2012, 14:07
Default Problem !!!
  #5
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
How to calculate average Nusselt number?

Last edited by Goutam; March 3, 2012 at 09:03.
Goutam is offline   Reply With Quote

Old   March 2, 2012, 04:21
Default
  #6
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
DearGoutam,

I have not used the code but it would be helpful to see the error message.

Markus
markusrehm is online now   Reply With Quote

Old   March 2, 2012, 05:35
Default
  #7
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
Looking for a response?

Last edited by Goutam; March 3, 2012 at 09:28.
Goutam is offline   Reply With Quote

Old   March 5, 2012, 08:10
Default
  #8
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
Hello Goutam,

please be a bit more precise. As far as I understand, the code you posted above calculates the patch-averaged Nusselt number.

Because patchHeatFlux should be the heat flux over the patch in [W/m2], right?

Markus
markusrehm is online now   Reply With Quote

Old   March 5, 2012, 08:16
Default Average Nusselt Number
  #9
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
Dear Markus,

This code will calculate heat flux and Local Nusselt NUmber at each patch. I am using this code and its working properly.

If you want to calculate average Nusselt number, then just write in the terminal window:

patchAverage wall_localNusselt your_patch_name

You will get your average Nusselt number.

Cheers !!!

Last edited by Goutam; March 7, 2012 at 06:29.
Goutam is offline   Reply With Quote

Old   April 9, 2012, 08:27
Default How can I alter your code?
  #10
New Member
 
giovanni silva
Join Date: Jul 2010
Posts: 14
Rep Power: 7
giovanni10 is on a distinguished road
Quote:
Originally Posted by Goutam View Post
Dear Members,

This is the code for local Nusselt number:

volScalarField wall_localNusselt
(
IOobject
(
"wall_localNusselt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("wall_localNusselt ",dimless,0.0)
);

forAll(wall_localNusselt.boundaryField(),patchi)
{
wall_localNusselt.boundaryField()[patchi] = length*patchHeatFlux[patchi]/((T_hot-T_ini)*k);
}

wall_localNusselt.write();
}

I want to write a code for Average Nusselt Number.
What does (T_hot-T_ini) stand for ?
-- wall_localNusselt.boundaryField()[patchi] = length*patchHeatFlux[patchi]/((T_hot-T_ini)*k); --

I want to calculate the localNusselt number at a wall which is called "right". I have a rectangular cavity which has 4 walls with the following names: bottom, right, left and top. So, the Nusselt number is calculated as the integration of dT/dx for limits from y=0 to 1, at x=0, which is the "right" wall.
How can I alter your code?
I am using an incompressible Magnetohydrodynamics` solver.
Thanks a lot for your help!
giovanni10 is offline   Reply With Quote

Old   June 22, 2014, 05:47
Question
  #11
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 5
shash is on a distinguished road
Quote:
Originally Posted by Goutam View Post
Dear Markus,

This code will calculate heat flux and Local Nusselt NUmber at each patch. I am using this code and its working properly.

If you want to calculate average Nusselt number, then just write in the terminal window:

patchAverage wall_localNusselt your_patch_name

You will get your average Nusselt number.

Cheers !!!
Hi Goutam,

I have used the same code and terminal command for calculating the nusselt number for a case of fin tube heat exchanger using chtMultiRegionSimpleFoam solver but i am getting:

Code:
Create time

Create mesh for time = 0

Time = 0
    No field NusseltNumber

Time = 1600
    No field NusseltNumber

Time = 1700
    No field NusseltNumber

Time = 1800
    No field NusseltNumber

Time = 1900
    No field NusseltNumber

Time = 2000
    No field NusseltNumber

End
Can you help me with what i m doing wrong.
Attached Files
File Type: h createFields.H (1.2 KB, 39 views)
File Type: c NusseltCalc.C (4.0 KB, 70 views)
shash is offline   Reply With Quote

Old   June 22, 2014, 05:59
Default
  #12
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 5
shash is on a distinguished road
Hi,
From what i understand from code, this is not a post processing utility rather a runtime utility and i need to create a volumetric scalar field NusseltNumber for it to work.
Plz let me know your views.
shash is offline   Reply With Quote

Old   June 23, 2014, 06:05
Default
  #13
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 128
Rep Power: 5
Goutam is on a distinguished road
Quote:
Originally Posted by shash View Post
Hi Goutam,

I have used the same code and terminal command for calculating the nusselt number for a case of fin tube heat exchanger using chtMultiRegionSimpleFoam solver but i am getting:

Code:
Create time

Create mesh for time = 0

Time = 0
    No field NusseltNumber

Time = 1600
    No field NusseltNumber

Time = 1700
    No field NusseltNumber

Time = 1800
    No field NusseltNumber

Time = 1900
    No field NusseltNumber

Time = 2000
    No field NusseltNumber

End
Can you help me with what i m doing wrong.
This code is developed for 3D cubical domain that is can be used for 2D cavity problem. That's why, this will not work for tube. You need to modify the code according to your problem. Thanks
Goutam is offline   Reply With Quote

Old   October 24, 2014, 15:58
Default Nusseltcalc.C
  #14
New Member
 
Lorenzo Gomes
Join Date: Nov 2013
Location: Brazil
Posts: 11
Rep Power: 3
gomeslorenzo is on a distinguished road
Hello there,

I'm trying to compile the tool but I keep receiving this error:

Code:
NusseltCalc.C: In function 'int main(int, char**)':
NusseltCalc.C:61:38: error: missing template arguments before '->' token
My file is attached.

Any ideas why?

Thanks.
Attached Files
File Type: c NusseltCalc.C (4.5 KB, 24 views)
gomeslorenzo is offline   Reply With Quote

Old   October 24, 2014, 16:29
Default
  #15
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,108
Rep Power: 19
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

RASModel is class name, did you mean turbulence->alphaEff()? (also this method is available only for compressible turbulence models, in case of incompressible model you have to calculate is as nu/Pr + nut/Prt)
alexeym is offline   Reply With Quote

Old   October 27, 2014, 12:52
Default
  #16
New Member
 
Lorenzo Gomes
Join Date: Nov 2013
Location: Brazil
Posts: 11
Rep Power: 3
gomeslorenzo is on a distinguished road
Thanks for the quickly reply. That killed that error but now I can't find a way to link the libraries I need. The error is this:

Code:
/usr/bin/ld: cannot find -lcompressibleTurbulenceModel
/usr/bin/ld: cannot find -lcompressibleRASModels
/usr/bin/ld: cannot find -lcompressibleLESModels
/usr/bin/ld: cannot find -lLESdeltas
/usr/bin/ld: cannot find -lreactionThermophysicalModels
/usr/bin/ld: cannot find -lfiniteVolume
/usr/bin/ld: cannot find -lgenericPatchFields
/usr/bin/ld: cannot find -lspecie
/usr/bin/ld: cannot find -lfluidThermophysicalModels
/usr/bin/ld: cannot find -lsolidThermo
I tryied to create a symbolic link to /usr/bin/ld but the response is that the file already exists.

My options file in /Make dir is this:

Code:
EXE_INC = \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude 
    
EXE_LIBS = \
    -lcompressibleTurbulenceModel \
    -lcompressibleRASModels \
    -lcompressibleLESModels \
    -lLESdeltas \
    -lreactionThermophysicalModels \
    -lfiniteVolume \
    -lgenericPatchFields \
    -lspecie \
    -lfluidThermophysicalModels \
    -lsolidThermo
Thanks for the attention.
gomeslorenzo is offline   Reply With Quote

Old   October 27, 2014, 13:41
Default
  #17
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,108
Rep Power: 19
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

it looks much like you've forgotten to set up environment variables.
alexeym is offline   Reply With Quote

Old   October 27, 2014, 13:49
Default
  #18
New Member
 
Lorenzo Gomes
Join Date: Nov 2013
Location: Brazil
Posts: 11
Rep Power: 3
gomeslorenzo is on a distinguished road
Im kind of new at this. How can I do that?
gomeslorenzo is offline   Reply With Quote

Old   February 8, 2015, 16:13
Default
  #19
Member
 
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 30
Rep Power: 2
jameswilson620 is on a distinguished road
basically we can calculate local nusselt numbers over a patch as we've seen in the discussion above. To get an average nusselt number, you must do some area weighting in the case of a non uniform mesh. Below, you calculate the local nusselt number at each face on heatedPatchID and multiply by the faces area. You must also calculate the total patch area. Once each local nusselt number is weighted by its own area of its face on the boundary, you divide the entire sum of area weighted nusselt numbers by the total area. This results in an averaged nusselt number.

Take a uniform mesh for example:
e.g. (A1*Nu1 +A2*Nu2 +... An*Nun)/Atotal = NUM/DEN where A1 is the face area of face 1 on heatedPatchID and Atotal is the entire patch area

and if A1 = A2 = An (uniform mesh), then A1 = Atotal/n = A2 = .. = An

resulting in Atotal(Nu1 + Nu2 + ... +Nun)/(Atotal*n) = (Nu1 + Nu2 + ... +Nun)/n), which quite simply in a basic average of n components. This is how we integrate numerically along a dimension in most cases where we divide the area weighted sum by the total area of that boundary of interest whether it be length, area or volume.

Code:
	        label heatedPatchID = mesh.boundaryMesh().findPatchID("heatedBoundaryName");

		const polyPatch& cPatch = mesh.boundaryMesh()[heatedPatchID];

		scalar patchArea = 0.0; 
                scalar eps = 1e-99; //avoid divide by zero

                forAll(cPatch, facei) //Cycle through all of the boundary faces of heatedPatchID to find total patch area
		{
                        localArea = magSf.boundaryField()[heatedPatchID][facei];
			patchArea += localArea; //building DEN
                }
                // i suppose scalar patchArea = sum(magSf.boundaryField()[heatedPatchID]); //would suffice

                scalar averageNusseltNumber = sum(T.boundaryField()[heatedPatchID].snGrad()  * magSf.boundaryField()[heatedPatchID])/(T.boundaryField()[heatedPatchID]-Tsat.value()+eps)/(patchArea + eps); //calculating NUM/DEN
you should get creative with making a dictionary containing your heated boundary names so that the solver reads this dict. at run time to avoid having to hard code the names of the boundaries and recompile every time you have a new case. Put all of this in a header nusseltSomething.H, throw in an info line or have the contents written to a file. I hope this helps

Any comments are welcome.

James
jameswilson620 is offline   Reply With Quote

Old   April 16, 2015, 21:27
Default error compiling
  #20
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 100
Rep Power: 4
student666 is on a distinguished road
Hi,

I'm facing this problem when i type wmake
Code:
michele@micheleXubuntu:~/OpenFOAM/michele-2.3.1/run/nusseltCalc$ wmake
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam231/src/turbulenceModels -I/opt/openfoam231/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/openfoam231/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam231/src/thermophysicalModels/reactionThermo/lnInclude -I/opt/openfoam231/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam231/src/thermophysicalModels/solidThermo/lnInclude -I/opt/openfoam231/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam231/src/OpenFOAM/lnInclude -I/opt/openfoam231/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPOpt/nusseltCalc.o -L/opt/openfoam231/platforms/linux64GccDPOpt/lib \
         -lcompressibleTurbulenceModel -lcompressibleRASModels -lcompressibleLESModels -lLESdeltas -lreactionThermophysicalModels -lfiniteVolume -lgenericPatchFields -lspecie -lfluidThermophysicalModels -lsolidThermo -lOpenFOAM -ldl   -lm -o /opt/openfoam231/platforms/linux64GccDPOpt/bin/nusseltCalc
/usr/bin/ld: cannot open output file /opt/openfoam231/platforms/linux64GccDPOpt/bin/nusseltCalc: Permission denied
collect2: error: ld returned 1 exit status
make: *** [/opt/openfoam231/platforms/linux64GccDPOpt/bin/nusseltCalc] Error 1
michele@micheleXubuntu:~/OpenFOAM/michele-2.3.1/run/nusseltCalc$
why permission is denied?

thanks a lot

Michele
student666 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Mesh Utilities 41 January 17, 2013 03:43
Problem with decomposePar tool vinz OpenFOAM Pre-Processing 18 January 26, 2011 03:17
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 08:10
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34


All times are GMT -4. The time now is 23:04.