From 6758a3ccbca1dd27ebe146f2032b5dc162284a0f Mon Sep 17 00:00:00 2001 From: daniel-dudt Date: Mon, 19 Aug 2024 17:11:26 -0600 Subject: [PATCH] allow QuadraticFlux to take multiple fields --- desc/objectives/_coils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/desc/objectives/_coils.py b/desc/objectives/_coils.py index 62ef664622..bfc5e0d548 100644 --- a/desc/objectives/_coils.py +++ b/desc/objectives/_coils.py @@ -1175,12 +1175,11 @@ def __init__( self._source_grid = source_grid self._eval_grid = eval_grid self._eq = eq - self._field = field + self._field = [field] if not isinstance(field, list) else field self._field_grid = field_grid self._vacuum = vacuum - things = [field] super().__init__( - things=things, + things=self._field, target=target, bounds=bounds, weight=weight, @@ -1200,6 +1199,8 @@ def build(self, use_jit=True, verbose=1): Level of output. """ + from desc.magnetic_fields import SumMagneticField + eq = self._eq if self._eval_grid is None: @@ -1241,7 +1242,7 @@ def build(self, use_jit=True, verbose=1): ) self._constants = { - "field": self._field, + "field": SumMagneticField(self._field), "field_grid": self._field_grid, "quad_weights": w, "eval_data": eval_data, @@ -1258,7 +1259,7 @@ def build(self, use_jit=True, verbose=1): super().build(use_jit=use_jit, verbose=verbose) - def compute(self, field_params, constants=None): + def compute(self, *field_params, constants=None): """Compute boundary force error. Parameters