Skip to content

Commit

Permalink
TokaMaker: Add support for grouping coils into coil sets (#38)
Browse files Browse the repository at this point in the history
* Add X-point candidate filtering with characteristic scale length
* Add support for arbitrary number of coil regularization terms
* Add HBT example and update ITER and fixed-boundary examples
* Update examples and format notes in Jupyter notebook examples
  • Loading branch information
hansec committed Mar 4, 2024
1 parent 3afe65d commit 6b3439b
Show file tree
Hide file tree
Showing 21 changed files with 8,107 additions and 349 deletions.
4 changes: 2 additions & 2 deletions src/bin/tokamaker_gs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ program tokamaker_gs
CLOSE(io_unit)
!---Read coil constraint matrix
IF(.NOT.ASSOCIATED(mygs%coil_reg_mat))THEN
ALLOCATE(mygs%coil_reg_mat(mygs%ncoil_regs+1,mygs%ncoil_regs+1))
ALLOCATE(mygs%coil_reg_mat(mygs%ncoils+1,mygs%ncoils+1))
OPEN(NEWUNIT=io_unit,FILE='coil_reg_mat.dat')
DO i=1,mygs%ncoil_regs+1
DO i=1,mygs%ncoils+1
READ(io_unit,*)mygs%coil_reg_mat(i,:)
END DO
CLOSE(io_unit)
Expand Down
12 changes: 6 additions & 6 deletions src/bin/tokamaker_wall.F90
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ program tokamaker_wall
IF(TRIM(coil_file)/='none')THEN
mygs%coil_file=coil_file
CALL mygs%load_coils(ignore_inmesh=.TRUE.)
DO i=1,mygs%ncoils
mygs%coils(i)%curr=0.d0 ! Zero all external coils
DO i=1,mygs%ncoils_ext
mygs%coils_ext(i)%curr=0.d0 ! Zero all external coils
END DO
DO i=1,mygs%ncoil_regs
mygs%coil_regions(i)%curr=0.d0 ! Zero all internal coil regions
Expand Down Expand Up @@ -955,20 +955,20 @@ subroutine compute_eddy(self)
CASE(1)
IF(grid_3d)THEN
CALL nonax_indcouple(self%cond_regions(i)%nc_quad,rc,self%cond_regions(i)%extent, &
eigs,self%coils(k)%pt,self%coils(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall, &
eigs,self%coils_ext(k)%pt,self%coils_ext(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall, &
rz_grid,rz_correction)
ELSE
CALL nonax_indcouple(self%cond_regions(i)%nc_quad,rc,self%cond_regions(i)%extent, &
eigs,self%coils(k)%pt,self%coils(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall)
eigs,self%coils_ext(k)%pt,self%coils_ext(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall)
END IF
CASE(2)
IF(grid_3d)THEN
CALL nonax_rescouple(self%cond_regions(i)%nc_quad,rc,self%cond_regions(i)%extent, &
eigs,self%coils(k)%pt,self%coils(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall, &
eigs,self%coils_ext(k)%pt,self%coils_ext(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall, &
eta,rz_grid,rz_correction)
ELSE
CALL nonax_rescouple(self%cond_regions(i)%nc_quad,rc,self%cond_regions(i)%extent, &
eigs,self%coils(k)%pt,self%coils(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall,eta)
eigs,self%coils_ext(k)%pt,self%coils_ext(k)%ncoils,correction(:,j),sensors,nsensor,mirror_wall,eta)
END IF
CASE(3)
IF(grid_3d)THEN
Expand Down
10 changes: 6 additions & 4 deletions src/docs/doc_tokamaker_main.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ Talk about TokaMaker...
The following examples illustrate usage of TokaMaker to compute different Grad-Shafranov equilibria.

### Mesh Generation
- \subpage doc_tMaker_mesh_ex1
- \subpage doc_tMaker_HBT_ex1
- \subpage doc_tMaker_ITER_ex1

### Fixed Boundary Equilibria
- \subpage doc_tMaker_ex1
- \subpage doc_tMaker_ex2
- \subpage doc_tMaker_fixed_ex1
- \subpage doc_tMaker_fixed_ex2

### Free Boundary Equilibria
- \subpage doc_tMaker_ex3
- \subpage doc_tMaker_HBT_ex2
- \subpage doc_tMaker_ITER_ex2
5 changes: 5 additions & 0 deletions src/examples/TokaMaker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ install(FILES fixed_boundary/fixed_boundary_ex1.ipynb DESTINATION examples/TokaM
install(FILES fixed_boundary/fixed_boundary_ex2.ipynb DESTINATION examples/TokaMaker/fixed_boundary COMPONENT examples)
install(FILES fixed_boundary/gNT_example DESTINATION examples/TokaMaker/fixed_boundary COMPONENT examples)
#
install(FILES HBT/HBT_geom.json DESTINATION examples/TokaMaker/HBT COMPONENT examples)
install(FILES HBT/HBT_mesh_ex.ipynb DESTINATION examples/TokaMaker/HBT COMPONENT examples)
install(FILES HBT/HBT_eq_ex.ipynb DESTINATION examples/TokaMaker/HBT COMPONENT examples)
install(FILES HBT/HBT_mesh.h5 DESTINATION examples/TokaMaker/HBT COMPONENT examples)
#
install(FILES ITER/ITER_mesh_ex.ipynb DESTINATION examples/TokaMaker/ITER COMPONENT examples)
install(FILES ITER/ITER_baseline_ex.ipynb DESTINATION examples/TokaMaker/ITER COMPONENT examples)
install(FILES ITER/ITER_geom.json DESTINATION examples/TokaMaker/ITER COMPONENT examples)
Expand Down
731 changes: 731 additions & 0 deletions src/examples/TokaMaker/HBT/HBT_eq_ex.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 6b3439b

Please sign in to comment.