MPI-AMRVAC  3.1
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Functions/Subroutines | Variables
mod_magnetofriction Module Reference

module mod_magnetofriction.t Purpose: use magnetofrictional method to relax 3D magnetic field to force-free field 01.04.2016 developed by Chun Xia and Yang Guo 04.10.2017 modulized by Chun Xia Usage: in amrvac.par: &methodlist time_stepper='onestep' ! time marching scheme, or 'twostep','threestep' flux_method=13*'cd4' ! or 'tvdlf', 'fd' limiter= 13*'koren' ! or 'vanleer','cada3','mp5' so on / &meshlist ditregrid=20 ! set iteration interval for adjusting AMR / &mhd_list mhd_magnetofriction=.true. / &mf_list mf_it_max=60000 ! set the maximum iteration number mf_ditsave=20000 ! set iteration interval for data output mf_cc=0.3 ! stability coefficient controls numerical stability mf_cy=0.2 ! frictional velocity coefficient mf_cdivb=0.01 ! divb cleaning coefficient controls diffusion speed of divb / More...

Functions/Subroutines

subroutine mf_params_read (files)
 Read this module"s parameters from a file. More...
 
subroutine magnetofriction_init ()
 Initialize the module. More...
 
subroutine magnetofriction
 
subroutine mf_velocity_update (dtfff)
 
subroutine vhat (w, x, ixIL, ixOL, vhatmaxgrid)
 
subroutine frictional_velocity (w, x, ixIL, ixOL, qvmax, qdt)
 
subroutine advectmf (idimLIM, qt, qdt)
 
subroutine advect1mf (method, dtin, dtfactor, idimLIM, qtC, psa, qt, psb)
 
subroutine process1_gridmf (method, igrid, qdt, ixGL, idimLIM, qtC, wCT, qt, w)
 
subroutine upwindlrmf (ixIL, ixLL, ixRL, idim, w, wCT, wLC, wRC, x)
 
subroutine getfluxmf (w, x, ixIL, ixOL, idir, idim, f)
 
subroutine tvdlfmf (qdt, ixIL, ixOL, idimLIM, qtC, wCT, qt, wnew, fC, dxD, x)
 
subroutine hancockmf (qdt, ixIL, ixOL, idimLIM, qtC, wCT, qt, wnew, dxD, x)
 
subroutine fdmf (qdt, ixIL, ixOL, idimLIM, qtC, wCT, qt, wnew, fC, dxD, x)
 
subroutine reconstructlmf (ixIL, iLL, idims, w, wLC)
 
subroutine reconstructrmf (ixIL, iLL, idims, w, wRC)
 
subroutine centdiff4mf (qdt, ixIL, ixOL, idimLIM, qtC, wCT, qt, w, fC, dxD, x)
 
subroutine getdtfff_courant (w, x, ixIL, ixOL, dtnew)
 
subroutine getcmaxfff (w, ixIL, ixOL, idims, cmax)
 
subroutine divbclean (qdt, ixIL, ixOL, wCT, w, x)
 Clean divergence of magnetic field by Janhunen's and Linde's source terms. More...
 
