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

Nml settings #208

Merged
merged 7 commits into from
Oct 19, 2018
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
81 changes: 36 additions & 45 deletions cicecore/cicedynB/general/ice_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ module ice_flux
public :: init_coupler_flux, init_history_therm, init_history_dyn, &
init_flux_ocn, init_flux_atm, scale_fluxes, alloc_flux

character (char_len), public :: &
default_season ! seasonal default values for forcing

!-----------------------------------------------------------------
! Dynamics component
!-----------------------------------------------------------------
Expand Down Expand Up @@ -529,22 +532,9 @@ subroutine init_coupler_flux

integer (kind=int_kind) :: n

#ifdef CESMCOUPLED
logical (kind=log_kind), parameter :: &
l_winter = .false. , & ! winter/summer default switch
l_spring = .false. ! spring example
#else
logical (kind=log_kind), parameter :: &
l_winter = .true. , & ! winter/summer default switch
l_spring = .false. ! spring example
#endif

real (kind=dbl_kind) :: fcondtopn_d(6), fsurfn_d(6), &
stefan_boltzmann, &
Tffresh, &
vonkar, &
zref, &
iceruf
real (kind=dbl_kind) :: fcondtopn_d(6), fsurfn_d(6)
real (kind=dbl_kind) :: stefan_boltzmann, Tffresh
real (kind=dbl_kind) :: vonkar, zref, iceruf

integer :: i, j, iblk

Expand Down Expand Up @@ -572,24 +562,8 @@ subroutine init_coupler_flux
stray (:,:,:) = 0.05_dbl_kind
fsnow (:,:,:) = c0 ! snowfall rate (kg/m2/s)
! fsnow must be 0 for exact restarts
if (l_spring) then
!typical spring values
potT (:,:,:) = 263.15_dbl_kind ! air potential temp (K)
Tair (:,:,:) = 263.15_dbl_kind ! air temperature (K)
Qa (:,:,:) = 0.001_dbl_kind ! specific humidity (kg/kg)
swvdr (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swvdf (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swidr (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swidf (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
flw (:,:,:) = 230.0_dbl_kind ! incoming longwave rad (W/m^2)
do n = 1, ncat ! surface heat flux (W/m^2)
fsurfn_f(:,:,n,:) = fsurfn_d(n)
enddo
fcondtopn_f(:,:,:,:) = 0.0_dbl_kind ! conductive heat flux (W/m^2)
flatn_f(:,:,:,:) = -1.0_dbl_kind ! latent heat flux (W/m^2)
fsensn_f(:,:,:,:) = c0 ! sensible heat flux (W/m^2)
elseif (l_winter) then
!typical winter values
if (trim(default_season) == 'winter') then
! typical winter values
potT (:,:,:) = 253.0_dbl_kind ! air potential temp (K)
Tair (:,:,:) = 253.0_dbl_kind ! air temperature (K)
Qa (:,:,:) = 0.0006_dbl_kind ! specific humidity (kg/kg)
Expand All @@ -599,14 +573,14 @@ subroutine init_coupler_flux
swidf (:,:,:) = c0 ! shortwave radiation (W/m^2)
flw (:,:,:) = c180 ! incoming longwave rad (W/m^2)
frain (:,:,:) = c0 ! rainfall rate (kg/m2/s)
do n = 1, ncat ! conductive heat flux (W/m^2)
do n = 1, ncat ! conductive heat flux (W/m^2)
fcondtopn_f(:,:,n,:) = fcondtopn_d(n)
enddo
fsurfn_f = fcondtopn_f ! surface heat flux (W/m^2)
flatn_f(:,:,:,:) = c0 ! latent heat flux (kg/m2/s)
fsensn_f(:,:,:,:) = c0 ! sensible heat flux (W/m^2)
else
!typical summer values
fsurfn_f = fcondtopn_f ! surface heat flux (W/m^2)
flatn_f (:,:,:,:) = c0 ! latent heat flux (kg/m2/s)
fsensn_f(:,:,:,:) = c0 ! sensible heat flux (W/m^2)
elseif (trim(default_season) == 'summer') then
! typical summer values
potT (:,:,:) = 273.0_dbl_kind ! air potential temp (K)
Tair (:,:,:) = 273.0_dbl_kind ! air temperature (K)
Qa (:,:,:) = 0.0035_dbl_kind ! specific humidity (kg/kg)
Expand All @@ -616,13 +590,30 @@ subroutine init_coupler_flux
swidf (:,:,:) = 50._dbl_kind ! shortwave radiation (W/m^2)
flw (:,:,:) = 280.0_dbl_kind ! incoming longwave rad (W/m^2)
frain (:,:,:) = c0 ! rainfall rate (kg/m2/s)
do n = 1, ncat ! surface heat flux (W/m^2)
do n = 1, ncat ! surface heat flux (W/m^2)
fsurfn_f(:,:,n,:) = fsurfn_d(n)
enddo
fcondtopn_f(:,:,:,:) = 0.0_dbl_kind ! conductive heat flux (W/m^2)
flatn_f (:,:,:,:) = -2.0_dbl_kind ! latent heat flux (W/m^2)
fsensn_f (:,:,:,:) = c0 ! sensible heat flux (W/m^2)
else
! typical spring values
potT (:,:,:) = 263.15_dbl_kind ! air potential temp (K)
Tair (:,:,:) = 263.15_dbl_kind ! air temperature (K)
Qa (:,:,:) = 0.001_dbl_kind ! specific humidity (kg/kg)
swvdr (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swvdf (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swidr (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
swidf (:,:,:) = 25._dbl_kind ! shortwave radiation (W/m^2)
flw (:,:,:) = 230.0_dbl_kind ! incoming longwave rad (W/m^2)
frain (:,:,:) = c0 ! rainfall rate (kg/m2/s)
do n = 1, ncat ! surface heat flux (W/m^2)
fsurfn_f(:,:,n,:) = fsurfn_d(n)
enddo
fcondtopn_f(:,:,:,:) = 0.0_dbl_kind ! conductive heat flux (W/m^2)
flatn_f(:,:,:,:) = -2.0_dbl_kind ! latent heat flux (W/m^2)
fsensn_f(:,:,:,:) = c0 ! sensible heat flux (W/m^2)
endif ! l_winter
fcondtopn_f(:,:,:,:) = c0 ! conductive heat flux (W/m^2)
flatn_f (:,:,:,:) = -1.0_dbl_kind ! latent heat flux (W/m^2)
fsensn_f (:,:,:,:) = c0 ! sensible heat flux (W/m^2)
endif !

faero_atm (:,:,:,:) = c0 ! aerosol deposition rate (kg/m2/s)
flux_bio_atm (:,:,:,:) = c0 ! zaero and bio deposition rate (kg/m2/s)
Expand Down
88 changes: 44 additions & 44 deletions cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ module ice_forcing
ocn_data_format, & ! 'bin'=binary or 'nc'=netcdf
atm_data_type, & ! 'default', 'monthly', 'ncar',
! 'LYq' or 'hadgem' or 'oned'
sss_data_type, & ! 'default', 'clim', 'ncar', 'oned'
sst_data_type, & ! 'default', 'clim', 'ncar', 'oned',
bgc_data_type, & ! 'default', 'clim', 'ncar', 'oned'
ocn_data_type, & ! 'default', 'clim', 'ncar', 'oned',
! 'hadgem_sst' or 'hadgem_sst_uvocn'
precip_units ! 'mm_per_month', 'mm_per_sec', 'mks'

Expand All @@ -140,7 +140,7 @@ module ice_forcing
ocn_frc_m ! ocn data for 12 months

logical (kind=log_kind), public :: &
restore_sst ! restore sst if true
restore_ocn ! restore sst if true

integer (kind=int_kind), public :: &
trestore ! restoring time scale (days)
Expand Down Expand Up @@ -253,9 +253,9 @@ subroutine init_forcing_ocn(dt)
! Read sst data for current month, and adjust sst based on freezing
! temperature. No interpolation in time.

! Note: SST is subsequently prognosed if CICE is run with a mixed layer
! ocean (oceanmixed_ice = T), and can be restored to data
! (restore_sst = T). SSS is not prognosed by CICE.
! Note: SST is subsequently prognosed if CICE is run
! with a mixed layer ocean (oceanmixed_ice = T), and can be
! restored to data (restore_ocn = T).

use ice_blocks, only: nx_block, ny_block
use ice_domain, only: nblocks
Expand Down Expand Up @@ -300,7 +300,7 @@ subroutine init_forcing_ocn(dt)

nbits = 64 ! double precision data

if (restore_sst .or. restore_bgc) then
if (restore_ocn .or. restore_bgc) then
if (trestore == 0) then
trest = dt ! use data instantaneously
else
Expand All @@ -313,7 +313,7 @@ subroutine init_forcing_ocn(dt)
! initialize to annual climatology created from monthly data
!-------------------------------------------------------------------

if (trim(sss_data_type) == 'clim') then
if (trim(bgc_data_type) == 'clim') then

sss_file = trim(ocn_data_dir)//'/sss.mm.100x116.da' ! gx3 only

Expand Down Expand Up @@ -357,14 +357,14 @@ subroutine init_forcing_ocn(dt)

if (my_task == master_task) close(nu_forcing)

endif ! sss_data_type
endif ! bgc_data_type

!-------------------------------------------------------------------
! Sea surface temperature (SST)
! initialize to data for current month
!-------------------------------------------------------------------

if (trim(sst_data_type) == 'clim') then
if (trim(ocn_data_type) == 'clim') then

if (nx_global == 320) then ! gx1
sst_file = trim(ocn_data_dir)//'/sst_clim_hurrell.dat'
Expand Down Expand Up @@ -399,8 +399,8 @@ subroutine init_forcing_ocn(dt)
endif ! init_sst_data


if (trim(sst_data_type) == 'hadgem_sst' .or. &
trim(sst_data_type) == 'hadgem_sst_uvocn') then
if (trim(ocn_data_type) == 'hadgem_sst' .or. &
trim(ocn_data_type) == 'hadgem_sst_uvocn') then

diag = .true. ! write diagnostic information

Expand Down Expand Up @@ -431,10 +431,10 @@ subroutine init_forcing_ocn(dt)
enddo
!$OMP END PARALLEL DO

endif ! sst_data_type
endif ! ocn_data_type

if (trim(sst_data_type) == 'ncar' .or. &
trim(sss_data_type) == 'ncar') then
if (trim(ocn_data_type) == 'ncar' .or. &
trim(bgc_data_type) == 'ncar') then
! call ocn_data_ncar_init
call ocn_data_ncar_init_3D
endif
Expand Down Expand Up @@ -603,19 +603,19 @@ subroutine get_forcing_ocn (dt)

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

if (trim(sst_data_type) == 'clim' .or. &
trim(sss_data_type) == 'clim') then
if (trim(ocn_data_type) == 'clim' .or. &
trim(bgc_data_type) == 'clim') then
call ocn_data_clim(dt)
elseif (trim(sst_data_type) == 'ncar' .or. &
trim(sss_data_type) == 'ncar'.or. &
trim(sst_data_type) == 'ISPOL' .or. &
trim(sss_data_type) == 'ISPOL') then
elseif (trim(ocn_data_type) == 'ncar' .or. &
trim(bgc_data_type) == 'ncar'.or. &
trim(ocn_data_type) == 'ISPOL' .or. &
trim(bgc_data_type) == 'ISPOL') then
call ocn_data_ncar(dt)
elseif (trim(sst_data_type) == 'hadgem_sst' .or. &
trim(sst_data_type) == 'hadgem_sst_uvocn') then
elseif (trim(ocn_data_type) == 'hadgem_sst' .or. &
trim(ocn_data_type) == 'hadgem_sst_uvocn') then
call ocn_data_hadgem(dt)
elseif (trim(sst_data_type) == 'oned' .or. &
trim(sss_data_type) == 'oned') then
elseif (trim(ocn_data_type) == 'oned' .or. &
trim(bgc_data_type) == 'oned') then
call ocn_data_oned
endif

Expand Down Expand Up @@ -3080,16 +3080,16 @@ subroutine ocn_data_clim (dt)
character(len=*), parameter :: subname = '(ocn_data_clim)'

if (my_task == master_task .and. istep == 1) then
if (trim(sss_data_type)=='clim') then
if (trim(bgc_data_type)=='clim') then
write (nu_diag,*) ' '
write (nu_diag,*) 'SSS data interpolated to timestep:'
write (nu_diag,*) trim(sss_file)
endif
if (trim(sst_data_type)=='clim') then
if (trim(ocn_data_type)=='clim') then
write (nu_diag,*) ' '
write (nu_diag,*) 'SST data interpolated to timestep:'
write (nu_diag,*) trim(sst_file)
if (restore_sst) write (nu_diag,*) &
if (restore_ocn) write (nu_diag,*) &
'SST restoring timescale (days) =', trestore
endif
endif ! my_task, istep
Expand All @@ -3101,8 +3101,8 @@ subroutine ocn_data_clim (dt)
! month.
!-------------------------------------------------------------------

if (trim(sss_data_type)=='clim' .or. &
trim(sst_data_type)=='clim') then
if (trim(bgc_data_type)=='clim' .or. &
trim(ocn_data_type)=='clim') then

midmonth = 15 ! data is given on 15th of every month
!!! midmonth = fix(p5 * real(daymo(month))) ! exact middle
Expand All @@ -3128,14 +3128,14 @@ subroutine ocn_data_clim (dt)
readm = .false.
if (istep==1 .or. (mday==midmonth .and. sec==0)) readm = .true.

endif ! sss/sst_data_type
endif ! bgc/ocn_data_type

!-------------------------------------------------------------------
! Read two monthly SSS values and interpolate.
! Note: SSS is restored instantaneously to data.
!-------------------------------------------------------------------

if (trim(sss_data_type)=='clim') then
if (trim(bgc_data_type)=='clim') then
call read_clim_data (readm, 0, ixm, month, ixp, &
sss_file, sss_data, &
field_loc_center, field_type_scalar)
Expand All @@ -3159,13 +3159,13 @@ subroutine ocn_data_clim (dt)
! Restore toward interpolated value.
!-------------------------------------------------------------------

if (trim(sst_data_type)=='clim') then
if (trim(ocn_data_type)=='clim') then
call read_clim_data (readm, 0, ixm, month, ixp, &
sst_file, sst_data, &
field_loc_center, field_type_scalar)
call interpolate_data (sst_data, sstdat)

if (restore_sst) then
if (restore_ocn) then
!$OMP PARALLEL DO PRIVATE(iblk,i,j)
do iblk = 1, nblocks
do j = 1, ny_block
Expand Down Expand Up @@ -3248,7 +3248,7 @@ subroutine ocn_data_ncar_init
write (nu_diag,*) 'WARNING: not data from ocean forcing file.'
write (nu_diag,*) 'WARNING: Alter ice_dyn_evp.F90 if desired.'

if (restore_sst) write (nu_diag,*) &
if (restore_ocn) write (nu_diag,*) &
'SST restoring timescale = ',trestore,' days'

sst_file = trim(ocn_data_dir)//'/'//trim(oceanmixed_file) ! not just sst
Expand Down Expand Up @@ -3400,7 +3400,7 @@ subroutine ocn_data_ncar_init_3D
write (nu_diag,*) 'WARNING: not data from ocean forcing file.'
write (nu_diag,*) 'WARNING: Alter ice_dyn_evp.F if desired.'

if (restore_sst) write (nu_diag,*) &
if (restore_ocn) write (nu_diag,*) &
'SST restoring timescale = ',trestore,' days'

sst_file = trim(ocn_data_dir)//'/'//trim(oceanmixed_file) ! not just sst
Expand Down Expand Up @@ -3604,7 +3604,7 @@ subroutine ocn_data_ncar(dt)

call ocn_freezing_temperature

if (restore_sst) then
if (restore_ocn) then
do j = 1, ny_block
do i = 1, nx_block
sst(i,j,:) = sst(i,j,:) + (work1(i,j,:)-sst(i,j,:))*dt/trest
Expand Down Expand Up @@ -3705,7 +3705,7 @@ end subroutine ocn_data_oned
subroutine ocn_data_hadgem(dt)

! Reads in HadGEM ocean forcing data as required from netCDF files
! Current options (selected by sst_data_type)
! Current options (selected by ocn_data_type)
! hadgem_sst: read in sst only
! hadgem_sst_uvocn: read in sst plus uocn and vocn

Expand Down Expand Up @@ -3776,9 +3776,9 @@ subroutine ocn_data_hadgem(dt)
write (nu_diag,*) ' '
write (nu_diag,*) 'SST data interpolated to timestep:'
write (nu_diag,*) trim(ocn_data_dir)//'/MONTHLY/sst.1997.nc'
if (restore_sst) write (nu_diag,*) &
if (restore_ocn) write (nu_diag,*) &
'SST restoring timescale (days) =', trestore
if (trim(sst_data_type)=='hadgem_sst_uvocn') then
if (trim(ocn_data_type)=='hadgem_sst_uvocn') then
write (nu_diag,*) ' '
write (nu_diag,*) 'uocn and vocn interpolated to timestep:'
write (nu_diag,*) trim(ocn_data_dir)//'/MONTHLY/uocn.1997.nc'
Expand All @@ -3799,7 +3799,7 @@ subroutine ocn_data_hadgem(dt)
call interpolate_data (sst_data, sstdat)

! Restore SSTs if required
if (restore_sst) then
if (restore_ocn) then
!$OMP PARALLEL DO PRIVATE(iblk,i,j)
do iblk = 1, nblocks
do j = 1, ny_block
Expand All @@ -3821,7 +3821,7 @@ subroutine ocn_data_hadgem(dt)
! Also need to be converted from cm s-1 (UM) to m s-1 (CICE)
! -----------------------------------------------------------

if (trim(sst_data_type)=='hadgem_sst_uvocn') then
if (trim(ocn_data_type)=='hadgem_sst_uvocn') then

filename = trim(ocn_data_dir)//'/MONTHLY/uocn.1997.nc'
fieldname='uocn'
Expand Down Expand Up @@ -3873,7 +3873,7 @@ subroutine ocn_data_hadgem(dt)
call t2ugrid_vector(uocn)
call t2ugrid_vector(vocn)

endif ! sst_data_type = hadgem_sst_uvocn
endif ! ocn_data_type = hadgem_sst_uvocn

end subroutine ocn_data_hadgem

Expand Down Expand Up @@ -4356,7 +4356,7 @@ subroutine ocn_data_ispol_init

if (my_task == master_task) then

if (restore_sst) write (nu_diag,*) &
if (restore_ocn) write (nu_diag,*) &
'SST restoring timescale = ',trestore,' days'

sst_file = trim(ocn_data_dir)//'/'//trim(oceanmixed_file) ! not just sst
Expand Down
Loading