Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... ·...

Preview:

Citation preview

2009-11-18

Flow boiling implementation with OpenFoam

Qingming LiuKTH,Department of Energy

2009-11-18

contents

● Introduction

● Background

● Physical and mathmatic models

● Implementation on OpenFoam

● Transport model

● Solvers

● Boundary conditions

Introduction

Set up the bubbly flow case in OpenFOAM.

Implementing “myInterFoamDiabatic” based on “interFoam” which using VOF method for simulation of two phase isothermal flow by adding energy equation as well as implementing an heat flux boundary condition.

To study the flow pattern and temperature of elongated bubble flow in micro-channels(with diameter 1.7mm).

Future plan:adding source terms to the U,T equations.

Background

• MEMS(micro electronic and mechanic systems)• fuel cells• cooling of micro-electronic chips• compact heat exchangers

• Macro scale

• Flow boiling in a uniformly heated circular tube

( Collier & Thome, 1994, p.170)

• Transition

• skewed flow• liquid ring flow

• frothy annular flow• Transition

• rivulet flow

Bubbly flow

slug flow(elongated bubble)

annular flow

Mathmatical models

∂α∂t+u∇α=0 ;

Discription of problem

Openfoam

+Energy equation

+Cp,K,

InterFoam

UtilitiesSwak4Foam

LibrariesTransportModels

myinterFoamDiabatic

OpenFOAMinterFoam

myinterFoamDiabatic mytransportModels

2009-11-18

transportModels/incompressibleTwoPhaseProperties/twoPhaseMixture.H

Add specific heat capacity,prandlt number,thermal conductivities for each phase

dimensionedScalar cp1_;dimensionedScalar cp2_;dimensionedScalar Pr1_;dimensionedScalar Pr2_; 

Const tmp<surfaceScalarField> kappaf()

const dimensionedScalar& Pr1() const{return Pr1_;}

const dimensionedScalar& Pr2() const{return Pr2_;};

const dimensionedScalar& cp1() const{return cp1_;}

const dimensionedScalar& cp2() const{return cp2_;};

2009-11-18

twoPhaseMixture.C

cp1_(nuModel1_->viscosityProperties().lookup("cp")),cp2_(nuModel2_->viscosityProperties().lookup("cp")),Pr1_(nuModel1_->viscosityProperties().lookup("Pr")),Pr2_(nuModel2_->viscosityProperties().lookup("Pr")),

tmp<surfaceScalarField> twoPhaseMixture::kappaf() const{surfaceScalarField alpha1f =min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1));

return tmp<surfaceScalarField>(new surfaceScalarField("kappaf",alpha1f*rho1_*cp1_*(1/Pr1_)*fvc::interpolate(nuModel1_->nu())+ (scalar(1) - alpha1f)*rho2_*cp2_*(1/Pr2_)*fvc::interpolate(nuModel2_->nu())));}

2009-11-18

Read function twoPhaseMixture.C

