@@ -29,6 +29,7 @@ module MOM
2929use MOM_domains, only : To_All, Omit_corners, CGRID_NE, SCALAR_PAIR
3030use MOM_domains, only : create_group_pass, do_group_pass, group_pass_type
3131use MOM_domains, only : start_group_pass, complete_group_pass, Omit_Corners
32+ use MOM_domains, only : root_PE,PE_here,Get_PElist,num_PEs
3233use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
3334use MOM_error_handler, only : MOM_set_verbosity, callTree_showQuery
3435use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
@@ -141,6 +142,7 @@ module MOM
141142use MOM_offline_main, only : offline_fw_fluxes_into_ocean, offline_fw_fluxes_out_ocean
142143use MOM_offline_main, only : offline_advection_layer, offline_transport_end
143144use MOM_ALE, only : ale_offline_tracer_final, ALE_main_offline
145+ use stochastic_physics, only : init_stochastic_physics_ocn,run_stochastic_physics_ocn
144146
145147implicit none ; private
146148
@@ -227,6 +229,8 @@ module MOM
227229 logical :: offline_tracer_mode = .false.
228230 ! < If true, step_offline() is called instead of step_MOM().
229231 ! ! This is intended for running MOM6 in offline tracer mode
232+ logical :: do_stochy = .false.
233+ ! < If true, call stochastic physics pattern generator
230234
231235 type (time_type), pointer :: Time ! < pointer to the ocean clock
232236 real :: dt ! < (baroclinic) dynamics time step [T ~> s]
@@ -757,6 +761,9 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
757761 enddo ; enddo
758762 endif
759763
764+ print * ,' calling run_stochastic_physics_ocn' ,CS% do_stochy
765+ if (CS% do_stochy) call run_stochastic_physics_ocn(forces% t_rp)
766+
760767 call step_MOM_dynamics(forces, CS% p_surf_begin, CS% p_surf_end, dt, &
761768 dt_therm_here, bbl_time_int, CS, &
762769 Time_local, Waves= Waves)
@@ -904,7 +911,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
904911 if (CS% time_in_thermo_cycle > 0.0 ) then
905912 call enable_averages(CS% time_in_thermo_cycle, Time_local, CS% diag)
906913 call post_surface_thermo_diags(CS% sfc_IDs, G, GV, US, CS% diag, CS% time_in_thermo_cycle, &
907- sfc_state_diag, CS% tv, ssh, CS% ave_ssh_ibc)
914+ sfc_state_diag, CS% tv, ssh,fluxes % t_rp, CS% ave_ssh_ibc)
908915 endif
909916 call disable_averaging(CS% diag)
910917 call cpu_clock_end(id_clock_diagnostics)
@@ -1672,6 +1679,11 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
16721679 integer :: nkml, nkbl, verbosity, write_geom
16731680 integer :: dynamics_stencil ! The computational stencil for the calculations
16741681 ! in the dynamic core.
1682+ integer ,allocatable :: pelist(:) ! list of pes for this instance of the ocean
1683+ integer :: num_procs
1684+ ! model
1685+ integer :: me ! my pe
1686+ integer :: master ! root pe
16751687 real :: conv2watt, conv2salt
16761688 real :: RL2_T2_rescale, Z_rescale, QRZ_rescale ! Unit conversion factors
16771689 character (len= 48 ) :: flux_units, S_flux_units
@@ -2328,6 +2340,17 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
23282340 call copy_dyngrid_to_MOM_grid(dG_in, G_in, US)
23292341 call destroy_dyn_horgrid(dG_in)
23302342
2343+ num_procs= num_PEs()
2344+ allocate (pelist(num_procs))
2345+ call Get_PElist(pelist)
2346+ me= PE_here()
2347+ master= root_PE()
2348+
2349+ ! call init_stochastic_physics_ocn(CS%dt_therm,G,me,master,pelist,CS%do_stochy)
2350+ print * ,' callling init_stochastic_physics_ocn' ,maxval (G% geoLatT)
2351+ 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)
2352+ print * ,' back from init_stochastic_physics_ocn' ,CS% do_stochy
2353+
23312354 ! Set a few remaining fields that are specific to the ocean grid type.
23322355 call set_first_direction(G, first_direction)
23332356 ! Allocate the auxiliary non-symmetric domain for debugging or I/O purposes.
0 commit comments