Closed athoynilimanew closed 6 months ago
Ah, I can explain this a little bit. When doing a current vector optimisation (as opposed to dcurrent vector optimisation - see _get_dummy_equilibrium
) we trick the constraint so that it splits out the plasma background response from the controlled coil response.
The PlasmaCoil
is masquerading deliberately as an Equilibrium
. We'd never had any constraints that required methods on Equilibrium
that were not also on PlasmaCoil
.
The simple answer is that LCFS is an optional input and get called up when I_not_dI == True
, because in the PlasmaCoil
case the concept of an LCFS does not really make sense. I am not sure that will do what you need. Personally, in order to comply more easily with our constraint framework, I would use a normalised flux equaity constraint with a slightly looser than normal tolerance, but those units would sadly not be [m].
Bit of a side note: I have never really understood this constraint... It is similar to what one might call a "gap" constraint in normal parlance, which is something that I have never implemented. Technically, I think they are only valid about a "linearised" plasma state, for which I'm told you need to converge representative equilibria to get a good idea of the linearised control response of a gap constraints. I'm actually thinking about trying to do an approximate gap constraint response function, but never seem to find the time...
As this is by design, closing
Describe the bug
I have been trying to use the
CurrentMidplanceConstraint
function frombluemira.equilibria.optimisation.constraint_funcs
, to use with aTikhonovCurrentCOP
But I am getting the following error:
Steps to reproduce
This is how I built a constraint class inherited from
UpdateableConstraint
and this is how I use it:
given coilset and eq defined before.
Expected behaviour
I expected the constrained_iterator() to run. As defined in the
bluemira.equilibria.optimisation.constraint_funcs
,CurrentMidplanceConstraint
should know thatself.eq
is anEquilibrium
object, not aPlasmaCoil
.Screenshots / Tracebacks
Environment (please complete the following information)
Additional context
Discussed this with @oliverfunk. We tried to modify
CurrentMidplanceConstraint
to haveLCFS
as input, instead ofEquilibrium
. The same error as above was observed.You can see the old current midplane constraint definition in here: old coilset optimisation example