subroutine addgeometrymf (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine get_current (w, ixIL, ixOL, idirmin, current)
 Calculate idirmin and the idirmin:3 components of the common current array make sure that dxlevel(^D) is set correctly. More...
 
subroutine get_divb (w, ixIL, ixOL, divb)
 Calculate div B within ixO. More...
 

Variables

double precision mf_cc
 stability coefficient controls numerical stability More...
 
double precision mf_cy
 frictional velocity coefficient More...
 
double precision mf_cy_max
 
double precision mf_cdivb
 divb cleaning coefficient controls diffusion speed of divb More...
 
double precision mf_cdivb_max
 
double precision mf_tvdlfeps
 TVDLF dissipation coefficient controls the dissipation term. More...
 
double precision mf_tvdlfeps_min
 
double precision tmf
 time in magnetofriction process More...
 
double precision cmax_mype
 maximal speed for fd scheme More...
 
double precision cmax_global
 maximal speed for fd scheme More...
 
double precision, public mf_vmax = 3.d6
 maximal limit of magnetofrictional velocity in cm s^-1 (Pomoell 2019 A&A) More...
 
integer mf_ditsave
 
integer mf_it_max
 
integer mf_it
 
logical mf_advance
 
logical fix_conserve_at_step = .true.
 

Detailed Description

module mod_magnetofriction.t Purpose: use magnetofrictional method to relax 3D magnetic field to force-free field 01.04.2016 developed by Chun Xia and Yang Guo 04.10.2017 modulized by Chun Xia Usage: in amrvac.par: &methodlist time_stepper='onestep' ! time marching scheme, or 'twostep','threestep' flux_method=13*'cd4' ! or 'tvdlf', 'fd' limiter= 13*'koren' ! or 'vanleer','cada3','mp5' so on / &meshlist ditregrid=20 ! set iteration interval for adjusting AMR / &mhd_list mhd_magnetofriction=.true. / &mf_list mf_it_max=60000 ! set the maximum iteration number mf_ditsave=20000 ! set iteration interval for data output mf_cc=0.3 ! stability coefficient controls numerical stability mf_cy=0.2 ! frictional velocity coefficient mf_cdivb=0.01 ! divb cleaning coefficient controls diffusion speed of divb /

Function/Subroutine Documentation

◆ addgeometrymf()

subroutine mod_magnetofriction::addgeometrymf ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(inout)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1335 of file mod_magnetofriction.t.

◆ advect1mf()

subroutine mod_magnetofriction::advect1mf ( integer, dimension(nlevelshi), intent(in)  method,
double precision, intent(in)  dtin,
double precision, intent(in)  dtfactor,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
type(state), dimension(max_blocks)  psa,
double precision, intent(in)  qt,
type(state), dimension(max_blocks)  psb 
)

Definition at line 681 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ advectmf()

subroutine mod_magnetofriction::advectmf ( integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qt,
double precision, intent(in)  qdt 
)

Definition at line 624 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ centdiff4mf()

subroutine mod_magnetofriction::centdiff4mf ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
double precision, dimension(ixi^s,1:nw)  wCT,
double precision, intent(in)  qt,
double precision, dimension(ixi^s,1:nw)  w,
double precision, dimension(ixi^s,1:ndir,1:ndim)  fC,
double precision, intent(in)  dx,
integer, intent(in)  D,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1158 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ divbclean()

subroutine mod_magnetofriction::divbclean ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Clean divergence of magnetic field by Janhunen's and Linde's source terms.

Definition at line 1296 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ fdmf()

subroutine mod_magnetofriction::fdmf ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
double precision, dimension(ixi^s,1:nw), intent(inout)  wCT,
double precision, intent(in)  qt,
double precision, dimension(ixi^s,1:nw), intent(inout)  wnew,
double precision, dimension(ixi^s,1:ndir,1:ndim), intent(out)  fC,
double precision, intent(in)  dx,
double precision, intent(in)  D,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1020 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ frictional_velocity()

subroutine mod_magnetofriction::frictional_velocity ( double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, intent(in)  qvmax,
double precision, intent(in)  qdt 
)

Definition at line 554 of file mod_magnetofriction.t.

◆ get_current()

subroutine mod_magnetofriction::get_current ( double precision, dimension(ixi^s,1:nw)  w,
integer  ixI,
integer  L,
integer  ixO,
  L,
integer  idirmin,
double precision, dimension(ixi^s,7-2*ndir:3)  current 
)

Calculate idirmin and the idirmin:3 components of the common current array make sure that dxlevel(^D) is set correctly.

Definition at line 1397 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ get_divb()

subroutine mod_magnetofriction::get_divb ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s)  divb 
)

Calculate div B within ixO.

Definition at line 1421 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ getcmaxfff()

subroutine mod_magnetofriction::getcmaxfff ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idims,
double precision, dimension(ixi^s), intent(out)  cmax 
)

Definition at line 1277 of file mod_magnetofriction.t.

◆ getdtfff_courant()

subroutine mod_magnetofriction::getdtfff_courant ( double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, intent(inout)  dtnew 
)

Definition at line 1245 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ getfluxmf()

subroutine mod_magnetofriction::getfluxmf ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idir,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(out)  f 
)

Definition at line 837 of file mod_magnetofriction.t.

◆ hancockmf()

subroutine mod_magnetofriction::hancockmf ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
double precision, dimension(ixi^s,1:nw), intent(inout)  wCT,
double precision, intent(in)  qt,
double precision, dimension(ixi^s,1:nw), intent(inout)  wnew,
double precision, intent(in)  dx,
double precision, intent(in)  D,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 959 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ magnetofriction()

subroutine mod_magnetofriction::magnetofriction

Definition at line 113 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ magnetofriction_init()

subroutine mod_magnetofriction::magnetofriction_init

Initialize the module.

Definition at line 80 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ mf_params_read()

subroutine mod_magnetofriction::mf_params_read ( character(len=*), dimension(:), intent(in)  files)

Read this module"s parameters from a file.

Definition at line 63 of file mod_magnetofriction.t.

◆ mf_velocity_update()

subroutine mod_magnetofriction::mf_velocity_update ( double precision, intent(in)  dtfff)

Definition at line 476 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ process1_gridmf()

