.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/study_analysis/plot_study_analysis.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_study_analysis_plot_study_analysis.py: Generate an N2 and XDSM from an Excel description of the MDO problem ==================================================================== .. GENERATED FROM PYTHON SOURCE LINES 24-36 .. code-block:: default from __future__ import annotations from os import mkdir from os.path import exists from os.path import join from gemseo.api import configure_logger from gemseo.utils.study_analysis import StudyAnalysis configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 37-42 Describe your MDO problem in an Excel file ------------------------------------------ .. image:: /_images/study_analysis_example/disciplines_spec.png .. GENERATED FROM PYTHON SOURCE LINES 44-46 Visualize this study -------------------- .. GENERATED FROM PYTHON SOURCE LINES 46-50 .. code-block:: default study = StudyAnalysis("disciplines_spec.xlsx") if not exists("outputs"): mkdir("outputs") .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:59:52: 2 disciplines detected INFO - 16:59:52: Discipline1 INFO - 16:59:52: Inputs: a, b, c INFO - 16:59:52: Outputs: d, e, g INFO - 16:59:52: Discipline2 INFO - 16:59:52: Inputs: d, g, x, z INFO - 16:59:52: Outputs: a, b, f INFO - 16:59:52: 1 scenario detected INFO - 16:59:52: Scenario INFO - 16:59:52: Objectives: f INFO - 16:59:52: Disciplines: Discipline1, Discipline2 INFO - 16:59:52: Constraints: g INFO - 16:59:52: Design variables: x INFO - 16:59:52: Formulation: MDF .. GENERATED FROM PYTHON SOURCE LINES 51-53 Generate N2 chrt ^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 53-55 .. code-block:: default study.generate_n2(file_path=join("outputs", "n2.png"), save=False, show=True) .. image-sg:: /examples/study_analysis/images/sphx_glr_plot_study_analysis_001.png :alt: plot study analysis :srcset: /examples/study_analysis/images/sphx_glr_plot_study_analysis_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-58 Generate XDSM ^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 58-59 .. code-block:: default study.generate_xdsm("outputs") .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:59:52: Generated the following Scenario: INFO - 16:59:52: MDOScenario INFO - 16:59:52: Optimization problem: INFO - 16:59:52: minimize f(x) INFO - 16:59:52: with respect to x INFO - 16:59:52: subject to constraints: INFO - 16:59:52: g(x) == 0.0 INFO - 16:59:52: Generating HTML XDSM file in : outputs/xdsm.html MDOScenario Disciplines: Discipline1 Discipline2 MDO formulation: MDF .. GENERATED FROM PYTHON SOURCE LINES 60-61 .. image:: /_images/study_analysis_example/xdsm.png .. GENERATED FROM PYTHON SOURCE LINES 63-80 Visualize this study from command line -------------------------------------- We can create the same figures using command line inputs: .. code:: gemseo-study disciplines_spec.xlsx -o outputs -s '(5,5)' -x -l where: - :code:`gemseo-study` is an executable provided by |g|, - :code:`disciplines_spec.xlsx` is the Excel file path, - :code:`-o outputs` is the output directory, - :code:`-s '(5,5)'` is the size of the N2 chart, - :code:`-x` is an option to create of the XDSM, - :code:`-l` is an option to create a PDF file with the creation of the XDSM. .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.319 seconds) .. _sphx_glr_download_examples_study_analysis_plot_study_analysis.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_study_analysis.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_study_analysis.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_