1、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/buoy
2、antFoam,Example of application with the buoyantFoam solver,Symmetry axis,Inlet,Inlet,Outlet,Outlet,Nozzle,Nozzle,C A T H O D E,anode,,Governing equations: Continuity equation,Continuity equation (OpenFoam/OpenFoam -1.4/src/finiteVolume/cfdTools/compressible/rhoEqn.h)*-*/ solve(fvm:ddt(rho) + fvc:div
3、(phi); / * / where is density and is velocity.,Governing equations: Momentum equations,Momentum equations (applications/solvers/heatTransfer/buoyantFoam/UEqn.H)where is the effective viscosityis laminar kinematics viscosity,is turbulent viscosity.,Pressure correction equation,(applications/solvers/h
4、eatTransfer/buoyantFoam/pEqn.H ):,Governing equations: Energy equation,Energy equation,(applications/solvers/heatTransfer/buoyantFoam/hEqn.H),Governing equations: Energy equation,is defined in OpenFOAM/OpenFOAM-1.4/src/thermophysicalModels /specie/transport/const/constTransportI.H,/ Thermal diffusiv
5、ity for enthalpy kg/mstemplate inline scalar constTransport: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 ,Governing equations: Energy equation,The
6、 temperature (src/thermophysicalModels/specie/thermo/specieThermo/specieThermoI.H)where Told is the temperature at the previous time step, Cp heat capacity andwhere Hf reference enthalpy , W molecular weight.,Governing equations: Ideal gas,Equation of state (src/thermophysicalModels/basic/basicTherm
7、o.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/blockMeshDictblockMesh and checkMesh,x,y,z,0,7,1,16,21,6,Geometry,paraFoam . buoyantFoamTIG,Figure
8、1: Mesh for “buoyantFoamTIG” case,Boundary and Initial conditions,S Y M M E T R y A X I s,C A T H O D E,Inlet,Outlet,Nozzle,anode,Thermo physical properties,thermophysicalProperties dictionarythermoType hThermo,Thermophysical properties,The basic thermophysical properties are specified for each spec
9、ies from the input data file The data is specified using a compound entry with following format for a species access through the keyword mixturemixture Ar 1 39.948 520 0 3.4079e-05 0.65,keyword,name of species,number of molecules of species,Molecule weightkg/kmol,Heat capacity at constant pressure J
10、/kmol K,Dynamic viscositykg/ms,Prandtl number,specieTheremoI.H,hconstThermoI.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 dis
11、tribution 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
12、/ 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 preparedOpenFOAM/username-
13、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 Modifi
14、ed 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)/spec
15、iesTable.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 basic
16、Thermo = basicThermo $(basicMixture)/basicMixture.C $(basicThermo)/basicThermo.C $(basicThermo)/newBasicThermo.C $(basicThermo)/basicThermos.C derivedFvPatchFields/fixedEnthalpy/fixedEnthalpyFvPatchScalarField.C derivedFvPatchFields/gradientEnthalpy/gradientEnthalpyFvPatchScalarField.C derivedFvPatc
17、hFields/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:atomicWeight
18、s = 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)/makeLang
19、muirHinshelwoodReactions.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 (“libspecieT
20、IG”) 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 -lmeshTool
21、s -lbasicThermophysicalModelsTIG -lspecieTIG -lcompressibleTurbulenceModelsTIG,Example of new thermophysical model,change Make/options:buoyantFoam.CEXE=$(FOAM_USER_APPBIN)/buoyantFoamTIGCompile solver (wmake) To check the our new solver is using the new libraries:ldd which buoyantFoamTIGsolver | les
22、s,Example of new thermophysical model,OpenFoam/user-1.4/src/thermophycialModels/specie/thermo/hConst:,/- Heat capacity at constant pressure J/(kmol K)template inline scalar hConstThermo:cp(const scalar ) const return CP*this-W(); /- Enthalpy J/kmoltemplate inline scalar hConstThermo : h(const scalar T) const return (CP*T + Hf)*this-W(); ,