Skip to content

Sm jul212020#481

Closed
SMoorthi-emc wants to merge 45 commits into
NCAR:masterfrom
SMoorthi-emc:SM_Jul212020
Closed

Sm jul212020#481
SMoorthi-emc wants to merge 45 commits into
NCAR:masterfrom
SMoorthi-emc:SM_Jul212020

Conversation

@SMoorthi-emc
Copy link
Copy Markdown
Contributor

Changing pull request from SM_Jun142020 to SM_Jul212020 as the later one is up to date with the master

@climbfuji
Copy link
Copy Markdown
Collaborator

This PR supersedes #466 - for a description and a discussion/first review of the proposed changes see there.

Comment thread physics/sfc_cice.f
stress(i) = sqrt(dusfc(i)*dusfc(i) + dvsfc(i)*dvsfc(i)) * tem

snwdph(i) = snowd(i) * 1000.0_kind_phys
weasd(i) = snwdph(i) * 0.33_kind_phys
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the hard-coded 0.33 come from? Should it be a parameter?

@grantfirl
Copy link
Copy Markdown
Collaborator

I reviewed for CCPP-specific stuff, not any of the science or logic changes, necessarily. I understand the need for specifying precision for hard-coded constants, but I don't necessarily understand using "r8" as the string. It was my understanding that r8 was short for real(8) or double precision. But, in comments, it was said that using r8 was to facilitate the ability to switch to single-precision as needed in the future. Wasn't that the purpose of kind_phys to begin with? If kind_phys is too much to type, fine, but could we agree on something like "kp" instead of "r8" and then be ruthlessly consistent throughout CCPP schemes?

@SMoorthi-emc
Copy link
Copy Markdown
Contributor Author

Grant,
The reason I chose "_r8" was simply because "MGx" codes from NCAR exclusively used that notation and I did not want to change their style. I have no special affinity for that particular string. However, I don't want long string as the coding becomes messy.
CCPP folks may want to standardize all codes at some point.

@SMoorthi-emc
Copy link
Copy Markdown
Contributor Author

SMoorthi-emc commented Jul 28, 2020 via email

@climbfuji
Copy link
Copy Markdown
Collaborator

Grant,
The reason I chose "_r8" was simply because "MGx" codes from NCAR exclusively used that notation and I did not want to change their style. I have no special affinity for that particular string. However, I don't want long string as the coding becomes messy.
CCPP folks may want to standardize all codes at some point.

Can I suggest a compromise and use _kp (short for _kind_phys) in those modules, instead of _r8? In that case

use machine, only : kp => kind_phys

and be consistent throughout the file to only use _kp. In light of what Vijay and Fanglin mentioned yesterday, it seems more forward-thinking to use _kp than _r8 (and a simple search & replace in the files you modified will do the trick). We are certainly not asking you to fix existing _r8 in the original MG code (although this is something we should clean up rather sooner than later, however gets to it first; the reason it came with _r8 is because WRF w/o CCPP doesn't know about the concept of _kp and always compiles physics in double precision). Likewise, I would advocate for modifying the code changes in this PR that turn constants like 1.0 into 1.0d0 such that they become 1.0_kp unless double precision is explicitly required, independent of the precision with which the physics are compiled. Does this make sense?

Yesterday was the first time that I heard about the requirements to compile all physics in single precision or even mix precisions per user request. The former should be relatively straightforward as long as we clean up the physics code beforehand and use _kind_phys/_kp consistently. The latter will be more difficult to implement - think about what happens to a variable that gets passed from one scheme to another - if one scheme is double precision and the other is single precision, we will end up allocating additional arrays and copying data back and forth - the benefit of a faster computation in that particular scheme will be eaten up by the data copies. Only if this is done carefully and for more or less confined blocks of physics (e.g. all radiation in double precision, all "other" physics in single precision) can I see benefits right now. But that's for another time and deserves a good strategy and careful planning (for sure, the automatic code generation and metadata concept in CCPP will help with the implementation).

@SMoorthi-emc
Copy link
Copy Markdown
Contributor Author

I will try to change to "_kp" in some codes.
I do not recommend single precision for physics; some parts may not converge, especially if there are iteration.

@climbfuji
Copy link
Copy Markdown
Collaborator

Dom, bad news. It is not "kp". Even with "pk", and optimization, I got the same error.
So, I have no clue why, but it won't work (it worked ok with O0)

This mystery was solved - _kp works and will be used instead of _r8.

@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@NCAR NCAR deleted a comment from SMoorthi-emc Jul 31, 2020
@climbfuji
Copy link
Copy Markdown
Collaborator

Superseded by #486.

@climbfuji climbfuji closed this Aug 11, 2020
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