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

Alloc dyn4 #194

Merged
merged 10 commits into from
Sep 28, 2018
22 changes: 14 additions & 8 deletions cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ foreach compiler ( $ncompilers )
end

# from basic script dir to casescr
foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_settings.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh)
foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh)
if !(-e ${ICE_SCRIPTS}/$file) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found"
exit -1
Expand Down Expand Up @@ -603,6 +603,7 @@ foreach compiler ( $ncompilers )
echo "ICE_COMPILER = ${compiler}"
echo "ICE_PES = ${task}x${thrd}"
echo "ICE_GRID = ${grid} (${ICE_DECOMP_NXGLOB}x${ICE_DECOMP_NYGLOB}) blocksize=${ICE_DECOMP_BLCKX}x${ICE_DECOMP_BLCKY}x${ICE_DECOMP_MXBLCKS}"
echo "ICE_DECOMP = ${ICE_DECOMP_DECOMP} ${ICE_DECOMP_DSHAPE}"

#------------------------------------------------------------
# Copy in and update cice.settings and ice_in files
Expand All @@ -618,7 +619,12 @@ foreach compiler ( $ncompilers )
cat >! ${fimods} << EOF1
# cice.setup settings

nprocs = ${task}
nprocs = ${task}
nx_global = ${ICE_DECOMP_NXGLOB}
ny_global = ${ICE_DECOMP_NYGLOB}
block_size_x = ${ICE_DECOMP_BLCKX}
block_size_y = ${ICE_DECOMP_BLCKY}
max_blocks = ${ICE_DECOMP_MXBLCKS}
distribution_type = '${ICE_DECOMP_DECOMP}'
processor_shape = '${ICE_DECOMP_DSHAPE}'
version_name = '${ICE_VERSION}'
Expand Down Expand Up @@ -651,13 +657,13 @@ setenv ICE_COMPILER ${compiler}
setenv ICE_MACHCOMP ${machcomp}
setenv ICE_RUNDIR ${ICE_MACHINE_WKDIR}/${casename}
setenv ICE_GRID ${grid}
setenv ICE_NXGLOB ${ICE_DECOMP_NXGLOB}
setenv ICE_NYGLOB ${ICE_DECOMP_NYGLOB}
#setenv ICE_NXGLOB ${ICE_DECOMP_NXGLOB} # moved to namelist
#setenv ICE_NYGLOB ${ICE_DECOMP_NYGLOB} # moved to namelist
setenv ICE_NTASKS ${task}
setenv ICE_NTHRDS ${thrd}
setenv ICE_MXBLCKS ${ICE_DECOMP_MXBLCKS}
setenv ICE_BLCKX ${ICE_DECOMP_BLCKX}
setenv ICE_BLCKY ${ICE_DECOMP_BLCKY}
#setenv ICE_MXBLCKS ${ICE_DECOMP_MXBLCKS} # moved to namelist
#setenv ICE_BLCKX ${ICE_DECOMP_BLCKX} # moved to namelist
#setenv ICE_BLCKY ${ICE_DECOMP_BLCKY} # moved to namelist
setenv ICE_BASELINE ${basedir_tmp}
setenv ICE_BASEGEN ${baseGen}
setenv ICE_BASECOM ${baseCom}
Expand Down Expand Up @@ -754,7 +760,7 @@ EOF2
${casescr}/parse_namelist.sh ice_in ${fimods}
source ./cice.settings
source ./env.${machcomp} || exit 2
${casescr}/parse_namelist_from_settings.sh ice_in cice.settings
${casescr}/parse_namelist_from_env.sh ice_in

#------------------------------------------------------------
# Generate run script
Expand Down
39 changes: 36 additions & 3 deletions cicecore/cicedynB/dynamics/ice_dyn_eap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module ice_dyn_eap

implicit none
private
public :: eap, init_eap, write_restart_eap, read_restart_eap
public :: eap, init_eap, write_restart_eap, read_restart_eap, &
alloc_dyn_eap

! Look-up table needed for calculating structure tensor
integer (int_kind), parameter :: &
Expand All @@ -44,12 +45,12 @@ module ice_dyn_eap
real (kind=dbl_kind), dimension (nx_yield,ny_yield,na_yield) :: &
s11r, s12r, s22r, s11s, s12s, s22s

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: &
real (kind=dbl_kind), dimension (:,:,:), allocatable :: &
a11_1, a11_2, a11_3, a11_4, & ! components of
a12_1, a12_2, a12_3, a12_4 ! structure tensor

! history
real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), public :: &
real (kind=dbl_kind), dimension(:,:,:), allocatable, public :: &
e11 , & ! components of strain rate tensor (1/s)
e12 , &
e22 , &
Expand All @@ -66,6 +67,38 @@ module ice_dyn_eap

contains

!=======================================================================
!
! Allocate space for all variables
!
subroutine alloc_dyn_eap

integer (int_kind) :: ierr

allocate( a11_1 (nx_block,ny_block,max_blocks), &
a11_2 (nx_block,ny_block,max_blocks), &
a11_3 (nx_block,ny_block,max_blocks), &
a11_4 (nx_block,ny_block,max_blocks), &
a12_1 (nx_block,ny_block,max_blocks), &
a12_2 (nx_block,ny_block,max_blocks), &
a12_3 (nx_block,ny_block,max_blocks), &
a12_4 (nx_block,ny_block,max_blocks), &
e11 (nx_block,ny_block,max_blocks), &
e12 (nx_block,ny_block,max_blocks), &
e22 (nx_block,ny_block,max_blocks), &
yieldstress11(nx_block,ny_block,max_blocks), &
yieldstress12(nx_block,ny_block,max_blocks), &
yieldstress22(nx_block,ny_block,max_blocks), &
s11 (nx_block,ny_block,max_blocks), &
s12 (nx_block,ny_block,max_blocks), &
s22 (nx_block,ny_block,max_blocks), &
a11 (nx_block,ny_block,max_blocks), &
a12 (nx_block,ny_block,max_blocks), &
stat=ierr)
if (ierr/=0) call abort_ice('(alloc_dyn_eap): Out of memory')

end subroutine alloc_dyn_eap

!=======================================================================
!
! Elastic-anisotropic-plastic dynamics driver
Expand Down
23 changes: 20 additions & 3 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
module ice_dyn_shared

use ice_kinds_mod
use ice_communicate, only: my_task, master_task
use ice_constants, only: c0, c1, p01, p001
use ice_blocks, only: nx_block, ny_block
use ice_domain_size, only: max_blocks
Expand All @@ -21,7 +22,8 @@ module ice_dyn_shared
implicit none
private
public :: init_evp, set_evp_parameters, stepu, principal_stress, &
dyn_prep1, dyn_prep2, dyn_finish, basal_stress_coeff
dyn_prep1, dyn_prep2, dyn_finish, basal_stress_coeff, &
alloc_dyn_shared

! namelist parameters

Expand Down Expand Up @@ -60,7 +62,7 @@ module ice_dyn_shared
real (kind=dbl_kind), allocatable, public :: &
fcor_blk(:,:,:) ! Coriolis parameter (1/s)

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: &
real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: &
uvel_init, & ! x-component of velocity (m/s), beginning of timestep
vvel_init ! y-component of velocity (m/s), beginning of timestep

Expand All @@ -75,6 +77,22 @@ module ice_dyn_shared

contains

!=======================================================================
!
! Allocate space for all variables
!
subroutine alloc_dyn_shared

integer (int_kind) :: ierr

allocate( &
uvel_init (nx_block,ny_block,max_blocks), & ! x-component of velocity (m/s), beginning of timestep
vvel_init (nx_block,ny_block,max_blocks), & ! y-component of velocity (m/s), beginning of timestep
stat=ierr)
if (ierr/=0) call abort_ice('(alloc_dyn_shared): Out of memory')

end subroutine alloc_dyn_shared

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

! Initialize parameters and variables needed for the evp dynamics
Expand All @@ -83,7 +101,6 @@ module ice_dyn_shared
subroutine init_evp (dt)

use ice_blocks, only: nx_block, ny_block
use ice_communicate, only: my_task, master_task
use ice_constants, only: c0, c2, omega
use ice_domain, only: nblocks
use ice_domain_size, only: max_blocks
Expand Down
Loading