# Non-dimensionalizing the Ideal MHD System

Non-dimensionalization is a really frustrating topic for me, and I imagine many others, because in school it was glossed over while being really important to implementing a simulation.

I'm writing a CUDA C/C++ project on a single GPU in order to solve the Ideal MHD equations, but have run into a barrier where I need to non-dimensionalize the system, but I'm not sure how to do this.

For expressions like $$\frac{B^{2}}{2\mu_{0}}$$, it's clear that $$\tilde{B} = \frac{B}{\sqrt{\mu_{0}}}$$ works, but for more complicated expressions like the energy $$e = \frac{p}{\gamma - 1} + \frac{\rho v^{2}}{2} + \frac{B^{2}}{2\mu_{0}}$$, I am lost. What do I do? What is the procedure?

For reference, here is the full Ideal MHD system, in conservative form, with a numerical diffusion, that I am solving:

$$\frac{\partial\vec{Q}}{\partial t} + \vec{\nabla}\cdot\overleftrightarrow{T} = D\nabla^{2}\vec{Q}$$

The Ideal MHD variables, $$\vec{Q}$$, are:

$$\vec{Q} = \pmatrix{\rho \\ \rho u \\ \rho v \\ \rho w \\ B_{x} \\ B_{y} \\ B_{z} \\ e}$$

where $$e$$ was previously expressed. The fluxes, $$\overleftrightarrow{T} = [\vec{F} \quad \vec{G} \quad \vec{H}]^{T}$$, are broken down into the following components,

$$\vec{F} = \pmatrix{ \rho u \\ \rho u^{2} - \frac{B_{x}^{2}}{\mu_{0}} + p + \frac{B^{2}}{2\mu_{0}} \\ \rho v u - \frac{B_{y}B_{x}}{\mu_{0}} \\ \rho w u - \frac{B_{z}B_{x}}{\mu_{0}} \\ 0 \\ vB_{x} - B_{y}u \\ wB_{x} - B_{z}u \\ e + p + \frac{B^{2}}{2\mu_{0}}u - \frac{\vec{B}\cdot\vec{v}}{\mu_{0}}B_{x}}$$

$$\vec{G} = \pmatrix{ \rho v \\ \rho u v - \frac{B_{x}B_{y}}{\mu_{0}} \\ \rho v^{2} - \frac{B_{y}^{2}}{\mu_{0}} + p + \frac{B^{2}}{2\mu_{0}} \\ \rho w v - \frac{B_{z}B_{y}}{\mu_{0}} \\ u B_{y} - B_{x}v \\ 0 \\ wB_{y} - B_{z}v \\ e + p + \frac{B^{2}}{2\mu_{0}}v - \frac{\vec{B}\cdot\vec{v}}{\mu_{0}}B_{y}}$$

$$\vec{H} = \pmatrix{ \rho w \\ \rho u w - \frac{B_{x}B_{z}}{\mu_{0}} \\ \rho v w - \frac{B_{y}B_{z}}{\mu_{0}} \\ \rho w^{2} - \frac{B_{z}^{2}}{\mu_{0}} + p + \frac{B^{2}}{2\mu_{0}} \\ uB_{z} - B_{x}w \\ vB_{z} - B_{y}w \\ 0 \\ e + p + \frac{B^{2}}{2\mu_{0}}w - \frac{\vec{B}\cdot\vec{v}}{\mu_{0}}B_{z}}$$

From Jardin (2010), the general form is,

$$\frac{\partial \rho}{\partial t} + \vec{\nabla}\cdot{\rho\vec{u}} = 0 \\ \frac{\partial \vec{B}}{\partial t} = \vec{\nabla}\times(\vec{u}\times\vec{B}) \\ \rho(\frac{\partial \vec{u}}{\partial t} + \vec{u}\cdot\vec{\nabla}\vec{u}) + \vec{\nabla}p = \vec{J}\times\vec{B} \\ \frac{\partial p}{\partial t} + \vec{u}\cdot\vec{\nabla}p + \gamma p\vec{\nabla}\cdot\vec{u} = 0$$

• Could you write out the MHD equations in your post so more people will be able to answer? Commented Feb 13 at 0:49
• Sorry, I understand, I will do so tomorrow. Thanks for the response. Commented Feb 13 at 1:45
• Some degree of moving between dimensional and nondimensional forms is necessary for fluid simulations because so many of the relevent phenomena are governed by nondimensional parameters, but this is sometimes undone internally. It would help to know what exactly the issue is that supposedly necessitates nondimensionalization. Commented Feb 13 at 16:09
• The problem appears when building linear systems with blocks expressed in different physical units. That can be addressed by automatic scaling of variables before/after linear solves, but it does not require non-dimensionalization. Let me refer to this paper of mine here where we describe the design of a simulator for problems in Earth dynamics, which uses SI units: math.colostate.edu/~bangerth/publications/2008-boussinesq.pdf See section 3.2.4 Commented Feb 14 at 17:23
• @Ashamandarei "Multiplying a large number amplifies roundoff error," -- No, that's just plain wrong. The relative error is entirely unaffected by the size of numbers, and we only ever care about relative error. "and small numbers, for example the charge of an electron, are indistinguishable from machine precision." That's also not true. The charge of an electron is approximately $10^{-19}$ Coulomb, which is not a problem at all in double precision where you can store numbers down to $10^{-308}$. It's not a problem because you're only ever going to add numbers of the same magnitude. Commented Feb 15 at 4:45

$$\begin{gather} e_0 = m_0 n_0 V_0^2\\ P_0 = e_0\\ B_0 = \sqrt{\mu_0 e_0} \end{gather}$$ where $$m_0$$ is your reference particle mass (typically a proton).
This has some nice properties such as your Alfven velocity becomes $$\begin{gather} \frac{V_A}{V_0} = \sqrt{\frac{\tilde{B}^2}{\tilde{\rho}}} \end{gather}$$ Similarly, you can analyze how magnetic field energy compares vs. other types of energy.