Skip to content

Commit

Permalink
Fix test failures and minor documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hansec committed Mar 1, 2024
1 parent 63a2b39 commit db85eb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/python/OpenFUSIONToolkit/TokaMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ def __init__(self,debug_level=0,nthreads=2):
self._cond_dict = {}
## Coil definition dictionary
self._coil_dict = {}
## Coil set definitions, including sub-coils
self.coil_sets = {}
## Vacuum F value
self._F0 = 0.0
## Plasma current target value (use @ref TokaMaker.TokaMaker.set_targets "set_targets")
Expand Down Expand Up @@ -1036,9 +1038,9 @@ def get_field_eval(self,field_type):
return TokaMaker_field_interpolator(int_obj,imode,field_dim)

def get_coil_currents(self):
'''! Get currents in each coil [A-turns]
'''! Get currents in each coil [A] and coil region [A-turns]
@result Coil currents, Coil to region map
@result Coil currents [ncoils], Coil currents by region [nregs]
'''
currents = numpy.zeros((self.ncoils,),dtype=numpy.float64)
currents_reg = numpy.zeros((self.nregs,),dtype=numpy.float64)
Expand Down Expand Up @@ -1207,7 +1209,7 @@ def get_xpoints(self):
def set_coil_currents(self, currents):
'''! Set coil currents
@param currents Current in each coil [A-turns]
@param currents Current in each coil [A]
'''
if currents.shape[0] != self.ncoils:
raise ValueError('Incorrect shape of "currents", should be [ncoils]')
Expand Down
4 changes: 2 additions & 2 deletions src/tests/physics/test_TokaMaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def masked_err(point_mask,gs_obj,psi,sort_ind):
# Run EQ
mygs = TokaMaker()
mygs.setup_mesh(mesh_pts,mesh_lc,mesh_reg)
mygs.setup_regions(cond_dict=cond_dict)
mygs.setup_regions(cond_dict=cond_dict,coil_dict=coil_dict)
mygs.setup(order=fe_order)
mygs.set_coil_currents(np.array([1.E-2]))
err_flag = mygs.solve(True)
Expand Down Expand Up @@ -328,7 +328,7 @@ def create_mesh():
mygs = TokaMaker()
mesh_pts,mesh_lc,mesh_reg,coil_dict,cond_dict = load_gs_mesh('ITER_mesh.h5')
mygs.setup_mesh(mesh_pts,mesh_lc,mesh_reg)
mygs.setup_regions(cond_dict=cond_dict)
mygs.setup_regions(cond_dict=cond_dict,coil_dict=coil_dict)
mygs.setup(order=fe_order,F0=5.3*6.2)
vsc_signs = np.zeros((mygs.ncoils,), dtype=np.float64)
vsc_signs[[coil_dict['VSU']['coil_id'], coil_dict['VSL']['coil_id']]] = [1.0,-1.0]
Expand Down

0 comments on commit db85eb1

Please sign in to comment.