Skip to content

Commit

Permalink
This version now checks for J < 0 and will not print input.gacode
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Candy committed Feb 24, 2024
1 parent 388e6e7 commit 0867ad3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions f2py/expro/expro.f90
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ module expro
integer :: expro_ctrl_quasineutral_flag
integer :: expro_ctrl_numeq_flag
integer :: expro_error=0
integer :: expro_jerr=0

! Header information
character(len=70) :: expro_head_original = '# *original : null'
Expand Down
5 changes: 2 additions & 3 deletions f2py/expro/expro_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ subroutine expro_compute_derived
integer :: n
integer :: i
integer :: is
integer :: nx,err
integer :: nx

double precision, parameter :: k = 1.6022d-12 ! erg/eV
double precision, parameter :: e = 4.8032d-10 ! statcoul
Expand Down Expand Up @@ -209,7 +209,6 @@ subroutine expro_compute_derived
! r_min = a [m]
r_min = expro_rmin(expro_n_exp)

100 err=0
do i=2,expro_n_exp

! Parameters to be passed to geo library
Expand Down Expand Up @@ -267,7 +266,7 @@ subroutine expro_compute_derived
call geo_interp(1,theta,.true.)
if (minval(geov_jac_r) <= 0d0) then
print '(a,i3,a,f5.2)','WARNING: (expro_util) J < 0 for i=',i,' in input.gacode: ',minval(geov_jac_r)
err = 1
expro_jerr = 1
endif

! V, dV/dr and S (note that S=dV/dr only in a circle)
Expand Down
8 changes: 7 additions & 1 deletion profiles_gen/bin/profiles_gen
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,13 @@ fi
$EXEC

if [ -f "success" ] ; then
echo "INFO: (profiles_gen) Done."
if [ `cat success` -eq "1" ] ; then
echo "INFO: (profiles_gen) Done."
else
m=0.001
r=$(echo "($PSINORM-$m)"| bc -l)
echo "ERROR: (profiles_gen) Rerun with -psinorm $r"
fi
else
echo "ERROR: (profiles_gen) *Failed*. Try running with -V option"
fi
Expand Down
5 changes: 0 additions & 5 deletions profiles_gen/src/prgen.f90
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,4 @@ program prgen
call prgen_swap
call prgen_write

! Successful completion
open(unit=1,file='success',status='replace')
write(1,*) 1
close(1)

end program prgen
20 changes: 15 additions & 5 deletions profiles_gen/src/prgen_write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ subroutine prgen_write
expro_shape_cos6 = shape_cos(6,:)

expro_z_eff = zeff

! EFIT passthrough functions
expro_ptot = p_tot
expro_fpol = fpol
Expand All @@ -63,10 +63,20 @@ subroutine prgen_write
expro_head_gfile = '# *gfile : '//trim(file_g)
expro_head_cerfile = '# *cerfile : '//trim(file_cer)

! Run check for Jacobian
call expro_compute_derived
call expro_write('input.gacode')
print '(a)','INFO: (prgen_write) Wrote input.gacode.'
!-------------------------------------------------------------------------------------


! Use unit=2 since expro use unit=1
open(unit=2,file='success',status='replace')
if (expro_jerr == 0) then
call expro_write('input.gacode')
print '(a)','INFO: (prgen_write) Wrote input.gacode.'
! Successful completion
write(2,*) 1
else
write(2,*) 2
endif
close(2)

end subroutine prgen_write

0 comments on commit 0867ad3

Please sign in to comment.