You are on page 1of 55

Cite as: Melchiorri, L.

: Baseline for developing a general OpenFOAM solver for magnetohydrodynamic


(MHD) flows. In Proceedings of CFD with OpenSource Software, 2021, Edited by Nilsson. H.,
http://dx.doi.org/10.17196/OS CFD#YEAR 2021

CFD with OpenSource software


A course at Chalmers University of Technology
Taught by Håkan Nilsson

Baseline for developing a general


OpenFOAM solver for
magnetohydrodynamic (MHD) flows

Developed for foam-extend 4.1


Requires: meshing utility from
other OpenFOAM distributions,
gnuplot 5.2.8

Author: Peer reviewed by:


Lorenzo Melchiorri Dr. Saeed Salehi
Sapienza, University of Rome Marco Vergassola
lorenzo.melchiorri@uniroma1.it Dr. Alessandro Tassone

Licensed under CC-BY-NC-SA, https://creativecommons.org/licenses/

Disclaimer: This is a student project work, done as part of a course where OpenFOAM and some
other OpenSource software are introduced to the students. Any reader should be aware that it
might not be free of errors. Still, it might be useful for someone who would like learn some details
similar to the ones presented in the report and in the accompanying files. The material has gone
through a review process. The role of the reviewer is to go through the tutorial and make sure that
it works, that it is possible to follow, and to some extent correct the writing. The reviewer has no
responsibility for the contents.

January 22, 2022


Learning outcomes

The main requirements of a tutorial in the course is that it should teach the four points: How to
use it, The theory of it, How it is implemented, and How to modify it. Therefore the list of learning
outcomes is organized with those headers.

The reader will learn:

How to use it:

ˆ How to properly set a magnetohydrodynamic case: consistent meshing, boundary conditions.

ˆ How to use the new MhdPisoFoam solver for coupled solid/fluid domains: tutorial for electro-
conductive walls flow.
The theory of it:

ˆ Fundamental theory of magnetohydrodynamic phenomena: differences from classical hydro-


dynamic confined flows and governing parameters.
ˆ Basic information on high-level programming in OpenFOAM.

How it is implemented:

ˆ Base-solver conjugateHeatFoam features. How the coupling between solid and fluid domain is
enforced.
How to modify it:

ˆ How to modify the base-solver to include the MHD effect within the Navier-Stokes equations.

ˆ How to implement an additional volume scalar fields (electric potential and electrical conduc-
tivity) to the solid and fluid domain.

1
Prerequisites

The reader is expected to know the following in order to get maximum benefit out of this report:
ˆ Basic knowledge about hydrodynamics. Suggested material: G.K. Batchelor, An introduction
to fluid dynamics, 2000, Cambridge University Press.
ˆ Fundamental knowledge about the finite volume method and computational fluid dynamics
codes. Suggested source: H.K. Versteeg & W. Malalasekhara, An Introduction to Computa-
tional Fluid Dynamics: The finite volume method, 2007, Longman Scientific and Technical.
ˆ The reader should be familiar with elementary OpenFOAM features and their usage (top-level
programming and running tutorials).
ˆ Access to the latest version of foam-extend (4.1) and other OpenFOAM distributions.

ˆ A basic knowledge about shell-languages (BASH) and scripts would be ideal.

2
Contents

1 Introduction 5

2 Magnetohydrodynamics 7
2.1 MHD equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Fundamental parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Implementation 11
3.1 Implementation strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 Derivation of MhdPisoFoam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 Validation tutorial 17
4.1 Geometry and mesh grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 Boundary conditions and run control . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 Running the tutorial and post-processes using BASH scripts . . . . . . . . . . . . . . 24

A Boundary conditions and parameters dictionaries 32

B System and run control dictionaries 44

3
Nomenclature

Greek symbols
β Thermal expansion coefficient
δ Wall thickness
κ Thermal conductivity
µ Dynamic viscosity
ν Kinematic viscosity
ρ Density
σ Electric conductivity
φ Electric potential

Latin symbols
a Half-width of rectangular duct parallel to magnetic field direction
B Magnetic field
g Gravity acceleration
J Current density
L Generic characteristic length
n Normal direction
p Pressure, poloidal coordinate
T Temperature
u Characteristic/average velocity

Dimensionless groups
c Wall conductance ratio
Ha Hartmann number
N Interaction parameter or Stuart number
Pr Prandtl number
Re Reynolds number
Rm Magnetic Reynolds number

4
Chapter 1

Introduction

The main purpose of this report is to set the base for the implementation of a new OpenFOAM
(foam-extend 4.1) solver, that could handle all the relevant phenomena occurring in incompressible
confined 3D magnetohydrodynamic (MHD) flows.
The general characterization of MHD effects is pivotal for many reasons and, in particular, for a
reliable and efficient design of magnetic confinement nuclear fusion reactors, where magnetohydrody-
namic effects arise due to the interaction between magnetic field and liquid metals (electro-conductive
materials), that are foreseen to be used as working fluids in breeding blankets.
Unfortunately, current OpenFOAM distributions provide applications that, despite being well-
functioning and solidly validated, have limited modelling capabilities. As a matter of fact the
built-in solver, referred as mhdFoam, is able to treat only a limited spectrum of MHD cases of study,
namely isothermal and laminar flows. Moreover the solver cannot simulate MHD flows within chan-
nels that have a finite electrical conductivity.
It would be ideal to develop a tool that can overcome these limitations and that could model MHD
flows under fusion-relevant conditions. Thus, in this report will be given preliminary guidelines on
how such a numerical tool could be developed. The focus of the tutorial is to show how the influence
of the electrical conductivity of the wall on a incompressible, laminar and confined MHD flow could
be taken into account. This is done implementing a specific set of magnetohydrodynamic equations
in the foam-extend solver conjugateHeatFoam, which is originally developed for the characterization
of thermal-hydraulic coupled (fluid-solid) problems. Moreover,conjugateHeatFoam is able to treat
also turbulent regimes and buoyancy phenomena, thus, it could be further modified with ease to
model those effects in MHD flows. It is worth mentioning that the conjugateHeatFoam solver has
been exclusively implemented for the foam-extend distribution. As discussed in Mas de les Valls’s
Ph.D. thesis [1], such a solver provides a resolution approach (referred as grid coupling strategy) to
treat coupled study cases, that has several upsides respect to the standard conjugated OpenFOAM
solvers (e.g. chtMultiRegionFoam). The newly derived solver has been named MhdPisoFoam.
The reader interested in the topics discussed in this project might find useful information in other
works, carried out in the framework of this course, where alternative MHD solvers have been de-
scribed. In particular, Tassone [2] derived a new solver, epotFoam, that employs a convenient
formulation of the MHD Navier-Stokes equations along with other approximations that make it way
more stable and faster than mhdFoam. Unfortunately, such a tool does not allow to take into account
the influence of the channel walls on the flow. Moreover, in the study performed by Iraola [3], a 2-
dimensional solver has been derived to model natural MHD convective flows. Such a solver, referred
as Q2DmhdFoam, uses a simplified approach to take into account MHD phenomena on the liquid
flow and, again, it does not deal with the effect of the duct walls electrical conductivity. Therefore,
it has a narrow range of application, i.e. it is less general than the mhdFoam (and consequently than
MhdPisoFoam) solver but it allows the analysis of buoyant phenomena with a low computational
effort.
In chapter 2 of this report, fundamentals of magnetohydrodynamic theory are presented. Basic
equations are described (Navier-Stokes and Maxwell sets), along with a discussion about pivotal

5
Chapter 1. Introduction

governing parameters and boundaries conditions.


The section 3 is focused on the implementation of MhdPisoFoam. The structure of the base-code
conjugateHeatFoam is briefly discussed, along with the fundamental steps that have been followed
to obtain the electrical potential coupling between solid and fluid domain.
At last, in the chapter 4 is presented a tutorial case that showcases the reliability of the solver
and will help the reader in the usage of the new application. The modelled study case deals with
the comparison between an hydrodynamic case and two MHD flows that present a different wall
conductivity.

6
Chapter 2

Magnetohydrodynamics

In this chapter, the equations and the parameters governing a laminar and incompressible MHD
flow are presented. First, the equations according to the magnetic induction formulation are de-
rived by the combination of the Navier-Stokes’ and Maxwell’s ones. Therefore, the induction-less
approximation is introduced and the MHD set is reformulated accordingly. A different form of the
MHD equations, called electric potential formula, is also presented in which the fundamental elec-
tromagnetic variable considered is the electric potential φ instead of magnetic field B. This latter
formulation is the one used to derive the MhdPisoFoam implementation. Fundamental parameters
and boundary conditions of MHD flows are briefly discussed.

