Download - Buoyant Foam Tutorial
The buoyantFoam solver OpenFoam course
Chalmers
March, 2008 Margarita Sass-Tisovskaya
BuoyantFoam solver
The buoyantFoam solver is a transient solver for buoyant, turbulent flow of compressible fluids used for ventilation and heat transfer.
OpenFoam/OpenFoam-1.4/applications/solvers/heatTransfer/buoyantFoam
Example of application with the buoyantFoam solver
Symmetry axis
Inlet Inlet
OutletOutlet
Nozzle Nozzle
CATHODE
anode www.weldingengineer.com
Governing equations: Continuity equation
Continuity equation(OpenFoam/OpenFoam -1.4/src/finiteVolume/cfdTools/compressible/rhoEqn.h)
\*---------------------------------------------------------------------------*/ { solve(fvm::ddt(rho) + fvc::div(phi)); } // *************************************************************** //
where is density and is velocity. U
Governing equations: Momentum equations
Momentum equations
(applications/solvers/heatTransfer/buoyantFoam/UEqn.H)
where is the effective viscosity
is laminar kinematics viscosity,
is turbulent viscosity.
eff
arlamin
turbulent
Pressure correction equation
(applications/solvers/heatTransfer/buoyantFoam/pEqn.H ):
Governing equations: Energy equation
Energy equation(applications/solvers/heatTransfer/buoyantFoam/hEqn.H)
Governing equations: Energy equation
arlamin is defined in OpenFOAM/OpenFOAM-1.4/src/thermophysicalModels/specie/transport/const/constTransportI.H
// Thermal diffusivity for enthalpy [kg/ms] template<class thermo> inline scalar constTransport<thermo>::alpha( const scalar T) const { scalar Cp_ = this->Cp(T); scalar deltaT = T - specie::Tstd; scalar CpBar = (deltaT*(this->H(T) - this->H( specie::Tstd )) + Cp_)/( sqr(deltaT) + 1 );
return Cp_*mu(T)*rPr/CpBar }
p
p
C
C
Pr
Governing equations: Energy equation
The temperature (src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H)
where Told is the temperature at the previous time step, Cp heat capacity and
where Hf reference enthalpy , W molecular weight.
W
HTCTH fp
)(
Cp
hTHTT oldold
)(
Governing equations: Ideal gas
Equation of state (src/thermophysicalModels/basic/basicThermo.H)
Create case in OpenFOAM
Create a new application (ex. with FoamX) buoyantFoamTIG Times directory “0”, constant and system
directory
Geometry
2 dimensional axis symmetric problem
constant/polyMesh/blockMeshDict
blockMesh and checkMesh o5
x
y
z0
7
1
16
21
6
Geometry
paraFoam . buoyantFoamTIG
Figure 1: Mesh for “buoyantFoamTIG” case
Boundary and Initial conditions
SYMMETRy
AXIs
CATHODE
Inlet
Outlet
Nozzle
anode
Nozzle Cathode
tip
Cathode wall
Anode Inlet Outlet
grad(T)=0 T=5000 K grad(T)=0 grad(T)=0 T=300 K grad(T)=0
Wall Wall Wall Wall Velocity Inlet
Pressure
Outlet
Thermo physical properties thermophysicalProperties dictionary
thermoType hThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>
Thermophysical model: hThermo General thermophysical model calculation based on enthalpy h
Mixture property: pureMixture General thermophysical model calculation for passive gas mixture
Transport coefficient: constTransport Constant transport properties
Derived thermophysical property:
specieThermo Thermophysical properties of species, derived from Cp, h
Basic thermophysical property:
hConstThermo Constant specific heat Cp with evaluation of enthalpy h
Equation of State perfectGasPerfect gas equation of state
Thermophysical properties The basic thermophysical properties are specified for each species from the
input data file The data is specified using a compound entry with following format for a species
access through the keyword mixture
mixture Ar 1 39.948 520 0 3.4079e-05 0.65
keyword
name of species
number of molecules of species
Molecule weight [kg/kmol]
Heat capacity at constant pressure [J/kmol K]
Dynamic viscosity [kg/ms]
Prandtl number
specieTheremoI.HhconstThermoI.H
constTransportI.H
Hf [J/kmol]
Turbulent properties
The turbulentProperties dictionary is set in const/turbulentProperties
turbulentModel “laminar” turbulence “off”
Solution: Temperature distribution
Figure 1:Temperature distribution at T=0 s Figure 2: 1:Temperature distribution at T=0.64 s
Solution: Velocity profile
Figure 1: Velocity profile at T=0 s Figure 1: Velocity profile at T=0.64 s
Create new thermophysical model Copy the already existing thermophysical model from
OpenFOAM/OpenFOAM-1.4/src/thermophysicalModels/ to the user directory and rename
Modify it accordingly to once needs Change files and options
For example (species) the last line in file:LIB=$(FOAM-USERLIBBIN)/libspecieTIG)
To compile: ./Allwmake or remove dependencies and wmake libso To check:
- that library has been prepared OpenFOAM/username-1.4/lib/linux64Gcc4DPOpt/libspecieTIG.so
- that it is used by the solverldd ‘which name_solver ‘ | less
Example of new thermophysical model Create in OpenFoam/user-1.4/src/ thermophysicalModels directory Copy from OpenFOAM/OpenFOAM-1.4/src/thermophysicalModels/ specie and
thermo and Allwmake file Modified files and options OpenFoam/user-1.4/src/ thermophysicalModels/specie/make/files:
atomicWeights = atomicWeights specie = specie speciesTable = speciesTable perfectGas = equationOfState/perfectGas reactions = reaction/reactions $(atomicWeights)/atomicWeights.C $(specie)/specie.C $(speciesTable)/speciesTable.C $(perfectGas)/perfectGas.C $(reactions)/makeChemkinReactions.C $(reactions)/makeLangmuirHinshelwoodReactions.C
LIB = $(FOAM_USER_LIBBIN)/libspecieTIG
Example of new thermophysical model OpenFoam/user-1.4/src/ thermophysicalModels/basic/make/files:
basicMixture = mixtures/basicMixture
basicThermo = basicThermo
$(basicMixture)/basicMixture.C
$(basicThermo)/basicThermo.C
$(basicThermo)/newBasicThermo.C
$(basicThermo)/basicThermos.C
derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C
derivedFvPatchFields/mixedEnthalpy/mixedEnthalpyFvPatchScalarField.C
derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
LIB = $(FOAM_USER_LIBBIN)/libbasicThermophysicalModelsTIG
Example of new thermophysical model OpenFoam/user-1.4/src/ thermophysicalModels/basic/make/options:
atomicWeights = atomicWeights
specie = specie
speciesTable = speciesTable
perfectGas = equationOfState/perfectGas
reactions = reaction/reactions
$(atomicWeights)/atomicWeights.C
$(specie)/specie.C
$(speciesTable)/speciesTable.C
$(perfectGas)/perfectGas.C
$(reactions)/makeChemkinReactions.C
$(reactions)/makeLangmuirHinshelwoodReactions.C
LIB = $(FOAM_USER_LIBBIN)/libspecieTIG
Example of new thermophysical model OpenFoam/user-1.4/src/ thermophysicalModels/basic/make/Allwmake:#!/bin/sh set -x wmake libso
specie wmake libso basic
Tell to use our new library by adding a line to ControlDict : libs (“ libspecieTIG”) Another way to copy solver to user directory and change Make/options: EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(WM_PROJECT_USER_DIR)/src/thermophysicalModels/basic/lnInclude \ -I$(WM_PROJECT_USER_DIR)/src/turbulenceModels \ -I../XiFoam
EXE_LIBS = \ -L$(FOAM_USER_LIBBIN) \ -lfiniteVolume \ -lmeshTools \ -lbasicThermophysicalModelsTIG\ -lspecieTIG\ -lcompressibleTurbulenceModelsTIG
Example of new thermophysical model change Make/options:
buoyantFoam.C
EXE=$(FOAM_USER_APPBIN)/buoyantFoamTIG
Compile solver (wmake) To check the our new solver is using the new libraries:
ldd ‘which buoyantFoamTIGsolver ‘ | less
Example of new thermophysical model
OpenFoam/user-1.4/src/thermophycialModels/specie/thermo/hConst:
//- Heat capacity at constant pressure [J/(kmol K)]
template<class equationOfState>inline scalar hConstThermo<equationOfState>::cp(const scalar ) const{return CP*this->W(); }
//- Enthalpy [J/kmol]template<class equationOfState>inline scalar hConstThermo< equationOfState > :: h(const scalar T) const {return (CP*T + Hf)*this->W(); }