-
Notifications
You must be signed in to change notification settings - Fork 20
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
Solar zenith angle and Earth-Sun distance #171
Solar zenith angle and Earth-Sun distance #171
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.
Thanks @mattldawson! I have a couple of minor suggestions but nothing that holds up the PR. Just a reminder that the Earth eccentricity, etc. parameter need a SIMA update (ESCOMP/CAM-SIMA#325) to be merged before they're available for use by code in this PR.
public :: has_error_occurred | ||
public :: has_error_occurred, calculate_solar_zenith_angle_and_earth_sun_distance | ||
|
||
real(kind_phys), parameter, public :: PI = 3.14159265358979323846_kind_phys |
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 would suggest avoid hardcoding this in a separate location and use the CCPP standard name pi_constant
if possible, or if not, maybe include from shr_const_pi
(these are the same numerically). I realize this is used in another module and maybe the CCPP variable can be brought in from there.
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 guess my preference would be to use the shr_const_pi
instead of adding yet another function argument to a list that is getting pretty long, and then having to pass constants down through all the internal functions, but I'll go with the approach the group prefers.
@@ -129,6 +132,7 @@ subroutine tuvx_init(vertical_layer_dimension, vertical_interface_dimension, & | |||
use musica_tuvx, only: grid_map_t, profile_map_t, radiator_map_t | |||
use musica_util, only: error_t, configuration_t | |||
use musica_ccpp_namelist, only: filename_of_tuvx_micm_mapping_configuration | |||
use musica_ccpp_util, only: PI |
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.
Maybe use CCPP variable pi_constant
as an argument, if possible?
cloud_area_fraction, constituents, & | ||
air_pressure_thickness, rate_parameters, & | ||
errmsg, errcode) | ||
use musica_util, only: error_t | ||
use musica_ccpp_tuvx_height_grid, only: set_height_grid_values, calculate_heights | ||
use musica_ccpp_tuvx_temperature, only: set_temperature_values | ||
use musica_ccpp_util, only: has_error_occurred | ||
use musica_ccpp_util, only: has_error_occurred, PI |
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.
Similarly, would it be possible to use the CCPP pi_constant
here as well?
to_be_ccppized/shr_orb_mod.F90
Outdated
@@ -0,0 +1,141 @@ | |||
! Copyright (C) 2024 National Science Foundation-National Center for Atmospheric Research | |||
! SPDX-License-Identifier: Apache-2.0 | |||
module shr_orb_mod |
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 suppose this is fine since it's a temporary solution but I wonder if the copy of shr_orb_mod
in CAM-SIMA's share
submodule can be used directly here, perhaps through a dependency (dependencies = ../../../../../share/shr_orb_mod.F90
in the ccpp metadata. Just wanted to open it up for discussion in case it's an easy fix. Please don't hold up the PR if not, I think this is best computed in the host model and passed as a CCPP variable eventually (e.g., cosine_of_solar_zenith_angle
)
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 would be a little hesitant to introduce this type of dependency on source code and a very specific folder structure of a host application. But, I agree with the long-term plan to pass this as a CCPP variable.
Good point. I added a note to the PR description. thanks! |
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.
Looks good! I just have a couple of suggestions and questions.
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.
Looks good! I just have a couple minor questions.
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 addressing the comments!
Tag name (The PR title should also include the tag name): `atmos_phys0_07_001` Originator(s): @jimmielin List all `development` PR URLs included in this PR and a short description of each: * Update extraterrestrial flux in TUV-x prior to calculating rate constants #152 by @boulderdaze * Simplify deallocation of multiple objects associated with the TUV-x #156 by @boulderdaze * Fill in errmsg, errflg in check_energy schemes #160 by @jimmielin * Validates the MUSICA meta data against the CCPP standard names #162 by @boulderdaze * Add constituent tendency updater #111 by @peverwhee * Add cloud optical calculations for use in TUV-x #167 by @mattldawson * Add initialize_constituents scheme #149 by @peverwhee * Add diagnostics to TJ2016 test schemes #170 by @peverwhee * update "radians" to "rad" #173 by @peverwhee * Solar zenith angle and Earth-Sun distance #171 by @mattldawson * Update standard names for tropopause_find #140 by @jimmielin * Update surface albedo units #181 by @mattldawson * don't set water species property for species that air_composition handles #185 by @peverwhee List all test failures: N/A
Tag name (required for release branches): Originator(s): Matt Dawson Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): Adds the calculation of solar zenith angle and Earth–Sun distance and makes them available as CCPP standard named variables. @nusbaume - I wasn't sure if I put the call to recalculate the orbital properties is correct. If it isn't let me know, and I can move it. closes #328 Additionally: - adds some stubbed-out dependencies needed for MUSICA, until the actual values are available from other physics schemes or the host model - adds some testing infrastructure needed for unit tests of this code. Once #326 is merged in, I can update this PR to use the new unit testing infrastructure In draft until ESCOMP/atmospheric_physics#171 is merged in Describe any changes made to build system: none Describe any changes made to the namelist: none List any changes to the defaults for the input datasets (e.g. boundary datasets): none List all files eliminated and why: none List all files added and what they do: List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: derecho/gnu/aux_sima: If this changes climate describe any run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced: CAM-SIMA date used for the baseline comparison tests if different than latest: --------- Co-authored-by: Courtney Peverley <courtneyp@ucar.edu> Co-authored-by: Kuan-Chih Wang <kuanchihw@ucar.edu>
Adds the calculation of solar zenith angle and Earth-Sun distance needed as inputs to TUV-x.
closes #163
closes #164
Both calculations required functions that are currently in shared code in CAM here and here that I put in a modified form in the
to_be_ccppized/
folder. @nusbaume @peverwhee - if there is a better way to handle these functions, let me know and I can update the PR.Requires an update to CAM-SIMA that is in review to make certain variables available through CCPP (ESCOMP/CAM-SIMA#325)
After more discussion, the plan is to use the shared functions in CAM-SIMA and pass the outputs through CCPP. So, this PR will be put in draft until this issue is finished: ESCOMP/CAM-SIMA#328
A related draft PR to CAM-SIMA has been added (ESCOMP/CAM-SIMA#337) and will be un-drafted once this PR is merged in.