upstream_plume_boundary Derived Type

type, public, extends(plume_boundary) :: upstream_plume_boundary

A type with procedures for getting the boundary conditions of the plume model. For given boundary conditions, it integrates the plume upstream slightly and then returns these when asked for boundary values. This allows boundary layers, which can cause numerical difficulties, to be avoided. Inflow boundaries must be Dirichlet, while outflow boundaries for velocity, salinity, and temperature are set to have a gradient of zero.


Inherits

type~~upstream_plume_boundary~~InheritsGraph type~upstream_plume_boundary upstream_plume_boundary type~plume_boundary plume_boundary type~upstream_plume_boundary->type~plume_boundary

Contents


Components

TypeVisibility AttributesNameInitial
procedure(bound_vals), private, nopass, pointer:: get_boundaries=> null()

Calculate the "actual" boundary values, used to initiate the integration, for the specified time.

real(kind=r8), private :: distance =0.05_r8

The distance upstream which the plume should be integrated

real(kind=r8), private :: thickness =0.1_r8

The thickness of the plume at the inflowing boundary

real(kind=r8), private, dimension(:), allocatable:: velocity

The velocity of the plume at the inflowing boundary

real(kind=r8), private :: temperature =0.0_r8

The tempreature of the plume at the inflowing boundary

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

The salinity of the plume at the inflowing boundary

real(kind=r8), private :: boundary_time

The time at which the boundaries were most recently calculated

real(kind=r8), private, dimension(:), allocatable:: thresholds

Thresholds to use when calculating error in the integration.


Constructor

public interface upstream_plume_boundary

  • private pure function constructor(bound_calculator, distance, thresholds) result(this)

    Author
    Chris MacMackin
    Date
    July 2017

    Constructs a boundary condition object which integrates an IVP from actual boundary values to calculate the staet of the plume a little upstream. This can be used to avoid boundary layers.

    Arguments

    Type IntentOptional AttributesName
    procedure(bound_vals) :: bound_calculator

    Calculates the "actual" inflow boundary conditions, used to initiate the integration to find the values to use in the simulation.

    real(kind=r8), intent(in) :: distance

    The distance upstream which the plume should be integrated.

    real(kind=r8), intent(in), optional dimension(:):: thresholds

    The thresholds to use when evaluating the error of the integration. This is done according to the formula abs(e) / max(magnitude_y, THRESHOLDS) <= TOLERANCE.

    Return Value type(upstream_plume_boundary)


Type-Bound Procedures

procedure, public :: set_time

Specifies the time at which to calculate the boundary conditions.

  • private subroutine set_time(this, time)

    Author
    Chris MacMackin
    Date
    May 2017

    Sets the time at which boundary conditions are to be calculated.

    Arguments

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

procedure, public :: thickness_bound_info => upstream_thickness_info

Indicates the type and depth of the thickness boundary at different locations.

  • private subroutine upstream_thickness_info(this, location, bound_type, bound_depth)

    Author
    Chris MacMackin
    Date
    July 2017

    Indicates that the lower boundary is Dirichlet and the upper boundary is free.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    integer, intent(out) :: bound_type

    An integer representing what sort of boundary condition is used. The integer value corresponding to each boundary type is specified in the boundary_types_mod.

    integer, intent(out) :: bound_depth

    The number of layers of data-points needed to specify the boundary condition.

procedure, public :: velocity_bound_info => upstream_info

Indicates the type and depth of the thickness boundary at different locations.

  • private subroutine upstream_info(this, location, bound_type, bound_depth)

    Author
    Chris MacMackin
    Date
    July 2017

    Indicates that the lower boundary is Dirichlet and the upper boundary is Neumann.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    integer, intent(out) :: bound_type

    An integer representing what sort of boundary condition is used. The integer value corresponding to each boundary type is specified in the boundary_types_mod.

    integer, intent(out) :: bound_depth

    The number of layers of data-points needed to specify the boundary condition.

procedure, public :: temperature_bound_info => upstream_info

Indicates the type and depth of the thickness boundary at different locations.

  • private subroutine upstream_info(this, location, bound_type, bound_depth)

    Author
    Chris MacMackin
    Date
    July 2017

    Indicates that the lower boundary is Dirichlet and the upper boundary is Neumann.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    integer, intent(out) :: bound_type

    An integer representing what sort of boundary condition is used. The integer value corresponding to each boundary type is specified in the boundary_types_mod.

    integer, intent(out) :: bound_depth

    The number of layers of data-points needed to specify the boundary condition.

procedure, public :: salinity_bound_info => upstream_info

Indicates the type and depth of the thickness boundary at different locations.

  • private subroutine upstream_info(this, location, bound_type, bound_depth)

    Author
    Chris MacMackin
    Date
    July 2017

    Indicates that the lower boundary is Dirichlet and the upper boundary is Neumann.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    integer, intent(out) :: bound_type

    An integer representing what sort of boundary condition is used. The integer value corresponding to each boundary type is specified in the boundary_types_mod.

    integer, intent(out) :: bound_depth

    The number of layers of data-points needed to specify the boundary condition.

