shelf_assign Subroutine

private subroutine shelf_assign(this, rhs)

Copies the data from one ice shelf into another. This is only needed due to a bug in gfortran which means that the intrinsic assignment for glacier types is not using the appropriate defined assignment for the field components.

It does not assign the Jacobian object as it would take up quite a bit of extra space and it is unlikely that it would ever be needed without first having to be recalculated.

Arguments

Type IntentOptional AttributesName
class(ice_shelf), intent(out) :: this
class(glacier), intent(in) :: rhs

The ice shelf to be assigned to this one.


Contents

Source Code


Source Code

  subroutine shelf_assign(this, rhs)
    !* Author: Chris MacMackin
    !  Date: February 2017
    !
    ! Copies the data from one ice shelf into another. This is only
    ! needed due to a bug in gfortran which means that the intrinsic
    ! assignment for glacier types is not using the appropriate
    ! defined assignment for the field components.
    !
    ! It does not assign the Jacobian object as it would take up quite
    ! a bit of extra space and it is unlikely that it would ever be
    ! needed without first having to be recalculated.
    !
    class(ice_shelf), intent(out) :: this
    class(glacier), intent(in)    :: rhs
      !! The ice shelf to be assigned to this one.
    select type(rhs)
    class is(ice_shelf)
      this%thickness = rhs%thickness
      this%velocity = rhs%velocity
      this%eta = rhs%eta
      this%lambda = rhs%lambda
      this%chi = rhs%chi
      this%zeta = rhs%zeta
      this%courant = rhs%courant
      this%max_dt = rhs%max_dt
      allocate(this%viscosity_law, source=rhs%viscosity_law)
      allocate(this%boundaries, source=rhs%boundaries)
      this%time = rhs%time
      this%thickness_size = rhs%thickness_size
      this%velocity_size = rhs%velocity_size
      this%boundary_start = rhs%boundary_start
      this%thickness_lower_bound_size = rhs%thickness_lower_bound_size
      this%thickness_upper_bound_size = rhs%thickness_upper_bound_size
      this%velocity_lower_bound_size = rhs%velocity_lower_bound_size
      this%velocity_upper_bound_size = rhs%velocity_upper_bound_size
      this%stale_jacobian = .true.
      this%stale_eta = .true.
      if (allocated(rhs%kappa)) then
        allocate(this%kappa(size(rhs%kappa)))
        this%kappa = rhs%kappa
      end if
    class default
      call logger%fatal('ice_shelf%assign','Type other than `ice_shelf` '// &
                        'requested to be assigned.')
      error stop
    end select
#ifdef DEBUG
    call logger%debug('ice_shelf%assign','Copied ice shelf data.')
#endif
  end subroutine shelf_assign