Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Convective Heat transfer in a vertical slotfor the course
CFD with OpenSource Software
Varun Venkatesh
Applied Mechanics/Fluid Dynamics,Chalmers University of Technology,
Gothenburg, Sweden
December 10, 2016
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 1 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Contents
1 Introduction
2 buoyantBoussinesqSimpleFoam
Solver DescriptionViscosity ModelsNew viscosity ModelTest case
3 buoyantSimpleFoam
Solver DescriptionTest case
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 2 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Natural Convection
2D Natural convection in a vertical slot with two walls at differenttemperatures.
The fluid rises along hot wall, turns at top, sinks down along cold walland turns again. This forms unicellular motion
In the current project, simulations are carried out on the vertical slotof dimensions 300mm high and 15mm wide.
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 3 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Overview
Description of solver buoyantBoussinesqSimpleFoam.
Description of Viscosity Models.
Implementation of new Viscosity model.
Test Case using buoyantBoussinesqSimpleFoam and new viscositymodel.
Description of buoyantSimpleFoam solver.
Test case using buoyantSimpleFoam.
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 4 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
buoyantBoussinesqSimpleFoam-Solver Description
Solver Organization
The solver has following directories
buoyantBoussinesqSimpleFoam.C
createFields.H
Make
files
options
pEqn.H
readTransportProperties.H
TEqn.H
UEqn.H
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 5 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
buoyantBoussinesqSimpleFoam-Solver Description
buoyantBoussinesqSimpleFoam.C
while (simple.loop())
{
{
#include "UEqn.H"
#include "TEqn.H"
#include "pEqn.H"
}
laminarTransport.correct();
turbulence->correct();
runTime.write();
}
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 6 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
buoyantBoussinesqSimpleFoam-Solver Description
createFields.H
Creates Pressure(Prgh), Velocity(U) and Temperature(T) fields
Transport and turbulence properties.
Density treated as ρ = 1− β(T − Tref ).Turbulent thermal diffusivity (alphat).
Dynamic Pressure is treated as p = ρ.g + prgh
Acceleration due to gravity(g) and body force(gh).
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 7 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
buoyantBoussinesqSimpleFoam-Solver Description
UEqn.H:
∇(φU) +∂U
∂t−∇.(νeff∇U)−∇.(νeff (∇U)T ) = −(∇ρ)gh−∇prgh
where νeff = ν + νtTEqn.H:
∇.(φT )−∇.αeff∇T = Sradiation + ST
Where, αeff = νtprt
+ νpr , Sradiation and ST are source terms due to
radiation and user defined source term respectively.
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 8 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
buoyantBoussinesqSimpleFoam-Solver Description
PEqn.H:The boundary flux is solved as:
φg = −raUFgh∇ρ
Using the boundary flux, the pressure is solved using equation:
∇.raUF∇prgh = ∇.φg
Where raUF is 1/U.Eqn.A() interpolated from volume field to face field.The pressure is then calculated as p = prgh + ρkgh. Finally velocity iscorrected using the updated flux and relaxed pressure.
Varun Venkatesh Convective Heat transfer in a vertical slot December 10, 2016 9 / 34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Viscosity Model
Viscosity models in OpenFoam
viscosityModel is a base class. There are five models as derived classes.
BirdCarreu
CrossPowerLaw
HerschelBulkley
Newtonian
powerLaw
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 10 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Viscosity Model
Link between transportModel, turbulenceModel and viscosityModel
TransportModel class is the base class for all the turbulence models.singlePhaseTransportModel reads the viscosity nu, corrects it andfetches it when it is called in the turbulenceModel class
singlePhaseTransportModel is a derived class of+viscosityModel. It has a pointer viscosityModelPtr which isprivate member data.
class singlePhaseTransportModel
:
public IOdictionary,
public transportModel
{
// Private Data
autoPtr<viscosityModel> viscosityModelPtr_;
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 11 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Viscosity Model
The member function nu returns the value of viscosity read fromviscosityModel and the member function correct corrects theviscosity
Foam::tmp<Foam::volScalarField>
Foam::singlePhaseTransportModel::nu() const
{
return viscosityModelPtr_->nu();
}
void Foam::singlePhaseTransportModel::correct()
{
viscosityModelPtr_->correct();
}
The class turbulenceModel has a private member datatransportModel which returns the value of nu as a volume scalarfield.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 12 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
New Viscosity Model
New Viscosity model
Viscosity is function of strain rate in non Newtonian fluids.OpenFoam has four non Newtonian viscosity models.
Newtonian model assumes constant viscosity. But viscosity is functionof temperature in Newtonian fluids.
New model is based on power law. It can be applied to bothNewtonian and non Newtonian fluids. Temperature dependency ofviscosity has been added based on Vogel’s law.
ν = k.γ̇(n−1) = exp(A+B
T + C)γ̇(n−1)
For Newtonian fluids, n = 1.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 13 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
New Viscosity Model
Steps for new viscosity model
Copy powerlaw folder from$FOAM_SRC/transportModels/incompressible/viscosityModels.
Copy Make from$FOAM_SRC/transportModels/incompressible/Make
Modify the name and path of the library in the files directory and addnecessary lninclude files in options directory
Include temperature based viscosity law in powerLaw.C
Add additional private data members in powerLaw.H
Replace powerLaw by new name tempLaw in all the above files andalso rename the .C and .H files. Compile by wmake libso
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 14 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Test Case
The already available tutorial hotRoom is used to implement the caseof verticalSlot.
Mesh Generation:
The blockMeshDict file in system directory has to be modified asper required geometry.
blockMesh command is used for mesh generation.
The mesh has four patches of type wall namely hot, cold andtopAndBottom. The frontAndBack has the empty patches.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 15 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Boundary Conditions
: The 0/ directory has eight directories.alphat, k, epsilon, nut, p_rgh, p, U and T.
These files have to be modified since the patches of our mesh isdifferent from that of the default tutorial.
Velocity Boundary condition
Internal Field uniform (0,0,0)
boundaryField
hot noSlip
cold noSlip
frontAndBack empty
topAndBottom noSlip
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 16 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Temperature Boundary condition
Internal Field fixedValue298
boundaryField
hot 323
cold 273
frontAndBack empty
topAndBottom zeroGradient
Two additional files v2 and f have to be created for implementing v2fturbulence model.
The dimensions of v2 is m2/s2 and f is 1/s and v2wallFunction andfwallFunction are used at walls respectively.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 17 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
constant/transportProperties
transportModel tempLaw;
tempLawCoeffs
{
m m [0 2 -1 0 0 0 0] 1;
A A [0 0 0 0 0 0 0] -2.2;
B B [0 0 0 0 0 0 0] 812.9;
C C [0 0 0 0 0 0 0] -140;
n n [0 0 0 0 0 0 0] 1;
nuMin nuMin [0 2 -1 0 0 0 0] 5e-6;
nuMax nuMax [0 2 -1 0 0 0 0] 5.5e-5;
}
The turbulence model has to be changed from kEpsilon to v2f inconstant/turbulenceProperties.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 18 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Solution Control
Add the following in system/controlDict
libs
(
"libusertempLaw.so"
);
Add the following in divSchemes in system/fvSchemes
div(phi,v2) bounded Gauss upwind;
div(phi,f) bounded Gauss upwind;
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 19 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Solution Control
Adding a solver for f under solvers section in system/fvSolution
f
{
solver PCG;
preconditioner DIC;
tolerance 1e-5;
relTol 0.1;
}
Replace (k|epsilon|R) as (k|epsilon|v2|f) under SIMPLE andrelaxationFactor in system/fvSolution.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 20 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Results
The case can be run using buoyantBoussinesqSimpleFoam. The resultscan be checked using paraFoam.
Temperature Viscosity
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 21 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Results
Velocity
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 22 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
buoyantSimpleFoam
/buoyantSimpleFoam
buoyantSimpleFoam.C
createFieldRefs.H
createFields.H
EEqn.H
Make
files
options
pEqn.H
UEqn.H
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 23 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
CreateFields.H
In createFields, class rhoThermo.H is used which is athermophysical model belonging to thermophysical model library.
The temperature is not solved directly, thus it is not created as a filedin createFields.H. Instead enthalpy or internal energy areconsidered based on energy model chosen.
Since the density change is being accounted, it is created as field increateFields.H.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 24 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
Governing Equations
UEqn.H:
∇(φU) +∂ρU
∂t−∇.(µeff∇U)−∇.(µeff (∇U)T ) = −(∇ρ)−∇prgh
EEqn.H:
∇.(φhe) +∇.(φ(0.5√U +
p
ρ))∇.αeff∇T = Sradiation + Sh
Where Sradiation and Sh are radiation and user defined source termsrespectively.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 25 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
PEqn.HThe flux at boundaries are calculated and then equation for pressure issolved and relaxed.
φg = −ρ.raUF.g.h∇ρ
∇.ρraUF∇prgh = ∇.φg
Velocity is corrected based on boundary flux and pressure relaxation.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 26 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
Thermophysical properties
The solver accesses thermophysicalproperties dictionary to getall the thermophysical properties.
The thermophysical models available in OpenFoam arepsiThermo, rhoThermo, rhoReactionThermo
psiuReactionThermo, rhoReactionThermo, multiphaseReactionThermo.
buoyantSimpleFoam uses rhoThermo to access the thermophysicalproperties. It is a density based model.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 27 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
Thermophysical properties
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport constant;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleEnthalpy;
}
Mixture specifies mixture composition. pureMixture is used tospecify a mixture without any reaction.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 28 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Solver Description
Thermophysical properties
transport specifies the transport model to be used. The transportmodel evaluate properties like dynamic viscosity, thermal conductivityand thermal diffusivity.
thermo specifies the type of thermodynamic model used. hthermo
assumes contant cp.
The equations of state available in the thermophysical library arerhoConst, perfectGas, incompressiblePerfectGas, perfectFluid etc.Density is calculated based on these equations.
The form of energy used in specified through this. sensibleEnthalpyand sensibleInternalEnergy are few examples.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 29 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Test Case
The tutorial buoyantCavity is used as a base for this case.
The mesh for this case is similar to that used in the previous case.Same blockMeshDict file is used.
The boundary conditions used for this case is similar to previous case.Except that the wall function used for alphat iscompressible::alphatWallFunction;. Also v2 and f files areadded to implement v2f turbulence model.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 30 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
ThermophysicalProperties
In constant/thermophysicalProperties,
mixture
specie
{
nMoles 1;
molWeight 162.38;
}
thermodynamics
{
Cp 1600;
Hf 0;
}
transport
{
mu 5e-05;
Pr 0.9;
}
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 31 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Solution Control
The fvSchemes and fvSolution directories in system are modifiedsimilarly as done in previous case to add v2 and f.
The case is run using buoyantSimpleFoam and results can bechecked using paraFoam.
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 32 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Results
Temperature Velocity
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 33 /
34
Introduction buoyantBoussinesqSimpleFoam buoyantSimpleFoam
Test Case
Questions??
Thank You
Varun Venkatesh Convective Heat transfer in a vertical slotDecember 10, 2016 34 /
34