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

calculate Nusselt number

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 6 Post By floquation
  • 1 Post By floquation
  • 2 Post By amdk136

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2017, 21:01
Default calculate Nusselt number
  #1
Senior Member
 
alberto
Join Date: Apr 2016
Location: Mexico
Posts: 119
Rep Power: 10
dewey is on a distinguished road
It is possible calculate the nusselt number (local, average) with openFoam or with paraview?




I did my simulation with buoyantSimpleFoam
dewey is offline   Reply With Quote

Old   July 12, 2017, 04:33
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
I use swak4Foam for that purpose.

I have attached a topoSetDict and a NusseltDict that I have used.
topoSet creates several horizontal planes, because I have had my NusseltDict calculate the Nusselt number at 10 different planes in order to see whether they yield the same value.
NusseltDict calculates the Nusselt number for each of those planes.

Note that NusseltDict requires some physical parameters, like H (height of domain) and \alpha (thermal diffusivity). Therefore, I use NusseltDict.template to generate NusseltDict using pyFoamFromTemplate.py.

Altogether, my prepareCase.sh script looks like (I am only showing the part relevant for the Nusselt number):
Code:
## Define variables
Wy=2
# Calculate alpha
nu=`grep 'nu \[0 2' constant/transportProperties | sed 's/^[^0-9]*[-(0-9) ]*\] //' | sed 's/;//g'`
Pr=`grep 'Pr \[0 ' constant/transportProperties | sed 's/^[^0-9]*[-(0-9) ]*\] //' | sed 's/;//g'`
nu=`echo ${nu} | sed -e 's/[eE]+*/\\*10\\^/'`
Pr=`echo ${Pr} | sed -e 's/[eE]+*/\\*10\\^/'`
alpha=`echo "($nu)/($Pr)" | bc -l`

# Get temperatures
Ts=(`grep 'value' "0/T.org" | sed -e 's/\s*value\s*uniform\s*//' | sed 's/;//'`)
Ts=(`echo ${Ts[@]} | sed -e 's/[eE]+*/\\*10\\^/'`)
dT=`echo "${Ts[1]}-1*${Ts[0]}" | bc -l | sed 's/-//'`
Tm=`echo "(${Ts[1]}+1*${Ts[0]})/2" | bc -l`

#
PARAMETERS_NUSSELT="{'alpha':$alpha,'dT':$dT,'H':$Wy}"
echo "Parameters_Nusselt: $PARAMETERS_NUSSELT"

## Write dictionaries:
pyFoamFromTemplate.py ./system/NusseltDict $PARAMETERS_NUSSELT || exit 1

