Merge stochastic physics (SPPT only) into GSL's develop branch#239
Merge stochastic physics (SPPT only) into GSL's develop branch#239gsketefian wants to merge 44 commits intoufs-community:gsl/developfrom
Conversation
…he stochastic_physics submodule itself will be added in a separate commit.
…'t updated during latest merge of gsl/develop.
…he gsl/MPAS_stoch_physics in the stochastic_physics repo.
…teger seed workaround.
… smoke) from "output" to "output_smoke" (and file from "history..." to "history_smoke...". This is necessary because the stream name "output" is already taken by the main output stream, and having the same name for two different output streams apparently causes SMIOL I/O errors during the forecast (and incorrect/corrupted history*.nc files).
…) no stale stream_list.atmosphere files exist in the two default_inputs directories (one under core_atmosphere and the other immediately under the MPAS-Model top-level directory), and (2) for the atmosphere core, all files (stream-related as well as namelist) in the top-level directory are backed up before new such files are copied from the default_inputs directory back up a level into the top-level directory. Previously, existing (and thus possibly outdated) stream_list.atmosphere.* files in the top-level directory were not being replaced by newer ones in default_inputs, and that was causing unexpected (and wrong) behavior. Probably a similar fix is needed for the init_atmsophere core and maybe even other ones.
…ll as its output file) so it doesn't conflict with the default output stream.
…tochastic_physics's master branh will gradually happen.
…/MPAS_stoch_physics_try_merge_stoch_master
…tochastic_physics code know that the dycore being used is MPAS.
…ill instead be defined in the Makefile for stochastic_physics only (in a separate commit into the stochastic_physics repo) since it is only needed by the stochastic_physics submodule.
…e that is now added in the Makefile in stochastic_physics).
…s the TEMPO tables.
…the top level of MPAS-Model.
| @@ -65,7 +65,8 @@ core_physics_mmm: core_physics_init | |||
| (cd physics_mmm; $(MAKE) -f Makefile.mpas all) | |||
|
|
|||
| core_microphysics: core_physics_init core_physics_mmm | |||
There was a problem hiding this comment.
Changes in first line are to copy ccn_activate.bin into the top-level MPAS-Model directory, just as other microphysics files are copied there during a make invocation (e.g. MP_THOMPSON_*).
|
|
||
| core_microphysics: core_physics_init core_physics_mmm | ||
| (cd physics_noaa/TEMPO; $(MAKE) -f Makefile.mpas) | ||
| (cd physics_noaa/TEMPO; $(MAKE) -f Makefile.mpas; cp tables/ccn_activate.bin ../../../../../) |
There was a problem hiding this comment.
The following new line builds TEMPO's run_build_tables executable, which is needed to generate the tables for TEMPO. This is similar to the building of the build_tables executable for THOMPSON microphysics.
Not sure why this wasn't originally included. Also, not sure if this work with all machines and compilers, but it works on Hera.
There was a problem hiding this comment.
@clark-evans Not sure if you're the right person to ask this. If not, please let me know who to ask (Anders?).
I'm wondering why the original version of this Makefile does not build the executable for generating the TEMPO MP tables. I tried to include it via this line, but it is failing during CI testing because the sub-makefile called (Makefile.intel) is apparently only for intel, but one of the CI tests is with gnu FORTRAN.
Without this executable (named run_build_tables) a user will not be able to generate the tables needed to run MPAS with TEMPO. Note that an executable for generating tables for THOMPSON MP (named build_tables) is generated during the make, so it would be nice to have one for TEMPO as well.
I will comment out this line for now so the CI tests can proceed, but it would be nice to understand why building run_build_tables (regardless of compiler) is not part of the original Makefile.
There was a problem hiding this comment.
Hi @gsketefian -- I think this is handled in src/core_atmosphere/utils/Makefile, where directives for compiling build_tables_tempo are provided alongside those for build_tables. This is called when core_atmosphere is built.
Tagging @AndersJensen-NOAA to correct me in case I'm wrong, though...
There was a problem hiding this comment.
@clark-evans @AndersJensen-NOAA As far as I can tell, that Makefile builds the executable for Thompson MP but not the one for TEMPO, probably intentionally. In my build log, I can see the fortran files for Thompson (atmphys_build_tables_thompson.F and build_tables.F) being compiled but not the ones for TEMPO (atmphys_build_tables_tempo.F and build_tables_tempo.F).
There was a problem hiding this comment.
@clark-evans @AndersJensen-NOAA I talked to Anders today about this, and he pointed out that there is also a Makefile for gfortran (Makefile.gfortran) for building the TEMPO executable to generate MP tables. So I added the variable MAKEFILE_SUFFIX to distinguish between intel and gfortran.
Btw, the code in src/core_atmosphere/utils/ related to TEMPO is outdated since the subroutine interfaces for the latest TEMPO are different than the ones used in the .F files in that directory. So another option for building the executable for TEMPO table generation is to update this directory (specifically atmphys_build_tables_tempo.F, build_tables_tempo.F, and Makefile) to match the latest TEMPO, but that is a job best suited for @AndersJensen-NOAA (and not necessary for this PR).
| @@ -290,6 +291,7 @@ clean: | |||
| ( cd physics_noahmp/src; $(MAKE) clean ) | |||
| ( cd physics_noahmp/utility; $(MAKE) clean ) | |||
| ( if [ -d physics_noaa/TEMPO ]; then cd physics_noaa/TEMPO; $(MAKE) -f Makefile.mpas clean; fi ) | |||
There was a problem hiding this comment.
The following is to clean the run_build_tables executable and related files generated by the new line above in this Makefile.
| @@ -199,9 +199,9 @@ | |||
| <!-- **************************************************************************************** --> | |||
|
|
|||
| <streams> | |||
There was a problem hiding this comment.
This was necessary to avoid SMIOL errors apparently due to another stream named output defined in the main Registry.xml. This error causes the output .nc files to contain only the smoke variables defined here and none of the output variables for the output stream in the main Registry.xml. The output file is also renamed so two different streams are not writing to the same file.
| @@ -28,6 +28,7 @@ core_reg: | |||
|
|
|||
| core_input_gen: | |||
| if [ ! -e default_inputs ]; then mkdir default_inputs; fi | |||
There was a problem hiding this comment.
This is to remove any stale stream files (streams.atmosphere and stream_list.atmosphere.*) in the default_inputs directory under core_atmosphere generated by a previous invocation of make.
| @@ -37,12 +38,21 @@ gen_includes: core_reg | |||
|
|
|||
| post_build: | |||
| if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi | |||
There was a problem hiding this comment.
This is to remove any stale stream files (streams.atmosphere and stream_list.atmosphere.*) in the default_inputs directory under the top-level MPAS-Model directory generated by a previous invocation of make.
| <stream name="output_smoke" | ||
| type="output" | ||
| filename_template="history.$Y-$M-$D_$h.$m.$s.nc" | ||
| filename_template="history_smoke.$Y-$M-$D_$h.$m.$s.nc" |
There was a problem hiding this comment.
@gsketefian This change will break the current rrfs-workflow.v2 (with smoke and dust) as discussed in #196 (comment)
We need to discuss this and have an agreement before making this change. Thanks!
| post_build: | ||
| if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi | ||
| rm -f $(ROOT_DIR)/default_inputs/streams.$(CORE) $(ROOT_DIR)/default_inputs/stream_list.$(CORE).* | ||
| cp default_inputs/* $(ROOT_DIR)/default_inputs/. |
There was a problem hiding this comment.
Previously, files (e.g. stream-related files such as streams.atmosphere and stream_list.atmosphere.*) were not copied from the default_inputs directory under the top-level directory (MPAS-Model) if files with the same name already exist under MPAS-Model. This just seems wrong since we want to update those files with each make invocation. The new code makes a backup of the existing file (e.g. <file_name>.old01, <file_name>.old02, etc) before replacing the existing file with the new one from default_inputs.
| @@ -9,7 +9,7 @@ else | |||
| all: mpas | |||
|
|
|||
| mpas: $(AUTOCLEAN_DEPS) externals frame ops dycore drver | |||
There was a problem hiding this comment.
Note that the new line here now uses esmf_time_f91 instead of esmf_time_f90.
There was a problem hiding this comment.
@NingWang325 @clark-evans These intel mkl libraries are generating the following errors in the CI build tests:
With gnu compiler:
/usr/bin/ld: cannot find -lmkl_intel_lp64: No such file or directory
/usr/bin/ld: cannot find -lmkl_core: No such file or directory
/usr/bin/ld: cannot find -lmkl_sequential: No such file or directory
With intel compiler:
ld: cannot find -lmkl_intel_lp64: No such file or directory
ld: cannot find -lmkl_core: No such file or directory
ld: cannot find -lmkl_sequential: No such file or directory
First, I thought this was due to gnu not recognizing these intel libraries, but it is also happening with the intel compiler. Do we need to change the modules when running the CI tests?
Thanks.
…hat generates the data tables for the TEMPO microphysics scheme. This is necessary because the makefile invoked (Makefile.intel) is only for the intel fortran compiler but the CI tests for the repo include build tests with gnu fortran (which are failing with these lines present).
…building TEMPO's executable for generating microphysics tables.
… Math Kernel Library (MKL).
This PR enables use of the SPPT scheme of stochastic physics into MPAS-Model. This is addressed in Issue #204.
Main changes:
stochastic_physicscode as a submodule.Makefiles, registryxmlfiles, and fortran files to allow the SPPT stochastic scheme to bue used with MPAS.stochastic_physicscode as a submodule. There is a companion PR into the authoritativestochastic_physicsrepo here.Note that this PR still requires
maketo be used to build MPAS-Model with stochastic physics. The ability to build withcmakewill come in a separate PR.Mandatory Questions
Priority Reviewers