magnetic induction and electric potential solvers for...

32
Introduction Theoretical background Solvers Tutorial 2D MHD flow Magnetic induction and electric potential solvers for incompressible MHD flows Alessandro Tassone DIAEE - Nuclear Section, Sapienza Universit` a di Roma, Rome, Italy 05/12/2016 Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 1 / 32

Upload: others

Post on 31-Mar-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Magnetic induction and electric potential solvers forincompressible MHD flows

Alessandro Tassone

DIAEE - Nuclear Section,Sapienza Universita di Roma,

Rome, Italy

05/12/2016

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 1 / 32

Page 2: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Fusion reactors

Figure: ITER experiment

Liquid metal blankets are theleading candidate for tritiumproduction in MCF reactors.Interaction between LM andmagnetic field cause transition tomagnetohydrodynamic flow

MHD-related issues

High pressure drops

Enhanced corrosion rates

Turbulence suppression

etc.

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 2 / 32

Page 3: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Codes for CMHD

To support the blanket desing aCFD software able to modelMHD flows is needed

Required parameters

M = 104

Re = 104

Gr = 1012

No mature CMHD code iscurrently available. Figure: MHD calculations progress

(Smolentsev, 2015)

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 3 / 32

Page 4: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

MHD governing equations

A laminar, isotherm and incompressible flow flow is assumed

∇ · u = 0 (1)

Du

Dt= −∇(p/ρ) + ν∇2u + (J× B)/ρ (2)

∂B

∂t= ∇× (u× B) +

1

µσ∇2B (3)

J =1

µ∇× B (4)

This set is called the B-formulation of the MHD governing equations

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 4 / 32

Page 5: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Inductionless approximation

The equation (3) can be simplified, reducing the u-B couplingnon-linearity, if the self-induced magnetic field is negligible. Thiscorresponds to the inductionless condition

Rm � 1

The parameter Rm = u0 L/µσ is called the magnetic Reynolds number.For the typical values encountered in LM flows the condition is valid andthe magnetic field can be uncoupled from the fluid velocity, i.e. it dependsjust from the boundary conditions.

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 5 / 32

Page 6: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Electric potential formulation

A Poisson equation for the electric potential and the Ohm’s law substitute(3) and (4)

∇ · u = 0 (1)

Du

Dt= −∇(p/ρ) + ν∇2u + (J× B)/ρ (2)

∇2φ = ∇ · (u× B) (5)

J = σ(−∇φ+ u× B) (6)

The new set is called the φ-formulation of the MHD equations

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 6 / 32

Page 7: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Parameters for incompressible LM MHD flow

Hartmann number: adimensional measure of the magnetic field intensity

M = BL

√σ

ρν(7)

Wall conductance ratio: measures relative electrical conductivity of thewall compared to the fluid

c =σwσ

t

L(8)

Others: Reynolds number (Re), Rm, Grashof number (Gr, buoyantflows), interaction parameter (N)

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 7 / 32

Page 8: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

A magnetic induction solver

Numerical constrains to ensure

∇ · (B0 + b)t+1 = 0

Employ arbitrary scheme to”project” calculated field to veryclose divergence-free one

Analogy

∇ · u = 0 ∇ ·B = 0

Application

PISO(u, p) → BPISO(B, pB)Figure: Solenoid magnetic field

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 8 / 32

Page 9: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

How to find mhdFoam source code

A solver based on the magnetic induction formulation is available in theOpenFOAM-4.x distribution. To access the source code

cd $FOAM_SOLVERS/electromagnetics/mhdFoam

ls

gedit mhdFoam.C

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 9 / 32

Page 10: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

Momentum equation - Line 78 to 90

fvVectorMatrix UEqn

(

fvm::ddt(U)

+ fvm::div(phi, U)

- fvc::div(phiB, 2.0*DBU*B)

- fvm::laplacian(nu, U)

+ fvc::grad(DBU*magSqr(B))

);

Lorentz force term is definedimplicitly

if (piso.momentumPredictor())

{

solve(UEqn == -fvc::grad(p));

}

UEqn solved to obtain velocityfield prediction for following PISO

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 10 / 32

Page 11: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

Predictor/corrector - from Line 133 to 155

Remember from (3)?

while (bpiso.correct())

{

fvVectorMatrix BEqn

(

fvm::ddt(B)

+ fvm::div(phi, B)

- fvc::div(phiB, U)

- fvm::laplacian(DB, B)

);

BEqn.solve();

phiB = fvc::flux(B) +

rABf*fvc::ddtCorr(B, phiB);

Flux coefficients are calculated

fvScalarMatrix pBEqn

(

fvm::laplacian(rABf, pB)

== fvc::div(phiB)

);

Poisson equation for pB

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 11 / 32

Page 12: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

Projection scheme - from Lines 159 to 165

Magnetic flux coefficients are updated

if (bpiso.finalNonOrthogonalIter())

{

phiB -= pBEqn.flux();

}

Evaluate magnetic flux divergence error (from magneticFieldErr.H)

mag(fvc::div(phiB))().weightedAverage(mesh.V()).value()

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 12 / 32

Page 13: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

The hartmann tutorial

Case parameters

M = 20

Re = 2

c = 0

B|wall = B0

Available in

$FOAM_TUTORIALS

/electromagnetics

/mhdFoam/hartmannFigure: Hartmann problem

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 13 / 32

Page 14: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

Default setup results

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 14 / 32

Page 15: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The mhdFoam solver

M influence on the flow

Figure

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 15 / 32

Page 16: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

An electric potential solver

Why employ a solver based on the φ-formulation?

Advantages

Faster

More stable

Simpler boundary conditions

More accurate for coarse mesh

Drawbacks

Requirement on J interpolation

Nonconservative treatment of Lorentz force

Worse convergence behavior

Constrain on charge conservation ∇ · J = 0

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 16 / 32

Page 17: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Source code

A solver based on the electric potential formulation was developed basedon previous work by Francesco Ferroni of Imperial College. It isconstructed starting from the default icoFoam. To have a look at thesource code download epotFoam.tar.gz

tar xzf epotFoam.tar.gz

rm epotFoam.tar.gz

cd epotFoam

gedit epotFoam.C

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 17 / 32

Page 18: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Pre-PISO - Line 57 and from Line 67 to 78

Lorentz force initialization

volVectorField

lorentz = sigma *

(-fvc::grad(PotE) ^ B0)

+ sigma * ((U ^ B0) ^ B0);

Lorentz force is defined explicitlyin momentum predictor for PISOloop

fvVectorMatrix UEqn

(

fvm::ddt(U)

+ fvm::div(phi, U)

- fvm::laplacian(nu, U)

- (1.0/rho) * lorentz

);

if (piso.momentumPredictor())

{

solve(UEqn == -fvc::grad(p));

}

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 18 / 32

Page 19: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Potential prediction - from Line 128 to 142

After the PISO loop corrected ufield is employed to estimate J

surfaceScalarField psiub =

fvc::interpolate(U ^ B0)

& mesh.Sf();

Evaluation of cross product u×B

fvScalarMatrix PotEEqn

(

fvm::laplacian(PotE)

==

fvc::div(psiub)

);

PotEEqn.setReference(

PotERefCell, PotERefValue);

PotEEqn.solve();

Poisson equation for electricpotential

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 19 / 32

Page 20: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Current interpolation - from Line 145 to 151

Interpolation scheme for current density

surfaceScalarField jn = -(fvc::snGrad(PotE) * mesh.magSf())

+ psiub;

surfaceVectorField jnv = jn * mesh.Cf();

volVectorField jfinal = fvc::surfaceIntegrate(jnv)

-(fvc::surfaceIntegrate(jn) * mesh.C());

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 20 / 32

Page 21: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Lorentz force calculation - from Line 154 to 157

Current density distribution is updated and employed to calculate Lorentzforce

jfinal.correctBoundaryConditions();

lorentz = sigma* (jfinal ^ B0);

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 21 / 32

Page 22: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The epotFoam solver

Compile epotFoam

Move the epotFoam folder in the user directory and compile it

mkdir -p $WM_PROJECT_USER_DIR/applications/solvers/MHD

mv epotFoam $WM_PROJECT_USER_DIR/applications/solvers/MHD

cd $WM_PROJECT_USER_DIR/applications/solvers/MHD/epotFoam

wmake

Download the case directory epotHunt.tar.gz and move it to the rundirectory

tar xzf epotHunt.tar.gz

rm epotHunt.tar.gz

mv epotHunt $WM_PROJECT_USER_DIR/run

cd $WM_PROJECT_USER_DIR/run/epotHunt

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 22 / 32

Page 23: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

The huntFlow tutorial

Case parameters

M = 20

Re = 2

cs = 0

ch =∞

Boundary layers scalinglaws

δH = 1/M (9a)

δS = 1/M1/2 (9b)Figure: Hunt problem

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 23 / 32

Page 24: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Running the case

To run the case...

blockMesh

epotFoam >& log &

...since it will take awhile, have a look at thecase files

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 24 / 32

Page 25: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

blockMeshDict

A uniform 40x40x40 mesh is employed to simulate the half-duct over thecenterline for y > 0

vertices

(

(0 0 -1) //0

(20 0 -1) //1

(20 1 -1) //2

(0 1 -1) //3

(0 0 1) //4

(20 0 1) //5

(20 1 1) //6

(0 1 1) //7

);

Important patches

upperWall → Hartmann wall

rightWall/leftWall → side walls

symmetryPlane

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 25 / 32

Page 26: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Boundary Conditions

Electrical potential boundary equations are specified in 0/PotE

Conductive wall ≡ φ(Γ) = 0

Insulating wall ≡ ∂φ∂n = 0

type fixedValue;value uniform 0;

type zeroGradient;

For other patches the setting is zeroGradient, except for the symmetryplane. Velocity and pressure fields employ usual BCs (i.e. noSlip,inlet-velocity/outlet-pressure)

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 26 / 32

Page 27: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Other relevant files

constant

Magnetic induction intensity is defined in electromagneticProperties

All transportProperties are assumed to be constant and equal to 1

system

∆ t = 2.5 e-3 sTemporal discretization scheme: Crank-Nicholson (explicit, second order)Spacial discretization scheme: Gauss liner (central differencing)Residual tolerance: 1e-06 (p), 1e-05 (u, PotE)

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 27 / 32

Page 28: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Post Process

To validate the results, the analytical velocity profiles available inhunt.dat would be employed. To extract the numerical data and compareit

postProcess -func sample

./plot.sh

The sampling data utility produces data for every written time step. Theplot.sh is a script for the generation of the comparison picture employinggnuplot

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 28 / 32

Page 29: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Results

FigureAlessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 29 / 32

Page 30: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Results

Figure: Velocity contour Hunt flow Figure: Potential contour Hunt flow

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 30 / 32

Page 31: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Introduction Theoretical background Solvers Tutorial 2D MHD flow

Follow-up activities

Tutorials for elemental 2D MHD flows (Hunt and Shercliff cases) weredeveloped for both mhdFoam and epotFoam

Extension of epotFoam capabilities to cases with wall of finiteconductivity, i.e. coupling solid and fluid domain to calculate potential

Implementation of wall function treatment to ease computationaltime at high M (Widlund, 2003)

Code validation and development of tutorials for non-uniformmagnetic field (Smolentsev, 2015)

Q2D MHD turbulence modeling

Alessandro Tassone CMHD Solvers for OpenFOAM 05/12/2016 31 / 32

Page 32: Magnetic induction and electric potential solvers for ...hani/kurser/OS_CFD_2016/AlessandroT..."project" calculated eld to very close divergence-free one Analogy ru = 0 rB = 0 Application

Thank youfor your attention

Questions?