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

Added ability to allow the user to change the name of the integration variable. #874

Merged
merged 24 commits into from
Nov 29, 2022

Conversation

robfalck
Copy link
Contributor

Summary

  • The user may now change the name of the integration variable, which defaults to "time" for backward compatibility.
    The elapsed time of the phase can now be referenced as {time_name}_phase (it was previously time_phase).

  • Changed the name of the integration variable to s in the race car example and documentation.

  • Added documentation of renaming time.

Related Issues

Backwards incompatibilities

Internally, the names of time and time_phase coming out of the TimeComp are now t and t_phase. This shouldn't affect many users as they should be pulling these values from the timeseries instead.

New Dependencies

None

…he name of the users choosing.

Elapsed time of a phase has been renamed from time_phase to t_phase to reflect the fact that t is now the generic integration variable.
…looking for the wrong timeseries name when the linkage variable was the independent variable
…aints/objective/timeseries to support existing code with a deprecation warning.
…date introspection to search for appropriate name in constraints, objectives, rates, etc.
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@johnjasa johnjasa left a comment

Choose a reason for hiding this comment

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

Looks generally good, I added some quite minor comments!

@@ -263,7 +264,7 @@
"# timeODE.py\n",
"phase.set_time_options(fix_initial=True, fix_duration=True, duration_val=s_final,\n",
" targets=['curv.s'], units='m', duration_ref=s_final,\n",
" duration_ref0=10)\n",
" duration_ref0=10, name='s')\n",
Copy link
Member

Choose a reason for hiding this comment

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

At first glance, this name='s' confuses me. I will review the PR and see if it makes more sense. I'm leaving this note here so I remember to check back in here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've left this alone because it was an external contribution. In my mind 's' is often used for arclength so it makes sense to me.

as a timeseries output. If a name, it be one of 'time', 'time_phase', one of the states, controls,
control rates, or parameters, in the phase, the path to an output variable in the ODE, or a glob pattern
matching some outputs in the ODE.
as a timeseries output. If a name, it be one of the integration variable, 'time_phase', one of the states,
Copy link
Member

Choose a reason for hiding this comment

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

"If a name, it be one of" -> "If a name, it should be one of"? or maybe a word is missing in here


# Solve for the optimal trajectory
p.run_driver()
for time_name in ('time', 'elaspsed_time'):
Copy link
Member

Choose a reason for hiding this comment

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

should change 'elaspsed' to 'elapsed' in three places

@@ -63,7 +63,7 @@ def configure_time(self, phase):
Configure the inputs/outputs on the time component.

This method assumes that target introspection has already been performed by the phase and thus
options['targets'], options['time_phase_targets'], options['t_initial_targets'],
options['targets'], options['timw_phase_targets'], options['t_initial_targets'],
Copy link
Member

Choose a reason for hiding this comment

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

is timw correct here?

@robfalck robfalck merged commit 15da682 into OpenMDAO:master Nov 29, 2022
@robfalck robfalck deleted the rename_time2 branch February 1, 2024 21:06
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.

Allow user to rename integration variable
2 participants