D3DEnergetic / FIDASIM

A Neutral Beam and Fast-ion Diagnostic Modeling Suite
http://d3denergetic.github.io/FIDASIM/
Other
29 stars 19 forks source link

Bug in Magnetic Field Calculation and COCOS #238

Closed lstagner closed 2 years ago

lstagner commented 3 years ago

So this is the basic problem. Right now the idl and the python codes make the assumption that the poloidal flux is of the ribbon variety instead of the disk variety (see image below from Flux Coordinates and Magnetic Field Structure: 4.7.1).

Flux Coordinates and Magnetic Field Structure: 4.7.1 The problem is that depending on which interpretation you use the poloidal field can be flipped because dPsi_disk = -dPsi_ribbon.

So far we have recommended using extract_transp_geqdsk to get the geqdsk file from a transp run. The poloidal flux outputted is of the ribbon variety where the poloidal flux at the magnetic axis is zero. However if a person uses a geqdsk file from MDSplus or EFIT its using the disk variety. Right now FIDASIM only supports "ribbon" geqdsk. Additionally, some machines have different conventions toroidal coordinate conventions. We need to support all of them.

To that end I suggest we implement the COCOS convention so we can take a geqdsk file, determine the COCOS, and convert it to the convention FIDASIM uses.

We may also want to look into changing how we represent fields in FIDASIM to use the flux function.

@gardner-chris I'm assigning this to you as you are working on the Zeeman splitting and this would probably effect you. @shaunhaskey you may of run into this bug.

lstagner commented 3 years ago

Looking at the COCOS paper you can see that in the case of a "ribbon" poloidal flux the poloidal field depends on the sign of the current.

Screen Shot 2021-04-30 at 11 01 04 PM
kudav commented 2 years ago

Hey all, was there any progress on this front in the meantime? We're running into this exact issue in our interface from BEAMS3D to FIDASIM so would be helpful to know :)

lstagner commented 2 years ago

Not yet address but its now on my todo list

hayashiw commented 2 years ago

@lstagner Since this is an issue that affects geqdsk files but also equilibrium inputs in other formats and from other machines, would the most general solution be to implement COCOS checks and conversions in the read_equilibrium subroutine in FIDASIM rather than in preprocessing?

lstagner commented 2 years ago

@hayashiw What is the status of this?

hayashiw commented 2 years ago

@lstagner I have it implemented on python preFida but it needs to be tested against g-files with different COCOS index. I'm working on the IDL preFida implementation.

lstagner commented 2 years ago

If you need gfiles with different cocos check out the files here: https://github.com/ProjectTorreyPines/Equilibrium.jl/tree/master/test

hayashiw commented 2 years ago

@lstagner Is this issue closed?

lstagner commented 2 years ago

We have cocos support now so it should be fixed.