Source file twofluid.M
The source file twofluid.M contains the time stepper for all quantities
in the two-fluid code. The file is preprocessed by the m4-macro processor,
which allows to write numerical expressions, e.g. finite differences and
lengthy vector operations, in a compact form. To view the Fortran-90 program
pipe the source file through m4
Subroutines:
-
Subroutine steptwofluid:
The subroutine steptwofluid advances all quantities from t
to
t+dt
according
to the two-fluid equations. As time stepping
algorithm a trapezoidal leapfrog scheme is used. One iteration consist
of the following steps (only the first half of a leapfrog time step is
shown):
-
the quantity on the right hand side of the evolution equation for B'
is calculated (compare the twofluid equations):
E' = (j x B' - ji x B
-
grad pe)/n = [(curl B) x (1-de2
div
grad) B - ji x B - grad pe)]/n
-
B' is calculated from B: B'
= (1-de2 div grad) B
-
B' is advanced from t to t+dt using dB'/dt
= E'
-
B at t+dt is calculated by inverting the Helmholtz
equation (1-de2 div grad) B =
B',
call to subroutine helmholtz (source file multigrid.M)
-
the ion current density is advanced from t to t+dt according
to dji/dt = -div (ji ji /n)
+ j x B - grad (pe+pi)
-
step density, electron and ion pressure
-
apply fourth order viscosities to B and j,
density, electron and ion pressure
-
Subroutine divergence:
The subroutine divergence is called to fix the divergence of
the magnetic field (i.e. div
B = 0) at start up and uses
the same algorithm as described in the full-particle version of the subroutine
divergence
in the source file maxwell.M.
Switches:
-
isothermal: If the switch #define isothermal is used electron
and ion pressure are determined from the density and the constant temperatures
T_e
and T_i.
-
n_base: Since in the two-fluid equations the density appears at
several location in theisothermal: If the switche #define isothermal is
used the electron pressure is determined from the density and the constant
electron temperature T_e. denominator numerical problems arise if the density
becomes too small. To relax these problems an artificial homogeneous background
density can be added. The parameter n_base sets the small artificial
background density, for example #define n_base 0.1