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

Methods for level 2 revamp part 1. #651

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

Kenneth-T-Moore
Copy link
Member

Summary

  1. Moved PreMissiongroup, PostMissionGroup and AviaryGroup into their own files.
  2. Created a new object called a Problem Builder which builds parts of an aviary problem that are unique to a specific mission_method.

This is a first pass at some refactoring that will allow for more customization.

Related Issues

  • Resolves #

Backwards incompatibilities

None

New Dependencies

None

f'When using "settings:equations_of_motion,custom", a problem_builder must be specified in load_inputs().')
else:
raise ValueError(
f'settings:equations_of_motion must be one of: height_energy, 2DOF, or custom')
Copy link
Contributor

Choose a reason for hiding this comment

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

SOLVED_2DOF should be added here per line 136

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

@@ -551,7 +297,8 @@ def check_and_preprocess_inputs(self):
elif mission_method is TWO_DEGREES_OF_FREEDOM:
Copy link
Contributor

@ehariton ehariton Jan 28, 2025

Choose a reason for hiding this comment

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

I don't like that we are setting defaults for the different ODEs in methods4L2. I feel like these should be moved to the individual builders which decreases the number of different locations that a new ODE needs to inject information.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is one of the areas that is still pretty messy. It makes me wonder if we should move all of the core pre-mission builder setup into the problem builders. Concepts of FLOPS and GASP maybe shouldn't exist at this level.

# The rest of the phases includes all Height Energy method phases
# and any 2DOF phases that don't fall into the naming patterns
# above.
input_initial = False
Copy link
Contributor

Choose a reason for hiding this comment

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

consolidate with line 139 which also sets input_initial

Copy link
Member Author

Choose a reason for hiding this comment

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

Consolidated into input_initial = phase_idx > 0

elif phase_name == 'descent': # TODO: generalize this logic for all phases
phase.set_time_options(
fix_initial=False, fix_duration=False, units=time_units,
duration_bounds=user_options.get_val("duration_bounds", time_units),
Copy link
Contributor

Choose a reason for hiding this comment

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

The only difference between this elif and the code before it is that if the phase_name is 'descent' then fix_duration is set to False, no matter what the user input. That is a check that should be happening on the phase inputs, not here. That would allow us to delete lines 158 through 165.

Honestly a bit strange to me that we specifically need fix_duration = False in descent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that is strange too, plus it is the only example where we have to adhere to a naming convention in HE. It looks like fix_duration is always false in our phase_infos, and the ones in MBSAE. If the user sets target_duration in a phase, then fix_duration is automatically set to True (we have so much interaction between these attributes), but in those cases, the phase is named something like "reserve_hold" instead of "descent". I am going to remove this "if" branch and see what happens.

fix_initial=fix_initial, fix_duration=fix_duration, units=time_units,
duration_bounds=user_options.get_val("duration_bounds", time_units),
duration_ref=user_options.get_val("duration_ref", time_units),
initial_ref=initial_ref,
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we not applying the initial_bounds that the user supplied here??

Copy link
Member Author

Choose a reason for hiding this comment

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

It is potentially an oversight. We should treat initial_bounds just like initial_ref -- none unless mpi.

Kenneth-T-Moore and others added 6 commits January 28, 2025 14:23
…gine_deck() when no deck is supplied into each of the 3 different builders.
…roblem_builders. left all objective calcs in m4l2 because even if your running shooting, they could be useful and don\t have a large computational cost
Kenneth-T-Moore and others added 21 commits January 29, 2025 15:53
… be calculated no matter the problem. placed them in the add_objective() definition for eas of finding them in the future
…ing probably isnt quite right in there. alternative_mission was calling mass_methods based on ODE, but add_post_mission_systems was calling based on mass_method!!
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