-
Notifications
You must be signed in to change notification settings - Fork 67
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
USatm1976Comp now accepts altitude as either geopotential or geodetic #735
Conversation
…t and previous implementation) or as geodetic.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
self._dh_dz = lambda z: (R0 / (R0 + z)) ** 2 | ||
else: | ||
self._h = lambda z: z | ||
self._dh_dz = lambda z: np.ones_like(z) |
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.
Do you think it would be more efficient to just have if-branching in the compute and compute-partials functions, rather than multiplying the derivatives by an array of ones.
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 just having it be lambda z: 1.0
would be the best compromise? Little code but a cheap operation?
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.
Yeah, that would be better than allocating an array of ones each time.
@@ -1341,11 +1357,12 @@ def compute_partials(self, inputs, partials): | |||
d2rho_dh2 = coeffs[:, 1] + dx * (2.0 * coeffs[:, 2] + 3.0 * coeffs[:, 3] * dx) | |||
|
|||
partials['temp', 'h'] = dT_dh.ravel() |
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.
partials['temp', 'h'] is in here twice.
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.
Once for the assignment, once in use by partials['sos', 'h']
and once when using the chain rule if _geodetic
is True. Those are all necessary I think.
…n the lambda way of doing this.
Summary
The atmosphere component included in dymos has started to be used more widely. In order to make it more accurate, it will now convert the input (geodetic) altitude to the geopotential altitude used for interpolating the atmosphere table.
In the future the default altitude type will be switched to geodetic, but for now the behavior remains the same by default.
Users can enable the geodetic input conversion by giving
USatm1976Comp
theh_def='geodetic'
option.Related Issues
Backwards incompatibilities
None
New Dependencies
None