Skip to content

Commit 14ca4a1

Browse files
authored
Merge pull request #76 from jiandewang/feature/update-to-GFDL-20210914
update to gfdl 20210914
2 parents f8a8e4c + 29016c2 commit 14ca4a1

20 files changed

Lines changed: 1284 additions & 233 deletions

config_src/drivers/mct_cap/mom_surface_forcing_mct.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
12451245
"If true, use a 2-dimensional gustiness supplied from "//&
12461246
"an input file", default=.false.)
12471247
call get_param(param_file, mdl, "GUST_CONST", CS%gust_const, &
1248-
"The background gustiness in the winds.", units="Pa", default=0.0)
1248+
"The background gustiness in the winds.", units="Pa", default=0.0, &
1249+
scale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z)
12491250
if (CS%read_gust_2d) then
12501251
call get_param(param_file, mdl, "GUST_2D_FILE", gust_file, &
12511252
"The file in which the wind gustiness is found in "//&

config_src/drivers/nuopc_cap/mom_cap.F90

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module MOM_cap_mod
3131
use MOM_grid, only: ocean_grid_type, get_global_grid_size
3232
use MOM_ocean_model_nuopc, only: ice_ocean_boundary_type
3333
use MOM_ocean_model_nuopc, only: ocean_model_restart, ocean_public_type, ocean_state_type
34-
use MOM_ocean_model_nuopc, only: ocean_model_init_sfc
34+
use MOM_ocean_model_nuopc, only: ocean_model_init_sfc, ocean_model_flux_init
3535
use MOM_ocean_model_nuopc, only: ocean_model_init, update_ocean_model, ocean_model_end
3636
use MOM_ocean_model_nuopc, only: get_ocean_grid, get_eps_omesh, query_ocean_state
3737
use MOM_cap_time, only: AlarmInit
@@ -422,6 +422,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
422422
logical :: isPresent, isPresentDiro, isPresentLogfile, isSet
423423
logical :: existflag
424424
logical :: use_waves ! If true, the wave modules are active.
425+
character(len=40) :: wave_method ! Wave coupling method.
425426
integer :: userRc
426427
integer :: localPet
427428
integer :: localPeCount
@@ -650,6 +651,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
650651
ocean_public%is_ocean_pe = .true.
651652
call ocean_model_init(ocean_public, ocean_state, time0, time_start, input_restart_file=trim(restartfiles))
652653

654+
! GMM, this call is not needed for NCAR. Check with EMC.
655+
! If this can be deleted, perhaps we should also delete ocean_model_flux_init
656+
call ocean_model_flux_init(ocean_state)
657+
653658
call ocean_model_init_sfc(ocean_state, ocean_public)
654659

655660
call mpp_get_compute_domain(ocean_public%domain, isc, iec, jsc, jec)
@@ -669,6 +674,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
669674
Ice_ocean_boundary% seaice_melt_heat (isc:iec,jsc:jec),&
670675
Ice_ocean_boundary% seaice_melt (isc:iec,jsc:jec), &
671676
Ice_ocean_boundary% mi (isc:iec,jsc:jec), &
677+
Ice_ocean_boundary% ice_fraction (isc:iec,jsc:jec), &
678+
Ice_ocean_boundary% u10_sqr (isc:iec,jsc:jec), &
672679
Ice_ocean_boundary% p (isc:iec,jsc:jec), &
673680
Ice_ocean_boundary% lrunoff_hflx (isc:iec,jsc:jec), &
674681
Ice_ocean_boundary% frunoff_hflx (isc:iec,jsc:jec), &
@@ -690,25 +697,32 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
690697
Ice_ocean_boundary%seaice_melt = 0.0
691698
Ice_ocean_boundary%seaice_melt_heat= 0.0
692699
Ice_ocean_boundary%mi = 0.0
700+
Ice_ocean_boundary%ice_fraction = 0.0
701+
Ice_ocean_boundary%u10_sqr = 0.0
693702
Ice_ocean_boundary%p = 0.0
694703
Ice_ocean_boundary%lrunoff_hflx = 0.0
695704
Ice_ocean_boundary%frunoff_hflx = 0.0
696705
Ice_ocean_boundary%lrunoff = 0.0
697706
Ice_ocean_boundary%frunoff = 0.0
698707

699-
call query_ocean_state(ocean_state, use_waves=use_waves)
708+
call query_ocean_state(ocean_state, use_waves=use_waves, wave_method=wave_method)
700709
if (use_waves) then
701710
call query_ocean_state(ocean_state, NumWaveBands=Ice_ocean_boundary%num_stk_bands)
702-
allocate ( Ice_ocean_boundary% ustk0 (isc:iec,jsc:jec), &
703-
Ice_ocean_boundary% vstk0 (isc:iec,jsc:jec), &
704-
Ice_ocean_boundary% ustkb (isc:iec,jsc:jec,Ice_ocean_boundary%num_stk_bands), &
705-
Ice_ocean_boundary% vstkb (isc:iec,jsc:jec,Ice_ocean_boundary%num_stk_bands), &
706-
Ice_ocean_boundary%stk_wavenumbers (Ice_ocean_boundary%num_stk_bands))
707-
Ice_ocean_boundary%ustk0 = 0.0
708-
Ice_ocean_boundary%vstk0 = 0.0
709-
call query_ocean_state(ocean_state, WaveNumbers=Ice_ocean_boundary%stk_wavenumbers, unscale=.true.)
710-
Ice_ocean_boundary%ustkb = 0.0
711-
Ice_ocean_boundary%vstkb = 0.0
711+
if (wave_method == "EFACTOR") then
712+
allocate( Ice_ocean_boundary%lamult(isc:iec,jsc:jec) )
713+
Ice_ocean_boundary%lamult = 0.0
714+
else
715+
allocate ( Ice_ocean_boundary% ustk0 (isc:iec,jsc:jec), &
716+
Ice_ocean_boundary% vstk0 (isc:iec,jsc:jec), &
717+
Ice_ocean_boundary% ustkb (isc:iec,jsc:jec,Ice_ocean_boundary%num_stk_bands), &
718+
Ice_ocean_boundary% vstkb (isc:iec,jsc:jec,Ice_ocean_boundary%num_stk_bands), &
719+
Ice_ocean_boundary%stk_wavenumbers (Ice_ocean_boundary%num_stk_bands))
720+
Ice_ocean_boundary%ustk0 = 0.0
721+
Ice_ocean_boundary%vstk0 = 0.0
722+
call query_ocean_state(ocean_state, WaveNumbers=Ice_ocean_boundary%stk_wavenumbers, unscale=.true.)
723+
Ice_ocean_boundary%ustkb = 0.0
724+
Ice_ocean_boundary%vstkb = 0.0
725+
endif
712726
endif
713727
! Consider adding this:
714728
! if (.not.use_waves) Ice_ocean_boundary%num_stk_bands = 0
@@ -722,18 +736,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
722736
call fld_list_add(fldsFrOcn_num, fldsFrOcn, trim(scalar_field_name), "will_provide")
723737
end if
724738

725-
if (cesm_coupled) then
726-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_lamult" , "will provide")
727-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_ustokes" , "will provide")
728-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_vstokes" , "will provide")
729-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_hstokes" , "will provide")
730-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Fioi_melth" , "will provide")
731-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "Fioi_meltw" , "will provide")
732-
!call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_fswpen" , "will provide")
733-
else
734-
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mass_of_overlying_sea_ice" , "will provide")
735-
!call fld_list_add(fldsFrOcn_num, fldsFrOcn, "sea_lev" , "will provide")
736-
endif
737739

738740
!--------- import fields -------------
739741
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_salt_rate" , "will provide") ! from ice
@@ -751,21 +753,27 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
751753
call fld_list_add(fldsToOcn_num, fldsToOcn, "inst_pres_height_surface" , "will provide")
752754
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofl" , "will provide") !-> liquid runoff
753755
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofi" , "will provide") !-> ice runoff
756+
call fld_list_add(fldsToOcn_num, fldsToOcn, "Si_ifrac" , "will provide") !-> ice fraction
757+
call fld_list_add(fldsToOcn_num, fldsToOcn, "So_duu10n" , "will provide") !-> wind^2 at 10m
754758
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_fresh_water_to_ocean_rate", "will provide")
755759
call fld_list_add(fldsToOcn_num, fldsToOcn, "net_heat_flx_to_ocn" , "will provide")
756760
!These are not currently used and changing requires a nuopc dictionary change
757761
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_runoff_heat_flx" , "will provide")
758762
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_calving_heat_flx" , "will provide")
759763
if (use_waves) then
760-
if (Ice_ocean_boundary%num_stk_bands > 3) then
761-
call MOM_error(FATAL, "Number of Stokes Bands > 3, NUOPC cap not set up for this")
764+
if (wave_method == "EFACTOR") then
765+
call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_lamult" , "will provide")
766+
else
767+
if (Ice_ocean_boundary%num_stk_bands > 3) then
768+
call MOM_error(FATAL, "Number of Stokes Bands > 3, NUOPC cap not set up for this")
769+
endif
770+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_1" , "will provide")
771+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_1", "will provide")
772+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_2" , "will provide")
773+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_2", "will provide")
774+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_3" , "will provide")
775+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_3", "will provide")
762776
endif
763-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_1" , "will provide")
764-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_1", "will provide")
765-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_2" , "will provide")
766-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_2", "will provide")
767-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_3" , "will provide")
768-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_3", "will provide")
769777
endif
770778

771779
!--------- export fields -------------
@@ -1103,7 +1111,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
11031111
k = k + 1 ! Increment position within gindex
11041112
if (mask(k) /= 0) then
11051113
mesh_areas(k) = dataPtr_mesh_areas(k)
1106-
model_areas(k) = ocean_grid%AreaT(i,j) / ocean_grid%Rad_Earth**2
1114+
model_areas(k) = ocean_grid%US%L_to_m**2 * ocean_grid%AreaT(i,j) / ocean_grid%Rad_Earth**2
11071115
mod2med_areacor(k) = model_areas(k) / mesh_areas(k)
11081116
med2mod_areacor(k) = mesh_areas(k) / model_areas(k)
11091117
end if

config_src/drivers/nuopc_cap/mom_cap_methods.F90

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,37 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
250250
!----
251251
! Note - preset values to 0, if field does not exist in importState, then will simply return
252252
! and preset value will be used
253-
254253
ice_ocean_boundary%mi(:,:) = 0._ESMF_KIND_R8
255254
call state_getimport(importState, 'mass_of_overlying_ice', &
256255
isc, iec, jsc, jec, ice_ocean_boundary%mi,rc=rc)
257256
if (ChkErr(rc,__LINE__,u_FILE_u)) return
258257

258+
!----
259+
! sea-ice fraction
260+
!----
261+
ice_ocean_boundary%ice_fraction(:,:) = 0._ESMF_KIND_R8
262+
call state_getimport(importState, 'Si_ifrac', &
263+
isc, iec, jsc, jec, ice_ocean_boundary%ice_fraction, rc=rc)
264+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
265+
266+
!----
267+
! 10m wind squared
268+
!----
269+
ice_ocean_boundary%u10_sqr(:,:) = 0._ESMF_KIND_R8
270+
call state_getimport(importState, 'So_duu10n', &
271+
isc, iec, jsc, jec, ice_ocean_boundary%u10_sqr, rc=rc)
272+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
273+
274+
!----
275+
! Langmuir enhancement factor
276+
!----
277+
if ( associated(ice_ocean_boundary%lamult) ) then
278+
ice_ocean_boundary%lamult (:,:) = 0._ESMF_KIND_R8
279+
call state_getimport(importState, 'Sw_lamult', &
280+
isc, iec, jsc, jec, ice_ocean_boundary%lamult, rc=rc)
281+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
282+
endif
283+
259284
!----
260285
! Partitioned Stokes Drift Components
261286
!----

config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ module MOM_ocean_model_nuopc
4141
use MOM_time_manager, only : operator(/=), operator(<=), operator(>=)
4242
use MOM_time_manager, only : operator(<), real_to_time_type, time_type_to_real
4343
use time_interp_external_mod,only : time_interp_external_init
44-
use MOM_tracer_flow_control, only : call_tracer_register, tracer_flow_control_init
4544
use MOM_tracer_flow_control, only : call_tracer_flux_init
4645
use MOM_unit_scaling, only : unit_scale_type
4746
use MOM_variables, only : surface
@@ -147,6 +146,7 @@ module MOM_ocean_model_nuopc
147146
integer :: nstep = 0 !< The number of calls to update_ocean.
148147
logical :: use_ice_shelf !< If true, the ice shelf model is enabled.
149148
logical,public :: use_waves !< If true use wave coupling.
149+
character(len=40) :: wave_method !< Wave coupling method.
150150

151151
logical :: icebergs_alter_ocean !< If true, the icebergs can change ocean the
152152
!! ocean dynamics and forcing fluxes.
@@ -242,14 +242,17 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
242242
!! tracer fluxes, and can be used to spawn related
243243
!! internal variables in the ice model.
244244
character(len=*), optional, intent(in) :: input_restart_file !< If present, name of restart file to read
245+
245246
! Local variables
246247
real :: Rho0 ! The Boussinesq ocean density, in kg m-3.
247248
real :: G_Earth ! The gravitational acceleration in m s-2.
248249
real :: HFrz !< If HFrz > 0 (m), melt potential will be computed.
249250
!! The actual depth over which melt potential is computed will
250251
!! min(HFrz, OBLD), where OBLD is the boundary layer depth.
251252
!! If HFrz <= 0 (default), melt potential will not be computed.
252-
logical :: use_melt_pot!< If true, allocate melt_potential array
253+
logical :: use_melt_pot !< If true, allocate melt_potential array
254+
logical :: use_CFC !< If true, allocated arrays for surface CFCs.
255+
253256

254257
! This include declares and sets the variable "version".
255258
#include "version_variable.h"
@@ -368,13 +371,17 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
368371
use_melt_pot=.false.
369372
endif
370373

374+
call get_param(param_file, mdl, "USE_CFC_CAP", use_CFC, &
375+
default=.false., do_not_log=.true.)
376+
371377
! Consider using a run-time flag to determine whether to do the diagnostic
372378
! vertical integrals, since the related 3-d sums are not negligible in cost.
373379
call allocate_surface_state(OS%sfc_state, OS%grid, use_temperature, &
374-
do_integrals=.true., gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot)
380+
do_integrals=.true., gas_fields_ocn=gas_fields_ocn, &
381+
use_meltpot=use_melt_pot, use_cfcs=use_CFC)
375382

376383
call surface_forcing_init(Time_in, OS%grid, OS%US, param_file, OS%diag, &
377-
OS%forcing_CSp, OS%restore_salinity, OS%restore_temp)
384+
OS%forcing_CSp, OS%restore_salinity, OS%restore_temp, OS%use_waves)
378385

379386
if (OS%use_ice_shelf) then
380387
call initialize_ice_shelf(param_file, OS%grid, OS%Time, OS%ice_shelf_CSp, &
@@ -386,8 +393,12 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
386393
call allocate_forcing_type(OS%grid, OS%fluxes, shelf=.true.)
387394
endif
388395

396+
call allocate_forcing_type(OS%grid, OS%fluxes, waves=.true.)
389397
call get_param(param_file, mdl, "USE_WAVES", OS%Use_Waves, &
390398
"If true, enables surface wave modules.", default=.false.)
399+
if (OS%Use_Waves) then
400+
call get_param(param_file, mdl, "WAVE_METHOD", OS%wave_method, default="EMPTY", do_not_log=.true.)
401+
endif
391402
! MOM_wave_interface_init is called regardless of the value of USE_WAVES because
392403
! it also initializes statistical waves.
393404
call MOM_wave_interface_init(OS%Time, OS%grid, OS%GV, OS%US, param_file, OS%Waves, OS%diag)
@@ -413,6 +424,8 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
413424

414425
endif
415426

427+
call extract_surface_state(OS%MOM_CSp, OS%sfc_state)
428+
416429
call close_param_file(param_file)
417430
call diag_mediator_close_registration(OS%diag)
418431

@@ -572,7 +585,9 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
572585
call set_net_mass_forcing(OS%fluxes, OS%forces, OS%grid, OS%US)
573586

574587
if (OS%use_waves) then
575-
call Update_Surface_Waves(OS%grid, OS%GV, OS%US, OS%time, ocean_coupling_time_step, OS%waves, OS%forces)
588+
if (OS%wave_method /= "EFACTOR") then
589+
call Update_Surface_Waves(OS%grid, OS%GV, OS%US, OS%time, ocean_coupling_time_step, OS%waves, OS%forces)
590+
endif
576591
endif
577592

578593
if (OS%nstep==0) then
@@ -1002,15 +1017,16 @@ end subroutine ocean_model_flux_init
10021017

10031018
!> This interface allows certain properties that are stored in the ocean_state_type to be
10041019
!! obtained.
1005-
subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale)
1020+
subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, wave_method)
10061021
type(ocean_state_type), intent(in) :: OS !< The structure with the complete ocean state
10071022
logical, optional, intent(out) :: use_waves !< Indicates whether surface waves are in use
10081023
integer, optional, intent(out) :: NumWaveBands !< If present, this gives the number of
10091024
!! wavenumber partitions in the wave discretization
10101025
real, dimension(:), optional, intent(out) :: Wavenumbers !< If present, this gives the characteristic
10111026
!! wavenumbers of the wave discretization [m-1 or Z-1 ~> m-1]
1012-
logical, optional, intent(in) :: unscale !< If present and true, undo any dimensional
1027+
logical, optional, intent(in) :: unscale !< If present and true, undo any dimensional
10131028
!! rescaling and return dimensional values in MKS units
1029+
character(len=40), optional, intent(out) :: wave_method !< Wave coupling method.
10141030

10151031
logical :: undo_scaling
10161032
undo_scaling = .false. ; if (present(unscale)) undo_scaling = unscale
@@ -1022,6 +1038,7 @@ subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale)
10221038
elseif (present(Wavenumbers)) then
10231039
call query_wave_properties(OS%Waves, WaveNumbers=WaveNumbers)
10241040
endif
1041+
if (present(wave_method)) wave_method = OS%wave_method
10251042

10261043
end subroutine query_ocean_state
10271044

0 commit comments

Comments
 (0)