2.1 MHD equations


A magnetohydrodynamic flow occurs whether the motion of an electric conductive fluid happens
in the presence of an imposed magnetic field. Currents are induced and the velocity distribution
of the flow is significantly modified by the arising of Lorentz forces which oppose the movement in
directions perpendicular to the field lines. However, the influence exerted by the magnetic field is
far from being unidirectional: the same currents generate a secondary field which, abiding to the
Faraday’s law, lessen the imposed one. Therefore, the velocity and magnetic field are coupled and
the flow features can no longer be described by the ordinary hydrodynamics laws but a new set
of governing equations is needed. A full discussion of the topic summarized in this section can be
found in textbooks dedicated to magnetohydrodynamics, such as the one by Davidson [4] or the
more recent by Müller and Bühler [5].
For a laminar and incompressible MHD flow, the governing equations are obtained by combin-
ing the Navier-Stokes and Maxwell equations. Considering an externally applied magnetic field of
magnitude B0 , the total field (B) acting on the fluid can be represented by the sum of the external
and the induced one (b).
B = B0 + b (2.1)
The magnetic field influence on the flow could be represented by source terms added to the momen-
tum and energy equations.
∇·u=0 (2.2)

Du
= −∇(p/ρ) + ν∇2 u + (J × B)/ρ + Sm (2.3)
Dt
DT k
= ∇T 2 + J 2 /σ + St (2.4)
Dt cp ρ
The symbols ρ, ν, cp , k and σ represent density, kinematic viscosity, specific heat capacity, thermal
and electrical conductivity. The term (J × B)/ρ in Eq. (2.3) accounts for the retarding effect of
the Lorentz force or electromagnetic drag, whereas the group J 2 /σ in Eq. (2.4) represents the heat

7
2.2. Fundamental parameters Chapter 2. Magnetohydrodynamics

generation in the fluid due to the Joule effect. However, the above set lacks equations to determine
J and B. For this purpose, equations are introduced to give closure to the system together with
the magnetic permeability µ. From the Ohm’s and Ampere’s law the magnetic induction equation
is deduced
∂B 1 2
= ∇ × (u × B) + ∇ B (2.5)
∂t µσ
that can be used to calculate the magnetic field distribution, which must satisfy the Gauss’ law for
magnetism
∇·B=0 (2.6)
In turn, the current density distribution is obtained from the Ampere’s law
1
J= ∇×B (2.7)
µ

The flow considered is described completely by Eqs.(2.1)-(2.5), which is known as the magnetic
induction formulation of the MHD equations. The non-linear and mutual coupling between the
velocity and magnetic field is evident in the first term on the right-hand side of Eq. (2.5).
It is possible to reduce the MHD problem complexity by employing some assumptions. One of
the most widely employed is the induction-less approximation. The coupling intensity between the
velocity and magnetic field can be represented by the magnetic Reynolds number, which is defined
as
Momentum advection
Rem = = µσu0 L (2.8)
Magnetic diffusivity
Here, u0 is the reference bulk velocity. If Rem  1, the magnetic field is not dependent from the
flow velocity distribution and determined exclusively by the boundary conditions. In other terms,
the induced field b in Eq. (2.1) can be neglected and we can declare that B ' B0 . Therefore, Eq.
(2.5) is simplified accordingly in a pure diffusive one

∂B 1 2
= ∇ B (2.9)
∂t µσ
If the induction-less approximation is valid, the MHD equations can be casted in a different
formulation. Employing Ohm’s law and the charge conservation condition (DJ/Dt = 0), a Poisson
equation for the electric potential φ is given by

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

From the Ohm’s law, the current density distribution is given by

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

If Eq.(2.10) is substituted to Eq.(2.9), the electric potential formulation of the MHD equations
is obtained where the electric potential φ is considered as the fundamental electromagnetic vari-
able instead of the magnetic induction B. Both formulas can be implemented into computational
magneto-hydrodynamic numerical codes, although the electric potential one is generally preferred
due to reasons that would be discussed in section 3. In the following, we will always assume that
the induction-less approximation is valid, considering that we will treat a liquid metal flow with a
low fluid velocity and magnetic permeability.

2.2 Fundamental parameters


The parameters of interest for a laminar, incompressible and induction-less MHD flow are essentially
three: the Hartmann number (Ha), the interaction parameter or Stuart number (N) and the wall
conductance ratio (c).

8
2.3. Boundary conditions Chapter 2. Magnetohydrodynamics

The Hartmann number expresses the relation between electromagnetic and viscous forces acting
on the fluid, hence representing the magnetic field intensity and the deviation from the ordinary
hydrodynamic behavior. In a typical fusion reactor blanket, this parameter can reach up to 104 . It
is formulated as  1/2 r
Electromagnetic forces σ
Ha = = BL (2.12)
Viscous forces ρν
The characteristic length L for a rectangular duct is the half-length in the magnetic field direction.
The boundary layer structure is dependent on the associated wall orientation with the magnetic
field. An Hartmann layer is formed for perpendicular walls, whereas a Shercliff layer occurs for
parallel walls. The scaling of these layers depends on the Hartmann number according to the
relations

δH = 1/Ha (2.13a)
1/2
δS = 1/Ha (2.13b)

Therefore, we define Hartmann walls those where the former condition applies and, conversely, side
walls for the latter. In the more general case where the magnetic field direction is arbitrary (i.e.
not aligned with any pair of walls), the Hartmann layer behavior is dominant wherever it exists a
non-null normal component of the magnetic field to the wall.
The interaction parameter measures the relative strength of the electromagnetic and inertial
forces. Thus, it is correlated to both the Hartmann and Reynolds number through the relation

Electromagnetic forces Ha2 B2 L σ L


N= = = = (2.14)
Inertial forces Re ρ u0 u0 τ

The group ρ/σB 2 is called magnetic damping time τ and represents the characteristic time in which
the magnetic field dissipates the kinetic energy carried by the flow. If N  1, then τ is big and
the flow is unaffected by the electromagnetic drag. Otherwise, the flow is dominated by the Lorentz
force and it can be considered as inertia-less. The turbulence structures are largely suppressed and
the existence region of the laminar regime is extended. In a typical fusion reactor blanket, this
parameter can reach up to 104 .
The electromagnetic drag is not uniformly distributed on the duct cross-section but is dependent
on the induced current paths inside the fluid. Mean path resistivity influences the MHD pressure
drops severity, whereas the path geometry can create local areas where the Lorentz force is reduced,
hence causing the onset of jets. Therefore, the flow features are influenced by the relative conductivity
between the duct wall and the fluid, which is expressed by the wall conductance ratio
σw t
c= (2.15)
σ L
A value of c → 0 characterizes a duct with poorly conductive walls, whereas a duct with c > 1
is associated to well conducting walls. Even small variations for the value of this parameter can
drastically change the flow features, i.e. triggering the onset of turbulence or high velocity jets, as
it is observed in section 4.

2.3 Boundary conditions


Since we are considering a MHD bounded flow, it is possible to set the classic no-slip boundary
condition at the duct walls (u = 0). Dirichlet boundary conditions are employed at the inlet (mean
velocity) and outlet (zero pressure) surfaces. Electromagnetic boundary conditions should also be
specified to give closure to the problem.
For a fully developed 2D flow, the magnetic field is constant along the duct axis and thus it is a
stream-function of the current density. Therefore, a simple Dirichlet or Neumann boundary condition
can be set at the wall depending on the wall conductivity. Assuming uniform conductivity, for a

9
2.3. Boundary conditions Chapter 2. Magnetohydrodynamics

perfectly conducting wall the current density flux is conserved at the fluid/solid interface Γ and the
tangential component JΓ must be zero, hence from the Ampere’s law Eq.(2.7) we obtain that the
magnetic induction gradient normal to the wall must be equal to zero. Otherwise, for a perfectly
insulating wall JΓ 6= 0 and the interface can be considered as an isosurface of the magnetic field.
Thus, the value can be set to the applied field intensity B0 . The BCs for the B-formulation can be
summarized as

∂B
=0 (valid for c = ∞) (2.16a)
∂n
B(Γ) = B0 (valid for c = 0) (2.16b)

In an analog way, for the φ-formula BCs can be expressed for the cases discussed with the relations

φ(Γ) = 0 (valid for c = ∞) (2.17a)


∂φ
=0 (valid for c = 0) (2.17b)
∂n
A considerable layer of complexity is added to this straightforward problem when the walls have
a finite conductivity. Assuming that the duct is immersed in a purely dielectric material (i.e. air)
the current density at the external duct surface (Γ0 ) must have a null normal component, whereas
at the interface there will be conservation of the current density normal component and potential

JΓ0 = 0 (2.18a)
J · n = Jw · n (2.18b)
φ = φw (2.18c)

For the φ-formula, it is possible to employ these conditions to solve the Poisson equation in both
the fluid and solid domains. For the latter the Eq.(2.11) is employed, whereas for the former

Jw = −σw ∇φw (2.19)

If the wall thickness tw is much lower than the characteristic length L, it can be assumed that the
currents in the wall turns in a quasi bi-dimensional way in the tangential direction. Therefore the
Jw,t and φw are constant across the wall. The component of Jw normal to the wall can be obtained
by a balance on the wall element, leading to

J · n = Jw · n = ∇T · (tw σw ∇T φw ) (2.20)

This is called the thin wall approximation and can be used to represent the effect of a finite conduc-
tivity wall without solving Eq. 2.19 in the solid domain. [6].
For the B-formulation it is not possible to define easily a local BC at the duct external surface
since we have to consider the magnetic field in the space surrounding the duct. From Eq.(2.18a),
the Eq. (2.7) takes the form
∇×B=0 (2.21)
It is then possible to define B as the gradient of a magnetic scalar potential ψ. A fixed value of
ψ must therefore be provided at Γ, in order to ensure the magnetic field divergence-free condition,
whereas in the outside space it must be true the condition

∇2 ψ = 0 (2.22)

10
Chapter 3

Implementation

3.1 Implementation strategy


To implement fluid-solid coupling in foam-extend, two different strategies may be followed as sug-
gested by De Les Valls [1]. A first strategy implies the separate solution of two transport equations,
one for each domain type (fluid and solid), which result then coupled by means of internal boundary
conditions. This is called the segregated approach. An example of this strategy can be found in
the chtMultiRegionFoam solver algorithm. The main drawback is the need of an iterative process
between both liquid and solid domains if a converged transient simulation is needed. The second
strategy, referred as grid coupling strategy or monolithic method, consists on directly coupling both
meshes (fluid and solid) and solving a unique matrix system. Since different transport equations are
required at each domain, the matrix system is built from the corresponding two transport equations,
each one attributed to one sub-domain. Such strategy can be found in the conjugateHeatFoam algo-
rithm. As obvious, in order to couple both transport equations, the main variables (electric potential
for our purposes) must be conserved at the interface. This second strategy has been chosen for the
present study. The disadvantage of the grid coupling strategy lays on the need of dealing with larger
mesh domains (therefore higher computational times) at solver level; however, this disadvantage is
compensated by the fact that no inner iterations at the interface are required.
Both the aforementioned solvers are well described in the work carried out by Välikangas [7] in the
framework of this course. Here, it is worth briefly describing how the conjugateHeatFoam base solver
work: at first the hydrodynamic PISO algorithm is solved for the fluid domain, obtaining both the
velocity and the pressure field maps. Consequently, both domains are coupled and the temperature
is solved. With the obtained thermal field, all other fields (velocity, pressure and physical properties)
are updated and the iterative loop is closed.

3.2 Derivation of MhdPisoFoam


The folder structure of the solver MhdPisoFoam is reported in Figure 3.1. The folder structure
reflects the one of conjugateHeatFoam, with the only exception of the new header file solvePotE.H
where is stored the code part that handles the electric potential coupled solution. It is important
to remind here that the implementation of MHD terms in the equations follows the so called φ -
formulation of the Navier-Stokes set, which is discussed in section 2.1. A similar implementation, for
the non-coupled solver epotFoam, is presented in the work performed by Tassone [2]. The advantages
of using the electric potential formulation over the magnetic induction one for the implementation
in a CFD tool are several:

ˆ In order to obtain the J distribution, a scalar Eq.(2.10) must be solved instead of a vectorial
Eq.(2.9) reducing the overall scheme complexity and thus improving its velocity [8].

ˆ Only the current density J is influenced by the velocity u, whereas the magnetic field B is

11
3.2. Derivation of MhdPisoFoam Chapter 3. Implementation

Figure 3.1: MhdPisoFoam folder and files

determined just by the boundary conditions. The MHD coupling non-linearity is lessened and
the numerically stability is improved [9].
ˆ Boundary conditions are easier to implement even for complex geometries and non-uniform
magnetic fields [6].

For the design of fusion reactor blankets, the inductionless approximation is always applicable and
almost the totality of the studies in the literature employs the electric potential formula. However,
this approach is not without drawbacks.
For a collocated mesh, a conservative and consistent numerical scheme was developed in 2007
by Ni et al. for both structured [8] and unstructured [9] grids in order to address these issues. The
authors demonstrated the capability of the scheme to correctly simulate 2D and 3D MHD flows and
since then it is considered as the state-of-the-art, being employed in the development of codes for
fusion reactor blanket design [10, 11]. In our implementation, the Lorentz force is treated as a source
term but, thanks to the consistent interpolation technique employed for the J reconstruction at the
cell center, it can ensure the conservation of both momentum and charge. The general four step
projection method for MHD flows developed by Ni [8] was modified in order to employ a PISO loop
for a stronger pressure-velocity coupling as described by De Les Valls [1].
The modification of the base solver can be done following the steps reported below:
ˆ Step 1: At first, the new variables (i.e. electric potential and electric conductivity) must be
inserted in the createFields files of both solid and fluid.

added variables to the fluid domain


Info<< "Reading field sigma\n" << endl;
volScalarField sigma
(
IOobject
(
"sigma",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field PotE\n" << endl;


volScalarField PotE
(
IOobject
(
"PotE",
runTime.timeName(),

12
3.2. Derivation of MhdPisoFoam Chapter 3. Implementation

mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

added variables to the solid domain


//mhd modelling
Info<< "Reading field PotEsolid\n" << endl;
volScalarField PotEsolid
(
IOobject
(
"PotE",
runTime.timeName(),
solidMesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
solidMesh
);

Info<< "Reading solid electrical conductivity sigma_w\n" << endl;


volScalarField sigmasolid
(
IOobject
(
"sigma_w",
runTime.timeName(),
solidMesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
solidMesh
);

Those quantities are associated to the mesh domain of both materials, it is compulsory to
initialize their values (option IOObject::MUST-READ), and they will be written in the output
file (option IOObject::AUTO-WRITE)
ˆ Step 2: The magnetic field vector, which is supposed to be constant property, has to be added
to the readTransportProperties.H file.

added magnetic field B

//applied magnetic field


dimensionedVector B0(laminarTransport.lookup("B0"));

ˆ Step 3: Adding a source term for Lorentz body forces (lorentz) to the UEqn.H files.

added Lorentz forces to the velocity equation


// Solve the momentum equation

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff()
- (1.0/rho) * lorentz
);

UEqn.relax();

13
3.2. Derivation of MhdPisoFoam Chapter 3. Implementation

ˆ Step 4: Now that all the main parameters have been declared, the coupling of the electric
potential field between solid and fluid can be coded. That is made implementing the following
set of equations in the header file solvePotE.H:
1. Evaluation of magnetic flux term on cell faces

χ = (u × B) · Sf

2. Solve Poisson equation for electric potential in fluid and solid regions, respectively:

∇2 (σφ) − σ∇ · χ = 0

∇2 (σw φ) = 0
3. Computation of current density flux from normal gradient of electric potential on cell
faces and magnetic flux. The value at the center of the face is considered.

jf = −∇sn φ · Sf + χ

4. Reconstruction of current density in the cell centroid employing consistent scheme: a


volume-weighted interpolation between cell face center and centroid.
nf
1 X
Jc = jf (rf − rp ) · Sf
Ωp
f =1

5. The final, conservative, current density distribution is employed for the Lorentz force
calculation
lorentz = σ(Jc × B)
Where Ωp stands for the single cell volume whereas Sf points the single cell external sur-
face. The terms rp and rr are the coordinate vectors of the cell center and the face centre,
respectively. The resulting file is shown below:

solvePotE.H
{

//calculate cross-product of velocity and magnetic field


surfaceScalarField psiub = fvc::interpolate(U ^ B0) & mesh.Sf();
surfaceScalarField sigmasolidF = fvc::interpolate(sigmasolid);
surfaceScalarField sigmaF = fvc::interpolate(sigma);

while (simpleSolid.correctNonOrthogonal())
{
coupledFvScalarMatrix PotEqns(2);

// Add fluid equation


PotEqns.set
(
0,
new fvScalarMatrix
(
fvm::laplacian(sigma, PotE) - sigma * fvc::div(psiub)
)
);

// Add solid equation


PotEqns.set
(
1,
new fvScalarMatrix
(
fvm::laplacian(sigmasolidF, PotEsolid)

14
3.2. Derivation of MhdPisoFoam Chapter 3. Implementation

)
);

PotEqns.solve();
}
//consistent and conservative scheme for current density (Ni, 2007)
surfaceScalarField jn = -(fvc::snGrad(PotE) * mesh.magSf()) + psiub;

surfaceVectorField jnv = jn * mesh.Cf();

volVectorField jfinal = fvc::surfaceIntegrate(jnv) - fvc::surfaceIntegrate(jn) * mesh.C();

jfinal.correctBoundaryConditions();

//update lorentz field, maybe here we should just use lorentz.correct();


lorentz = sigma * (jfinal ^ B0);
}

ˆ Step 5: At last, few additions are necessary to the final MhdPisoFoam.C file, namely the
initialization of the lorentz term (see Eq.2.11) and the inclusion of the solvePotE.H files, as
it is done in the snippet below:

MhdPisoFoam source file


Info<< "\nStarting time loop\n" << endl;

// Lorentz force estimate


volVectorField lorentz = sigma * (-fvc::grad(PotE) ^ B0) + sigma * ((U ^ B0) ^ B0);

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

# include "readTimeControls.H"
# include "CourantNo.H"
# include "setDeltaT.H"

// Detach coupled CHT patches


# include "detachPatches.H"

# include "UEqn.H"

p_rgh.storePrevIter();

while (piso.correct())
{
# include "pEqn.H"
}

// Update turbulent quantities


turbulence->correct();

radiation->correct();

// Update thermal conductivity in the fluid


kappaEff = rho*Cp*(turbulence->nu()/Pr + turbulence->nut()/Prt);

// Update thermal conductivity in the solid


solidThermo.correct();
ksolid = solidThermo.k();

rhoCpsolid.oldTime();
rhoCpsolid = solidThermo.rho()*solidThermo.C();

// Attached coupled CHT patches


# include "attachPatches.H"

15
3.2. Derivation of MhdPisoFoam Chapter 3. Implementation

kappaEff.correctBoundaryConditions();
ksolid.correctBoundaryConditions();

// Interpolate to the faces and add thermal resistance


surfaceScalarField ksolidf = fvc::interpolate(ksolid);
solidThermo.modifyResistance(ksolidf);

# include "solveEnergy.H"

// Update density according to Boussinesq approximation


rhok = 1.0 - beta*(T - TRef);
rhok.correctBoundaryConditions();

# include "solvePotE.H"

runTime.write();

Info<< "ExecutionTime = "


<< runTime.elapsedCpuTime()
<< " s\n\n" << endl;
}

16
Chapter 4

Validation tutorial

In the following Section is described a tutorial case, that could help the reader understanding what
is needed to run (and test) MhdPisoFoam. The model studied is three-dimensional and it consists
in a fully developed MHD flow confined in a straight duct with square cross-section. The channel
side-walls are assumed to be perfectly insulated, consequently they are simulated just as boundary
patches. Conversely, the Hartmann-walls are set as electrically conductive and for this reason they
are modelled as separated bodies. Isothermal flow conditions are enforced (reference temperature
273.15K), hence all the materials physical properties are imposed as constant. The fluid is assumed
to be incompressible and under laminar regime and the magnetic field is treated as one-dimensional,
always perpendicular to the duct axis (therefore perpendicular to the main velocity component). At
last is worth mentioning that both the solid and the liquid are “dummy”, i.e. their properties do not
correspond to existing materials. All the quantities of the tutorial cases are expressed in SI units.
The aforementioned configuration (insulated side-walls and conductive Hartmann-walls) has been
chosen because it is the one that presents the most prominent alterations of the flow velocity, there-
fore it is ideal to showcase the effects of Lorentz forces and evaluate their proper implementation [5].
The tutorial is set to compare the results, in terms of velocity profiles, of three different cases: a
classical hydrodynamic flow and two MHD flows at the same Hartmann number (Ha) but different
walls conductance ratio c. In Figure 4.1a is reported the main structure of the tutorial direc-
tory (bash command: tree -L 1): the usage of the files (in green) will be discussed in the next
sections. Furthermore, in Figure 4.1b is shown the tree-diagram of the directory (bash command:
tree -d -L 3). It is important to notice that the folders that contains the files for handling the fluid
region (0,constant,system) also hosts the directories (solid) for the solid domain. Eventually,
Figure 4.1c, the internal structure of a single case directory (bash command: tree -L 4 Ha50c04)
is outlined: files for geometry, mesh, boundary conditions and control of the calculation will be
discussed in the following.

4.1 Geometry and mesh grid


In Figure 4.2 is depicted a sketch of the employed geometry. The channel and its mesh are built
through the blockMesh utility that is provided with every OpenFOAM (and foam-extend) distribu-
tions. The dictionaries (blockMeshDict) required by blockMesh are placed in the constant/polymesh
folder for the fluid region and in constant/solid/polymesh for the walls. The reader can find
an extensive guide about blockMesh usage in every OpenFOAM User Guide. The dictionary
file for the solid domain is reported below. The first parameter (convertToMeters), after the
header, is needed to define the dimension unit of length employed that is expressed in meters since
convertToMeters=1. Subsequently, the position of the vertices of the geometry model must be
declared as coordinates of a (x y z) system.

blockMeshDict for solid

17
4.1. Geometry and mesh grid Chapter 4. Validation tutorial

(a)

(b) (c)

Figure 4.1: Tutorial main folders and files.

Figure 4.2: Scheme of the channel. In light grey is depicted the fluid region, whereas in green the
solid domain. The red vector points the magnetic field. The walls perpendicular to the field are
addressed as Hartmann walls, the parallel ones instead as Side walls.

18
4.1. Geometry and mesh grid Chapter 4. Validation tutorial

convertToMeters 1;

vertices
(
//topWall
( 0 1.2 0)
(10 1.2 0)
(10 1.4 0)
( 0 1.4 0)
( 0 1.2 1)
(10 1.2 1)
(10 1.4 1)
( 0 1.4 1)
//Botwall
(0 0 0)
(10 0 0)
(10 0.2 0)
(0 0.2 0)
(0 0 1)
(10 0 1)
(10 0.2 1)
(0 0.2 1)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (60 30 70) simpleGrading (1 1 ((50 50 36.17701855)(50 50 0.02764)))
hex (8 9 10 11 12 13 14 15) (60 30 70) simpleGrading (1 1 ((50 50 36.17701855)(50 50 0.02764)))
);

edges
(
);

boundary
(
topInter
{
type regionCouple;

shadowRegion region0;
shadowPatch topWall;
attached off;
isWall on;
zone topInterZone;
master off;
bridgeOverlap off;

faces
(
(1 5 4 0)
);
}
botInter
{
type regionCouple;

shadowRegion region0;
shadowPatch bottomWall;
attached off;
isWall on;
zone botInterZone;
master off;
bridgeOverlap off;

faces

19
4.1. Geometry and mesh grid Chapter 4. Validation tutorial

(
(10 14 15 11)
);
}

outsidePatchSolid
{
type patch;
faces
(
(3 7 6 2)
(9 13 12 8)
(0 4 7 3)
(11 15 12 8)
(2 6 5 1)
(9 13 14 10)
(0 3 2 1)
(8 11 10 9)
(4 5 6 7)
(15 14 13 12)
);
}
);

The solid domain is divided in two bodies (the top and bottom Hartmann walls) that have the
same extension along each direction, but do not have any patches in common: they are indeed
separated by the fluid region (also region0 in the dictionaries).
The channel is therefore 10m long in the axial direction (x ), and 1m wide along both the toroidal
(y) and poloidal (z ) direction. The characteristic length of the channel is therefore a = 0.5m. The
thickness of the walls is varied, in order to change the conductance ratio from c = 0.1 for the first
MHD case to c = 0.4 for the second one (see Eq. 2.15).
The blocks constructor is utilized for declaring the number of the volumes that belong to the solid
domain (2 in this case), the shape of the bodies (hexahedral) and the number of cells along each axis.
Moreover, a grid grading option (simpleGrading) is employed to refine the mesh, within the thin
boundary layers, for the MHD cases. All the edges are straight and they are assumed to connect only
vertices that have exactly two common coordinates, that is the default option thus the edges field is
left empty. At last it is compulsory to define the boundary patches of the domain, specifying their
role (type) and their location (using 4 of the existing vertices). Each part of the solid domain has
a total of 6 faces, 5 of them being external patches and 1 being the interface (type regionCouple)
with the fluid body. The definition of an interface boundary is of paramount importance for a con-
jugate solver: it is indeed necessary a sub-dictionary where the user must declare the domain this
patch is linked to and the interface boundary of the other region (shadowRegion and shadowPatch
respectively). To properly set a functioning coupled-domains case, it is important to define right
nomenclature for the all the interfaces patches, as it is further discussed in Section 4.3. In the next
snippet of code is reported the blockMeshDict for the fluid region (or region0).
The main differences with the walls dictionary are that there is only one fluid body, as obvious, and
the non-interface patches are named in order to make clearer the definition of the boundary condi-
tions on them (inlet,outlet,side1,side2). Moreover, the reader can notice the non-uniformity
of the mesh is extended also to the poloidal direction in this case: this is a pivotal feature for the
tutorial that is mandatory to explain. As will be presented in the next Section, the MHD flows
simulated are at the same Hartmann number i.e. Ha = 50. To accurately detect the fluid behaviour
within the thin boundary layers close to both side and Hartmann walls, it is known that is needed
a number of cells that goes from a minimum of 5 to a maximum of 10 [12]. However, the thickness
of those layers is relatively small compared with the channel characteristic length (remember Eqs.
2.13). Therefore, to guarantee a mesh grid that is reliable and efficient in terms of computational
effort, a total expansion ratio is applied to the cells in both z and y direction. In Figure 4.3 is de-
picted the resulting mesh employed for the calculations. The grid is computed to obtain 7 elements
within the thinner layer (Hartmann layer).
Nevertheless, the simpleGrading functionality it is not fully supported by foam-extend. A simple

20
4.1. Geometry and mesh grid Chapter 4. Validation tutorial

Figure 4.3: Fluid domain mesh grid. The cells expansion ratio allows to obtain the desired reso-
lution, in terms of element numbers, within the thin boundary layers. Parameter a = 0.5m is the
characteristic length.

workaround to solve this issue is to generate the mesh with another distribution of OpenFOAM (e.g.
OpenFOAM v.9).

blockMeshDict for fluid

convertToMeters 1;

vertices
(
( 0 0.2 0)
(10 0.2 0)
(10 1.2 0)
( 0 1.2 0)
( 0 0.2 1)
(10 0.2 1)
(10 1.2 1)
( 0 1.2 1)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (60 70 70) simpleGrading (1 ((50 50 36.17701855)(50 50 0.02764)) ((50 50
36.17701855)(50 50 0.02764)))
);

edges
(
);

boundary
(
topWall
{

21
4.1. Geometry and mesh grid Chapter 4. Validation tutorial

type regionCouple;

shadowRegion solid;
shadowPatch topInter;
attached off;
isWall on;

zone topWallZone;
master on;
bridgeOverlap off;

faces
(
(3 7 6 2)
);
}
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(2 6 5 1)
);
}
bottomWall
{
type regionCouple;

shadowRegion solid;
shadowPatch botInter;
attached off;
isWall on;
zone bottomWallZone;
master on;
bridgeOverlap off;
faces
(
(1 5 4 0)
);
}
side1
{
type wall;
faces
(
(0 3 2 1)
);
}
side2
{
type wall;
faces
(
(4 5 6 7)
);
}
);

22
4.2. Boundary conditions and run control Chapter 4. Validation tutorial

4.2 Boundary conditions and run control


The boundary conditions for both domains are specified in the files placed in 0 and 0/solid folders of
each case. At the fluid inlet, is specified a constant velocity (in dictionary U) of 0.001m/s, whereas
the no-slip and zero-gradient conditions are applied to the wall-patches and the outlet patches
respectively. The temperature (T) is considered invariable in all the model with a value of 273.15K.
Also the pressure (p) and the buoyant pressure (p-rgh) are set as constant in the fluid region. The
thermal conductivity of liquid and walls are set to a low arbitrary value to minimize their influence
on the calculation. The electric potential (PotE) is set equal to 0V at the interface patches and the
zero-gradient condition is enforced in all other boundaries. The electrical conductivity (sigma and
sigma-w) is supposed constant in all regions with an arbitrary value of 5 · 105 (s3 A2 )/(m3 kg). All
the other invariable physical properties are collected in the transportProperties dictionary: it is
worth underlining that the magnetic field value and the dynamic viscosity are chosen so that the
MHD flows are simulated at Re = 4 and Ha = 50. In Appendix A are gathered all the dictionaries
mentioned above so that the reader can easily consult them. Figure 4.4 can help the reader in
visualizing the model boundaries.
In the system and system/solid folders are collected the files that handle the discretization of

(a) (b)

Figure 4.4: Solid and fluid region patches.

the derivative terms of the balance equations (fvSchemes), the solution of the discretized system
(fvSolution) and the general control of the run (controlDict). The second-order central difference
scheme is applied for both convective and diffusive terms of discretized equation, whereas the first-
order Euler scheme is used for time integration. The convergence of the solution can be controlled
run-time by the user changing the time- step in the controlDict. If the reader is not familiar with
Third-Party utilities that can plot the residuals and the Courant number of the calculations (such
as the one provided by the pyFoam package), a workaround for controlling the right behaviour of
the simulation is to print the run-summary (log file for this tutorial) on screen (bash command:
tail -f log). The Courant number and the maximum velocity are evaluated automatically by
OpenFOAM and the user can control that the increasing of the time-interval do not cause the
divergence of those parameters.
The tutorial is thought for parallel-running the three cases simultaneously. The default number of
processor is 3 for each MHD simulation and 2 for the hydrodynamic model. A decomposeParDict
is needed to divide the domain (either solid and liquid) in all the non-virtual processors that the
working-machines owns. An example of such a file is reported below, where can be noticed that the
simple decomposition method has been adopted and the domain is divided in 3 sub-domains along
the x -direction.

decomposeParDict for fluid domain in MHD folders


/*--------------------------------*- C++ -*----------------------------------*\

23
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

numberOfSubdomains 3;

globalFaceZones ( topWallZone bottomWallZone );

method simple;

simpleCoeffs
{
n (3 1 1);
delta 0.001;
}

// ************************************************************************* //

4.3 Running the tutorial and post-processes using BASH


scripts
The tutorial must be run following the steps listed below:

ˆ Step1: source the OpenFOAM distribution that you prefer (remember not foam-extend.x)
and, from the tutorial folder, run the TopoMesh script that is shown below.

TopoMesh BASH script topology and mesh generation


#!/bin/sh
cd ${0%/*} || exit 1
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

Tut="
Ha50c01
Ha50c04
Hydro
"
for folder in $Tut;
do
cd $folder;
blockMesh -region solid;
setSet -region solid -batch solid.setSet;
setsToZones -region solid -noFlipMap;
blockMesh;
setSet -batch fluid.setSet;
setsToZones -noFlipMap;
cd ..;
done
# ----------------------------------------------------------------- end-of-file

The script is designed to run the blockMesh utility in each case folders (variable name in
bash: Tut), then using the setSet and setToZone functions objects that are needed to detect

24
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

and name the interface regions in accordance with what is required by the regionCoupling
boundary condition. Notice that the program will complain because it does not recognize
the solver library liblduSolvers.so that is called in the controlDict but the mesh will be
computed anyway. It is suggested to control the status of the mesh using the paraFoam utility.
If the mesh has to be re-generated for whatever reason, the AllCaseClean script can be run
and the step1 must be repeated.
ˆ Step2: after the domain has been meshed, the user can exit the current terminal window and
open a new one where foam-extend version should be sourced. The following ParaRun script
has to be run in order to start the calculation.

ParaRun BASH script for parallel running


#!/bin/sh
cd ${0%/*} || exit 1
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

Tut="
Ha50c01
Ha50c04
"
decomposePar -case Hydro;
decomposePar -case Hydro -region solid;
mpirun -np 2 MhdPisoFoam -case Hydro -parallel > Hydro/log &

for folder in $Tut;


do
decomposePar -case $folder;
decomposePar -case $folder -region solid;
mpirun -np 3 MhdPisoFoam -case $folder -parallel > $folder/log &
done

# ----------------------------------------------------------------- end-of-file

The script launches the decomposePar in each folders for each domain and then initializes
the parallel run through the command mpirun, being np the flag that establishes the number
of processors to be used. The reader can notice that for the hydrodynamic case solution are
used only 2 processes, since it will be generally faster than the others (because the electric
potential field it is not solved). The calculations are put in background and their information
are collected in a log file. As already mentioned in previous Section, the user must control the
speed of the run changing the time-step from the controlDict, paying attention that this will
not cause a divergent trend. The default value chosen is 1 · 10−3 s, but the Author found that
it has to be increased up to 7 · 10−3 s during the run to reach the fully-developed condition
within the specified end time.
ˆ Step3: after the simulations reach their end-time, the post-processing script can be launched.

graph BASH script for post-processing


#!/bin/sh
cd ${0%/*} || exit 1
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

cases="
Ha50c01
Ha50c04
Hydro
"
mkdir Results

25
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

for folder in $cases;


do
reconstructPar -case $folder;
reconstructPar -case $folder -region solid;

latestTime=$(ls $folder -1 | sort -n | tail -n 1);


sample -case $folder;
Uref=$(sort -nk 1 $folder/postProcessing/sets/$latestTime/CentralVelocity_U.xy | head -n 1 | awk
'{print $2}');

GraphName="Velocity Pofiles_$folder.png"
gnuplot<<Velocity
set terminal pngcairo font "helvetica,20" size 1000, 1000
set output 'Results/$GraphName'
set key center top outside
set key horizontal
set xlabel "non-dimensional channel height z/2a"
set ylabel "non-dimensional velocity U/U0"
set grid
plot \
"$folder/postProcessing/sets/$latestTime/SideLayerProfiles_U.xy" u 1:(\$2/$Uref) w lines
lw 2 lc rgb "red" title "foam-extend", \
"SloanSol$folder" u 1:2 w points pt 7 ps 1.5 lc rgb "midnight-blue" title "Analytical"

Velocity
done

latestTimeA=$(ls Ha50c01 -1 | sort -n | tail -n 1);


latestTimeB=$(ls Ha50c04 -1 | sort -n | tail -n 1);

GraphName="Electric Potential.png"
gnuplot<<POT
set terminal pngcairo font "helvetica,20" size 1000, 1000
set output 'Results/$GraphName'
set key center top outside
set key horizontal
set xlabel "non-dimensional channel height z/2a"
set ylabel "Electric Potential"
set grid
plot \
"Ha50c01/postProcessing/sets/$latestTimeA/SideLayerProfiles_PotE.xy" u 1:2 w lines lw 2
lc rgb "red" title "Conductance ratio c = 0.1", \
"Ha50c04/postProcessing/sets/$latestTimeB/SideLayerProfiles_PotE.xy" u 1:2 w lines lw 2
lc rgb "green" title "Conductance ratio c = 0.4"
POT

The script is designed to make a new folder Tutorial/Results where will be gathered the
outcomes of the calculations. Then, the cases are re-built from the parallel-running set-up
employing the reconstructPar utility and the latest time folder is selected so its name can
be used as a variable in the rest of the file. After, the sample utility is run to collect the data
along the sampling regions that have been defined within system/sampleDict.

sample dictionary for post-processing


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;

26
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

class dictionary;
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cellPoint;

setFormat raw;

sets
(
SideLayerProfiles
{
type uniform;
axis distance;
start (5 0.6999999 0);
end (5 0.6999999 1);
nPoints 1000;
}

CentralVelocity
{
type uniform;
axis distance;
start (5 0.6999999 0.49);
end (5 0.6999999 0.51);
nPoints 2;
}
);

fields
(
U
PotE
);

// ************************************************************************* //

Two sets of data are sampled along two lines (z -direction) with the specified length and
locations: the first set samples the velocity and the electric potential between the side walls,
whereas the second is used to extract the velocity at the center of the channel which will be
assigned to the script variable Uref .
At last the application gnuplot is called, to make the final graphs that serve as a benchmark
solver performances.

In Figure 4.5 are shown the velocity profiles computed at the centre of the duct for the hydrodynamic
and the magnetohydrodynamic flows. As expected, the classical parabolic-shaped trend of the
velocity is deeply altered in the MHD flows: the Lorentz forces (caused by the electrical currents
arising in the fluid) brake the liquid in the core region of the channel, conveying a substantial fraction
of the mass flow rate towards the side layers. When the conductivity of the walls is increased (from
c = 0.1 to c = 0.4) also the currents intensity grows, magnifying the velocity imbalance between
the core and the side. The dots in the MHD graph represent the analytical solution provided by
Sloan [13] for a MHD flow in rectangular channel with electrical conductive walls. It is clear that
MhdPisoFoam is able to model with a good accuracy those kind of flows. Moreover, in Figure 4.6
is also depicted the electric potential along z -direction. It can be noticed how much it is strictly
linked with the mass flow rate, presenting a more irregular profile whenever the velocity in side
layers increases.

27
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

(a) Hydrodynamic case (b) MHD case Ha = 50 and c = 0.1

(c) MHD case Ha = 50 and c = 0.4

Figure 4.5: Scaled velocity profile along non-dimensional z-coordinate plotted on the plane x = 5m.

28
4.3. Running the tutorial and post-processes using BASH scripts Chapter 4. Validation tutorial

Figure 4.6: Electric potential between the side walls in Volt.

29
Bibliography

[1] E. de les Valls, Development of a simulation tool for MHD flows under nuclear fusion conditions.
PhD thesis, Dept. of Physics and Nuclear Engineering, Universitat Politecnica de Catalunya,
2011.
[2] A. Tassone, “Magnetic induction and electric potential solvers for incompressible mhd flows.,”
In Proceedings of CFD with OpenSource Software, 2016, Edited by Nilsson. H., available online.,
2016.
[3] E. Iraola, “Implementation of quasi-2d magnetohydrodynamic mixed convection solver for in-
compressible flows in liquid metal channels.,” In Proceedings of CFD with OpenSource Software,
2020, Edited by Nilsson. H., available online., 2020.
[4] P. Davidson, An introduction to magnetohydrodynamics, vol. 25. Cambridge university press,
2001.
[5] U. Müller and L. Bühler, Magnetofluiddynamics in channels and containers. Springer Science
& Business Media, 2013.
[6] C. Mistrangelo, “Simulation of magneto-hydrodynamic (MHD) flows in OpenFOAM.”
Presentation at NUMAP-FOAM Summer School University of Zagreb, available online
at: http://powerlab.fsb.hr/ped/kturbo/OpenFOAM/SummerSchool2010/Chiara.pdf, Septem-
ber 2010.
[7] T. Valikangas, “Conjugate heat transfer in openfoam.,” In Proceedings of CFD with OpenSource
Software, 2016, Edited by Nilsson. H., available online., 2016.
[8] J. Ni et al., “A current density conservative scheme for incompressible MHD flows at a low
magnetic reynolds number. Part I: On a rectangular collocated grid system,” Journal of Com-
putational Physics, vol. 227, no. 1, pp. 174–204, 2007.
[9] J. Ni et al., “A current density conservative scheme for incompressible MHD flows at a low
magnetic reynolds number. Part II: On an arbitrary collocated mesh,” Journal of Computational
Physics, vol. 227, no. 1, pp. 205–228, 2007.
[10] C. Mistrangelo and L. Bühler, “Development of a numerical tool to simulate magnetohydro-
dynamic interactions of liquid metals with strong applied magnetic fields,” Fusion Science and
Technology, vol. 60, no. 2, pp. 798–803, 2011.
[11] J. Feng, H. Chen, Q. He, and M. Ye, “Further validation of liquid metal MHD code for un-
structured grid based on OpenFOAM,” Fusion Engineering and Design, vol. 100, pp. 260–264,
2015.
[12] A. Blishchik, “An extensive numerical benchmark of the various magnetohydrodynamic flows,”
International Journal of Heat and Fluid Flow, vol. 90, no. 108800, 2021.
[13] D. Sloan, “Magnetohydrodynamic flow in a rectangular pipe between conducting plates,”
ZAMM, vol. 46, no. 7, 1966.

30
Study questions

1. What is a magnetohydrodynamic regime and by what phenomena is caused?


2. What are the most important non-dimensional parameters used in this tutorial and what is
their physical meaning?
3. What kind of field is chosen to implement electric potential and electrical conductivity in the
solver? And why?
4. Which features of the blockMesh utility can help increasing the resolution in thin boundary
layers?

31
Appendix A

Boundary conditions and


parameters dictionaries

In the following are shown the dictionaries (in alphabetical order) for the tutorials settings.

gravitational acceleration g
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -2 0 0 0 0];
value (0 0 0); // (0 -9.81 0);

// ************************************************************************* //

solid thermal conductivity


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

32
Appendix A. Boundary conditions and parameters dictionaries

dimensions [1 1 -3 -1 0 0 0];

internalField uniform 1e-10;

boundaryField
{
botInter
{
type chtRcThermalDiffusivity;
remoteField kappaEff;
value uniform 1e-10;
}
topInter
{
type chtRcThermalDiffusivity;
remoteField kappaEff;
value uniform 1e-10;
}
outsidePatchSolid
{
type zeroGradient;
}

// ************************************************************************* //

fluid thermal conductivity


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object kappaEff;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [1 1 -3 -1 0 0 0];

internalField uniform 1e-10;

boundaryField
{
topWall
{
type chtRcThermalDiffusivity;
remoteField k;
value uniform 1e-10;
}
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
bottomWall
{

33
Appendix A. Boundary conditions and parameters dictionaries

type chtRcThermalDiffusivity;
remoteField k;
value uniform 1e-10;
}
side1
{
type zeroGradient;
}
side2
{
type zeroGradient;
}
}

// ************************************************************************* //

pressure
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0;

boundaryField
{
topWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
bottomWall
{
type zeroGradient;
}
side1
{
type zeroGradient;
}
side2
{
type zeroGradient;
}
}

34
Appendix A. Boundary conditions and parameters dictionaries

// ************************************************************************* //

buoyant pressure
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0;

boundaryField
{
topWall
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
bottomWall
{
type zeroGradient;
}
side1
{
type zeroGradient;
}
side2
{
type zeroGradient;
}
}

/* type buoyantPressure;
rho rhok;
*/

// ************************************************************************* //

fluid electric potential


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |

35
Appendix A. Boundary conditions and parameters dictionaries

\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object PotE;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 0.0;

boundaryField
{
topWall
{
type regionCoupling;
value uniform 0.0;
remoteField PotE;

}
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
bottomWall
{
type regionCoupling;
value uniform 0.0;
remoteField PotE;
}
side1
{
type zeroGradient;
}
side2
{
type zeroGradient;
}
}

// ************************************************************************* //

thermal radiation properties


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object environmentalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

36
Appendix A. Boundary conditions and parameters dictionaries

radiation on;

radiationModel none;

noRadiation
{
}

// ************************************************************************* //

turbulent models properties


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

RASModel laminar;

turbulence on;

printCoeffs on;

// ************************************************************************* //

fluid electrical conductivity


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object sigma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 50000;

boundaryField
{
topWall
{
type regionCoupling;
value uniform 50000;
remoteField sigma_w;

37
Appendix A. Boundary conditions and parameters dictionaries

}
inlet
{
type fixedValue;
value uniform 50000;
}
outlet
{
type fixedValue;
value uniform 50000;
}
bottomWall
{
type regionCoupling;
value uniform 50000;
remoteField sigma_w;
}

side1
{
type fixedValue;
value uniform 50000;
}
side2
{
type fixedValue;
value uniform 50000;
}
}

// ************************************************************************* //

solid electrical conductivity


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object sigma_w;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform 50000;

boundaryField
{
botInter
{
type regionCoupling;
value uniform 50000;
remoteField sigma;
}
topInter
{
type regionCoupling;
value uniform 50000;
remoteField sigma;

38
Appendix A. Boundary conditions and parameters dictionaries

}
outsidePatchSolid
{
type fixedValue;
value uniform 50000;
}

// ************************************************************************* //

fluid temperature
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 1 0 0 0];

internalField uniform 273;

boundaryField
{
topWall
{
type chtRcTemperature;
radiation off;
K kappaEff;
remoteField T;
value uniform 273;
}
inlet
{
type fixedValue;
value uniform 273;
}
outlet
{
type fixedValue;
value uniform 273;
}
bottomWall
{
type chtRcTemperature;
radiation off;
K kappaEff;
remoteField T;
value uniform 273;
}
side1
{
type fixedValue;
value uniform 273;
}
side2

39
Appendix A. Boundary conditions and parameters dictionaries

{
type fixedValue;
value uniform 273;
}
}

// ************************************************************************* //

solid temperature
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 1 0 0 0];

internalField uniform 273;

boundaryField
{
topInter
{
type chtRcTemperature;
radiation off;
K k;
remoteField T;
value uniform 273;
}
botInter
{
type chtRcTemperature;
radiation off;
K k;
remoteField T;
value uniform 273;
}
outsidePatchSolid
{
type fixedValue;
value uniform 273;
}
}

// ************************************************************************* //

solid thermal properties


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |

40
Appendix A. Boundary conditions and parameters dictionaries

\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object thermalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

thermal
{
type constant;
rho rho [1 -3 0 0 0] 10000;
C C [0 2 -2 -1 0] 1e-10;
k k [1 1 -3 -1 0] 1e-10;

// Values not used


alpha alpha [0 0 0 -1 0 0 0] 0.0;
T0 T0 [0 0 0 1 0 0 0] 273.0;

gaps
(
);

sources
(
);
}

// ************************************************************************* //

transport properties for MHD


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel Newtonian;

TRef TRef [0 0 0 1 0 0 0] 273.0;

nu nu [0 2 -1 0 0 0 0] 0.001;

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

Cp Cp [0 2 -2 -1 0 0 0] 1e-10;

beta beta [0 0 0 -1 0 0 0] 1e-10;

Prt Prt [0 0 0 0 0 0 0] 1e-10;

Pr Pr [0 0 0 0 0 0 0] 1e-10;

B0 B0 [1 0 -2 0 0 -1 0] (0 0 0);

41
Appendix A. Boundary conditions and parameters dictionaries

// ************************************************************************* //

transport properties for hydrodynmic case


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel Newtonian;

TRef TRef [0 0 0 1 0 0 0] 273.0;

nu nu [0 2 -1 0 0 0 0] 0.001;

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

Cp Cp [0 2 -2 -1 0 0 0] 1e-10;

beta beta [0 0 0 -1 0 0 0] 1e-10;

Prt Prt [0 0 0 0 0 0 0] 1e-10;

Pr Pr [0 0 0 0 0 0 0] 1e-10;

B0 B0 [1 0 -2 0 0 -1 0] (0 0.45 0);

// ************************************************************************* //

turbulent properties
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType RASModel;

// ************************************************************************* //

42
Appendix A. Boundary conditions and parameters dictionaries

Velocity
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField uniform (0 0 0);

boundaryField
{
topWall
{
type fixedValue;
value uniform (0 0 0);
}

inlet
{
type fixedValue;
value uniform (1e-3 0 0);
}

outlet
{
type zeroGradient;
}

bottomWall
{
type fixedValue;
value uniform (0 0 0);
}

side1
{
type fixedValue;
value uniform (0 0 0);
}
side2
{
type fixedValue;
value uniform (0 0 0);
}
}
// ************************************************************************* //

43
Appendix B

System and run control


dictionaries

Here are listed (in alphabetical order) the dictionaries and scripts employed for the simulations
management and run control.

cleaning script to reset the turorial


#!/bin/sh
cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions

Tut="
Ha50c01
Ha50c04
"
for folder in $Tut;
do

cd $folder;./Allclean;cd ..;

done

control dictionary
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs
(
"liblduSolvers.so"
)

application MhdPisoFoam;

44
Appendix B. System and run control dictionaries

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 16;

deltaT 1e-3;

writeControl adjustableRunTime;

writeInterval 2;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

adjustTimeStep off;

maxCo 0.5;

// ************************************************************************* //

discretization schemes for fluid equations


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
default Euler;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
default Gauss linear;
div(phi,U) Gauss linear;
div(phi,T) Gauss upwind;
div(phi,k) Gauss upwind;

45
Appendix B. System and run control dictionaries

div(phi,epsilon) Gauss upwind;


div((nuEff*dev(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
default Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}

// ************************************************************************* //

discretization schemes for solid equations


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
default steadyState;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
default none;
}

laplacianSchemes
{
default Gauss harmonic uncorrected;
laplacian(k,T) Gauss harmonic uncorrected;
}

interpolationSchemes
{
default harmonic;
interpolate(k) harmonic;
}

snGradSchemes

46
Appendix B. System and run control dictionaries

{
default corrected;
}

// ************************************************************************* //

solvers definition for fluid equations


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
"p_rgh|p"
{
solver PCG;
preconditioner DIC;

minIter 0;
maxIter 1000;
tolerance 1e-7;
relTol 0.01;
}

p_rghFinal
{
solver PCG;
preconditioner DIC;

minIter 0;
maxIter 1000;
tolerance 1e-7;
relTol 0;
}

U
{
solver BiCGStab;
preconditioner DILU;

minIter 0;
maxIter 1000;
tolerance 1e-7;
relTol 0; //0.01;
}
T_T
{
solver BiCGStab;
preconditioner Cholesky;

minIter 0;
maxIter 1000;
tolerance 1e-7;
relTol 0.001;

47
Appendix B. System and run control dictionaries

}
PotE_PotE
{
solver BiCGStab;
preconditioner Cholesky;

minIter 1;
maxIter 1000;
tolerance 1e-7;
relTol 0;//0.0001;
}
G
{
solver PCG;
preconditioner DIC;

minIter 1;
maxIter 1000;
tolerance 1e-7;
relTol 0.1;
}
epsilon
{
solver BiCGStab;
preconditioner DILU;

minIter 1;
maxIter 100;
tolerance 1e-7;
relTol 0.01;
}
k
{
solver BiCGStab;
preconditioner DILU;

minIter 1;
maxIter 100;
tolerance 1e-7;
relTol 0.01;
}
}

PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
p_rghRefCell 0;
p_rghRefValue 0;
}

relaxationFactors
{
}

// ************************************************************************* //

solvers definition for solid equations


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile

48
Appendix B. System and run control dictionaries

{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
}

SIMPLE
{
}

relaxationFactors
{
T 0.9;
PotE 0.3;
}

// ************************************************************************* //

Sloan analytical solution for Ha


0.002785359 0.033756995
0.005219756 0.208449069
0.007421978 0.378715464
0.010883723 0.530600319
0.013992825 0.696275323
0.016972994 0.80512711
0.020561874 0.93806048
0.023730189 1.063423452
0.028120975 1.178185578
0.03186279 1.289762014
0.035434147 1.394235788
0.040133177 1.525237074
0.046729218 1.64832442
0.052664724 1.732053517
0.059651949 1.829012505
0.064292129 1.862782007
0.068682461 1.914266089
0.078208916 1.943847572
0.088404804 1.950664008
0.099523725 1.937243758
0.109708357 1.883331374
0.119892988 1.829418989
0.129152085 1.782247998
0.139334216 1.71484032
0.150325646 1.630346068
0.159694724 1.559782024
0.170802388 1.485632953
0.180057733 1.418219021
0.190241114 1.35755899
0.200424495 1.296898959
0.210611628 1.256481868
0.221723045 1.202575737
0.230982142 1.155404746
0.240246242 1.135224342
0.250433375 1.094807251
0.259694974 1.061131553
0.269884608 1.034209756
0.28100353 1.020789506
0.300462267 1.000677891
0.319922255 0.987313924
0.339383494 0.980697603

49
Appendix B. System and run control dictionaries

0.360699554 0.980841436
0.380163294 0.987720409
0.400552569 0.987857988
0.420941844 0.987995567
0.440404334 0.988126893
0.461720394 0.988270726
0.480256098 0.988395799
0.499719838 0.995274771
0.521037149 1.002166251
0.541425173 0.995556184
0.561814448 0.995693763
0.580350152 0.995818835
0.601666212 0.995962668
0.621128702 0.996093994
0.641516726 0.989483927
0.661907251 0.996369153
0.681370992 1.003248126
0.701759016 0.996638058
0.711031871 1.023691182
0.72122901 1.037255265
0.740697753 1.071124825
0.761097034 1.125243578
0.781501317 1.206352919
0.800980066 1.294203653
0.820465069 1.41579262
0.832280157 1.479781694
0.840880609 1.557630782
0.852435299 1.626463319
0.861299901 1.719711884
0.871505795 1.780509494
0.881712939 1.848054752
0.892843117 1.895363322
0.902118473 1.935911739
0.921583464 1.949538358
0.93300154 1.920098201
0.941952728 1.84171359
0.9507242 1.718871487
0.957219786 1.630402991
0.961357684 1.531453164
0.966059072 1.410859705
0.970602915 1.286757601
0.974303549 1.176154991
0.977835971 1.070579773
0.981639397 0.951293122
0.984302359 0.824584795
0.987242583 0.71792804
0.99123521 0.540088819
0.993698652 0.416260021
0.995452546 0.297023945
0.99720511 0.170604251
0.999080719 0.047227274

Sloan analytical solution for Ha


0.001864827 0.067488975
0.003247757 0.215619372
0.003270126 0.336304155
0.004073307 0.411019109
0.004495136 0.557567581
0.005364437 0.68482595
0.006322398 0.83414886
0.006931841 0.928258252
0.008486424 1.102522573
0.009957482 1.282430595
0.011287307 1.430401391

50
Appendix B. System and run control dictionaries

0.012775633 1.581800864
0.01358977 1.715626733
0.014795739 1.83416442
0.01600051 1.946236851
0.017209475 2.080937679
0.018412647 2.184389768
0.019615421 2.285686772
0.021762568 2.415801375
0.022287721 2.558630638
0.024546472 2.69928042
0.02563488 2.822342988
0.026838852 2.930105248
0.029238739 3.10216888
0.03163603 3.260224455
0.034031324 3.407504604
0.03642542 3.548319497
0.038935811 3.677785072
0.041485208 3.819443228
0.044197442 3.958556018
0.047297623 4.076100782
0.051175966 4.194225485
0.054327076 4.312776297
0.057890257 4.373142657
0.061995803 4.474102544
0.067570272 4.54836418
0.077773664 4.595666497
0.091655278 4.486974137
0.10090077 4.366402848
0.10640864 4.235544747
0.112307462 4.121365165
0.116436278 4.039499882
0.119361431 3.961669114
0.122128029 3.88746376
0.124681128 3.806806581
0.129867873 3.683570847
0.134446207 3.563040255
0.137056391 3.500868337
0.140573681 3.401758265
0.144711638 3.281101554
0.14848142 3.178545054
0.151779147 3.084318354
0.156103432 2.992397337
0.160864149 2.86883175
0.164741829 2.75367246
0.170048572 2.639057866
0.175354676 2.520995137
0.179311052 2.389873902
0.18596241 2.260732721
0.19127107 2.156462538
0.196581329 2.060812696
0.20147135 1.944679302
0.207786867 1.83187485
0.213691149 1.747148102
0.220878808 1.64791417
0.230221793 1.502657756
0.240290017 1.371391979
0.250308826 1.281897317
0.260645523 1.189343096
0.281012285 1.068023033
0.300459766 0.987182598
0.320840285 0.94008665
0.340300273 0.926722682
0.359764014 0.933601655
0.381081324 0.940493135
0.400546315 0.954119754
0.421866128 0.974506528
0.440403083 0.981379247
0.460794859 0.995012119

51
Appendix B. System and run control dictionaries

0.481185385 1.001897346
0.500647874 1.002028672
0.521037149 1.002166251
0.541425173 0.995556184
0.560885161 0.982192216
0.581270684 0.962086855
0.600730672 0.948722887
0.621118696 0.94211282
0.640579935 0.935496499
0.660042425 0.935627825
0.68228652 0.942525559
0.701759016 0.996638058
0.720307227 1.064239598
0.730392352 1.134280956
0.740720266 1.192582466
0.752324557 1.286721459
0.762071346 1.381660409
0.771308117 1.500382333
0.776645798 1.552679106
0.782508148 1.638208565
0.789116399 1.761087917
0.795051905 1.844817013
0.802029422 1.955479289
0.806342276 2.073547474
0.811688805 2.173579389
0.817035335 2.273611303
0.822501244 2.400961555
0.826552384 2.516768853
0.83190107 2.628438229
0.837251194 2.747865912
0.842055037 2.893671095
0.847619298 3.019845739
0.852240043 3.128123644
0.855694092 3.238487187
0.859258471 3.305318802
0.862541868 3.420125122
0.867846343 3.554442739
0.872467088 3.662720645
0.875920537 3.769851559
0.879483518 3.829140376
0.882100663 3.939825249
0.887221853 4.05763136
0.892569621 4.16434404
0.897322193 4.253812042
0.90164445 4.378553615
0.911574418 4.492583622
0.922074998 4.601363537
0.934118203 4.574454247
0.941516226 4.486784868
0.946477874 4.360604813
0.95102174 4.236625856
0.954248165 4.122736111
0.957543549 4.015866244
0.959422874 3.93456047
0.96178418 3.832400711
0.963525259 3.710100368
0.965870287 3.586198935
0.968212719 3.448289446
0.970554353 3.306069787
0.97289279 3.146609444
0.975228786 2.973979135
0.977309388 2.792282072
0.978723105 2.662832713
0.979885466 2.546106908
0.980982768 2.40877857
0.983386198 2.26956158
0.984548626 2.153194957
0.984825319 2.049034492

52
Appendix B. System and run control dictionaries

0.986873282 1.919384167
0.987915113 1.791163775
0.989192746 1.657557267
0.989469514 1.553807295
0.990629802 1.425895571
0.992086033 1.297677975
0.993241031 1.141226762
0.994407293 1.045548959
0.994976723 0.923790627
0.995740424 0.785511305
0.996702589 0.653339391
0.997228399 0.053962413
0.997265162 0.494585426
0.997823873 0.314998969

53
Index

electrical conductivity, 5, 7, 23 MHD, 5, 8, 9, 11, 12, 17, 20, 23, 27


foam-extend, 5, 11, 24, 25

54

You might also like