icfaust / TRIPPy

Toroidal Radiation Inversion Protocol (Python)
MIT License
2 stars 2 forks source link

Diagnostic weights near the LCFS #1

Open fsciortino opened 5 years ago

fsciortino commented 5 years ago

Hi Ian,

I hope you're well! I was wondering whether you could help me with a quick thing. I've been using TRIPPy to get weights to line integrate emissivities and compare to Hirex-Sr, XEUS, LoWEUS and XTOMO data on C-Mod. A minimal working example to plot XEUS weights is:

efit_tree = eqtools.CModEFITTree(1101014019)
tokamak = TRIPPy.plasma.Tokamak(efit_tree)  

XEUS_POS = [2.561, 0.2158, 0.196, 0.1136]

XEUS_beam = TRIPPy.beam.pos2Ray(XEUS_POS, tokamak)

sqrtpsinormgrid = np.linspace(0,1.005, 200)  # extending slightly outside of LCFS

XEUS_weights = TRIPPy.invert.fluxFourierSens(
                XEUS_beam,
                efit_tree.rz2psinorm,
                tokamak.center,
                1.25, 
                sqrtpsinormgrid**2.0,   
                ds=1e-5
            )[0]

plt.figure()
plt.plot(sqrtpsinormgrid, XEUS_weights, '.')

The issue that I'm having here is to deal with weights near the LCFS. For many applications, these can just be set to 0, since there will be no emissivity from the plasma at such low temperatures, but in some (hot) discharges XEUS and LoWEUS particularly can have useful signals extending across the LCFS. I suspect that the error that would come from ignoring this wouldn't be negligible.

Plotting the MWE above shows that the weights misbehave outside of the LCFS, and maybe even just inside of it. An easy fix might be to set weights outside of rho=0.998 to be constant at the same value. However, I was wondering whether you could give me some advice on how to possibly prevent this issue and/or a better understanding of why it occurs. Thanks!

icfaust commented 5 years ago

Hey dude!!!

I just wanted to quickly respond that I will look at it in detail tomorrow, just to let you know that I am looking into it. What I am worried about is that the LCFS region will generally be rather weird due to the limitations in the EFIT geometry and some of the assumptions going into the general TRIPPy inversion using flux-based coordinates.

As I am sure you know, that flux-based symmetry gets way way off once very close or over into the LCFS. The inversion model also assumed 0 emissivity (Dirichlet BC) in the SOL to make the inversion process a bit simpler (if I remember correctly).

We might be able to attack it with a Neumann condition to provide a finite value. I'll let you know! -Ian

fsciortino commented 5 years ago

Thanks for the quick reply! I really appreciate any help you can give. I realize that asking questions about spectroscopy across the LCFS is like opening a can of warms, but... please let me know if anything can be done! Thanks a lot!

fsciortino commented 5 years ago

Hey Ian, did you get a chance to look at this? Thanks!

fsciortino commented 5 years ago

Hi Ian! I'd still be interested in this, in case you can help :)

fsciortino commented 5 years ago

Also, do you have any insight into why TRIPPy could be randomly failing sometimes? Every once in a while, I get weights for diagnostics that are clearly wrong. In the figure below for example, the XICS chords have some issues...

image

Running the same code more than once often solves the issue (i.e. weights are often computed correctly the second time). This shouldn't be an issue with the EFIT equilibrium, because I'm not changing the efit tree (loaded with eqtools) between different attempts.