Skip to content

Commit 1992b35

Browse files
authored
Merge branch 'master' into poloidal_distance
2 parents a74c277 + ffc1852 commit 1992b35

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ name: Python package
66
on:
77
push:
88
pull_request:
9+
workflow_dispatch:
910
schedule:
1011
- cron: '25 1 3 * *'
1112

.github/workflows/pythonpublish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ name: Upload Python Package
77
on:
88
release:
99
types: [created]
10+
workflow_dispatch:
1011

1112
jobs:
1213
pytest:

doc/whats-new.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Release history
3535
By [John Omotani](https://github.com/johnomotani)
3636
- Script to convert UEDGE grid file to BOUT++ grid file (#136).
3737
By [Ben Dudson](https://github.com/bendudson)
38+
- Add flag for `tokamak_example.py` to generate grids with reversed current. This
39+
prevents negative `dx`/`J` and allows them to be run in BOUT++.
3840

3941
0.5.2 (13th March 2023)
4042
-------------------------

examples/tokamak/connected-double-null.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
3232
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points
3333

3434
y_boundary_guards: 2
35+
reverse_current: true

examples/tokamak/disconnected-double-null.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
3333
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points
3434

3535
y_boundary_guards: 2
36+
reverse_current: true

examples/tokamak/single-null.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
2929
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points
3030

3131
y_boundary_guards: 2
32+
reverse_current: true

examples/tokamak/tokamak_example.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ def create_tokamak(geometry="lsn", nx=65, ny=65):
8787
parser.add_argument("--ny", type=int, default=65)
8888
parser.add_argument("--np", "--number-of-processors", type=int, default=-1)
8989
parser.add_argument("--no-plot", action="store_true", default=False)
90+
parser.add_argument(
91+
"--original-cocos",
92+
action="store_true",
93+
default=False,
94+
help="""Do not reverse current direction.
95+
WARNING: will cause warnings of negative J on running in BOUT++.
96+
Default: False.""",
97+
)
98+
parser.add_argument(
99+
"--no-guards",
100+
action="store_true",
101+
default=False,
102+
help="Remove Y boundary guards? Default: False.",
103+
)
90104
args = parser.parse_args()
91105

92106
if "sn" in args.geometry:
@@ -106,6 +120,13 @@ def create_tokamak(geometry="lsn", nx=65, ny=65):
106120
if args.np >= 0:
107121
options.update(number_of_processors=args.np)
108122

123+
# Reverse current by default, unless --original-cocos=True
124+
if args.original_cocos:
125+
options.update(reverse_current=False)
126+
127+
if args.no_guards:
128+
options.update(y_boundary_guards=0)
129+
109130
# Generate an artificial poloidal flux function
110131
r1d, z1d, psi2d, psi1d = create_tokamak(
111132
geometry=args.geometry,

0 commit comments

Comments
 (0)