Skip to content

Conversation

@Plasdom
Copy link
Collaborator

@Plasdom Plasdom commented Aug 26, 2025

Description of changes

This PR adds an up_down_symmetry option to INGRID. This enables grids to be generated which are symmetric about the midplane, and can be used with the com.isudsym option in UEDGE.

As an example, we start with this UDN configuration:
image
image
image

Changing the INGRID input file settings from

grid_settings:
  up_down_symmetry: false
  num_xpt: 2

to

grid_settings:
  up_down_symmetry: true
  num_xpt: 1

allows INGRID to generate a half-domain configuration, with ghost cells added to the upper patches where they meet the midplane:

image image image

A key part of this process is an added module to INGRID, udsym_tools.py, which takes the magnetic equilibrium, chops off the upper half of the domain and extends psi from the lower half by matching field lines on the outer/inner side.

Important note: when using this option, the INGRID input file should be configured as if the equilibrium contained just a single divertor. So for a UDN geometry, the upper x-point should be ignored and the INGRID input file should specify one x-point, i.e.

grid_settings:
  num_xpt: 1

How was this tested?

Locally on some example files.

Relevant issues

Checklist

  • I have added/updated tests relevant to this PR.
  • I have updated any baselines required for the test suite.
  • I have run the test suite locally to ensure my changes work as intended.

@Plasdom Plasdom marked this pull request as ready for review August 27, 2025 18:37
@Plasdom Plasdom requested a review from bryan-garcia August 27, 2025 18:37
Copy link
Collaborator

@bryan-garcia bryan-garcia left a comment

Choose a reason for hiding this comment

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

Looks great

Comment on lines +1523 to +1539
def ApplyUpDownSymmetry(self) -> None:
if self.settings["grid_settings"]["up_down_symmetry"]:
if self.CurrentTopology.config == "LSN":
del self.CurrentTopology.patches["C1"]
del self.CurrentTopology.patches["C2"]
del self.CurrentTopology.patches["D1"]
del self.CurrentTopology.patches["D2"]
elif self.CurrentTopology.config in ["SF15", "SF75"]:
del self.CurrentTopology.patches["C1"]
del self.CurrentTopology.patches["C2"]
del self.CurrentTopology.patches["C3"]
del self.CurrentTopology.patches["D1"]
del self.CurrentTopology.patches["D2"]
del self.CurrentTopology.patches["D3"]
else:
#TODO: Implement up/down symmetry for other geometries
raise Exception("Up/down symmetry not yet implemented for config " + self.CurrentTopology.config)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we ever do a proper refactor of ingrid, we can probably have each topology state which patches to delete. Could help keep things tidy and trickle in future changes

@Plasdom Plasdom merged commit 3736c2b into master Oct 5, 2025
5 checks passed
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.

3 participants