# WISDEM seems to ignore my user-defined constraint

**URL:** <https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [March 26, 2025, 12:28am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534 "2025-03-26T00:28:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henny.Bottini](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/henny.bottini/32/3236_2.png) [@Henny.Bottini](https://forums.nlr.gov/u/Henny.Bottini)\
**Post date:** [March 26, 2025, 12:28am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/1 "2025-03-26T00:28:48Z")

</div>

Hello everybody.  
I am optimizing a monopile offshore wind turbine in two steps: first the rotor and then the tower/monopile.  
The output of the rotor optimization becomes the input geometry for the tower/monopile optimization.  
In the latter optimization, I would like to set a user-defined constraint to keep fixed the diameter of the tower top, while having all the others variable.  
My _analysis\_options.yaml_ looks like this:

```auto
design_variables:
    tower:
        outer_diameter:
            flag: True
            lower_bound: 7.7300
            upper_bound: 15.0
...
constraints:
...
    user:
        - name: tower.diameter
          upper_bound: [7.7508]
          lower_bound: [7.7308]
          indices: [-1]

```

The optimization starts without any warning or error and completes successfully.  
When I inspect the _outputFileName-analysis.yaml_ in the folder of the optimization outputs, I can see my user-defined constraint:

```auto
constraints:
    user:
          - name: tower.diameter
             upper_bound: [7.7508]
             lower_bound: [7.7308]
             indices: [-1]

```

but when I inspect the tower-height vs tower-diameter plot I see the top diameter changed like all the others.  
I tried also the following variables as user-defined constraint :  
_towerse.tower\_outer\_diameter, drivese.D\_top, fixedse.monopile.monopile\_tower\_d\_full, towerse.member.d\_eff_  
and the result has been always the same as for _tower.diameter_. All the variables tried are [WISDEM Output Variables](https://wisdem.readthedocs.io/en/master/docstrings/wisdem_outputs.html#wisdem-outputs-documentation) as per the instruction in [WISDEM documentation](https://wisdem.readthedocs.io/en/master/examples/03_blade/user.html) .  
Then, to be sure that my settings are really read, I also set a non-existent variable as user-defined constraint:

```auto
design_variables:
    tower:
        outer_diameter:
            flag: True
            lower_bound: 7.7300
            upper_bound: 15.0
...
constraints:
...
    user:
        - name: tower.ciccio
          upper_bound: [7.7508]
          lower_bound: [7.7308]
          indices: [-1]

```

**and the optimization started without any error or warning…**  
Then it really seems that WISDEM simply ignores my user-defined constraint, even if it is reported in the _outputFileName-analysis.yaml_.  
Can someone help me understand why my setting is ignored?  
I am using WISDEM 3-10-1 development version

Thank you for your time and attention

---

<div class="post-metadata">

**Author:** ![Garrett.Barter](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Garrett.Barter](https://forums.nlr.gov/u/Garrett.Barter)\
**Post date:** [March 26, 2025, 2:24pm UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/2 "2025-03-26T14:24:22Z")

</div>

You cannot set the same variable to be both a design variable and a constraint. That is a poorly posed optimization problem. I see we have not enabled an `indices` input for the tower design variables, which is probably something to add to the to-do list. Nevertheless, I would suggest setting your design variable lower bound to be the tower top diameter you desire, and also adjust your initial condition to be the same. So, in the analysis options file you have:

```auto
design_variables:
    tower:
        outer_diameter:
            flag: True
            lower_bound: 7.74
            upper_bound: 15.0

```

And you don’t have a user-specified constraint on the tower diameter. It may help to turn on the `slope` constraint for the tower to ensure a smooth, monotonic diameter profile. In the geometry file, you have:

```auto
    tower:
        outer_shape_bem:
            reference_axis: &ref_axis_tower
                x:
                    grid: [0.0, 1.0]
                    values: [0.0, 0.0]
                y:
                    grid: [0.0, 1.0]
                    values: [0.0, 0.0]
                z:
                    grid: &grid_tower [0., ... 1.]
                    values: [...]
            outer_diameter:
                grid: *grid_tower
                values: [15.0, ..., 7.74]

```

---

<div class="post-metadata">

**Author:** ![Henny.Bottini](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/henny.bottini/32/3236_2.png) [@Henny.Bottini](https://forums.nlr.gov/u/Henny.Bottini)\
**Post date:** [March 27, 2025, 5:56am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/3 "2025-03-27T05:56:01Z")

</div>

I tried what you suggest about the lower bound, but the tower-top diameter of the optimized design gets anyway 25 cm larger than the initial configuration value.  
The `slope` constraint is turned on.

I also tried to replace the default design-variable setting for the tower diameters with a user-defined design variable that would allow the use of `indices` that you mentioned. Then I set the upper bound equal to the lower bound only for the index of the tower top:

```auto
design_variables:
    tower:
        outer_diameter:
            flag: False
            lower_bound: 7.7300
            upper_bound: 15.0
...
user:
        - name: towerse.tower_outer_diameter_in
          lower_bound: [7.7300]
          upper_bound: [7.7300, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0 , 15.0]

```

The optimization ran without any warning and completed successfully, but the results was exactly the same as with the default design variable: the optimized tower top is larger than 7.73 m.  
Instead of ` towerse.tower_outer_diameter_in` I also tried `tower.diameter`, but I got the very same result.  
This time my user-defined design variable seems to be ignored…

Thank you Garret for your time and attention

---

<div class="post-metadata">

**Author:** ![Garrett.Barter](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Garrett.Barter](https://forums.nlr.gov/u/Garrett.Barter)\
**Post date:** [March 27, 2025, 10:33am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/4 "2025-03-27T10:33:03Z")

</div>

Setting the tower diameter as a design variable twice is also likely to cause problems, so I wouldn’t recommend that approach. If the optimized value of the tower top comes out larger than the initial condition, there may be other stress or frequency constraints that are pushing the optimizer in that direction. You may also want to experiment with lower convergence tolerance or other optimization algorithms, as it sounds like your problem is quite sensitive to small changes.

---

<div class="post-metadata">

**Author:** ![Henny.Bottini](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/henny.bottini/32/3236_2.png) [@Henny.Bottini](https://forums.nlr.gov/u/Henny.Bottini)\
**Post date:** [March 28, 2025, 4:43am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/5 "2025-03-28T04:43:41Z")

</div>

> [@Garrett.Barter](#):
>
> Setting the tower diameter as a design variable twice is also likely to cause problems, so I wouldn’t recommend that approach.

I flagged the default tower _outer\_diameter_ design variable to False: doesn’t this left only the user-defined design variable active?  
I’ll experiment with your other suggestions and report on the results.

Thank you again.  
Have a nice weekend

---

<div class="post-metadata">

**Author:** ![Henny.Bottini](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/henny.bottini/32/3236_2.png) [@Henny.Bottini](https://forums.nlr.gov/u/Henny.Bottini)\
**Post date:** [April 4, 2025, 7:21am UTC](https://forums.nlr.gov/t/wisdem-seems-to-ignore-my-user-defined-constraint/8534/6 "2025-04-04T07:21:46Z")

</div>

The tower-top diameter is kept constant with the following settings:

```auto
design_variables:
    tower:
        outer_diameter:
            flag: True
            lower_bound: 7.7300
            upper_bound: 15.0
...
user:
        - name: towerse.tower_outer_diameter_in
          lower_bound: [7.7000]
          upper_bound: [7.7600, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0, 15.0 , 15.0]

```

and in _modeling\_options_:

```auto
TowerSE:
...
    n_refine: 1

```

I found this combination by pure chance, since we wanted to play with the number of calculation points along the tower and monopile (as reported in my other post). And we are OK with a reduction of calculation points if we can have the constraint on the tower-top diameter.