subroutine mod_magnetofriction::process1_gridmf ( integer, intent(in)  method,
integer, intent(in)  igrid,
double precision, intent(in)  qdt,
integer, intent(in)  ixG,
integer, intent(in)  L,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
double precision, dimension(ixg^s,1:nw)  wCT,
double precision, intent(in)  qt,
double precision, dimension(ixg^s,1:nw)  w 
)

Definition at line 742 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ reconstructlmf()

subroutine mod_magnetofriction::reconstructlmf ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  iL,
  L,
integer, intent(in)  idims,
double precision, dimension(ixi^s,1:nw), intent(in)  w,
double precision, dimension(ixi^s,1:nw), intent(out)  wLC 
)

Definition at line 1077 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ reconstructrmf()

subroutine mod_magnetofriction::reconstructrmf ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  iL,
  L,
integer, intent(in)  idims,
double precision, dimension(ixi^s,1:nw), intent(in)  w,
double precision, dimension(ixi^s,1:nw), intent(out)  wRC 
)

Definition at line 1118 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ tvdlfmf()

subroutine mod_magnetofriction::tvdlfmf ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
integer, intent(in)  LIM,
double precision, intent(in)  qtC,
double precision, dimension(ixi^s,1:nw)  wCT,
double precision, intent(in)  qt,
double precision, dimension(ixi^s,1:nw)  wnew,
double precision, dimension(ixi^s,1:ndir,1:ndim)  fC,
double precision, intent(in)  dx,
double precision, intent(in)  D,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 861 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ upwindlrmf()

subroutine mod_magnetofriction::upwindlrmf ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixL,
  L,
integer, intent(in)  ixR,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s,1:nw)  w,
double precision, dimension(ixi^s,1:nw)  wCT,
double precision, dimension(ixi^s,1:nw)  wLC,
double precision, dimension(ixi^s,1:nw)  wRC,
double precision, dimension(ixi^s,1:ndim)  x 
)

Definition at line 789 of file mod_magnetofriction.t.

Here is the call graph for this function:

◆ vhat()

subroutine mod_magnetofriction::vhat ( double precision, dimension(ixi^s,nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, intent(out)  vhatmaxgrid 
)

Definition at line 501 of file mod_magnetofriction.t.

Here is the call graph for this function:

Variable Documentation

◆ cmax_global

double precision mod_magnetofriction::cmax_global

maximal speed for fd scheme

Definition at line 42 of file mod_magnetofriction.t.

◆ cmax_mype

double precision mod_magnetofriction::cmax_mype

maximal speed for fd scheme

Definition at line 40 of file mod_magnetofriction.t.

◆ fix_conserve_at_step

logical mod_magnetofriction::fix_conserve_at_step = .true.

Definition at line 59 of file mod_magnetofriction.t.

◆ mf_advance

logical mod_magnetofriction::mf_advance

Definition at line 58 of file mod_magnetofriction.t.

◆ mf_cc

double precision mod_magnetofriction::mf_cc

stability coefficient controls numerical stability

Definition at line 30 of file mod_magnetofriction.t.

◆ mf_cdivb

double precision mod_magnetofriction::mf_cdivb

divb cleaning coefficient controls diffusion speed of divb

Definition at line 34 of file mod_magnetofriction.t.

◆ mf_cdivb_max

double precision mod_magnetofriction::mf_cdivb_max

Definition at line 34 of file mod_magnetofriction.t.

◆ mf_cy

double precision mod_magnetofriction::mf_cy

frictional velocity coefficient

Definition at line 32 of file mod_magnetofriction.t.

◆ mf_cy_max

double precision mod_magnetofriction::mf_cy_max

Definition at line 32 of file mod_magnetofriction.t.

◆ mf_ditsave

integer mod_magnetofriction::mf_ditsave

Definition at line 55 of file mod_magnetofriction.t.

◆ mf_it

integer mod_magnetofriction::mf_it

Definition at line 57 of file mod_magnetofriction.t.

◆ mf_it_max

integer mod_magnetofriction::mf_it_max

Definition at line 56 of file mod_magnetofriction.t.

◆ mf_tvdlfeps

double precision mod_magnetofriction::mf_tvdlfeps

TVDLF dissipation coefficient controls the dissipation term.

Definition at line 36 of file mod_magnetofriction.t.

◆ mf_tvdlfeps_min

double precision mod_magnetofriction::mf_tvdlfeps_min

Definition at line 36 of file mod_magnetofriction.t.

◆ mf_vmax

double precision, public mod_magnetofriction::mf_vmax = 3.d6

maximal limit of magnetofrictional velocity in cm s^-1 (Pomoell 2019 A&A)

Definition at line 44 of file mod_magnetofriction.t.

◆ tmf

double precision mod_magnetofriction::tmf

time in magnetofriction process

Definition at line 38 of file mod_magnetofriction.t.