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

allocate c and cd var in evp, reduce number of "if grid_ice". #778

Merged
merged 7 commits into from
Nov 17, 2022
589 changes: 323 additions & 266 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion cicecore/drivers/direct/hadgem3/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subroutine cice_init
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -123,7 +124,9 @@ subroutine cice_init
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down
5 changes: 4 additions & 1 deletion cicecore/drivers/direct/nemo_concepts/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subroutine cice_init
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -123,7 +124,9 @@ subroutine cice_init
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down
5 changes: 4 additions & 1 deletion cicecore/drivers/mct/cesm1/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ subroutine cice_init(mpicom_ice)
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -136,7 +137,9 @@ subroutine cice_init(mpicom_ice)
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down
3 changes: 3 additions & 0 deletions cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ subroutine cice_init2()
use ice_diagnostics , only: init_diags
use ice_domain_size , only: ncat, nfsd
use ice_dyn_eap , only: init_eap, alloc_dyn_eap
use ice_dyn_evp , only: alloc_dyn_evp
use ice_dyn_shared , only: kdyn, init_dyn
use ice_dyn_vp , only: init_vp
use ice_flux , only: init_coupler_flux, init_history_therm
Expand All @@ -106,6 +107,8 @@ subroutine cice_init2()
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 1) then
call alloc_dyn_evp ! allocate dyn_evp arrays
if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
Expand Down
24 changes: 19 additions & 5 deletions cicecore/drivers/nuopc/dmi/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module CICE_InitMod
use ice_kinds_mod
use ice_exit, only: abort_ice
use ice_fileunits, only: init_fileunits, nu_diag
use ice_memusage, only: ice_memusage_init, ice_memusage_print
use icepack_intfc, only: icepack_aggregate
use icepack_intfc, only: icepack_init_itd, icepack_init_itd_hist
use icepack_intfc, only: icepack_init_fsd_bounds, icepack_init_wave
Expand Down Expand Up @@ -47,9 +48,9 @@ subroutine CICE_Initialize(mpi_comm)

integer (kind=int_kind), optional, intent(in) :: mpi_comm ! communicator from nuopc
character(len=*), parameter :: subname='(CICE_Initialize)'
!--------------------------------------------------------------------
! model initialization
!--------------------------------------------------------------------
!--------------------------------------------------------------------
! model initialization
!--------------------------------------------------------------------

if (present(mpi_comm)) then
call cice_init(mpi_comm)
Expand All @@ -70,13 +71,14 @@ subroutine cice_init(mpi_comm)
floe_binwidth, c_fsd_range
use ice_state, only: alloc_state
use ice_flux_bgc, only: alloc_flux_bgc
use ice_calendar, only: dt, dt_dyn, istep, istep1, write_ic, &
use ice_calendar, only: dt, dt_dyn, write_ic, &
init_calendar, advance_timestep, calc_timesteps
use ice_communicate, only: init_communicate, my_task, master_task
use ice_diagnostics, only: init_diags
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -122,6 +124,12 @@ subroutine cice_init(mpi_comm)
call input_zbgc ! vertical biogeochemistry namelist
call count_tracers ! count tracers

! Call this as early as possible, must be after memory_stats is read
if (my_task == master_task) then
call ice_memusage_init(nu_diag)
call ice_memusage_print(nu_diag,subname//':start')
endif

call init_domain_blocks ! set up block decomposition
call init_grid1 ! domain distribution
call alloc_grid ! allocate grid arrays
Expand All @@ -138,7 +146,9 @@ subroutine cice_init(mpi_comm)
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down Expand Up @@ -254,6 +264,10 @@ subroutine cice_init(mpi_comm)

if (write_ic) call accum_hist(dt) ! write initial conditions

if (my_task == master_task) then
call ice_memusage_print(nu_diag,subname//':end')
endif

end subroutine cice_init

!=======================================================================
Expand Down
5 changes: 4 additions & 1 deletion cicecore/drivers/standalone/cice/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ subroutine cice_init
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -133,7 +134,9 @@ subroutine cice_init
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down
5 changes: 4 additions & 1 deletion cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subroutine cice_init
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -124,7 +125,9 @@ subroutine cice_init
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down
5 changes: 4 additions & 1 deletion cicecore/drivers/unittest/sumchk/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subroutine cice_init
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_evp, only: alloc_dyn_evp
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
Expand Down Expand Up @@ -124,7 +125,9 @@ subroutine cice_init
call init_hist (dt) ! initialize output history file

call init_dyn (dt_dyn) ! define dynamics parameters, variables
if (kdyn == 2) then
if (kdyn == 1) then
call alloc_dyn_evp
else if (kdyn == 2) then
call alloc_dyn_eap ! allocate dyn_eap arrays
call init_eap ! define eap dynamics parameters, variables
else if (kdyn == 3) then
Expand Down