Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... ·...

27
Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles Ebrahim Ghahramani Chalmers University of Technology, Gothenburg, Sweden 2016-12-05 Ebrahim Ghahramani Beamer slides template 2016-12-05 1 / 26

Transcript of Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... ·...

Page 1: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement of the VOF-LPT Solver for Bubbles

Ebrahim Ghahramani

Chalmers University of Technology,Gothenburg, Sweden

2016-12-05

Ebrahim Ghahramani Beamer slides template 2016-12-05 1 / 26

Page 2: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

1 Introduction

2 TheoryVolume of FluidLagrangian Particle Tracking

3 SolverOriginal SolverImprovement

4 Sample ProblemBubble in Channel Flow

Ebrahim Ghahramani Beamer slides template 2016-12-05 2 / 26

Page 3: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

LPT-VOF Solver

Aurelia Vallier developed a LPT-VOF solver before (OSCFD course 2011)

Solver is a coupling of interFoam solver with Lagrangian library

Eulerian Model: VoF approach

Lagrangian Library: solidParticle

Aim:

To improve the solver for bubble particle

Implementing the Rayleigh-Plesset equation

Ebrahim Ghahramani Beamer slides template 2016-12-05 2 / 26

Page 4: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Volume of Fluid

VoF method

Eulerian Approach for modeling multiphase flows

Multiphase flow is treated as a single fluid mixture

Continuity Navier-Stokes equations

∂ρm∂t

+∂ (ρmui)

∂xi= 0

∂ (ρmui)

∂t+∂ (ρmuiuj)

∂xj=∂τij∂xj

+ ρmgi + Sp + Sst

However,

ρm = αρ1 + (1− α)ρ2 µm = αµ1 + (1− α)µ2

Ebrahim Ghahramani Beamer slides template 2016-12-05 3 / 26

Page 5: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Lagrangian Particle Tracking

LPT method

Tracking individual particles

Particle p: xp, dp , up,i and ρp

Continuity Navier-Stokes equations

dxp,idt

= up,i

mpdup,idt

= mp(uf,i − up,i)

τp+ (ρp − ρf )gi

τp =4

3

ρpd2p

ρfCD|uf,i − up,i|

CD : Particle drag coefficient

Ebrahim Ghahramani Beamer slides template 2016-12-05 4 / 26

Page 6: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Lagrangian Particle Tracking

Rayleigh-Plesset equation

Variation of bubble radius in incompressible flows

R(t)R(t) +3

2R2(t) =

PB − Plρl

− 4νlR(t)

R(t)− 2σstρlR(t)

PB is the bubble pressure

PB = Pv + Pg0

(R0

R(t)

)3k

Pg0 equilibrium pressure of dissolved gas and R0 Equilibrium radius

Equilibrium State

R03γ +

2σstP0 − Pv

R03γ−1 +

R3γ

P0 − Pv

(Pv −

2σstR− Pl

)= 0

Ebrahim Ghahramani Beamer slides template 2016-12-05 5 / 26

Page 7: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Original Solver

Solver directory content

interFoam.C

alphaCourantNo.H

alphaEqn.H

alphaEqnSubCycle.H

correctPhi.H

createFields.H

myCM.H

pEqn.H

UEqn.H

setDeltaT.H

setRDeltaT.H

solidParticle.C

solidParticleCloud.C

solidParticleIO.C

solidParticle.H

solidParticleI.H

solidParticleCloud.H

solidParticleCloudI.H

LPTtoVOF.H

Make

interDyMFoam

interMixingFoam

First follow Vallier’s presentation to have the original solver

Ebrahim Ghahramani Beamer slides template 2016-12-05 6 / 26

Page 8: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Original Solver

Solver Description

solidParticleCloud: a class that contains a cloud of solid particlesand track them in the flow field

Subclass of Cloud<solidParticle> class

Cloud is a Base cloud calls templated on particle type.

Subclass of cloud classA cloud is a collection of lagrangian particles.Cloud has some general functions for tracking a collection of particles

solidParticle : Subclass of the particle with additional memberdata and functions to track each particle

Ebrahim Ghahramani Beamer slides template 2016-12-05 7 / 26

Page 9: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Original Solver

Solver Description

In interFoam.C a solidParticleCloud object (named particles)is constructed

Also, solidParticleCloud::move is called viaparticles.move(g)

In solidParticleCloud::move function:

