Magnetohydrodynamics Simulator (MHDSim)
This package provides a Julia simulation of an inductionless magnetohydrodynamic (MHD) flow in the low-conductivity regime. It models the behavior of a fluid in a cylindrical geometry influenced by external electric and magnetic fields generated by electrodes and electromagnets.
Usage
For usage instructions, please refer to the examples/run_simulation.jl
file, which contains a simple example of how to set up and run the simulation.
Details
The simulation is based on the incompressible Navier–Stokes equations:
\[\frac{\partial \mathbf{u}}{\partial t} + (\mathbf{u} \cdot \nabla) \mathbf{u} = \nabla p + \nu \nabla^2 \mathbf{u} + \mathbf{f}, \quad \nabla \cdot \mathbf{u} = 0\]
where ( \mathbf{u} ) is the velocity field, ( p ) is the pressure, ( \nu ) is the kinematic viscosity, and ( \mathbf{f} ) represents the body force acting on the fluid — specifically, the Lorentz force:
\[\mathbf{f} = \sigma \mathbf{E} \times \mathbf{B}\]
with $\sigma$ the electrical conductivity, $\mathbf{E}$ the electric field, and $\mathbf{B}$ the magnetic field.
The electric field is assumed to be generated by a set of electrodes, and the magnetic field by a set of electromagnets. The fields are assumed to admit the decomposition:
\[\mathbf{E}(t, \mathbf{r}) = \sum_{i=1}^{n_{\mathrm{el}}} \phi_i(t) \mathbf{E}_i(\mathbf{r}), \quad \mathbf{B}(t, \mathbf{r}) = \sum_{j=1}^{n_{\mathrm{mag}}} \psi_j(t) \mathbf{B}_j(\mathbf{r})\]
where $\phi_i(t)$ and $\psi_j(t)$ are the time-dependent control signals for the electrodes and electromagnets, respectively, and $\mathbf{E}_i(\mathbf{r})$, $\mathbf{B}_j(\mathbf{r})$ are the spatial field distributions generated by each element. These field components must be provided by the user as part of the simulation setup.
The simulation is implemented using the Finite Element Method (FEM) with a Taylor–Hood (Q2/Q1) element pair for the velocity and pressure fields. Time integration is performed using a semi-implicit BDF2 scheme, with an Iterative Pressure Correction Scheme (IPCS) in rotational form used to split the velocity and pressure updates (see e.g. Guermond et al. 2006).
Citation
For more details, see the Master's thesis of Adam Uchytil: Feedback Control of Magnetohydrodynamic Flow Using Data-Driven Methods