sheet_assign Subroutine

private subroutine sheet_assign(this, rhs)

Copies the data from one ice sheet 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_sheet), intent(out) :: this
class(glacier), intent(in) :: rhs

The ice sheet to be assigned to this one.


Contents

Source Code


Source Code

  subroutine sheet_assign(this, rhs)
    !* Author: Chris MacMackin
    !  Date: February 2017
    !
    ! Copies the data from one ice sheet 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_sheet), intent(out) :: this
    class(glacier), intent(in)    :: rhs
      !! The ice sheet to be assigned to this one.
    select type(rhs)
    class is(ice_sheet)
      this%thickness = rhs%thickness
      this%velocity = rhs%velocity
      this%lambda = rhs%lambda
      this%chi = rhs%chi
      allocate(this%viscosity_law, source=rhs%viscosity_law)
      this%time = rhs%time
    class default
      call logger%fatal('ice_sheet%assign','Type other than `ice_sheet` '// &
                        'requested to be assigned.')
      error stop
    end select
#ifdef DEBUG
    call logger%debug('ice_sheet%assign','Copied ice sheet data.')
#endif
  end subroutine sheet_assign