CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Code for Nusselt number (https://www.cfd-online.com/Forums/openfoam-solving/97971-code-nusselt-number.html)

Goutam February 29, 2012 12:20

Code for Nusselt number
 
4 Attachment(s)
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.

markusrehm March 1, 2012 12:18

Hi,

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

Markus

Goutam March 1, 2012 12:28

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.

Goutam March 1, 2012 12:48

Solved !!!
 
The code was correct. NusseltCalc is working now.

Goutam March 1, 2012 13:07

Problem !!!
 
How to calculate average Nusselt number?

markusrehm March 2, 2012 03:21

DearGoutam,

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

Markus

Goutam March 2, 2012 04:35

Looking for a response?

markusrehm March 5, 2012 07:10

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

Goutam March 5, 2012 07:16

Average Nusselt Number
 
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 !!!

giovanni10 April 9, 2012 08:27

How can I alter your code?
 
Quote:

Originally Posted by Goutam (Post 347135)
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!

shash June 22, 2014 05:47

2 Attachment(s)
Quote:

Originally Posted by Goutam (Post 347685)
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.:confused:

shash June 22, 2014 05:59

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.

Goutam June 23, 2014 06:05

Quote:

Originally Posted by shash (Post 498130)
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.:confused:

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

gomeslorenzo October 24, 2014 15:58

Nusseltcalc.C
 
1 Attachment(s)
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.

alexeym October 24, 2014 16:29

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)

gomeslorenzo October 27, 2014 11:52

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.

alexeym October 27, 2014 12:41

Hi,

it looks much like you've forgotten to set up environment variables.

gomeslorenzo October 27, 2014 12:49

I´m kind of new at this. How can I do that?

jameswilson620 February 8, 2015 15:13

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

student666 April 16, 2015 21:27

error compiling
 
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

alexeym April 17, 2015 01:33

Hi,

You are trying to install software system-wide while being simple user. You should either use 'sudo wmake' (though in this case I am not quite sure about environment variables being set right), or change $(FOAM_APPBIN) to $(FOAM_USER_APPBIN) in Make/files file to install software in user's folder.

student666 April 17, 2015 11:42

Thank you very much for helping; I change Make/file by changing into FOAM_USER_APPBIN.

Regards.

Scram_1 March 7, 2016 11:39

Hi,
I'm new to openFOAM and thought of checking if OF gives the right value of the Nu for laminar flow through a pipe.
I used the buoyantBoussinesqSimpleFoam solver by turning off turbulence and g (so that the buoyancy effects are turned off). The velocity and temperature fields seem correct. Now, I want to check the Nu. I tried creating the function NusseltCalc() as detailed in one of your previous posts. However during compilation, I'm getting an error. I tried compiling the wallHeatFlux function as well just to check if it compiles properly (obviously by creating a copy of it first). Even that is giving the same error. In fact even when I tried adding temperature field to icoFoam and tried compiling, its giving me the same error.

Here's the error message I'm getting

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/utilities/postProcessing/wall/wallHeatFlux - Copy (2)
$ wclean

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/utilities/postProcessing/wall/wallHeatFlux - Copy (2)
$ 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 wallHeatFlux.C:34:
/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=wallHeatFlux.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 -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/specie/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/reactionThermo/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/basic/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/solidThermo/lnInclude -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/wallHeatFlux.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 wallHeatFlux.C:34:
/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.
wallHeatFlux.dep:3: recipe for target 'Make/cygwin64mingw-w64DPOpt/wallHeatFlux.o' failed
make: *** [Make/cygwin64mingw-w64DPOpt/wallHeatFlux.o] Error 1


I'm running openFOAM 2.3x on cygwin if that's any help.

Thanks!!
Ram

djamila77 May 17, 2016 15:44

hi; all

thank you for the answer,

I'll try your suggestions and I'll share the results with you.

Cordially

djamila77 May 22, 2016 06:21

Quote:

Originally Posted by giovanni10 (Post 353771)
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!

Dear Sir
I don't know exactly what your kind of problem research but the Code Fluent is useful in kind of convection in a box headed by the below wall and cladded by the top
you can use it for calculate the Nusselt number and other thing

acs June 14, 2016 09:54

Same problem
 
Quote:

Originally Posted by Scram_1 (Post 588501)
Hi,
I'm new to openFOAM and thought of checking if OF gives the right value of the Nu for laminar flow through a pipe.
I used the buoyantBoussinesqSimpleFoam solver by turning off turbulence and g (so that the buoyancy effects are turned off). The velocity and temperature fields seem correct. Now, I want to check the Nu. I tried creating the function NusseltCalc() as detailed in one of your previous posts. However during compilation, I'm getting an error. I tried compiling the wallHeatFlux function as well just to check if it compiles properly (obviously by creating a copy of it first). Even that is giving the same error. In fact even when I tried adding temperature field to icoFoam and tried compiling, its giving me the same error.

Here's the error message I'm getting

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/utilities/postProcessing/wall/wallHeatFlux - Copy (2)
$ wclean

