@@ -27,6 +27,7 @@ module MOM
2727use MOM_domains, only : To_All, Omit_corners, CGRID_NE, SCALAR_PAIR
2828use MOM_domains, only : create_group_pass, do_group_pass, group_pass_type
2929use MOM_domains, only : start_group_pass, complete_group_pass, Omit_Corners
30+ use MOM_domains, only : root_PE,PE_here,Get_PElist,num_PEs
3031use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
3132use MOM_error_handler, only : MOM_set_verbosity, callTree_showQuery
3233use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
@@ -130,6 +131,7 @@ module MOM
130131use MOM_offline_main, only : offline_fw_fluxes_into_ocean, offline_fw_fluxes_out_ocean
131132use MOM_offline_main, only : offline_advection_layer, offline_transport_end
132133use MOM_ALE, only : ale_offline_tracer_final, ALE_main_offline
134+ use stochastic_physics, only : init_stochastic_physics_ocn,run_stochastic_physics_ocn
133135
134136implicit none ; private
135137
@@ -212,6 +214,8 @@ module MOM
212214 logical :: offline_tracer_mode = .false.
213215 ! < If true, step_offline() is called instead of step_MOM().
214216 ! ! This is intended for running MOM6 in offline tracer mode
217+ logical :: do_stochy = .false.
218+ ! < If true, call stochastic physics pattern generator
215219
216220 type (time_type), pointer :: Time ! < pointer to the ocean clock
217221 real :: dt ! < (baroclinic) dynamics time step [s]
@@ -703,6 +707,9 @@ subroutine step_MOM(forces, fluxes, sfc_state, Time_start, time_interval, CS, &
703707 enddo ; enddo
704708 endif
705709
710+ print * ,' calling run_stochastic_physics_ocn' ,CS% do_stochy
711+ if (CS% do_stochy) call run_stochastic_physics_ocn(forces% t_rp)
712+
706713 call step_MOM_dynamics(forces, CS% p_surf_begin, CS% p_surf_end, dt, &
707714 dt_therm_here, bbl_time_int, CS, &
708715 Time_local, Waves= Waves)
@@ -843,7 +850,7 @@ subroutine step_MOM(forces, fluxes, sfc_state, Time_start, time_interval, CS, &
843850 if (CS% time_in_thermo_cycle > 0.0 ) then
844851 call enable_averaging(CS% time_in_thermo_cycle, Time_local, CS% diag)
845852 call post_surface_thermo_diags(CS% sfc_IDs, G, GV, US, CS% diag, CS% time_in_thermo_cycle, &
846- sfc_state, CS% tv, ssh, CS% ave_ssh_ibc)
853+ sfc_state, CS% tv, ssh, fluxes % t_rp, CS% ave_ssh_ibc)
847854 endif
848855 call disable_averaging(CS% diag)
849856 call cpu_clock_end(id_clock_diagnostics)
@@ -1580,6 +1587,11 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
15801587 integer :: nkml, nkbl, verbosity, write_geom
15811588 integer :: dynamics_stencil ! The computational stencil for the calculations
15821589 ! in the dynamic core.
1590+ integer ,allocatable :: pelist(:) ! list of pes for this instance of the ocean
1591+ integer :: num_procs
1592+ ! model
1593+ integer :: me ! my pe
1594+ integer :: master ! root pe
15831595 real :: conv2watt, conv2salt
15841596 character (len= 48 ) :: flux_units, S_flux_units
15851597
@@ -2146,6 +2158,17 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
21462158 call copy_dyngrid_to_MOM_grid(dG, G, US)
21472159 call destroy_dyn_horgrid(dG)
21482160
2161+ num_procs= num_PEs()
2162+ allocate (pelist(num_procs))
2163+ call Get_PElist(pelist)
2164+ me= PE_here()
2165+ master= root_PE()
2166+
2167+ ! call init_stochastic_physics_ocn(CS%dt_therm,G,me,master,pelist,CS%do_stochy)
2168+ print * ,' callling init_stochastic_physics_ocn' ,maxval (G% geoLatT)
2169+ call init_stochastic_physics_ocn(CS% dt_therm,G% geoLonT,G% geoLatT,G% ied- G% isd+1 ,G% jed- G% jsd+1 ,nz,CS% do_stochy)
2170+ print * ,' back from init_stochastic_physics_ocn' ,CS% do_stochy
2171+
21492172 ! Set a few remaining fields that are specific to the ocean grid type.
21502173 call set_first_direction(G, first_direction)
21512174 ! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
0 commit comments