25
2009-11-18 Flow boiling implementation with OpenFoam Qingming Liu KTH,Department of Energy

Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18

Flow boiling implementation with OpenFoam

Qingming LiuKTH,Department of Energy

Page 2: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18

contents

● Introduction

● Background

● Physical and mathmatic models

● Implementation on OpenFoam

● Transport model

● Solvers

● Boundary conditions

Page 3: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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.

Page 4: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

Background

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

Page 5: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

• Macro scale

• Flow boiling in a uniformly heated circular tube

( Collier & Thome, 1994, p.170)

Page 6: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

• Transition

• skewed flow• liquid ring flow

• frothy annular flow• Transition

• rivulet flow

Bubbly flow

slug flow(elongated bubble)

annular flow

Page 7: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

Mathmatical models

∂α∂t+u∇α=0 ;

Page 8: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

Discription of problem

Page 9: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

Openfoam

+Energy equation

+Cp,K,

InterFoam

UtilitiesSwak4Foam

LibrariesTransportModels

myinterFoamDiabatic

OpenFOAMinterFoam

myinterFoamDiabatic mytransportModels

Page 10: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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_;};

Page 11: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 12: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 13: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 14: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 15: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 16: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18

Utilities Swak4Foam

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

Page 17: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18

Set up Case Mesh

fluent3DMeshToFoam

Page 18: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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;

Page 19: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 20: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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;

}

Page 21: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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

Page 22: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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"

Page 23: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18

Run in parallel

decomposate

DecomposePar

numberOfSubdomains 4;

method simple;

simpleCoeffs

{

n ( 2 2 1 );

delta 0.001;

Page 24: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

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;

Page 25: Flow boiling implementation with OpenFoamhani/kurser/OS_CFD_2011/QingmingLiu/projectSlide... · isothermal flow by adding energy equation as well as implementing an heat flux boundary

2009-11-18