procedure, public :: thickness_bound => upstream_thickness_bound

Produces a field containing the boundary conditions for plume thickness at the specified location.

  • private function upstream_thickness_bound(this, location) result(bound)

    Author
    Chris MacMackin
    Date
    July 2017

    Returns a field containing the thickness boundary values for the specified boundary location.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    Return Value class(scalar_field), pointer

procedure, public :: velocity_bound => upstream_velocity_bound

Produces a field containing the boundary conditions for plume velocity at the specified location.

  • private function upstream_velocity_bound(this, location) result(bound)

    Author
    Chris MacMackin
    Date
    July 2017

    Returns a field containing the velocity boundary values for the specified boundary location.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    Return Value class(vector_field), pointer

procedure, public :: temperature_bound => upstream_temperature_bound

Produces a field containing the boundary conditions for plume temperature at the specified location.

  • private function upstream_temperature_bound(this, location) result(bound)

    Author
    Chris MacMackin
    Date
    July 2017

    Returns a field containing the temperature boundary values for the specified boundary location.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    Return Value class(scalar_field), pointer

procedure, public :: salinity_bound => upstream_salinity_bound

Produces a field containing the boundary conditions for plume salinity at the specified location.

  • private function upstream_salinity_bound(this, location) result(bound)

    Author
    Chris MacMackin
    Date
    July 2017

    Returns a field containing the salinity boundary values for the specified boundary location.

    Arguments

    Type IntentOptional AttributesName
    class(upstream_plume_boundary), intent(in) :: this
    integer, intent(in) :: location

    Which boundary information is to be provided for. The boundary will be the one normal to dimension of number abs(boundary). If the argument is negative, then the lower boundary is returned. If positive, then the upper boundary is returned.

    Return Value class(scalar_field), pointer

procedure, public :: calculate => upstream_calculate

Calculates the upstreamed boundary conditions for the given time and ice thickness.

  • private subroutine upstream_calculate(this, t, func, b)

    Author
    Chris MacMackin
    Date
    July 2017

    Calculates the boundary values to use at the current time with the current ice thickness.

    Arguments

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

    The time at which to calculate the boundary values.

    procedure(non_diff) :: func

    A function which returns the non-diffusive, non-inertial components of the ODEs describing the plume.

    class(scalar_field), intent(in) :: b

    The depth of the ice shelf base.

Source Code

  type, extends(plume_boundary), public :: upstream_plume_boundary
    !* Author: Chris MacMackin
    !  Date: July 2017
    !
    ! A type with procedures for getting the boundary conditions of
    ! the plume model. For given boundary conditions, it integrates
    ! the plume upstream slightly and then returns these when asked
    ! for boundary values. This allows boundary layers, which can
    ! cause numerical difficulties, to be avoided. Inflow boundaries
    ! must be Dirichlet, while outflow boundaries for velocity,
    ! salinity, and temperature are set to have a gradient of zero.
    !
    ! @Warning The `calculate` method __must__ be called prior to use.
    !
    private
    procedure(bound_vals), nopass, pointer :: get_boundaries => null()
      !! Calculate the "actual" boundary values, used to initiate the
      !! integration, for the specified time.
    real(r8) :: distance = 0.05_r8
      !! The distance upstream which the plume should be integrated
    real(r8) :: thickness = 0.1_r8
      !! The thickness of the plume at the inflowing boundary
    real(r8), dimension(:), allocatable :: velocity
      !! The velocity of the plume at the inflowing boundary
    real(r8) :: temperature = 0.0_r8
      !! The tempreature of the plume at the inflowing boundary
    real(r8) :: salinity = 1.0_r8
      !! The salinity of the plume at the inflowing boundary
    real(r8) :: boundary_time
      !! The time at which the boundaries were most recently
      !! calculated
    real(r8), dimension(:), allocatable :: thresholds
      !! Thresholds to use when calculating error in the integration.
  contains
    procedure :: thickness_bound_info => upstream_thickness_info
      !! Indicates the type and depth of the thickness boundary at
      !! different locations.
    procedure :: velocity_bound_info => upstream_info
      !! Indicates the type and depth of the thickness boundary at
      !! different locations.
    procedure :: temperature_bound_info => upstream_info
      !! Indicates the type and depth of the thickness boundary at
      !! different locations.
    procedure :: salinity_bound_info => upstream_info
      !! Indicates the type and depth of the thickness boundary at
      !! different locations.
    procedure :: thickness_bound => upstream_thickness_bound
      !! Produces a field containing the boundary conditions for plume
      !! thickness at the specified location.
    procedure :: velocity_bound => upstream_velocity_bound
      !! Produces a field containing the boundary conditions for plume
      !! velocity at the specified location.
    procedure :: temperature_bound => upstream_temperature_bound
      !! Produces a field containing the boundary conditions for plume
      !! temperature at the specified location.
    procedure :: salinity_bound => upstream_salinity_bound
      !! Produces a field containing the boundary conditions for plume
      !! salinity at the specified location.
    procedure :: calculate => upstream_calculate
      !! Calculates the upstreamed boundary conditions for the given
      !! time and ice thickness.
  end type upstream_plume_boundary