Skip to content
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

modradrrtmg: merge duplicate definitions of orbital parameters #134

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

fjansson
Copy link
Contributor

@fjansson fjansson commented Nov 4, 2024

Some orbital parameters were defined both in modradrrtmg and modraddata. Moved all orbital parameters to modraddata, which is where shr_orb_decl() looks for them. This is to resolve use of undefined variables found on Fugaku (debug build). Note the orbit calculations aren't actually used anyway.

Some orbital parameters were defined both in modradrrtmg and modraddata.
Moved all orbital parameters to modraddata, which is where
shr_orb_decl() looks for them. This is to resolve use of undefined variables
found on Fugaku (debug build). Note the orbit calculations aren't
actually used anyway.
@CasparJungbacker
Copy link
Collaborator

Another reason to explicitly pass variables as arguments to subroutines :^).

Looks good, but when you say "the orbit calculations aren't actually used", do you mean that they're just not used by RRTMG, or at all?

@fjansson
Copy link
Contributor Author

fjansson commented Nov 4, 2024

I mean at all, at least that's what I believe but a double check would be good. There's somewhere a much simpler orbit calculation which is used instead, with the assumption that the orbit is a perfect circle. So the times of sunrise, sunset are off by up to ~30 min.
And yes, this is a case where function arguments would be great.

@CasparJungbacker
Copy link
Collaborator

Hmmm, we have setupSW() in both RRTMG and RRTMGP, which both call shr_orb_decl() from shr_orb_mod, so at least it's called. Whether the call actually does something is a different question, I think the values it touches in modraddata are not used at all.

@fjansson
Copy link
Contributor Author

fjansson commented Nov 4, 2024

the setup is called, but then to actually calculate the zenith angles, the function zenith in modraddata is used, and that one seems to not care about the fancy orbit parameters.

We should fix that too, but let's do another PR for it, and check the zenith angles with some online astronomic calendar.

@fjansson fjansson merged commit 447269c into dev Nov 7, 2024
26 checks passed
@fjansson fjansson deleted the dev-fix-uninitialized branch November 7, 2024 10:17
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.

2 participants