Aviary icon indicating copy to clipboard operation
Aviary copied to clipboard

Incorrect values when saving and loading json files for off-design

Open kaushikponnapalli opened this issue 1 year ago • 1 comments

Description

Currently we save the results of a sizing run to a json file using aviary_inputs for the names and values of the data. This is a problem since these values are stored as an option at the time the problem is instantiated and do not get updated after the optimization is finished. Additionally, there are many unnecessary values being dumped into the json file that are not relevant to the problem at hand (eg: blended wing variables for a non-blended wing aircraft)

Example

In save_sizing_to_json() in methods_for_level2.py, the lines for data in self.aviary_inputs: (name, (value, units)) = data type_value = type(value)

are the source of the issue, changing them to for data in self.aviary_inputs: (name, (_, units)) = data try: value = self.get_val(name, units=units) except KeyError: (_, (value, _)) = data

Appears to solve the issue but is a hacky-fix that doesn't address the issue of bloat

Aviary Version

0.9.4-dev

Relevant environment information

No response

kaushikponnapalli avatar Nov 15 '24 18:11 kaushikponnapalli

This has been partially fixed. Variables that were never specified by the user or present in the input file no longer show up in the json file. Variable values that got updated during the optimization still don't make it back into aviary_inputs. We should probably create some sort of aviary_outputs that updates aviary_inputs with the final values from the openmdao problem, and build the json from that (or directly export the outputs into a csv)

jkirk5 avatar Aug 25 '25 18:08 jkirk5