forked from mom-ocean/MOM6
-
Notifications
You must be signed in to change notification settings - Fork 20
Ocean stochastic physics #72
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
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
671c714
Merge pull request #1 from NOAA-EMC/dev/emc
pjpegion 182ef34
additions for stochastic physics and ePBL perts
c2aa2a8
updates from dev/emc
3cad1ba
Merge pull request #8 from NOAA-EMC/dev/emc
pjpegion 0a62737
Merge branch 'ocn_stoch' into dev/emc_merge
pjpegion 9896d61
Merge pull request #9 from pjpegion/dev/emc_merge
pjpegion cd06356
Merge pull request #11 from NOAA-EMC/dev/emc
pjpegion 7de295c
cleanup of code and enhancement of ePBL perts
pjpegion 7212400
Update MOM_diabatic_driver.F90
pjpegion bd477a9
Update MOM_diabatic_driver.F90
pjpegion 167a62e
Merge pull request #12 from pjpegion/dev/emc
pjpegion 0c15f4c
Update MOM_diabatic_driver.F90
pjpegion a2a374b
add stochy_restart writing to mom_cap
pjpegion 25ed5ef
additions for stochy restarts
pjpegion 4bd9b9e
clean up debug statements
pjpegion 1dc0f4f
Merge remote-tracking branch 'upstream/dev/emc' into dev/emc
pjpegion 2cba995
Merge branch 'dev/emc' into ocn_stoch
pjpegion 040e1f1
Merge pull request #13 from NOAA-EMC/dev/emc
pjpegion 1d7ffa3
clean up code
pjpegion 6bb9d0b
fix non stochastic ePBL calculation
pjpegion 600ebf9
Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
pjpegion 1727d9a
re-write of stochastic code to remove CPP directives
pjpegion 5443f8e
remove blank link in MOM_diagnostics
pjpegion 80f9f44
clean up MOM_domains
pjpegion 85023f8
Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
pjpegion 0b99c1f
make stochastics optional
pjpegion 6e3ea1b
correct coupled_driver/ocean_model_MOM.F90 and other cleanup
pjpegion eb88219
clean up of code for MOM6 coding standards
pjpegion d984a7e
remove stochastics container
pjpegion b8d9888
place stochastic array in fluxes container and make SPPT specific arr…
pjpegion 25ed4fc
revert MOM_domains.F90
pjpegion 8afe969
clean up of mom_ocean_model_nuopc.F90
pjpegion 689a73f
remove PE_here from mom_ocean_model_nuopc.F90
pjpegion a4c0411
Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
pjpegion 565e0bb
remove debug statements
pjpegion 61717ee
Merge remote-tracking branch 'origin/dev/emc' into ocn_stoch
pjpegion 202cbd4
update to dev/emc
pjpegion e4bc007
stochastic physics re-write
pjpegion a3fa3a1
Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch_july2021
pjpegion 8bc4acc
move stochastics to external directory
pjpegion bdf2dc7
doxygen cleanup
pjpegion c5f2b72
add write_stoch_restart_ocn to MOM_stochastics
pjpegion 5b2040e
add logic to remove incrments from restart if outside IAU window
pjpegion 1b4273d
revert logic wrt increments
pjpegion 237a510
add comments
pjpegion 16e6af0
update to dev/emc
pjpegion a8577df
Merge branch 'NOAA-EMC:dev/emc' into ocn_stoch_july2021
pjpegion ca2ae1c
update to dev/emc
pjpegion 56bb41e
Merge branch 'ocn_stoch_july2021' of https://github.com/pjpegion/MOM6…
pjpegion a9a957e
return a more accurate error message in MOM_stochasics
pjpegion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
config_src/external/OCEAN_stochastic_phyiscs/MOM_stochastics.F90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| !> Top-level module for the MOM6 ocean model in coupled mode. | ||
| module MOM_stochastics | ||
|
|
||
| ! This file is part of MOM6. See LICENSE.md for the license. | ||
|
|
||
| ! This is the top level module for the MOM6 ocean model. It contains routines | ||
| ! for initialization, update, and writing restart of stochastic physics. This | ||
| ! particular version wraps all of the calls for MOM6 in the calls that had | ||
| ! been used for MOM4. | ||
| ! | ||
| use MOM_diag_mediator, only : register_diag_field, diag_ctrl, time_type | ||
| use MOM_grid, only : ocean_grid_type | ||
| use MOM_verticalGrid, only : verticalGrid_type | ||
| use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe | ||
| use MOM_error_handler, only : callTree_enter, callTree_leave | ||
| use MOM_file_parser, only : get_param, log_version, close_param_file, param_file_type | ||
| use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain | ||
| use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain | ||
| use MOM_domains, only : root_PE,num_PEs | ||
| use MOM_coms, only : Get_PElist | ||
| use stochastic_physics, only : init_stochastic_physics_ocn, run_stochastic_physics_ocn | ||
| use get_stochy_pattern_mod, only: write_stoch_restart_ocn | ||
|
|
||
| #include <MOM_memory.h> | ||
|
|
||
| implicit none ; private | ||
|
|
||
| public stochastics_init, update_stochastics, write_mom_restart_stoch | ||
|
|
||
| !> This control structure holds parameters for the MOM_stochastics module | ||
| type, public:: stochastic_CS | ||
| logical :: do_sppt !< If true, stochastically perturb the diabatic | ||
| logical :: pert_epbl !! If true, then randomly perturb the KE dissipation and genration terms | ||
| integer :: id_sppt_wts = -1 | ||
| integer :: id_epbl1_wts=-1,id_epbl2_wts=-1 | ||
| ! stochastic patterns | ||
| real, allocatable :: sppt_wts(:,:) !< Random pattern for ocean SPPT | ||
| !! tendencies with a number between 0 and 2 | ||
| real, allocatable :: epbl1_wts(:,:) !< Random pattern for K.E. generation | ||
| real, allocatable :: epbl2_wts(:,:) !< Random pattern for K.E. dissipation | ||
| type(diag_ctrl), pointer :: diag !< structure used to regulate timing of diagnostic output | ||
| type(time_type), pointer :: Time !< Pointer to model time (needed for sponges) | ||
| end type stochastic_CS | ||
|
|
||
| contains | ||
|
|
||
| !! This subroutine initializes the stochastics physics control structure. | ||
| subroutine stochastics_init(dt, grid, GV, CS, param_file, diag, Time) | ||
| real, intent(in) :: dt !< time step [T ~> s] | ||
| type(ocean_grid_type), intent(in) :: grid ! horizontal grid information | ||
| type(verticalGrid_type), intent(in) :: GV ! vertical grid structure | ||
| type(stochastic_CS), pointer, intent(inout):: CS | ||
| type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters | ||
| type(diag_ctrl), target, intent(inout) :: diag !< structure to regulate diagnostic output | ||
| type(time_type), target :: Time !< model time | ||
| ! Local variables | ||
| integer,allocatable :: pelist(:) ! list of pes for this instance of the ocean | ||
| integer :: mom_comm ! list of pes for this instance of the ocean | ||
| 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 :: nx ! number of x-points including halo | ||
| integer :: ny ! number of x-points including halo | ||
|
|
||
| ! This include declares and sets the variable "version". | ||
| #include "version_variable.h" | ||
| character(len=40) :: mdl = "ocean_stochastics_init" ! This module's name. | ||
|
|
||
| call callTree_enter("ocean_model_stochastic_init(), MOM_stochastics.F90") | ||
| if (associated(CS)) then | ||
| call MOM_error(WARNING, "MOM_stochastics_init called with an "// & | ||
| "associated control structure.") | ||
jiandewang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return | ||
| else ; allocate(CS) ; endif | ||
|
|
||
| CS%diag => diag | ||
| CS%Time => Time | ||
|
|
||
| ! Read all relevant parameters and write them to the model log. | ||
| call log_version(param_file, mdl, version, "") | ||
|
|
||
| ! get number of processors and PE list for stocasthci physics initialization | ||
| call get_param(param_file, mdl, "DO_SPPT", CS%do_sppt, & | ||
| "If true, then stochastically perturb the thermodynamic "//& | ||
| "tendemcies of T,S, amd h. Amplitude and correlations are "//& | ||
| "controlled by the nam_stoch namelist in the UFS model only.", & | ||
| default=.false.) | ||
| call get_param(param_file, mdl, "PERT_EPBL", CS%pert_epbl, & | ||
| "If true, then stochastically perturb the kinetic energy "//& | ||
| "production and dissipation terms. Amplitude and correlations are "//& | ||
| "controlled by the nam_stoch namelist in the UFS model only.", & | ||
| default=.false.) | ||
| if (CS%do_sppt .OR. CS%pert_epbl) then | ||
| num_procs=num_PEs() | ||
| allocate(pelist(num_procs)) | ||
| call Get_PElist(pelist,commID = mom_comm) | ||
| master=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) | ||
| if (iret/=0) then | ||
| call MOM_error(FATAL, "call to init_stochastic_physics_ocn failed") | ||
| return | ||
| endif | ||
|
|
||
| if (CS%do_sppt) allocate(CS%sppt_wts(grid%isd:grid%ied,grid%jsd:grid%jed)) | ||
| if (CS%pert_epbl) then | ||
| allocate(CS%epbl1_wts(grid%isd:grid%ied,grid%jsd:grid%jed)) | ||
| allocate(CS%epbl2_wts(grid%isd:grid%ied,grid%jsd:grid%jed)) | ||
| endif | ||
| endif | ||
| CS%id_sppt_wts = register_diag_field('ocean_model', 'sppt_pattern', CS%diag%axesT1, Time, & | ||
| 'random pattern for sppt', 'None') | ||
| CS%id_epbl1_wts = register_diag_field('ocean_model', 'epbl1_wts', CS%diag%axesT1, Time, & | ||
| 'random pattern for KE generation', 'None') | ||
| CS%id_epbl2_wts = register_diag_field('ocean_model', 'epbl2_wts', CS%diag%axesT1, Time, & | ||
| 'random pattern for KE dissipation', 'None') | ||
|
|
||
| if (is_root_pe()) & | ||
| write(*,'(/12x,a/)') '=== COMPLETED MOM STOCHASTIC INITIALIZATION =====' | ||
|
|
||
| call callTree_leave("ocean_model_init(") | ||
| return | ||
| end subroutine stochastics_init | ||
|
|
||
| !> update_ocean_model uses the forcing in Ice_ocean_boundary to advance the | ||
| !! ocean model's state from the input value of Ocean_state (which must be for | ||
| !! time time_start_update) for a time interval of Ocean_coupling_time_step, | ||
| !! returning the publicly visible ocean surface properties in Ocean_sfc and | ||
| !! storing the new ocean properties in Ocean_state. | ||
| subroutine update_stochastics(CS) | ||
| type(stochastic_CS), intent(inout) :: CS !< diabatic control structure | ||
| call callTree_enter("update_stochastics(), MOM_stochastics.F90") | ||
|
|
||
| ! update stochastic physics patterns before running next time-step | ||
| call run_stochastic_physics_ocn(CS%sppt_wts,CS%epbl1_wts,CS%epbl2_wts) | ||
|
|
||
| return | ||
| end subroutine update_stochastics | ||
|
|
||
| !< wrapper to write ocean stochastic restarts | ||
| subroutine write_mom_restart_stoch(filename) | ||
| character(len=*) :: filename | ||
|
|
||
| call callTree_enter("write_mom_restart_stoch(), MOM_stochastics.F90") | ||
|
|
||
| call write_stoch_restart_ocn(filename) | ||
|
|
||
| return | ||
| end subroutine write_mom_restart_stoch | ||
|
|
||
| end module MOM_stochastics | ||
|
|
||
68 changes: 68 additions & 0 deletions
68
config_src/external/OCEAN_stochastic_phyiscs/MOM_stochastics_stub.F90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| !> Top-level module for the MOM6 ocean model in coupled mode. | ||
| module MOM_stochastics | ||
|
|
||
| ! This file is part of MOM6. See LICENSE.md for the license. | ||
|
|
||
| ! This is the top level module for the MOM6 ocean model. It contains | ||
| ! placeholder for initialization, update, and writing restarts of ocean stochastic physics. | ||
| ! The actualy stochastic physics is available at | ||
| ! https://github.com/ufs-community/ufs-weather-model | ||
| ! | ||
|
|
||
| use MOM_diag_mediator, only : register_diag_field, diag_ctrl, time_type | ||
| use MOM_grid, only : ocean_grid_type | ||
| use MOM_verticalGrid, only : verticalGrid_type | ||
| use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe | ||
| use MOM_error_handler, only : callTree_enter, callTree_leave | ||
| use MOM_file_parser, only : get_param, log_version, close_param_file, param_file_type | ||
| use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain | ||
| use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain | ||
| use MOM_domains, only : root_PE,num_PEs | ||
| use MOM_coms, only : Get_PElist | ||
|
|
||
| #include <MOM_memory.h> | ||
|
|
||
| implicit none ; private | ||
|
|
||
| public stochastics_init, update_stochastics | ||
|
|
||
| !> This control structure holds parameters for the MOM_stochastics module | ||
| type, public:: stochastic_CS | ||
| logical :: do_sppt !< If true, stochastically perturb the diabatic | ||
| logical :: pert_epbl !< If true, then randomly perturb the KE dissipation and genration terms | ||
| !>@{ Diagnostic IDs | ||
| integer :: id_sppt_wts = -1 | ||
| integer :: id_epbl1_wts=-1,id_epbl2_wts=-1 | ||
| !>@} | ||
| ! stochastic patterns | ||
| real, allocatable :: sppt_wts(:,:) !< Random pattern for ocean SPPT | ||
| !! tendencies with a number between 0 and 2 | ||
| real, allocatable :: epbl1_wts(:,:) !< Random pattern for K.E. generation | ||
| real, allocatable :: epbl2_wts(:,:) !< Random pattern for K.E. dissipation | ||
| type(diag_ctrl), pointer :: diag !< structure used to regulate timing of diagnostic output | ||
| type(time_type), pointer :: Time !< Pointer to model time (needed for sponges) | ||
| end type stochastic_CS | ||
|
|
||
| contains | ||
|
|
||
| subroutine stochastics_init(dt, grid, GV, CS, param_file, diag, Time) | ||
| real, intent(in) :: dt !< time step [T ~> s] | ||
| type(ocean_grid_type), intent(in) :: grid ! horizontal grid information | ||
| type(verticalGrid_type), intent(in) :: GV ! vertical grid structure | ||
| type(stochastic_CS), pointer, intent(inout):: CS | ||
| type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters | ||
| type(diag_ctrl), target, intent(inout) :: diag !< structure to regulate diagnostic output | ||
| type(time_type), target :: Time !< model time | ||
| return | ||
| end subroutine stochastics_init | ||
|
|
||
| subroutine update_stochastics(CS) | ||
| type(stochastic_CS), intent(inout) :: CS !< diabatic control structure | ||
| return | ||
| end subroutine update_stochastics | ||
| subroutine write_mom_restart_stoch(filename) | ||
| character(len=*) :: filename | ||
| return | ||
| end subroutine write_mom_restart_stoch | ||
| end module MOM_stochastics | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.