The field modules and programs¶
Module mag_dipole_line¶
Module : mag_field_line
Purpose : single field line
-
class
field_line_t
¶ A field line object
type
- Parameters
vr(:,:) – xyz position along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
s(:) – the length along the field line – real(WP), allocatable
vB(:,:) – magnetic field along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
n – number of grids along field line – integer
i_0 – zero-point index where forwards and backwards tracing along a field meet – integer
foot_N – boolean for the north magnetic foot point being on the star – integer
foot_S – boolean for the south magnetic foot point being on the star – integer
-
init_fl
(n) result (fl)¶ Construct a field line
space for type variables vr, s, vB is allocated; type variable n is set
type variables foot_N and foot_S are initialized to .FALSE.
function
- Parameters
n – number of points on the field line – integer, intent(in)
- Rtype fl
returned field line with vr, s, vB, and n initialized –
field_line_t
-
init_fl_trace_point
(pf, st, r_0, R_outer, ds, tol, max_steps) result (fl)¶ Construct a field line by tracing from an arbitrary specified point
calls trace_point
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)r_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
-
init_fl_trace_star
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps) result (fl)¶ Construct a field line by tracing from a specified point on the star
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – azimuthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
-
discrim_star
(vr) result (D)¶ Calculate the discriminant for r being outside the star
D = st_m%D_surf(vr)
function
- Parameters
vr(:) – position of discriminant calcualtion – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_source
(vr) result (D)¶ Calculate the discriminant for r being outside the source surface
D = NORM2(vr) - R_source_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_outer
(vr) result (D)¶ Calculate the discriminant for r being outside the outer boundary
D = NORM2(vr) - R_outer_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discriminant – real(WP)
-
read_fl
(hg, fl)¶ Read various attributes of a field line
reads n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
-
write_fl
(hg, fl)¶ Write various assets of a field line
writes n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
, intent(in)
-
bcast_fl
(fl, root_rank)¶ Broadcast a field line
vr, s, vB, n, i_0, foot_N, foot_S are broadcasted
only if MPI
subroutine
- Parameters
fl – field line to broadcast –
field_line_t
, intent(inout)root_rank – rank of root processor – integer, intent(in)
-
trace_point
(pf, st, r_0, R_outer, ds, tol, max_steps, fl)¶ Construct a field line by tracing from a specified point
does the calculation here; traces forwards and backwards, then puts the results together
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)r_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_star
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps, fl)¶ Construct a field line by tracing from a specified point on the star
does the calculation here; traces forwards only since starting from the star
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – aziumthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_1
(s, vr, bound, vr_0, del_s, tol, max_steps)¶ Trace from the specified point in one direction
called by both trace_point and trace_star
subroutine
- Rtype s(:)
position along ray in ray coordinate system – real(WP), allocatable, intent(out)
- Rtype vr(:,:)
3D position of loop; index 1 is dimension, index 2 is loop point – real(WP), allocatable, intent(out)
- Rtype bound
notes whether inside the star, outside the calculation domain, or in a region to continue computing the loop – integer, intent(out)
- Parameters
vr_0(:) – initial point – real(WP), intent(in)
del_s(:) – change in physical distance along the loop – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along loop – integer, intent(in), optional
-
trace_1_inside
()¶ Trace inside the source surface using ODEPACK
part of trace_1 subroutine
subroutine
-
trace_1_outside
()¶ Trace outside the source surface using radial extrapolation
part of trace_1 subroutine
subroutine
-
trace_1_dipole
()¶ Trace a dipole field
part of trace_1 subroutine
subroutine
-
odepack_rhs
(neq, s, vr, vdr_ds)¶ Calculate the rhs vector for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
- Rtype vdr_ds(neq)
v*dr/ds; computed from vB of potential field – real(WP), intent(out)
-
odepack_dummy
()¶ Dummy subroutine
subroutine
-
odepack_discrim
(neq, s, vr, ng, g_out)¶ Calculate the root discriminant for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
ng – number of constraint functions; hardwired to 2 – integer, intent(in)
- Rtype g_out(ng)
output of root information – real(WP), intent(out)
-
nudge
(vr, discrim, outside)¶ Nudge r in the radial direction, so it lies inside or outside the surface represented by the discriminant function discrim
subroutine
- Parameters
vr(:) – point from where the nudge occurs – real(WP), intent(inout)
discrim – evaluate the discriminant – function discrim (vr) result (D)
vr(:) – point for evaluating the discriminant; within funciton discrim – real(WP), intent(in)
D – discriminant; within function discrim – real(WP)
outside – outside the surface (true) or not (false) – logical, intent(in)
-
expand_1
(a, n)¶ Expand 1D array until it has a size of at least n
subroutine
- Parameters
a(:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the expanded array – integer, intent(in)
-
expand_2
(a, n)¶ Expand 2D array in its last dimension until it has a size of at least n
subroutine
- Parameters
a(:,:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the second dimension of the expanded array – integer, intent(in)
Module mag_field_line¶
Module : mag_field_line
Purpose : single field line
-
class
field_line_t
¶ A field line object
type
- Parameters
vr(:,:) – xyz position along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
s(:) – the length along the field line – real(WP), allocatable
vB(:,:) – magnetic field along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
n – number of grids along field line – integer
i_0 – zero-point index where forwards and backwards tracing along a field meet – integer
foot_N – boolean for the north magnetic foot point being on the star – integer
foot_S – boolean for the south magnetic foot point being on the star – integer
-
field_line_t_
(n) result (fl)¶ Construct a field line
space for type variables vr, s, vB is allocated; type variable n is set
type variables foot_N and foot_S are initialized to .FALSE.
function
- Parameters
n – number of points on the field line – integer, intent(in)
- Rtype fl
returned field line with vr, s, vB, and n initialized –
field_line_t
-
field_line_t_trace_point_
(pf, st, vr_0, R_outer, ds, tol, max_steps, move_s0_foot) result (fl)¶ Construct a field line by tracing from an arbitrary specified point
calls trace_point
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)vr_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
move_s0_foot – enforce s=0 at northern end – logical, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
-
field_line_t_trace_star_
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps) result (fl)¶ Construct a field line by tracing from a specified point on the star
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – azimuthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
-
discrim_star_
(vr) result (D)¶ Calculate the discriminant for r being outside the star
D = st_m%D_surf(vr)
function
- Parameters
vr(:) – position of discriminant calcualtion – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_source_
(vr) result (D)¶ Calculate the discriminant for r being outside the source surface
D = NORM2(vr) - R_source_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_outer_
(vr) result (D)¶ Calculate the discriminant for r being outside the outer boundary
D = NORM2(vr) - R_outer_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discriminant – real(WP)
-
read_
(hg, fl)¶ Read various attributes of a field line
reads n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
-
write_
(hg, fl)¶ Write various assets of a field line
writes n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
, intent(in)
-
bcast_
(fl, root_rank)¶ Broadcast a field line
vr, s, vB, n, i_0, foot_N, foot_S are broadcasted
only if MPI
subroutine
- Parameters
fl – field line to broadcast –
field_line_t
, intent(inout)root_rank – rank of root processor – integer, intent(in)
-
trace_point_
(pf, st, vr_0, R_outer, ds, tol, fl, max_steps, move_s0_foot)¶ Construct a field line by tracing from a specified point
does the calculation here; traces forwards and backwards, then puts the results together
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)vr_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
move_s0_foot – enforce s=0 at northern end – logical, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_star_
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps, fl)¶ Construct a field line by tracing from a specified point on the star
does the calculation here; traces forwards only since starting from the star
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – azimuthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_1_
(s, vr, bound, vr_0, del_s, tol, max_steps)¶ Trace from the specified point in one direction
called by both trace_point and trace_star
subroutine
- Rtype s(:)
position along ray in ray coordinate system – real(WP), allocatable, intent(out)
- Rtype vr(:,:)
3D position of loop; index 1 is dimension, index 2 is loop point – real(WP), allocatable, intent(out)
- Rtype bound
notes whether inside the star, outside the calculation domain, or in a region to continue computing the loop – integer, intent(out)
- Parameters
vr_0(:) – initial point – real(WP), intent(in)
del_s(:) – change in physical distance along the loop – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along loop – integer, optional, intent(in)
-
trace_1_inside_
()¶ Trace inside the source surface using ODEPACK
part of trace_1 subroutine
subroutine
-
trace_1_outside_
()¶ Trace outside the source surface using radial extrapolation
part of trace_1 subroutine
subroutine
-
trace_1_dipole_
()¶ Trace a dipole field
part of trace_1 subroutine
subroutine
-
odepack_rhs_
(neq, s, vr, vdr_ds)¶ Calculate the rhs vector for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
- Rtype vdr_ds(neq)
v*dr/ds; computed from vB of potential field – real(WP), intent(out)
-
odepack_dummy_
()¶ Dummy subroutine
subroutine
-
odepack_discrim_
(neq, s, vr, ng, g_out)¶ Calculate the root discriminant for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
ng – number of constraint functions; hardwired to 2 – integer, intent(in)
- Rtype g_out(ng)
output of root information – real(WP), intent(out)
-
nudge_
(vr, discrim, outside)¶ Nudge r in the radial direction, so it lies inside or outside the surface represented by the discriminant function discrim
subroutine
- Parameters
vr(:) – point from where the nudge occurs – real(WP), intent(inout)
discrim – evaluate the discriminant – function discrim (vr) result (D)
vr(:) – point for evaluating the discriminant; within funciton discrim – real(WP), intent(in)
D – discriminant; within function discrim – real(WP)
outside – outside the surface (true) or not (false) – logical, intent(in)
-
expand_1_
(a, n)¶ Expand 1D array until it has a size of at least n
subroutine
- Parameters
a(:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the expanded array – integer, intent(in)
-
expand_2_
(a, n)¶ Expand 2D array in its last dimension until it has a size of at least n
subroutine
- Parameters
a(:,:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the second dimension of the expanded array – integer, intent(in)
Module mag_field_line_bin¶
Module : mag_field_line_bin
Purpose : single field line
-
class
field_line_t
¶ A field line object
type
- Parameters
vr(:,:) – xyz position along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
s(:) – the length along the field line – real(WP), allocatable
vB(:,:) – magnetic field along the field line; index 1: x, y, or z dimension, so values are 1:3, index 2: s dimension, so values are 1:n – real(WP), allocatable
n – number of grids along field line – integer
i_0 – zero-point index where forwards and backwards tracing along a field meet – integer
foot_N – boolean for the north magnetic foot point being on the star – integer
foot_S – boolean for the south magnetic foot point being on the star – integer
-
field_line_t_
(n) result (fl)¶ Construct a field line
space for type variables vr, s, vB is allocated; type variable n is set
type variables foot_N and foot_S are initialized to .FALSE.
function
- Parameters
n – number of points on the field line – integer, intent(in)
- Rtype fl
returned field line with vr, s, vB, and n initialized –
field_line_t
-
field_line_t_trace_point_
(pf, st, vr_0, R_outer, ds, tol, max_steps, move_s0_foot) result (fl)¶ Construct a field line by tracing from an arbitrary specified point
calls trace_point
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)vr_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
move_s0_foot – enforce s=0 at northern end – logical, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
-
field_line_t_trace_star_
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps) result (fl)¶ Construct a field line by tracing from a specified point on the star
function
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – azimuthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, intent(in), optional
- Rtype fl
computed and returned field line –
field_line_t
-
discrim_star_
(vr) result (D)¶ Calculate the discriminant for r being outside the star
D = st_m%D_surf(vr)
function
- Parameters
vr(:) – position of discriminant calcualtion – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_source_
(vr) result (D)¶ Calculate the discriminant for r being outside the source surface
D = NORM2(vr) - R_source_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discrimant – real(WP)
-
discrim_outer_
(vr) result (D)¶ Calculate the discriminant for r being outside the outer boundary
D = NORM2(vr) - R_outer_m
function
- Parameters
vr(:) – position of discriminant calculation – real(WP), intent(in)
- Rtype D
calculated and returned discriminant – real(WP)
-
read_
(hg, fl)¶ Read various attributes of a field line
reads n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
-
write_
(hg, fl)¶ Write various assets of a field line
writes n, i_0, foot_N, foot_S, vr, s, vB
only if hdf5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fl – field line –
field_line_t
, intent(in)
-
bcast_
(fl, root_rank)¶ Broadcast a field line
vr, s, vB, n, i_0, foot_N, foot_S are broadcasted
only if MPI
subroutine
- Parameters
fl – field line to broadcast –
field_line_t
, intent(inout)root_rank – rank of root processor – integer, intent(in)
-
trace_point_
(pf, st, vr_0, R_outer, ds, tol, fl, max_steps, move_s0_foot)¶ Construct a field line by tracing from a specified point
does the calculation here; traces forwards and backwards, then puts the results together
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)vr_0(:) – the specified point – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
move_s0_foot – enforce s=0 at northern end – logical, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_star_
(pf, st, theta_0, phi_0, R_outer, ds, tol, max_steps, fl)¶ Construct a field line by tracing from a specified point on the star
does the calculation here; traces forwards only since starting from the star
computes vr, s, vB, n, i_0, foot_N, foot_S for field line class
subroutine
- Parameters
pf – potential field –
pot_field_t
, target, intent(in)st – star –
star_t
, target, intent(in)theta_0 – polar coordinate for field line tracing to start – real(WP), intent(in)
phi_0 – azimuthal coordinate for field line tracing to start – real(WP), intent(in)
R_outer – outer radius for field-line calculation – real(WP), intent(in)
ds – step size along the field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along the field line – integer, optional, intent(in)
- Rtype fl
computed and returned field line –
field_line_t
, intent(out)
-
trace_1_
(s, vr, bound, vr_0, del_s, tol, max_steps)¶ Trace from the specified point in one direction
called by both trace_point and trace_star
subroutine
- Rtype s(:)
position along ray in ray coordinate system – real(WP), allocatable, intent(out)
- Rtype vr(:,:)
3D position of loop; index 1 is dimension, index 2 is loop point – real(WP), allocatable, intent(out)
- Rtype bound
notes whether inside the star, outside the calculation domain, or in a region to continue computing the loop – integer, intent(out)
- Parameters
vr_0(:) – initial point – real(WP), intent(in)
del_s(:) – change in physical distance along the loop – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along loop – integer, optional, intent(in)
-
trace_1_inside_
()¶ Trace inside the source surface using ODEPACK
part of trace_1 subroutine
subroutine
-
trace_1_outside_
()¶ Trace outside the source surface using radial extrapolation
part of trace_1 subroutine
subroutine
-
trace_1_dipole_
()¶ Trace a dipole field
part of trace_1 subroutine
subroutine
-
odepack_rhs_
(neq, s, vr, vdr_ds)¶ Calculate the rhs vector for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
- Rtype vdr_ds(neq)
v*dr/ds; computed from vB of potential field – real(WP), intent(out)
-
odepack_dummy_
()¶ Dummy subroutine
subroutine
-
odepack_discrim_
(neq, s, vr, ng, g_out)¶ Calculate the root discriminant for ODEPACK
subroutine
- Parameters
neq – number of first-order ODEs; hardwired to 3 – integer, intent(in)
s – initial value of the independent variable – real(WP), intent(in)
vr(neq) – array of initial values – real(WP), intent(in)
ng – number of constraint functions; hardwired to 2 – integer, intent(in)
- Rtype g_out(ng)
output of root information – real(WP), intent(out)
-
nudge_
(vr, discrim, outside)¶ Nudge r in the radial direction, so it lies inside or outside the surface represented by the discriminant function discrim
subroutine
- Parameters
vr(:) – point from where the nudge occurs – real(WP), intent(inout)
discrim – evaluate the discriminant – function discrim (vr) result (D)
vr(:) – point for evaluating the discriminant; within funciton discrim – real(WP), intent(in)
D – discriminant; within function discrim – real(WP)
outside – outside the surface (true) or not (false) – logical, intent(in)
-
expand_1_
(a, n)¶ Expand 1D array until it has a size of at least n
subroutine
- Parameters
a(:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the expanded array – integer, intent(in)
-
expand_2_
(a, n)¶ Expand 2D array in its last dimension until it has a size of at least n
subroutine
- Parameters
a(:,:) – the array to expand – real(WP), allocatable, intent(inout)
n – the minimum size of the second dimension of the expanded array – integer, intent(in)
Module mag_field_vol¶
Module : mag_field_vol
Purpose : magnetosphere field data
-
class
field_vol_t
¶ A field volume object
type with contains that adds procedures
type, extends (volume_t)
- Parameters
pf – potential field –
pot_field_t
st – star –
star_t
field_mask(:,:,:) – mask for field nodes; true if field line goes through the particular – logical, allocatable
star_mask(:,:,:) – mask for star nodes; true if particular node is in the star – logical allocatable
build – loops over building, processing, and broadcasting nodes – procedure
build_node – build a single node – procedure
process_node – process a single node – procedure
bcast-nodes – broadcast nodes if MPI – procedure
-
field_vol_t_
(vl, pf, st) result (fv)¶ Construct the field_vol_t
sets volume, potential field, and star; allocates space for field_mask and star_mask
function
- Parameters
vl – volume —
volume_t
, intent(in)pf – potential field —
pot_field_t
, intent(in)st – star —
star_t
, intent(in)
- Rtype fv
field volume —
field_vol_t
-
read_
(hg, fv)¶ Read the field_vol_t
read variables are volume, potential field, star, field_mask, and star_mask
only if HDF5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)- Rtype fv
field volume –
field_vol_t
, intent(out)
-
write_
(hg, fv)¶ Write the field_vol_t
written variables are volume, potential field, star, field_mask, and star_mask
only if HDF5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fv – field volume –
field_vol_t
, intent(in)
-
build
(this, R_outer, ds, tol, max_steps)¶ Process, build, and broadcast the nodes
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)R_outer – outer radius – real(WP), intent(in)
ds – step size along field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along field line – integer, optional, intent(in)
-
build_node
(this, vi, R_outer, ds, tol, max_steps)¶ Build the node
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi(:) – node index – integer, intent(in)
R_outer – outer radius – real(WP), intent(in)
ds – step size along field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along field line – integer, optional, intent(in)
-
process_node
(this, vi, fl)¶ Process the node
checks that node index vi has size of 3
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi(:) – node index – integer, intent(in)
fl – field volume –
field_line_t
, intent(in)
-
bcast_
(fv, root_rank)¶ Broadcast the field_vol_t
only if MPI
subroutine
- Parameters
fv – field volume – :class:`field_vol_t), intent(inout)
root_rank – rank of root processor – integer, intent(in)
-
bcast_nodes
(this, vi_a, vi_b, root_rank)¶ Broadcast the nodes with indices between vi_a and vi_b
only if MPI
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi_a(:) – lower limit of node indices – integer, intent(in)
vi_b(:) – upper limit of node indices – integer, intent(in)
root_rank – rank of root processor – integer, intent(in)
Module mag_field_vol_bin¶
Module : mag_field_vol_bin
Purpose : magnetosphere field data
-
class
field_vol_t
¶ A field volume object
type with contains that adds procedures
type, extends (volume_t)
- Parameters
pf – potential field –
pot_field_t
st – star –
star_t
field_mask(:,:,:) – mask for field nodes; true if field line goes through the particular – logical, allocatable
star_mask(:,:,:) – mask for star nodes; true if particular node is in the star – logical allocatable
build – loops over building, processing, and broadcasting nodes – procedure
build_node – build a single node – procedure
process_node – process a single node – procedure
bcast-nodes – broadcast nodes if MPI – procedure
-
field_vol_t_
(vl, pf, st) result (fv)¶ Construct the field_vol_t
sets volume, potential field, and star; allocates space for field_mask and star_mask
function
- Parameters
vl – volume —
volume_t
, intent(in)pf – potential field —
pot_field_t
, intent(in)st – star —
star_t
, intent(in)
- Rtype fv
field volume —
field_vol_t
-
read_
(hg, fv)¶ Read the field_vol_t
read variables are volume, potential field, star, field_mask, and star_mask
only if HDF5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)- Rtype fv
field volume –
field_vol_t
, intent(out)
-
write_
(hg, fv)¶ Write the field_vol_t
written variables are volume, potential field, star, field_mask, and star_mask
only if HDF5
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)fv – field volume –
field_vol_t
, intent(in)
-
build
(this, R_outer, ds, tol, max_steps)¶ Process, build, and broadcast the nodes
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)R_outer – outer radius – real(WP), intent(in)
ds – step size along field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along field line – integer, optional, intent(in)
-
build_node
(this, vi, R_outer, ds, tol, max_steps)¶ Build the node
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi(:) – node index – integer, intent(in)
R_outer – outer radius – real(WP), intent(in)
ds – step size along field line – real(WP), intent(in)
tol – tolerance – real(WP), intent(in)
max_steps – maximum steps along field line – integer, optional, intent(in)
-
process_node
(this, vi, fl)¶ Process the node
checks that node index vi has size of 3
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi(:) – node index – integer, intent(in)
fl – field volume –
field_line_t
, intent(in)
-
bcast_
(fv, root_rank)¶ Broadcast the field_vol_t
only if MPI
subroutine
- Parameters
fv – field volume –
field_vol_t
, intent(inout)root_rank – rank of root processor – integer, intent(in)
-
bcast_nodes
(this, vi_a, vi_b, root_rank)¶ Broadcast the nodes with indices between vi_a and vi_b
only if MPI
subroutine
- Parameters
this – field volume –
field_vol_t
, intent(inout)vi_a(:) – lower limit of node indices – integer, intent(in)
vi_b(:) – upper limit of node indices – integer, intent(in)
root_rank – rank of root processor – integer, intent(in)
Module mag_harmonic¶
Module : mag_harmonic
Purpose : spherical harmonics
-
factorial
(a) result (af)¶ Calculate the factorial a!
function
- Parameters
a – input variable – integer, intent(in)
- Rtype af
factorial of input variable – real(WP)
-
Y_lm_tableaux
(theta, phi, Y_lm, grad_Y_lm_theta, grad_Y_lm_phi)¶ Create a tableaux of spherical harmonics Y_lm(theta, phi) for m >= 0
subroutine
- Parameters
theta – polar coordinate – real(WP), intent(in)
phi – azimuthal coordinate – real(WP), intent(in)
- Rtype Y_lm(0:,0:)
spherical harmonic table – complex(WP), intent(out)
- Rtype grad_Y_lm_theta(0:,0:)
gradients in the theta direction – complex(WP), intent(out), optional
- Rtype grad_Y_lm_phi(0:,0:)
gradients in the phi direction – complex(WP), intent(out), optional
Module mag_pot_field¶
Module : mag_pot_field
Purpose : force-free potential fields
-
class
pot_field_t
¶
-
pot_field_t_
(l_max) result (pf)¶ Construct the pot_field_t
allocates G_lm, a_lm, and b_lm in pf class
function
- Parameters
l_max – truncate G_lm to level l_max; array size is {0:l_max,-l_max:l_max} – integer, intent(in)
- Rtype pf
potential field –
pot_field_t
-
pot_field_t_coeffs_
(G_lm, va) result (pf)¶ Construct the pot_field from the expansion coefficients
function
- Parameters
G_lm(:,:) – spherical harmonic coefficients to set – complex(WP), intent(in)
va(:) – center of magnetic-centered frame – real(WP), intent(in)
- Rtype pf
potential field –
pot_field_t
-
is_dipole_
(this) result (is_dipole)¶ Determine whether the potential represents a pure dipole
function
- Parameters
this – potential field –
pot_field_t
, intent(in)is_dipole – is the field a dipole or not – logical
-
vB_
(this, vr, outside_source) result (vB)¶ Evaluate the magnetic field at vr
Calculate the spherical-polar coordinates in the magnetic-centered frame
function
- Parameters
this – potential field –
pot_field_t
, intent(in)vr(:) – location of magnetice-field evaluation – real(WP), intent(in)
outside_source – outside the source or not – logical, intent(in), optional
- Rtype vB(3)
magnetic field – real(WP)
-
read_
(hg, pf)¶ Read the pot_field_t
read variables are l_max, R_source, va, G_lm
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)- Rtype pf
potential field –
pot_field_t
, intent(out)
-
write_
(hg, pf)¶ Write the pot_field_t
written variables are l_max, R_source, va, G_lm
subroutine
- Parameters
hg – hdf5 data set –
hgroup_t
, intent(inout)pf – potential field –
pot_field_t
, intent(in)
-
get_R_source_
(this, R_source)¶ Get the source-surface radius
subroutine
- Parameters
this – potential field –
pot_field_t
, intent(in)- Rtype R_source
source radius – real(WP), intent(out)
-
set_R_source_
(this, R_source)¶ Set the source-surface radius to R_source
subroutine
- Parameters
this – potential field –
pot_field_t
, intent(inout)R_source – source radius – real(WP), intent(in)
-
dipole_params_
(this, B_pole, beta, gamma, va)¶ Calculate the parameters of the dipole component of the field
subroutine
- Parameters
this – potential field –
pot_field_t
, intent(in)- Rtype B_pole
magnetic field at the pole – real(WP), optional, intent(out)
- Rtype beta
angle between rotation axis and magnetic axis; rotation axis is z axis – real(WP), optional, intent(out)
- Rtype gamma
azimuthal angle of magnetic axis; measured from x-axis to y-axis – real(WP), optional, intent(out)
- Rtype va(:)
magnetic center of star – real(WP), optional, intent(out)
-
bcast_
(pf, root_rank)¶ Broadcast the pot_field_t
only if MPI
subroutine
- Parameters
pf – potential field to broadcast –
pot_field_t
, intent(inout)root_rank – rank of root processor – integer, intent(in)
Module build_field_line¶
Module build_field_lines¶
Program : build_field_lines
Purpose : build field_lines
-
random
()¶ Calculates a random number from [0,1) via the built-in fortran function RANDOM_NUMBER
- Rtype real(WP) random
computed and returned random number
Module build_field_map¶
Program : build_field_map
Purpose : build & analyze a surface map of the field
Module build_pot_field¶
Program : build_pot_field
Purpose : build force-free potential fields
-
pf_oblique_dipole
(beta, gamma, va, B_d_pole) result (pf)¶
-
pf_oblique_diquad
(beta, gamma, va, B_d_pole, B_q_pole) result (pf)¶
-
pf_invers10
(map_file, l_max, flip_lat, flip_lon) result (pf)¶
-
pf_donati
(map_file, l_max, flip_lat, flip_lon) result (pf)¶
-
pf_invers10_read
(map_file, n_lat, n_lon, lat, lon, B_r)¶
-
pf_donati_read
(map_file, n_lat, n_lon, lat, lon, B_r)¶
-
pf_lat_lon_expand
(pf, l_max, n_lat, n_lon, lat, lon, B_r)¶
Module calc_b_z¶
Program : calc_b_z
Purpose : calculate longitudinal field strength
-
init_pot_field
(unit, pf)¶
-
init_star
(unit, st, inc, u_limb, grav_dark)¶
-
init_geom
(unit, x, y, phase)¶
-
init_output
(unit, map_prefix, int_filename)¶
Module dipole_params¶
Program : dipole_params
Purpose : extract dipole parameters from a potential field