PLUTO  4.4-patch2
Functions
get_current.c File Reference

Compute the curl of magnetic field. More...

#include "pluto.h"

Functions

void GetCurrent (const Data *d, Grid *grid)
 

Detailed Description

Compute the electric current (defined as J = curl(B)) at cell edges for both staggered MHD and cell-centered MHD. That is, the three components of J = (Jx, Jy, Jz) are always placed at different locations inside the cell, no matter what scheme is used to control the divergence condition:

The same rule apply to the components of resistivity eta which are computed and stored inside this function.

For a compact implementation, we note that the curl of a vector in the three system of coordinates normally adopted may be written as

\[ \begin{array}{lcl} \left(\nabla\times\vec{B}\right)_{x_1} &=& \DS \frac{1}{d_{23}}\pd{}{x_2}(a_{23}B_{x_3}) - \frac{1}{d_{32}}\pd{B_{x_2}}{x_3} \\ \noalign{\bigskip} \left(\nabla\times\vec{B}\right)_{x_2} &=& \DS \frac{1}{d_{31}}\pd{B_{x_1}}{x_3} - \frac{1}{d_{13}}\pd{}{x_1}(a_{13}B_{x_3}) \\ \noalign{\bigskip} \left(\nabla\times\vec{B}\right)_{x_3} &=& \DS \frac{1}{d_{12}}\pd{}{x_1}(a_{12}B_{x_2}) - \frac{1}{d_{21}}\pd{B_{x_1}}{x_2} \end{array} \]

where the coefficients $d_{nm}=1$ and $a_{nm}=1$ except:

\[ \begin{array}{lll} d_{nm} = 1; & \quad a_{nm} = 1; & \qquad ({\rm Cartesian}) \\ \noalign{\medskip} d_{13} = r\,,\qquad & d_{32} = d_{31} = \infty; \quad a_{13} = r; & \qquad ({\rm Cylindrical}) \\ \noalign{\medskip} d_{23} = d_{12} = d_{21} = r; & \quad a_{12} = r; & \qquad ({\rm Polar}) \\ \noalign{\medskip} d_{23} = d_{32} = d_{31} = r\sin\theta \,,\qquad d_{13} = d_{12} = d_{21} = r; & \quad a_{23} = \sin\theta\,,\qquad a_{13} = a_{12} = r; & \qquad ({\rm Spherical}) \end{array} \]

In the actual implementation we use $d_{nm} \to 1/(d_{nm}\Delta x_n)$.

Note
In cylindrical (or polar) geometry, there's a potential singular behavior with the definition of $ d_{13} (d_{12}) \quad\mathrm{at}\quad r=0$. An equivalent formulation can be obtained by using absolute values in the geometrical coefficient and thus replacing

\[ d_{13} = r_{i+\HALF}\Delta r \quad\to\quad \frac{r_{i+1}|r_{i+1}| - r_i |r_i|}{2}\,,\qquad a_{13} = r_i \quad\to\quad |r_i|. \]

This is obviously the desired derivative away from the axis (where r = |r|) and it gives the correct behavior at the axis, where Bphi –> -Bphi. Bphi = 0 –> Bphi alpha*r –> d(r Bphi)/(r dr) = 2*alpha
Attention
Do NOT use this function to compute terms like (curl V)^2 !!
Authors
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
Date
July 10, 2019

Function Documentation

◆ GetCurrent()

void GetCurrent ( const Data d,
Grid grid 
)

Compute the current (at cell edges) inside d->J.

Parameters
[in,out]dpointer to the PLUTO data structure
[in]gridpointer to an array of Grid structures