coupling level-set with volume of fluid - openfoam version...

26
Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon Chalmers University of Technology OpenFOAM course 2015 January 15, 2016

Upload: trinhdan

Post on 17-Mar-2019

263 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Coupling Level-Set with Volume ofFluid

OpenFOAM version 2.3.x

Sankar Menon

Chalmers University of Technology

OpenFOAM course 2015January 15, 2016

Page 2: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Outline for section

Motivation

Theoretical BackgroundNavier-Stokes and continuityVolume Of Fluid advective

ImplementationCase folderInitialisingHeader filesSurface tension correctionsclsVOFFoam

Test Case

Motivation Sankar Menon OFv2.3.x 2/23

Page 3: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Motivation

• Representation of sharp interfaces to capture phenomena atthe interface

• Application of a Surface Capturing method - coupling theVolume of Fluid(VOF) and Level Set(LS).

• VOF is mass conservative and bounded, while LS is thesharper interface capturing but not mass conservative.

• Two solvers developed, sclsVOFFoamsf and sclsVOFFoam.

Working on the OpenFOAM version 2.3.x environment

Motivation Sankar Menon OFv2.3.x 3/23

Page 4: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Outline for section

Motivation

Theoretical BackgroundNavier-Stokes and continuityVolume Of Fluid advective

ImplementationCase folderInitialisingHeader filesSurface tension correctionsclsVOFFoam

Test Case

Theoretical Background Sankar Menon OFv2.3.x 4/23

Page 5: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

NS and continuity equation

∂vi∂xi

= 0,

∂vi∂t

+∂vivj∂xj

= −1

ρ

∂p

∂xj+ ν

∂2vi∂xj∂xj

+ gi + Fσ

where v is the velocity in the tensor from, ν is the kinematicviscosity, Fσ is the volumetric surface tension force, gi is thegravitational acceleration, ρ is the density and p is the pressure.

Theoretical Background — Navier-Stokes and continuity Sankar Menon OFv2.3.x 5/23

Page 6: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Volume Of Fluid advective equation

∂α

∂t+∂αvj∂xj

= 0

water : α = 1

air : α = 0

interface : 0 < α < 1

Bringing in the counter gradient compressive term

∂α

∂t+∂αvj∂xj

+∂vcjαβ

∂xj= 0.

where vc ensures compression (vc = vl − vg, l and g stands forliquid and gas, respectively), while the ∂/∂xj guaranteesconservation and αβ guarantees boundedness (β = 1− α).

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 6/23

Page 7: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Level Set function and coupling

φ0 = (2α− 1)Γ

where Γ = 0.75∆x and ∆x meshcell size.Re-initialisation equation

∂φ∂τ = S(φ0)(1−∇φ)

φ(x, 0) = φ(x)

Iteration number, φcorr = ε/∆τInterface width, ε = 1.5∆x

the surface tension will be calculatedas :

Fσ = σκ(φ)δ(φ)∇φ

where σ is the surface tensioncoefficient and δ is the Diracfunction to limit the influence ofsurface tension within the interface.

The physical properties can be calculated using the Heaviside function

H(φ) =

0, ifφ < ε12 [1 + φ

ε + 1π sin(πφε )] if φ ≥ 1

1, ifφ > ε

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 7/23

Page 8: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Level Set function and coupling

φ0 = (2α− 1)Γ

where Γ = 0.75∆x and ∆x meshcell size.Re-initialisation equation

∂φ∂τ = S(φ0)(1−∇φ)

φ(x, 0) = φ(x)

Iteration number, φcorr = ε/∆τInterface width, ε = 1.5∆x

the surface tension will be calculatedas :

Fσ = σκ(φ)δ(φ)∇φ

where σ is the surface tensioncoefficient and δ is the Diracfunction to limit the influence ofsurface tension within the interface.

The physical properties can be calculated using the Heaviside function

H(φ) =

0, ifφ < ε12 [1 + φ

ε + 1π sin(πφε )] if φ ≥ 1

1, ifφ > ε

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 7/23

Page 9: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Level Set function and coupling

φ0 = (2α− 1)Γ

where Γ = 0.75∆x and ∆x meshcell size.Re-initialisation equation

∂φ∂τ = S(φ0)(1−∇φ)

φ(x, 0) = φ(x)

Iteration number, φcorr = ε/∆τInterface width, ε = 1.5∆x

the surface tension will be calculatedas :

Fσ = σκ(φ)δ(φ)∇φ

where σ is the surface tensioncoefficient and δ is the Diracfunction to limit the influence ofsurface tension within the interface.

The physical properties can be calculated using the Heaviside function