bool twoPhaseMixture::read(){if (transportModel::read()){if(nuModel1_().read(subDict(phase1Name_))&& nuModel2_().read(subDict(phase2Name_))){nuModel1_->viscosityProperties().lookup("rho") >> rho1_;nuModel2_->viscosityProperties().lookup("rho") >> rho2_;nuModel1_->viscosityProperties().lookup("cp") >> cp1_;nuModel2_->viscosityProperties().lookup("cp") >> cp2_;nuModel1_->viscosityProperties().lookup("Pr") >> Pr1_;nuModel2_->viscosityProperties().lookup("Pr") >> Pr2_;

complied the lib to $FOAM_USER_LIBBIN

modifying the Make/files:

LIB = $(FOAM_USER_LIBBIN)/libmyincompressibleTransportModels

2009-11-18

Solver: myinterFoamDiabaticalphaEqnSubcycle.H

Info<< "Reading / calculating rho*cp\n" << endl;volScalarField rhoCp(IOobject("rho*Cp",runTime.timeName(),mesh,IOobject::NO_READ,IOobject::NO_WRITE),alpha*rho1*cp1 + (scalar(1) - alpha)*rho2*cp2,alpha.boundaryField().types());rhoCp.oldTime();

Info<< "Reading / calculating rho*phi*cp\n" << endl;surfaceScalarField rhoPhiCpf(IOobject("rho*phi*cpf",runTime.timeName(),mesh,IOobject::NO_READ,IOobject::NO_WRITE),rhoPhi*cp1

Add specific heat capacity,prandlt number,thermal conductivities for each phase

CreateFields.H:

const dimensionedScalar& cp1 = twoPhaseProperties.cp1();const dimensionedScalar& cp2 = twoPhaseProperties.cp2();

2009-11-18

solver

create TEqn.H

surfaceScalarField kappaf = twoPhaseProperties.kappaf();

fvScalarMatrix TEqn(fvm::ddt(rhoCp, T)+ fvm::div(rhoPhiCpf, T)- fvm::laplacian(kappaf, T));

Teqn.solve();

InterFoam.C

Add:

#include "Teqn.H"

Modifying Make/files

EXE = $(FOAM_USER_APPBIN)/myinterFoamDiabatic

2009-11-18

Make

EXE_LIBS = \

-L$(FOAM_USER_LIBBIN) \

-linterfaceProperties \

-lmyincompressibleTransportModels \

-lincompressibleTurbulenceModel \

-lincompressibleRASModels \

-lincompressibleLESModels \

-lfiniteVolume

Modifying Make/optionsEXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(WM_PROJECT_USER_DIR)/src/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude

2009-11-18

Utilities Swak4Foam

svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.7/libraries/swak4Foam

2009-11-18

Set up Case Mesh

fluent3DMeshToFoam

2009-11-18

Set up the case:add Cp and Prandlt number

constant/transportProperties

add Cp and Prandlt number

phase1

{

transportModel Newtonian;

nu nu [ 0 2 -1 0 0 0 0 ] 0.75e-06;

rho rho [ 1 -3 0 0 0 0 0 ] 1199.02;

Pr Pr [0 0 0 0 0 0 0] 0.9;

cp cp [0 2 -2 -1 0 0 0] 1433.4;

phase2

{

transportModel Newtonian;

nu nu [ 0 2 -1 0 0 0 0 ] 3.57e-06;

rho rho [ 1 -3 0 0 0 0 0 ] 34.424;

Pr Pr [0 0 0 0 0 0 0] 0.87;

cp cp [0 2 -2 -1 0 0 0] 1045.2;

2009-11-18

system/controdict, fvSchemes

application myinterFoamDiabatic;

to use the new libraries

libs("libmyincompressibleTransportModels.so");

add new finite divergence schemes for Temperature

divSchemes

{

div(rho*phi,U) Gauss limitedLinearV 1;

div(phi,alpha) Gauss vanLeer;

div(rhoPhiCpf, T) Gauss upwind;

div(phirb,alpha) Gauss interfaceCompression;

}

add new finite volume solution methods for Temperature

T

{

solver BICCG;

preconditioner DILU;

tolerance 1e-7;

relTol 0;}

2009-11-18

Temperature boundary conditions

vi 0/T

dimensions [0 0 0 1 0 0 0];

internalField uniform 300;

boundaryField

inlet

{

type fixedValue;

value uniform 300;

}

wall

{

type fixedValue;

value uniform 300;

outlet

{

type pressureInletOutletTemperature;

phi phi;

value $internalField;

}

2009-11-18

Set up the constant heat flux wallset boundary condtions

constant heat flux wall

gradient(T)=q/k =15000/81.626=183,764977

vi 0/T

wall

{

type fixedGradient;

value uniform 183.764977;

}

outlet

{

type zeroGradient;

}

set the gravity in the constant/g

dimensions [0 1 -2 0 0 0 0];

value (0 0 9.81);

constant/turbulenceProperties

2009-11-18

Initialize the phase (bubble)

funkySetFields (swak4foam)

funkySetFields -field alphagas -expression 1 -time 0 -keepPatches -condition "pow(pos().x,2) + pow(pos().y,2) < pow(0.0075,2) && pos().z>0.12"

2009-11-18

Run in parallel

decomposate

DecomposePar

numberOfSubdomains 4;

method simple;

simpleCoeffs

{

n ( 2 2 1 );

delta 0.001;

2009-11-18

Run caseSystem/ControDict

application interFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 0.02;

deltaT 2e-4;

writeControl adjustableRunTime;

writeInterval 0.001;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

adjustTimeStep on;

maxCo 0.5;

maxAlphaCo 0.5;

maxDeltaT 1;

2009-11-18

Recommended