26
The buoyantFoam solver OpenFoam course Chalmers March, 2008 Margarita Sass-Tisovskaya

Buoyant Foam Tutorial

Embed Size (px)

Citation preview

Page 1: Buoyant Foam Tutorial

The buoyantFoam solver OpenFoam course

Chalmers

March, 2008 Margarita Sass-Tisovskaya

Page 2: Buoyant Foam Tutorial

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

Page 3: Buoyant Foam Tutorial

Example of application with the buoyantFoam solver

Symmetry axis

Inlet Inlet

OutletOutlet

Nozzle Nozzle

CATHODE

anode www.weldingengineer.com

Page 4: Buoyant Foam Tutorial

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

Page 5: Buoyant Foam Tutorial

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

Page 6: Buoyant Foam Tutorial

Pressure correction equation

(applications/solvers/heatTransfer/buoyantFoam/pEqn.H ):

Page 7: Buoyant Foam Tutorial

Governing equations: Energy equation

Energy equation(applications/solvers/heatTransfer/buoyantFoam/hEqn.H)

Page 8: Buoyant Foam Tutorial

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

Page 9: Buoyant Foam Tutorial

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

)(

Page 10: Buoyant Foam Tutorial

Governing equations: Ideal gas

Equation of state (src/thermophysicalModels/basic/basicThermo.H)

Page 11: Buoyant Foam Tutorial

Create case in OpenFOAM

Create a new application (ex. with FoamX) buoyantFoamTIG Times directory “0”, constant and system

directory

Page 12: Buoyant Foam Tutorial

Geometry

2 dimensional axis symmetric problem

constant/polyMesh/blockMeshDict

blockMesh and checkMesh o5

x

y

z0

7

1

16

21

6

Page 13: Buoyant Foam Tutorial

Geometry

paraFoam . buoyantFoamTIG

Figure 1: Mesh for “buoyantFoamTIG” case

Page 14: Buoyant Foam Tutorial

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

Page 15: Buoyant Foam Tutorial

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

Page 16: Buoyant Foam Tutorial

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]

Page 17: Buoyant Foam Tutorial

Turbulent properties

The turbulentProperties dictionary is set in const/turbulentProperties

turbulentModel “laminar” turbulence “off”

Page 18: Buoyant Foam Tutorial

Solution: Temperature distribution

Figure 1:Temperature distribution at T=0 s Figure 2: 1:Temperature distribution at T=0.64 s

Page 19: Buoyant Foam Tutorial

Solution: Velocity profile

Figure 1: Velocity profile at T=0 s Figure 1: Velocity profile at T=0.64 s

Page 20: Buoyant Foam Tutorial

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

Page 21: Buoyant Foam Tutorial

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

Page 22: Buoyant Foam Tutorial

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

Page 23: Buoyant Foam Tutorial

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

Page 24: Buoyant Foam Tutorial

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

Page 25: Buoyant Foam Tutorial

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

Page 26: Buoyant Foam Tutorial

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