Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seabed stress - remove if statements #673

Merged
merged 9 commits into from
Feb 23, 2022
44 changes: 23 additions & 21 deletions cicecore/cicedynB/dynamics/ice_dyn_eap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -395,30 +395,32 @@ subroutine eap (dt)
!-----------------------------------------------------------------

if (seabed_stress) then
if ( seabed_stress_method == 'LKD' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
call seabed_stress_factor_LKD (nx_block, ny_block, &
icellu (iblk), &
indxui(:,iblk), indxuj(:,iblk), &
vice(:,:,iblk), aice(:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
enddo
!$OMP END PARALLEL DO

!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

if ( seabed_stress_method == 'LKD' ) then

call seabed_stress_factor_LKD (nx_block, ny_block, &
icellu (iblk), &
indxui(:,iblk), indxuj(:,iblk), &
vice(:,:,iblk), aice(:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))

elseif ( seabed_stress_method == 'probabilistic' ) then

call seabed_stress_factor_prob (nx_block, ny_block, &
icellt(iblk), indxti(:,iblk), indxtj(:,iblk), &
icellu(iblk), indxui(:,iblk), indxuj(:,iblk), &
aicen(:,:,:,iblk), vicen(:,:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
endif
elseif ( seabed_stress_method == 'probabilistic' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

enddo
!$OMP END PARALLEL DO
call seabed_stress_factor_prob (nx_block, ny_block, &
icellt(iblk), indxti(:,iblk), indxtj(:,iblk), &
icellu(iblk), indxui(:,iblk), indxuj(:,iblk), &
aicen(:,:,:,iblk), vicen(:,:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
enddo
!$OMP END PARALLEL DO

endif
endif


do ksub = 1,ndte ! subcycling

Expand Down
23 changes: 12 additions & 11 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -332,29 +332,30 @@ subroutine evp (dt)
!-----------------------------------------------------------------

if (seabed_stress) then

!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

if ( seabed_stress_method == 'LKD' ) then

if ( seabed_stress_method == 'LKD' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
call seabed_stress_factor_LKD (nx_block, ny_block, &
icellu (iblk), &
indxui(:,iblk), indxuj(:,iblk), &
vice(:,:,iblk), aice(:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
enddo
!$OMP END PARALLEL DO

elseif ( seabed_stress_method == 'probabilistic' ) then
elseif ( seabed_stress_method == 'probabilistic' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

call seabed_stress_factor_prob (nx_block, ny_block, &
icellt(iblk), indxti(:,iblk), indxtj(:,iblk), &
icellu(iblk), indxui(:,iblk), indxuj(:,iblk), &
aicen(:,:,:,iblk), vicen(:,:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
endif

enddo
!$OMP END PARALLEL DO
enddo
!$OMP END PARALLEL DO

endif
endif

call ice_timer_start(timer_evp_2d)
Expand Down
6 changes: 2 additions & 4 deletions cicecore/cicedynB/dynamics/ice_dyn_evp_1d.F90
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,8 @@ subroutine stepu_last(NA_len, rhow, lb, ub, Cw, aiu, uocn, vocn, &
vvel(iw) = (cca * cc2 - ccb * cc1) / ab2

! calculate seabed stress component for outputs
if (seabed_stress) then
taubx(iw) = -uvel(iw) * Tbu(iw) / (sqrt(uold**2 + vold**2) + u0)
tauby(iw) = -vvel(iw) * Tbu(iw) / (sqrt(uold**2 + vold**2) + u0)
end if
taubx(iw) = -uvel(iw) * Tbu(iw) / (sqrt(uold**2 + vold**2) + u0)
tauby(iw) = -vvel(iw) * Tbu(iw) / (sqrt(uold**2 + vold**2) + u0)

end do
#ifdef _OPENACC
Expand Down
12 changes: 4 additions & 8 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,10 @@ subroutine stepu (nx_block, ny_block, &
uvel(i,j) = (cca*cc1 + ccb*cc2) / ab2 ! m/s
vvel(i,j) = (cca*cc2 - ccb*cc1) / ab2

! calculate seabed stress component for outputs
if (ksub == ndte) then ! on last subcycling iteration
if ( seabed_stress ) then
taubx(i,j) = -uvel(i,j)*Tbu(i,j) / (sqrt(uold**2 + vold**2) + u0)
tauby(i,j) = -vvel(i,j)*Tbu(i,j) / (sqrt(uold**2 + vold**2) + u0)
endif
endif

! calculate seabed stress component for outputs
! only needed on last iteration.
taubx(i,j) = -uvel(i,j)*Tbu(i,j) / (sqrt(uold**2 + vold**2) + u0)
tauby(i,j) = -vvel(i,j)*Tbu(i,j) / (sqrt(uold**2 + vold**2) + u0)
enddo ! ij

end subroutine stepu
Expand Down
24 changes: 13 additions & 11 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -440,33 +440,35 @@ subroutine implicit_solver (dt)
!-----------------------------------------------------------------
! seabed stress factor Tbu (Tbu is part of Cb coefficient)
!-----------------------------------------------------------------

if (seabed_stress) then

!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

if ( seabed_stress_method == 'LKD' ) then

if (seabed_stress) then
if ( seabed_stress_method == 'LKD' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
call seabed_stress_factor_LKD (nx_block, ny_block, &
icellu (iblk), &
indxui(:,iblk), indxuj(:,iblk), &
vice(:,:,iblk), aice(:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
enddo
!$OMP END PARALLEL DO

elseif ( seabed_stress_method == 'probabilistic' ) then
elseif ( seabed_stress_method == 'probabilistic' ) then
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks

call seabed_stress_factor_prob (nx_block, ny_block, &
icellt(iblk), indxti(:,iblk), indxtj(:,iblk), &
icellu(iblk), indxui(:,iblk), indxuj(:,iblk), &
aicen(:,:,:,iblk), vicen(:,:,:,iblk), &
hwater(:,:,iblk), Tbu(:,:,iblk))
endif
enddo
!$OMP END PARALLEL DO

enddo
!$OMP END PARALLEL DO
endif
endif


!-----------------------------------------------------------------
! calc size of problem (ntot) and allocate solution vector
!-----------------------------------------------------------------
Expand Down