Skip to content

Commit d984a7e

Browse files
committed
remove stochastics container
1 parent 6e3ea1b commit d984a7e

7 files changed

Lines changed: 69 additions & 83 deletions

File tree

config_src/nuopc_driver/mom_ocean_model_nuopc.F90

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ module MOM_ocean_model_nuopc
4343
use MOM_tracer_flow_control, only : call_tracer_register, tracer_flow_control_init
4444
use MOM_tracer_flow_control, only : call_tracer_flux_init
4545
use MOM_unit_scaling, only : unit_scale_type
46-
use MOM_variables, only : surface, stochastic_pattern
46+
use MOM_variables, only : surface
4747
use MOM_verticalGrid, only : verticalGrid_type
4848
use MOM_ice_shelf, only : initialize_ice_shelf, shelf_calc_flux, ice_shelf_CS
4949
use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
5050
use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
5151
use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
5252
use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
5353
use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
54-
use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
54+
use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain,mpp_get_pelist
5555
use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
5656
use fms_mod, only : stdout
5757
use mpp_mod, only : mpp_chksum
@@ -62,7 +62,7 @@ module MOM_ocean_model_nuopc
6262
use MOM_surface_forcing_nuopc, only : convert_IOB_to_forces, ice_ocn_bnd_type_chksum
6363
use MOM_surface_forcing_nuopc, only : ice_ocean_boundary_type, surface_forcing_CS
6464
use MOM_surface_forcing_nuopc, only : forcing_save_restart
65-
use MOM_domains, only : root_PE,PE_here,Get_PElist,num_PEs
65+
use MOM_domains, only : root_PE,PE_here,num_PEs
6666
use stochastic_physics, only : init_stochastic_physics_ocn, run_stochastic_physics_ocn
6767

6868
#include <MOM_memory.h>
@@ -191,7 +191,6 @@ module MOM_ocean_model_nuopc
191191
!! timesteps are taken per thermodynamic step.
192192
type(surface) :: sfc_state !< A structure containing pointers to
193193
!! the ocean surface state fields.
194-
type(stochastic_pattern) :: stochastics !< A structure containing pointers to
195194
type(ocean_grid_type), pointer :: &
196195
grid => NULL() !< A pointer to a grid structure containing metrics
197196
!! and related information.
@@ -254,7 +253,6 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
254253
!! If HFrz <= 0 (default), melt potential will not be computed.
255254
logical :: use_melt_pot!< If true, allocate melt_potential array
256255
! stochastic physics
257-
integer,allocatable :: pelist(:) ! list of pes for this instance of the ocean
258256
integer :: mom_comm ! list of pes for this instance of the ocean
259257
integer :: num_procs ! number of processors to pass to stochastic physics
260258
integer :: iret ! return code from stochastic physics
@@ -441,8 +439,7 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
441439
default=.false.)
442440
if (OS%do_sppt .OR. OS%pert_epbl) then
443441
num_procs=num_PEs()
444-
allocate(pelist(num_procs))
445-
call Get_PElist(pelist,commID = mom_comm)
442+
call mpp_get_pelist(Ocean_sfc%domain, mom_comm)
446443
me=PE_here()
447444
master=root_PE()
448445

@@ -455,10 +452,10 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
455452
return
456453
endif
457454

458-
if (OS%do_sppt) allocate(OS%stochastics%sppt_wts(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
455+
if (OS%do_sppt) allocate(OS%fluxes%sppt_wts(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
459456
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))
457+
allocate(OS%fluxes%epbl1_wts(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
458+
allocate(OS%fluxes%epbl2_wts(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
462459
endif
463460
endif
464461
call close_param_file(param_file)
@@ -632,7 +629,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
632629

633630
! update stochastic physics patterns before running next time-step
634631
if (OS%do_sppt .OR. OS%pert_epbl ) then
635-
call run_stochastic_physics_ocn(OS%stochastics%sppt_wts,OS%stochastics%t_rp1,OS%stochastics%t_rp2)
632+
call run_stochastic_physics_ocn(OS%fluxes%sppt_wts,OS%fluxes%epbl1_wts,OS%fluxes%epbl2_wts)
636633
endif
637634

638635
if (OS%offline_tracer_mode) then
@@ -641,12 +638,11 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
641638
! The call sequence is being orchestrated from outside of update_ocean_model.
642639
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time1, dt_coupling, OS%MOM_CSp, &
643640
Waves=OS%Waves, do_dynamics=do_thermo, do_thermodynamics=do_dyn, &
644-
reset_therm=Ocn_fluxes_used, stochastics=OS%stochastics)
641+
reset_therm=Ocn_fluxes_used)
645642
!### What to do with these? , start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
646643

647644
elseif (OS%single_step_call) then
648-
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time1, dt_coupling, OS%MOM_CSp, Waves=OS%Waves, &
649-
stochastics=OS%stochastics)
645+
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time1, dt_coupling, OS%MOM_CSp, Waves=OS%Waves)
650646
else
651647
n_max = 1 ; if (dt_coupling > OS%dt) n_max = ceiling(dt_coupling/OS%dt - 0.001)
652648
dt_dyn = dt_coupling / real(n_max)
@@ -671,19 +667,16 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
671667
dtdia = dt_dyn*min(nts,n_max-(n-1))
672668
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time2, dtdia, OS%MOM_CSp, &
673669
Waves=OS%Waves, do_dynamics=.false., do_thermodynamics=.true., &
674-
start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling, &
675-
stochastics=OS%stochastics)
670+
start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
676671
endif
677672

678673
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time2, dt_dyn, OS%MOM_CSp, &
679674
Waves=OS%Waves, do_dynamics=.true., do_thermodynamics=.false., &
680-
start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling, &
681-
stochastics=OS%stochastics)
675+
start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling)
682676
else
683677
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time2, dt_dyn, OS%MOM_CSp, &
684678
Waves=OS%Waves, do_dynamics=.true., do_thermodynamics=.false., &
685-
start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling, &
686-
stochastics=OS%stochastics)
679+
start_cycle=(n==1), end_cycle=.false., cycle_length=dt_coupling)
687680

688681
step_thermo = .false.
689682
if (thermo_does_span_coupling) then
@@ -700,8 +693,8 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
700693
Time2 = Time2 - set_time(int(floor((dtdia - dt_dyn) + 0.5)))
701694
call step_MOM(OS%forces, OS%fluxes, OS%sfc_state, Time2, dtdia, OS%MOM_CSp, &
702695
Waves=OS%Waves, do_dynamics=.false., do_thermodynamics=.true., &
703-
start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling, &
704-
stochastics=OS%stochastics)
696+
start_cycle=.false., end_cycle=(n==n_max), cycle_length=dt_coupling)
697+
705698
endif
706699
endif
707700

src/core/MOM.F90

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ module MOM
418418
!! occur inside of diabatic.
419419
subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS, &
420420
Waves, do_dynamics, do_thermodynamics, start_cycle, &
421-
end_cycle, cycle_length, reset_therm, stochastics)
421+
end_cycle, cycle_length, reset_therm)
422422
type(mech_forcing), target, intent(inout) :: forces_in !< A structure with the driving mechanical forces
423423
type(forcing), target, intent(inout) :: fluxes_in !< A structure with pointers to themodynamic,
424424
!! tracer and mass exchange forcing fields
@@ -443,7 +443,6 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
443443
logical, optional, intent(in) :: reset_therm !< This indicates whether the running sums of
444444
!! thermodynamic quantities should be reset.
445445
!! If missing, this is like start_cycle.
446-
type(stochastic_pattern), optional, intent(in) :: stochastics !< random patternss for stochastics
447446

448447
! local variables
449448
type(ocean_grid_type), pointer :: G => NULL() ! pointer to a structure containing
@@ -704,8 +703,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
704703

705704
! Apply diabatic forcing, do mixing, and regrid.
706705
call step_MOM_thermo(CS, G, GV, US, u, v, h, CS%tv, fluxes, dtdia, &
707-
end_time_thermo, .true., Waves=Waves, &
708-
stochastics=stochastics)
706+
end_time_thermo, .true., Waves=Waves)
709707
CS%time_in_thermo_cycle = CS%time_in_thermo_cycle + dtdia
710708

711709
! The diabatic processes are now ahead of the dynamics by dtdia.
@@ -803,8 +801,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
803801

804802
! Apply diabatic forcing, do mixing, and regrid.
805803
call step_MOM_thermo(CS, G, GV, US, u, v, h, CS%tv, fluxes, dtdia, &
806-
Time_local, .false., Waves=Waves, &
807-
stochastics=stochastics)
804+
Time_local, .false., Waves=Waves)
808805
CS%time_in_thermo_cycle = CS%time_in_thermo_cycle + dtdia
809806

