shellig_type Derived Type

type, public :: shellig_type


Inherited by

type~~shellig_type~~InheritedByGraph type~shellig_type shellig_type type~radbelt_type radbelt_type type~radbelt_type->type~shellig_type igrf

Components

Type Visibility Attributes Name Initial
character(len=:), private, allocatable :: igrf_dir

directory containing the data files

real(kind=wp), private, dimension(3) :: sp = 0.0_wp
real(kind=wp), private, dimension(3) :: xi = 0.0_wp
real(kind=wp), private, dimension(144) :: h = 0.0_wp

Field model coefficients adjusted for shellg

integer, private :: iyea = 0

the int year corresponding to the file name that has been read

character(len=:), private, allocatable :: name

file name

integer, private :: nmax = 0

maximum order of spherical harmonics

real(kind=wp), private :: Time = 0.0_wp

year (decimal: 1973.5) for which magnetic field is to be calculated

real(kind=wp), private, dimension(144) :: g = 0.0_wp

g(m) -- normalized field coefficients (see feldcof) m=nmax*(nmax+2)

integer, private :: nmax1 = 0

saved variables from the file

integer, private :: nmax2 = 0

saved variables from the file

real(kind=wp), private, dimension(144) :: g_cache = 0.0_wp

saved g from the file

real(kind=wp), private :: step = 0.20_wp

step size for field line tracing

real(kind=wp), private :: steq = 0.03_wp

step size for integration

real(kind=wp), private, dimension(120) :: gh2 = 0.0_wp
real(kind=wp), private, dimension(:, :), allocatable :: p

this was p(8,100) in the original code. used for the field line integration loop. changed it to be allocatable since it was changed to be p(8,3334).


Type-Bound Procedures

procedure, public :: igrfc

  • private subroutine igrfc(me, v, year, xl, bbx)

    Alternate version of igrf for cartesian coordinates.

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in), dimension(3) :: v

    cartesian coordinates in earth radii (6371.2 km) x-axis pointing to equator at 0 longitude y-axis pointing to equator at 90 long. z-axis pointing to north pole

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

    decimal year for which geomagnetic field is to be calculated (e.g.:1995.5 for day 185 of 1995)

    real(kind=wp), intent(out) :: xl

    l-value

    real(kind=wp), intent(out) :: bbx

    b_total / b_equatorial ratio

procedure, public :: igrf

  • private subroutine igrf(me, lon, lat, height, year, xl, bbx)

    Wrapper for IGRF functions.

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in) :: lon

    geodetic longitude in degrees (east)

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

    geodetic latitude in degrees (north)

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

    altitude in km above sea level

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

    decimal year for which geomagnetic field is to be calculated (e.g.:1995.5 for day 185 of 1995)

    real(kind=wp), intent(out) :: xl

    l-value

    real(kind=wp), intent(out) :: bbx

    b_total / b_equatorial ratio

procedure, public :: feldcof

  • private subroutine feldcof(me, year, dimo)

    Determines coefficients and dipol moment from IGRF models

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in) :: year

    decimal year for which geomagnetic field is to be calculated (e.g.:1995.5 for day 185 of 1995)

    real(kind=wp), intent(out) :: dimo

    geomagnetic dipol moment in gauss (normalized to earth's radius) at the time (year)

procedure, public :: feldc

  • private subroutine feldc(me, v, b)

    Alternate version of feldg to be used with cartesian coordinates

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in), dimension(3) :: v

    cartesian coordinates in earth radii (6371.2 km) x-axis pointing to equator at 0 longitude y-axis pointing to equator at 90 long. z-axis pointing to north pole

    real(kind=wp), intent(out) :: b(3)

    field components

procedure, public :: feldg

  • private subroutine feldg(me, glat, glon, alt, bnorth, beast, bdown, Babs)

    Calculates earth magnetic field from spherical harmonics model

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in) :: glat

    geodetic latitude in degrees (north)

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

    geodetic longitude in degrees (east)

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

    altitude in km above sea level

    real(kind=wp), intent(out) :: bnorth

    components of the field with respect to the local geodetic coordinate system, with axis pointing in the tangential plane to the north, east and downward.

    real(kind=wp), intent(out) :: beast

    components of the field with respect to the local geodetic coordinate system, with axis pointing in the tangential plane to the north, east and downward.

    real(kind=wp), intent(out) :: bdown

    components of the field with respect to the local geodetic coordinate system, with axis pointing in the tangential plane to the north, east and downward.

    real(kind=wp), intent(out) :: Babs

    magnetic field strength in gauss

