Closed VinceSO closed 4 years ago
Hi @VinceSO,
Thanks for flagging this issue. I made a new version 0.6, which can handle Auto-IVC.
I would also recommend to turn off the include_indepvarcomps
option in write_xdsm()
to keep the diagram cleaner.
Thanks a lot. I gonna install this version very soon. Yes, the option include_indepvarcomps is very very useful. 😁
Hi, I tested your dev and thanks a lot for your reactivity. The xDSM is now generated but I've detect a minor issue about the variable naming. They are called v0, v1, ... in the diagram.
I also noticed it. The reason is, that in the Auto-IVC component the outputs are names v0, v1, v2, ... I guess it is set up this way to ensure unique names. So far I was using the source names in the XDSM as the variable names. I will change this in case of the Auto-IVC for target names. Maybe it could be a user option to show the target name in case of normal components too, but might look a bit confusing (since it is not visible on the XDSM, that they are the same variable).
@VinceSO now the target names are used for Auto-IVC connections.
import openmdao.api as om
from omxdsm import write_xdsm
p = om.Problem()
p.model.add_subsystem('paraboloid', om.ExecComp('f = (x-3)**2 + x*y + (y+4)**2 - 3'), promotes_inputs=['x', 'y'])
# setup the optimization
p.driver = om.ScipyOptimizeDriver()
p.driver.options['optimizer'] = 'SLSQP'
p.model.add_design_var('x', lower=-50, upper=50)
p.model.add_design_var('y', lower=-50, upper=50)
p.model.add_objective('paraboloid.f')
p.setup()
p.final_setup()
# Write output
write_xdsm(p, filename='xdsm_auto_ivc', out_format='pdf', show_browser=True, quiet=False,
include_indepvarcomps=False) # Not showing the Auto IVC
Nice work 👍 !
Hello,
Due to an update to the Auto-IVC (IndepVarComp) functionality in OpenMDAO, there is a new development which will be very useful. The declaration of independent variables is no longer mandatory in OpenMDAO. Without this declaration, it is not possible at the moment to generate the xDSM. The scripts available in the OpenMDAO help (http://openmdao.org/twodocs/versions/latest/other/auto_ivc_api_translation.html?highlight=ivc) are a very good test. In OpenMDAO-XDSM, the following error is reported:
Traceback (most recent call last): File "C:\Users\vambert\workspace\openMDAO_test\prab2.py", line 34, in
write_xdsm(prob, filename='toto', out_format='html', include_solver=True, show_browser=True, quiet=False, output_side='left', legend=True, class_names=False, include_indepvarcomps=False)#, show_parallel=False)
File "C:\Users\vambert\AppData\Local\Continuum\anaconda2\envs\openmdao\lib\site-packages\omxdsm\xdsm_writer.py", line 1272, in write_xdsm
include_indepvarcomps=include_indepvarcomps, **kwargs)
File "C:\Users\vambert\AppData\Local\Continuum\anaconda2\envs\openmdao\lib\site-packages\omxdsm\xdsm_writer.py", line 1570, in _write_xdsm
(comps_dct[src]['is_parallel'] or comps_dct[tgt]['is_parallel'])
KeyError: '@auto@ivc'
Thanks
Best regards
Vincent