810807
if ((CS%t_dyn_rel_thermo==0.0) .and. .not.do_dyn) then
@@ -1212,7 +1209,7 @@ end subroutine step_MOM_tracer_dyn
12121209
!> MOM_step_thermo orchestrates the thermodynamic time stepping and vertical
12131210
!! remapping, via calls to diabatic (or adiabatic) and ALE_main.
12141211
subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
1215-
Time_end_thermo, update_BBL, Waves, stochastics)
1212+
Time_end_thermo, update_BBL, Waves)
12161213
type(MOM_control_struct), intent(inout) :: CS !< Master MOM control structure
12171214
type(ocean_grid_type), intent(inout) :: G !< ocean grid structure
12181215
type(verticalGrid_type), intent(inout) :: GV !< ocean vertical grid structure
@@ -1225,7 +1222,6 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
12251222
intent(inout) :: h !< layer thickness [H ~> m or kg m-2]
12261223
type(thermo_var_ptrs), intent(inout) :: tv !< A structure pointing to various thermodynamic variables
12271224
type(forcing), intent(inout) :: fluxes !< pointers to forcing fields
1228-
type(stochastic_pattern), intent(in) :: stochastics !< surface ocean state
12291225
real, intent(in) :: dtdia !< The time interval over which to advance [T ~> s]
12301226
type(time_type), intent(in) :: Time_end_thermo !< End of averaging interval for thermo diags
12311227
logical, intent(in) :: update_BBL !< If true, calculate the bottom boundary layer properties.
@@ -1288,8 +1284,7 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
12881284
call cpu_clock_begin(id_clock_diabatic)
12891285

12901286
call diabatic(u, v, h, tv, CS%Hml, fluxes, CS%visc, CS%ADp, CS%CDp, dtdia, &
1291-
Time_end_thermo, G, GV, US, CS%diabatic_CSp, OBC=CS%OBC, Waves=Waves, &
1292-
stochastics=stochastics)
1287+
Time_end_thermo, G, GV, US, CS%diabatic_CSp, OBC=CS%OBC, Waves=Waves)
12931288
fluxes%fluxes_used = .true.
12941289

12951290
if (showCallTree) call callTree_waypoint("finished diabatic (step_MOM_thermo)")

src/core/MOM_forcing_type.F90

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ module MOM_forcing_type
166166
!! exactly 0 away from shelves or on land.
167167
real, pointer, dimension(:,:) :: iceshelf_melt => NULL() !< Ice shelf melt rate (positive)
168168
!! or freezing (negative) [R Z T-1 ~> kg m-2 s-1]
169+
! stochastic patterns
170+
real, allocatable :: sppt_wts(:,:) !< Random pattern for ocean SPPT
171+
real, allocatable :: epbl1_wts(:,:) !< Random pattern for K.E. generation
172+
real, allocatable :: epbl2_wts(:,:) !< Random pattern for K.E. dissipation
169173

170174
! Scalars set by surface forcing modules
171175
real :: vPrecGlobalAdj = 0. !< adjustment to restoring vprec to zero out global net [kg m-2 s-1]

src/core/MOM_variables.F90

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,6 @@ module MOM_variables
269269

270270
!> Container for information about the summed layer transports
271271
!! and how they will vary as the barotropic velocity is changed.
272-
type, public :: stochastic_pattern
273-
real, allocatable :: sppt_wts(:,:) !< Random pattern for ocean SPPT
274-
real, allocatable :: t_rp1(:,:) !< Random pattern for K.E. generation
275-
real, allocatable :: t_rp2(:,:) !< Random pattern for K.E. dissipation
276-
end type stochastic_pattern
277272
type, public :: BT_cont_type
278273
real, allocatable :: FA_u_EE(:,:) !< The effective open face area for zonal barotropic transport
279274
!! drawing from locations far to the east [H L ~> m2 or kg m-1].

src/framework/MOM_domains.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module MOM_domains
3838

3939
public :: MOM_domains_init, MOM_infra_init, MOM_infra_end, get_domain_extent, get_domain_extent_dsamp2
4040
public :: MOM_define_domain, MOM_define_io_domain, clone_MOM_domain
41-
public :: pass_var, pass_vector, PE_here, root_PE, num_PEs, Get_PElist
41+
public :: pass_var, pass_vector, PE_here, root_PE, num_PEs
4242
public :: pass_var_start, pass_var_complete, fill_symmetric_edges, broadcast
4343
public :: pass_vector_start, pass_vector_complete
4444
public :: global_field_sum, sum_across_PEs, min_across_PEs, max_across_PEs

0 commit comments

Comments
 (0)