Skip to content

Commit

Permalink
ice_dyn_vp: remove unused subroutine and cleanup interfaces
Browse files Browse the repository at this point in the history
The previous commit removed the last caller of 'calc_L2norm_squared'.
Remove the subroutine.

Also, do not compute 'sum_squared' in 'residual_vec', since the variable
'L2norm' which receives this value is also unused in 'anderson_solver'
since the previous commit.  Adjust the interface accordingly.
  • Loading branch information
phil-blain committed Jul 22, 2022
1 parent 26dd003 commit 3a36c09
Showing 1 changed file with 3 additions and 62 deletions.
65 changes: 3 additions & 62 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,7 @@ subroutine anderson_solver (icellt , icellu , &
indxui (:,iblk), indxuj (:,iblk), &
bx (:,:,iblk), by (:,:,iblk), &
Au (:,:,iblk), Av (:,:,iblk), &
Fx (:,:,iblk), Fy (:,:,iblk), &
L2norm (iblk))
Fx (:,:,iblk), Fy (:,:,iblk))
enddo
!$OMP END PARALLEL DO
nlres_norm = sqrt(global_sum_prod(Fx(:,:,:), Fx(:,:,:), distrb_info, field_loc_NEcorner) + &
Expand Down Expand Up @@ -1959,8 +1958,7 @@ subroutine residual_vec (nx_block , ny_block, &
indxui , indxuj , &
bx , by , &
Au , Av , &
Fx , Fy , &
sum_squared)
Fx , Fy )

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
Expand All @@ -1980,9 +1978,6 @@ subroutine residual_vec (nx_block , ny_block, &
Fx , & ! x residual vector, Fx = bx - Au (N/m^2)
Fy ! y residual vector, Fy = by - Av (N/m^2)

real (kind=dbl_kind), intent(out), optional :: &
sum_squared ! sum of squared residual vector components

! local variables

integer (kind=int_kind) :: &
Expand All @@ -1991,22 +1986,15 @@ subroutine residual_vec (nx_block , ny_block, &
character(len=*), parameter :: subname = '(residual_vec)'

!-----------------------------------------------------------------
! compute residual and sum its squared components
! compute residual
!-----------------------------------------------------------------

if (present(sum_squared)) then
sum_squared = c0
endif

do ij = 1, icellu
i = indxui(ij)
j = indxuj(ij)

Fx(i,j) = bx(i,j) - Au(i,j)
Fy(i,j) = by(i,j) - Av(i,j)
if (present(sum_squared)) then
sum_squared = sum_squared + Fx(i,j)**2 + Fy(i,j)**2
endif
enddo ! ij

end subroutine residual_vec
Expand Down Expand Up @@ -2470,53 +2458,6 @@ end subroutine formDiag_step2

!=======================================================================

! Compute squared l^2 norm of a grid function (tpu,tpv)

subroutine calc_L2norm_squared (nx_block, ny_block, &
icellu , &
indxui , indxuj , &
tpu , tpv , &
L2norm)

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
icellu ! total count when iceumask is true

integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: &
tpu , & ! x-component of vector grid function
tpv ! y-component of vector grid function

real (kind=dbl_kind), intent(out) :: &
L2norm ! squared l^2 norm of vector grid function (tpu,tpv)

! local variables

integer (kind=int_kind) :: &
i, j, ij

character(len=*), parameter :: subname = '(calc_L2norm_squared)'

!-----------------------------------------------------------------
! compute squared l^2 norm of vector grid function (tpu,tpv)
!-----------------------------------------------------------------

L2norm = c0

do ij = 1, icellu
i = indxui(ij)
j = indxuj(ij)

L2norm = L2norm + tpu(i,j)**2 + tpv(i,j)**2
enddo ! ij

end subroutine calc_L2norm_squared

!=======================================================================

! Convert a grid function (tpu,tpv) to a one dimensional vector

subroutine arrays_to_vec (nx_block, ny_block , &
Expand Down

0 comments on commit 3a36c09

Please sign in to comment.