Skip to content
22 changes: 11 additions & 11 deletions cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ subroutine init_forcing_ocn(dt)
endif ! ocn_data_type

if (trim(ocn_data_type) == 'ncar') then
! call ocn_data_ncar_init
call ocn_data_ncar_init_3D
call ocn_data_ncar_init
! call ocn_data_ncar_init_3D
endif

if (trim(ocn_data_type) == 'hycom') then
Expand Down Expand Up @@ -3722,13 +3722,14 @@ subroutine ocn_data_ncar_init
do m=1,12

! Note: netCDF does single to double conversion if necessary
if (n >= 4 .and. n <= 7) then
call ice_read_nc(fid, m, vname(n), work1, dbug, &
field_loc_NEcorner, field_type_vector)
else
! if (n >= 4 .and. n <= 7) then
! call ice_read_nc(fid, m, vname(n), work1, dbug, &
! field_loc_NEcorner, field_type_vector)
! else
call ice_read_nc(fid, m, vname(n), work1, dbug, &
field_loc_center, field_type_scalar)
endif
! endif

ocn_frc_m(:,:,:,n,m) = work1(:,:,:)

enddo ! month loop
Expand Down Expand Up @@ -3764,8 +3765,8 @@ subroutine ocn_data_ncar_init
endif

!echmod - currents cause Fram outflow to be too large
ocn_frc_m(:,:,:,4,:) = c0
ocn_frc_m(:,:,:,5,:) = c0
! ocn_frc_m(:,:,:,4,:) = c0
! ocn_frc_m(:,:,:,5,:) = c0
!echmod

end subroutine ocn_data_ncar_init
Expand Down Expand Up @@ -3995,8 +3996,8 @@ subroutine ocn_data_ncar(dt)
! Find interpolation coefficients
call interp_coeff_monthly (recslot)

sst_data(:,:,:,:) = c0
do n = nfld, 1, -1
!$OMP PARALLEL DO PRIVATE(iblk,i,j)
do iblk = 1, nblocks
! use sst_data arrays as temporary work space until n=1
if (ixm /= -99) then ! first half of month
Expand All @@ -4007,7 +4008,6 @@ subroutine ocn_data_ncar(dt)
sst_data(:,:,2,iblk) = ocn_frc_m(:,:,iblk,n,ixp)
endif
enddo
!$OMP END PARALLEL DO

call interpolate_data (sst_data,work1)
! masking by hm is necessary due to NaNs in the data file
Expand Down
31 changes: 20 additions & 11 deletions cicecore/cicedynB/infrastructure/ice_read_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
! dimlen ! dimension size

real (kind=dbl_kind) :: &
missingvalue, &
amin, amax, asum ! min, max values and sum of input array

! character (char_len) :: &
Expand All @@ -1141,6 +1142,8 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
nx = nx_global
ny = ny_global

work = c0 ! to satisfy intent(out) attribute

if (present(restart_ext)) then
if (restart_ext) then
nx = nx_global + 2*nghost
Expand Down Expand Up @@ -1181,25 +1184,26 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
count=(/nx,ny,1/) )
endif

status = nf90_get_att(fid, varid, "_FillValue", missingvalue)
endif ! my_task = master_task

!-------------------------------------------------------------------
! optional diagnostics
!-------------------------------------------------------------------

if (my_task==master_task .and. diag) then
! write(nu_diag,*) &
! 'ice_read_nc_xy, fid= ',fid, ', nrec = ',nrec, &
! ', varname = ',trim(varname)
write(nu_diag,*) &
'ice_read_nc_xy, fid= ',fid, ', nrec = ',nrec, &
', varname = ',trim(varname)
! status = nf90_inquire(fid, nDimensions=ndim, nVariables=nvar)
! write(nu_diag,*) 'ndim= ',ndim,', nvar= ',nvar
! do id=1,ndim
! status = nf90_inquire_dimension(fid,id,name=dimname,len=dimlen)
! write(nu_diag,*) 'Dim name = ',trim(dimname),', size = ',dimlen
! enddo
amin = minval(work_g1)
amax = maxval(work_g1, mask = work_g1 /= spval_dbl)
asum = sum (work_g1, mask = work_g1 /= spval_dbl)
amax = maxval(work_g1, mask = work_g1 /= missingvalue)
asum = sum (work_g1, mask = work_g1 /= missingvalue)
write(nu_diag,*) ' min, max, sum =', amin, amax, asum, trim(varname)
endif

Expand All @@ -1223,12 +1227,15 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, &
endif

deallocate(work_g1)

! echmod: this should not be necessary if fill/missing are only on land
where (work > 1.0e+30_dbl_kind) work = c0

if (orca_halogrid .and. .not. present(restart_ext)) deallocate(work_g2)

#else
call abort_ice(subname//'ERROR: USE_NETCDF cpp not defined', &
file=__FILE__, line=__LINE__)
work = c0 ! to satisfy intent(out) attribute
#endif
end subroutine ice_read_nc_xy

Expand Down Expand Up @@ -1282,6 +1289,7 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &
! dimlen ! size of dimension

real (kind=dbl_kind) :: &
missingvalue, & ! missing value
amin, amax, asum ! min, max values and sum of input array

! character (char_len) :: &
Expand Down Expand Up @@ -1347,16 +1355,17 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &
count=(/nx,ny,ncat,1/) )
endif

status = nf90_get_att(fid, varid, "_FillValue", missingvalue)
endif ! my_task = master_task

!-------------------------------------------------------------------
! optional diagnostics
!-------------------------------------------------------------------

if (my_task==master_task .and. diag) then
! write(nu_diag,*) &
! 'ice_read_nc_xyz, fid= ',fid, ', nrec = ',nrec, &
! ', varname = ',trim(varname)
write(nu_diag,*) &
'ice_read_nc_xyz, fid= ',fid, ', nrec = ',nrec, &
', varname = ',trim(varname)
! status = nf90_inquire(fid, nDimensions=ndim, nVariables=nvar)
! write(nu_diag,*) 'ndim= ',ndim,', nvar= ',nvar
! do id=1,ndim
Expand All @@ -1365,8 +1374,8 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, &
! enddo
do n=1,ncat
amin = minval(work_g1(:,:,n))
amax = maxval(work_g1(:,:,n), mask = work_g1(:,:,n) /= spval_dbl)
asum = sum (work_g1(:,:,n), mask = work_g1(:,:,n) /= spval_dbl)
amax = maxval(work_g1(:,:,n), mask = work_g1(:,:,n) /= missingvalue)
asum = sum (work_g1(:,:,n), mask = work_g1(:,:,n) /= missingvalue)
write(nu_diag,*) ' min, max, sum =', amin, amax, asum, trim(varname)
enddo
endif
Expand Down
2 changes: 1 addition & 1 deletion cicecore/drivers/standalone/cice/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ subroutine cice_init

! call calendar(time) ! determine the initial date

call init_forcing_ocn(dt) ! initialize sss and sst from data
call init_state ! initialize the ice state
call init_transport ! initialize horizontal transport
call ice_HaloRestore_init ! restored boundary conditions
Expand Down Expand Up @@ -201,6 +200,7 @@ subroutine cice_init
!--------------------------------------------------------------------

call init_forcing_atmo ! initialize atmospheric forcing (standalone)
call init_forcing_ocn(dt) ! initialize sss and sst from data

if (tr_fsd .and. wave_spec) call get_wave_spec ! wave spectrum in ice
call get_forcing_atmo ! atmospheric forcing from data
Expand Down
7 changes: 7 additions & 0 deletions configuration/scripts/options/set_nml.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

oceanmixed_ice = .true.
ocn_data_type = 'ncar'
ocn_data_format = 'nc'
ocn_data_dir = '/glade/p/cesm/pcwg_dev/CICE_data/forcing/gx1'
oceanmixed_file = 'pop_frc.gx1.nc'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need have a standard name for the oceanmixed_file and then commit to Zenodo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ocean_forcing_gx1.nc?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be named similarly to the atmospheric forcing, but that is not standardized. It could follow the JRA tx1 example,
CESM_ocean_monthly_forcing_gx1.nc -- probably overkill since its location in the forcing directory structure would identify it: CICE_data/forcing/gx1/CESM/MONTHLY/
So ocean_forcing_gx1.nc works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eclare108213 mentioned having 2D in the name as well. Then if we put it under the forcing/gx1 area, we shouldn't need the "gx1" label.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want a filename that doesn't rely on it's directory location to describe it. We also don't want the same filename in multiple directories. So we want to avoid having multiple "ocean_forcing.nc" files in multiple directories. When the file is separated from it's directory, it should be unique (relative to other input data files) and still somewhat descriptive. I am completely fine with something like "CESM_ocean_monthly_climatology_forcing_gx1_210324.nc". But it need not be that descriptive. It's always a balance. When/if we update this file in the future, we'll need to give it a new name as well. We need to make sure we never have multiple versions of the same filename, ever.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the Kay et al. 2015 reference to the CESM-LE in the metadata. I think the metadata can be very descriptive as well as the Zenodo entry. I believe we should keep the filename simple.


1 change: 1 addition & 0 deletions configuration/scripts/tests/base_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ restart gx1 8x1 bgczclim,medium
smoke gx1 24x1 medium,run90day,yi2008
smoke gx3 8x1 medium,run90day,yi2008
restart gx1 24x1 short
restart gx1 24x1 short,ml
restart gx3 8x1 short
smoke gx3 4x2 fsd1,diag24,run5day,debug
smoke gx3 8x2 fsd12,diag24,run5day,short
Expand Down