Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Far3d #4

Merged
merged 4 commits into from
Dec 14, 2023
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
10 changes: 8 additions & 2 deletions .github/workflows/ci_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,16 @@ jobs:
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make -j VERBOSE=1
- name: Test
- name: Test Mac
if: ${{matrix.os == 'macos-latest'}}
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make test ARGS=-j3
- name: Test Linux
if: ${{matrix.os == 'ubuntu-latest'}}
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make test
run: make test ARGS=-j2
- name: Show Log
if: failure()
shell: bash
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/ci_test_master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,16 @@ jobs:
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make -j VERBOSE=1
- name: Test
- name: Test Mac
if: ${{matrix.os == 'macos-latest'}}
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make test ARGS=-j3
- name: Test Linux
if: ${{matrix.os == 'ubuntu-latest'}}
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make test
run: make test ARGS=-j2
- name: Show Log
if: failure()
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ target_sources(xbooz_xform
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/booz_params.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/booz_persistent.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boozer_coords.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boozer_gij.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boozer_metric.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boozer_xform.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boozer.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/foranl.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/free_mem_boozer.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/harfun.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/read_wout_booz.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/root.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/setup_booz.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/transpmn.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/trigfunc.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vcoords.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vcoords_gijb.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/write_boozmn.f>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/write_polcut.f>
)
3 changes: 2 additions & 1 deletion Sources/allocate_boozer.f
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SUBROUTINE allocate_boozer (iread)
jlist = 0
i = 1
READ (iread, '(a)', iostat=istat1) temp
IF (far) istat1=1 ! All surfaces are computed for metric elements calculation
IF (istat1 .eq. 0) THEN
DO WHILE (istat1 .eq. 0)
DO jrad = i, ns
Expand All @@ -47,7 +48,7 @@ SUBROUTINE allocate_boozer (iread)
END DO

ELSE IF (istat1 .ne. 0) THEN
WRITE(6, '(a,/,a,i4)')
WRITE(6, '(a,/,a,a,i4)')
1 ' No jlist data was found in Boozer input file.',
1 ' Will assume that all surfaces are needed.',
1 ' Iostat: ', istat1
Expand Down
5 changes: 2 additions & 3 deletions Sources/booz_jac.f
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ SUBROUTINE booz_rzhalf(r, z, rodd, zodd, r12, z12, ohs,
C L o c a l P a r a m e t e r s
C-----------------------------------------------
REAL(rprec), PARAMETER :: one = 1, c1p5 = 1.5_dp
LOGICAL, PARAMETER :: lwrite=.FALSE.
C-----------------------------------------------
C L o c a l V a r i a b l e s
C-----------------------------------------------
Expand All @@ -32,10 +31,10 @@ SUBROUTINE booz_rzhalf(r, z, rodd, zodd, r12, z12, ohs,
z12 = z
END IF

! WRITE R,Z IN SPECIFIED TOROIDAL PLANE IN VMEC/BOOZER COORDINATES
! WRITE R,Z IN SPECIFIED TOROIDAL PLANE IN VMEC COORDINATES
nvplane = 1
! nvplane = nv_boz/4
IF (lWrite) CALL WriteSurface(js, nvplane, nrep, r12, z12)
! CALL WriteSurface(js, nvplane, nrep, r12, z12)

END SUBROUTINE booz_rzhalf

Expand Down
2 changes: 1 addition & 1 deletion Sources/booz_params.f
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ MODULE booz_params
REAL(rprec), DIMENSION(:,:), ALLOCATABLE :: bsubumnc,
1 bsubvmnc, bsubumns, bsubvmns, bmodmnc, bmodmns
REAL(rprec) :: ohs
LOGICAL :: lscreen, lasym_b, lrfp_b=.FALSE. ! CRCook 10/8/12 need to know LRFP
LOGICAL :: lscreen, lasym_b, far, lrfp_b=.FALSE. ! CRCook 10/8/12 need to know LRFP
LOGICAL, ALLOCATABLE, DIMENSION(:) :: lsurf_boz
END MODULE booz_params
5 changes: 3 additions & 2 deletions Sources/boozer.f
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SUBROUTINE boozer(thgrd, ztgrd, bmod, rad, zee, xmb, xnb,
C
USE stel_kinds
! CRCook Need extra variables from booz_params now
USE booz_params, ONLY: lasym_b, lrfp_b, hiota
USE booz_params, ONLY: lasym_b, lrfp_b, phip, hiota
IMPLICIT NONE
C-----------------------------------------------
C D u m m y A r g u m e n t s
Expand Down Expand Up @@ -70,7 +70,8 @@ SUBROUTINE boozer(thgrd, ztgrd, bmod, rad, zee, xmb, xnb,
! jacobian from VMEC to Boozer coords, with SPECIAL
! radial variable s = (toroidal flux)/twopi (phip = 1)
! cost = cos(mu-nv); sint = sin(mu-nv)
bbjac = jacfac/(bmod*bmod)
sgn = SIGN(one,phip(js))
bbjac = sgn*jacfac/(bmod*bmod)

! CRCook This modification makes the Jacobian the correct one for s ~ chi
! (LRFP = TRUE)
Expand Down
127 changes: 127 additions & 0 deletions Sources/boozer_gij.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
SUBROUTINE boozer_gij (thgrd, ztgrd, gib, grrb, grtb, gttb,
1 grrojb, grtojb, gttojb, jbgrrb, jbgrtb, jbgttb, xmb, xnb,
1 gimncb, grrmncb, grtmnsb, gttmncb, grrojmncb, grtojmnsb,
2 gttojmncb, jbgrrmncb, jbgrtmnsb, jbgttmncb,
1 gimnsb, grrmnsb, grtmncb, gttmnsb, grrojmnsb, grtojmncb,
2 gttojmnsb, jbgrrmnsb, jbgrtmncb, jbgttmnsb,
2 scl, cosm_boz, sinm_boz, cosn_boz, sinn_boz,
3 mboz, nboz, mnmax, nfp, nznt, nu2, nv, lasym_b)
C...MODIFIED 6/98 by A. WARE to speed up by factor of 8
C
USE stel_kinds
IMPLICIT NONE
C-----------------------------------------------
C D u m m y A r g u m e n t s
C-----------------------------------------------
INTEGER :: mnmax, nznt, mboz, nboz, nfp, nu2, nv
REAL(rprec), DIMENSION(nznt), INTENT(in) ::
1 thgrd, ztgrd, gib, grrb, grtb, gttb, grrojb, grtojb, gttojb,
2 jbgrrb, jbgrtb, jbgttb
REAL(rprec), DIMENSION(mnmax), INTENT(in) ::
1 xmb, xnb, scl
REAL(rprec), DIMENSION(nznt,0:mboz) :: cosm_boz, sinm_boz
REAL(rprec), DIMENSION(nznt,0:nboz) :: cosn_boz, sinn_boz
REAL(rprec), DIMENSION(mnmax), INTENT(out) ::
1 gimncb, grrmncb, grtmnsb, gttmncb, grrojmncb, grtojmnsb,
2 gttojmncb, jbgrrmncb, jbgrtmnsb, jbgttmncb, gimnsb, grrmnsb,
3 grtmncb, gttmnsb, grrojmnsb, grtojmncb, gttojmnsb, jbgrrmnsb,
4 jbgrtmncb, jbgttmnsb
LOGICAL, INTENT(in) :: lasym_b
C-----------------------------------------------
C L o c a l P a r a m e t e r s
C-----------------------------------------------
REAL(rprec), PARAMETER :: one=1
C-----------------------------------------------
C L o c a l V a r i a b l e s
C-----------------------------------------------
INTEGER :: mn, m, n, imax, i
REAL(rprec) :: sgn
REAL(rprec), DIMENSION(nznt) :: tsin, tcos
C-----------------------------------------------
IF (.not.lasym_b) THEN
! ONLY INTEGRATE IN U HALF WAY AROUND (FOR LASYM=F)
i = nv*(nu2-1)+1 !u=pi interval: i:imax
imax = i-1+nv
DO m = 0,mboz
cosm_boz(1:nv,m) = 0.5*cosm_boz(1:nv,m) !u=0
cosm_boz(i:imax,m) = 0.5*cosm_boz(i:imax,m) !u=pi
sinm_boz(1:nv,m) = 0.5*sinm_boz(1:nv,m) !should be zeroes
sinm_boz(i:imax,m) = 0.5*sinm_boz(i:imax,m) !should be zeroes
END DO
END IF

DO mn = 1, mnmax
m = NINT(xmb(mn))
n = NINT(ABS(xnb(mn)/nfp))
sgn = SIGN(one,xnb(mn))

tcos = cosm_boz(:,m)*cosn_boz(:,n)
1 + sinm_boz(:,m)*sinn_boz(:,n)*sgn
tsin = sinm_boz(:,m)*cosn_boz(:,n)
1 - cosm_boz(:,m)*sinn_boz(:,n)*sgn

gimncb(mn) = DOT_PRODUCT(gib,tcos)
grrmncb(mn) = DOT_PRODUCT(grrb,tcos)
grtmnsb(mn) = DOT_PRODUCT(grtb,tsin)
gttmncb(mn) = DOT_PRODUCT(gttb,tcos)
grrojmncb(mn) = DOT_PRODUCT(grrojb,tcos)
grtojmnsb(mn) = DOT_PRODUCT(grtojb,tsin)
gttojmncb(mn) = DOT_PRODUCT(gttojb,tcos)
jbgrrmncb(mn) = DOT_PRODUCT(jbgrrb,tcos)
jbgrtmnsb(mn) = DOT_PRODUCT(jbgrtb,tsin)
jbgttmncb(mn) = DOT_PRODUCT(jbgttb,tcos)

IF (.not.lasym_b) CYCLE

gimnsb(mn) = DOT_PRODUCT(gib,tsin)
grrmnsb(mn) = DOT_PRODUCT(grrb,tsin)
grtmncb(mn) = DOT_PRODUCT(grtb,tcos)
gttmnsb(mn) = DOT_PRODUCT(gttb,tsin)
grrojmnsb(mn) = DOT_PRODUCT(grrojb,tsin)
grtojmncb(mn) = DOT_PRODUCT(grtojb,tcos)
gttojmnsb(mn) = DOT_PRODUCT(gttojb,tsin)
jbgrrmnsb(mn) = DOT_PRODUCT(jbgrrb,tsin)
jbgrtmncb(mn) = DOT_PRODUCT(jbgrtb,tcos)
jbgttmnsb(mn) = DOT_PRODUCT(jbgttb,tsin)

END DO

gimncb = scl*gimncb
grrmncb = scl*grrmncb
grtmnsb = scl*grtmnsb
gttmncb = scl*gttmncb
grrojmncb = scl*grrojmncb
grtojmnsb = scl*grtojmnsb
gttojmncb = scl*gttojmncb
jbgrrmncb = scl*jbgrrmncb
jbgrtmnsb = scl*jbgrtmnsb
jbgttmncb = scl*jbgttmncb

IF (lasym_b) THEN

gimnsb = scl*gimnsb
grrmnsb = scl*grrmnsb
grtmncb = scl*grtmncb
gttmnsb = scl*gttmnsb
grrojmnsb = scl*grrojmnsb
grtojmncb = scl*grtojmncb
gttojmnsb = scl*gttojmnsb
jbgrrmnsb = scl*jbgrrmnsb
jbgrtmncb = scl*jbgrtmncb
jbgttmnsb = scl*jbgttmnsb

ELSE

! RECOVER cosm AND sinm FOR u=0 AND u=pi
i = nv*(nu2-1)+1 !u=pi interval: i:imax
imax = i-1+nv
DO m = 0,mboz
cosm_boz(1:nv,m) = 2.0*cosm_boz(1:nv,m) !u=0
cosm_boz(i:imax,m) = 2.0*cosm_boz(i:imax,m) !u=pi
sinm_boz(1:nv,m) = 2.0*sinm_boz(1:nv,m) !should be zeroes
sinm_boz(i:imax,m) = 2.0*sinm_boz(i:imax,m) !should be zeroes
END DO

END IF

END SUBROUTINE boozer_gij
Loading