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

Remove "coupled" CPP flag, add ssh_stress namelist #496

Merged
merged 4 commits into from
Jul 31, 2020
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
39 changes: 21 additions & 18 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ module ice_dyn_shared
ndte ! number of subcycles: ndte=dt/dte

character (len=char_len), public :: &
coriolis ! 'constant', 'zero', or 'latitude'
coriolis , & ! 'constant', 'zero', or 'latitude'
ssh_stress ! 'geostrophic' or 'coupled'

logical (kind=log_kind), public :: &
revised_evp ! if true, use revised evp procedure
revised_evp ! if true, use revised evp procedure

integer (kind=int_kind), public :: &
kevp_kernel ! 0 = 2D org version
Expand Down Expand Up @@ -475,9 +476,7 @@ subroutine dyn_prep2 (nx_block, ny_block, &
integer (kind=int_kind) :: &
i, j, ij

#ifdef coupled
real (kind=dbl_kind) :: gravit
#endif

logical (kind=log_kind), dimension(nx_block,ny_block) :: &
iceumask_old ! old-time iceumask
Expand Down Expand Up @@ -577,12 +576,12 @@ subroutine dyn_prep2 (nx_block, ny_block, &
! Define variables for momentum equation
!-----------------------------------------------------------------

#ifdef coupled
call icepack_query_parameters(gravit_out=gravit)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
#endif
if (trim(ssh_stress) == 'coupled') then
call icepack_query_parameters(gravit_out=gravit)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
endif

do ij = 1, icellu
i = indxui(ij)
Expand All @@ -597,14 +596,18 @@ subroutine dyn_prep2 (nx_block, ny_block, &
watery(i,j) = vocn(i,j)*cosw + uocn(i,j)*sinw*sign(c1,fm(i,j))

! combine tilt with wind stress
#ifndef coupled
! calculate tilt from geostrophic currents if needed
strtltx(i,j) = -fm(i,j)*vocn(i,j)
strtlty(i,j) = fm(i,j)*uocn(i,j)
#else
strtltx(i,j) = -gravit*umass(i,j)*ss_tltx(i,j)
strtlty(i,j) = -gravit*umass(i,j)*ss_tlty(i,j)
#endif
if (trim(ssh_stress) == 'geostrophic') then
! calculate tilt from geostrophic currents if needed
strtltx(i,j) = -fm(i,j)*vocn(i,j)
strtlty(i,j) = fm(i,j)*uocn(i,j)
elseif (trim(ssh_stress) == 'coupled') then
strtltx(i,j) = -gravit*umass(i,j)*ss_tltx(i,j)
strtlty(i,j) = -gravit*umass(i,j)*ss_tlty(i,j)
else
call abort_ice(subname//' ERROR: unknown ssh_stress='//trim(ssh_stress), &
file=__FILE__, line=__LINE__)
endif

forcex(i,j) = strairx(i,j) + strtltx(i,j)
forcey(i,j) = strairy(i,j) + strtlty(i,j)
enddo
Expand Down
29 changes: 16 additions & 13 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ subroutine input_data
use ice_dyn_shared, only: ndte, kdyn, revised_evp, yield_curve, &
kevp_kernel, &
basalstress, k1, k2, alphab, threshold_hw, &
Ktens, e_ratio, coriolis, &
Ktens, e_ratio, coriolis, ssh_stress, &
kridge, ktransport, brlx, arlx
use ice_transport_driver, only: advection, conserv_check
use ice_restoring, only: restore_ice
Expand Down Expand Up @@ -186,7 +186,7 @@ subroutine input_data
namelist /dynamics_nml/ &
kdyn, ndte, revised_evp, yield_curve, &
kevp_kernel, &
brlx, arlx, &
brlx, arlx, ssh_stress, &
advection, coriolis, kridge, ktransport, &
kstrength, krdg_partic, krdg_redist, mu_rdg, &
e_ratio, Ktens, Cf, basalstress, &
Expand Down Expand Up @@ -324,6 +324,7 @@ subroutine input_data
ktherm = 1 ! -1 = OFF, 0 = 0-layer, 1 = BL99, 2 = mushy thermo
conduct = 'bubbly' ! 'MU71' or 'bubbly' (Pringle et al 2007)
coriolis = 'latitude' ! latitude dependent, or 'constant'
ssh_stress = 'geostrophic' ! 'geostrophic' or 'coupled'
kridge = 1 ! -1 = off, 1 = on
ktransport = 1 ! -1 = off, 1 = on
calc_Tsfc = .true. ! calculate surface temperature
Expand Down Expand Up @@ -611,6 +612,7 @@ subroutine input_data
call broadcast_scalar(albedo_type, master_task)
call broadcast_scalar(ktherm, master_task)
call broadcast_scalar(coriolis, master_task)
call broadcast_scalar(ssh_stress, master_task)
call broadcast_scalar(kridge, master_task)
call broadcast_scalar(ktransport, master_task)
call broadcast_scalar(conduct, master_task)
Expand Down Expand Up @@ -1152,6 +1154,13 @@ subroutine input_data
endif
write(nu_diag,*) 'coriolis = ',trim(coriolis),trim(tmpstr2)

if (trim(ssh_stress) == 'geostrophic') then
tmpstr2 = ': from ocean velocity'
elseif (trim(ssh_stress) == 'coupled') then
tmpstr2 = ': from coupled sea surface height gradients'
endif
write(nu_diag,*) 'ssh_stress = ',trim(ssh_stress),trim(tmpstr2)

if (ktransport == 1) then
tmpstr2 = ' transport enabled'
if (trim(advection) == 'remap') then
Expand Down Expand Up @@ -1309,6 +1318,11 @@ subroutine input_data
tmpstr2 = ' ocean mixed layer calculation (SST) disabled'
endif
write(nu_diag,1012) ' oceanmixed_ice = ', oceanmixed_ice,trim(tmpstr2)
if (oceanmixed_ice) then
write(nu_diag,*) ' WARNING: ocean mixed layer ON'
write(nu_diag,*) ' WARNING: will impact ocean forcing interaction'
write(nu_diag,*) ' WARNING: coupled forcing will be modified by mixed layer routine'
endif
if (trim(tfrz_option) == 'minus1p8') then
tmpstr2 = ': constant ocean freezing temperature (-1.8C)'
elseif (trim(tfrz_option) == 'linear_salt') then
Expand Down Expand Up @@ -1537,17 +1551,6 @@ subroutine input_data
if (restore_ice .or. restore_ocn) &
write(nu_diag,1020) ' trestore = ', trestore

#ifdef coupled
if( oceanmixed_ice ) then
write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING '
write(nu_diag,*) subname//' WARNING: coupled CPP and oceanmixed_ice namelist are BOTH ON'
write(nu_diag,*) subname//' WARNING: Ocean data received from coupler will'
write(nu_diag,*) subname//' WARNING: be altered by mixed layer routine!'
write(nu_diag,*) subname//' WARNING ** WARNING ** WARNING ** WARNING '
write(nu_diag,*) ' '
endif
#endif

write(nu_diag,*) ' '
write(nu_diag,'(a30,2f8.2)') 'Diagnostic point 1: lat, lon =', &
latpnt(1), lonpnt(1)
Expand Down
77 changes: 1 addition & 76 deletions cicecore/cicedynB/infrastructure/comm/serial/ice_communicate.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ subroutine init_communicate
!
!-----------------------------------------------------------------------

#ifdef coupled
use mpi ! MPI Fortran module

integer (int_kind) :: ierr ! MPI error flag
#endif

character(len=*), parameter :: subname = '(init_communicate)'

!-----------------------------------------------------------------------
Expand All @@ -58,27 +52,9 @@ subroutine init_communicate
!
!-----------------------------------------------------------------------

#ifdef coupled
call MPI_INIT(ierr)
call MPI_COMM_RANK (MPI_COMM_ICE, my_task, ierr)
#else
my_task = 0
#endif

master_task = 0

#ifdef coupled
!-----------------------------------------------------------------------
!
! On some 64-bit machines where real_kind and dbl_kind are
! identical, the MPI implementation uses MPI_REAL for both.
! In these cases, set MPI_DBL to MPI_REAL.
!
!-----------------------------------------------------------------------

MPI_DBL = MPI_DOUBLE_PRECISION

#endif
!-----------------------------------------------------------------------

end subroutine init_communicate
Expand Down Expand Up @@ -136,11 +112,6 @@ subroutine create_communicator(new_comm, num_procs)
! this routine should be called from init_domain1 when the
! domain configuration (e.g. nprocs_btrop) has been determined

#ifdef coupled

use mpi ! MPI Fortran module

#endif
! !INPUT PARAMETERS:

integer (int_kind), intent(in) :: &
Expand All @@ -151,54 +122,8 @@ subroutine create_communicator(new_comm, num_procs)
integer (int_kind), intent(out) :: &
new_comm ! new communicator for this distribution

#ifdef coupled
!-----------------------------------------------------------------------
!
! local variables
!
!-----------------------------------------------------------------------

integer (int_kind) :: &
MPI_GROUP_ICE, &! group of processors assigned to ice
MPI_GROUP_NEW ! group of processors assigned to new dist

integer (int_kind) :: &
ierr ! error flag for MPI comms

integer (int_kind), dimension(3) :: &
range ! range of tasks assigned to new dist
! (assumed 0,num_procs-1)

character(len=*), parameter :: subname = '(create_communicator)'

!-----------------------------------------------------------------------
!
! determine group of processes assigned to distribution
!
!-----------------------------------------------------------------------

call MPI_COMM_GROUP (MPI_COMM_ICE, MPI_GROUP_ICE, ierr)

range(1) = 0
range(2) = num_procs-1
range(3) = 1

!-----------------------------------------------------------------------
!
! create subroup and communicator for new distribution
! note: MPI_COMM_CREATE must be called by all procs in MPI_COMM_ICE
!
!-----------------------------------------------------------------------

call MPI_GROUP_RANGE_INCL(MPI_GROUP_ICE, 1, range, &
MPI_GROUP_NEW, ierr)

call MPI_COMM_CREATE (MPI_COMM_ICE, MPI_GROUP_NEW, &
new_comm, ierr)

#else
new_comm = MPI_COMM_ICE
#endif

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

end subroutine create_communicator
Expand Down
5 changes: 2 additions & 3 deletions cicecore/drivers/direct/hadgem3/CICE_FinalMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ subroutine CICE_Finalize
! quit MPI
!-------------------------------------------------------------------

#ifndef coupled
call end_run ! quit MPI
#endif
! standalone
! call end_run ! quit MPI

end subroutine CICE_Finalize

Expand Down
24 changes: 11 additions & 13 deletions cicecore/drivers/direct/hadgem3/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,17 @@ subroutine cice_init
call init_forcing_atmo ! initialize atmospheric forcing (standalone)
#endif

#ifndef coupled
#ifndef CESMCOUPLED
if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
call get_forcing_atmo ! atmospheric forcing from data
call get_forcing_ocn(dt) ! ocean forcing from data

! aerosols
! if (tr_aero) call faero_data ! data file
! if (tr_zaero) call fzaero_data ! data file (gx1)
if (tr_aero .or. tr_zaero) call faero_default ! default values
if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry
#endif
#endif
! standalone
! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
! call get_forcing_atmo ! atmospheric forcing from data
! call get_forcing_ocn(dt) ! ocean forcing from data

! ! aerosols
! ! if (tr_aero) call faero_data ! data file
! ! if (tr_zaero) call fzaero_data ! data file (gx1)
! if (tr_aero .or. tr_zaero) call faero_default ! default values
! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry

if (z_tracers) call get_atm_bgc ! biogeochemistry

if (runtype == 'initial' .and. .not. restart) &
Expand Down
20 changes: 9 additions & 11 deletions cicecore/drivers/direct/hadgem3/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,19 @@ subroutine CICE_Run

call ice_timer_start(timer_couple) ! atm/ocn coupling

#ifndef coupled
#ifndef CESMCOUPLED
! standalone
! for now, wave_spectrum is constant in time
! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
call get_forcing_atmo ! atmospheric forcing from data
call get_forcing_ocn(dt) ! ocean forcing from data
! call get_forcing_atmo ! atmospheric forcing from data
! call get_forcing_ocn(dt) ! ocean forcing from data

! aerosols
! if (tr_aero) call faero_data ! data file
! if (tr_zaero) call fzaero_data ! data file (gx1)
if (tr_aero .or. tr_zaero) call faero_default ! default values
! ! aerosols
! ! if (tr_aero) call faero_data ! data file
! ! if (tr_zaero) call fzaero_data ! data file (gx1)
! if (tr_aero .or. tr_zaero) call faero_default ! default values

! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry

if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry
#endif
#endif
if (z_tracers) call get_atm_bgc ! biogeochemistry

call init_flux_atm ! initialize atmosphere fluxes sent to coupler
Expand Down
5 changes: 2 additions & 3 deletions cicecore/drivers/mct/cesm1/CICE_FinalMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ subroutine CICE_Finalize
! quit MPI
!-------------------------------------------------------------------

#ifndef coupled
call end_run ! quit MPI
#endif
! standalone
! call end_run ! quit MPI

end subroutine CICE_Finalize

Expand Down
26 changes: 12 additions & 14 deletions cicecore/drivers/mct/cesm1/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,19 @@ subroutine cice_init(mpicom_ice)

call init_forcing_atmo ! initialize atmospheric forcing (standalone)

#ifndef coupled
#ifndef CESMCOUPLED
if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
call get_forcing_atmo ! atmospheric forcing from data
call get_forcing_ocn(dt) ! ocean forcing from data
! for standalone
! if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
! call get_forcing_atmo ! atmospheric forcing from data
! call get_forcing_ocn(dt) ! ocean forcing from data

! ! isotopes
! if (tr_iso) call fiso_default ! default values
! ! aerosols
! ! if (tr_aero) call faero_data ! data file
! ! if (tr_zaero) call fzaero_data ! data file (gx1)
! if (tr_aero .or. tr_zaero) call faero_default ! default values
! if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry

! isotopes
if (tr_iso) call fiso_default ! default values
! aerosols
! if (tr_aero) call faero_data ! data file
! if (tr_zaero) call fzaero_data ! data file (gx1)
if (tr_aero .or. tr_zaero) call faero_default ! default values
if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry
#endif
#endif
if (z_tracers) call get_atm_bgc ! biogeochemistry

if (runtype == 'initial' .and. .not. restart) &
Expand Down
Loading