Skip to content

Commit ca2ae1c

Browse files
committed
update to dev/emc
2 parents 16e6af0 + 14ca4a1 commit ca2ae1c

21 files changed

Lines changed: 1287 additions & 254 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
@@ -424,6 +424,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
424424
logical :: isPresent, isPresentDiro, isPresentLogfile, isSet
425425
logical :: existflag
426426
logical :: use_waves ! If true, the wave modules are active.
427+
character(len=40) :: wave_method ! Wave coupling method.
427428
integer :: userRc
428429
integer :: localPet
429430
integer :: localPeCount
@@ -652,6 +653,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
652653
ocean_public%is_ocean_pe = .true.
653654
call ocean_model_init(ocean_public, ocean_state, time0, time_start, input_restart_file=trim(restartfiles))
654655

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

657662
call mpp_get_compute_domain(ocean_public%domain, isc, iec, jsc, jec)
@@ -671,6 +676,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
671676
Ice_ocean_boundary% seaice_melt_heat (isc:iec,jsc:jec),&
672677
Ice_ocean_boundary% seaice_melt (isc:iec,jsc:jec), &
673678
Ice_ocean_boundary% mi (isc:iec,jsc:jec), &
679+
Ice_ocean_boundary% ice_fraction (isc:iec,jsc:jec), &
680+
Ice_ocean_boundary% u10_sqr (isc:iec,jsc:jec), &
674681
Ice_ocean_boundary% p (isc:iec,jsc:jec), &
675682
Ice_ocean_boundary% lrunoff_hflx (isc:iec,jsc:jec), &
676683
Ice_ocean_boundary% frunoff_hflx (isc:iec,jsc:jec), &
@@ -692,25 +699,32 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
692699
Ice_ocean_boundary%seaice_melt = 0.0
693700
Ice_ocean_boundary%seaice_melt_heat= 0.0
694701
Ice_ocean_boundary%mi = 0.0
702+
Ice_ocean_boundary%ice_fraction = 0.0
703+
Ice_ocean_boundary%u10_sqr = 0.0
695704
Ice_ocean_boundary%p = 0.0
696705
Ice_ocean_boundary%lrunoff_hflx = 0.0
697706
Ice_ocean_boundary%frunoff_hflx = 0.0
698707
Ice_ocean_boundary%lrunoff = 0.0
699708
Ice_ocean_boundary%frunoff = 0.0
700709

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

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

740742
!--------- import fields -------------
741743
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_salt_rate" , "will provide") ! from ice
@@ -753,21 +755,27 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
753755
call fld_list_add(fldsToOcn_num, fldsToOcn, "inst_pres_height_surface" , "will provide")
754756
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofl" , "will provide") !-> liquid runoff
755757
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofi" , "will provide") !-> ice runoff
758+
call fld_list_add(fldsToOcn_num, fldsToOcn, "Si_ifrac" , "will provide") !-> ice fraction
759+
call fld_list_add(fldsToOcn_num, fldsToOcn, "So_duu10n" , "will provide") !-> wind^2 at 10m
756760
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_fresh_water_to_ocean_rate", "will provide")
757761
call fld_list_add(fldsToOcn_num, fldsToOcn, "net_heat_flx_to_ocn" , "will provide")
758762
!These are not currently used and changing requires a nuopc dictionary change
759763
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_runoff_heat_flx" , "will provide")
760764
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_calving_heat_flx" , "will provide")
761765
if (use_waves) then
762-
if (Ice_ocean_boundary%num_stk_bands > 3) then
763-
call MOM_error(FATAL, "Number of Stokes Bands > 3, NUOPC cap not set up for this")
766+
if (wave_method == "EFACTOR") then
767+
call fld_list_add(fldsToOcn_num, fldsToOcn, "Sw_lamult" , "will provide")
768+
else
769+
if (Ice_ocean_boundary%num_stk_bands > 3) then
770+
call MOM_error(FATAL, "Number of Stokes Bands > 3, NUOPC cap not set up for this")
771+
endif
772+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_1" , "will provide")
773+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_1", "will provide")
774+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_2" , "will provide")
775+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_2", "will provide")
776+
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_3" , "will provide")
777+
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_3", "will provide")
764778
endif
765-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_1" , "will provide")
766-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_1", "will provide")
767-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_2" , "will provide")
768-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_2", "will provide")
769-
call fld_list_add(fldsToOcn_num, fldsToOcn, "eastward_partitioned_stokes_drift_3" , "will provide")
770-
call fld_list_add(fldsToOcn_num, fldsToOcn, "northward_partitioned_stokes_drift_3", "will provide")
771779
endif
772780

773781
!--------- export fields -------------
@@ -1105,7 +1113,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
11051113
k = k + 1 ! Increment position within gindex
11061114
if (mask(k) /= 0) then
11071115
mesh_areas(k) = dataPtr_mesh_areas(k)
1108-
model_areas(k) = ocean_grid%AreaT(i,j) / ocean_grid%Rad_Earth**2
1116+
model_areas(k) = ocean_grid%US%L_to_m**2 * ocean_grid%AreaT(i,j) / ocean_grid%Rad_Earth**2
11091117
mod2med_areacor(k) = model_areas(k) / mesh_areas(k)
11101118
med2mod_areacor(k) = mesh_areas(k) / model_areas(k)
11111119
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: 23 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
@@ -149,6 +148,7 @@ module MOM_ocean_model_nuopc
149148
integer :: nstep = 0 !< The number of calls to update_ocean.
150149
logical :: use_ice_shelf !< If true, the ice shelf model is enabled.
151150
logical,public :: use_waves !< If true use wave coupling.
151+
character(len=40) :: wave_method !< Wave coupling method.
152152

153153
logical :: icebergs_alter_ocean !< If true, the icebergs can change ocean the
154154
!! ocean dynamics and forcing fluxes.
@@ -246,14 +246,17 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
246246
!! tracer fluxes, and can be used to spawn related
247247
!! internal variables in the ice model.
248248
character(len=*), optional, intent(in) :: input_restart_file !< If present, name of restart file to read
249+
249250
! Local variables
250251
real :: Rho0 ! The Boussinesq ocean density, in kg m-3.
251252
real :: G_Earth ! The gravitational acceleration in m s-2.
252253
real :: HFrz !< If HFrz > 0 (m), melt potential will be computed.
253254
!! The actual depth over which melt potential is computed will
254255
!! min(HFrz, OBLD), where OBLD is the boundary layer depth.
255256
!! If HFrz <= 0 (default), melt potential will not be computed.
256-
logical :: use_melt_pot!< If true, allocate melt_potential array
257+
logical :: use_melt_pot !< If true, allocate melt_potential array
258+
logical :: use_CFC !< If true, allocated arrays for surface CFCs.
259+
257260

258261
! This include declares and sets the variable "version".
259262
#include "version_variable.h"
@@ -372,13 +375,17 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
372375
use_melt_pot=.false.
373376
endif
374377

378+
call get_param(param_file, mdl, "USE_CFC_CAP", use_CFC, &
379+
default=.false., do_not_log=.true.)
380+
375381
! Consider using a run-time flag to determine whether to do the diagnostic
376382
! vertical integrals, since the related 3-d sums are not negligible in cost.
377383
call allocate_surface_state(OS%sfc_state, OS%grid, use_temperature, &
378-
do_integrals=.true., gas_fields_ocn=gas_fields_ocn, use_meltpot=use_melt_pot)
384+
do_integrals=.true., gas_fields_ocn=gas_fields_ocn, &
385+
use_meltpot=use_melt_pot, use_cfcs=use_CFC)
379386

380387
call surface_forcing_init(Time_in, OS%grid, OS%US, param_file, OS%diag, &
381-
OS%forcing_CSp, OS%restore_salinity, OS%restore_temp)
388+
OS%forcing_CSp, OS%restore_salinity, OS%restore_temp, OS%use_waves)
382389

383390
if (OS%use_ice_shelf) then
384391
call initialize_ice_shelf(param_file, OS%grid, OS%Time, OS%ice_shelf_CSp, &
@@ -390,8 +397,12 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
390397
call allocate_forcing_type(OS%grid, OS%fluxes, shelf=.true.)
391398
endif
392399

400+
call allocate_forcing_type(OS%grid, OS%fluxes, waves=.true.)
393401
call get_param(param_file, mdl, "USE_WAVES", OS%Use_Waves, &
394402
"If true, enables surface wave modules.", default=.false.)
403+
if (OS%Use_Waves) then
404+
call get_param(param_file, mdl, "WAVE_METHOD", OS%wave_method, default="EMPTY", do_not_log=.true.)
405+
endif
395406
! MOM_wave_interface_init is called regardless of the value of USE_WAVES because
396407
! it also initializes statistical waves.
397408
call MOM_wave_interface_init(OS%Time, OS%grid, OS%GV, OS%US, param_file, OS%Waves, OS%diag)
@@ -428,6 +439,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
428439
"production and dissipation terms. Amplitude and correlations are "//&
429440
"controlled by the nam_stoch namelist in the UFS model only.", &
430441
default=.false.)
442+
call extract_surface_state(OS%MOM_CSp, OS%sfc_state)
431443

432444
call close_param_file(param_file)
433445
call diag_mediator_close_registration(OS%diag)
@@ -588,7 +600,9 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
588600
call set_net_mass_forcing(OS%fluxes, OS%forces, OS%grid, OS%US)
589601

590602
if (OS%use_waves) then
591-
call Update_Surface_Waves(OS%grid, OS%GV, OS%US, OS%time, ocean_coupling_time_step, OS%waves, OS%forces)
603+
if (OS%wave_method /= "EFACTOR") then
604+
call Update_Surface_Waves(OS%grid, OS%GV, OS%US, OS%time, ocean_coupling_time_step, OS%waves, OS%forces)
605+
endif
592606
endif
593607

594608
if (OS%nstep==0) then
@@ -1018,15 +1032,16 @@ end subroutine ocean_model_flux_init
10181032

10191033
!> This interface allows certain properties that are stored in the ocean_state_type to be
10201034
!! obtained.
1021-
subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale)
1035+
subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, wave_method)
10221036
type(ocean_state_type), intent(in) :: OS !< The structure with the complete ocean state
10231037
logical, optional, intent(out) :: use_waves !< Indicates whether surface waves are in use
10241038
integer, optional, intent(out) :: NumWaveBands !< If present, this gives the number of
10251039
!! wavenumber partitions in the wave discretization
10261040
real, dimension(:), optional, intent(out) :: Wavenumbers !< If present, this gives the characteristic
10271041
!! wavenumbers of the wave discretization [m-1 or Z-1 ~> m-1]
1028-
logical, optional, intent(in) :: unscale !< If present and true, undo any dimensional
1042+
logical, optional, intent(in) :: unscale !< If present and true, undo any dimensional
10291043
!! rescaling and return dimensional values in MKS units
1044+
character(len=40), optional, intent(out) :: wave_method !< Wave coupling method.
10301045

10311046
logical :: undo_scaling
10321047
undo_scaling = .false. ; if (present(unscale)) undo_scaling = unscale
@@ -1038,6 +1053,7 @@ subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale)
10381053
elseif (present(Wavenumbers)) then
10391054
call query_wave_properties(OS%Waves, WaveNumbers=WaveNumbers)
10401055
endif
1056+
if (present(wave_method)) wave_method = OS%wave_method
10411057

10421058
end subroutine query_ocean_state
10431059

0 commit comments

Comments
 (0)