csriram91@SRIRAM-PC /opt/OpenFOAM/OpenFOAM-2.3.x/applications/utilities/postProcessing/wall/wallHeatFlux - Copy (2)
$ 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 wallHeatFlux.C:34:
/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=wallHeatFlux.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 -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/specie/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/reactionThermo/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/basic/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/thermophysicalModels/solidThermo/lnInclude -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/wallHeatFlux.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 wallHeatFlux.C:34:
/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.
wallHeatFlux.dep:3: recipe for target 'Make/cygwin64mingw-w64DPOpt/wallHeatFlux.o' failed
make: *** [Make/cygwin64mingw-w64DPOpt/wallHeatFlux.o] Error 1


I'm running openFOAM 2.3x on cygwin if that's any help.

Thanks!!
Ram

Hi, Ram, I've got the same problem. Have you solved it? What did you do?

Thanx!

djamila77 December 3, 2016 08:22

Hi there
I'd like asking about the Lenght in Report - Reference Values.
is it the Depth that means Hydraulic diameter for 3D or note

djamila77 December 12, 2016 08:30

How to add this Nusselt Program to the CFD
 
Hi there
I'd like add this program to calculate Nusselt number, but I don't know how to do that
please help me:confused:

djamila77 December 16, 2016 10:21

Quote:

Originally Posted by Goutam (Post 347138)
The code was correct. NusseltCalc is working now.

Hi
how can I include the program
please with Details

pille February 7, 2017 11:30

changes for OF 4.1
 
If someone wants to implement the code of Johan Magnusson (shown in post #3) in OpenFOAM 4.1, one only need to change

Code:


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

to

Code:


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

and everything works fine.
A detailed description of the implementation is given in his report
("conjugateHeatFoam with explanational tutorial together with a buoyancy driven flow tutorial and a convective conductive tutorial")

MFN August 20, 2018 16:20

Quote:

Originally Posted by pille (Post 636279)
If someone wants to implement the code of Johan Magnusson (shown in post #3) in OpenFOAM 4.1, one only need to change

Code:


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

to

Code:


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

and everything works fine.
A detailed description of the implementation is given in his report
("conjugateHeatFoam with explanational tutorial together with a buoyancy driven flow tutorial and a convective conductive tutorial")

does it work in openfoam 4.x ?
I will test and re check that

Hgholami May 4, 2019 20:34

wrong in heat flux code
 
Hi
I modify icoFluid solver of fsiFoam and add this code to it as:
Quote:

wallHeatFlux_
(
IOobject
(
"wallHeatFlux",
runTime().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("wallHeatFlux",dimMass/pow3(dimTime), 0.0)
),

forAll(wallHeatFlux_.boundaryField(),patchi)
{
if (mesh.boundary()[patchi].isWall())
{
wallHeatFlux_.boundaryField()[patchi] = (DT_*rho_*Cp_)*fvc::snGrad(T_);
}
}
to calculate heat flux during the simulation. The problem is that the output file "wallheatFlux" in each timeStep is different size
for example: "size 10441 is not equal to the given value of 117"
the code make same size for each boundary surfaces (for inlet, top,bottom etc with different size, the wallHeatFlux is same size 10441). Do you know what is the mistake?

Daniel_Khazaei May 4, 2019 21:04

Quote:

Originally Posted by Hgholami (Post 732730)
Hi
I modify icoFluid solver of fsiFoam and add this code to it as:

to calculate heat flux during the simulation. The problem is that the output file "wallheatFlux" in each timeStep is different size
for example: "size 10441 is not equal to the given value of 117"
the code make same size for each boundary surfaces (for inlet, top,bottom etc with different size, the wallHeatFlux is same size 10441). Do you know what is the mistake?

Assuming (DT_*rho_*Cp_) results in a dimensionedScalar, what you need is surface normal gradient of temperature at boundaries:

Code:

wallHeatFlux_.boundaryField()[patchi] = (DT_*rho_*Cp_)*T_.boundaryField()[patchi].snGrad();

Hgholami September 4, 2019 12:09

Quote:

Originally Posted by Goutam (Post 347135)
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.

Dear Goutam
Do you have any code for calculation Nusselt number with bulk temperature?
https://www.cfd-online.com/Forums/vb...02a8aed9-1.gif
I can't use swak4Foam, in order, I should calculate bulk temperature and add it to Nusselt calculation

chberbelali March 20, 2022 14:22

Local Nusselt with Matlab
 
hello everyone,

is there anyone who can help me?!

How can i calculate the local Nusselt number for a vertical wall in cavity using a Matlab implimentation?

piu58 March 20, 2022 15:00

The Nußelt number is connected to the thickness of the boundary layer d. If you may measure this thickness, you may calculate the Nußelt number stepwise (but not pointwise). You have to select al length along L the surface for which you plan getting Nu. The you have

Nu = L / d

chberbelali March 20, 2022 15:39

More information about my problem
 
Quote:

Originally Posted by piu58 (Post 824412)
The Nußelt number is connected to the thickness of the boundary layer d. If you may measure this thickness, you may calculate the Nußelt number stepwise (but not pointwise). You have to select al length along L the surface for which you plan getting Nu. The you have

Nu = L / d

Details here:

https://www.cfd-online.com/Forums/ma...lt-number.html

https://www.cfd-online.com/Forums/ma...computing.html

My problem figure:
https://media.springernature.com/lw6..._Fig1_HTML.png

Best regards :)


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