kripnerl / pleque

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FluxSurface class

kripnerl opened this issue · comments

  • implement into class Equilibrium as
def flux_surface(*coordinates, psi_n=None, coord_type=('psi_n'), resolution = 100, **coords):
    """
    :param resolution: number of points used for generation of FluxSurface
    :return FluxSurface or list of FluSurfaces generated on given coordinates. 
    """
    grid = False
    ...
  • add test file to test all implemented functions
  • FluxSurface should accept instance of Coordinates on input
  • implement (r, theta) coordinates into Coordinates class
  • implement as_array into Coordinates
  • all functions returning some set of points should return instance of Coordinates

I chaged the function header to
def fluxSurface(self, level = None, resolution = [1e-3, 1e-3], dim = "step", norm = True, closed = True, inlcfs = True, coord_type=None, grid=True, **coords):
as I dont understand clearly the meaning of psi_n parameter in other functions (mainly due to missing comments....) I used parameter norm to specify if the function is supposed to be working in normalized psi poloidal values.

  • I've added the review.
  • I'll test it as soon as I will be on computer with python instelled.
  • I understand your confusion with coordinates class, so I wll write comments ASAP (weekend?) for avoidance of future confusion. Hopefully with some stub of online documentation.
  • I still think that this header is too complicated and I would preffer to underscore this function, or rename it to somethink like selectFluxSurfaces and write function which will return only unique FluxSurface prefereably the one which goes throught midplane and has minimal value of r_mid.

Function coordinates(...) of instance of equilibrium class should be used for generation of coordinates from now on.
This function is factory function for Coordinate class (view #11)

  • flux_surface function name can be changed to whatever name you please
  • If a flux surface is a isosurface of psi poloidal, then the there are imo 3 types of surfaces
    1. Flux surface which is opened (set by paramerer closed to False) in the space covered by the equilibrium and is outside of the lcfs
    2. Flux surface which is closed(set by paramerer closed to True). Then there are two options:
      a) the surface is within the lcfs and then it is unique and encapsulates the magnetic axis (that is how it is identified by the function when you set the 'inlcfs' parameter to True).
      b) It is not inside the lcfs (inlcfs parameter set to False) and then there can be a number of isosurfaces with requested value of psi poloidal (inside and outside lcfs) and the function returns them all. This case happens when you include coils in the reconstruction space and should not be imo omitted. It can cause problems to other codes, which can for example use psi normalized to falsely identify what is inside the lcfs. This adds a nice tool how to find these problematic regions.

-If you want to have a function for each of these cases then be my guest, but they willl be most probably getting the results by calling flux_surface function, right? I don't personally like this option as it is piling up class functions (doing almost the same thing) and that is increasing the complexity of the class.

  • Flux surfaces can pass through midplane more than once, returning the one which has lower value of r_mid is ambiguous plus I don't think that covers all the user request possibilities.