Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments to stochastic physics stub #9

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module MOM_ocean_model_nuopc
!! processes before time stepping the dynamics.
logical :: do_sppt !< If true, stochastically perturb the diabatic and
!! write restarts
logical :: pert_epbl !< If true, then randomly perturb the KE dissipation and
logical :: pert_epbl !< If true, then randomly perturb the KE dissipation and
!! genration termsand write restarts

real :: eps_omesh !< Max allowable difference between ESMF mesh and MOM6
Expand Down
25 changes: 17 additions & 8 deletions config_src/external/stochastic_physics/stochastic_physics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ module stochastic_physics
subroutine init_stochastic_physics_ocn(delt,geoLonT,geoLatT,nx,ny,nz,pert_epbl_in,do_sppt_in, &
mpiroot, mpicomm, iret)
implicit none
real,intent(in) :: delt
integer,intent(in) :: nx,ny,nz
real,intent(in) :: geoLonT(nx,ny),geoLatT(nx,ny)
logical,intent(in) :: pert_epbl_in,do_sppt_in
integer,intent(in) :: mpiroot, mpicomm
integer, intent(out) :: iret
real,intent(in) :: delt !< timestep in seconds between calls to run_stochastic_physics_ocn
integer,intent(in) :: nx !< number of gridpoints in the x-direction of the compute grid
integer,intent(in) :: ny !< number of gridpoints in the y-direction of the compute grid
integer,intent(in) :: nz !< number of gridpoints in the z-direction of the compute grid
real,intent(in) :: geoLonT(nx,ny) !< Longitude in degrees
real,intent(in) :: geoLatT(nx,ny) !< Latitude in degrees
logical,intent(in) :: pert_epbl_in !< logical flag, if true generate random pattern for ePBL perturbations
logical,intent(in) :: do_sppt_in !< logical flag, if true generate random pattern for SPPT perturbations
integer,intent(in) :: mpiroot !< root processor
integer,intent(in) :: mpicomm !< mpi communicator
integer, intent(out) :: iret !< return code

iret=0
if (pert_epbl_in .EQV. .true. ) then
Expand All @@ -37,7 +42,11 @@ end subroutine init_stochastic_physics_ocn

subroutine run_stochastic_physics_ocn(sppt_wts,t_rp1,t_rp2)
implicit none
real, intent(inout) :: sppt_wts(:,:),t_rp1(:,:),t_rp2(:,:)
real, intent(inout) :: sppt_wts(:,:) !< array containing random weights for SPPT range [0,2]
real, intent(inout) :: t_rp1(:,:) !< array containing random weights for ePBL
!! perturbations (KE generation) range [0,2]
real, intent(inout) :: t_rp2(:,:) !< array containing random weights for ePBL
!! perturbations (KE dissipation) range [0,2]
return
end subroutine run_stochastic_physics_ocn

Expand All @@ -52,7 +61,7 @@ module get_stochy_pattern_mod
contains
subroutine write_stoch_restart_ocn(sfile)

character(len=*) :: sfile
character(len=*) :: sfile !< name of restart file
return
end subroutine write_stoch_restart_ocn

Expand Down
6 changes: 3 additions & 3 deletions src/parameterizations/stochastic/MOM_stochastics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subroutine stochastics_init(dt, grid, GV, CS, param_file, diag, Time)
integer :: num_procs ! number of processors to pass to stochastic physics
integer :: iret ! return code from stochastic physics
integer :: me ! my pe
integer :: master ! root pe
integer :: pe_zero ! root pe
integer :: nx ! number of x-points including halo
integer :: ny ! number of x-points including halo

Expand Down Expand Up @@ -95,11 +95,11 @@ subroutine stochastics_init(dt, grid, GV, CS, param_file, diag, Time)
num_procs=num_PEs()
allocate(pelist(num_procs))
call Get_PElist(pelist,commID = mom_comm)
master=root_PE()
pe_zero=root_PE()
nx = grid%ied - grid%isd + 1
ny = grid%jed - grid%jsd + 1
call init_stochastic_physics_ocn(dt,grid%geoLonT,grid%geoLatT,nx,ny,GV%ke, &
CS%pert_epbl,CS%do_sppt,master,mom_comm,iret)
CS%pert_epbl,CS%do_sppt,pe_zero,mom_comm,iret)
if (iret/=0) then
call MOM_error(FATAL, "call to init_stochastic_physics_ocn failed")
return
Expand Down