Skip to content

Commit

Permalink
Merge pull request #486 from fast-aircraft-design/fix-openmdao
Browse files Browse the repository at this point in the history
Fixed VariableList.from_ivc()
  • Loading branch information
christophe-david committed Apr 3, 2023
2 parents 16c4c95 + e53dee0 commit 95ab229
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/fastoad/openmdao/variables/variable_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Class for managing a list of OpenMDAO variables.
"""
# This file is part of FAST-OAD : A framework for rapid Overall Aircraft Design
# Copyright (C) 2022 ONERA & ISAE-SUPAERO
# Copyright (C) 2023 ONERA & ISAE-SUPAERO
# FAST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down Expand Up @@ -197,8 +197,11 @@ def from_ivc(cls, ivc: om.IndepVarComp) -> "VariableList":
"""
variables = cls()

# Need setup on ivc to have get_io_metadata() working
ivc = deepcopy(ivc)
om.Problem(ivc).setup() # Need setup to have get_io_metadata working
problem = om.Problem()
problem.model.add_subsystem("ivc", ivc)
problem.setup()

for name, metadata in ivc.get_io_metadata(
metadata_keys=["val", "units", "upper", "lower"]
Expand Down

0 comments on commit 95ab229

Please sign in to comment.