Skip to content

Commit

Permalink
Merge pull request #9 from pjpegion/EMC-stochastic-candidate-20211028
Browse files Browse the repository at this point in the history
add comments to stochastic physics stub
  • Loading branch information
jiandewang authored Dec 7, 2021
2 parents 808f72e + ceb2aef commit 6568deb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
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

0 comments on commit 6568deb

Please sign in to comment.