Replies: 10 comments 11 replies
-
The syntax for pcd.yaml is explained in https://github.com/ESCOMP/PhysicalConstantsDictionary/wiki/Dictionary-Syntax |
Beta Was this translation helpful? Give feedback.
-
If we are going to change constants, I hope we can fix this at the same time! |
Beta Was this translation helpful? Give feedback.
-
We could think of adding entries to each constant though, no? I like the idea of showing a what the source is, including a formula for the derived constants, so that one knows immediately it's not something whose number is established by a committee (like |
Beta Was this translation helpful? Give feedback.
-
Those groups are a little to broad. I think it will be less ambiguous to group them as in the current pcd.yaml with "universal" "earth" "water" (dropping "physical"). We could add "air" and "standard_atmosphere" and "molecular_weights". |
Beta Was this translation helpful? Give feedback.
-
We have
vs.
These aren't really very different in the core content. |
Beta Was this translation helpful? Give feedback.
-
I agree they should always be double and yes PCD lets you specify if it should be single or double in the output code with "prec".. But the code generator could handle that ("all double", "all single", "use pcd") |
Beta Was this translation helpful? Give feedback.
-
Replying to E3SM-Project/Omega#179 (comment)
I think we'd better figure out how we want to organize things, then. It seems like we need the It no longer seems intuitive to me if the E3SM-specific YAML file exists in a fork of PhysicalConstantsDictionary, nor does it make sense for a code designed to parse both PhysicalConstantsDictionary and E3SM-specific constants should try to be general enough to contribute back to PhysicalConstantsDictionary. Also, as we already discussed, there are significant advantages in having both YAML files and the code to parse them living outside of E3SM itself. Does this point to making yet another repo? |
Beta Was this translation helpful? Give feedback.
-
I would not be in favor of 2+ repos. It seems to me that, being our PCD repo a fork inside our org, we can easily make a single and comprehensive database of the E3SM project (and siblings) needs. I don't see the advantage of keeping a "pristine" PCD file and a "e3sm-specific" one. Some other thoughts:
<header guard>
#include <e3sm_physics_constants.hpp>
#include "share/scream_config.hpp"
namespace scream
{
namespace constants
{
constexpr Real g = e3sm_constants::gravity_acceleration;
constexpr Real Rgas = e3sm_constants::ideal_gas_constant;
...
} // namespace constants
} // namespace scream If eamxx is built with
- name: radius_of_sphere_of_same_surface
...
- name: radius_of_sphere_of_same_volume
... Since our goal is to make the whole model agree on constants, I would avoid storing two values for the earth radius (or any constant, for that matter), in case a component uses the first and another uses the second... |
Beta Was this translation helpful? Give feedback.
-
A good question to ask might be: are we trying to provide a dictionary for the broader community as a complement to something like the CF Convention? Or are we simply trying to produce a single point of reference for E3SM to ensure consistency inside E3SM? If we're aiming for a broadly used dictionary, we'll end up with multiple sources that potentially define things differently, but we'll have a comprehensive reference better capable of supporting new research. In contrast, if we limit scope to the "for E3SM by E3SM" philosophy, we can simply define the only value that we use and presume that, especially since we include references, models that use other approximations and require other constants can figure this out for themselves. |
Beta Was this translation helpful? Give feedback.
-
I've been experimenting with yaml and have a format that puts the citation with the constant but don't require re-entering the info for each constant.
|
Beta Was this translation helpful? Give feedback.
-
Summary
The current format of
pcd.yaml
may not be as much as we'd like for e3sm. It might be worth merging its format and entries with a complementary project from a few years ago.Background
Consistency with physical constants has come up several times over recent years in e3sm, e.g., E3SM-Project/EKAT#48. Before @rljacob pointed me to the PhysicalConstantsDictionary, @jeff-cohere and I had decided on the same approach: hold the constants in a .yaml database that could be parsed into auto-generated source files in either c++ or fortran, to use consistently throughout e3sm. As a fundamental guiding principle, we felt that all constants should be accompanied by metadata that gives a reputable reference source for their value. Since we're a U.S. government project, we should use NIST or other agencies' publications (e.g., NASA) as source documents whenever possible.
The database that we came up with, now here in the
pbosler/database2
branch fileconstants.yaml
reflects several decisions that could be worth adopting or revisiting. To make the database, I grepped through E3SM's main components and gathered as many constants as I could find, then searched the SNL library, NIST, etc., to find their source values and reference material, and made this file. I've likely missed several constants, but it's a good start.Only after I had done that and presented this work to @mt5555, did I talk to @rljacob and learn about PhysicalConstantsDictionary. PCD's database has some fields that mine doesn't; mine has some fields that they don't. PCD has constants that I have not found in E3SM, whereas
constants.yaml
is targeted at E3SM specifically. It's likely we'll want aspects of both if this effort moves forward.The basic format for each entry in
constants.yaml
is:For derived constants, the source doesn't have to be a citation, it could instead be a definition. For example, the length of a sidereal day is given as a constant (source: NASA) in
constants.yaml
, so the angular velocity of the Earth can be derived from it as2*pi / sidereal_day
. In these cases, the numerical value is computed in double precision and appears as a given value like base constants, but thesource
metadata field contains the definition string, e.g.,"2*pi/sidereal_day"
instead of a citation.Some possible points for discussion with @bartgol or @xylar (or others) have come up:
constants.yaml
we decided that all constants should use double precision, with as many significant digits as possible.pcd.yaml
seems to allow other precision values.Beta Was this translation helpful? Give feedback.
All reactions