-
Notifications
You must be signed in to change notification settings - Fork 9
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 variables we can use to modify the radiative fluxes to the Statein #158
Conversation
…limateModeling/fv3gfs-fortran into flux-override-or-correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work getting this together. I did my best to follow the logic of the GFS physics driver changes, but it is not trivial. For future reference, do you have a doc that describes the implementation you ended up going with?
I was wondering why the averaged SW diagnostics are treated somewhat uniquely (i.e. store them in uswsfc
versus fluxr
depending on whether overriding)?
Thanks for the notebook checking the outputs. I was a bit unclear on the configuration of the run—you were outputting the diagnostics on every timestep or was it every 3 hours? I guess I was just wondering if we are confident that the time-averaging across multiple timesteps is working as expected in the case of overriding.
Yes, I think I put this detail at the top of the notebook. I output instantaneous and time-mean diagnostics every 3 hours from both the Python wrapper and the fortran model.
I think the natural place for that would be this document. I vaguely allude to the current approach here, but I should update it to be more specific about what we actually went with (in terms of technical details of the changes to the physics driver). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think this looks good! I do think it would be useful to make a section in your doc that is explicitly about what was actually implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for being so careful about preserving the implementation when this new flag is false. Looks good to me!
@oliverwm1 @brianhenn I wrote a document describing the implementation here (and its motivation). I linked to it in the original writeup as well. |
…ive fluxes (#244) This PR is tied to ai2cm/fv3gfs-fortran#158. It adds getters and setters for four fields in the fortran model: - `Statein%adjsfcdlw_override` (the downward longwave radiative flux at the surface seen by the land surface model) - `Statein%adjsfcdsw_override` (the downward shortwave radiative flux at the surface seen by the land surface model) - `Statein%adjsfcnsw_override` (the net shortwave radiative flux at the surface seen by the land surface model). - `Radtend%sfalb` (the average surface albedo) The first three are only valid if `gfs_physics_nml.override_surface_radiative_fluxes` is set to `.true.` in the fortran namelist (if it is not set to `.true.`, memory will not be allocated for them). We add a flag to the wrapper to be able to dynamically check this; if it is not set and a user asks to get or set one of these variables, then an informative error will be raised (rather than a model segmentation fault). The test infrastructure for the setters is modified to check this. In adding the new boolean flag, it was discovered that there was a bug in the implementation of earlier boolean flags (#244 (comment)). We fixed this, and added more comprehensive tests of the flags, which did not exist previously. In addition we added a flag for the physics timestep, `dt_atmos`, using the preexisting `get_physics_timestep_subroutine` subroutine. Finally, to check that the fortran diagnostics for the radiative fluxes were updated as expected, we added an additional set of tests (which basically are an automated way of doing what we did in [this notebook](https://github.com/VulcanClimateModeling/explore/blob/master/spencerc/2021-03-04-predicting-radiative-fluxes-online/2021-03-11-verify-diagnostics.ipynb)). We also add a test that ensures that modifying the surface radiative fluxes modifies the temperature after a timestep (indicating that the modifications are being felt by the land surface model).
This PR ports the ability to override the surface radiative fluxes seen by the land surface model from the wrapper. This was split across two PRs originally in the case of FV3GFS: - ai2cm/fv3gfs-fortran#158 - ai2cm/fv3gfs-wrapper#244 This depends on the fortran changes made in: - NOAA-GFDL/SHiELD_physics#31 - NOAA-GFDL/atmos_drivers#31 which have now been merged, and incorporated into this repo via #11.
This PR adds three variables to the
Statein
derived type that we can use to override the downward longwave, downward shortwave, and net shortwave radiative fluxes at the surface. By default these variables are not allocated or used. To use them one must set thegfs_physics_nml.override_surface_radiative_fluxes
namelist parameter to.true.
. Setters for these variables in the Python wrapper can be found in a complementary PR.A significant amount of work in this PR also goes into refactoring the diagnostics related to these variables. When running in a mode where we override these fluxes, we want the usual fortran diagnostics -- namely
DLWRF
,DSWRF
,USWRF
,DLWRFI
,DSWRFI
, andUSWRFI
-- to correspond to the overriding fluxes. We modify things such that this is the case. In addition, to enable diagnosis of what the traditional radiation code would predict for these fluxes, we add diagnostics with the suffix_from_rrtmg
. This notebook checks to make sure all of these diagnostics work as expected in a case where we override the fluxes with ML (the regression tests ensure that things continue to work when we are not overriding the fluxes).Care has been made to ensure that if
gfs_physics_nml.override_surface_radiative_fluxes
is set to.false.
, the model will run identically to before, both in producing bit-for-bit identical results and in terms of memory allocated during runtime. When it is set to.true.
the model will use more memory to accommodate the arrays used for storing the RRTMG diagnostics as well as the overriding fluxes in theStatein
.