Skip to content

Enable SPPT with the MPAS dycore#97

Draft
gsketefian wants to merge 27 commits intoNOAA-PSL:masterfrom
dtcenter:gsl/MPAS_stoch_physics_try_merge_stoch_master
Draft

Enable SPPT with the MPAS dycore#97
gsketefian wants to merge 27 commits intoNOAA-PSL:masterfrom
dtcenter:gsl/MPAS_stoch_physics_try_merge_stoch_master

Conversation

@gsketefian
Copy link

@gsketefian gsketefian commented Mar 14, 2026

Description

This is the PR to enable stochastic_physics to use SPPT with the MPAS dycore, as described in Issue #94.

Note that I created a new branch in our (dtcenter) for of stochastic_physics named gsl/MPAS_stoch_physics_try_merge_stoch_master specifically for the PR. Once the PR is merged, we can merge the result back into gsl/MPAS_stoch_physics.

This code can be built under MPAS with make but not yet cmake. I did not have time to merge in Guoqing's cmake PRs (PR into stochastic_physics and PR into MPAS-Model) into our code.

Unfortunately I did not have time to create a parallel PR into the ufs-community/MPAS-Model repo. That needs to be created using the branch gsl/MPAS_stoch_physics_try_merge_stoch_master in our (dtcenter) fork of MPAS-Model. But I do have working code on hera at:

/scratch4/BMC/fv3lam/Gerard.Ketefian/DTC_WIW/mpas_app.try_merge_stoch_phys_master/src/MPAS-Model

(which itself is under mpas_app, but still valid). Feel free to look at that and/or clone the gsl/MPAS_stoch_physics_try_merge_stoch_master branches from our forks of stochastic_physics and MPAS-Model (and compare to master and gsl/develop, respectively; I still need to update our gsl/develop with the latest from ufs-community). I ran this code successfully on our CONUS 15km grid. The result is on hera at:

/scratch4/BMC/fv3lam/Gerard.Ketefian/DTC_WIW/expt_dirs/sppt_timing_tests/conus_15km_dt_060p0s_l1_0150km_ncores_0080/sppt_pat1_only_l1_0150km_spptint_0060sec_run01

I included new macros (FV3_STOCH and MPAS_STOCH) in this PR to indicate whether stochastic_physics is being used by FV3 or MPAS (see the new file macros.h that is now #included in several other files).

To enable running with FV3, the weather model must set -DFV3_STOCH in the build commands to indicate that stochastic_physics is being used with FV3. I have not tested this code with FV3, so even after -DFV3_STOCH is included, there may be other things that are broken with FV3. Similarly, during the MPAS-Model build, the flag -DMPAS_STOCH must be specified in the build commands so stochastic_physics knows it needs to be build for MPAS, not FV3. The -DMPAS_STOCH flag is now in the top-level Makefile in ufs-community:MPAS-Model (but as stated above, I haven't created the PR for those changes).

So, to-do's (in no particular order):

  • Include capability for cmake build.
  • Test with FV3.
  • Merge latest ufs-community:gsl/develop into dtcenter:gsl/develop. Then merge the resulting dtcenter:gsl/develop into dtcenter:gsl/MPAS_stoch_physics_try_merge_stoch_master. Finally, create a new PR into ufs-community/MPAS-Model:gsl/develop from dtcenter:gsl/MPAS_stoch_physics_try_merge_stoch_master.
  • @NingWang325 can you please add more comments here describing the changes, e.g. the new files being added and what they do?

I could not find Dustin's handle in this repo. If anyone knows, can you add him to the list below?

@JeffBeck-NOAA @NingWang325 @willmayfield @CPKalb

willmayfield and others added 27 commits October 9, 2024 17:31
changes to build stochastic physics with mpas
…osphere model.

This implementation assumes that each MPI task has only one block.
…ption to transform the pattern to

a bounded interval [-1.0, 1.0] , and to include a shift of the pattern’s mean from 0.0 to 1.0.

(These two computations were previously excluded for debugging purposes.)
…ted and no perturbation is applied.

Added sanity check for SPPT namelist variables; if their values are not set correctly, reset do_sppt to false.
Changed module name stochastic_physics_mpas to mpas_stochastic_physics.
…PT implementation.

If SPPTINT = 0 perturbation pattern advances every time step; if SPPTINT = t > 0 pattern advances after t seconds.
The tapering is specified with two namelist variables, config_sppt_hgt_top1 and config_sppt_hgt_top2;
the default values for the two variables are 15000 and 27000 meters respectively.

Fixed some logics for the SPPT seeds generation.
…ong with the Registry file that defines the namelist variables, was updated to allow for reading 8-byte integer values of namelist variables that are provided as character strings.

Replace print statements with mpas_log_write, and wrap debug/diag print statements with #ifdef directives.
… the "gsl/MPAS_stoch_physics_try_merge_stoch_master" branch. Details:

* Add new variable declarations needed in latest master branch.
* Remove some unneeded variable declarations.
* Add new subroutines needed in latest master branch.
* Add new arguments to existing subroutines and/or functions (some optional).
* Add some code modifications in if-statements required by latest "master" branch.
* Add new code for new optional argument "normalize".
* Limit kmax in k-loop for sppt tapering in PBL.
* Bug fix(es) from master branch.
* Add new file macros.h that defines preprocessor macros using macros defined via the -DMY_MACRO flag to the CPPFLAGS variable in the makefile of MPAS-Model.
… as the dycore; add back variable declarations that were accidentally removed during the merge of the master branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants