Skip to content

Commit

Permalink
Merge pull request #75 from PrincetonUniversity/Hotfix_curvature
Browse files Browse the repository at this point in the history
Hotfix curvature calculation in diagnos.f90
  • Loading branch information
Caoxiang Zhu authored Mar 31, 2021
2 parents b47ad35 + 8fc4bea commit 125ef66
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
12 changes: 6 additions & 6 deletions examples/check_deriv/deriv.focus
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#coil_type coil_symm coil_name
1 2 1
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.033518962591905E+00 1 2.200000000000000E+00
128 -1.500725500000000E+05 0 2.033518907783376E+00 1 2.200000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand All @@ -18,7 +18,7 @@
#coil_type coil_symm coil_name
1 2 2
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.095801646502330E+00 1 2.300000000000000E+00
128 -1.500725500000000E+05 0 2.095801591241713E+00 1 2.300000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand All @@ -32,7 +32,7 @@
#coil_type coil_symm coil_name
1 2 3
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.169957742564031E+00 1 2.400000000000000E+00
128 -1.500725500000000E+05 0 2.169957681519326E+00 1 2.400000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand All @@ -46,7 +46,7 @@
#coil_type coil_symm coil_name
1 2 4
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.256963944700190E+00 1 2.500000000000000E+00
128 -1.500725500000000E+05 0 2.256963877644726E+00 1 2.500000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand All @@ -60,7 +60,7 @@
#coil_type coil_symm coil_name
1 2 5
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.258918695362754E+00 1 2.500000000000000E+00
128 -1.500725500000000E+05 0 2.258918623171938E+00 1 2.500000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand All @@ -74,7 +74,7 @@
#coil_type coil_symm coil_name
1 2 6
#Nseg current Ifree Length Lfree target_length
128 -1.500725500000000E+05 0 2.227457614856919E+00 1 2.400000000000000E+00
128 -1.500725500000000E+05 0 2.227457545661790E+00 1 2.400000000000000E+00
#NFcoil
4
#Fourier harmonics for coils ( xc; xs; yc; ys; zc; zs)
Expand Down
2 changes: 1 addition & 1 deletion examples/d3d_RMP/d3d.input
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
case_length = 2 ! 1: quadratic format, converging the target length; 2: exponential format, as short as possible
weight_bnorm = 0.000D+00 ! weight for real space Bn errors
weight_bharm = 1.000D+00 ! weight for Bmn harmonic errors
bharm_jsurf = 0 ! 0: no weightes; 1: weighted with area square; 2: weighted with area
bharm_jsurf = 0 ! 0: no weightes; 1: weighted with area; 2: weighted with squared root of area
weight_tflux = 0.000D+00 ! weight for toroidal flux error, specified by target_tflux
target_tflux = 0.000D+00 ! target for the toroidal flux, 0: the present value
weight_ttlen = 0.000D+00 ! weight for coil length error
Expand Down
6 changes: 6 additions & 0 deletions sources/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ ifneq (,$(findstring eddy,$(HOSTNAME)))
FC=mpiifort # this is optional after recent updates
endif

#### Stellar Intel+IntelMPI+HDF5###############
# available env: /home/caoxiang/module/focus/intel
ifneq (,$(findstring stellar,$(HOSTNAME)))
FC=mpiifort # this is optional after recent updates
endif

#### Traverse + GNU Fortran ################
ifneq (,$(findstring traverse,$(HOSTNAME)))
# available env: /home/caoxiang/Modules/focus/
Expand Down
21 changes: 11 additions & 10 deletions sources/diagnos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ SUBROUTINE diagnos
enddo
!!$ FATAL( output , idof .ne. Tdof, counting error in restart )
endif
!-------------------------------average coil length-------------------------------------------------------
AvgLength = zero
if ( (case_length == 1) .and. (sum(coil(1:Ncoils)%Lo) < sqrtmachprec) ) coil(1:Ncoils)%Lo = one
call length(0)
do icoil = 1, Ncoils
if(coil(icoil)%type .ne. 1) cycle ! only for Fourier
AvgLength = AvgLength + coil(icoil)%L
enddo
AvgLength = AvgLength / Ncoils
if(myid .eq. 0) write(ounit, '(8X": Average length of the coils is"8X" :" ES23.15)') AvgLength

!-------------------------------coil maximum curvature----------------------------------------------------
MaxCurv = zero
do icoil = 1, Ncoils
Expand Down Expand Up @@ -84,16 +95,6 @@ SUBROUTINE diagnos
AvgCurv = AvgCurv / Ncoils
if(myid .eq. 0) write(ounit, '(8X": Average curvature of the coils is"5X" :" ES23.15)') AvgCurv

!-------------------------------average coil length-------------------------------------------------------
AvgLength = zero
if ( (case_length == 1) .and. (sum(coil(1:Ncoils)%Lo) < sqrtmachprec) ) coil(1:Ncoils)%Lo = one
call length(0)
do icoil = 1, Ncoils
if(coil(icoil)%type .ne. 1) cycle ! only for Fourier
AvgLength = AvgLength + coil(icoil)%L
enddo
AvgLength = AvgLength / Ncoils
if(myid .eq. 0) write(ounit, '(8X": Average length of the coils is"8X" :" ES23.15)') AvgLength

!-----------------------------minimum coil coil separation------------------------------------
! coils are supposed to be placed in order
Expand Down
2 changes: 1 addition & 1 deletion sources/globals.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module globals

!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!

CHARACTER(10), parameter :: version='v0.13.10' ! version number
CHARACTER(10), parameter :: version='v0.13.11' ! version number

!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!

Expand Down

0 comments on commit 125ef66

Please sign in to comment.