Vous êtes sur la page 1sur 26

# 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
C A T H O D E

Inlet

Nozzle

Nozzle

Outlet

Outlet

www.weldingengineer.com

anode

## 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.

## Governing equations: Momentum equations

Momentum equations

(applications/solvers/heatTransfer/buoyantFoam/UEqn.H)

where

eff

## 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

la min 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

## 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

## blockMesh and checkMesh

7

21 5o

16

x
1

z y

Geometry

paraFoam . buoyantFoamTIG

## Boundary and Initial conditions

Inlet
C A T H O D E

Nozzle

Cathode tip
T=5000 K

Cathode wall

Anode

Inlet

Outlet
S Y M M E T R y A X I s

Nozzle

T=300 K

Wall

Wall

Wall

Wall

Velocity Inlet

Outlet
anode

## Thermo physical properties thermophysicalProperties dictionary

hThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>

thermoType

Thermophysical model: Mixture property: Transport coefficient: Derived thermophysical property: Basic thermophysical property: Equation of State

hThermo pureMixture

General thermophysical model calculation based on enthalpy h General thermophysical model calculation for passive gas mixture

constTransport Constant transport properties specieThermo Thermophysical properties of species, derived from
Cp, h

## hConstThermo Constant specific heat Cp with evaluation of enthalpy h 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 hconstThermoI.H constTransportI.H

mixture

Ar

39.948

520

3.4079e-05

0.65

keyword

## Molecule weight [kg/kmol] number of molecules of species name of species

Hf [J/kmol]
Dynamic viscosity [kg/ms] Heat capacity Prandtl number at constant pressure [J/kmol K]

Turbulent properties

## 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(); }