Interpolated flow variables passedcalling Cloud<solidParticle>::move function

In Cloud<solidParticle>::move:

A loop over all solidParticlesCalling solidParticle::move function in the loop to track eachparticle

Ebrahim Ghahramani Beamer slides template 2016-12-05 8 / 26

Page 10: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Original Solver

Updating the solver

void Foam::solidParticleCloud::inject(solidParticle::trackingData &td)

{

label cellI=1;

label tetFaceI=1;

label tetPtI=1;

mesh_.findCellFacePt(td.cloud().posP1_, cellI, tetFaceI, tetPtI);

solidParticle* ptr1 = new solidParticle(mesh_, td.cloud().posP1_,

cellI, tetFaceI, tetPtI,td.cloud().dP1_, td.cloud().UP1_);

Cloud<solidParticle>::addParticle(ptr1);

mesh_.findCellFacePt(td.cloud().posP2_, cellI, tetFaceI, tetPtI);

solidParticle* ptr2 = new solidParticle(mesh_, td.cloud().posP2_,

cellI, tetFaceI, tetPtI, td.cloud().dP2_, td.cloud().UP2_);

Cloud<solidParticle>::addParticle(ptr2);

}

Ebrahim Ghahramani Beamer slides template 2016-12-05 9 / 26

Page 11: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

New member data

In solidParticle class

Description In the solverbubble radius Rtemporal derivative of bubble radius Rdtequilibrium radius R0dissolved gas pressure pGequilibrium dissolved gas pressure pG0bubble inside pressure pBa numerical variable in solving the equation F0olda numerical variable in solving the equation F1old

Ebrahim Ghahramani Beamer slides template 2016-12-05 10 / 26

Page 12: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

New member data

In solidParticleCloud class

Description In the solversurrounding pressure in the equilibrium condition p0liquid saturation pressure pSatpolytropic compression constant gammaliquid surface tension coefficient sigma

Ebrahim Ghahramani Beamer slides template 2016-12-05 11 / 26

Page 13: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticle.H

Add new member data as private data

scalar Rdt_;

scalar R_;

...

Adding the equlibrium function

bool initialEquilibriumRadius(trackingData& );

Add a member data in trackingData class to pass flow pressure

const interpolationCellPoint<scalar>& pInterp_;

+ Including this member in the constructor

const interpolationCellPoint<scalar>& pInterp,

+ An access function for that (in trackingData class)

inline const interpolationCellPoint<scalar>& pInterp() const;

Ebrahim Ghahramani Beamer slides template 2016-12-05 12 / 26

Page 14: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleI.H

Include pInterp in the definition of trackingData constructor

const interpolationCellPoint<scalar>& pInterp,

+ Its initialization

pInterp_(pInterp),

+ Definition of its access function

inline const Foam::interpolationCellPoint<Foam::scalar>&

Foam::solidParticle::trackingData::pInterp() const

{

return pInterp_;

}

Ebrahim Ghahramani Beamer slides template 2016-12-05 13 / 26

Page 15: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleIO.C

In the definition of the constructor, the command is >> U_ for theascii format

is>> U_>> Rdt_>> R_>> R0_>> pB_>> pG_>> pG0_>> F0Old_>> F1Old_;

For other formats

is.read

(

reinterpret_cast<char*>(&d_),

sizeof(d_)

+ sizeof(U_)

+ sizeof(Rdt_)

+ sizeof(R_)

...

);

Ebrahim Ghahramani Beamer slides template 2016-12-05 14 / 26

Page 16: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleIO.C

In the definition of the readFields function, Add

IOField<scalar> Rdt(c.fieldIOobject("Rdt", IOobject::MUST_READ));

c.checkFieldIOobject(c, Rdt);

IOField<scalar> R(c.fieldIOobject("R", IOobject::MUST_READ));

c.checkFieldIOobject(c, R);

...

And also in the forAllIter loop

p.Rdt_ = Rdt[i];

p.R_ = R[i];

...

Ebrahim Ghahramani Beamer slides template 2016-12-05 15 / 26

Page 17: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleIO.C

In the definition of the writeFields function, Add

IOField<scalar> Rdt(c.fieldIOobject("Rdt", IOobject::NO_READ), np);

IOField<scalar> R(c.fieldIOobject("R", IOobject::NO_READ), np);

...

Also in the forAllIter loop

Rdt[i] = p.Rdt_;

