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

RASM test update, new bathymetry popfile method, minor refactor to ice_dyn_evp_1d #367

Merged
merged 3 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ subroutine runtime_diags (dt)
use ice_global_reductions, only: global_sum, global_sum_prod, global_maxval
use ice_grid, only: lmask_n, lmask_s, tarean, tareas
use ice_state ! everything
! tcraig, this is likely to cause circular dependency because ice_prescribed_mod is high level routine
#ifdef CESMCOUPLED
use ice_prescribed_mod, only: prescribed_ice
#endif
Expand Down Expand Up @@ -839,6 +840,7 @@ subroutine runtime_diags (dt)

if (print_global) then ! global diags for conservations checks

! tcraig, this is likely to cause circular dependency because ice_prescribed_mod is high level routine
#ifdef CESMCOUPLED
if (prescribed_ice) then
write (nu_diag,*) '----------------------------'
Expand Down
9 changes: 5 additions & 4 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ subroutine evp (dt)
aice_init, aice0, aicen, vicen, strength
use ice_timers, only: timer_dynamics, timer_bound, &
ice_timer_start, ice_timer_stop, timer_evp_1d, timer_evp_2d
use ice_dyn_evp_1d
use ice_dyn_evp_1d, only: ice_dyn_evp_1d_copyin, ice_dyn_evp_1d_kernel, &
ice_dyn_evp_1d_copyout
use ice_dyn_shared, only: kevp_kernel

