MODgvec_BiotSavart Module


Subroutines

public subroutine BiotSavart(n_positions, xyz, n_points, coil_points, prefactor, B)

Evaluate the magnetic field of a current loop discretized via line-segments. The segments are defined by a list of coil_points, each segment being defined between points (i,i+1). For a closed loop, the last point in the list is a repetition of the first point. Each line segment is evaluated via the analytic compact Biot-Savart expression from Hanson and Hirshman (2002) (https://doi.org/10.1063/1.1507589). This implementation parallelizes over the number of evaluation positions n_positions.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n_positions

number of positions where the magnetic field is evaluated

real(kind=wp), intent(in) :: xyz(3,n_positions)

x,y,z positions where the magnetic field is evaluated

integer, intent(in) :: n_points

number of points representing the segmented coil

real(kind=wp), intent(in) :: coil_points(3,n_points)

x,y,z positions of the segment chain (=polygon), n_segments=n_points-1

real(kind=wp), intent(in) :: prefactor

factor applied to the final magnetic field

real(kind=wp), intent(out) :: B(3,n_positions)

magnetic field evaluated at xyz positions.

public subroutine BiotSavart_VectorPotential(n_positions, xyz, n_points, n_segments, coil_points, ehat, L, prefactor, A)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n_positions

number of positions where the magnetic field is evaluated

real(kind=wp), intent(in) :: xyz(3,n_positions)

x,y,z positions where the magnetic field is evaluated

integer, intent(in) :: n_points

number of points representing the segmented coil

integer, intent(in) :: n_segments

number of coil segments

real(kind=wp), intent(in) :: coil_points(3,n_points)

x,y,z positions of the segment chain (=polygon), n_segments=n_points-1

real(kind=wp), intent(in) :: ehat(3,n_segments)

unit vector along segment

real(kind=wp), intent(in) :: L(n_segments)

segment length

real(kind=wp), intent(in) :: prefactor

factor applied to the final magnetic field

real(kind=wp), intent(out) :: A(3,n_positions)

magnetic field evaluated at xyz positions.