fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
53 stars 26 forks source link

Issue 406 - Adding internal IndepVarComp to inputs #408

Closed ScottDelbecq closed 2 years ago

ScottDelbecq commented 2 years ago

This PR allows to include internal IndepVarComps in problem inputs, hence modifiying their value. Therefore, it closes #406.

For this purpose the generation of the input file uses the VariableList.from_problem() method instead of the function get_unconnected_input_names. Now get_unconnected_input_names is only used in unit tests and could be removed later. To make this functional, it was necessary to change the manner that the initial values (and other metadata) of inputs were set. Now we use the problem.set_value() method after the problem.setup().

codecov[bot] commented 2 years ago

Codecov Report

Merging #408 (2113642) into master (24f6fbb) will decrease coverage by 0.00%. The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #408      +/-   ##
==========================================
- Coverage   91.90%   91.90%   -0.01%     
==========================================
  Files         203      204       +1     
  Lines        8409     8433      +24     
  Branches      915      921       +6     
==========================================
+ Hits         7728     7750      +22     
- Misses        504      505       +1     
- Partials      177      178       +1     
Impacted Files Coverage Δ
src/fastoad/cmd/api.py 91.00% <ø> (ø)
src/fastoad/io/configuration/exceptions.py 100.00% <ø> (ø)
src/fastoad/openmdao/variables.py 89.78% <81.81%> (-0.31%) :arrow_down:
src/fastoad/io/configuration/configuration.py 91.60% <100.00%> (-0.60%) :arrow_down:
src/fastoad/openmdao/_utils.py 100.00% <100.00%> (ø)
src/fastoad/openmdao/exceptions.py 100.00% <100.00%> (ø)
src/fastoad/openmdao/problem.py 98.27% <100.00%> (+1.84%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 24f6fbb...2113642. Read the comment docs.

christophe-david commented 2 years ago

I realized something annoying. I think this PR got us further from resolution of #357. This issue was mainly about passing through OpenMDAO setup when an input of the problem has dynamic shape. It prevents the reading of an input file only because we want to analyze the problem to know needed variables before reading the file. Without this analysis, the input reading would go fine... before this PR. Indeed, while we were adding inputs as IVC to the problem, a dynamically-shaped input would have been fed by the IVC. But now we rely on the set_val method and we cannot possibly go through the setup this way. Yet, we need to use set_val to be compatible with the objective of this PR, that is to allow IVCs to be present in the defined problem...

christophe-david commented 2 years ago

Don't bother. Working on a solution...