diff --git a/coil/field.F b/coil/field.F index e3b5bb99..5bb333bf 100644 --- a/coil/field.F +++ b/coil/field.F @@ -383,7 +383,7 @@ SUBROUTINE field_bs_rzphi(nr,nz,np,gdr,gdz,cbr,cbz,cbp,op_verbose) DO iz=0,nz DO ip=0,np - phi=ip/REAL(np,8) + phi=ip/REAL(np,r8) xobs(ir,iz,ip)=gdr(ir,iz)*COS(twopi*phi) yobs(ir,iz,ip)=gdr(ir,iz)*SIN(twopi*phi) zobs(ir,iz,ip)=gdz(ir,iz) @@ -433,7 +433,7 @@ SUBROUTINE field_bs_rzphi(nr,nz,np,gdr,gdz,cbr,cbz,cbp,op_verbose) DO iz=0,nz CALL cspline_alloc(bspl,np,3) DO ip=0,np - phi=ip/REAL(np,8) + phi=ip/REAL(np,r8) bspl%xs(ip)=phi bspl%fs(ip,1)=br(ir,iz,ip)*EXP(twopi*ifac*cnn*phi) bspl%fs(ip,2)=bz(ir,iz,ip)*EXP(twopi*ifac*cnn*phi) diff --git a/coil/makefile b/coil/makefile index 0dc51c7d..2816829e 100644 --- a/coil/makefile +++ b/coil/makefile @@ -1,16 +1,5 @@ # This is the makefile for COIL -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif - include ../install/DEFAULTS.inc IFLAGS = -I../equil -I$(MATHINC) -I$(NETCDFINC) diff --git a/dcon/fourfit.F b/dcon/fourfit.F index 090c8419..c8251be2 100644 --- a/dcon/fourfit.F +++ b/dcon/fourfit.F @@ -1091,7 +1091,7 @@ SUBROUTINE fourfit_kinetic_matrix(methodin,writein) !$OMP END CRITICAL IF(debug_omp)THEN CALL SYSTEM_CLOCK(COUNT=t_end) - t_sec = REAL(t_end-t_start,8)/REAL(cr,8) + t_sec = REAL(t_end-t_start,r8)/REAL(cr,r8) WRITE(*,'(1x,a5,i3,a6,es16.8,a8)') $ "ipsi=",ipsi," took ",t_sec," seconds" ENDIF @@ -1303,8 +1303,8 @@ SUBROUTINE fourfit_kinetic_matrix(methodin,writein) ktmats(i)%xs=rzphi%xs ENDDO DO ipsi=0,mpsi - iindex = FLOOR(REAL(ipsi+1,8)/FLOOR((mpsi+1)/10.0))*10 - ileft = REAL(ipsi+1,8)/FLOOR((mpsi+1)/10.0)*10-iindex + iindex = FLOOR(REAL(ipsi+1,r8)/FLOOR((mpsi+1)/10.0))*10 + ileft = REAL(ipsi+1,r8)/FLOOR((mpsi+1)/10.0)*10-iindex IF ((ipsi /= 0) .AND. (ileft == 0) .AND. verbose) $ WRITE(*,*)" ...",iindex,"% of kinetic computations" kwmat = 0 diff --git a/dcon/makefile b/dcon/makefile index e30706ef..b1744238 100644 --- a/dcon/makefile +++ b/dcon/makefile @@ -1,18 +1,8 @@ -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif include ../install/DEFAULTS.inc IFLAGS = -I../equil -I../harvest -I../pentrc -I../vacuum -I$(MATHINC) -I$(NETCDFINC) -F90 = $(FC) $(FFLAGS) $(OMPFLAG) $(IFLAGS) $(RECURSFLAG) +F90 = $(FC) $(FFLAGS) $(OMPFLAG) $(IFLAGS) $(RECURSFLAG) $(LEGACYFLAG) export FFLAGS # for sub-makes .f.o: diff --git a/docs/examples/DIIID_ideal_example/coil.in b/docs/examples/DIIID_ideal_example/coil.in index 5875bc84..946e00dc 100644 --- a/docs/examples/DIIID_ideal_example/coil.in +++ b/docs/examples/DIIID_ideal_example/coil.in @@ -5,7 +5,7 @@ machine="d3d" ! Choose from: nstx, d3d, kstar, iter ip_direction="positive" ! Set positive for CCW or negative for CW from a top down view bt_direction="negative" ! Set positive for CCW or negative for CW from a top down view - coil_num=1 ! Total number of coil sets activated + coil_num=3 ! Total number of coil sets activated cmpsi=64 ! ?? Why do we need this is only care about psi_lim?? cmtheta=480 ! Number of poloidal gridpoints (uses DCON jac_type??) @@ -23,12 +23,26 @@ ! bl2l(9), avvu(9), avvm(9), avvl(9) coil_name(1)="c" ! External correction coil set - coil_cur(1,1)= 1e3 ! 1kA, 19 degree phase n=1 field - coil_cur(1,2)= 5e2 - coil_cur(1,3)=-5e2 - coil_cur(1,4)=-1e3 - coil_cur(1,5)=-5e2 - coil_cur(1,6)= 5e2 + coil_cur(1,1)= 982 ! 1kA, 30 degree phase n=1 field + coil_cur(1,2)= 656 + coil_cur(1,3)=-326 + coil_cur(1,4)=-982 + coil_cur(1,5)=-656 + coil_cur(1,6)= 326 + coil_name(2)="il" ! External correction coil set + coil_cur(2,1)= 1e3 ! 1kA, 30 degree phase n=1 field + coil_cur(2,2)= 5e2 + coil_cur(2,3)=-5e2 + coil_cur(2,4)=-1e3 + coil_cur(2,5)=-5e2 + coil_cur(2,6)= 5e2 + coil_name(3)="iu" ! External correction coil set + coil_cur(3,1)= 1e3 ! 1kA, 30 degree phase n=1 field + coil_cur(3,2)= 5e2 + coil_cur(3,3)=-5e2 + coil_cur(3,4)=-1e3 + coil_cur(3,5)=-5e2 + coil_cur(3,6)= 5e2 / &COIL_OUTPUT diff --git a/docs/examples/DIIID_ideal_example/gpec.in b/docs/examples/DIIID_ideal_example/gpec.in index c2719c31..19c273c7 100644 --- a/docs/examples/DIIID_ideal_example/gpec.in +++ b/docs/examples/DIIID_ideal_example/gpec.in @@ -51,7 +51,7 @@ resp_flag=t ! Output energy, reluctance, inductance, and permeability eigenvalues, eigenvectors, and matrices filter_flag=t ! Outputs energy, reluctance, pereability, and (optionally) the singular-coupling eigenmodes on the control surface - singcoup_flag=f ! Calculate coupling of each m to resonant surfaces + singcoup_flag=t ! Calculate coupling of each m to resonant surfaces singfld_flag=t ! Output of resonant surface quantities (flux,current,etc.) vsingfld_flag=f ! Output of vacuum resonant surface quantities singthresh_flag=t ! Calculate Callen resonant field penetration threshold (requires kinetic profiles from pentrc.in) diff --git a/docs/examples/DIIID_kinetic_example/coil.in b/docs/examples/DIIID_kinetic_example/coil.in index b3ae7abf..946e00dc 100644 --- a/docs/examples/DIIID_kinetic_example/coil.in +++ b/docs/examples/DIIID_kinetic_example/coil.in @@ -10,6 +10,8 @@ cmpsi=64 ! ?? Why do we need this is only care about psi_lim?? cmtheta=480 ! Number of poloidal gridpoints (uses DCON jac_type??) cmzeta=40 ! Number of toroidal gridpoints (uses DCON jac_type??) + coil_threads=0 ! Number of parallel threads used when computing fields from coils (no reason to go beyond 4 for coils with less than 1000 points). Setting to <= 0 uses OMP_NUM_THREADS env variable. + ! Array values should be specified for each of the coil arrays to be activated. ! The supported coil sets (number of coils) include... diff --git a/docs/examples/DIIID_resistive_example/coil.in b/docs/examples/DIIID_resistive_example/coil.in index b3ae7abf..946e00dc 100644 --- a/docs/examples/DIIID_resistive_example/coil.in +++ b/docs/examples/DIIID_resistive_example/coil.in @@ -10,6 +10,8 @@ cmpsi=64 ! ?? Why do we need this is only care about psi_lim?? cmtheta=480 ! Number of poloidal gridpoints (uses DCON jac_type??) cmzeta=40 ! Number of toroidal gridpoints (uses DCON jac_type??) + coil_threads=0 ! Number of parallel threads used when computing fields from coils (no reason to go beyond 4 for coils with less than 1000 points). Setting to <= 0 uses OMP_NUM_THREADS env variable. + ! Array values should be specified for each of the coil arrays to be activated. ! The supported coil sets (number of coils) include... diff --git a/docs/examples/DIIID_resistive_example/gpec.in b/docs/examples/DIIID_resistive_example/gpec.in index 133a4555..06ccfb4c 100644 --- a/docs/examples/DIIID_resistive_example/gpec.in +++ b/docs/examples/DIIID_resistive_example/gpec.in @@ -83,6 +83,6 @@ verbose=t ! Print run log to terminal / &GPEC_DIAGNOSE - timeit=f ! Print timer splits for major subroutines + timeit=t ! Print timer splits for major subroutines radvar_flag=f ! Map various radial variables (rho,psi_tor) on psi_n grid / diff --git a/equil/makefile b/equil/makefile index 859c4b53..802c4199 100644 --- a/equil/makefile +++ b/equil/makefile @@ -1,13 +1,4 @@ -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif +include ../install/DEFAULTS.inc F90 = $(FC) $(FFLAGS) $(RECURSFLAG) diff --git a/gpec/makefile b/gpec/makefile index 1dd80116..db554906 100644 --- a/gpec/makefile +++ b/gpec/makefile @@ -1,18 +1,8 @@ -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif include ../install/DEFAULTS.inc IFLAGS = -I../equil -I../vacuum -I../harvest -I../pentrc -I../coil -I../slayer -I$(MATHINC) -I$(NETCDFINC) -F90 = $(FC) $(FFLAGS) $(OMPFLAG) $(IFLAGS) $(RECURSFLAG) +F90 = $(FC) $(FFLAGS) $(OMPFLAG) $(IFLAGS) $(RECURSFLAG) $(LEGACYFLAG) export FFLAGS # for sub-makes .f.o: diff --git a/install/DEFAULTS.inc b/install/DEFAULTS.inc index 0c561400..0f585b1f 100644 --- a/install/DEFAULTS.inc +++ b/install/DEFAULTS.inc @@ -463,13 +463,30 @@ ifdef X11_HOME X11_LIB_DIR = -L$(X11_HOME)/lib endif -#Common compiler flags for OpenMP +#Different flags for different compilers ifeq ($(findstring ifort,$(FC)),ifort) OMPFLAG ?= -qopenmp + ZEROFLAG ?= -zero + RECURSFLAG ?= -recursive + LEGACYFLAG ?= +else ifeq ($(findstring ifx,$(FC)),ifx) + OMPFLAG ?= -qopenmp + ZEROFLAG ?= -zero + RECURSFLAG ?= -recursive + LEGACYFLAG ?= else ifeq ($(findstring gfortran,$(FC)),gfortran) OMPFLAG ?= -fopenmp + ZEROFLAG ?= -finit-local-zero + RECURSFLAG ?= -frecursive + LEGACYFLAG ?= -std=legacy else ifeq ($(findstring pgfortran,$(FC)),pgfortran) OMPFLAG ?= -mp + ZEROFLAG ?= -zeroinit + RECURSFLAG ?= -Mrecursive + LEGACYFLAG ?= -std=legacy else + ZEROFLAG ?= -zero OMPFLAG ?= -openmp -endif + RECURSFLAG ?= -recursive + LEGACYFLAG ?= -std=legacy +endif \ No newline at end of file diff --git a/install/makefile b/install/makefile index 4d180f66..3048ff7d 100644 --- a/install/makefile +++ b/install/makefile @@ -14,11 +14,11 @@ export LDFLAGS .IGNORE: -all: v harvest equil lsode zlange zvode orbit vacuum pentrc dcon match rdcon rmatch \ +all: v harvest equil lsode zlange zvode orbit vacuum pentrc dcon match rdcon rmatch \ multi sum xdraw slayer coil gpec stride mkbin # fortran only -allf: v harvest equil lsode zlange zvode orbit vacuum pentrc dcon match rdcon rmatch \ +allf: v harvest equil lsode zlange zvode orbit vacuum pentrc dcon match rdcon rmatch \ multi sum slayer coil gpec stride mkbin diff --git a/lsode/makefile b/lsode/makefile index 0f647a36..15795159 100644 --- a/lsode/makefile +++ b/lsode/makefile @@ -1,15 +1,7 @@ -ifneq (,$(findstring ifort,$(FC))) - EXTRAFLAGS=-recursive -else ifneq (,$(findstring ifx,$(FC))) - EXTRAFLAGS=-recursive -else - EXTRAFLAGS=-frecursive -std=legacy -endif - include ../install/DEFAULTS.inc -F90 = $(FC) $(FFLAGS) $(EXTRAFLAGS) $(OMPFLAG) -I../equil +F90 = $(FC) $(FFLAGS) $(RECURSFLAG) $(LEGACYFLAG) $(OMPFLAG) -I../equil LIBDIR = ../lib LIBS = \ diff --git a/match/makefile b/match/makefile index 3aac76bf..ccca698e 100644 --- a/match/makefile +++ b/match/makefile @@ -1,13 +1,3 @@ -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif include ../install/DEFAULTS.inc diff --git a/orbit/makefile b/orbit/makefile index 8f134663..b61d42f2 100644 --- a/orbit/makefile +++ b/orbit/makefile @@ -1,17 +1,6 @@ include ../install/DEFAULTS.inc -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive -else - RECURSFLAG=-frecursive -endif - IFLAGS = -I../equil -I$(MATHINC) F90 = $(FC) $(FFLAGS) $(OMPFLAG) $(IFLAGS) $(RECURSFLAG) export FFLAGS diff --git a/pentrc/makefile b/pentrc/makefile index 09450e01..93756e6b 100644 --- a/pentrc/makefile +++ b/pentrc/makefile @@ -1,18 +1,3 @@ -# If using gfortran, the proper syntax is -frecursive. -# If using ifort, the proper syntax is -recursive. - -ifneq (,$(findstring ifort,$(FC))) - RECURSFLAG=-recursive - LEGACYFLAG= -else ifneq (,$(findstring ifx,$(FC))) - RECURSFLAG=-recursive - LEGACYFLAG= -else - RECURSFLAG=-frecursive - LEGACYFLAG=-std=legacy -endif - - include ../install/DEFAULTS.inc diff --git a/rmatch/deltac.f b/rmatch/deltac.f index 287fc69d..33659513 100644 --- a/rmatch/deltac.f +++ b/rmatch/deltac.f @@ -1492,10 +1492,10 @@ SUBROUTINE deltac_lsode_int(u_res,u_h1,u_h2) CALL deltac_lsode_der(neq,x0,u,u) u=u*deltac_tol DO ip=1,neq/2 -c tmp=MAX( DABS(REAL(u(ip),8)),DABS(IMAG(u(ip),8)) ) +c tmp=MAX( DABS(REAL(u(ip),r8)),DABS(IMAG(u(ip),r8)) ) tmp=CDABS(u(ip)) IF (tmp