Skip to content

Commit

Permalink
Make fld2 a module variable
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-blain committed Oct 18, 2019
1 parent fa5dabb commit 6063323
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ module ice_dyn_vp
indxtj(:,:) , & ! compressed index in j-direction
indxui(:,:) , & ! compressed index in i-direction
indxuj(:,:) ! compressed index in j-direction

real (kind=dbl_kind), allocatable :: &
fld2(:,:,:,:) ! work array for boundary updates

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

Expand Down Expand Up @@ -143,6 +146,7 @@ subroutine init_vp (dt)
indxtj(nx_block*ny_block, max_blocks), &
indxui(nx_block*ny_block, max_blocks), &
indxuj(nx_block*ny_block, max_blocks))
allocate(fld2(nx_block,ny_block,2,max_blocks))

! Redefine tinyarea using a different puny value

Expand Down Expand Up @@ -229,8 +233,6 @@ subroutine imp_solver (dt)
aiu , & ! ice fraction on u-grid
umass , & ! total mass of ice and snow (u grid)
umassdti ! mass of U-cell/dte (kg/m^2 s)

real (kind=dbl_kind), allocatable :: fld2(:,:,:,:)

logical (kind=log_kind) :: calc_strair

Expand All @@ -256,8 +258,6 @@ subroutine imp_solver (dt)
!-----------------------------------------------------------------
! Initialize
!-----------------------------------------------------------------

allocate(fld2(nx_block,ny_block,2,max_blocks))

! This call is needed only if dt changes during runtime.
! call set_evp_parameters (dt)
Expand Down Expand Up @@ -480,7 +480,6 @@ subroutine imp_solver (dt)
call picard_solver (icellt, icellu, &
indxti, indxtj, &
indxui, indxuj, &
fld2, &
aiu, ntot, &
waterx, watery, &
bxfix, byfix, &
Expand All @@ -492,7 +491,6 @@ subroutine imp_solver (dt)
call anderson_solver (icellt, icellu, &
indxti, indxtj, &
indxui, indxuj, &
fld2, &
aiu, ntot, &
waterx, watery, &
bxfix, byfix, &
Expand All @@ -507,7 +505,6 @@ subroutine imp_solver (dt)

deallocate(bvec, sol, diagvec)

deallocate(fld2)
if (maskhalo_dyn) call ice_HaloDestroy(halo_info_mask)

!-----------------------------------------------------------------
Expand Down Expand Up @@ -636,7 +633,6 @@ end subroutine imp_solver
subroutine picard_solver (icellt, icellu, &
indxti, indxtj, &
indxui, indxuj, &
fld2, &
aiu, ntot, &
waterx, watery, &
bxfix, byfix, &
Expand Down Expand Up @@ -669,9 +665,6 @@ subroutine picard_solver (icellt, icellu, &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

real (kind=dbl_kind), dimension (nx_block,ny_block,2,max_blocks), intent(inout) :: &
fld2 ! work array for boundary updates

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(in) :: &
aiu , & ! ice fraction on u-grid
waterx , & ! for ocean stress calculation, x (m/s)
Expand Down Expand Up @@ -1066,7 +1059,6 @@ end subroutine picard_solver
subroutine anderson_solver (icellt, icellu, &
indxti, indxtj, &
indxui, indxuj, &
fld2, &
aiu, ntot, &
waterx, watery, &
bxfix, byfix, &
Expand Down Expand Up @@ -1100,9 +1092,6 @@ subroutine anderson_solver (icellt, icellu, &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

real (kind=dbl_kind), dimension (nx_block,ny_block,2,max_blocks), intent(inout) :: &
fld2 ! work array for boundary updates

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(in) :: &
aiu , & ! ice fraction on u-grid
waterx , & ! for ocean stress calculation, x (m/s)
Expand Down Expand Up @@ -1349,8 +1338,7 @@ subroutine anderson_solver (icellt, icellu, &
! indxui, indxuj, &
! zetaD, &
! Cb, vrel, &
! aiu, umassdti, &
! fld2)
! aiu, umassdti)

elseif (fpfunc_andacc == 2) then
! g_2(x) = x - A(x)x + b(x) = x - F(x)
Expand Down Expand Up @@ -1530,8 +1518,7 @@ subroutine fgmres_solver (ntot, bvec, &
indxui, indxuj, &
zetaD, &
Cb, vrel, &
aiu, umassdti, &
fld2)
aiu, umassdti )

use ice_blocks, only: nx_block, ny_block
use ice_boundary, only: ice_HaloUpdate
Expand Down Expand Up @@ -1570,10 +1557,7 @@ subroutine fgmres_solver (ntot, bvec, &

real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks,4), intent(in) :: &
zetaD ! zetaD = 2zeta (viscous coeff)

real (kind=dbl_kind), dimension (nx_block,ny_block,2,max_blocks), intent(inout) :: &
fld2 ! work array for boundary updates


! local variables

integer (kind=int_kind) :: &
Expand Down Expand Up @@ -4810,7 +4794,7 @@ end function almost_zero
! Perform a halo update for the velocity field
! author: Philippe Blain, ECCC

subroutine ice_HaloUpdate_vel(uvel, vvel, fld2, halo_info_mask)
subroutine ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_constants, only: field_loc_NEcorner, field_type_vector
Expand All @@ -4821,9 +4805,6 @@ subroutine ice_HaloUpdate_vel(uvel, vvel, fld2, halo_info_mask)
uvel , & ! u components of velocity vector
vvel ! v components of velocity vector

real (kind=dbl_kind), dimension (nx_block,ny_block,2,max_blocks), intent(inout) :: &
fld2 ! work array to perform halo update

type (ice_halo), intent(in) :: &
halo_info_mask ! ghost cell update info for masked halo

Expand Down

0 comments on commit 6063323

Please sign in to comment.