-
Notifications
You must be signed in to change notification settings - Fork 36
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
Thompson-Eidhammer microphysics code formatting #147
Thompson-Eidhammer microphysics code formatting #147
Conversation
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.
@AndersJensen-NOAA Good job with this herculean effort!
I still think there is some work needed to clean up parameterizing the precision. For example, within the scheme there are still many instance of inline conversions that aren't using the parameterized precision (e.g. DBLE(var) instead of REAL(var,kind=kind_dbl_prec)).
I know this makes some things a bit long winded, so for brevity, you could redirect the precisions to something shorter. Something like
From:
use machine, only: kind_phys, kind_sngl_prec, kind_dbl_prec
To:
use machine, only: wp => kind_phys, sp => kind_sngl_prec, dp => kind_dbl_prec
Then instances of DBLE(var) could be changed to, the slightly shorter, real(var, kind=dp)
@dustinswales This passes the rrfs regression test: /scratch2/BMC/wrfruc/jensen/dev/ufs-weather-model/tests/logs/RegressionTests_hera.log when RoverRv = 0.622. This will fail when RoverRv = R*oRv. |
I am a little confused about the reconstruction of directories. Is this PR aimed at RRFS only? Do we have an agreement on an institutional directory name (GSL_*)? |
This is the first time I noticed a new GSL_cloud_phsyics directory has been created. This is concerning for me as we are moving towards community development and unified physics paradigm for all UFS applications. EMC, PSL, Greg Thompson and many others have all made significant contributions in the past few years to improve Thompson MP for RRFS, GFS and HAFS applications. We should continue the community development path. |
I have the same concern with the new gravity wave physics names, it doesn't seem on par with our pervious guidelines for community development. |
Thank you @mzhangw for bringing this up. I second Lisa's and Fanglin's recommendation wrt not using "GSL" in the name/location of the scheme. We want to avoid organization names to stimulate community development. |
@yangfanglin @mzhangw @lisa-bengtsson Sorry for the naming confusion. I opened an issue for more discussion, #151 |
physics/module_mp_radar.F90
Outdated
@@ -1,625 +0,0 @@ | |||
!>\file module_mp_radar.F90 |
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.
GFDL MP also uses this module. Does this really belong in the submodule repo if other MP schemes depend on it?
physics/module_mp_thompson.F90
Outdated
@@ -1,6545 +0,0 @@ | |||
!>\file module_mp_thompson.F90 |
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.
Were any changes made to this file when it was moved? Since there isn't an associated PR for the new submodule, it's impossible to tell/review any changes that you may have put in the moved file.
@AndersJensen-NOAA @dustinswales I see that this PR started out as changes to the Thompson scheme, but now they are "hidden" by the move to the submodule. Could we split this up? That is, have one PR with the actual code changes that we can review/merge now, then another, separate PR for moving things around (preferably after the CCPP Physics Management meeting on 1/17)? |
@AndersJensen-NOAA I think it's best if we revert the move to a submodule for the time being. A larger discussion needs to be had, which will be soon. (My apologies for leading you down this rabbit hole). |
b139e51
to
dd3040f
Compare
… into thompson_refactor
xDx(nbi+1) = D0s*2.0_dp | ||
do n = 2, nbi | ||
xDx(n) = exp(real(n-1, kind=dp)/real(nbi, kind=dp) & | ||
*log(real(xDx(nbi+1)/xDx(1), kind=dp)) + log(real(xDx(1), kind=dp))) |
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.
Is it really required to have real(X,dp)
inside the logs when the argument is already the precision required? This same question obviously applies to many of the statements below too.
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.
I see @dustinswales comment above, but I think it is referring to the recasting of the integers, right? I don't see why we need to recast xDx when it is already double precision.
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.
@grantfirl Correct, integers only. xD is defined type dp already
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.
@grantfirl I fixed as many of these as I could find. See latest commit.
return | ||
else | ||
write(*,'(a)') 'Logic error in mp_gt_driver: provide either tt or th+pii' | ||
stop |
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.
Here is a stop statement to clean up in the future. CCPP schemes shouldn't use STOP and should do what is done above with errmsg, errflg, return.
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.
OK, nevermind, I see that this should never execute in the CCPP.
DOUBLE PRECISION, PARAMETER, PRIVATE:: N_avo = 6.022E23 !< Avogadro number [1/mol] | ||
DOUBLE PRECISION, PARAMETER, PRIVATE:: ma_w = M_w / N_avo !< mass of water molecule [kg] | ||
REAL, PARAMETER, PRIVATE:: ar_volume = 4./3.*PI*(2.5e-6)**3 !< assume radius of 0.025 micrometer, 2.5e-6 cm | ||
real(wp), parameter, private :: Rv = 461.5 |
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.
All of these should be coming in through the argument list (lines 194-212). Otherwise, this may be introducing inconsistencies between this scheme and the rest of physics and the host model.
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.
@grantfirl Let's save this for another PR.
I suggested passing in a bunch of physical constants that already exist from the host that will result in similar regression test failures. If we do one replacement, this is a good time to do them all, IMO. There is no point in calculating a new RoverRv when it already exists from the host with the CCPP standard name of ratio_of_dry_air_to_water_vapor_gas_constants. |
This looks fine to me, @AndersJensen-NOAA. My only comments are related to using constants from the host so that this scheme is in line with all of the other CCPP schemes and the potentially superfluous double precision recasting. Since you've shown that your changes don't change the answer when you don't touch the constants, if you change one constant, I think that it makes sense to move to using whatever constants are available from the host so that we "rip the bandaid off" and get this scheme to be CCPP-compliant with respect to physical constants all at once. @dustinswales Objections? |
@dustinswales I re-requested a review since you had requested changes. Your approval isnt required for merge, though. |
@grantfirl Thanks for looking this over. I'll bring in constants and fix the double precision recasting. |
@AndersJensen-NOAA Is this still being targeted for the RRFS release? Do you want some assistance with the physical constants changes? I'm super familiar with how to do this if so, and I don't mind making these changes and putting in a PR to your branch. Let me know. |
@grantfirl, I would like this in the RRFS release, and yes, I would like assistance with constants changes. Feel free to add a PR. Thanks! |
Closed in favor of #179 targeting the RRFS release branch. |
This PR is the first of many that will modernized, modularize, and streamline Thompson-Eidhammer microphysics.
This PR includes: