Skip to content

Latest commit

 

History

History
126 lines (79 loc) · 7.77 KB

whatsopt_tutorial_part_1.md

File metadata and controls

126 lines (79 loc) · 7.77 KB

WhatsOpt tutorial - Part 1

Installation

Prerequisites

Install OpenMDAO 3.0+ required

pip install openmdao 

WhatsOpt command line installation

pip install wop

You can test with

wop --version
wop, version 1.19.1

Sellar Analysis Creation

Open your favourite web browser (Firefox recommended) and navigate to the WhatsOpt server url. If you are not already logged in, you land on the log in page. Once you are logged in you see the Analyses page.

Multidisicplinary analyses

We are going to create the Sellar analysis which is kind-of the "hello world" of the MDAO domain. The figure below is copied from OpenMDAO tutorial. In our analysis below, we will group the Objective and Contraint components in one single component named Functions.

sellar XDSM

a. 0n the Analyses page, create a new analysis by clicking on the "New" button. Enter the name of the New Analysis. The WhatsOpt convention here is to use a CamelCase name, let say: Sellar.

New Sellar analysis

b. Once you clicked Submit button, you arrive on the edition page of the analysis which is empty at the moment. Below the title the XDSM diagram is for the moment displayed with a single component named Driver which represent the user of the analysis (directly the actual user if he or she runs tha analysis once or indirectly through the usage of an optimizer [XXX] or a design of experiment runner [XXX]). AT the bottom there are four tabs : Analysis, Disciplines, Connections, Variables, the latter one is displayed as a default. We can see there is no variable for the moment (no rows in the table).

Note: All screenshots were made with XDSM v1 standard, since then WhatsOpt uses XDSM v2 (which mainly differs by using less flashy colors).

Edit no variable

c. Click on the Analysis tab. Here you can update the name of your analysis or restrict access to your analysis.

Edit analysis

d. As we are happy with the current analysis name we click on the second tab named Disciplines. On this tab, we can enter the disciplines of our analysis. Successivly we enter three names in the textfield: Disc1 (press Enter), Disc2 (press Enter), Functions (press Enter). WhatsOpt convention here is also to have CamelCase names. Note you can use a single underscore to display following text as subscript (e.g. Disc_1 will be displayed as Disc1 in the XDSM).

e. For Functions, we can click on the edit button next to the label, select the Function type and update. This action is just aesthetic to inform that this component is not a true discipline code but rather a set of functions used to compute some quantities from true disciplines outputs (actually the true multi-disciplinary analysis is only composed with Disc1 and Disc2.

Note: The cosmetic distinction between discipline and functions was removed with XDSM v2.

Add disciplines

Note that you can drag and drop disciplines to change their order in the list or delete a discipline by clicking on the cross button on the right.

f. After entering our disciplines, we can move on Connections tab where we will enter so called connections between disciplines. Those connections are created by selecting 'from discipline' and 'to discipline' and entering comma-separated list of variable names. WhatsOpt convention is to une snake_case for such names.

On the to discipline selector, you select Disc1.

On the texfield you enter x, z then press enter.

Add connections

You've just created two variable connections between the Driver and Disc1 (the Driver feeds Disc1 with 2 variables names x and z). Those connections are reflected in the XDSM diagram.

XDSM connections

Notes:

  • when you select a diagonal component (i.e. a discipline) in the XDSM is border is hihglighted and you can see its inputs and outputs.
  • when you select an off-diagonal component (i.e. connections) the variables are listed and can be deleted by pressing the corresponding cross button.
  • To unselect, click again on the selected element.

g. Successively, you keep on selecting and typing:

  • From: Driver, To: Disc2, enter x, then press Enter
  • From: Driver, To: Functions, enter x, z, then press Enter
  • From: Disc1, To: Disc2, enter y1, then press Enter
  • From: Disc1, To: Functions, enter y1, then press Enter
  • From: Disc2, To: Functions, enter y2, then press Enter
  • From: Disc2, To: Disc1, enter y2, then press Enter
  • From: Functions, To: Driver, enter f, g1, g2, then press Enter

You finally get the following XDSM.

Sellar XDSM

h. You've entered all the connections, you can move on the Variables tab and see that the table is now filled with the variables you've just entered. Each line contains information about a variable, the table columns are :

  • checkbox: that checkbox allows to deactivate a variable. You know that you're not going to use it bu you want to keep the information and reactivate it later on.
  • From : Discipline that produce the variable (always uniq).
  • To: Disciplines that consumes the variable.
  • Name: the name of the variable
  • Role: the role of a variable. As a default, variables produced by Driver are design variables, variables consumed by the Driver are responses, others are state variables.
  • Description: short description of the variable (empty by default)
  • Type: Float by default, can be Integer or String but at the code generation level only Float are supported.
  • Shape: can be either 1 (meaning scalar), (n,), (n, m), (n, m, p) or (n, m, p, q) Python shape
  • Units: text representing units used for the variable quantity.
  • Init: Initial value (default to 1.0 if empty).
  • Lower: Lower bound of the variable quantity (only used for design variables)
  • Upper: Upper bound of the variable quantity (only used for design variables)

Edit variables

Notes:

  • when you select a component the table is updated accordingly showing only the relevant variables
  • ordering is available by clicking on the headers of the columns
  • with the leading checkbox on, the columns from Name to Upper are editable

i. To implement Sellar analysis properly we have to set z as being a vector of size 2. So you click on the shape column of the z variable and set its shape to (2,).

We can also initialize the design variables :

  • select the Init cell of the x variable and set it to 2.
  • select the Init cell of the z variable and set it to [5, 2].

As for now, there is no check on the compatibility between the values and type/shape you enter at WhatsOpt level. Actually the checking will be done later on at runtime when you will run the generated code.

Sellar analysis initialized