MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
Functions/Subroutines | Variables
mod_lfff Module Reference

Program to extrapolate linear force-free fields in 3D Cartesian coordinates, based on exact Green function method (Chiu & Hilton 1977 ApJ 212,873). More...

Functions/Subroutines

subroutine init_b_fff_data (magnetogramname, qlunit, qbunit)
 
subroutine init_b_fff_data_driven_boundary (boundaryname, qlunit, qbunit, qxc1, qxc2)
 
subroutine lfff_balance_bottom_flux (bz, treatment, max_imbalance, imbalance_before, imbalance_after, mean_correction, status)
 Check a constant-alpha magnetogram and optionally remove its core mean. Status: 0 accepted unchanged, 1 mean removed, 2 invalid treatment, 3 invalid threshold, 4 strict-mode imbalance, 5 above auto-balance limit.
 
subroutine extrapolate_potential_fft (iw_b, padding_factor, source_plane_depth, alpha, top_boundary, flux_treatment, max_flux_imbalance)
 Extrapolate a Cartesian potential field with horizontal Fourier modes. The bottom magnetogram must match the level-one physical cell centers. Results are streamed one AMRVAC block layer at a time and written directly to the distributed cell-centered magnetic variables.
 
subroutine lfff_fft_transfer (k2, alpha, z, top_height, top_closed, transfer_b, transfer_d, status)
 Vertical transfer functions for one nonzero horizontal constant-alpha Fourier mode. transfer_b multiplies Bz0, while transfer_d=-d(transfer_b)/dz enters the horizontal field. status is zero on success, one for an oscillatory mode in an open half-space, two for a closed-box resonance, and three for invalid geometry.
 
subroutine calc_lin_fff (ixil, ixol, bf, x, alpha, zshift, idir)
 
subroutine get_potential_field_potential (ixil, ixol, potential, x, zshift)
 
subroutine get_potential_field_potential_sphere (ixil, x, potential, nth, nph, magnetogram, theta, phi, r_sphere)
 
subroutine potential_field_energy_mg (benergy)
 get potential magnetic field energy given normal B on all boundaries
 
subroutine get_potential_field_potential_mg ()
 Solve Poisson equation of scalar potential using multigrid solver.
 
subroutine multigrid_bc (box, nc, iv, nb, bc_type, bc)
 To set boundary condition on physical boundaries for mg Poisson solver.
 
subroutine init_lfff_2d (bn_bottom, nx, qalpha, qy0, qtop_closed, qy_top, flux_treatment, nmodes_keep)
 
subroutine calc_lfff_2d (ixil, ixol, x, bf)
 B from the stored modes at arbitrary points; Bf(:,:,1:3)=(Bx,By,Bz=alpha*A)
 

Variables

double precision, save bzmax
 
double precision, save darea
 
double precision, dimension(:,:), allocatable, save bz0
 
double precision, dimension(:), allocatable, save xa1
 
double precision, dimension(:), allocatable, save xa2
 
integer, save nx1
 
integer, save nx2
 
double precision, parameter lfff_mode_tolerance =1.d-12
 
double precision, parameter lfff_resonance_tolerance =1.d-10
 
double precision, parameter lfff_flux_balance_tolerance =1.d-8
 
double precision, dimension(:), allocatable, save l2d_br
 
double precision, dimension(:), allocatable, save l2d_bi
 
double precision, dimension(:), allocatable, save l2d_k
 
double precision, save l2d_b0
 
double precision, save l2d_alpha
 
double precision, save l2d_y0
 
double precision, save l2d_ytop
 
integer, save l2d_nm
 
logical, save l2d_closed
 
logical, save l2d_ready =.false.
 

Detailed Description

Program to extrapolate linear force-free fields in 3D Cartesian coordinates, based on exact Green function method (Chiu & Hilton 1977 ApJ 212,873).

Usage: 1 In the subroutine usr_set_parameters of mod_usr.t: To extrapolate a linear force free field from a observed magnetogram prepared in a data file, e.g., 'hmiM720sxxxx.dat' replace call init_bc_fff_data('hmiM720sxxxx.dat',unit_length,unit_magneticfield) 'hmiM720sxxxx.dat' must be a binary file containing nx1,nx2,xc1,xc2,dxm1, dxm2, Bz0(nx1,nx2). Integers nx1 and nx2 give the resolution of the uniform-grid magentogram. Others are double-precision floats. xc1 and xc2 are coordinates of the central point of the magnetogram. dxm1 and dxm2 are the cell sizes for each direction, Bz0 is the vertical conponent of magetic field on the solar surface from observations. 2 In the subroutine usr_init_one_grid of mod_usr.t, add lines like:

double precision :: Bf(ixG^S,1:ndir), alpha, zshift