## Mesh
echo "----> blockMesh"
blockMesh > ./logs/blockMesh.log || exit 1
## TopoSet
echo "----> topoSet"
topoSet > ./logs/topoSet.log || exit 1
Then, in system/controlDict, make sure to add the following. (I possibly show you too many libs, as I'm not sure which was required for Nusselt. Either way, too many cannot hurt.)
Code:
functions
{
    //work-around: otherwise mesh is NULL during construction of FuncObjs.
    doInit {
        type initSwakFunctionObject;
    }

    #include "NusseltDict"
}

libs
(
    "libOpenFOAM.so"
    "libsimpleFunctionObjects.so"
    "libsimpleSwakFunctionObjects.so"
    "libswakFunctionObjects.so"
    "libswakTopoSources.so"
);
Note: I have used this for run-time post-processing.
If you want to post-process it after the simulation, have a look at OF's "postProcess" tool, which can execute FunctionObjects after runtime.
Attached Files
File Type: gz NusseltDict.gz (670 Bytes, 220 views)
File Type: gz NusseltDict.template.gz (646 Bytes, 153 views)
File Type: gz topoSetDict.gz (638 Bytes, 130 views)
floquation is offline   Reply With Quote

Old   November 26, 2018, 11:00
Default
  #3
New Member
 
Arthur
Join Date: Oct 2018
Location: Glasgow
Posts: 20
Rep Power: 8
amdk136 is on a distinguished road
Hi,

I'm looking to get this plane creation/Nusselt calculation working using your method, however I get the following error after running topoSet:

Code:
--> FOAM FATAL ERROR: 
Unknown topoSetSource type expressionToFace

Valid topoSetSource types : 

45
(
boundaryToFace
boxToCell
boxToFace
boxToPoint
cellToCell
cellToFace
cellToPoint
cylinderAnnulusToCell
cylinderAnnulusToFace
cylinderToCell
cylinderToFace
faceToCell
faceToFace
faceToPoint
faceZoneToCell
faceZoneToFaceZone
fieldToCell
labelToCell
labelToFace
labelToPoint
nbrToCell
nearestToCell
nearestToPoint
normalToFace
patchToFace
pointToCell
pointToFace
pointToPoint
regionToCell
regionToFace
rotatedBoxToCell
searchableSurfaceToFaceZone
setAndNormalToFaceZone
setToCellZone
setToFaceZone
setToPointZone
setsToFaceZone
shapeToCell
sphereToCell
surfaceToCell
surfaceToPoint
targetVolumeToCell
zoneToCell
zoneToFace
zoneToPoint
)


    From function static Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New(const Foam::word&, const Foam::polyMesh&, const Foam::dictionary&)
    in file sets/topoSetSource/topoSetSource.C at line 85.

FOAM exiting
Do you have any idea of a fix for this at all? Is it an issue with swak4Foam not working properly? I've simply copy/pasted the topoSetDict into my system directory and run topoSet.

I have also included the libraries in the controlDict that are included in the above post by 'floquation'. I am also using OpenFOAM 6.

Any more information required can be supplied.

Thanks in advance!
Arthur

Last edited by amdk136; November 27, 2018 at 05:55. Reason: Adding information
amdk136 is offline   Reply With Quote

Old   November 28, 2018, 06:26
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
My guess would be that your swak4Foam is indeed not working, as "expressionToFace" is part of swak, but it is not found.

But if that's the case, I'd expect to see warnings in your log file above the error message you copied. Warnings like "...swak... library not found".
Are there any such warnings in your output?

I assume you already installed a version compatible with OF-6? Installation Problem with OF 6 version
amdk136 likes this.
floquation is offline   Reply With Quote

Old   November 28, 2018, 06:49
Default
  #5
New Member
 
Arthur
Join Date: Oct 2018
Location: Glasgow
Posts: 20
Rep Power: 8
amdk136 is on a distinguished road
Hi again,

Here is the rest of the log file from the beginning, there doesn't seem to be any mention about not being able to read swak libraries.

Quote:
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : 6-66a81087c208
Exec : topoSet
Date : Nov 28 2018
Time : 11:41:05
Host : "itlrstud054"
PID : 9983
I/O : uncollated
Case : /home/stss2/OpenFOAM/stss2-6/run/correct_geometry/100MM_GEOMETRY/calumsBigToiletFest
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
From function static bool Foam::functionObjectList::readFunctionObject(const Foam::string&, Foam::dictionary&, Foam::HashSet<>&, const Foam::word&)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 278
Cannot find functionObject file wallGradT
Create polyMesh for time = 0

Reading topoSetDict

Time = 0
mesh not changed.
Created faceSet plane0_0
Applying source expressionToFace


--> FOAM FATAL ERROR:
Unknown topoSetSource type expressionToFace

Valid topoSetSource types :

45
(
boundaryToFace
boxToCell
boxToFace
boxToPoint
cellToCell
cellToFace
cellToPoint
cylinderAnnulusToCell
cylinderAnnulusToFace
cylinderToCell
cylinderToFace
faceToCell
faceToFace
faceToPoint
faceZoneToCell
faceZoneToFaceZone
fieldToCell
labelToCell
labelToFace
labelToPoint
nbrToCell
nearestToCell
nearestToPoint
normalToFace
patchToFace
pointToCell
pointToFace
pointToPoint
regionToCell
regionToFace
rotatedBoxToCell
searchableSurfaceToFaceZone
setAndNormalToFaceZone
setToCellZone
setToFaceZone
setToPointZone
setsToFaceZone
shapeToCell
sphereToCell
surfaceToCell
surfaceToPoint
targetVolumeToCell
zoneToCell
zoneToFace
zoneToPoint
)


From function static Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New(const Foam::word&, const Foam:olyMesh&, const Foam::dictionary&)
in file sets/topoSetSource/topoSetSource.C at line 85.

FOAM exiting
I am on a university campus computer so can't actually edit or install anything, but I was told that the correct version of swak had been installed on the machine I am using.

I am quite new to OpenFOAM so this is all a bit overwhelming, but thank you for your reply - it's appreciated.

Arthur
amdk136 is offline   Reply With Quote

Old   November 28, 2018, 11:09
Default
  #6
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
Quote:
Originally Posted by amdk136 View Post
Here is the rest of the log file from the beginning, there doesn't seem to be any mention about not being able to read swak libraries.
Weird. Some ideas / hypotheses:
  1. You do not yet include the swak4Foam library. What does your controlDict look like?
  2. Check whether the swak libraries are indeed available. They should be in the directory $FOAM_USER_LIBBIN (on Linux). Run: "ls $FOAM_USER_LIBBIN" and see what's in there.
  3. I never used OF6. Perhaps they removed a feature from swak (unlikely). (Or you only have a partial installation on your system.) If the above doesn't work, do you perhaps have an older OF version installed? Then give that a brief try.



Quote:
Originally Posted by amdk136 View Post
I am on a university campus computer so can't actually edit or install anything, but I was told that the correct version of swak had been installed on the machine I am using.

I am quite new to OpenFOAM so this is all a bit overwhelming, but thank you for your reply - it's appreciated.
I respect that you're new, but then especially you might appreciate this: I am also working on a university (Linux) computer without root access, but I can install openFoam and swak4Foam. I don't know whether you are on Linux, but that's the strength of Linux: I can just compile OF and swak from source and have it "installed" for me personally.
floquation is offline   Reply With Quote

Old   November 29, 2018, 09:13
Default
  #7
New Member
 
Arthur
Join Date: Oct 2018
Location: Glasgow
Posts: 20
Rep Power: 8
amdk136 is on a distinguished road
Floquation,


Thank you again for your reply. It turns out that it was an issue with Swak not compiling correctly. My supervisor has corrected the problem just this morning. The planes now generate.



With regards to being a beginner, I have only recently begun to use Linux so I am still trying to figure it out, although with your help I've also learned what's wrong and how to rectify it. Small steps at a time.


Thank you for your help, it is much appreciated!


Arthur
amdk136 is offline   Reply With Quote

Old   April 24, 2019, 11:16
Default
  #8
Member
 
Farshad
Join Date: Sep 2010
Posts: 36
Rep Power: 16
farshadexp is on a distinguished road
Hi guys;
I have written a function object via swak4FOAM for nusselt number calculation. Is there any cases to verify this code?
I know that the best verification is to compare modeling results with analytical solutions. But I need an OpenFOAM case.
highly appreciated
farshadexp 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
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
decomposePar pointfield flying OpenFOAM Running, Solving & CFD 28 December 30, 2013 16:05
AMI interDyMFoam for mixer danny123 OpenFOAM Running, Solving & CFD 4 June 19, 2013 05:49
How to calculate Nusselt number SeRGeiSarov Main CFD Forum 4 May 6, 2009 02:57
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 09:44.