Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name: Python package
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '25 1 3 * *'

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name: Upload Python Package
on:
release:
types: [created]
workflow_dispatch:

jobs:
pytest:
Expand Down
2 changes: 2 additions & 0 deletions doc/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Release history
By [John Omotani](https://github.com/johnomotani)
- Script to convert UEDGE grid file to BOUT++ grid file (#136).
By [Ben Dudson](https://github.com/bendudson)
- Add flag for `tokamak_example.py` to generate grids with reversed current. This
prevents negative `dx`/`J` and allows them to be run in BOUT++.

0.5.2 (13th March 2023)
-------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/tokamak/connected-double-null.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points

y_boundary_guards: 2
reverse_current: true
1 change: 1 addition & 0 deletions examples/tokamak/disconnected-double-null.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points

y_boundary_guards: 2
reverse_current: true
1 change: 1 addition & 0 deletions examples/tokamak/single-null.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ target_all_poloidal_spacing_length: 0.3 # Smaller -> pack near targets
xpoint_poloidal_spacing_length: 0.05 # Smaller -> pack near X-points

y_boundary_guards: 2
reverse_current: true
21 changes: 21 additions & 0 deletions examples/tokamak/tokamak_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ def create_tokamak(geometry="lsn", nx=65, ny=65):
parser.add_argument("--ny", type=int, default=65)
parser.add_argument("--np", "--number-of-processors", type=int, default=-1)
parser.add_argument("--no-plot", action="store_true", default=False)
parser.add_argument(
"--original-cocos",
action="store_true",
default=False,
help="""Do not reverse current direction.
WARNING: will cause warnings of negative J on running in BOUT++.
Default: False.""",
)
parser.add_argument(
"--no-guards",
action="store_true",
default=False,
help="Remove Y boundary guards? Default: False.",
)
args = parser.parse_args()

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

# Reverse current by default, unless --original-cocos=True
if args.original_cocos:
options.update(reverse_current=False)

if args.no_guards:
options.update(y_boundary_guards=0)

# Generate an artificial poloidal flux function
r1d, z1d, psi2d, psi1d = create_tokamak(
geometry=args.geometry,
Expand Down