alpha=0.d0 ! potential field !alpha=0.08d0 ! non-potential linear force-free field zshift=0.05d0 ! lift your box zshift heigher to the bottom magnetogram call calc_lin_fff(ixG^L,ix^L,Bf,x,alpha,zshift)

3 Notice that the resolution of input magnetogram must be better than the best resolution of your AMR grid to have a good behavior close to the bottom layer

Function/Subroutine Documentation

◆ calc_lfff_2d()

subroutine mod_lfff::calc_lfff_2d ( integer, intent(in)  ixi,
integer, intent(in)  l,
integer, intent(in)  ixo,
  l,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
double precision, dimension(ixi^s,1:3), intent(out)  bf 
)

B from the stored modes at arbitrary points; Bf(:,:,1:3)=(Bx,By,Bz=alpha*A)

Definition at line 1005 of file mod_lfff.t.

Here is the call graph for this function:

◆ calc_lin_fff()

subroutine mod_lfff::calc_lin_fff ( integer, intent(in)  ixi,
integer, intent(in)  l,
integer, intent(in)  ixo,
  l,
double precision, dimension(ixi^s,1:ndir), intent(inout)  bf,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
double precision, intent(in)  alpha,
double precision, intent(in)  zshift,
integer, intent(in), optional  idir 
)

Definition at line 726 of file mod_lfff.t.

◆ extrapolate_potential_fft()

subroutine mod_lfff::extrapolate_potential_fft ( integer, dimension(3), intent(in)  iw_b,
integer, intent(in), optional  padding_factor,
double precision, intent(in), optional  source_plane_depth,
double precision, intent(in), optional  alpha,
character(len=*), intent(in), optional  top_boundary,
character(len=*), intent(in), optional  flux_treatment,
double precision, intent(in), optional  max_flux_imbalance 
)

Extrapolate a Cartesian potential field with horizontal Fourier modes. The bottom magnetogram must match the level-one physical cell centers. Results are streamed one AMRVAC block layer at a time and written directly to the distributed cell-centered magnetic variables.

Definition at line 228 of file mod_lfff.t.

Here is the call graph for this function:

◆ get_potential_field_potential()

subroutine mod_lfff::get_potential_field_potential ( integer, intent(in)  ixi,
integer, intent(in)  l,
integer, intent(in)  ixo,
  l,
double precision, dimension(ixi^s), intent(inout)  potential,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
double precision, intent(in)  zshift 
)

Definition at line 831 of file mod_lfff.t.

◆ get_potential_field_potential_mg()

subroutine mod_lfff::get_potential_field_potential_mg

Solve Poisson equation of scalar potential using multigrid solver.

Definition at line 930 of file mod_lfff.t.

Here is the call graph for this function:

◆ get_potential_field_potential_sphere()

subroutine mod_lfff::get_potential_field_potential_sphere ( integer, intent(in)  ixi,
integer, intent(in)  l,
real*8, dimension(ixi^s,1:ndim), intent(in)  x,
real*8, dimension(ixi^s), intent(out)  potential,
integer, intent(in)  nth,
integer, intent(in)  nph,
real*8, dimension(nth,nph), intent(in)  magnetogram,
real*8, dimension(nth), intent(in)  theta,
real*8, dimension(nph), intent(in)  phi,
real*8, intent(in)  r_sphere 
)

Definition at line 866 of file mod_lfff.t.

◆ init_b_fff_data()

subroutine mod_lfff::init_b_fff_data ( character(len=*), intent(in)  magnetogramname,
double precision, intent(in)  qlunit,
double precision, intent(in)  qbunit 
)

Definition at line 46 of file mod_lfff.t.

Here is the call graph for this function:

◆ init_b_fff_data_driven_boundary()

subroutine mod_lfff::init_b_fff_data_driven_boundary ( character(len=*), intent(in)  boundaryname,
double precision, intent(in)  qlunit,
double precision, intent(in)  qbunit,
double precision, intent(in), optional  qxc1,
double precision, intent(in), optional  qxc2 
)

Definition at line 110 of file mod_lfff.t.

Here is the call graph for this function:

◆ init_lfff_2d()

subroutine mod_lfff::init_lfff_2d ( double precision, dimension(nx), intent(in)  bn_bottom,
integer, intent(in)  nx,
double precision, intent(in)  qalpha,
double precision, intent(in)  qy0,
logical, intent(in)  qtop_closed,
double precision, intent(in)  qy_top,
character(len=*), intent(in), optional  flux_treatment,
integer, intent(in), optional  nmodes_keep 
)

Definition at line 961 of file mod_lfff.t.

Here is the call graph for this function:

◆ lfff_balance_bottom_flux()

subroutine mod_lfff::lfff_balance_bottom_flux ( double precision, dimension(:,:), intent(inout)  bz,
character(len=*), intent(in)  treatment,
double precision, intent(in)  max_imbalance,
double precision, intent(out)  imbalance_before,
double precision, intent(out)  imbalance_after,
double precision, intent(out)  mean_correction,
integer, intent(out)  status 
)