H(φ) =

0, ifφ < ε12 [1 + φ

ε + 1π sin(πφε )] if φ ≥ 1

1, ifφ > ε

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 7/23

Page 10: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Density and viscosity correction,VOF method :

ρ = αρl + (1− α)ρg

µ = αµl + (1− α)µg

CLSVOF method :

ρ = Hρl + (1−H)ρg

µ = Hµl + (1−H)µg

where l is the liquid and g is the gas.

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 8/23

Page 11: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Mesh

0.00

0.00

0.00

0.00

0.00

0.00

0.03

0.05

0.30

0.30

0.00

0.25

0.80

0.90

1.00

0.05

0.80

0.90

0.90

1.00

1.00

1.00

1.00

1.00

1.00

VOF

1 2 3 4 5

1

2

3

4

5

-0.75

-0.75

-0.75

-0.75

-0.75

-0.75

-0.70

-0.68

-0.30

-0.30

-0.75

-0.38

0.45

0.60

0.75

-0.68

0.45

0.60

0.60

0.75

0.75

0.75

0.75

0.75

0.75

psi0

1 2 3 4 5

1

2

3

4

5

-3.75

-3.58

-3.47

-2.06

-2.06

-3.75

-3.05

-1.50

-1.22

-0.94

-3.61

-1.58

1.36

2.06

1.78

-0.94

1.64

3.19

3.47

3.75

-1.59

2.62

3.19

3.19

3.75

psi

1 2 3 4 5

1

2

3

4

5

0.00

0.00

0.00

0.02

0.02

0.00

0.00

0.09

0.14

0.21

0.00

0.08

0.88

0.98

0.95

0.21

0.93

1.00

1.00

1.00

0.08

1.00

1.00

1.00

1.00

H

1 2 3 4 5

1

2

3

4

5

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 9/23

Page 12: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Numerical Algorithm

Initialize velocity, pressure and liquid volumefraction, and update density and viscosity fields

Constructing φ from α

Start time

PIMPLE loop

Advection of volume fraction (α)

Update density and viscosity withnew liquid volume fraction value

reconstructing φ from α

Velocity equation / momentum predictor equation

Pressure correction / PISO

Continue for a new time step?

Finish

Initialize variables withprevious time step values

CLSVOFsf CLSVOFor

Yes

Yes

No

No

Theoretical Background — Volume Of Fluid advective Sankar Menon OFv2.3.x 10/23

Page 13: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Outline for section

Motivation

Theoretical BackgroundNavier-Stokes and continuityVolume Of Fluid advective

ImplementationCase folderInitialisingHeader filesSurface tension correctionsclsVOFFoam

Test Case

Implementation Sankar Menon OFv2.3.x 11/23

Page 14: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Case folder

The interFoam solver folder has thefollowing files (skipping the foldersfor other specific solvers)

.|-- Make| |-- files| |-- options|-- alphaCourantNo.H|-- alphaEqn.H|-- alphaEqnSubCycle.H|-- correctPhi.H|-- createFields.H|-- interFoam.C|-- pEqn.H|-- UEqn.H|-- setDeltaT.H

For CLSVOFsf and CLSVOF solversfour more header files are includedas shown below.

|-- mappingPsi.H|-- solveLSFunction.H|-- calcNewCurvature.H|-- updateFlux.H

Implementation — Case folder Sankar Menon OFv2.3.x 12/23

Page 15: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Case folder

The interFoam solver folder has thefollowing files (skipping the foldersfor other specific solvers)

.|-- Make| |-- files| |-- options|-- alphaCourantNo.H|-- alphaEqn.H|-- alphaEqnSubCycle.H|-- correctPhi.H|-- createFields.H|-- interFoam.C|-- pEqn.H|-- UEqn.H|-- setDeltaT.H

For CLSVOFsf and CLSVOF solversfour more header files are includedas shown below.

|-- mappingPsi.H|-- solveLSFunction.H|-- calcNewCurvature.H|-- updateFlux.H

Implementation — Case folder Sankar Menon OFv2.3.x 12/23

Page 16: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

createFields.H

New variables areinitialised in createFields.H.H heavisidedelta, δ Dirac functionpsi, φ LS functionC curvatureand constants aredeltaX, ∆x mesh cell size,gamma, γ small non-dimensional number

of initialising LS,epsilon, ε interface thickness,deltaTau, ∆τ artificial time step,dimChange for phi reinitialisation fraction,sigma, σ recalled since the surface tension

is calculated with LS.nu1 ν1 and nu2, ν2 recalled for viscosity correction

for CLSVOF