real (kind=dbl_kind), intent(in) :: &
Expand Down Expand Up @@ -353,7 +354,7 @@ subroutine evp (dt)
call abort_ice(trim(subname)//' &
& Kernel not tested on tripole grid. Set kevp_kernel=0')
endif
call evp_copyin( &
call ice_dyn_evp_1d_copyin( &
nx_block,ny_block,nblocks,nx_global+2*nghost,ny_global+2*nghost, &
HTE,HTN, &
!v1 dxhy,dyhx,cyp,cxp,cym,cxm,tinyarea, &
Expand All @@ -367,15 +368,15 @@ subroutine evp (dt)
stress12_1,stress12_2,stress12_3,stress12_4 )
if (kevp_kernel == 2) then
call ice_timer_start(timer_evp_1d)
call evp_kernel_v2()
call ice_dyn_evp_1d_kernel()
call ice_timer_stop(timer_evp_1d)
!v1 else if (kevp_kernel == 1) then
!v1 call evp_kernel_v1()
else
if (my_task == 0) write(nu_diag,*) subname,' ERROR: kevp_kernel = ',kevp_kernel
call abort_ice(subname//' kevp_kernel not supported.')
endif
call evp_copyout( &
call ice_dyn_evp_1d_copyout( &
nx_block,ny_block,nblocks,nx_global+2*nghost,ny_global+2*nghost,&
!strocn uvel,vvel, strocnx,strocny, strintx,strinty, &
uvel,vvel, strintx,strinty, &
Expand Down
162 changes: 75 additions & 87 deletions cicecore/cicedynB/dynamics/ice_dyn_evp_1d.F90
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
! ice_dyn_evp_1d
!
! Contains 3 Fortran modules,
! Contained 3 Fortran modules,
! * dmi_omp
! * bench_v2
! * ice_dyn_evp_1d
! These were merged into one module, ice_dyn_evp_1d to support some
! coupled build systems.
!
! Modules used for:
! * convert 2D arrays into 1D vectors
! * Do stress/stepu/halo_update interations
! * convert 1D vectors into 2D matrices
!
! Call from ice_dyn_evp.F90:
! call evp_copyin(...)
! call evp_kernel()
! call evp_copyout(...)
! call ice_dyn_evp_1d_copyin(...)
! call ice_dyn_evp_1d_kernel()
! call ice_dyn_evp_1d_copyout(...)
!
! * REAL4 internal version:
! mv evp_kernel1d.F90 evp_kernel1d_r8.F90
Expand All @@ -27,40 +29,99 @@
!===============================================================================

!===============================================================================
module dmi_omp

!-- One dimension representation of EVP 2D arrays used for EVP kernels
module ice_dyn_evp_1d

use ice_kinds_mod
use ice_fileunits, only: nu_diag
use ice_exit, only: abort_ice

implicit none
private
public :: domp_init, domp_get_domain, domp_get_thread_no
public :: ice_dyn_evp_1d_copyin, ice_dyn_evp_1d_copyout, ice_dyn_evp_1d_kernel

interface ice_dyn_evp_1d_copyin
! module procedure evp_copyin_v1
module procedure evp_copyin_v2
end interface

interface ice_dyn_evp_1d_kernel
! module procedure evp_kernel_v1
module procedure evp_kernel_v2
end interface

interface ice_dyn_evp_1d_copyout
module procedure evp_copyout
end interface

interface convert_2d_1d
! module procedure convert_2d_1d_v1
module procedure convert_2d_1d_v2
end interface

integer(kind=int_kind) :: &
NA_len, NAVEL_len
logical(kind=log_kind), dimension(:), allocatable :: &
skipucell
integer(kind=int_kind), dimension(:), allocatable :: &
ee,ne,se,nw,sw,sse,indi,indj,indij , halo_parent
real (kind=dbl_kind), dimension(:), allocatable :: &
cdn_ocn,aiu,uocn,vocn,forcex,forcey,Tbu,tarear, &
umassdti,fm,uarear,strintx,strinty,uvel_init,vvel_init
real (kind=dbl_kind), dimension(:), allocatable :: &
strength,uvel,vvel,dxt,dyt, &
!v1 dxhy,dyhx,cyp,cxp,cym,cxm,tinyarea, &
!v1 waterx,watery, &
stressp_1, stressp_2, stressp_3, stressp_4, &
stressm_1, stressm_2, stressm_3, stressm_4, &
stress12_1,stress12_2,stress12_3,stress12_4, &
divu,rdg_conv,rdg_shear,shear,taubx,tauby
real (kind=DBL_KIND), dimension(:), allocatable :: &
str1, str2, str3, str4, str5, str6, str7, str8
real (kind=dbl_kind), dimension(:), allocatable :: &
HTE,HTN, &
HTEm1,HTNm1
logical(kind=log_kind),parameter :: dbug = .false.


!--- dmi_omp ---------------------------
interface domp_get_domain
module procedure domp_get_domain_rlu
end interface

INTEGER, PARAMETER :: JPIM = SELECTED_INT_KIND(9)
integer(int_kind), private :: domp_iam, domp_nt
integer(int_kind) :: domp_iam, domp_nt

#if defined (_OPENMP)
! Please note, this constant will create a compiler info for a constant
! expression in IF statements:
real(kind=dbl_kind) :: rdomp_iam, rdomp_nt
!$OMP THREADPRIVATE(domp_iam,domp_nt,rdomp_iam,rdomp_nt)
#endif
!--- dmi_omp ---------------------------

contains
!--- bench_v2 --------------------------
interface evp1d_stress
module procedure stress_i
module procedure stress_l
end interface
interface evp1d_stepu
module procedure stepu_iter
module procedure stepu_last
end interface
!--- bench_v2 --------------------------

!----------------------------------------------------------------------------
contains

!===============================================================================
!former module dmi_omp

subroutine domp_init(nt_out)

#if defined (_OPENMP)
use omp_lib, only : omp_get_thread_num, omp_get_num_threads
#endif
use ice_forcing, only : dbug

integer(int_kind), intent(out) :: nt_out

Expand Down Expand Up @@ -165,30 +226,11 @@ end subroutine domp_get_thread_no

!----------------------------------------------------------------------------

end module dmi_omp
!former end module dmi_omp

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

module bench_v2

use ice_fileunits, only: nu_diag
use ice_exit, only: abort_ice

implicit none
private
public :: evp1d_stress, evp1d_stepu, evp1d_halo_update

interface evp1d_stress
module procedure stress_i
module procedure stress_l
end interface
interface evp1d_stepu
module procedure stepu_iter
module procedure stepu_last
end interface

contains
!former module bench_v2

!----------------------------------------------------------------------------

Expand All @@ -201,7 +243,6 @@ subroutine stress_i(NA_len, &
str6,str7,str8)

use ice_kinds_mod
use dmi_omp, only : domp_get_domain
use ice_constants, only: p027, p055, p111, p166, p222, p25, p333, p5, c1p5, c1
use icepack_parameters, only: puny
use ice_dyn_shared, only: ecci, denom1, arlx1i, Ktens, revp
Expand Down Expand Up @@ -467,7 +508,6 @@ subroutine stress_l(NA_len, tarear, &
str1,str2,str3,str4,str5,str6,str7,str8 )

use ice_kinds_mod
use dmi_omp, only : domp_get_domain
use ice_constants, only: p027, p055, p111, p166, p222, p25, p333, p5, c1p5, c0, c1
use icepack_parameters, only: puny
use ice_dyn_shared, only: ecci, denom1, arlx1i, Ktens, revp
Expand Down Expand Up @@ -736,7 +776,6 @@ subroutine stepu_iter(NA_len,rhow, &
str1,str2,str3,str4,str5,str6,str7,str8, nw,sw,se,skipme)

use ice_kinds_mod
use dmi_omp, only : domp_get_domain
use ice_dyn_shared, only: brlx, revp
use ice_constants, only: c0, c1

Expand Down Expand Up @@ -827,7 +866,6 @@ subroutine stepu_last(NA_len, rhow, &
str1,str2,str3,str4,str5,str6,str7,str8, nw,sw,se,skipme)

use ice_kinds_mod
use dmi_omp, only : domp_get_domain
use ice_constants, only: c0, c1
use icepack_parameters, only: puny
use ice_dyn_shared, only: brlx, revp, basalstress
Expand Down Expand Up @@ -920,7 +958,6 @@ end subroutine stepu_last
subroutine evp1d_halo_update(NAVEL_len,lb,ub,uvel,vvel, halo_parent)

use ice_kinds_mod
use dmi_omp, only : domp_get_domain

implicit none

Expand Down Expand Up @@ -957,56 +994,9 @@ end subroutine evp1d_halo_update

!----------------------------------------------------------------------------

end module bench_v2
!former end module bench_v2

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

!-- One dimension representation of EVP 2D arrays used for EVP kernels
module ice_dyn_evp_1d

use ice_kinds_mod
use ice_fileunits, only: nu_diag
use ice_exit, only: abort_ice

implicit none
private
public :: evp_copyin, evp_copyout, evp_kernel_v2

interface evp_copyin
! module procedure evp_copyin_v1
module procedure evp_copyin_v2
end interface
interface convert_2d_1d
! module procedure convert_2d_1d_v1
module procedure convert_2d_1d_v2
end interface

integer(kind=int_kind) :: &
NA_len, NAVEL_len
logical(kind=log_kind), dimension(:), allocatable :: &
skipucell
integer(kind=int_kind), dimension(:), allocatable :: &
ee,ne,se,nw,sw,sse,indi,indj,indij , halo_parent
real (kind=dbl_kind), dimension(:), allocatable :: &
cdn_ocn,aiu,uocn,vocn,forcex,forcey,Tbu,tarear, &
umassdti,fm,uarear,strintx,strinty,uvel_init,vvel_init
real (kind=dbl_kind), dimension(:), allocatable :: &
strength,uvel,vvel,dxt,dyt, &
!v1 dxhy,dyhx,cyp,cxp,cym,cxm,tinyarea, &
!v1 waterx,watery, &
stressp_1, stressp_2, stressp_3, stressp_4, &
stressm_1, stressm_2, stressm_3, stressm_4, &
stress12_1,stress12_2,stress12_3,stress12_4, &
divu,rdg_conv,rdg_shear,shear,taubx,tauby
real (kind=DBL_KIND), dimension(:), allocatable :: &
str1, str2, str3, str4, str5, str6, str7, str8
real (kind=dbl_kind), dimension(:), allocatable :: &
HTE,HTN, &
HTEm1,HTNm1

contains

!----------------------------------------------------------------------------

subroutine alloc1d(na)
Expand Down Expand Up @@ -1407,8 +1397,6 @@ subroutine evp_kernel_v2

use ice_constants, only : c0
use ice_dyn_shared, only: ndte
use bench_v2, only : evp1d_stress, evp1d_stepu, evp1d_halo_update
use dmi_omp, only : domp_init
use icepack_intfc, only: icepack_query_parameters
use ice_communicate, only: my_task, master_task
implicit none
Expand Down Expand Up @@ -2043,7 +2031,6 @@ end subroutine findXinY_halo

subroutine numainit(l,u,uu)

use dmi_omp, only : domp_get_domain
use ice_constants, only: c0

implicit none
Expand Down Expand Up @@ -2127,6 +2114,7 @@ subroutine numainit(l,u,uu)
end subroutine numainit

!----------------------------------------------------------------------------
!===============================================================================

end module ice_dyn_evp_1d

Loading