Check a constant-alpha magnetogram and optionally remove its core mean. Status: 0 accepted unchanged, 1 mean removed, 2 invalid treatment, 3 invalid threshold, 4 strict-mode imbalance, 5 above auto-balance limit.

Definition at line 181 of file mod_lfff.t.

◆ lfff_fft_transfer()

subroutine mod_lfff::lfff_fft_transfer ( double precision, intent(in)  k2,
double precision, intent(in)  alpha,
double precision, intent(in)  z,
double precision, intent(in)  top_height,
logical, intent(in)  top_closed,
double precision, intent(out)  transfer_b,
double precision, intent(out)  transfer_d,
integer, intent(out)  status 
)

Vertical transfer functions for one nonzero horizontal constant-alpha Fourier mode. transfer_b multiplies Bz0, while transfer_d=-d(transfer_b)/dz enters the horizontal field. status is zero on success, one for an oscillatory mode in an open half-space, two for a closed-box resonance, and three for invalid geometry.

Definition at line 669 of file mod_lfff.t.

◆ multigrid_bc()

subroutine mod_lfff::multigrid_bc ( type(mg_box_t), intent(in)  box,
integer, intent(in)  nc,
integer, intent(in)  iv,
integer, intent(in)  nb,
integer, intent(out)  bc_type,
double precision, dimension(nc, nc), intent(out)  bc 
)

To set boundary condition on physical boundaries for mg Poisson solver.

Parameters
[in]ivIndex of variable
[in]nbnumber of boundary from 1 to 6 for 3D
[out]bc_typeType of b.c.

Definition at line 945 of file mod_lfff.t.

Here is the call graph for this function:

◆ potential_field_energy_mg()

subroutine mod_lfff::potential_field_energy_mg ( real*8, intent(out)  benergy)

get potential magnetic field energy given normal B on all boundaries

Definition at line 913 of file mod_lfff.t.

Here is the call graph for this function:

Variable Documentation

◆ bz0

double precision, dimension(:,:), allocatable, save mod_lfff::bz0

Definition at line 31 of file mod_lfff.t.

◆ bzmax

double precision, save mod_lfff::bzmax

Definition at line 30 of file mod_lfff.t.

◆ darea

double precision, save mod_lfff::darea

Definition at line 30 of file mod_lfff.t.

◆ l2d_alpha

double precision, save mod_lfff::l2d_alpha

Definition at line 39 of file mod_lfff.t.

◆ l2d_b0

double precision, save mod_lfff::l2d_b0

Definition at line 39 of file mod_lfff.t.

◆ l2d_bi

double precision, dimension(:), allocatable, save mod_lfff::l2d_bi

Definition at line 38 of file mod_lfff.t.

◆ l2d_br

double precision, dimension(:), allocatable, save mod_lfff::l2d_br

Definition at line 38 of file mod_lfff.t.

◆ l2d_closed

logical, save mod_lfff::l2d_closed

Definition at line 41 of file mod_lfff.t.

◆ l2d_k

double precision, dimension(:), allocatable, save mod_lfff::l2d_k

Definition at line 38 of file mod_lfff.t.

◆ l2d_nm

integer, save mod_lfff::l2d_nm

Definition at line 40 of file mod_lfff.t.

◆ l2d_ready

logical, save mod_lfff::l2d_ready =.false.

Definition at line 41 of file mod_lfff.t.

◆ l2d_y0

double precision, save mod_lfff::l2d_y0

Definition at line 39 of file mod_lfff.t.

◆ l2d_ytop

double precision, save mod_lfff::l2d_ytop

Definition at line 39 of file mod_lfff.t.

◆ lfff_flux_balance_tolerance

double precision, parameter mod_lfff::lfff_flux_balance_tolerance =1.d-8

Definition at line 36 of file mod_lfff.t.

◆ lfff_mode_tolerance

double precision, parameter mod_lfff::lfff_mode_tolerance =1.d-12

Definition at line 34 of file mod_lfff.t.

◆ lfff_resonance_tolerance

double precision, parameter mod_lfff::lfff_resonance_tolerance =1.d-10

Definition at line 35 of file mod_lfff.t.

◆ nx1

integer, save mod_lfff::nx1

Definition at line 33 of file mod_lfff.t.

◆ nx2

integer, save mod_lfff::nx2

Definition at line 33 of file mod_lfff.t.

◆ xa1

double precision, dimension(:), allocatable, save mod_lfff::xa1

Definition at line 32 of file mod_lfff.t.

◆ xa2

double precision, dimension(:), allocatable, save mod_lfff::xa2

Definition at line 32 of file mod_lfff.t.