Implementation — Initialising Sankar Menon OFv2.3.x 13/23

Page 17: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Solver header files

mappingPsi.H

• Initialise the LS function φ

solveLSFunction.H

• Re-initialise the LS, φ

• Calculate the Dirac function, δ

• Calculate the heaviside function, H

calcNewCurvature.H

• Calculate the interface normal

• Calculate the curvature of surface tension

updateFlux.H

• Update the convective flux in NS equation.

Implementation — Header files Sankar Menon OFv2.3.x 14/23

Page 18: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Surface tension correction

In UEqn.H, the new surface tension force is computed.

UEqn

==

fvc::reconstruct

(

(

// mixture.surfaceTensionForce()

sigma*fvc::snGrad(psi)*fvc::interpolate(C)*fvc::interpolate(delta)

- ghf*fvc::snGrad(rho)

- fvc::snGrad(p_rgh)

) * mesh.magSf()

)

And also in pEqn.H.

surfaceScalarField phig

(

(

// mixture.surfaceTensionForce()

sigma*fvc::snGrad(psi)*fvc::interpolate(C)*fvc::interpolate(delta)

- ghf*fvc::snGrad(rho)

)*rAUf*mesh.magSf()

);

This concludes the sclsVOFFoamsf solver!

Implementation — Surface tension correction Sankar Menon OFv2.3.x 15/23

Page 19: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

sclsVOFFoam

Now we move to the sclsVOFFoam, where the viscosity anddensity are corrected.DensityThe density is recomputed by adding the below code at the end ofsolveLSFunction.H.

const volScalarField limitedH

(

"limitedH",

min(max(H, scalar(0)), scalar(1))

);

rho == limitedH*rho1 + (1.0 - limitedH)*rho2;

Implementation — sclsVOFFoam Sankar Menon OFv2.3.x 16/23

Page 20: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

sclsVOFFoam

Viscosity Also, the viscosity is recomputed by adding the followingin the end of solveLSFunction.H.

volScalarField& nuTemp = const_cast<volScalarField&>(mixture.nu()());

nuTemp == limitedH*nu1 + (1.0 - limitedH)*nu2;

Limiting H The heaviside is kept in the limited region of0 < H < 1 by addingH == limitedH;

in solveLSFunction.H.

Implementation — sclsVOFFoam Sankar Menon OFv2.3.x 17/23

Page 21: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

sclsVOFFoamConvective Flux

surfaceScalarField phiH

(

fvc::flux

(

phi,

H,

alphaScheme

)

+ fvc::flux

(

-fvc::flux(-phir, scalar(1) - H, alpharScheme),

H,

alpharScheme

)

);

MULES::explicitSolve(H, phi, phiH, 1, 0);

rhoPhiH = phiH*(rho1 - rho2) + phi*rho2;

}

Thus rhoPhiH is computed instead of rhoPhi. This rhoPhiH is then fed into the

UEqn.H

Implementation — sclsVOFFoam Sankar Menon OFv2.3.x 18/23

Page 22: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

sclsVOFFoam

Overwriting Alpha

// reInitialise the alpha equation

if (runTime.outputTime())

{

Info<<"Overwriting alpha" << nl << endl;

alpha1 = H;

volScalarField& alpha10 = const_cast<volScalarField&>(alpha1.oldTime());

alpha10 = H.oldTime();

}

Implementation — sclsVOFFoam Sankar Menon OFv2.3.x 19/23

Page 23: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Outline for section

Motivation

Theoretical BackgroundNavier-Stokes and continuityVolume Of Fluid advective

ImplementationCase folderInitialisingHeader filesSurface tension correctionsclsVOFFoam

Test Case

Test Case Sankar Menon OFv2.3.x 20/23

Page 24: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Bubble column

Figure : Initial configuration and boundaryconditions for the test case.

Initial configurationand boundaryconditions for the testcase

Test Case Sankar Menon OFv2.3.x 21/23

Page 25: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Running the case

Download the tar package to the path -$WM_PROJECT_USER_DIR/applications/solvers/multiphase/.

tar -zxvf sclsVOFFoam.tar.gz

cd sclsVOFFoam

wmake

Extract the case file that is downloaded from the portal.

tar -zxvf bubblecol.tar.gz

cd bubblecol

Test Case Sankar Menon OFv2.3.x 22/23

Page 26: Coupling Level-Set with Volume of Fluid - OpenFOAM version …hani/kurser/OS_CFD_2015/SankarMenon/... · Coupling Level-Set with Volume of Fluid OpenFOAM version 2.3.x Sankar Menon

Results

Test Case Sankar Menon OFv2.3.x 23/23