stoer Subroutine

private subroutine stoer(me, p, bq, r)

subroutine used for field line tracing in shellg. calls entry point feldi in geomagnetic field subroutine feldg

Type Bound

shellig_type

Arguments

Type IntentOptional Attributes Name
class(shellig_type), intent(inout) :: me
real(kind=wp), intent(inout), dimension(7) :: p
real(kind=wp), intent(out) :: bq
real(kind=wp), intent(out) :: r

Calls

proc~~stoer~~CallsGraph proc~stoer shellig_module::shellig_type%stoer proc~feldi shellig_module::shellig_type%feldi proc~stoer->proc~feldi

Called by

proc~~stoer~~CalledByGraph proc~stoer shellig_module::shellig_type%stoer proc~findb0 shellig_module::shellig_type%findb0 proc~findb0->proc~stoer proc~shellg shellig_module::shellig_type%shellg proc~shellg->proc~stoer proc~igrf shellig_module::shellig_type%igrf proc~igrf->proc~findb0 proc~igrf->proc~shellg proc~igrfc shellig_module::shellig_type%igrfc proc~igrfc->proc~findb0 proc~shellc shellig_module::shellig_type%shellc proc~igrfc->proc~shellc proc~shellc->proc~shellg proc~get_flux_c_ radbelt_module::radbelt_type%get_flux_c_ proc~get_flux_c_->proc~igrfc proc~get_flux_g_ radbelt_module::radbelt_type%get_flux_g_ proc~get_flux_g_->proc~igrf none~get_flux radbelt_module::radbelt_type%get_flux none~get_flux->proc~get_flux_c_ none~get_flux->proc~get_flux_g_ proc~get_flux_c radbelt_module::get_flux_c proc~get_flux_c->none~get_flux proc~get_flux_g radbelt_module::get_flux_g proc~get_flux_g->none~get_flux proc~get_flux_g_c radbelt_c_module::get_flux_g_c proc~get_flux_g_c->none~get_flux interface~get_flux radbelt_module::get_flux interface~get_flux->proc~get_flux_c interface~get_flux->proc~get_flux_g

Source Code

    subroutine stoer(me, p, bq, r)

        class(shellig_type), intent(inout) :: me
        real(wp), dimension(7), intent(inout) :: p
        real(wp), intent(out) :: bq
        real(wp), intent(out) :: r

        real(wp) :: dr, dsq, dx, dxm, dy, dym, dz, &
                    dzm, fli, q, rq, wr, xm, ym, zm

        ! xm,ym,zm are geomagnetic cartesian inverse co-ordinates
        zm = P(3)
        fli = P(1) * P(1) + P(2) * P(2) + 1.0e-15_wp
        R = 0.5_wp * (fli + sqrt(fli * fli + (zm + zm)**2))
        rq = R * R
        wr = sqrt(R)
        xm = P(1) * wr
        ym = P(2) * wr
        ! transform to geographic co-ordinate system
        me%Xi(1) = xm * u(1, 1) + ym * u(1, 2) + zm * u(1, 3)
        me%Xi(2) = xm * u(2, 1) + ym * u(2, 2) + zm * u(2, 3)
        me%Xi(3) = xm * u(3, 1) + zm * u(3, 3)
        ! compute derivatives
        ! Changed from CALL FELDI(XI,H); XI, H are in COMMON block; results
        ! are the same; dkb Feb 1998.
        ! JW : feb 2024 : xi, h now class variables.
        call me%feldi()
        q = me%H(1) / rq
        dx = me%H(3) + me%H(3) + q * me%Xi(1)
        dy = me%H(4) + me%H(4) + q * me%Xi(2)
        dz = me%H(2) + me%H(2) + q * me%Xi(3)
        ! transform back to geomagnetic co-ordinate system
        dxm = u(1, 1) * dx + u(2, 1) * dy + u(3, 1) * dz
        dym = u(1, 2) * dx + u(2, 2) * dy
        dzm = u(1, 3) * dx + u(2, 3) * dy + u(3, 3) * dz
        dr = (xm * dxm + ym * dym + zm * dzm) / R
        ! form slowly varying expressions
        P(4) = (wr * dxm - 0.5_wp * P(1) * dr) / (R * dzm)
        P(5) = (wr * dym - 0.5_wp * P(2) * dr) / (R * dzm)
        dsq = rq * (dxm * dxm + dym * dym + dzm * dzm)
        Bq = dsq * rq * rq
        P(6) = sqrt(dsq / (rq + 3.0_wp * zm * zm))
        P(7) = P(6) * (rq + zm * zm) / (rq * dzm)

    end subroutine stoer