cryosphere Derived Type

type, public :: cryosphere

A data structure representing glaciers, either as ice shelves or (eventually) ice sheets. It will allow coupled systems of glaciers as well as different basal couplings with the ocean or ground. This type is a subclass of the FOODIE integrand, allowing it to take advantage of that set of integration libraries for evolution in time.


Inherits

type~~cryosphere~~InheritsGraph type~cryosphere cryosphere type~glacier glacier type~cryosphere->type~glacier ice type~basal_surface basal_surface type~cryosphere->type~basal_surface sub_ice

Contents

Source Code


Components

TypeVisibility AttributesNameInitial
class(glacier), private, allocatable:: ice

A model for the ice shelf or ice sheet

class(basal_surface), private, allocatable:: sub_ice

A model for the ground or ocean underneath the ice

real(kind=r8), private :: time

The time in the simulation

logical, private :: first_integration

Indicates whether the cryosphere has been integrated before or not.

real(kind=r8), private :: dt_factor =1.0_r8

A factor by which to reduce the time step

real(kind=r8), private :: min_dt_factor =1e-3_r8

The smallest time step reduction to allow

logical, private :: performing_time_step

True if in the process of trying to get a time-step to successfully integrate.


Type-Bound Procedures

procedure, public :: initialise

  • private subroutine initialise(this, ice, sub_ice)

    Author
    Christopher MacMackin
    Date
    November 2016

    Initialise a cryosphere object from the provided components. This object will model the evolution of a glacier/ice shelf/ice sheet and its surroundings.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(out) :: this
    class(glacier), intent(inout), allocatable:: ice

    An object modelling the ice sheet or shelf component of this system. Will be deallocated on return.

    class(basal_surface), intent(inout), allocatable:: sub_ice

    An object modelling the component of this system beneath the ice. Will be deallocated on return.

procedure, public :: time_step

  • private function time_step(this)

    Author
    Chris MacMackin
    Date
    December 2016

    Calculates an appropriate time step with which to integrate the cryosphere so as not to cause numerical instability.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this

    Return Value real(kind=r8)

procedure, public :: reduce_time_step

  • private subroutine reduce_time_step(this)

    Author
    Christopher MacMackin
    Date
    April 2017

    Reuces the time step by a factor of 2, unless doing so would take it below the minimum value.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this

procedure, public :: increase_time_step

  • private subroutine increase_time_step(this)

    Author
    Christopher MacMackin
    Date
    April 2017

    Increases the time step by a factor of 2, unless doing so would take it above the maximum.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this

procedure, public :: state_vector

  • private function state_vector(this)

    Author
    Chris MacMackin
    Date
    April 2017

    Returns the state vector for the current state of the cryosphere. This takes the form of a 1D array. This routine is mainly useful for unit-testing.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(in) :: this

    Return Value real(kind=r8), dimension(:), allocatable

procedure, public :: integrate

  • private subroutine integrate(this, time)

    Author
    Christopher MacMackin
    Date
    April 2016

    Integrates the cryosphere forward until the specified time is reached.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this
    real(kind=r8), intent(in) :: time

    The time to which to integrate the cryosphere

procedure, public :: read_data

  • private subroutine read_data(this, infile, set_time)

    Author
    Christopher MacMackin
    Date
    April 2017

    Reads the data describing the cryosphere from an HDF5 file on the disc. h5open_f must have been called once prior to using this method. After the method has been used, h5close_f must be called once before the end of the program.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this
    character(len=*), intent(in) :: infile

    The file from which to read the data describing the state of the cryosphere

    logical, intent(in), optional :: set_time

    If present and .true. then set the simulation time of the cryosphere to be the same as that in the HDF file. Otherwise, leave it unchanged.

procedure, public :: read_ice

  • private subroutine read_ice(this, infile, set_time)

    Author
    Christopher MacMackin
    Date
    December 2017

    Reads the data describing the ice component of the cryosphere from an HDF5 file on the disc. Data on anything below the ice is ignored. h5open_f must have been called once prior to using this method. After the method has been used, h5close_f must be called once before the end of the program.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this
    character(len=*), intent(in) :: infile

    The file from which to read the data describing the state of the cryosphere

    logical, intent(in), optional :: set_time

    If present and .true. then set the simulation time of the cryosphere to be the same as that in the HDF file. Otherwise, leave it unchanged.

procedure, public :: read_sub_ice

  • private subroutine read_sub_ice(this, infile, set_time)

    Author
    Christopher MacMackin
    Date
    April 2017

    Reads the data describing the part of the cryosphere beneath the ice from an HDF5 file on the disc. Data on the ice itself is ignored. h5open_f must have been called once prior to using this method. After the method has been used, h5close_f must be called once before the end of the program.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(inout) :: this
    character(len=*), intent(in) :: infile

    The file from which to read the data describing the state of the cryosphere

    logical, intent(in), optional :: set_time

    If present and .true. then set the simulation time of the cryosphere to be the same as that in the HDF file. Otherwise, leave it unchanged.

procedure, public :: write_data

  • private subroutine write_data(this, outfile)

    Author
    Christopher MacMackin
    Date
    April 2016

    Writes the data describing the cryosphere to the disc as an HDF5 file. h5open_f must have been called once prior to using this method. After the method has been used, h5close_f must be called once before the end of the program.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(in) :: this
    character(len=*), intent(in) :: outfile

    The file to which to write the data describing the state of the cryosphere

procedure, public :: get_time

  • private pure function get_time(this)

    Author
    Chris MacMackin
    Date
    April 2017

    Returns the current time of the cryosphere system.

    Arguments

    Type IntentOptional AttributesName
    class(cryosphere), intent(in) :: this

    Return Value real(kind=r8)

Source Code

  type, public :: cryosphere
    !* Author: Christopher MacMackin
    !  Date: April 2016
    !
    ! A data structure representing glaciers, either as ice shelves or
    ! (eventually) ice sheets. It will allow coupled systems of
    ! glaciers as well as different basal couplings with the ocean or
    ! ground. This type is a subclass of the
    ! [FOODIE](https://github.com/Fortran-FOSS-Programmers/FOODIE)
    ! [integrand](http://fortran-foss-programmers.github.io/FOODIE/type/integrand.html),
    ! allowing it to take advantage of that set of integration
    ! libraries for evolution in time.
    !
    private
    class(glacier), allocatable       :: ice
      !! A model for the ice shelf or ice sheet
    class(basal_surface), allocatable :: sub_ice
      !! A model for the ground or ocean underneath the ice
    real(r8)                          :: time 
      !! The time in the simulation
    logical                           :: first_integration
      !! Indicates whether the cryosphere has been integrated before
      !! or not.
    real(r8)                          :: dt_factor = 1.0_r8
      !! A factor by which to reduce the time step
    real(r8)                          :: min_dt_factor = 1e-3_r8
      !! The smallest time step reduction to allow
    logical                           :: performing_time_step
      !! True if in the process of trying to get a time-step to
      !! successfully integrate.
  contains
    procedure :: initialise
    procedure :: time_step
    procedure :: reduce_time_step
    procedure :: increase_time_step
    procedure :: state_vector
    procedure :: integrate
    procedure :: read_data
    procedure :: read_ice
    procedure :: read_sub_ice
    procedure :: write_data
    procedure :: get_time
  end type cryosphere