calc_dphi Function

public pure function calc_dphi(phi_base, phi_target, phi_direction, dphi_max, n_turns) result(dphi)

Calculates the difference in toroidal angle dphi between phi_base and phi_target, in the direction phi_direction. The maximum dphi is set by dphi_max, and extra turns can be added with n_turns.

Arguments

Type IntentOptional Attributes Name
real(kind=FP), intent(in) :: phi_base

Initial toroidal angle

real(kind=FP), intent(in) :: phi_target

Final toroidal angle

integer, intent(in) :: phi_direction

The sign of this argument determines whether the difference in phi should be taken from base to target in the positive or negative phi direction

real(kind=FP), intent(in), optional :: dphi_max

Maximum difference in toroidal angle, default 2pi. This option can also be thought of as setting where the periodic boundary is in phi.

integer, intent(in), optional :: n_turns

Add additional full turns +/- dphi_max to dphi, default zero. Note that the sign is determined by phi_direction, and only the absolute value of n_turns is used.

Return Value real(kind=fp)