R[i] = p.R_;

...

And after the loop

Rdt.write();

R.write();

...

Ebrahim Ghahramani Beamer slides template 2016-12-05 16 / 26

Page 18: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleIO.C

Finally in the definition of the Ostream operator <<, for the asciiformat add

<< token::SPACE << p.Rdt_

<< token::SPACE << p.R_

...

And for other formats:

sizeof(p.U_)

+ sizeof(p.Rdt_)

+ sizeof(p.R_)

...

Ebrahim Ghahramani Beamer slides template 2016-12-05 17 / 26

Page 19: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticle.C

Rayleigh-Plesset eq to be solved for each particle & at each timestep

Included in the solidParticle::move function

ODE solution using Rosenbrock numerical approach

R_, Rdot_, pB_, and pG_ are updated

Definition of solidParticle::initialEquilibriumRadius

function

to set R0_ & pG0_ and initialize other new data

Ebrahim Ghahramani Beamer slides template 2016-12-05 18 / 26

Page 20: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleCloud.H

Add new member data as private data

scalar p0_;

scalar pSat_;

...

Adding access function to new member data

inline scalar p0() const;

inline scalar pSat() const;

...

Ebrahim Ghahramani Beamer slides template 2016-12-05 19 / 26

Page 21: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleCloud.C

Set new member data in the constructor

p0_(dimensionedScalar(particleProperties_.lookup("p0")).value()),

pSat_(dimensionedScalar(particleProperties_.lookup("pSat")).value()),

...

Call solidParticle::initialEquilibriumRadius function inthe inject function after define new particle but before injecting it.

ptr1->initialEquilibriumRadius(td);

In the solidParticleCloud::move define the pressure field

const volScalarField& p = mesh_.lookupObject<const volScalarField>("p");

And +

interpolationCellPoint<scalar> pInterp(p);

Ebrahim Ghahramani Beamer slides template 2016-12-05 20 / 26

Page 22: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Improvement

solidParticleCloudI.H

Add definition of new inline access functions

{

return p0_;

}

inline Foam::scalar Foam::solidParticleCloud::pSat() const

{

return pSat_;

}

...

Ebrahim Ghahramani Beamer slides template 2016-12-05 21 / 26

Page 23: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Bubble in Channel Flow

Problem description

Channel dimension: 10m*1m

Inlet pressure: 270 kPa

Outlet pressure: 70 kPa

Bubble initial diameter: 4 mm

For this case: LPTtoVOF.H should be omitted before solvercompilation

Ebrahim Ghahramani Beamer slides template 2016-12-05 22 / 26

Page 24: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Bubble in Channel Flow

Setting parameters

particleProperties dictionary

rhop rhop [ 1 -3 0 0 0 0 0] 0.01389;

e e [ 0 0 0 0 0 0 0] 0.2;

mu mu [ 0 0 0 0 0 0 0] 0.05;

posP1 posP1 [ 0 1 0 0 0 0 0] (0.5 0.5 0.0);

dP1 dP1 [ 0 1 0 0 0 0 0] 0.0004;

UP1 UP1 [ 0 1 -1 0 0 0 0] (0 0 0);

tInjStart tInjStart [ 0 0 1 0 0 0 0] 0.025;

tInjEnd tInjEnd [ 0 0 1 0 0 0 0] 0.035;

pSat pSat [1 -1 -2 0 0] 2000;

sigma sigma [1 0 -2 0 0 0 0] 0.07;

gamma gamma [0 0 0 0 0 0 0] 1.4;

p0 p0 [1 -1 -2 0 0] 100000;

Ebrahim Ghahramani Beamer slides template 2016-12-05 23 / 26

Page 25: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Bubble in Channel Flow

Result

Ebrahim Ghahramani Beamer slides template 2016-12-05 24 / 26

Page 26: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Bubble in Channel Flow

Result

Ebrahim Ghahramani Beamer slides template 2016-12-05 25 / 26

Page 27: Improvement of the VOF-LPT Solver for Bubbleshani/kurser/OS_CFD_2016/EbrahimGhahramani/... · Introduction Theory Solver Sample Problem Improvement of the VOF-LPT Solver for Bubbles

Introduction Theory Solver Sample Problem

Bubble in Channel Flow

Thank You For Your Attention!

Ebrahim Ghahramani Beamer slides template 2016-12-05 26 / 26