33.2. Implementation

The MHD model is implemented using user-defined functions (UDF) as an Ansys Fluent add-on module, which is loaded into Ansys Fluent at run time. The model is accessed through a number of UDF schemes. The magnetic induction equation given by Equation 21–14 or Equation 21–16 and the electric potential equation given by Equation 21–22 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 as user-defined memory (UDM) variables. The MHD model setup and parameters are entered using the MHD Model graphical user interface (GUI) dialog box and a set of text user interface (TUI) commands described in Using the Ansys Fluent MHD Module. Detailed information can be found in the following sections:

33.2.1. Solving Magnetic Induction and Electric Potential Equations

The magnetic induction equation and the electric potential equations are solved through user-defined scalar transport equations. For the magnetic induction equation a set of 2 or 3 scalar equations are solved, each representing a Cartesian component of the induced magnetic field vector in a 2D or 3D case. For the electric potential equation a single scalar equation is solved.

The convection and the diffusion terms of the scalar equations are defined using user functions DEFINE_UDS_FLUX(mhd_flux, ..., ns) and DEFINE_DIFFUSIVITY (mhd_ magnetic_diffusivity, ..., ns) respectively. The user-defined scalar equation is identified by the scalar index ns.

The source terms to the induction equations and the potential equation are implemented using user function DEFINE_SOURCE(mhd_mag_source, ..., eqn) and DEFINE_SOURCE (mhd_phi_source, ..., eqn) respectively, where eqn identifies the scalar equations.

For transient cases, the additional unsteady source term is introduced through the user function DEFINE_UDS_UNSTEADY(mhd_unsteady_source, ..., ns), where ns identifies the scalar being solved.

The induction and potential equations can also be solved in solid zones, in which case the fluid velocity terms in the equations are not considered. For multiphase flows, the MHD equations are solved in the mixture domain only.

The wall boundary conditions are implemented through user profile functions (DEFINE_PROFILE(mhd_bc_...), and are applied to the Cartesian components of the induced magnetic field vector or to the electric potential. For external wall boundaries, three types of boundary conditions (electrically insulating, conducting, and "thin wall"), can be applied. The ’thin wall’ type boundary refers to an external wall where a 1D magnetic or electric potential diffusion normal to the boundary is assumed, and the wall material and the thickness are specified for the boundary. For internal wall boundaries, that is the boundaries between fluid/solid or solid/solid zones, a coupled boundary condition is applied.

33.2.2. Calculation of MHD Variables

Apart from the Cartesian components of the magnetic field vectors and the electric potential function, which are stored as user-defined scalars, other MHD-related variables include the induced electric current density vector, induced electric field vector, the Lorentz force vector and Joule heat. These variables are stored in user-defined memory locations. Updating of MHD variables is accessed through the user function DEFINE_ADJUST(mhd_adjust,...). The variables are updated at the start of each iteration using the solved induced magnetic field from the previous iteration.

33.2.3. MHD Interaction with Fluid Flows

Additional source terms due to the magnetic induction are added to the flow momentum and energy equations as user defined source terms. For the momentum equation, user function DEFINE_SOURCE(mhd_mom_source, ..., eqn) is used to introduce the Lorentz force to the equation, where eqn identifies the Cartesian component of the fluid momentum. For the energy equation, the additional source due to Joule heating is added through user function DEFINE_SOURCE(mhd_energy_source,..., eqn), where eqn is the energy equation index.

33.2.4. MHD Interaction with Discrete Phase Model

In discrete phase modeling, the Lorentz force acting on charged particles is introduced through the user function DEFINE_DPM_BODY_FORCE(mhd_dpm_force, ...). User function DEFINE_DPM_SOURCE(mhd_dpm_source, ...) is used to update the volume fraction of the discrete phase inside a fluid cell and the volume-weighted electric conductivity of the discrete phase.

33.2.5. General User-Defined Functions

Several general UDFs are used as part of the MHD model implementation.

  • DEFINE_INIT(mhd_init,...) is an initialization function called during the general 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.