procedure, public :: shellc

  • private subroutine shellc(me, v, dimo, fl, icode, b0)

    Wrapper to shellg to be used with cartesian coordinates.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in), dimension(3) :: v

    cartesian coordinates in earth radii (6371.2 km) * x-axis pointing to equator at 0 longitude * y-axis pointing to equator at 90 long. * z-axis pointing to north pole

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

    dipol moment in gauss (normalized to earth radius)

    real(kind=wp), intent(out) :: fl

    l-value

    integer, intent(out) :: icode Read more…
    real(kind=wp), intent(out) :: b0

    magnetic field strength in gauss

procedure, public :: shellg

  • private subroutine shellg(me, glat, glon, alt, dimo, fl, icode, b0, v)

    calculates l-value for specified geodaetic coordinates, altitude and gemagnetic field model.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in) :: glat

    geodetic latitude in degrees (north)

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

    geodetic longitude in degrees (east)

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

    altitude in km above sea level

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

    dipol moment in gauss (normalized to earth radius)

    real(kind=wp), intent(out) :: fl

    l-value

    integer, intent(out) :: icode Read more…
    real(kind=wp), intent(out) :: b0

    magnetic field strength in gauss

    real(kind=wp), intent(in), optional, dimension(3) :: v

    cartesian coordinates in earth radii (6371.2 km)

    Read more…

procedure, public :: findb0

  • private subroutine findb0(me, stps, bdel, value, bequ, rr0)

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    real(kind=wp), intent(in) :: stps
    real(kind=wp), intent(inout) :: bdel
    logical, intent(out) :: value
    real(kind=wp), intent(out) :: bequ
    real(kind=wp), intent(out) :: rr0

procedure, private :: feldi

  • private subroutine feldi(me)

    Used for l computation.

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me

procedure, private :: stoer

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

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

    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

procedure, public :: get_data_file_dir

  • private function get_data_file_dir(me) result(dir)

    Get the directory containing the data files.

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(in) :: me

    Return Value character(len=:), allocatable

procedure, public :: set_data_file_dir

  • private subroutine set_data_file_dir(me, dir)

    Set the directory containing the data files.

    Arguments

    Type IntentOptional Attributes Name
    class(shellig_type), intent(inout) :: me
    character(len=*), intent(in) :: dir

procedure, public :: destroy => destroy_shellig_type

Source Code

    type, public :: shellig_type
        private

        character(len=:), allocatable :: igrf_dir !! directory containing the data files

        ! formerly in the `fidb0` common block
        real(wp), dimension(3) :: sp = 0.0_wp

        ! formerly in blank common
        real(wp), dimension(3) :: xi = 0.0_wp
        real(wp), dimension(144) :: h = 0.0_wp !! Field model coefficients adjusted for [[shellg]]

        ! formerly in `model` common block
        integer :: iyea = 0 !! the int year corresponding to the file `name` that has been read
        character(len=:), allocatable :: name !! file name
        integer :: nmax = 0 !! maximum order of spherical harmonics
        real(wp) :: Time = 0.0_wp !! year (decimal: 1973.5) for which magnetic field is to be calculated
        real(wp), dimension(144) :: g = 0.0_wp !! `g(m)` -- normalized field coefficients (see [[feldcof]]) m=nmax*(nmax+2)
        integer :: nmax1 = 0 !! saved variables from the file
        integer :: nmax2 = 0 !! saved variables from the file
        real(wp), dimension(144) :: g_cache = 0.0_wp !! saved `g` from the file

        ! formerly saved vars in shellg:
        real(wp) :: step = 0.20_wp !! step size for field line tracing
        real(wp) :: steq = 0.03_wp !! step size for integration

        ! from feldcof, so we can cache the coefficients
        real(wp), dimension(120) :: gh2 = 0.0_wp ! JW : why is this 120 and g is 144 ???

        real(wp), dimension(:, :), allocatable :: p !! this was `p(8,100)` in the original code.
                                                  !! used for the field line integration loop.
                                                  !! changed it to be allocatable since it was
                                                  !! changed to be p(8,3334).

    contains
        private

        procedure, public :: igrf, igrfc

        procedure, public :: feldcof
        procedure, public :: feldg, feldc
        procedure, public :: shellg, shellc
        procedure, public :: findb0
        procedure :: stoer, feldi
        procedure, public :: set_data_file_dir, get_data_file_dir
        procedure, public :: destroy => destroy_shellig_type

    end type shellig_type