Skip to content

Helicity must be set in gpec namelist if not using coils #166

@logan-nc

Description

@logan-nc

The GPEC OMFIT workflow manager previously automated the setting of ip_direction and bt_direction in the coil namelist, but @ysm1887 and @jmhanson found that the user needed to manually set the directions in the gpec namelist.

This is a record of that discussion, so future users/developers can reference the documented issue.

From @jmhanson:

I do have one question about the plasma helicity. 152789 has Ip > 0 and Bt < 0, so I would call the helicity "left-handed". In gpec_control_output_n1.nc, the helicity attribute is +1. I also see that the response mode contours (pages 4-5) go the opposite direction I would expect on the LFS midplane. I think GPEC is getting the helicity from the geqdsk file. Could this information be getting lost or reversed somewhere?

@logan-nc:

GPEC takes the ip_direction and bt_direction as manual inputs in either the COIL_CONTROL namelist or the GPEC_INPUT namelist. OMFIT does indeed attempt to get this information from the gfile as a post-process of the GUI for loading equilibrium, but it only does so through the coil namelist (i.e. the set_coil_equilibrium script). Is it possible you ran this (a) without using the GUI and without calling this script or (b) without using coils but without adding the helicity information to the gpec namelist?

@logan-nc then added this logic to double-check the helicity settings at runtime in the OMFIT run_exes.py script

        # check helicity logic has been properly set
        btd = root['INPUTS'][f'{gexeu}'][f'{gexeu}_INPUT'].get('bt_direction', 'positive')
        ipd = root['INPUTS'][f'{gexeu}'][f'{gexeu}_INPUT'].get('ip_direction', 'positive')
        btip_nml = gexeu
        if root['INPUTS'][gexeu][gexeu + '_INPUT']['coil_flag']:  # coil namelist
            btd = root['INPUTS']['COIL'][t]['COIL_CONTROL'].get('bt_direction', btd)
            ipd = root['INPUTS']['COIL'][t]['COIL_CONTROL'].get('ip_direction', ipd)
            btip_nml = 'COIL'
            if btd != root['INPUTS'][f'{gexeu}'][f'{gexeu}_INPUT'].get('bt_direction', btd) or ipd != root['INPUTS'][f'{gexeu}'][
                f'{gexeu}_INPUT'
            ].get('ip_direction', ipd):
                raise OMFITexception(f"{gexeu} ip & bt directions do not match COIL namelist")
        if root['INPUTS']['EQUIL']['EQUIL_CONTROL']['eq_type'] == 'efit':
            eq = root['INPUTS']['EQUILIBRIUM'][t]
            if (eq['BCENTR'] > 0 and btd != 'positive') or (eq['BCENTR'] < 0 and btd != 'negative'):
                raise OMFITexception(f"{btip_nml} bt_direction does not match g-file")
            if (eq['CURRENT'] > 0 and ipd != 'positive') or (eq['CURRENT'] < 0 and ipd != 'negative'):
                raise OMFITexception(f"{btip_nml} ip_direction does not match g-file")
        else:
            printw(f" > Running with bt {btd} and ip {ipd} >> Be sure this is correct")

as well as logic updating the gpec.in ip and bt directions when loading an equilibrium file.

@jmhanson

Thanks, Nik. I think I see the problem now. The ip_direction and bt_direction inputs are set correctly in coil.in. However, we have coil_flag = .false. in gpec.in. So I think I now understand that for intrinsic EF calculations using SURFMN, we need to put ip_direction and bt_direction in gpec.in because we are keeping the coil.in file disabled.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions