Skip to content

Commit

Permalink
keep up w master 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ErolBa committed Dec 4, 2024
1 parent 2a42194 commit 65e1e01
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 35 deletions.
16 changes: 4 additions & 12 deletions src/dforce.f90
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,10 @@ subroutine dforce( NGdof, position, force, LComputeDerivatives, LComputeAxis)
voltotal = voltotal+vvolume(vvol)
!write(*,*) "Calc beta: ", betavol(vvol), vvolume(vvol)
enddo
! Calculate total beta which is obtained from individual betas
! write(*,*) "all betas", betavol(1:Nvol)
BetaTotal = sum(betavol(1:Nvol))/voltotal
! write(*,*) "Total BETA ", BetaTotal
! write(*,*)"total vol", voltotal

BetaTotal = sum(betavol(1:Nvol))/voltotal ! Calculate total beta which is obtained from individual betas

Energy = sum( lBBintegral(1:Nvol) ) ! should also compute beta;
! write(*,*)"total Energy", Energy
!write(*,*) "Betatotal", BetaTotal, voltotal

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

Expand Down Expand Up @@ -974,10 +969,7 @@ subroutine dforce( NGdof, position, force, LComputeDerivatives, LComputeAxis)
!call MPI_BARRIER( MPI_COMM_WORLD, ierr )

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

!if(LcomputeDerivatives .and. Lhessianallocated .and. Igeometry .eq. 1) then
!if(Lhessianallocated .and. Igeometry .eq. 1) then


if(Lhessianallocated .and. Igeometry.eq.1) then
if( myid.eq.0 ) then ; cput = GETTIME ; write(ounit,'("hesian : ",f10.2," : LHmatrix="L2" ;")')cput-cpus, LHmatrix ;
write(*,*) "Writing .hessian file..."
Expand Down Expand Up @@ -1013,7 +1005,7 @@ subroutine fndiff_dforce( NGdof )
iRbc, iZbs, iRbs, iZbc, &
LGdof, psifactor, dBdX, &
YESstellsym, NOTstellsym, &
hessian, ext, vvolume
hessian, ext

LOCALS

Expand Down
2 changes: 2 additions & 0 deletions src/dfp100.f90
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ subroutine dfp100(Ndofgl, x, Fvec, LComputeDerivatives)
LOGICAL :: LComputeDerivatives
INTEGER :: deriv, Lcurvature



BEGIN(dfp100)

dpflux(2:Mvol) = x - xoffset
Expand Down
64 changes: 42 additions & 22 deletions src/global.f90
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ module allglobal

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

CHARACTER(LEN=1000) :: ext ! extension of input filename, i.e., "path/G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp
CHARACTER(LEN=1000) :: ext ! extension of input filename, i.e., "path/G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp

REAL :: ForceErr !< total force-imbalance
REAL :: Energy !< MHD energy
Expand Down Expand Up @@ -952,6 +952,26 @@ subroutine set_mpi_comm(comm)

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

pure function get_hidden(ext) result(hidden_ext)
implicit none
CHARACTER(len=1000), intent(in) :: ext
! ext with a "." prefix added to the basename "path/.G3V01L1Fi.001" for an input file path/G3V01L1Fi.001.sp
CHARACTER(LEN=1000) :: hidden_ext
INTEGER :: basename_start_index

! Prepare the "hidden" ext filepath that has a "." prefix.
! Split ext into directory path and basename using INDEX function, then concatenate them again with a "." inbetween
#ifdef _WIN32
basename_start_index = INDEX(ext, '\', .TRUE.)
#else
basename_start_index = INDEX(ext, '/', .TRUE.)
#endif
! folder + . + filename
hidden_ext = trim(ext(1:basename_start_index))//"."//trim(ext(basename_start_index+1:))
end function get_hidden

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

subroutine read_inputlists_from_file()

use constants
Expand Down Expand Up @@ -1648,28 +1668,28 @@ subroutine wrtend
write(iunit,'(" Nvol = ",i9 )') Nvol
write(iunit,'(" Mpol = ",i9 )') Mpol
write(iunit,'(" Ntor = ",i9 )') Ntor
write(iunit,'(" Lrad = ",1025i23 )') Lrad(1:Mvol)
write(iunit,'(" tflux = ",1025es23.15)') tflux(1:Mvol)
write(iunit,'(" pflux = ",1025es23.15)') pflux(1:Mvol)
write(iunit,'(" helicity = ",1025es23.15)') helicity(1:Mvol)
write(iunit,'(" Lrad = ",257i23 )') Lrad(1:Mvol)
write(iunit,'(" tflux = ",257es23.15)') tflux(1:Mvol)
write(iunit,'(" pflux = ",257es23.15)') pflux(1:Mvol)
write(iunit,'(" helicity = ",257es23.15)') helicity(1:Mvol)
write(iunit,'(" pscale = ",es23.15 )') pscale
write(iunit,'(" Ladiabatic = ",i9 )') Ladiabatic
write(iunit,'(" pressure = ",1025es23.15)') pressure(1:Mvol)
write(iunit,'(" adiabatic = ",1025es23.15)') adiabatic(1:Mvol)
write(iunit,'(" mu = ",1025es23.15)') mu(1:Mvol)
write(iunit,'(" Ivolume = ",1025es23.15)') Ivolume(1:Mvol)
write(iunit,'(" Isurf = ",1025es23.15)') IPDt(1:Mvol) ! EDIT by EROL !!!!
write(iunit,'(" pressure = ",257es23.15)') pressure(1:Mvol)
write(iunit,'(" adiabatic = ",257es23.15)') adiabatic(1:Mvol)
write(iunit,'(" mu = ",257es23.15)') mu(1:Mvol)
write(iunit,'(" Ivolume = ",257es23.15)') Ivolume(1:Mvol)
write(iunit,'(" Isurf = ",257es23.15)') IPDt(1:Mvol-1), 0.0
write(iunit,'(" Lconstraint = ",i9 )') Lconstraint
write(iunit,'(" pl = ",1025i23 )') pl(0:Mvol)
write(iunit,'(" ql = ",1025i23 )') ql(0:Mvol)
write(iunit,'(" pr = ",1025i23 )') pr(0:Mvol)
write(iunit,'(" qr = ",1025i23 )') qr(0:Mvol)
write(iunit,'(" iota = ",1025es23.15)') iota(0:Mvol)
write(iunit,'(" lp = ",1025i23 )') lp(0:Mvol)
write(iunit,'(" lq = ",1025i23 )') lq(0:Mvol)
write(iunit,'(" rp = ",1025i23 )') rp(0:Mvol)
write(iunit,'(" rq = ",1025i23 )') rq(0:Mvol)
write(iunit,'(" oita = ",1025es23.15)') oita(0:Mvol)
write(iunit,'(" pl = ",257i23 )') pl(0:Mvol)
write(iunit,'(" ql = ",257i23 )') ql(0:Mvol)
write(iunit,'(" pr = ",257i23 )') pr(0:Mvol)
write(iunit,'(" qr = ",257i23 )') qr(0:Mvol)
write(iunit,'(" iota = ",257es23.15)') iota(0:Mvol)
write(iunit,'(" lp = ",257i23 )') lp(0:Mvol)
write(iunit,'(" lq = ",257i23 )') lq(0:Mvol)
write(iunit,'(" rp = ",257i23 )') rp(0:Mvol)
write(iunit,'(" rq = ",257i23 )') rq(0:Mvol)
write(iunit,'(" oita = ",257es23.15)') oita(0:Mvol)
write(iunit,'(" mupftol = ",es23.15 )') mupftol
write(iunit,'(" mupfits = ",i9 )') mupfits
write(iunit,'(" Lreflect = ",i9 )') Lreflect
Expand Down Expand Up @@ -1855,7 +1875,7 @@ subroutine wrtend
!write(iunit,'(" epsr = ",es23.15 )') epsr
write(iunit,'(" nPpts = ",i9 )') nPpts
write(iunit,'(" Ppts = ",es23.15 )') Ppts
write(iunit,'(" nPtrj = ",656i6 )') nPtrj(1:Mvol)
write(iunit,'(" nPtrj = ",256i6 )') nPtrj(1:Mvol)
write(iunit,'(" LHevalues = ",L9 )') LHevalues
write(iunit,'(" LHevectors = ",L9 )') LHevectors
write(iunit,'(" LHmatrix = ",L9 )') LHmatrix
Expand Down Expand Up @@ -1885,7 +1905,7 @@ subroutine wrtend
#endif

! write initial guess of interface geometry
do imn = 1, mn ; write(iunit,'(2i6,20000es23.15)') im(imn), in(imn)/Nfp, ( iRbc(imn,vvol), iZbs(imn,vvol), iRbs(imn,vvol), iZbc(imn,vvol), vvol = 1, Nvol )
do imn = 1, mn ; write(iunit,'(2i6,1024es23.15)') im(imn), in(imn)/Nfp, ( iRbc(imn,vvol), iZbs(imn,vvol), iRbs(imn,vvol), iZbc(imn,vvol), vvol = 1, Nvol )
enddo

close(iunit)
Expand Down
2 changes: 1 addition & 1 deletion src/sphdf5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ subroutine hdfint
HWRITERV( grpOutput, 1, BnsErr, (/ BnsErr /)) ! already in /input/global
!latex \type{ForceErr} & real & \pb{force-balance error across interfaces} \\
HWRITERV( grpOutput, 1, ForceErr, (/ ForceErr /))
!latex \type{ForceErr} & real & \pb{force-balance error across interfaces} \\
!latex \type{BetaTotal} & real & \pb{Total plasma beta} \\
HWRITERV( grpOutput, 1, BetaTotal, (/ BetaTotal /))
!latex \type{Ivolume} & real & \pb{Volume current at output (parallel, externally induced)}
HWRITERV( grpOutput, Mvol, Ivolume, Ivolume(1:Mvol))
Expand Down

0 comments on commit 65e1e01

Please sign in to comment.