Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Custom FW Definitions #198

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

Edgar-21
Copy link
Contributor

The approach I have taken is to create a class that has the same methods and behavior as those that we use from VMECData.

In this case, the custom first wall is defined in R-Z coordinates in a manner similar to how we define ribs. By assuming that the points on each rib are spaced evenly in the poloidal direction, a continuous surface which is a function of poloidal and toroidal angle can be created by interpolation of those points.

I was thinking we could set something up where there is a base class for representing the innermost surface, call it ReferenceSurface() or something along those lines, then we could have two classes that inherit from it, one that works with VMEC data and one that works with R-Z data, and by doing so we could have some infrastructure set up to possibly extend to other formats if it becomes necessary.

For right now I just added a vmec2xyz() method to my new KisslingerSurface() class that allows this class to be slotted in in place of a VMECData() object as a demonstration. I've included custom_geometry_example.py for a bit of context.

Addresses #108

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some high level design questions...

I think my thought is similar to what you describe in the comments for the PR, but doesn't really show up in the code yet.

toroidal_angles = []

for line in data[start_line - 1 :]:
if line.count("\t") == 2:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searching for tabs makes me nervous.... does T1E have a standard format/reader for these files? Is there a rigid structure we can rely upon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some structure, I got the code snippet that writes the files from Bonita today and it specifically uses '\t' as a delimiter. I could make the delimiter character a variable perhaps. Or we could leave it up to users to have their own function that reads their data. The class I have created to make custom FW takes a set of points defining ribs as an input so as to make it function with any sort of first wall definition that can be represented with ribs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may use tabs, that's fine, but I expect that the structure is defined by the order in which certain lines appear and the data expected to be on each line.

Copy link
Member

@gonuke gonuke Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I reverse engineer what you wrote, I'm guessing the format is:

num_toroidal_angles num_poloidal_angles periods
# repeat for each toroidal angle
toroidal_angle
### repeat for each poloidal angle
r z

If so, then you can write a parser that

  1. Reads the first line to get those three values
  2. For loop over num toroidal angles
    1. read toroidal angle
    2. Initialize profile
    3. For loop over poloidal angles
      1. Read r & z
      2. Convert to x,y,z
      3. Append to profile
    4. Append to profiles

return x_data, y_data, z_data, grid_points


class KisslingerSurface(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in IVB somewhere as a variation on the current surface definition to allow us to use them more interchangeably? I haven't really thought about the details, but assumed that's how this would come together, similar to what you've done with magnet definitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants