diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 998d5f69..95725bf8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -6,6 +6,7 @@ name: Python package on: push: pull_request: + workflow_dispatch: schedule: - cron: '25 1 3 * *' diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 71f79e67..707a876d 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -7,6 +7,7 @@ name: Upload Python Package on: release: types: [created] + workflow_dispatch: jobs: pytest: diff --git a/doc/whats-new.md b/doc/whats-new.md index ca2d954c..23a429fa 100644 --- a/doc/whats-new.md +++ b/doc/whats-new.md @@ -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) ------------------------- diff --git a/examples/tokamak/connected-double-null.yaml b/examples/tokamak/connected-double-null.yaml index 906f5c3d..d3ac6e39 100644 --- a/examples/tokamak/connected-double-null.yaml +++ b/examples/tokamak/connected-double-null.yaml @@ -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 diff --git a/examples/tokamak/disconnected-double-null.yaml b/examples/tokamak/disconnected-double-null.yaml index c45fa2fe..c8c3e337 100644 --- a/examples/tokamak/disconnected-double-null.yaml +++ b/examples/tokamak/disconnected-double-null.yaml @@ -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 \ No newline at end of file diff --git a/examples/tokamak/single-null.yaml b/examples/tokamak/single-null.yaml index 9d989a1d..d9107f74 100644 --- a/examples/tokamak/single-null.yaml +++ b/examples/tokamak/single-null.yaml @@ -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 \ No newline at end of file diff --git a/examples/tokamak/tokamak_example.py b/examples/tokamak/tokamak_example.py index 28e3a461..bc2c5af2 100755 --- a/examples/tokamak/tokamak_example.py +++ b/examples/tokamak/tokamak_example.py @@ -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: @@ -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,