-
Notifications
You must be signed in to change notification settings - Fork 9
branching of master with addition from old newmaster branch. superloa… #5
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
base: master
Are you sure you want to change the base?
Conversation
…d and supersave methods to reload an entire set of patches and associated grids. Corresponding workflow is: create a grid with INGRID -> run UEDGE -> identify an issue with a cell -> remake grid only in the patch where it occurs if possible (e.g. poloidal point distribution modification) or in patches of same topological region (e.g. radial point distribution modification)
| return fpath | ||
|
|
||
|
|
||
| def StoreSettings(self, fname: str = '', settings: dict = {}) -> 'Path': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe SaveSettings for consistency with SavePatches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
bryan-garcia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments before testing pull request in GUI workflow.
| if self.settings['patch_data']['preferences']['new_file']: | ||
| self.SavePatches(self.settings['patch_data']['preferences']['new_fname']) | ||
| self.CurrentTopology.SetBoundarySplines() | ||
| #not practical in a workflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the thought is to separate patch saving from patch construction?
This commented out if statement can be moved to the gui code in master with ease (if that's your thought)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was about the new_file variable. Probably easier to have a single filename system with a prompt to replace existing file or an option to overwrite automatically.
| if type(PatchName)==str: | ||
| if len(PatchName)<1 or len(PatchName)>2: | ||
| raise IOError('PatchName must be a string of one or two characters') | ||
| L='' | ||
| N=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len(PatchName) should be 2 by our convention. Is there a new feature for Patch with 1 char name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is to generate a list of patches based on one letter. For instance, I can redo A1/A2 and B1/B2 by simply putting in the list ['A','B']. similary, I can redo all the core with ['1'].
|
|
||
| def SuperSavePatches(self, fname: str = '') -> None: | ||
| """ | ||
| Save patches as '.npy' file for later reconstruction in Ingrid. | ||
| This file contains the information required to reconstruct patches | ||
| at a later time and bypass the line_tracing. | ||
| Parameters | ||
| ---------- | ||
| fname : str, optional | ||
| Name of file/location for patch data. | ||
| """ | ||
| if fname in ['', None]: | ||
| fname = self.CurrentTopology.config + '_patches_' + str(int(time())) | ||
| self.CurrentTopology.ResetHeavyAttr() | ||
|
|
||
| Data={'patches':self.CurrentTopology.patches, | ||
| 'config':self.CurrentTopology.config, | ||
| 'xpt_data':self.CurrentTopology.LineTracer.NSEW_lookup | ||
| } | ||
| np.save(fname, Data) | ||
|
|
||
| if Path(fname).suffix == '.npy': | ||
| tail = '' | ||
| else: | ||
| tail = '.npy' | ||
| print(f"# Saved patch data for file {Path(fname).name + tail}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SuperSavePatches only differ from SavePatches by saving the data in npy format as dict all at once without spline data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and the grids as well.
| def SetPatchesOrientation(self): | ||
|
|
||
|
|
||
| # set radial orientation negative if patch is in PFR | ||
| for name, patch in self.patches.items(): | ||
| if patch.plate_patch and self.GetPatchLetterNumber(patch.get_tag())[1]=='1': | ||
| patch.RadOrientation=-1 | ||
| else: | ||
| patch.RadOrientation=1 | ||
|
|
||
| #set poloidal orientation negative if patches in high field side region (must be checked for other config) | ||
| Letters=list(dict.fromkeys([L for L,N in self.GetPatchLetterNumber(self.GetListAllPatches())])) | ||
| Nhalf=int(len(Letters)/2) | ||
| ListLFS=Letters[0:Nhalf] | ||
| for name, patch in self.patches.items(): | ||
| if self.GetPatchLetterNumber(patch.get_tag())[0] in ListLFS: | ||
| patch.PolOrientation=-1 | ||
| else: | ||
| patch.PolOrientation=1 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetPatchesOrientation should be added strictly to the SNL class first since all other topologies inherit from TopologyUtils.
This will allow us to implement topology specific patch orientations (we see some SF configs have number-tag == 1 in the core)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
|
More comments:
|
|
It would be probably a good idea to reorganize the patch loading structure into a dictionary so the saving is straightforward. |
fb6b493 to
872c143
Compare
I would suggest to push these additions one by one through a new commit each time.