Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Study of conjugate heat transfer in OpenFOAM
Turo Välikangas
Mechanical Engineering and Industrial Systems,
Tampere University of Technology,
Tampere, Finland
2016-12-05
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
1 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Outline
Get the files and unpack
Download the file named oneFluidOneSolid2D.tgz
Unpack the files and enter the case directory:
tar xzf oneFluidOneSolid2D.tgz
rm oneFluidOneSolid2D.tgz
cd oneFluidOneSolid2D
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
2 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Outline
Conjugated heat transfer in OpenFOAM foundation and extended
In this presentation we look through the interesting bits of the case
setups for chtMultiRegionSimpleFoam in OpenFOAM foundation
4.0, chtMultiRegionSimpleFoam in FOAM extend 4.0 and
conjugateHeatSimpleFoam in FOAM extend 4.0.
We look what boundary conditions needs to be specified in the
patches that connect the regions together, where thermal properties
needs to be defined for every solver and go through some solver
specific tips for solving cases.
Then we modify the chtMultiRegionSimpleFoam in OpenFOAM
foundation 4.0 to make it converge faster.
Compare the convergence speed of all the solvers
For extra content a uniformExternalWallHeatFlux boundary condition
is introduced
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
3 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Outline
Illustration of the tutorial case
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
4 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
Run the case with chtMultiRegionSimpleFoam in OpenFOAM
foundation 4.0
cd oneFluidOneWall2DOF401Loop/
./Allrun >& log &
tree
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
5 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
tree structure for 0/
0
cellToRegion
fluid
p
p_rgh
T
U
p
p_rgh
solid
p
T
T
U
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
6 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
0/fluid/T/
boundaryField
{
fluid_top
{
type
value
}
leftLet
{
type
value
}
rightLet
{
type
value
}
frontAndBack
{
type
}
fluid_to_solid
{
type
value
Tnbr
kappaMethod
kappaName
}
}
Turo Välikangas
symmetryPlane;
uniform 300;
fixedValue;
uniform 300;
zeroGradient;
uniform 300;
empty;
compressible::turbulentTemperatureCoupledBaffleMixed;
uniform 300;
T;
fluidThermo;
none;
fasterChtMultiRegionSimpleFoam
2016-12-05
7 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
0/solid/T/
boundaryField
{
solid_bottom
{
type
value
}
leftLet
{
type
value
}
rightLet
{
type
value
}
frontAndBack
{
type
}
solid_to_fluid
{
type
value
kappaMethod
kappaName
Tnbr
}
}
Turo Välikangas
symmetryPlane;
uniform 350;
zeroGradient;
uniform 350;
zeroGradient;
uniform 350;
empty;
compressible::turbulentTemperatureCoupledBaffleMixed;
uniform 350;
solidThermo;
none;
T;
fasterChtMultiRegionSimpleFoam
2016-12-05
8 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
tree structure for constant/
constant
fluid
fvOptions
g
polyMesh
boundary
faces
neighbour
owner
points
radiationProperties
RASProperties
thermophysicalProperties
turbulenceProperties
regionProperties
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
9 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
limitTemperature fvOptions
limitT
{
type
limitTemperature;
region fluid;
active
yes;
limitTemperatureCoeffs
{
selectionMode
all;
Tmin
200;
Tmax
400;
}
}
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
10 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
constant/fluid/polyMesh/boundary
fluid_to_solid
{
type
nFaces
startFace
inGroups
sampleMode
sampleRegion
samplePatch
}
Turo Välikangas
mappedWall;
100;
19900;
1 ( wall );
nearestPatchFace(AMI);
solid;
solid_to_fluid;
fasterChtMultiRegionSimpleFoam
2016-12-05
11 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
tree structure for constant/
solid
fvOptions
polyMesh
boundary
faces
neighbour
owner
points
thermophysicalProperties
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
12 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
constant/solid/polyMesh/boundary
solid_to_fluid
{
type
nFaces
startFace
inGroups
sampleMode
sampleRegion
samplePatch
}
Turo Välikangas
mappedWall;
100;
19800;
1 ( solid );
nearestPatchFace(AMI);
fluid;
fluid_to_solid;
fasterChtMultiRegionSimpleFoam
2016-12-05
13 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
tree structure for system/
system
controlDict
customRegexp
decomposeParDict
fluid
blockMeshDict
changeDictionaryDict
fvOptions
fvSchemes
fvSolution
fvSchemes
fvSolution
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
14 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
tree structure for system/
solid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvOptions
fvSchemes
fvSolution
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
15 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory,run and observe
fieldMinMax for comparing results
fieldMinMaxFluid
{
type
fieldMinMax;
functionObjectLibs ("libfieldFunctionObjects.so");
region fluid;
write
yes;
log
yes;
location no;
mode
magnitude;
fields
(
T
);
}
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
16 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
Run the case with chtMultiRegionSimpleFoam in FOAM Extend
4.0
cd..
cd oneFluidOneSolid2DFE40/
./Allrun >& log &
tree
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
17 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for 0/
.
0
cellToRegion
fluid
p
T
U
p
solid
cp
Kappa
rho
T
T
U
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
18 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for constant/
constant
fluid
fvOptions
g
radiationProperties
RASProperties
thermophysicalProperties
turbulenceProperties
regionProperties
solid
fvOptions
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
19 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for system/
fluid.setSet
faceSet fluid_to_solidZone new patchToFace fluid_to_solid
solid.setSet
faceSet solid_to_fluidZone new patchToFace solid_to_fluid
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
20 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for constant/
system
controlDict
customRegexp
decomposeParDict
fluid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvSchemes
fvSolution
fvSchemes
fvSolution
solid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvSchemes
fvSolution
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
21 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
constant/fluid/polyMesh/boundary
fluid_to_solid
{
type
nFaces
startFace
sampleMode
sampleRegion
samplePatch
offset
}
Turo Välikangas
directMappedWall;
100;
19900;
nearestPatchFace;
solid;
solid_to_fluid;
( 0 0 0 );
fasterChtMultiRegionSimpleFoam
2016-12-05
22 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
constant/solid/polyMesh/boundary
solid_to_fluid
{
type
nFaces
startFace
sampleMode
sampleRegion
samplePatch
offset
}
Turo Välikangas
directMappedWall;
100;
19800;
nearestPatchFace;
fluid;
fluid_to_solid;
( 0 0 0 );
fasterChtMultiRegionSimpleFoam
2016-12-05
23 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for system/
system
controlDict
decomposeParDict
fluid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvSchemes
fvSolution
fvSchemes
fvSolution
solid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvSchemes
fvSolution
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
24 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
Run the case with conjugateHeatSimpleFoam in FOAM Extend 4.0
cd..
cd oneFluidOneWall2DFE40Coupled/
./Allrun >& log &
tree
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
25 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for 0/
.
0
kappaEff
p
p_rgh
solid
k
T
T
U
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
26 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for constant/
constant
g
polyMesh
boundary
boundaryRegionAddressing
faces
faceZones
neighbour
owner
points
sets
fluid_to_solidZone
radiationProperties
RASProperties
transportProperties
turbulenceProperties
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
27 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
Coupling boundary condition for fluid
fluid_to_solid
{
type
nFaces
startFace
shadowRegion
shadowPatch
zone
attached
master
isWall
bridgeOverlap
}
Turo Välikangas
regionCouple;
100;
19900;
solid;
solid_to_fluid;
fluid_to_solidZone;
off;
on;
on;
false;
fasterChtMultiRegionSimpleFoam
2016-12-05
28 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for constant/
solid
fvOptions
polyMesh
boundary
faces
faceZones
neighbour
owner
points
sets
solid_to_fluidZone
thermalProperties
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
29 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
Coupling boundary condition
solid_to_fluid
{
type
nFaces
startFace
shadowRegion
shadowPatch
zone
attached
master
isWall
bridgeOverlap
}
Turo Välikangas
regionCouple;
100;
19800;
region0;
fluid_to_solid;
solid_to_fluidZone;
off;
off;
on;
false;
fasterChtMultiRegionSimpleFoam
2016-12-05
30 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
decomposeBug with conjugateHeatFoam
If you have to use bridgeOverlap true; When you decompose,
Foam-extend changes all true:s to false. Then use:
find -name "boundary" -exec sed -i ’s/false/true/g’ {} +
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
31 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
Go to the case directory, run and observe
tree structure for system/
system
blockMeshDict
changeDictionaryDict
controlDict
decomposeParDict
fvSchemes
fvSolution
solid
blockMeshDict
changeDictionaryDict
decomposeParDict
fvSchemes
fvSolution
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
32 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
How to create the files and edit the solver loop
chtCustomMultiRegionSimpleFoam
Create the basic files in your user directory and edit them: (These can be
found in the copyPaste file)
cd $WM_PROJECT_USER_DIR
mkdir -p applications/solvers/heatTransfer/
cd applications/solvers/heatTransfer/
cp -rf $FOAM_SOLVERS/heatTransfer/chtMultiRegionFoam/ ./
mv chtMultiRegionFoam/ chtCustomMultiRegionFoam
cd chtCustomMultiRegionFoam
mv chtMultiRegionSimpleFoam/ chtCustomMultiRegionSimpleFoam
cd chtCustomMultiRegionSimpleFoam
mv chtMultiRegionSimpleFoam.C chtCustomMultiRegionSimpleFoam.C
sed -i s/chtMultiRegionSimpleFoam/chtCustomMultiRegionSimpleFoam/g chtCustomMultiRegionSimpleFoam.C
sed -i s/chtMultiRegionSimpleFoam/chtCustomMultiRegionSimpleFoam/g Make/files
sed -i s/FOAM_APPBIN/FOAM_USER_APPBIN/g Make/files
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
33 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
How to create the files and edit the solver loop
chtCustomMultiRegionSimpleFoam
Edit the solver loop:
sed -i ’57i int numberOfFluidLoops =runTime.controlDict().lookupOrDefault<int>("numberOfFluidLoops", 1); \n’ ch
sed -i ’58i int numberOfSolidLoops =runTime.controlDict().lookupOrDefault<int>("numberOfSolidLoops", 1);\n’ cht
sed -i ’59i Info<< "The number of Fluid region loops per iteration step "<< numberOfFluidLoops<< endl;\n’ chtCu
sed -i ’60i Info<< "The number of Solid region loops per iteration step "<< numberOfSolidLoops << endl;\n’ chtC
sed -i ’69i for(int iFluid =1 ; iFluid <= numberOfFluidLoops; iFluid++){’ chtCustomMultiRegionSimpleFoam.C
sed -i ’79i }\nfor(int iSolid =1 ; iSolid <= numberOfSolidLoops; iSolid++){ ’ chtCustomMultiRegionSimpleFoam.C
sed -i ’90i }’ chtCustomMultiRegionSimpleFoam.C
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
34 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
How to create the files and edit the solver loop
chtCustomMultiRegionSimpleFoam
wmake
. /home/turo/OpenFOAM/OpenFOAM-4.x/etc/bashrc
run
cd oneFluidOneWall2D/oneFluidOneWall2DOF402Loop/
vim system/controlDict
./Allrun >& log&
cd ..
cd oneFluidOneWall2DOF405Loops/
./Allrun >& log&
cd ..
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
35 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
How to create the files and edit the solver loop
Plot results with spyder
In the Allrun a sed command collects the execution times in to a file:
sed -n -e ’/ExecutionTime/p’ log.conjugateHeatSimpleFoam
> ExecutionTime
Then the minimum temperature in the solid is plotted against the
ExecutionTime to see which solver converges fastest. Lets also compare
the temperature fields.
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
36 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
What have we learned, future work and extra content
Figure: Extra content
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
37 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
What have we learned, future work and extra content
What modifications were done
Add to the private side on the .H file
//- Time varying ambient temperature
autoPtr<Function1<scalar> > uniformAmbientTemperature_;
Then in the code where the heat transfer coefficient is calculated add:
const scalar t = this->db().time().timeOutputValue();
Ta_ = uniformAmbientTemperature_->value(t);
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
38 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
What have we learned, future work and extra content
An example of uniformExternalWallHeatFluxTemperature
wallWarm
{
type uniformExternalWallHeatFluxTemperature;
h uniform 25; //heat transfer coeff.
kappaMethod solidThermo;
kappaName default;
value uniform 293.15; // initial temp.
Ta
uniform 500;
// ambient temperature /[K]
h
uniform 25.0;
// heat transfer coeff /[W/K/m2]
thicknessLayers (0); // thickness of layer [m]
kappaLayers
(0);
// thermal conductivity of // layer [W/m/K]
value
uniform 500;
// initial temperature / [K]
kappaName
none;
uniformAmbientTemperature table
((0 293.15)
(20 487.82)
(40 622.36)
(60 717.65));
}
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
39 / 40
Introduction
cht in OF40
cht in FE40
conjugateHeatSimpleFoam in FE40
chtCustom
Conclusion
What have we learned, future work and extra content
An example of uniformExternalWallHeatFluxTemperature
All the conjugated heat transfer solvers need a special case setup
With a small modification the chtMultiRegionSimpleFoam can be a bit
faster
conjugateHeatSimpleFoam is superior compared to others
uniformExternalWallHeatFlux was created
I will use only coupled solvers in the future for conjugated heat
transfer problems!
Turo Välikangas
fasterChtMultiRegionSimpleFoam
2016-12-05
40 / 40
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )