Fluent 6.1 Magnetohydrodynamics (MHD) Module Manual: February 2003
Fluent 6.1 Magnetohydrodynamics (MHD) Module Manual: February 2003
1
Magnetohydrodynamics (MHD)
Module Manual
February 2003
Licensee acknowledges that use of Fluent Inc.’s products can only provide an imprecise
estimation of possible future performance and that additional testing and analysis, inde-
pendent of the Licensor’s products, must be conducted before any product can be finally
developed or commercially introduced. As a result, Licensee agrees that it will not rely
upon the results of any usage of Fluent Inc.’s products in determining the final design,
composition or structure of any product.
Airpak, FIDAP, FLUENT, GAMBIT, Icepak, MixSim, and POLYFLOW are registered
trademarks of Fluent Inc. All other products or name brands are trademarks of their
respective holders.
Fluent Inc.
Centerra Resource Park
10 Cavendish Court
Lebanon, NH 03766
Contents
1 Introduction 1-1
3 Implementation 3-1
3.1 Solving Induction Equations . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.2 Solving Electric Potential Equation . . . . . . . . . . . . . . . . . . . . . 3-2
3.3 Calculation of MHD Variables . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.4 MHD Interaction with Fluid Flows . . . . . . . . . . . . . . . . . . . . . 3-2
3.5 MHD Interaction with Discrete Phase Model . . . . . . . . . . . . . . . 3-2
3.6 General UDFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
c Fluent Inc. January 24, 2003 i
CONTENTS
ii
c Fluent Inc. January 24, 2003
Chapter 1. Introduction
c Fluent Inc. January 24, 2003 1-1
Introduction
1-2
c Fluent Inc. January 24, 2003
Chapter 2. Technical Background
2.1 Introduction
The coupling between the fluid flow field and the magnetic field can be understood on the
basis of two fundamental effects: the induction of electric current due to the movement
of conducting material in a magnetic field, and the effect of Lorentz force as the result of
electric current and magnetic field interaction. In general, the induced electric current and
the Lorentz force tend to oppose the mechanisms that create them. Movements that lead
to electromagnetic induction are therefore systematically braked by the resulting Lorentz
force. Electric induction can also occur in the presence of a time-varying magnetic field.
The effect is the stirring of fluid movement by the Lorentz force.
Electromagnetic fields are described by Maxwell’s equations:
~ =0
∇·B (2.1-1)
~
~ = − ∂B
∇×E (2.1-2)
∂t
~ =q
∇·D (2.1-3)
~
∂D
~ = ~ +
∇×H (2.1-4)
∂t
where B ~ (Tesla) and E ~ (V/m) are the magnetic and electric fields, respectively, and H ~
and D~ are the induction fields for the magnetic and electric fields, respectively. q (C/m3 )
is the electric charge density, and ~ (A/m2 ) is the electric current density vector.
~ and D
The induction fields H ~ are defined as:
~ = 1B
H ~ (2.1-5)
µ
~ = εE
D ~ (2.1-6)
c Fluent Inc. January 24, 2003 2-1
Technical Background
where µ and ε are the magnetic permeability and the electric permittivity, respectively.
For sufficiently conducting media such as liquid metals, the electric charge density q and
~
the displacement current ∂∂tD are customarily neglected [1].
In studying the interaction between flow field and electromagnetic field, it is critical to
know the current density ~ due to induction. Generally, two approaches may be used
to evaluate the current density. One is through the solution of a magnetic induction
equation; the other is through solving an electric potential equation.
~
~ = σ E (2.2-1)
~ in a magnetic
where σ is the electrical conductivity of the media. For fluid velocity field U
~
field B, Ohm’s law takes the form:
~ +U
~ = σ(E ~ × B)
~ (2.2-2)
From Ohm’s law and Maxwell’s equation, the induction equation can be derived as:
~
∂B
+ (U ~ = 1 ∇2 B
~ · ∇)B ~ + (B
~ · ∇)U
~ (2.2-3)
∂t µσ
1 ~
~ = ∇×B (2.2-4)
µ
∂ B~0
∇2 B~0 − µσ 0 =0 (2.2-5)
∂t
2-2
c Fluent Inc. January 24, 2003
2.2 Magnetic Induction Method
where σ 0 is the electrical conductivity of the media in which field B~0 is generated. Two
cases need to be considered.
∇ × B~0 = 0 (2.2-6)
∇2 B~0 = 0 (2.2-7)
~ = B~0 + ~b, the induction equation (Equation 2.2-3) can be written as:
With B
1
~ = ∇ × ~b (2.2-9)
µ
1
~ = ∇ × (B~0 + ~b) (2.2-11)
µ
For the induction equation Equations 2.2-8 or 2.2-10, the boundary conditions for the
induced field are given by:
c Fluent Inc. January 24, 2003 2-3
Technical Background
where the subscripts denote the normal and tangential components of the field and b~∗ is
specified by the user. For an electrically insulating boundary, as jn = 0 at the boundary,
from Ampere’s relation one has bt1 = bt2 = 0 at the boundary.
~
~ = −∇ϕ − ∂ A
E (2.3-1)
∂t
where ϕ and A ~ are the scalar potential and the vector potential, respectively. For a static
field and assuming ~b << B~0 , Ohm’s law given in Equation 2.2-2 can be written as:
~ × B~0 ))
~ = σ(−∇ϕ + (U (2.3-2)
For sufficiently conducting media, the principle of conservation of electric charge gives:
∇ · ~ = 0 (2.3-3)
~ × B~0 )
∇2 ϕ = ∇ · (U (2.3-4)
∂ϕ ~ × B~0 )boundary · ~n
= (U (2.3-5)
∂n
for an insulating boundary, where ~n is the unit vector normal to the boundary, and
ϕ = ϕ0 (2.3-6)
for a conducting boundary, where ϕ0 is the specified potential at the boundary. The
current density can then be calculated from Equation 2.3-2.
2-4
c Fluent Inc. January 24, 2003
2.3 Electric Potential Method
With the knowledge of the induced electric current, the MHD coupling is achieved by
introducing additional source terms to the fluid momentum equation and energy equation.
For the fluid momentum equation, the additional source term is the Lorentz force given
by:
F~ = ~ × B
~ (2.3-7)
which has units of N/m3 in the SI system. For the energy equation, the additional source
term is the Joule heating rate given by:
1
Q= ~ · ~ (2.3-8)
σ
F~p = q(E
~ + ~νp × B)
~ (2.3-9)
where q is the particle charge density (Coulomb/m3 ) and νp is the particle velocity. The
force F~p has units of N/m3 .
For multiphase flows, assuming that the electric surface current at the interface between
phases can be ignored, the electric conductivity for the mixture is given by:
X
σm = σi νi (2.3-10)
i
where σi and νi are respectively the electric conductivity and volume fraction of phase i.
σm is used in solving the induction equations.
c Fluent Inc. January 24, 2003 2-5
Technical Background
2-6
c Fluent Inc. January 24, 2003
Chapter 3. Implementation
Implementation of the MHD model is achieved through the user-defined function (UDF)
facility of FLUENT. The UDF module is linked to the FLUENT code as a run-time library.
The model is accessed through a number of UDF schemes. The magnetic induction
equation given by Equations 2.2-8 or 2.2-10 and the electric potential equation given by
Equation 2.3-4 are solved through user-defined scalar (UDS) transport equations. Other
model-related variables such as the external magnetic field data, current density, Lorentz
force and Joule heat are stored through user-defined memory locations. The MHD-related
parameters are input through a combination of new, modified, and standard FLUENT
graphical user interface (GUI) panels, as described in Chapter 4.
c Fluent Inc. January 24, 2003 3-1
Implementation
3-2
c Fluent Inc. January 24, 2003
3.6 General UDFs
• DEFINE INIT(mhd init, ...) is an initialization function called during the gen-
eral case initialization to set up the external magnetic field and initialize MHD
model parameters and variables.
• DEFINE ADJUST(mhd adjust, ...) is called at the start of each iteration. It is used
to adjust the magnetic boundary conditions and update MHD related variables and
properties.
c Fluent Inc. January 24, 2003 3-3
Implementation
3-4
c Fluent Inc. January 24, 2003
Chapter 4. Using the FLUENT MHD Model
ln -s <path>/addons/mhd1.0/lib/mhd-parameter.scm mhd-parameter.scm
ln -s <path>/addons/mhd1.0 libudf
where <path> represents the location in the file system where FLUENT is installed.
c Fluent Inc. January 24, 2003 4-1
Using the FLUENT MHD Model
<path>\addons\mhd1.0
locally and rename it to libudf. Inside this folder are three different ports of the MHD
module, one for each type of parallel message passing supported (net, smpi and vmpi).
You will need to select one of the folders; ntx86 net, ntx86 smpi, or ntx86 vmpi you
wish to use and rename it as ntx86. If you are only running in serial mode, you can
rename any of the folders.
Also you will need to copy the file
<path>\addons\mhd1.0\lib\mhd-parameter.scm
locally. Note that <path> represents the location in the file system where FLUENT is
installed.
4-2
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
c Fluent Inc. January 24, 2003 4-3
Using the FLUENT MHD Model
Figure 4.3.1: The MHD Model Setup Panel for Patching an External Magnetic Field
Scalar Description
2-D Scalar-0 X component of induced magnetic field (bx )
Scalar-1 Y component of induced magnetic field (by )
Scalar-2 X component of imposed magnetic field (B0x )
Scalar-3 Y component of imposed magnetic field (B0y )
Scalar-4 Electric potential (ϕ)
3-D Scalar-0 X component of induced magnetic field (bx )
Scalar-1 Y component of induced magnetic field (by )
Scalar-2 Z component of induced magnetic field (bz )
Scalar-3 X component of imposed magnetic field (B0x )
Scalar-4 Y component of imposed magnetic field (B0y )
Scalar-5 Z component of imposed magnetic field (B0z )
Scalar-6 Electric potential (ϕ)
4-4
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
Figure 4.3.2: The MHD Model Setup Panel for Importing an External Magnetic Field
c Fluent Inc. January 24, 2003 4-5
Using the FLUENT MHD Model
4-6
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
The user-defined scalars that do not need to be solved can be de-selected from the
Equations list in the Solution Controls panel, shown in Figure 4.3.5, accessed from the
Solve−→Controls−→Solution...
menu.
c Fluent Inc. January 24, 2003 4-7
Using the FLUENT MHD Model
4-8
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
c Fluent Inc. January 24, 2003 4-9
Using the FLUENT MHD Model
4-10
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
electric potential scalar should be set to Specified Flux, and User Defined Scalar Boundary
Value set to user function mhd phi bc. For conducting boundaries, set the User Defined
Scalar Boundary Condition to Specified Value and set User Defined Scalar Boundary Value
to the desired numerical value of the potential function without referencing a UDF.
c Fluent Inc. January 24, 2003 4-11
Using the FLUENT MHD Model
Figure 4.3.9: Setting Up the MHD Model in the Discrete Phase Model Panel
4-12
c Fluent Inc. January 24, 2003
4.3 MHD Modeling
c Fluent Inc. January 24, 2003 4-13
Using the FLUENT MHD Model
Figure 4.3.10: Setting Up the UDFs in the User-Defined Function Hooks Panel
4-14
c Fluent Inc. January 24, 2003
4.4 Solving and Post-processing
menu. In the Execute On Demand panel (Figure 4.4.1), select mhd initialise from the
function list and click Execute to run the function. If your problem involves MHD/DPM
interactions, you should also execute the function mhd init dpm to initialize the DPM-
related user memory locations.
To change external magnetic field parameters such as the scale factor during a MHD
calculation, you will need to update the imposed magnetic field. This can be performed
by running the execute-on-demand UDF named mhd update B0.
4.4.2 Iteration
It is often an effective strategy to begin your MHD calculations using a previously-
converged flow field solution. With this approach, the induction equations themselves
are generally easy to converge. The under-relaxation factors for these equations can be
set to 0.8 ∼ 0.9, although for very strong magnetic fields smaller values may be needed.
For the electric potential equation, the convergence is generally slow. However, the
under-relaxation value for this equation should not be set to 1. As additional source
terms are added to the momentum and energy equations, the under-relaxation factors
for these equations should generally be reduced to improve the rate of convergence. In
case of convergence difficulties, another helpful strategy is to use the B0 Scale Factor in
the MHD Model Setup panel (Figure 4.3.1) to gradually increase the MHD effect to its
actual magnitude through a series of restarts.
4.4.3 Post-processing
You can use the standard post-processing facilities of FLUENT to display the results of
a MHD calculation. Contours of MHD variables can be displayed using the
Display−→Contours...
menu. The MHD variables can be selected from the variable list. Vectors of MHD
variables, such as the magnetic field vector and current density vector, can be displayed
using the
Display−→Vectors...
menu as custom vectors. Custom vectors are defined through the Custom Vectors...
button in the Vectors panel. In the Custom Vectors panel, the components of the vector
c Fluent Inc. January 24, 2003 4-15
Using the FLUENT MHD Model
can be selected. The defined custom vector can be selected from the Vectors Of dropdown
list in the Vectors panel. The color scheme used to display the vector can be selected
from the Color By list. Figures 4.4.2 and 4.4.3 illustrate the settings for displaying the
induced magnetic field vector, colored by its magnitude.
For more information on the postprocessing variables available in the FLUENT MHD
model, Table 4.3.1 and 4.3.2 lists the names of the user-defined scalars and user-defined
memory locations and the variables they represent in the MHD model.
4-16
c Fluent Inc. January 24, 2003
4.4 Solving and Post-processing
c Fluent Inc. January 24, 2003 4-17
Using the FLUENT MHD Model
4.5 Limitations
Many MHD applications involve the simultaneous use of other advanced FLUENT ca-
pabilities such as solidification, free surface modeling with the volume of fluid (VOF)
approach, DPM, Eulerian multiphase, etc. You should consult the latest FLUENT doc-
umentation for the limitations that apply to those features. In addition, you should be
aware of the following limitations of the MHD capability.
• Currently the MHD equations can be solved only in Fluid zones. Solving in Solid
zones is not possible.
• You must specify the MHD wall boundary conditions as either perfectly conducting
or non-conducting, which implies that the conductivity of the wall material is either
infinite or zero. It is not possible to model walls with a finite non-zero conductivity.
• You must specify the applied magnetic field directly. The alternative specification
of an imposed electrical current is not supported.
• In the case of alternating-current (AC) magnetic fields, the capability has been
designed for relatively low frequencies; explicit temporal resolution of each cycle
is required. Although not a fundamental limitation, the computational expense of
simulating high-frequency effects may become excessive due to small required time
step size. Time-averaging methods to incorporate high-frequency MHD effects have
not been implemented.
4-18
c Fluent Inc. January 24, 2003
Appendix A. Guidelines For Using the
FLUENT MHD Model
2d 2ddp 3d 3ddp
2d_host 2ddp_host 3d_host 3ddp_host
2d_node 2ddp_node 3d_node 3ddp_node
c Fluent Inc. January 24, 2003 A-1
Guidelines For Using the FLUENT MHD Model
1. Start FLUENT.
To begin modeling your MHD simulation, you need to start an appropriate FLUENT
session. Choose from either the 2d, 3d, 2ddp, 3ddp, or the parallel version of
FLUENT.
A-2
c Fluent Inc. January 24, 2003
A.2 An Overview of Using the MHD Module
c Fluent Inc. January 24, 2003 A-3
Guidelines For Using the FLUENT MHD Model
A-4
c Fluent Inc. January 24, 2003
A.2 An Overview of Using the MHD Module
c Fluent Inc. January 24, 2003 A-5
Guidelines For Using the FLUENT MHD Model
! Make sure the proper function is displayed in the Function drop-down list before
clicking Execute.
15. Fine-tune the FLUENT solver parameters.
Not all the scalars you define in the User-Defined Scalars panel need to be solved
for in a MHD calculation. The selection of which user scalars to solve will depend
on the approach used in solving a MHD problem and the type of problem.
In the magnetic induction approach, the scalars representing the induced magnetic
field (~b) must be solved. Scalars representing the imposed magnetic field (B
~ 0 ) are
never solved for in FLUENT.
You can choose which user-defined scalars do not need to be solved using the
Solution Controls panel.
Solve−→Controls−→Solution...
The user-defined scalars that do not need to be solved can be de-selected from the
Equations list in the Solution Controls panel.
For the magnetic induction approach, use the following solution control settings:
• In the Solution Controls panel, deselect User defined scalar-3 to User defined
scalar-6 from the Equations listings.
• Under Under-Relaxation Factors, enter 0.9 for the remaining user defined scalars
(i.e., User defined scalar-0 to User defined scalar-2).
Choose other under-relaxation factors as usually done in FLUENT(e.g., Mo-
mentum:0.7, Pressure:0.3, Energy:1.0).
16. Run the FLUENT MHD simulation.
It is often an effective strategy to begin your MHD calculations using a previously-
converged flow field solution. With this approach, the induction equations them-
selves are generally easy to converge. For more information, see Chapter 4.
17. Process the solution data.
You can use the standard post-processing facilities of FLUENT to display the results
of a MHD calculation. Contours of MHD variables can be displayed using the
Display−→Contours...
menu. The MHD variables can be selected from the variable list. Vectors of MHD
variables, such as the magnetic field vector and current density vector, can be
displayed using the
Display−→Vectors...
menu as custom vectors. For more information, see Chapter 4.
For more information on the postprocessing variables available in the FLUENT
MHD model, Table 4.3.1 and 4.3.2 lists the names of the user-defined scalars and
user-defined memory locations and the variables they represent in the MHD model.
A-6
c Fluent Inc. January 24, 2003
Appendix B. Definitions of the Magnetic
Field
where B̄0 is the mean vector, A0 is the amplitude vector, K is defined as the propagation
vector, R is the position vector of an arbitrary point. cos α, cos β and cos γ are the
x , y and z direction cosines respectively. The quantities f , λ, and φ are the frequency,
wavelength, and phase offset, respectively. For a non-moving field the propagation vector
is zero. For a static field only applies.
The square form of the magnetic field is defined as:
cos(2 πft − K · R + φ)
B0 = B̄0 + A0 (B.1-2)
| cos(2 πft − K · R + φ)|
The definition of the propagation vector is the same as for the sinusoidal form.
c Fluent Inc. January 24, 2003 B-1
Definitions of the Magnetic Field
B-2
c Fluent Inc. January 24, 2003
Appendix C. External Magnetic Field Data
Format
l = i + nX ((j − 1 ) + nY (k − 1 ))
i = 1 , ..., nX ; j = 1 , ..., nY ; k = 1 , ..., nZ
The data is listed in the ascending order from 1 to n, where n is the total number of
data points given by n = nX nY nZ .
For magnetic fields comprised of both DC and AC fields, the entire file structure described
above is repeated for the DC and AC parts. These two sections within the same file will
be imported into FLUENT and stored separately. The order of the DC and AC sections
of the file is not important.
c Fluent Inc. January 24, 2003 C-1
External Magnetic Field Data Format
The imported data is interpreted as a snapshot of the applied magnetic field at an instant
in time. Complex form is used to accommodate oscillating/moving fields. Thus, using
complex numbers, and with reference to the quantities defined in Appendix B,
BX re
BX im
B~0 ≡ BY re + i BY im
BZ re
BZ im
= B̄0 + A0 exp[i (2 πft + φ)] (C.1-1)
For a DC field,
For an AC field,
q
Ao,i = Bre,i 2 + Bim,i 2 i = x , y, z (C.1-3)
and
Bim,i
−1
φi = tg i = x , y, z (C.1-4)
Bre,i
Note that when the external magnetic field import option is used, the frequency, f , read
from this file supercedes the value specified in the GUI.
C-2
c Fluent Inc. January 24, 2003
Bibliography
c Fluent Inc. January 24, 2003 Bib-1