Simple bending free example

Introduction

In this example we will optimise a constant tension TF coil shape with a ripple constraint.

import matplotlib.pyplot as plt

from bluemira.builders.tf_coils import (
    EquispacedSelector,
    RippleConstrainedLengthGOP,
    RippleConstrainedLengthGOPParams,
)
from bluemira.equilibria.shapes import KuiroukidisLCFS
from bluemira.geometry.parameterisations import PrincetonDDiscrete
from bluemira.geometry.tools import make_polygon

Set up the parameterisation and inputs


parameterisation = PrincetonDDiscrete(
    {
        "x1": {"value": 4.0, "fixed": True},
        "x2": {"value": 14.0, "lower_bound": 10.0, "upper_bound": 17.0, "fixed": False},
        "dz": {"value": 0.0, "fixed": True},
    },
    n_TF=16,
    tf_wp_depth=1.0,
    tf_wp_width=1.0,
)

wp_xs = make_polygon(
    {"x": [3.5, 4.5, 4.5, 3.5], "y": [-0.5, -0.5, 0.5, 0.5], "z": 0}, closed=True
)


lcfs = KuiroukidisLCFS().create_shape()

params = RippleConstrainedLengthGOPParams.from_dict({
    "n_TF": {"value": 16, "unit": "", "source": "test"},
    "R_0": {"value": 9, "unit": "m", "source": "test"},
    "z_0": {"value": 0, "unit": "m", "source": "test"},
    "B_0": {"value": 6, "unit": "T", "source": "test"},
    "TF_ripple_limit": {"value": 0.6, "unit": "%", "source": "test"},
})

Set up the opimisation problem

problem = RippleConstrainedLengthGOP( parameterisation, algorithm=”SLSQP”, opt_conditions={“max_eval”: 100, “ftol_rel”: 1e-6}, opt_parameters={}, params=params, wp_cross_section=wp_xs, ripple_wire=lcfs, ripple_selector=EquispacedSelector(5, 0.5), keep_out_zone=None, rip_con_tol=0.001, )

Run the optimisation problem

problem.optimise()
problem.plot()
plt.show()