-
Notifications
You must be signed in to change notification settings - Fork 340
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 NSSL 2/3-moment cloud microphysics #1113
base: develop
Are you sure you want to change the base?
Conversation
…icrophysics (adds refl. moment variables for rain, graupel, hail: zrw, zgw, zhw). Also added code to compute the composite and 1-km reflectivity for NSSL2M (not actually tested yet)
mpas_io_streams.F : pass ioformat to def_var mpas_io.F : add conditional to set deflate on variables if ioformat is netcdf4 (needs netcdf-4.7.4 or later)
…eded if the libraries are static only.
… into nssl2m-deflate
…ophysics ccpp_kinds.F : Add 'machine' module for CCPP compatibility mpas_atmphys_driver_microphysics.F : Add support for NSSL microphysics (arrays, init/driver etc.) mpas_atmphys_interface.F : Get/put data for NSSL microphysics mpas_atmphys_packages.F : Set up packages for NSSL microphysics physics_mmm/Makefile : add dependencies for NSSL-mp physics_wrf/Makefile : remove NSSL-mp (moved to physics_mmm) docs/README.NSSLmp : brief overview of options in the NSSL microphysics scheme physics_mmm: module_mp_nssl_2mom.F, mp_nssl.F : new code file for NSSL-MP
Hi, @ldfowler58 would you have time to look at this at some point? Let me know if this is the approach you want for physics_mmm or if there is more to shift from the model code to the interface. The physics module is an updated version from CCPP, so it has all the extra comments for documentation. The interface 'run' subroutine is from CCPP (for SCM/FV3), but isn't actually used since MPAS can call the microphysics directly with the "_p" arrays. |
I think it would be good to separate the changes for NetCDF compression from the changes to add the NSSL microphysics scheme, as these (if I understand correctly) are unrelated changes. |
I agree that it would be cleaner to split it off the netcdf part, and it is only 2 files and I think no overlapping changes. It's a bare-bones implementation that assumes one would only choose the netcdf4 option because of compression being available. Otherwise the speed of pnetcdf for uncompressed writes really can't be beat. |
…h the netcdf4 output option
I moved the netcdf changes to a separate branch: https://github.com/MicroTed/MPAS-Model/tree/dev-nc4deflate |
I started to look at the changes and add-ons made by Ted in order to include the NSSL cloud microphysics scheme. Here my first suggestions for the top files that I have been modified:
Will look at the actual microphysics next. Thanks. |
Thanks for the comments! My thinking for leaving off "mp_" from nssl3m_in and nssl_hail_in etc. is that they are package options rather than full packages. They are not seen by the user, but rather activated by config_ options. So maybe it doesn't really matter? The package is still the mp_nssl2m_in, and the others are options (subpackages?) to turn variables on or off. Perhaps I could just rename mp_nssl2m_in to just mp_nssl_in? Or something like that? I also have a version with an option to run single-moment, but I'm not sure that's needed for a release code. I can change the other formatting things to match the rest of the code. (Although I'm firmly in the camp of having a space after 'if' :) considering there is an unbalanced space in front of 'then', haha.) |
Updated (merged) to 8.2.1-hotfix. Also added function in init_atmosphere to generate LBCs for hydrometeor number concentrations when the LBC data only have mixing ratio. I still need to run some more tests and update the NSSL microphysics code. (Also some enhancements to the ideal initialization will be added.) |
…l reordering of scalars mpas_atmphys_interface.F : For mp_nssl, changes to avoid problems with PG compilers and pointers module_mp_nssl_2mom.F : Updates to recent development version - Use more accurate form for water saturation - Add active breakup parameterization for 3-moment rain - Fixes problem with sedimentation when nz > 128 - Cleans up some unused/unset rate arrays that could cause issues in debug compile
I ran into an odd compiler issue with nvfortran/pgf90 at -O3 with mpas_atmphys_interface.F: If a pointer assignment is inside an IF structure, it may not work correctly. For example, the optional hail variables here:
At -O0 it works fine, but -O2 or 3, the pointer for qh seems to go randomly somewhere, maybe within the scalar structure or maybe not. I have only looked at the min/max values of qh. Obviously this is bad compiler behavior, but I found two work-arounds for it:
I currently have option 2 in the PR code, but can switch it to 1 or a better suggestion. Also for this reason I have not yet included mp_nssl with the mass/number tendencies (e.g., rqcmpten). Those seem to be diagnostic only, but maybe there will be a need for those. |
Hi Ted: Thanks for pointing this out. I do not use nvfortran or pgf90 at all but it is definitely something that we should look into. Is it a "feature" that only occurs with the NSSL cloud microphysics or a "feature" that could also occur with, for instance, the Thompson cloud microphysics scheme? I'll investigate with a different cloud microphysics scheme separately. |
Hi, Laura, That said, I don't yet fully understand the structure of the 'scalar' array and how it works to reference the first index. (Basically how it converts a s(numscalar)%vals2d(nlevs,ncells) kind of record into something that looks like a 3D array -- too fancy!) |
@MicroTed Apparently not updating .mod file is a gfortran feature as I just learnt. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31587 |
…ophysics for case of ccn_on=F
…nstead of 2), as this more realistically limits supersaturation.
…riables (when selected) module_mp_nssl_2mom.F : remove small noise values of hydrometeors at beginning of NSSL micro (already done at end)
…tion is turned off, where the max droplet concentration could only be half of nssl_cccn.
…ed the initialization of variable sh2o (soil liquid water) prior to calling subroutine NoahmpInitMain in subroutine noahmp_init.
…the dimension of index_nifa and index_nwfa from the pool lbc_state instead of state. Corrected the call to subroutine init_atm_thompson_aerosols_lbc accordingly. * In ./src/core_init_atmosphere/mpas_init_atm_thompson_aerosols.F, replaced the index name of nifa and nwfa from index_nifa (index_nwfa) to index_lbc_nifa (index_lbc_nwfa) from the pool lbc_state.
…2.3 (PR MPAS-Dev#1249) This merge corrects the pool from which lbc_scalar constituent indices are obtained in the init_atm_thompson_aerosols_lbc routine. Rather than obtaining index_nifa and index_nwfa from the state pool, the indices of lbc_nifa and lbc_nwfa should be obtained from the lbc_state pool. * NSF-MPAS/correct_thompson_aerosols_lbc: * In ./src/core_init_atmosphere/mpas_init_atm_thompson_aerosols, get the...
…ev#1244) This merge corrects the computation of the soil temperature (TSLB) in the Noah-MP land surface scheme through the addition of initialization of the soil liquid water (SH2O) in the noahmp_init subroutine in module mpas_atmphys_lsm_noahmpinit.F prior to calling NoahmpInitMain. Prior to the changes in this merge, running Noah-MP led TSLB to be set to ConstFreezePoint (273.16 K) in SoilSnowWaterPhaseChangeMod.F90 although the input TSLB was greater than ConstFreezePoint on the very first time step. This error occurred because TSLB is calculated as a function of the soil liquid (MassWatLiqTmp) and ice (MassWatIceTmp) water mass, and MassWatLiqTmp is always equal to 0 when not properly initializing SH2O. * NSF-MPAS/noahmp_fix_tslb: * In ./src/core_atmosphere/physics/mpas_atmphys_lsm_noahmpinit.F, added the...
-> in Registry.xml, corrected the units of static fields greenfrac, shdmin, shdmax, vegfra, and albedo12m from "unitless" to "percent". -> in mpas_init_atm_cases.F, corrected spelling of "greeness" to "greenness" (line 6702). * In ./src/core_atmosphere/Registry.xml, corrected the units of static fields greenfrac, shdmin, shdmax, vegfra, and albedo12m from "unitless" to "percent". corrected spelling of greenness fraction in the description of greenfrac.
…3 (PR MPAS-Dev#1248) This merge corrects the units of the fields 'greenfrac', 'shdmin', 'shdmax', 'vegfra', and 'albedo12m' from "unitless" to "percent" in the init_atmosphere and atmosphere core Registry.xml files. Also included in this merge is a correction to the spelling of "greenness" in several places. * NSF-MPAS/correct_units_static_fields: * In ./src/core_init_atmosphere: -> in Registry.xml, corrected the units of static fields greenfrac, shdmin, shdmax, vegfra, and albedo12m from "unitless" to "percent". -> in mpas_init_atm_cases.F, corrected spelling of "greeness" to "greenness" (line 6702).
…ock_fields This commit removes a duplicate allocation of indexToEdgeID % array in the mpas_io_setup_edge_block_fields routine that was the source of a memory leak.
…x-v8.2.3 (PR MPAS-Dev#1258) This merge removes a duplicate allocation of indexToEdgeID % array in the mpas_io_setup_edge_block_fields routine that was the source of a memory leak. * framework/fix_duplicate_indexToEdgeID_alloc: Remove duplicate allocation of indexToEdgeID in mpas_io_setup_edge_block_fields
…halos The cellLimitField field is allocated in the mpas_block_creator_build_cell_halos routine and is only used in a call therein to mpas_dmpar_get_exch_list. If not deallocated at the end of the mpas_block_creator_build_cell_halos routine, the memory allocated to cellLimitField would be otherwise be leaked, since there is nothing outisde of the mpas_block_creator_build_cell_halos routine that retains a reference to it and deallocates it. This commit fixes this memory leak by deallocating cellLimitField before the mpas_block_creator_build_cell_halos routine returns.
MPAS-Dev#1264) This merge fixes a memory leak in mpas_block_creator_build_cell_halos by deallocating the cellLimitField field before the routine returns. The cellLimitField field is allocated in the mpas_block_creator_build_cell_halos routine and is only used in a call therein to mpas_dmpar_get_exch_list. If not deallocated at the end of the mpas_block_creator_build_cell_halos routine, the memory allocated to cellLimitField would be otherwise be leaked, since there is nothing outisde of the mpas_block_creator_build_cell_halos routine that retains a reference to it and deallocates it. * framework/fix_cellLimitField_leak: Fix memory leak from cellLimitField in mpas_block_creator_build_cell_halos
…nto dev-nssl3m
…in graupel->hail conversion and for drop freezing.
Add NSSL 2/3-moment cloud microphysics
Adds option to use the NSSL 2-moment cloud microphysics scheme with 6 hydrometeor species (droplets, rain, cloud ice, snow, graupel, and hail). It includes the option for 3-moment rain/graupel/hail (adds reflectivity moment) and an option to turn off hail (for non-severe convection). Details on using the scheme are in docs/README.NSSLmp. Also adds a 3D reflectivity field for optional output (refl10cm). The parameterization code is (or will be) at parity with the current WRF PR for the 3-moment scheme wrf-model/WRF#1876 (and eventual CCPP update).
Tested on daily 3-km regional CONUS forecasts (with v7.3), so similar performance is expected with v8.0
Outstanding issue: At least in the physics_mmm directory, the .mod files are not updated by recompiling newer .F files. They have to be deleted in order to be replaced. I don't know if this is general or a gfortran quirk.