The buoyantFoam solver - Dept of Thermo and Fluid Dynamics

Download Report

Transcript The buoyantFoam solver - Dept of Thermo and Fluid Dynamics

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
Nozzle
Inlet
C
A
T
H
O
D
E
Outlet
Outlet
anode
www.weldingengineer.com
Nozzle
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
U
is velocity.
Governing equations: Momentum equations

Momentum equations
(applications/solvers/heatTransfer/buoyantFoam/UEqn.H)
where
 eff
is the effective viscosity
lamin ar is laminar kinematics viscosity,
turbulent is turbulent viscosity.
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
 lamin ar
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
}

Cp
Pr C p
Governing equations: Energy equation
The temperature
(src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H)
T  Told
H (Told )  h

Cp
where Told is the temperature at the previous time step, Cp heat capacity and
H (T ) 
C pT  H f
W
where Hf reference enthalpy , W molecular weight.
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
21
blockMesh and checkMesh
5o
7
6
x
16
0
1
z
y
Geometry

paraFoam . buoyantFoamTIG
Figure 1: Mesh for “buoyantFoamTIG” case
Boundary and Initial conditions
Inlet
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
S
Y
M
M
E
T
R
y
C
A
T
H
O
D
E
Nozzle
Outlet
A
X
I
s
anode
Thermo physical properties

thermophysicalProperties dictionary
thermoType
hThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>
Thermophysical model:
Mixture property:
hThermo
pureMixture
General thermophysical model calculation based on
enthalpy h
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
perfectGas
Perfect 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
specieTheremoI.H
constTransportI.H
hconstThermoI.H
mixture
keyword
Ar
1
39.948
Molecule weight
[kg/kmol]
number
of molecules of species
name of species
520
0
3.4079e-05
0.65
Hf [J/kmol]
Dynamic viscosity
[kg/ms]
Heat capacity
Prandtl number
at constant pressure [J/kmol K]
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 solver
ldd ‘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();
}
: