@@ -176,6 +176,8 @@ module MOM_ocean_model_nuopc
176176 ! ! steps can span multiple coupled time steps.
177177 logical :: diabatic_first ! < If true, apply diabatic and thermodynamic
178178 ! ! processes before time stepping the dynamics.
179+ logical :: do_sppt ! < If true, allocate array for SPPT
180+ logical :: pert_epbl ! < If true, allocate arrays for energetic PBL perturbations
179181
180182 real :: eps_omesh ! < Max allowable difference between ESMF mesh and MOM6
181183 ! ! domain coordinates
@@ -426,20 +428,38 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
426428
427429 endif
428430
429- num_procs= num_PEs()
430- allocate (pelist(num_procs))
431- call Get_PElist(pelist,commID = mom_comm)
432- me= PE_here()
433- master= root_PE()
434-
435- call init_stochastic_physics_ocn(OS% dt_therm,OS% grid% geoLonT,OS% grid% geoLatT,OS% grid% ied- OS% grid% isd+1 ,OS% grid% jed- OS% grid% jsd+1 ,OS% grid% ke,&
436- OS% stochastics% pert_epbl,OS% stochastics% do_sppt,master,mom_comm,iret)
437- print * ,' after init_stochastic_physics_ocn' ,OS% stochastics% pert_epbl,OS% stochastics% do_sppt
438-
439- if (OS% stochastics% do_sppt) allocate (OS% stochastics% sppt_wts(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
440- if (OS% stochastics% pert_epbl) then
441- allocate (OS% stochastics% t_rp1(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
442- allocate (OS% stochastics% t_rp2(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
431+ ! get number of processors and PE list for stocasthci physics initialization
432+ call get_param(param_file, mdl, " DO_SPPT" , OS% do_sppt, &
433+ " If true, then stochastically perturb the thermodynamic " // &
434+ " tendemcies of T,S, amd h. Amplitude and correlations are " // &
435+ " controlled by the nam_stoch namelist in the UFS model only." , &
436+ default= .false. )
437+ call get_param(param_file, mdl, " PERT_EPBL" , OS% pert_epbl, &
438+ " If true, then stochastically perturb the kinetic energy " // &
439+ " production and dissipation terms. Amplitude and correlations are " // &
440+ " controlled by the nam_stoch namelist in the UFS model only." , &
441+ default= .false. )
442+ if (OS% do_sppt .OR. OS% pert_epbl) then
443+ num_procs= num_PEs()
444+ allocate (pelist(num_procs))
445+ call Get_PElist(pelist,commID = mom_comm)
446+ me= PE_here()
447+ master= root_PE()
448+
449+ call init_stochastic_physics_ocn(OS% dt_therm,OS% grid% geoLonT,OS% grid% geoLatT,OS% grid% ied- OS% grid% isd+1 ,OS% grid% jed- OS% grid% jsd+1 ,OS% grid% ke,&
450+ OS% pert_epbl,OS% do_sppt,master,mom_comm,iret)
451+ if (iret/= 0 ) then
452+ write (6 ,* ) ' call to init_stochastic_physics_ocn failed'
453+ call MOM_error(FATAL, " stochastic physics in enambled in MOM6 but " // &
454+ " not activated in stochastic_physics namelist " )
455+ return
456+ endif
457+
458+ if (OS% do_sppt) allocate (OS% stochastics% sppt_wts(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
459+ if (OS% pert_epbl) then
460+ allocate (OS% stochastics% t_rp1(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
461+ allocate (OS% stochastics% t_rp2(OS% grid% isd:OS% grid% ied,OS% grid% jsd:OS% grid% jed))
462+ endif
443463 endif
444464 call close_param_file(param_file)
445465 call diag_mediator_close_registration(OS% diag)
@@ -611,22 +631,22 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
611631 Master_time = OS% Time ; Time1 = OS% Time
612632
613633! update stochastic physics patterns before running next time-step
614- print * ,' before call to stoch' ,OS% stochastics% do_sppt .OR. OS% stochastics% pert_epbl
615- if (OS% stochastics% do_sppt .OR. OS% stochastics% pert_epbl ) then
634+ if (OS% do_sppt .OR. OS% pert_epbl ) then
616635 call run_stochastic_physics_ocn(OS% stochastics% sppt_wts,OS% stochastics% t_rp1,OS% stochastics% t_rp2)
617636 endif
618637
619638 if (OS% offline_tracer_mode) then
620639 call step_offline(OS% forces, OS% fluxes, OS% sfc_state, Time1, dt_coupling, OS% MOM_CSp)
621640 elseif ((.not. do_thermo) .or. (.not. do_dyn)) then
622641 ! The call sequence is being orchestrated from outside of update_ocean_model.
623- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS % stochastics, Time1, dt_coupling, OS% MOM_CSp, &
642+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time1, dt_coupling, OS% MOM_CSp, &
624643 Waves= OS% Waves, do_dynamics= do_thermo, do_thermodynamics= do_dyn, &
625- reset_therm= Ocn_fluxes_used)
644+ reset_therm= Ocn_fluxes_used, stochastics = OS % stochastics )
626645 ! ### What to do with these? , start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
627646
628647 elseif (OS% single_step_call) then
629- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS% stochastics, Time1, dt_coupling, OS% MOM_CSp, Waves= OS% Waves)
648+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time1, dt_coupling, OS% MOM_CSp, Waves= OS% Waves, &
649+ stochastics= OS% stochastics)
630650 else
631651 n_max = 1 ; if (dt_coupling > OS% dt) n_max = ceiling (dt_coupling/ OS% dt - 0.001 )
632652 dt_dyn = dt_coupling / real (n_max)
@@ -649,18 +669,21 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
649669 " THERMO_SPANS_COUPLING and DIABATIC_FIRST." )
650670 if (modulo (n-1 ,nts)==0 ) then
651671 dtdia = dt_dyn* min (nts,n_max- (n-1 ))
652- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS % stochastics, Time2, dtdia, OS% MOM_CSp, &
672+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time2, dtdia, OS% MOM_CSp, &
653673 Waves= OS% Waves, do_dynamics= .false. , do_thermodynamics= .true. , &
654- start_cycle= (n== 1 ), end_cycle= .false. , cycle_length= dt_coupling)
674+ start_cycle= (n== 1 ), end_cycle= .false. , cycle_length= dt_coupling, &
675+ stochastics= OS% stochastics)
655676 endif
656677
657- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS % stochastics, Time2, dt_dyn, OS% MOM_CSp, &
678+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time2, dt_dyn, OS% MOM_CSp, &
658679 Waves= OS% Waves, do_dynamics= .true. , do_thermodynamics= .false. , &
659- start_cycle= .false. , end_cycle= (n== n_max), cycle_length= dt_coupling)
680+ start_cycle= .false. , end_cycle= (n== n_max), cycle_length= dt_coupling, &
681+ stochastics= OS% stochastics)
660682 else
661- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS % stochastics, Time2, dt_dyn, OS% MOM_CSp, &
683+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time2, dt_dyn, OS% MOM_CSp, &
662684 Waves= OS% Waves, do_dynamics= .true. , do_thermodynamics= .false. , &
663- start_cycle= (n== 1 ), end_cycle= .false. , cycle_length= dt_coupling)
685+ start_cycle= (n== 1 ), end_cycle= .false. , cycle_length= dt_coupling, &
686+ stochastics= OS% stochastics)
664687
665688 step_thermo = .false.
666689 if (thermo_does_span_coupling) then
@@ -675,9 +698,10 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
675698 if (step_thermo) then
676699 ! Back up Time2 to the start of the thermodynamic segment.
677700 Time2 = Time2 - set_time(int (floor ((dtdia - dt_dyn) + 0.5 )))
678- call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, OS % stochastics, Time2, dtdia, OS% MOM_CSp, &
701+ call step_MOM(OS% forces, OS% fluxes, OS% sfc_state, Time2, dtdia, OS% MOM_CSp, &
679702 Waves= OS% Waves, do_dynamics= .false. , do_thermodynamics= .true. , &
680- start_cycle= .false. , end_cycle= (n== n_max), cycle_length= dt_coupling)
703+ start_cycle= .false. , end_cycle= (n== n_max), cycle_length= dt_coupling, &
704+ stochastics= OS% stochastics)
681705 endif
682706 endif
683707
0 commit comments