From fb3bb20a05fde58f727bbea7e1adba554d72e58a Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Thu, 8 Aug 2019 17:08:27 -0400 Subject: [PATCH 01/57] initial commit for moving BNORM into separate file --- STELLOPTV2/ObjectList | 1 + STELLOPTV2/Release/STELLOPTV2.dep | 6 ++ STELLOPTV2/Sources/General/stellopt_bnorm.f90 | 63 +++++++++++++++++++ .../Sources/General/stellopt_coiloptpp.f90 | 24 +------ STELLOPTV2/Sources/Modules/stellopt_vars.f90 | 7 +++ make.inc | 2 +- 6 files changed, 81 insertions(+), 22 deletions(-) create mode 100644 STELLOPTV2/Sources/General/stellopt_bnorm.f90 diff --git a/STELLOPTV2/ObjectList b/STELLOPTV2/ObjectList index b485b68ed..f1d4c9cc0 100644 --- a/STELLOPTV2/ObjectList +++ b/STELLOPTV2/ObjectList @@ -83,6 +83,7 @@ stellopt_fcn.o \ stellopt_load_targets.o \ stellopt_toboozer.o \ stellopt_init.o \ +stellopt_bnorm.o \ stellopt_coiloptpp.o \ stellopt_regcoil_chi2_b.o \ stellopt_bootsj.o \ diff --git a/STELLOPTV2/Release/STELLOPTV2.dep b/STELLOPTV2/Release/STELLOPTV2.dep index e68d22922..e26030834 100644 --- a/STELLOPTV2/Release/STELLOPTV2.dep +++ b/STELLOPTV2/Release/STELLOPTV2.dep @@ -716,6 +716,12 @@ equil_utils.o : \ $(VMEC_DIR)/Release/vmec_dim.o \ $(VMEC_DIR)/Release/xstuff.o +stellopt_bnorm.o : \ + stellopt_runtime.o \ + stellopt_input_mod.o \ + stellopt_vars.o \ + $(LIB_DIR)/Release/mpi_params.o + stellopt_coiloptpp.o : \ stellopt_runtime.o \ stellopt_input_mod.o \ diff --git a/STELLOPTV2/Sources/General/stellopt_bnorm.f90 b/STELLOPTV2/Sources/General/stellopt_bnorm.f90 new file mode 100644 index 000000000..b5e2d7e9e --- /dev/null +++ b/STELLOPTV2/Sources/General/stellopt_bnorm.f90 @@ -0,0 +1,63 @@ +!----------------------------------------------------------------------- +! Subroutine: stellopt_bnorm +! Authors: Caoxiang Zhu +! Date: 08/07/18 +! Description: This subroutine is called to invoke the +! BNORM code. +!----------------------------------------------------------------------- +SUBROUTINE stellopt_bnorm(file_str,lscreen) +!----------------------------------------------------------------------- +! Libraries +!----------------------------------------------------------------------- + USE stellopt_runtime + USE stellopt_input_mod + USE stellopt_vars + USE mpi_params + +!----------------------------------------------------------------------- +! Subroutine Parameters +!---------------------------------------------------------------------- + IMPLICIT NONE + CHARACTER(256), INTENT(inout) :: file_str + LOGICAL, INTENT(inout) :: lscreen +!----------------------------------------------------------------------- +! Local Variables +! istat Error status +! iunit File unit number +! bnfou_c B-Normal Fourier coefficients +!---------------------------------------------------------------------- + INTEGER :: istat, nu, nv, mf, nf, md, nd, iunit, m, n, & + ivmec, ispline_file + REAL(rprec), ALLOCATABLE, DIMENSION(:,:) :: bnfou_c + +!---------------------------------------------------------------------- +! BEGIN SUBROUTINE +!---------------------------------------------------------------------- + ! Have master run bnorm + nu = nu_bnorm + nv = nv_bnorm + mf = mf_bnorm + nf = nf_bnorm + md = md_bnorm + nd = nd_bnorm + ! Run BNORM code + ALLOCATE(bnfou_c(0:mf_bnorm,-nf_bnorm:nf_bnorm),STAT=istat) + IF (lscreen) WRITE(6,"(A)") ' - Calculating B-Normal File' + CALL bnormal(nu,nv,mf,nf,md,nd,bnfou,bnfou_c,TRIM(file_str)//'.nc') + IF (lscreen) WRITE(6,"(A,ES22.12E3)") ' Max. B-Normal: ',MAXVAL(MAXVAL(bnfou,DIM=2),DIM=1) + IF (lscreen) WRITE(6,"(A,ES22.12E3)") ' MIN. B-Normal: ',MINVAL(MINVAL(bnfou,DIM=2),DIM=1) + ! WRITE BNORMAL + CALL safe_open(iunit, istat, 'bnorm.' // TRIM(file_str), 'replace','formatted') + DO m = 0, mf + DO n = -nf, nf + WRITE(iunit,"(1x,2i5,ES22.12E3)") m,n,bnfou(m,n) + END DO + END DO + CLOSE(iunit) + DEALLOCATE(bnfou_c) + IF (lscreen) WRITE(6,"(A)") ' Coefficients output to: '//'bnorm.' // TRIM(file_str) + RETURN +!---------------------------------------------------------------------- +! END SUBROUTINE +!---------------------------------------------------------------------- +END SUBROUTINE stellopt_bnorm diff --git a/STELLOPTV2/Sources/General/stellopt_coiloptpp.f90 b/STELLOPTV2/Sources/General/stellopt_coiloptpp.f90 index 82d9e86ae..7a9afd29c 100644 --- a/STELLOPTV2/Sources/General/stellopt_coiloptpp.f90 +++ b/STELLOPTV2/Sources/General/stellopt_coiloptpp.f90 @@ -30,12 +30,10 @@ SUBROUTINE stellopt_coiloptpp(file_str,lscreen) ! iverb Coilopt++ screen control ! istat Error status ! iunit File unit number -! bnfou/_c B-Normal Fourier coefficients !---------------------------------------------------------------------- LOGICAL :: lexists - INTEGER :: iverb, istat, nu, nv, mf, nf, md, nd, iunit, m, n, & + INTEGER :: iverb, istat, nu, nv, iunit, m, n, & ivmec, ispline_file - REAL(rprec), ALLOCATABLE, DIMENSION(:,:) :: bnfou, bnfou_c CHARACTER(8) :: temp_str CHARACTER(256) :: copt_fext @@ -52,27 +50,11 @@ SUBROUTINE stellopt_coiloptpp(file_str,lscreen) ispline_file = 0 copt_fext = 'coilopt_params.'//TRIM(file_str) ! Have master run bnorm - nu = nu_bnorm - nv = nv_bnorm - mf=24; nf=10; md=24; nd=20; coil_separation = 0.33; + coil_separation = 0.33; IF (myworkid == master) THEN IF (lscreen) WRITE(6,'(a)') ' --------------------------- COILOPT++ OPTIMIZATION -------------------------' ! Run BNORM code - ALLOCATE(bnfou(0:mf,-nf:nf),bnfou_c(0:mf,-nf:nf),STAT=istat) - IF (lscreen) WRITE(6,"(A)") ' - Calculating B-Normal File' - CALL bnormal(nu,nv,mf,nf,md,nd,bnfou,bnfou_c,TRIM(file_str)//'.nc') - IF (lscreen) WRITE(6,"(A,ES22.12E3)") ' Max. B-Normal: ',MAXVAL(MAXVAL(bnfou,DIM=2),DIM=1) - IF (lscreen) WRITE(6,"(A,ES22.12E3)") ' MIN. B-Normal: ',MINVAL(MINVAL(bnfou,DIM=2),DIM=1) - ! WRITE BNORMAL - CALL safe_open(iunit, istat, 'bnorm.' // TRIM(file_str), 'replace','formatted') - DO m = 0, mf - DO n = -nf, nf - WRITE(iunit,"(1x,2i5,ES22.12E3)") m,n,bnfou(m,n) - END DO - END DO - CLOSE(iunit) - DEALLOCATE(bnfou,bnfou_c) - IF (lscreen) WRITE(6,"(A)") ' Coefficients output to: '//'bnorm.' // TRIM(file_str) + call stellopt_bnorm(file_str,lscreen) ! Turn on screen output IF (lscreen) iverb = 1 END IF diff --git a/STELLOPTV2/Sources/Modules/stellopt_vars.f90 b/STELLOPTV2/Sources/Modules/stellopt_vars.f90 index 10e27c492..1dda13e76 100644 --- a/STELLOPTV2/Sources/Modules/stellopt_vars.f90 +++ b/STELLOPTV2/Sources/Modules/stellopt_vars.f90 @@ -118,6 +118,13 @@ MODULE stellopt_vars zeff_max, zeff_min REAL(rprec) :: mix_ece, xval, yval, xics_v0 + ! FOR BNORM RELATED VARIABLES + INTEGER, PARAMETER :: mf_bnorm = 24 ! Bn Fourier resolution + INTEGER, PARAMETER :: nf_bnorm = 20 ! Bn Fourier resolution + INTEGER, PARAMETER :: md_bnorm = 24 ! VMEC, Surface and others related resolution + INTEGER, PARAMETER :: nd_bnorm = 20 ! VMEC, Surface and others related resolution + REAL(rprec), DIMENSION(0:mf_bnorm,-nf_bnorm:nf_bnorm) :: bnfou ! calculated Bn Fourier harmonics + ! FOR REGCOIL WINDING SURFACE Fourier Series Representation INTEGER, PARAMETER :: mpol_rcws = 32 ! maximum poloidal mode number (min = -max) INTEGER, PARAMETER :: ntor_rcws = 32 ! maximum toroidal mode number (min = -max) diff --git a/make.inc b/make.inc index ff564e0f2..0e41fc3f8 120000 --- a/make.inc +++ b/make.inc @@ -1 +1 @@ -SHARE/make_macports.inc \ No newline at end of file +SHARE/make_pppl_czhu.inc \ No newline at end of file From 258b2414ce46a55eb4750615c71674b7d2cd337d Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Wed, 14 Aug 2019 09:26:35 -0400 Subject: [PATCH 02/57] fix bug with NFP variable conflicts; add calling bnorm when using REGCOIL --- STELLOPTV2/Sources/General/stellopt_regcoil_chi2_b.f90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/STELLOPTV2/Sources/General/stellopt_regcoil_chi2_b.f90 b/STELLOPTV2/Sources/General/stellopt_regcoil_chi2_b.f90 index 7325bb738..b9773c8a9 100644 --- a/STELLOPTV2/Sources/General/stellopt_regcoil_chi2_b.f90 +++ b/STELLOPTV2/Sources/General/stellopt_regcoil_chi2_b.f90 @@ -13,7 +13,7 @@ SUBROUTINE stellopt_regcoil_chi2_b(lscreen, iflag) USE stellopt_runtime USE stellopt_input_mod USE stellopt_vars, my_mpol => mpol_rcws, my_ntor => ntor_rcws - USE equil_utils + USE equil_utils, equil_nfp => nfp !DEC$ IF DEFINED (REGCOIL) !USE regcoil_auto_regularization_solve @@ -169,6 +169,11 @@ SUBROUTINE stellopt_regcoil_chi2_b(lscreen, iflag) ! Initialize some of the vectors and matrices needed: ! write(6,'(a)') '<----read bnorm' + IF (load_bnorm) THEN + call stellopt_bnorm(proc_string,lscreen) + bnorm_filename = 'bnorm.' // TRIM(proc_string) + ENDIF + call regcoil_read_bnorm() ! write(6,'(a)') '<----build matrices' call regcoil_build_matrices() From ae20b8ee590cc03e3da99f9a0cad51dafa295030 Mon Sep 17 00:00:00 2001 From: Samuel Lazerson Date: Wed, 21 Aug 2019 10:15:48 +0200 Subject: [PATCH 03/57] Added logical to control ASCOT output --- BEAMS3D/Sources/beams3d_main.f90 | 6 ++++++ BEAMS3D/Sources/beams3d_runtime.f90 | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index 6d5ec167e..4171ddafa 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -75,6 +75,7 @@ PROGRAM BEAMS3D lbeam_simple = .false. lcollision = .false. lw7x = .false. + lascot = .false. id_string = '' coil_string = '' mgrid_string = '' @@ -95,6 +96,8 @@ PROGRAM BEAMS3D lvac = .true. case ("-plasma") lplasma_only = .true. + case ("-ascot") + lascot = .true. case ("-vmec") i = i + 1 lvmec = .true. @@ -159,6 +162,7 @@ PROGRAM BEAMS3D write(6, *) ' -coil file: Coils. File (for vacuum)' write(6, *) ' -beam_simple: Monoenergetic BEAMS' write(6, *) ' -w7x: W7-X beam model' + write(6, *) ' -ascot: Output data in ASCOT format' !write(6,*)' -restart ext: FIELDLINES HDF5 extension.' write(6, *) ' -raw: Treat coil currents as raw (scale factors)' write(6, *) ' -vac: Only vacuum field' @@ -211,6 +215,8 @@ PROGRAM BEAMS3D IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BCAST_ERR, 'beams3d_main', ierr_mpi) CALL MPI_BCAST(lvac, 1, MPI_LOGICAL, master, MPI_COMM_BEAMS, ierr_mpi) IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BCAST_ERR, 'beams3d_main', ierr_mpi) + CALL MPI_BCAST(lascot, 1, MPI_LOGICAL, master, MPI_COMM_BEAMS, ierr_mpi) + IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BCAST_ERR, 'beams3d_main', ierr_mpi) CALL MPI_BCAST(lrestart, 1, MPI_LOGICAL, master, MPI_COMM_BEAMS, ierr_mpi) IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BCAST_ERR, 'beams3d_main', ierr_mpi) CALL MPI_BCAST(lhitonly,1,MPI_LOGICAL, master, MPI_COMM_BEAMS,ierr_mpi) diff --git a/BEAMS3D/Sources/beams3d_runtime.f90 b/BEAMS3D/Sources/beams3d_runtime.f90 index ae8a1ed6b..0e4cda465 100644 --- a/BEAMS3D/Sources/beams3d_runtime.f90 +++ b/BEAMS3D/Sources/beams3d_runtime.f90 @@ -23,6 +23,7 @@ ! v1.51 09/13/16 - Substep size implemnted for neutral deposition ! v1.52 11/22/16 - Added ability to model W7-X injector geometry ! v2.00 05/06/19 - Shared Memory model implemented +! v2.01 08/21/19 - Added ASCOT Interface !----------------------------------------------------------------------- MODULE beams3d_runtime !----------------------------------------------------------------------- @@ -104,7 +105,7 @@ MODULE beams3d_runtime LOGICAL :: lverb, lvmec, lpies, lspec, lcoil, lmgrid, & lvessel, lvac, lrestart, lneut, & lflux, lbeam, lhitonly, lread_input, lplasma_only, lraw,& - ldepo, lbeam_simple, ldebug, lcollision, lw7x + ldepo, lbeam_simple, ldebug, lcollision, lw7x, lascot INTEGER :: nextcur, npoinc, nbeams, nparticles_start, nprocs_beams INTEGER, ALLOCATABLE :: beam(:) REAL(rprec) :: dt, follow_tol, pi, pi2, mu0, to3, dt_save, ne_scale, te_scale, ti_scale, zeff_scale From bba185d7e1c0ab306625843dfd57a669e01e80c8 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 21 Aug 2019 14:29:47 +0200 Subject: [PATCH 04/57] Added ATT routine to EZ_HDF5 --- LIBSTELL/Sources/Modules/ez_hdf5.f90 | 46 ++++++++++++++++++++++++++++ SHARE/make_macports.inc | 28 +++++------------ 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/LIBSTELL/Sources/Modules/ez_hdf5.f90 b/LIBSTELL/Sources/Modules/ez_hdf5.f90 index 135f0ca85..533157044 100644 --- a/LIBSTELL/Sources/Modules/ez_hdf5.f90 +++ b/LIBSTELL/Sources/Modules/ez_hdf5.f90 @@ -114,6 +114,52 @@ SUBROUTINE close_hdf5(file_id,ier) IF (ier /=0) RETURN END SUBROUTINE close_hdf5 !----------------------------------------------------------------- + + !----------------------------------------------------------------- + SUBROUTINE write_att_hdf5(loc_id,ATT_NAME,ATT,ierr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(in) :: loc_id + CHARACTER(LEN=*), INTENT(in) :: ATT + CHARACTER(LEN=*), INTENT(in) :: ATT_NAME + INTEGER, INTENT(out) :: ierr + INTEGER :: drank = 1 + INTEGER :: arank = 1 + INTEGER(HID_T) :: dset_id + INTEGER(HID_T) :: attr_id + INTEGER(HID_T) :: dspace_id + INTEGER(HID_T) :: aspace_id + INTEGER(HID_T) :: atype_id + INTEGER(SIZE_T) :: attrlen + INTEGER(HSIZE_T), DIMENSION(1) :: ddims = (/1/) + INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/1/) + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims + + + ierr = 0 + attrlen=LEN(TRIM(ATT)) + data_dims(1)=1 + CALL h5screate_simple_f(drank, ddims, aspace_id, ierr) + IF (ierr /=0) RETURN + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, ierr) + IF (ierr /=0) RETURN + CALL h5tset_size_f(atype_id,attrlen,ierr) + IF (ierr /=0) RETURN + CALL h5acreate_f(loc_id,TRIM(ATT_NAME), atype_id, aspace_id, attr_id,ierr) + IF (ierr /=0) RETURN + CALL h5awrite_f(attr_id,atype_id,TRIM(ATT),data_dims,ierr) + IF (ierr /=0) RETURN + CALL h5aclose_f(attr_id,ierr) + IF (ierr /=0) RETURN + CALL h5tclose_f(atype_id, ierr) + IF (ierr /=0) RETURN + CALL h5sclose_f(aspace_id,ierr) + IF (ierr /=0) RETURN + + RETURN + END SUBROUTINE write_att_hdf5 + !----------------------------------------------------------------- + + !----------------------------------------------------------------- SUBROUTINE write_scalar_hdf5(file_id,var,ierr,BOOVAR,INTVAR,FLTVAR,DBLVAR,ATT,ATT_NAME) diff --git a/SHARE/make_macports.inc b/SHARE/make_macports.inc index c78a087c2..dc58c9cd1 100644 --- a/SHARE/make_macports.inc +++ b/SHARE/make_macports.inc @@ -28,7 +28,10 @@ FLAGS_R = -O2 -g -fexternal-blas -fbacktrace -fcheck=all # FLAGS_R = -O2 -fexternal-blas -Wmissing-include-dirs FLAGS_D = -g -O0 -fcheck=all - LIBS = -L/opt/local/lib -lopenblas -lscalapack +# LIBS = -L/opt/local/lib -lopenblas -lscalapack + LIBS = -L/opt/local/lib -lopenblas +# Because scalapack is broken in macport for MPI4.0 + LIBS += /Users/lazerson/Sims_Work/scalapack-2.0.2/libscalapack.a ####################################################################### # MPI Options @@ -41,7 +44,7 @@ MPI_LINK = /opt/local/bin/mpif90 MPI_LINK = mpif90 -shared -Wl,-no_compact_unwind MPI_RUN = mpiexec - MPI_RUN_OPTS = -np 4 + MPI_RUN_OPTS = -np 2 # MPI_RUN_OPTS_SM = -np 16 # MPI_RUN_OPTS_MD = -np 64 # MPI_RUN_OPTS_LG = -np 256 @@ -62,7 +65,7 @@ ####################################################################### # NTCC Options ####################################################################### - LNTCC = T + LNTCC = F NTCC_INC = -I/opt/local/mod NTCC_LIB = -L/opt/local/lib -lpreact -lsigsub -laladdinsub \ -lpreact -lpspline -lportlib -lezcdf @@ -134,7 +137,7 @@ ####################################################################### # TRAVIS Options ####################################################################### - LTRAVIS= T + LTRAVIS= F TRAVIS_DIR = $(TRAVIS_PATH) LIB_TRAVIS = libtravis64_sopt.a LIB_MCONF = libmconf64.a @@ -153,22 +156,7 @@ ####################################################################### # LIBSTELL Shared Options ####################################################################### -LIB_SHARE = /opt/local/lib/libnetcdf.dylib \ - /opt/local/lib/libnetcdff.dylib \ - /opt/local/lib/libnetcdf_c++4.dylib \ - /opt/local/lib/libhdf5.dylib \ - /opt/local/lib/libhdf5hl_fortran.dylib\ - /opt/local/lib/libhdf5_hl.dylib \ - /opt/local/lib/libhdf5_fortran.dylib\ - /opt/local/lib/gcc6/libgfortran.dylib \ - /opt/local/lib/gcc6/libstdc++.dylib \ - /opt/local/lib/libopenblas.dylib \ - /opt/local/lib/openmpi-gcc6/libmpi.dylib \ - /opt/local/lib/openmpi-gcc6/libmpi_mpifh.12.dylib \ - /opt/local/lib/libz.dylib \ - /usr/lib/libc.dylib \ - /usr/lib/libm.dylib \ - /usr/lib/libpthread.dylib + LIB_SHARE = -L/opt/local/lib/gcc8 -lstdc++ -lgfortran -L/usr/lib -lz -lc -lm -lpthread -L/opt/local/lib/openmpi-gcc8 -lmpi -lmpi_mpifh $(LIBS) From 92ea217545fae6e3a2c08070fad85e7cd602202a Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 21 Aug 2019 14:30:29 +0200 Subject: [PATCH 05/57] Fixed indexing for wall_mn routine --- LIBSTELL/Sources/Modules/wall_mod.f90 | 122 +++++++++++++------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/LIBSTELL/Sources/Modules/wall_mod.f90 b/LIBSTELL/Sources/Modules/wall_mod.f90 index 4c43b950f..89da5734e 100644 --- a/LIBSTELL/Sources/Modules/wall_mod.f90 +++ b/LIBSTELL/Sources/Modules/wall_mod.f90 @@ -242,24 +242,26 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) CALL MPI_COMM_SIZE( shar_comm, shar_size, istat) END IF #endif - ALLOCATE(r_temp(nu,nv),z_temp(nu,nv),x_temp(nu,nv),y_temp(nu,nv)) - r_temp(:,:) = 0 - z_temp(:,:) = 0 - DO u = 1, nu - DO v = 1, nv - DO i = 1, mn - th = pi2*DBLE(u-1)/DBLE(nu) - zt = pi2*DBLE(v-1)/DBLE(nv) - r_temp(u,v) = r_temp(u,v) + Rmn(i)*DCOS(xm(i)*th+xn(i)*zt) - z_temp(u,v) = z_temp(u,v) + Zmn(i)*DSIN(xm(i)*th+xn(i)*zt) + IF (shar_rank==0)THEN + ALLOCATE(r_temp(nu,nv),z_temp(nu,nv),x_temp(nu,nv),y_temp(nu,nv)) + r_temp(:,:) = 0 + z_temp(:,:) = 0 + DO u = 1, nu + DO v = 1, nv + DO i = 1, mn + th = pi2*DBLE(u-1)/DBLE(nu) + zt = pi2*DBLE(v-1)/DBLE(nv) + r_temp(u,v) = r_temp(u,v) + Rmn(i)*DCOS(xm(i)*th+xn(i)*zt) + z_temp(u,v) = z_temp(u,v) + Zmn(i)*DSIN(xm(i)*th+xn(i)*zt) + END DO END DO END DO - END DO - DO v = 1, nv - zt = pi2*DBLE(v-1)/DBLE(nv) - x_temp(:,v) = r_temp(:,v) * DCOS(zt) - y_temp(:,v) = r_temp(:,v) * DSIN(zt) - END DO + DO v = 1, nv + zt = pi2*DBLE(v-1)/DBLE(nv) + x_temp(:,v) = r_temp(:,v) * DCOS(zt) + y_temp(:,v) = r_temp(:,v) * DSIN(zt) + END DO + END IF nvertex = nu*nv nface = 2*nu*nv @@ -269,7 +271,7 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) CALL mpialloc_2d_dbl(vertex,nvertex,3,shar_rank,0,shar_comm,win_vertex) CALL mpialloc_2d_int(face,nface,3,shar_rank,0,shar_comm,win_face) mydelta = CEILING(REAL(nface) / REAL(shar_size)) - mystart = 1 + (shar_rank-1)*mydelta + mystart = 1 + shar_rank*mydelta myend = mystart + mydelta IF (myend > nface) myend=nface ELSE @@ -279,17 +281,47 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) END IF i = 1 ! Tracks vertex index j = 1 ! Tracks face index - DO v = 1, nv-1 - DO u = 1, nu-1 + IF (shar_rank==0)THEN + DO v = 1, nv-1 + DO u = 1, nu-1 + vertex(i,1) = x_temp(u,v) + vertex(i,2) = y_temp(u,v) + vertex(i,3) = z_temp(u,v) + face(j,1) = i + face(j,2) = i + nu + face(j,3) = i + 1 + j = j + 1 + face(j,1) = i + nu + face(j,2) = i + nu + 1 + face(j,3) = i + 1 + j = j + 1 + i=i+1 + END DO + u = nu vertex(i,1) = x_temp(u,v) vertex(i,2) = y_temp(u,v) vertex(i,3) = z_temp(u,v) face(j,1) = i - face(j,2) = i + nu - face(j,3) = i + 1 + face(j,2) = i+nu + face(j,3) = i-nu+1 j = j + 1 face(j,1) = i + nu - face(j,2) = i + nu + 1 + face(j,2) = i + 1 + face(j,3) = i-nu+1 + j = j + 1 + i=i+1 + END DO + v = nv + DO u = 1, nu - 1 + vertex(i,1) = x_temp(u,v) + vertex(i,2) = y_temp(u,v) + vertex(i,3) = z_temp(u,v) + face(j,1) = i + face(j,2) = i - nu*(nv-1) + face(j,3) = i + 1 + j = j + 1 + face(j,1) = i - nu*(nv-1) + face(j,2) = i - nu*(nv-1) + 1 face(j,3) = i + 1 j = j + 1 i=i+1 @@ -299,44 +331,16 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) vertex(i,2) = y_temp(u,v) vertex(i,3) = z_temp(u,v) face(j,1) = i - face(j,2) = i+nu - face(j,3) = i-nu+1 + face(j,2) = nu + face(j,3) = i - nu + 1 j = j + 1 - face(j,1) = i + nu - face(j,2) = i + 1 - face(j,3) = i-nu+1 + face(j,1) = nu + face(j,2) = 1 + face(j,3) = i - nu + 1 j = j + 1 i=i+1 - END DO - v = nv - DO u = 1, nu - 1 - vertex(i,1) = x_temp(u,v) - vertex(i,2) = y_temp(u,v) - vertex(i,3) = z_temp(u,v) - face(j,1) = i - face(j,2) = i - nu*(nv-1) - face(j,3) = i + 1 - j = j + 1 - face(j,1) = i - nu*(nv-1) - face(j,2) = i - nu*(nv-1) + 1 - face(j,3) = i + 1 - j = j + 1 - i=i+1 - END DO - u = nu - vertex(i,1) = x_temp(u,v) - vertex(i,2) = y_temp(u,v) - vertex(i,3) = z_temp(u,v) - face(j,1) = i - face(j,2) = nu - face(j,3) = i - nu + 1 - j = j + 1 - face(j,1) = nu - face(j,2) = 1 - face(j,3) = i - nu + 1 - j = j + 1 - i=i+1 - DEALLOCATE(r_temp,z_temp,x_temp,y_temp) + DEALLOCATE(r_temp,z_temp,x_temp,y_temp) + END IF IF (PRESENT(comm)) CALL MPI_BARRIER(shar_comm,istat) ! Sort the array by toroidal angle @@ -380,7 +384,7 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) CALL mpialloc_2d_dbl(V1,nface,3,shar_rank,0,shar_comm,win_v1) CALL mpialloc_2d_dbl(FN,nface,3,shar_rank,0,shar_comm,win_fn) mydelta = CEILING(REAL(nface) / REAL(shar_size)) - mystart = 1 + (shar_rank-1)*mydelta + mystart = 1 + shar_rank*mydelta myend = mystart + mydelta IF (myend > nface) myend=nface ELSE @@ -414,7 +418,7 @@ SUBROUTINE wall_load_mn(Rmn,Zmn,xm,xn,mn,nu,nv,comm) CALL mpialloc_1d_dbl(d,nface,shar_rank,0,shar_comm,win_d) CALL mpialloc_1d_int(ihit_array,nface,shar_rank,0,shar_comm,win_ihit) mydelta = CEILING(REAL(nface) / REAL(shar_size)) - mystart = 1 + (shar_rank-1)*mydelta + mystart = 1 + shar_rank*mydelta myend = mystart + mydelta IF (myend > nface) myend=nface ELSE From a035555361b32e9dd492601e78ba776c524ffb4a Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 21 Aug 2019 14:30:59 +0200 Subject: [PATCH 06/57] Added routine for writing ASCOT5 File --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 171 ++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 BEAMS3D/Sources/beams3d_write_ascoth5.f90 diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 new file mode 100644 index 000000000..5f289de31 --- /dev/null +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -0,0 +1,171 @@ +!----------------------------------------------------------------------- +! Module: beams3d_write_ascoth5 +! Authors: S. Lazerson (samuel.lazerson@ipp.mpg.de) +! Date: 08/21/2019 +! Description: This subroutine outputs simulation data for the +! ASCOT5 code. +!----------------------------------------------------------------------- + SUBROUTINE beams3d_write_ascoth5 +!----------------------------------------------------------------------- +! Libraries +!----------------------------------------------------------------------- + USE stel_kinds, ONLY: rprec +#ifdef LHDF5 + USE hdf5 + USE ez_hdf5 +#endif + USE beams3d_lines + USE beams3d_grid, ONLY: nr, nphi, nz, B_R, B_PHI, B_Z, raxis, & + zaxis, phiaxis, S_ARR, U_ARR, POT_ARR, & + ZEFF_ARR, TE, TI, NE + USE beams3d_runtime, ONLY: id_string, npoinc, nbeams, beam, t_end, lverb, lflux, & + lvmec, lpies, lspec, lcoil, lmgrid, lbeam, & + lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & + HDF5_OPEN_ERR,HDF5_WRITE_ERR,& + HDF5_CLOSE_ERR, BEAMS3D_VERSION, weight, e_beams, p_beams,& + charge, Zatom, mass, ldepo, v_neut,lcollision, pi, pi2 + USE safe_open_mod, ONLY: safe_open + USE wall_mod, ONLY: nface,nvertex,face,vertex,ihit_array, wall_free + USE mpi_params +!----------------------------------------------------------------------- +! Input Variables +!----------------------------------------------------------------------- + IMPLICIT NONE +!----------------------------------------------------------------------- +! Local Variables +! ier Error Flag +! iunit File ID +!----------------------------------------------------------------------- + INTEGER :: ier, iunit + INTEGER(HID_T) :: options_gid, bfield_gid, efield_gid, plasma_gid, & + neutral_gid, wall_gid, marker_gid, qid_gid + INTEGER(HID_T) :: atype_id + INTEGER(HID_T) :: temp_sid + INTEGER(HID_T) :: temp_aid + INTEGER(HID_T) :: temp_did + INTEGER(HSIZE_T), DIMENSION(1) :: h5_1d_help = (/1/) + INTEGER(SIZE_T) :: help_int + CHARACTER(LEN=10) :: qid_str +!----------------------------------------------------------------------- +! Begin Subroutine +!----------------------------------------------------------------------- + IF (myworkid == master) THEN + qid_str='0000000000' + CALL open_hdf5('beams3d_ascot5_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.true.) + IF (ier /= 0) CALL handle_err(HDF5_OPEN_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + ! Write the ID + !CALL write_var_hdf5(fid,'/options/',nz,ier,DBLVAR=zaxis,ATT='Vertical Axis [rad]',ATT_NAME='description') + + ! Create the options Groups + CALL h5gcreate_f(fid,'options', options_gid, ier) + CALL write_att_hdf5(options_gid,'active',qid_str,ier) + CALL h5gcreate_f(options_gid,'opt_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'SIM_MODE',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USE_USERDEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_FIRSTORDER_GCTRANS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_RHOLIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_WALLHIT',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_POLOIDALORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_TOROIDALORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_5D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_6D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO5D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO6D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(options_gid, ier) + + CALL h5gcreate_f(fid,'bfield', bfield_gid, ier) + CALL write_att_hdf5(bfield_gid,'active',qid_str,ier) + CALL h5gcreate_f(bfield_gid,'B_STS_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'b_nr',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'b_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'b_nz',ier,INTVAR=nz) + CALL write_var_hdf5(qid_gid,'b_rmin',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'b_rmax',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'b_zmin',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'b_zmax',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'b_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'b_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'psi_nr',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'psi_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'psi_nz',ier,INTVAR=nz) + CALL write_var_hdf5(qid_gid,'psi_rmin',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'psi_rmax',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'psi_zmin',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'psi_zmax',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'psi_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'psi_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'axis_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'axis_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'axis_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'toroidalPeriods',ier,INTVAR=FLOOR(pi2/phiaxis(nphi))) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(bfield_gid, ier) + + CALL h5gcreate_f(fid,'efield', efield_gid, ier) + CALL write_att_hdf5(efield_gid,'active',qid_str,ier) + CALL h5gcreate_f(efield_gid,'opt_'//qid_str, qid_gid, ier) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(efield_gid, ier) + + CALL h5gcreate_f(fid,'plasma', plasma_gid, ier) + CALL write_att_hdf5(plasma_gid,'active',qid_str,ier) + CALL h5gcreate_f(plasma_gid,'opt_'//qid_str, qid_gid, ier) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(plasma_gid, ier) + + CALL h5gcreate_f(fid,'neutral', neutral_gid, ier) + CALL write_att_hdf5(neutral_gid,'active',qid_str,ier) + CALL h5gcreate_f(neutral_gid,'opt_'//qid_str, qid_gid, ier) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(neutral_gid, ier) + + CALL h5gcreate_f(fid,'wall', wall_gid, ier) + CALL write_att_hdf5(wall_gid,'active',qid_str,ier) + CALL h5gcreate_f(wall_gid,'opt_'//qid_str, qid_gid, ier) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(wall_gid, ier) + + CALL h5gcreate_f(fid,'marker', marker_gid, ier) + CALL write_att_hdf5(marker_gid,'active',qid_str,ier) + CALL h5gcreate_f(marker_gid,'opt_'//qid_str, qid_gid, ier) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(marker_gid, ier) + + ! Close the HDF5 file + CALL close_hdf5(fid,ier) + IF (ier /= 0) CALL handle_err(HDF5_CLOSE_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + WRITE(6,*) 'DONE DONE DONE' + STOP + END IF + + RETURN + +!----------------------------------------------------------------------- +! End Subroutine +!----------------------------------------------------------------------- + END SUBROUTINE beams3d_write_ascoth5 From 3d412f85577d6e9499732afc2061a355651cc7a8 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 21 Aug 2019 15:06:39 +0200 Subject: [PATCH 07/57] Fixed glitch in BCAST statements --- BEAMS3D/Sources/beams3d_init_vmec.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BEAMS3D/Sources/beams3d_init_vmec.f90 b/BEAMS3D/Sources/beams3d_init_vmec.f90 index 9a67a3040..3f5a9d517 100644 --- a/BEAMS3D/Sources/beams3d_init_vmec.f90 +++ b/BEAMS3D/Sources/beams3d_init_vmec.f90 @@ -79,6 +79,8 @@ SUBROUTINE beams3d_init_vmec CALL MPI_BCAST(mpol,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(ntor,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(nfp,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) + CALL MPI_BCAST(mnyq,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) + CALL MPI_BCAST(nnyq,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(mnmax,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(mnmax_nyq,1,MPI_INTEGER, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(lasym,1,MPI_LOGICAL, master, MPI_COMM_BEAMS,ierr_mpi) @@ -264,7 +266,7 @@ SUBROUTINE beams3d_init_vmec DEALLOCATE(mnum) DEALLOCATE(moffsets) #endif - + IF (mylocalid == mylocalmaster) THEN TE = 0; NE = 0; TI=0; S_ARR=1.5; U_ARR=0; POT_ARR=0; ZEFF_ARR = 1; END IF From 0e9cad494ebf0e2238a84bf59ce5180b2e47e235 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 21 Aug 2019 15:59:19 +0200 Subject: [PATCH 08/57] B-FIELD now written --- BEAMS3D/ObjectList | 1 + BEAMS3D/Release/BEAMS3D.dep | 11 ++++++++++ BEAMS3D/Sources/beams3d_grid.f90 | 5 +++-- BEAMS3D/Sources/beams3d_init.f90 | 5 +++++ BEAMS3D/Sources/beams3d_init_vmec.f90 | 25 ++++++++++++++++++++++- BEAMS3D/Sources/beams3d_main.f90 | 13 ++++++------ BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 17 ++++++++++++++- 7 files changed, 67 insertions(+), 10 deletions(-) diff --git a/BEAMS3D/ObjectList b/BEAMS3D/ObjectList index 6365ddc9f..680102a82 100644 --- a/BEAMS3D/ObjectList +++ b/BEAMS3D/ObjectList @@ -1,4 +1,5 @@ ObjectFiles = \ +beams3d_write_ascoth5.o \ beams3d_write_parhdf5.o \ beams3d_init_beams_w7x.o \ beams3d_lines.o \ diff --git a/BEAMS3D/Release/BEAMS3D.dep b/BEAMS3D/Release/BEAMS3D.dep index 7ad776616..454a0b660 100644 --- a/BEAMS3D/Release/BEAMS3D.dep +++ b/BEAMS3D/Release/BEAMS3D.dep @@ -107,6 +107,17 @@ beams3d_write.o: \ beams3d_grid.o +beams3d_write_ascoth5.o: \ + ../../LIBSTELL/Release/stel_kinds.o \ + ../../LIBSTELL/Release/ez_hdf5.o \ + ../../LIBSTELL/Release/safe_open_mod.o \ + ../../LIBSTELL/Release/wall_mod.o \ + ../../LIBSTELL/Release/mpi_params.o \ + beams3d_runtime.o \ + beams3d_lines.o \ + beams3d_grid.o + + beams3d_write_parhdf5.o: \ ../../LIBSTELL/Release/stel_kinds.o \ ../../LIBSTELL/Release/ez_hdf5.o \ diff --git a/BEAMS3D/Sources/beams3d_grid.f90 b/BEAMS3D/Sources/beams3d_grid.f90 index e2f17be22..2989708a6 100644 --- a/BEAMS3D/Sources/beams3d_grid.f90 +++ b/BEAMS3D/Sources/beams3d_grid.f90 @@ -43,10 +43,11 @@ MODULE beams3d_grid win_MODB, win_TE, win_NE, win_TI, win_ZEFF_ARR,& win_S_ARR, win_U_ARR, win_POT_ARR, win_BR4D, win_BPHI4D, & win_BZ4D, win_MODB4D, win_TE4D, win_NE4D, win_TI4D, win_ZEFF4D, & - win_S4D, win_U4D, win_POT4D + win_S4D, win_U4D, win_POT4D, win_req_axis,win_zeq_axis REAL(rprec) :: rmin, rmax, zmin, zmax, phimin, phimax, tmin, tmax, delta_t, & - vc_adapt_tol + vc_adapt_tol, phiedge_eq REAL(rprec), POINTER :: raxis(:), zaxis(:), phiaxis(:) + REAL(rprec), POINTER :: req_axis(:), zeq_axis(:) REAL(rprec), POINTER :: B_R(:,:,:),B_PHI(:,:,:), B_Z(:,:,:), MODB(:,:,:),& TE(:,:,:), NE(:,:,:), TI(:,:,:), ZEFF_ARR(:,:,:), & S_ARR(:,:,:), U_ARR(:,:,:), POT_ARR(:,:,:) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index 16b76fe76..8597e89bb 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -184,6 +184,8 @@ SUBROUTINE beams3d_init ! Put the plasma field on the background grid IF (lvmec .and. .not.lvac .and. nte > 0) THEN + CALL mpialloc(req_axis, nphi, myid_sharmem, 0, MPI_COMM_SHARMEM, win_req_axis) + CALL mpialloc(zeq_axis, nphi, myid_sharmem, 0, MPI_COMM_SHARMEM, win_zeq_axis) CALL beams3d_init_vmec ELSE IF (lpies .and. .not.lvac) THEN !CALL beams3d_init_pies @@ -191,6 +193,9 @@ SUBROUTINE beams3d_init !CALL beams3d_init_spec END IF + ! For testing I put this here + IF (lascot) CALL beams3d_write_ascoth5 + ! Construct 3D Profile Splines IF (.not. lvac) THEN ! First Allocated Spline on master threads diff --git a/BEAMS3D/Sources/beams3d_init_vmec.f90 b/BEAMS3D/Sources/beams3d_init_vmec.f90 index 3f5a9d517..68b70fd58 100644 --- a/BEAMS3D/Sources/beams3d_init_vmec.f90 +++ b/BEAMS3D/Sources/beams3d_init_vmec.f90 @@ -23,7 +23,8 @@ SUBROUTINE beams3d_init_vmec BR_spl, BZ_spl, TE_spl_s, NE_spl_s, TI_spl_s, & nte, nne, nti, TE, NE, TI, Vp_spl_s, S_ARR,& U_ARR, POT_ARR, POT_spl_s, nne, nte, nti, npot, & - ZEFF_spl_s, nzeff, ZEFF_ARR + ZEFF_spl_s, nzeff, ZEFF_ARR, req_axis, zeq_axis, & + phiedge_eq USE wall_mod, ONLY: wall_load_mn, wall_info,vertex,face USE mpi_params USE mpi_inc @@ -108,6 +109,7 @@ SUBROUTINE beams3d_init_vmec CALL MPI_BCAST(bsupumns,ns*mnmax_nyq,MPI_DOUBLE_PRECISION, master, MPI_COMM_BEAMS,ierr_mpi) CALL MPI_BCAST(bsupvmns,ns*mnmax_nyq,MPI_DOUBLE_PRECISION, master, MPI_COMM_BEAMS,ierr_mpi) END IF + phiedge_eq = phi(ns) #endif ! Write info to screen @@ -137,6 +139,27 @@ SUBROUTINE beams3d_init_vmec CALL EZspline_setup(Vp_spl_s,vp(1:ns),ier,EXACT_DIM=.true.) IF (ier /=0) CALL handle_err(EZSPLINE_ERR,'beams3d_init_vmec',ier) + ! Calculate the axis values + chunk = FLOOR(REAL(nphi) / REAL(numprocs_local)) + mystart = mylocalid*chunk + 1 + myend = mystart + chunk - 1 + DO i = mystart, myend + req_axis(i) = 0 + zeq_axis(i) = 0 + DO u = 1, mnmax + req_axis(i) = req_axis(i)+rmnc(u,1)*COS(xn(u)*phiaxis(i)) + zeq_axis(i) = zeq_axis(i)+zmns(u,1)*SIN(xn(u)*phiaxis(i)) + END DO + END DO + IF (lasym) THEN + DO i = mystart, myend + DO u = 1, mnmax + req_axis(i) = req_axis(i)+rmns(u,1)*SIN(xn(u)*phiaxis(i)) + zeq_axis(i) = zeq_axis(i)+zmnc(u,1)*COS(xn(u)*phiaxis(i)) + END DO + END DO + END IF + ! If only plasma response then put a wall at the plasma boundary Unless doing depo calc IF (lplasma_only .and. .not.ldepo) THEN diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index 4171ddafa..5725dcd74 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -94,8 +94,6 @@ PROGRAM BEAMS3D lverb = .false. case ("-vac") ! Vacuum Fields Only lvac = .true. - case ("-plasma") - lplasma_only = .true. case ("-ascot") lascot = .true. case ("-vmec") @@ -149,6 +147,8 @@ PROGRAM BEAMS3D lbeam_simple = .true. case ("-collisions") lcollision = .true. + case ("-plasma") + lplasma_only = .true. case ("-help", "-h") ! Output Help message write(6, *) ' Beam MC Code' write(6, *) ' Usage: xbeams3d ' @@ -182,10 +182,10 @@ PROGRAM BEAMS3D DEALLOCATE(args) WRITE(6, '(a,f5.2)') 'BEAMS3D Version ', BEAMS3D_VERSION WRITE(6,'(A)') '----- MPI Parameters -----' - WRITE(6,'(A,I2,A,I2.2)') ' MPI_version: ', vmajor,'.',vminor - WRITE(6,'(A,A)') ' ', TRIM(mpi_lib_name(1:liblen)) - WRITE(6,'(A,I8)') ' Nproc_total: ', nprocs_beams - WRITE(6,'(A,3X,I5)') ' Nproc_shared: ', nshar + WRITE(6,'(A,I2,A,I2.2)') ' MPI_version: ', vmajor,'.',vminor + WRITE(6,'(A,A)') ' ', TRIM(mpi_lib_name(1:liblen)) + WRITE(6,'(A,I8)') ' Nproc_total: ', nprocs_beams + WRITE(6,'(A,3X,I5)') ' Nproc_shared: ', nshar ELSE lverb = .false. ! Shutup the workers END IF @@ -237,6 +237,7 @@ PROGRAM BEAMS3D IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BCAST_ERR,'fieldlines_main',ierr_mpi) !DEC$ ENDIF + ! Initialize the Calculation CALL beams3d_init ! Follow Fieldlines diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 5f289de31..33946aa2a 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -17,7 +17,7 @@ SUBROUTINE beams3d_write_ascoth5 USE beams3d_lines USE beams3d_grid, ONLY: nr, nphi, nz, B_R, B_PHI, B_Z, raxis, & zaxis, phiaxis, S_ARR, U_ARR, POT_ARR, & - ZEFF_ARR, TE, TI, NE + ZEFF_ARR, TE, TI, NE, req_axis, zeq_axis USE beams3d_runtime, ONLY: id_string, npoinc, nbeams, beam, t_end, lverb, lflux, & lvmec, lpies, lspec, lcoil, lmgrid, lbeam, & lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & @@ -46,6 +46,7 @@ SUBROUTINE beams3d_write_ascoth5 INTEGER(HSIZE_T), DIMENSION(1) :: h5_1d_help = (/1/) INTEGER(SIZE_T) :: help_int CHARACTER(LEN=10) :: qid_str + DOUBLE PRECISION, ALLOCATABLE :: rtemp(:,:,:) !----------------------------------------------------------------------- ! Begin Subroutine !----------------------------------------------------------------------- @@ -123,6 +124,20 @@ SUBROUTINE beams3d_write_ascoth5 CALL write_var_hdf5(qid_gid,'axis_phimin',ier,DBLVAR=phiaxis(1)*180/pi) CALL write_var_hdf5(qid_gid,'axis_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) CALL write_var_hdf5(qid_gid,'toroidalPeriods',ier,INTVAR=FLOOR(pi2/phiaxis(nphi))) + CALL write_var_hdf5(qid_gid,'axisr',nphi,ier,DBLVAR=req_axis) + CALL write_var_hdf5(qid_gid,'axisz',nphi,ier,DBLVAR=zeq_axis) + CALL write_var_hdf5(qid_gid,'psi0',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'psi1',ier,DBLVAR=DBLE(0)) + ALLOCATE(rtemp(nr,nphi,nz)) + rtemp = RESHAPE(B_R,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'br',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(B_PHI,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'bphi',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(B_Z,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'bz',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(S_ARR,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'psi',nr,nphi,nz,ier,DBLVAR=rtemp) + DEALLOCATE(rtemp) CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(bfield_gid, ier) From 762b5876d66369ded5cb75ba3a62949f5349aa7e Mon Sep 17 00:00:00 2001 From: lazersos Date: Thu, 22 Aug 2019 15:18:28 +0200 Subject: [PATCH 09/57] Now to a GIGO stage with ASCOT5 --- BEAMS3D/Release/BEAMS3D.dep | 1 + BEAMS3D/Sources/beams3d_free.f90 | 8 +- BEAMS3D/Sources/beams3d_init.f90 | 20 +- BEAMS3D/Sources/beams3d_main.f90 | 10 +- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 409 +++++++++++++++------- BEAMS3D/Sources/beams3d_write_parhdf5.f90 | 203 ++++++++++- 6 files changed, 508 insertions(+), 143 deletions(-) diff --git a/BEAMS3D/Release/BEAMS3D.dep b/BEAMS3D/Release/BEAMS3D.dep index 454a0b660..2f56afb73 100644 --- a/BEAMS3D/Release/BEAMS3D.dep +++ b/BEAMS3D/Release/BEAMS3D.dep @@ -115,6 +115,7 @@ beams3d_write_ascoth5.o: \ ../../LIBSTELL/Release/mpi_params.o \ beams3d_runtime.o \ beams3d_lines.o \ + beams3d_write_parhdf5.o \ beams3d_grid.o diff --git a/BEAMS3D/Sources/beams3d_free.f90 b/BEAMS3D/Sources/beams3d_free.f90 index 4bde84cc7..7d4a71c71 100644 --- a/BEAMS3D/Sources/beams3d_free.f90 +++ b/BEAMS3D/Sources/beams3d_free.f90 @@ -63,9 +63,11 @@ SUBROUTINE beams3d_free IF (ALLOCATED(B_lines)) DEALLOCATE(B_lines) IF (ALLOCATED(weight)) DEALLOCATE(weight) IF (ALLOCATED(beam)) DEALLOCATE(beam) - IF (ASSOCIATED(raxis)) CALL mpidealloc(raxis,win_raxis) - IF (ASSOCIATED(phiaxis)) CALL mpidealloc(phiaxis,win_phiaxis) - IF (ASSOCIATED(zaxis)) CALL mpidealloc(zaxis,win_zaxis) + IF (ASSOCIATED(req_axis)) CALL mpidealloc(req_axis,win_req_axis) + IF (ASSOCIATED(zeq_axis)) CALL mpidealloc(zeq_axis,win_zeq_axis) + IF (ASSOCIATED(raxis)) CALL mpidealloc(raxis,win_raxis) + IF (ASSOCIATED(phiaxis)) CALL mpidealloc(phiaxis,win_phiaxis) + IF (ASSOCIATED(zaxis)) CALL mpidealloc(zaxis,win_zaxis) IF (ASSOCIATED(B_R)) CALL mpidealloc(B_R,win_B_R) IF (ASSOCIATED(B_PHI)) CALL mpidealloc(B_PHI,win_B_PHI) IF (ASSOCIATED(B_Z)) CALL mpidealloc(B_Z,win_B_Z) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index 8597e89bb..e4f1d4569 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -88,6 +88,7 @@ SUBROUTINE beams3d_init IF (lvac) WRITE(6,'(A)') ' VACUUM FIELDS ONLY!' IF (ldepo) WRITE(6,'(A)') ' DEPOSITION ONLY!' IF (lw7x) WRITE(6,'(A)') ' W7-X BEAM Model!' + IF (lascot) WRITE(6,'(A)') ' ASCOT5 OUTPUT ON!' CALL FLUSH(6) END IF @@ -192,9 +193,18 @@ SUBROUTINE beams3d_init ELSE IF (lspec .and. .not.lvac) THEN !CALL beams3d_init_spec END IF + + ! Setup vessel + IF (lvessel .and. (.not. lplasma_only .or. ldepo)) THEN + CALL wall_load_txt(TRIM(vessel_string),ier,MPI_COMM_BEAMS) + IF (lverb) CALL wall_info(6) + CALL FLUSH(6) + END IF ! For testing I put this here - IF (lascot) CALL beams3d_write_ascoth5 + IF (lascot) THEN + CALL beams3d_write_ascoth5('INIT') + END IF ! Construct 3D Profile Splines IF (.not. lvac) THEN @@ -254,14 +264,6 @@ SUBROUTINE beams3d_init ! Construct MODB IF (myid_sharmem == master) MODB = SQRT(B_R*B_R+B_PHI*B_PHI+B_Z*B_Z) - - ! Get setup vessel - IF (lvessel .and. (.not. lplasma_only .or. ldepo)) THEN - CALL wall_load_txt(TRIM(vessel_string),ier,MPI_COMM_BEAMS) - !IF (myworkid /= master) DEALLOCATE(vertex,face) ! Do this to save memory - IF (lverb) CALL wall_info(6) - CALL FLUSH(6) - END IF ! Initialize Random Number generator CALL RANDOM_SEED diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index 5725dcd74..437b21283 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -240,11 +240,19 @@ PROGRAM BEAMS3D ! Initialize the Calculation CALL beams3d_init + ! Follow Fieldlines CALL beams3d_follow + + ! Write Ouput CALL beams3d_write('TRAJECTORY_PARTIAL') - ! Write some stuff + IF (lascot) THEN + CALL beams3d_write_ascoth5('MARKER') + END IF + + ! Write diagnostics stuff CALL beams3d_diagnostics + ! Clean up CALL beams3d_free CALL wall_free(ier,MPI_COMM_BEAMS) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 33946aa2a..21992d1a8 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -5,7 +5,7 @@ ! Description: This subroutine outputs simulation data for the ! ASCOT5 code. !----------------------------------------------------------------------- - SUBROUTINE beams3d_write_ascoth5 + SUBROUTINE beams3d_write_ascoth5(write_type) !----------------------------------------------------------------------- ! Libraries !----------------------------------------------------------------------- @@ -17,7 +17,9 @@ SUBROUTINE beams3d_write_ascoth5 USE beams3d_lines USE beams3d_grid, ONLY: nr, nphi, nz, B_R, B_PHI, B_Z, raxis, & zaxis, phiaxis, S_ARR, U_ARR, POT_ARR, & - ZEFF_ARR, TE, TI, NE, req_axis, zeq_axis + ZEFF_ARR, TE, TI, NE, req_axis, zeq_axis, npot, & + POT_SPL_S, ezspline_interp, phiedge_eq, TE_spl_s, & + NE_spl_s, TI_spl_s, ZEFF_spl_s USE beams3d_runtime, ONLY: id_string, npoinc, nbeams, beam, t_end, lverb, lflux, & lvmec, lpies, lspec, lcoil, lmgrid, lbeam, & lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & @@ -26,157 +28,306 @@ SUBROUTINE beams3d_write_ascoth5 charge, Zatom, mass, ldepo, v_neut,lcollision, pi, pi2 USE safe_open_mod, ONLY: safe_open USE wall_mod, ONLY: nface,nvertex,face,vertex,ihit_array, wall_free + USE beams3d_write_par USE mpi_params !----------------------------------------------------------------------- ! Input Variables +! write_type Type of write to preform !----------------------------------------------------------------------- IMPLICIT NONE + CHARACTER(*), INTENT(IN):: write_type !----------------------------------------------------------------------- ! Local Variables ! ier Error Flag ! iunit File ID !----------------------------------------------------------------------- - INTEGER :: ier, iunit + INTEGER :: ier, iunit, i, d1, d2, d3 INTEGER(HID_T) :: options_gid, bfield_gid, efield_gid, plasma_gid, & neutral_gid, wall_gid, marker_gid, qid_gid - INTEGER(HID_T) :: atype_id - INTEGER(HID_T) :: temp_sid - INTEGER(HID_T) :: temp_aid - INTEGER(HID_T) :: temp_did - INTEGER(HSIZE_T), DIMENSION(1) :: h5_1d_help = (/1/) - INTEGER(SIZE_T) :: help_int CHARACTER(LEN=10) :: qid_str - DOUBLE PRECISION, ALLOCATABLE :: rtemp(:,:,:) + DOUBLE PRECISION, ALLOCATABLE :: rtemp(:,:,:), r1dtemp(:) !----------------------------------------------------------------------- ! Begin Subroutine !----------------------------------------------------------------------- - IF (myworkid == master) THEN - qid_str='0000000000' - CALL open_hdf5('beams3d_ascot5_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.true.) - IF (ier /= 0) CALL handle_err(HDF5_OPEN_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) - ! Write the ID - !CALL write_var_hdf5(fid,'/options/',nz,ier,DBLVAR=zaxis,ATT='Vertical Axis [rad]',ATT_NAME='description') + qid_str='0000000000' + SELECT CASE (TRIM(write_type)) + CASE('INIT') + IF (myworkid == master) THEN + CALL open_hdf5('beams3d_ascot5_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.true.) + IF (ier /= 0) CALL handle_err(HDF5_OPEN_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + ! Write the ID + !CALL write_var_hdf5(fid,'/options/',nz,ier,DBLVAR=zaxis,ATT='Vertical Axis [rad]',ATT_NAME='description') - ! Create the options Groups - CALL h5gcreate_f(fid,'options', options_gid, ier) - CALL write_att_hdf5(options_gid,'active',qid_str,ier) - CALL h5gcreate_f(options_gid,'opt_'//qid_str, qid_gid, ier) - CALL write_var_hdf5(qid_gid,'SIM_MODE',ier,DBLVAR=DBLE(1)) - CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USE_USERDEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_FIRSTORDER_GCTRANS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_RHOLIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_WALLHIT',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_POLOIDALORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_TOROIDALORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_5D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_6D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO5D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO6D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(options_gid, ier) + !-------------------------------------------------------------- + ! OPTIONS + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'options', options_gid, ier) + CALL write_att_hdf5(options_gid,'active',qid_str,ier) + CALL h5gcreate_f(options_gid,'opt_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'SIM_MODE',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USE_USERDEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_FIRSTORDER_GCTRANS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_RHOLIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_WALLHIT',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_POLOIDALORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_TOROIDALORBS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_5D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_6D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO5D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO6D',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(options_gid, ier) - CALL h5gcreate_f(fid,'bfield', bfield_gid, ier) - CALL write_att_hdf5(bfield_gid,'active',qid_str,ier) - CALL h5gcreate_f(bfield_gid,'B_STS_'//qid_str, qid_gid, ier) - CALL write_var_hdf5(qid_gid,'b_nr',ier,INTVAR=nr) - CALL write_var_hdf5(qid_gid,'b_nphi',ier,INTVAR=nphi) - CALL write_var_hdf5(qid_gid,'b_nz',ier,INTVAR=nz) - CALL write_var_hdf5(qid_gid,'b_rmin',ier,DBLVAR=raxis(1)) - CALL write_var_hdf5(qid_gid,'b_rmax',ier,DBLVAR=raxis(nr)) - CALL write_var_hdf5(qid_gid,'b_zmin',ier,DBLVAR=zaxis(1)) - CALL write_var_hdf5(qid_gid,'b_zmax',ier,DBLVAR=zaxis(nz)) - CALL write_var_hdf5(qid_gid,'b_phimin',ier,DBLVAR=phiaxis(1)*180/pi) - CALL write_var_hdf5(qid_gid,'b_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) - CALL write_var_hdf5(qid_gid,'psi_nr',ier,INTVAR=nr) - CALL write_var_hdf5(qid_gid,'psi_nphi',ier,INTVAR=nphi) - CALL write_var_hdf5(qid_gid,'psi_nz',ier,INTVAR=nz) - CALL write_var_hdf5(qid_gid,'psi_rmin',ier,DBLVAR=raxis(1)) - CALL write_var_hdf5(qid_gid,'psi_rmax',ier,DBLVAR=raxis(nr)) - CALL write_var_hdf5(qid_gid,'psi_zmin',ier,DBLVAR=zaxis(1)) - CALL write_var_hdf5(qid_gid,'psi_zmax',ier,DBLVAR=zaxis(nz)) - CALL write_var_hdf5(qid_gid,'psi_phimin',ier,DBLVAR=phiaxis(1)*180/pi) - CALL write_var_hdf5(qid_gid,'psi_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) - CALL write_var_hdf5(qid_gid,'axis_nphi',ier,INTVAR=nphi) - CALL write_var_hdf5(qid_gid,'axis_phimin',ier,DBLVAR=phiaxis(1)*180/pi) - CALL write_var_hdf5(qid_gid,'axis_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) - CALL write_var_hdf5(qid_gid,'toroidalPeriods',ier,INTVAR=FLOOR(pi2/phiaxis(nphi))) - CALL write_var_hdf5(qid_gid,'axisr',nphi,ier,DBLVAR=req_axis) - CALL write_var_hdf5(qid_gid,'axisz',nphi,ier,DBLVAR=zeq_axis) - CALL write_var_hdf5(qid_gid,'psi0',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'psi1',ier,DBLVAR=DBLE(0)) - ALLOCATE(rtemp(nr,nphi,nz)) - rtemp = RESHAPE(B_R,(/nr,nphi,nz/),ORDER=(/1,2,3/)) - CALL write_var_hdf5(qid_gid,'br',nr,nphi,nz,ier,DBLVAR=rtemp) - rtemp = RESHAPE(B_PHI,(/nr,nphi,nz/),ORDER=(/1,2,3/)) - CALL write_var_hdf5(qid_gid,'bphi',nr,nphi,nz,ier,DBLVAR=rtemp) - rtemp = RESHAPE(B_Z,(/nr,nphi,nz/),ORDER=(/1,2,3/)) - CALL write_var_hdf5(qid_gid,'bz',nr,nphi,nz,ier,DBLVAR=rtemp) - rtemp = RESHAPE(S_ARR,(/nr,nphi,nz/),ORDER=(/1,2,3/)) - CALL write_var_hdf5(qid_gid,'psi',nr,nphi,nz,ier,DBLVAR=rtemp) - DEALLOCATE(rtemp) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(bfield_gid, ier) + !-------------------------------------------------------------- + ! B-FIELD + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'bfield', bfield_gid, ier) + CALL write_att_hdf5(bfield_gid,'active',qid_str,ier) + CALL h5gcreate_f(bfield_gid,'B_STS_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'b_nr',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'b_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'b_nz',ier,INTVAR=nz) + CALL write_var_hdf5(qid_gid,'b_rmin',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'b_rmax',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'b_zmin',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'b_zmax',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'b_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'b_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'psi_nr',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'psi_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'psi_nz',ier,INTVAR=nz) + CALL write_var_hdf5(qid_gid,'psi_rmin',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'psi_rmax',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'psi_zmin',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'psi_zmax',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'psi_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'psi_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'axis_nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'axis_phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'axis_phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'toroidalPeriods',ier,INTVAR=FLOOR(pi2/phiaxis(nphi))) + CALL write_var_hdf5(qid_gid,'axisr',nphi,ier,DBLVAR=req_axis) + CALL write_var_hdf5(qid_gid,'axisz',nphi,ier,DBLVAR=zeq_axis) + CALL write_var_hdf5(qid_gid,'psi0',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'psi1',ier,DBLVAR=DBLE(phiedge_eq)) + ALLOCATE(rtemp(nr,nphi,nz)) + rtemp = RESHAPE(B_R,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'br',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(B_PHI,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'bphi',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(B_Z,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'bz',nr,nphi,nz,ier,DBLVAR=rtemp) + rtemp = RESHAPE(S_ARR,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + CALL write_var_hdf5(qid_gid,'psi',nr,nphi,nz,ier,DBLVAR=rtemp) + DEALLOCATE(rtemp) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(bfield_gid, ier) - CALL h5gcreate_f(fid,'efield', efield_gid, ier) - CALL write_att_hdf5(efield_gid,'active',qid_str,ier) - CALL h5gcreate_f(efield_gid,'opt_'//qid_str, qid_gid, ier) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(efield_gid, ier) + !-------------------------------------------------------------- + ! E-FIELD + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'efield', efield_gid, ier) + CALL write_att_hdf5(efield_gid,'active',qid_str,ier) + CALL h5gcreate_f(efield_gid,'E_1DS_'//qid_str, qid_gid, ier) + IF (npot < 1) THEN ! Because we can run with E=0 + ALLOCATE(r1dtemp(5)) + r1dtemp = 0 + CALL write_var_hdf5(qid_gid,'nrho',ier,INTVAR=5) + CALL write_var_hdf5(qid_gid,'dvdrho',5,ier,DBLVAR=r1dtemp) + DEALLOCATE(r1dtemp) + ELSE + ! This is glitchy since we don't require POT_AUX_S to be equidistant + ! should really spline to new grid + ALLOCATE(r1dtemp(nr)) + DO i = 1, nr + CALL EZspline_interp(POT_spl_s,DBLE(i-1)/DBLE(nr-1),r1dtemp(i),ier) + END DO + CALL write_var_hdf5(qid_gid,'nrho',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'dvdrho',nr,ier,DBLVAR=r1dtemp) + DEALLOCATE(r1dtemp) + END IF + CALL write_var_hdf5(qid_gid,'rhomin',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'rhomax',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'reff',ier,DBLVAR=DBLE(phiedge_eq)) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(efield_gid, ier) - CALL h5gcreate_f(fid,'plasma', plasma_gid, ier) - CALL write_att_hdf5(plasma_gid,'active',qid_str,ier) - CALL h5gcreate_f(plasma_gid,'opt_'//qid_str, qid_gid, ier) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(plasma_gid, ier) - CALL h5gcreate_f(fid,'neutral', neutral_gid, ier) - CALL write_att_hdf5(neutral_gid,'active',qid_str,ier) - CALL h5gcreate_f(neutral_gid,'opt_'//qid_str, qid_gid, ier) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(neutral_gid, ier) + !-------------------------------------------------------------- + ! PLASMA + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'plasma', plasma_gid, ier) + CALL write_att_hdf5(plasma_gid,'active',qid_str,ier) + CALL h5gcreate_f(plasma_gid,'plasma_1D_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'nion',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'nrho',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'znum',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'anum',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'charge',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'mass',ier,INTVAR=1) + ALLOCATE(rtemp(nr,5,1)) + DO i = 1, nr + rtemp(i,1,1)=DBLE(i-1)/DBLE(nr-1) + CALL EZspline_interp( TE_spl_s, rtemp(i,1,1), rtemp(i,2,1), ier) + CALL EZspline_interp( NE_spl_s, rtemp(i,1,1), rtemp(i,3,1), ier) + CALL EZspline_interp( TI_spl_s, rtemp(i,1,1), rtemp(i,4,1), ier) + CALL EZspline_interp( ZEFF_spl_s, rtemp(i,1,1), rtemp(i,5,1), ier) + rtemp(i,5,1)=rtemp(i,3,1)/rtemp(i,5,1) + END DO + CALL write_var_hdf5( qid_gid, 'rho', nr, ier, DBLVAR=rtemp(1:nr,1,1)) + CALL write_var_hdf5( qid_gid, 'etemperature', nr, ier, DBLVAR=rtemp(1:nr,2,1)) + CALL write_var_hdf5( qid_gid, 'edensity', nr, ier, DBLVAR=rtemp(1:nr,3,1)) + CALL write_var_hdf5( qid_gid, 'itemperature', nr, ier, DBLVAR=rtemp(1:nr,4,1)) + CALL write_var_hdf5( qid_gid, 'idensity', nr, ier, DBLVAR=rtemp(1:nr,5,1)) + ! Need to add idensity + DEALLOCATE(rtemp) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(plasma_gid, ier) - CALL h5gcreate_f(fid,'wall', wall_gid, ier) - CALL write_att_hdf5(wall_gid,'active',qid_str,ier) - CALL h5gcreate_f(wall_gid,'opt_'//qid_str, qid_gid, ier) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(wall_gid, ier) - CALL h5gcreate_f(fid,'marker', marker_gid, ier) - CALL write_att_hdf5(marker_gid,'active',qid_str,ier) - CALL h5gcreate_f(marker_gid,'opt_'//qid_str, qid_gid, ier) - CALL h5gclose_f(qid_gid, ier) - CALL h5gclose_f(marker_gid, ier) + !-------------------------------------------------------------- + ! NEUTRAL + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'neutral', neutral_gid, ier) + CALL write_att_hdf5(neutral_gid,'active',qid_str,ier) + CALL h5gcreate_f(neutral_gid,'N0_3D_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'nr',ier,INTVAR=nr) + CALL write_var_hdf5(qid_gid,'nphi',ier,INTVAR=nphi) + CALL write_var_hdf5(qid_gid,'nz',ier,INTVAR=nz) + CALL write_var_hdf5(qid_gid,'rmin',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'rmax',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'zmin',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'zmax',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'phimin',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'phimax',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'nspecies',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'anum',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'znum',ier,INTVAR=1) + CALL write_var_hdf5(qid_gid,'maxwellian',ier,INTVAR=1) + ALLOCATE(rtemp(nr,nphi,nz)) + rtemp = RESHAPE(S_ARR,(/nr,nphi,nz/),ORDER=(/1,2,3/)) + rtemp = 0 + CALL write_var_hdf5(qid_gid,'density',nr,nphi,nz,ier,DBLVAR=rtemp) + CALL write_var_hdf5(qid_gid,'temperature',nr,nphi,nz,ier,DBLVAR=rtemp) + DEALLOCATE(rtemp) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(neutral_gid, ier) - ! Close the HDF5 file - CALL close_hdf5(fid,ier) - IF (ier /= 0) CALL handle_err(HDF5_CLOSE_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) - WRITE(6,*) 'DONE DONE DONE' - STOP - END IF + + !-------------------------------------------------------------- + ! WALL + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'wall', wall_gid, ier) + CALL write_att_hdf5(wall_gid,'active',qid_str,ier) + CALL h5gcreate_f(wall_gid,'wall_3D_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'nelements',ier,INTVAR=nface) + ALLOCATE(rtemp(3,nface,3)) + DO i = 1, nface + d1 = face(i,1) + d2 = face(i,2) + d3 = face(i,3) + ! X + rtemp(1,i,1) = vertex(d1,1) + rtemp(2,i,1) = vertex(d2,1) + rtemp(3,i,1) = vertex(d3,1) + ! Y + rtemp(1,i,2) = vertex(d1,2) + rtemp(2,i,2) = vertex(d2,2) + rtemp(3,i,2) = vertex(d3,2) + ! Z + rtemp(1,i,3) = vertex(d1,3) + rtemp(2,i,3) = vertex(d2,3) + rtemp(3,i,3) = vertex(d3,3) + END DO + CALL write_var_hdf5( qid_gid, 'x1x2x3', 3, nface, ier, DBLVAR=rtemp(:,:,1)) + CALL write_var_hdf5( qid_gid, 'y1y2y3', 3, nface, ier, DBLVAR=rtemp(:,:,2)) + CALL write_var_hdf5( qid_gid, 'z1z2z3', 3, nface, ier, DBLVAR=rtemp(:,:,3)) + DEALLOCATE(rtemp) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(wall_gid, ier) + + ! Close file + CALL close_hdf5(fid,ier) + IF (ier /= 0) CALL handle_err(HDF5_CLOSE_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + END IF + CASE('MARKER') + IF (myworkid == master) THEN + CALL open_hdf5('beams3d_ascot5_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.false.) + IF (ier /= 0) CALL handle_err(HDF5_OPEN_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + !-------------------------------------------------------------- + ! MARKER + !-------------------------------------------------------------- + CALL h5gcreate_f(fid,'marker', marker_gid, ier) + CALL write_att_hdf5(marker_gid,'active',qid_str,ier) + CALL h5gcreate_f(marker_gid,'gc_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'n',ier,INTVAR=nparticles) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(marker_gid, ier) + CALL close_hdf5(fid,ier) + IF (ier /= 0) CALL handle_err(HDF5_CLOSE_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) + END IF + ! For now we assume we will only run this in deposition mode + ! so that means we look at index (1,i) since + ! 0: starting point + ! 1: Ionization point (or wall) + ! 2: Gyrocenter + d1 = LBOUND(R_lines,DIM=2) + d2 = UBOUND(R_lines,DIM=2) + ALLOCATE(rtemp(d1:d2,13,1)) + DO i = d1, d2 + rtemp(i,1,1) = R_lines(2,i) + rtemp(i,2,1) = PHI_lines(2,i) + rtemp(i,3,1) = Z_lines(2,i) + rtemp(i,4,1) = 0.5*mass(i)*vll_lines(2,i)*vll_lines(2,i) + rtemp(i,5,1) = 0.0 ! pitch + rtemp(i,6,1) = 0.0 ! zeta + rtemp(i,7,1) = mass(i) ! mass + rtemp(i,8,1) = charge(i) + rtemp(i,9,1) = mass(i)/1.6726231000E-27 ! Anum + rtemp(i,10,1) = Zatom(i) + rtemp(i,11,1) = 1.0 ! weight + rtemp(i,12,1) = 0.0 ! time + rtemp(i,13,1) = i + END DO + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/r', DBLVAR=rtemp(:,1,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/phi', DBLVAR=rtemp(:,2,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/z', DBLVAR=rtemp(:,3,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/energy', DBLVAR=rtemp(:,4,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/pitch', DBLVAR=rtemp(:,5,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/zeta', DBLVAR=rtemp(:,6,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/mass', DBLVAR=rtemp(:,7,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/charge', DBLVAR=rtemp(:,8,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/anum', INTVAR=INT(rtemp(:,9,1))) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/znum', INTVAR=INT(rtemp(:,10,1))) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/weight', DBLVAR=rtemp(:,11,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/time', DBLVAR=rtemp(:,12,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/id', INTVAR=INT(rtemp(:,13,1))) + DEALLOCATE(rtemp) + END SELECT RETURN diff --git a/BEAMS3D/Sources/beams3d_write_parhdf5.f90 b/BEAMS3D/Sources/beams3d_write_parhdf5.f90 index 89dfff16e..dc9f1b8bd 100644 --- a/BEAMS3D/Sources/beams3d_write_parhdf5.f90 +++ b/BEAMS3D/Sources/beams3d_write_parhdf5.f90 @@ -198,7 +198,7 @@ SUBROUTINE beams3d_write_parhdf5(n1,n2,m1,m2,mystart,myend,var_name,INTVAR,FLTVA CALL h5close_f(ier) END IF CALL MPI_BARRIER(MPI_COMM_BEAMS,ierr_mpi) - IF (ierr_mpi /=0) CALL handle_err(MPI_BARRIER_ERR,'beams3d_init_coil',ierr_mpi) + IF (ierr_mpi /=0) CALL handle_err(MPI_BARRIER_ERR,'beams3d_write_parhdf5',ierr_mpi) !IF (i == 1) STOP END DO @@ -211,4 +211,205 @@ SUBROUTINE beams3d_write_parhdf5(n1,n2,m1,m2,mystart,myend,var_name,INTVAR,FLTVA ! End Subroutine !----------------------------------------------------------------------- END SUBROUTINE beams3d_write_parhdf5 + + SUBROUTINE beams3d_write1d_parhdf5(m1,m2,mystart,myend,var_name,INTVAR,FLTVAR,DBLVAR) +!----------------------------------------------------------------------- +! Libraries +!----------------------------------------------------------------------- + USE mpi_params + USE hdf5 + USE beams3d_runtime, ONLY: id_string, nprocs_beams, handle_err, & + MPI_BARRIER_ERR + USE mpi_inc +!----------------------------------------------------------------------- +! Input Variables +! var_name Name of variable +! n1,n2 Extent of first dimesion of global array +! m1,m2 Extent of second dimension of global array +! mystart Starting point of data (2nd dim) +! myend Ending point of data (2nd dim) +! INTVAR Array (INTEGER) +! FLTVAR Array (REAL) +! DBLVAR Array (DOUBLE PRCISION) +!----------------------------------------------------------------------- + IMPLICIT NONE + INTEGER :: m1,m2,mystart,myend + CHARACTER(LEN=*), INTENT(in) :: var_name + INTEGER, INTENT(in), OPTIONAL :: INTVAR(mystart:myend) + REAL, INTENT(in), OPTIONAL :: FLTVAR(mystart:myend) + DOUBLE PRECISION, INTENT(in), OPTIONAL :: DBLVAR(mystart:myend) +!----------------------------------------------------------------------- +! Local Variables +! ier Error Flag +! info ? +! plist_id Property list +! file_id HDF5 file ID +! rank Data space rank +! dimsf Data space dimensions +! fspace_id Data space identifier +! dset_id Dataset identifier +! mspace_id Memory identifier +! dataspace Data identifier +!----------------------------------------------------------------------- + LOGICAL :: livar, lfvar, ldvar + INTEGER :: ier, info, rank, i + INTEGER(HID_T) :: file_id, fspace_id, dset_id, mspace_id, & + fapl_id, dcpl_id, dxpl_id, driver_id + INTEGER(HSIZE_T), ALLOCATABLE :: dimsf(:), counts(:), chunk_dims(:),& + offset(:) + +!----------------------------------------------------------------------- +! Begin Subroutine +!----------------------------------------------------------------------- + ! Handle types + livar = .false.; lfvar=.false.; ldvar=.false. + IF (PRESENT(INTVAR)) livar=.true. + IF (PRESENT(FLTVAR)) lfvar=.true. + IF (PRESENT(DBLVAR)) ldvar=.true. + + ! Setup Helper Arrays + rank =1 + ALLOCATE(dimsf(rank),chunk_dims(rank),counts(rank),offset(rank)) + dimsf(1) = m2-m1+1 + chunk_dims(1) = myend-mystart+1 + counts(1) = 1 + offset(1) = mystart-1 + +!DEC$ IF DEFINED (HDF5_PAR) + ier = 0 + info = MPI_INFO_NULL + ! Initialize + CALL h5open_f(ier) + ! Setup File access + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, ier) + CALL h5pset_fapl_mpio_f(fapl_id, MPI_COMM_BEAMS, info, ier) + CALL h5pget_driver_f(fapl_id, driver_id, ier) + ! Open file + CALL h5fopen_f('beams3d_ascot5_'//TRIM(id_string)//'.h5', H5F_ACC_RDWR_F, file_id, ier, access_prp = fapl_id) +!!!!!!! Begin writing + +! WRITE(6,*) myworkid,dimsf,chunk_dims,counts,offset; CALL FLUSH(6) + + ! Create Data Space + CALL h5screate_simple_f(rank, dimsf, fspace_id, ier) + + ! Enable Chunking + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl_id, ier) + CALL h5pset_chunk_f(dcpl_id, rank, chunk_dims, ier) + + ! Create Dataset + IF (livar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_INTEGER, fspace_id, dset_id, ier, dcpl_id) + IF (lfvar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_DOUBLE, fspace_id, dset_id, ier, dcpl_id) + IF (ldvar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_DOUBLE, fspace_id, dset_id, ier, dcpl_id) + + ! Close the file space + CALL h5sclose_f(fspace_id, ier) + + ! Create the Memore Space + CALL h5screate_simple_f(rank, chunk_dims, mspace_id, ier) + + ! Select the Hyperslab in data + CALL h5dget_space_f(dset_id, fspace_id, ier) + CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, offset, chunk_dims, ier) + + ! Create Properties + CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, ier) + CALL h5pset_dxpl_mpio_f(dxpl_id, H5FD_MPIO_COLLECTIVE_F, ier) + + ! Write dataset + IF (livar) CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, INTVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id, xfer_prp = dxpl_id) + IF (lfvar) CALL h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE, FLTVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id, xfer_prp = dxpl_id) + IF (ldvar) CALL h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE, DBLVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id, xfer_prp = dxpl_id) + + ! Close Property list + CALL h5pclose_f(fapl_id, ier) + CALL h5pclose_f(dcpl_id, ier) + CALL h5pclose_f(dxpl_id, ier) + CALL h5sclose_f(mspace_id, ier) + CALL h5sclose_f(fspace_id, ier) + CALL h5dclose_f(dset_id, ier) + +!!!!!!!CLOSE FILE + ! Close the file + CALL h5fclose_f(file_id, ier) + ! Close the fortran interface + CALL h5close_f(ier) + +!DEC$ ELSE + + DO i = 0, nprocs_beams-1 + IF (myworkid == i) THEN + ! Open the fotran interface + CALL h5open_f(ier) + !PRINT *,'h5open ',ier + + ! Setup File access + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, ier) + !PRINT *,'h5pcreate_f ',ier + + ! Open file + CALL h5fopen_f('beams3d_ascot5_'//TRIM(id_string)//'.h5', H5F_ACC_RDWR_F, file_id, ier, access_prp = H5P_DEFAULT_F) + !PRINT *,'h5fopen_f ',ier + + ! Open or create the dataset and get/create dataspace identifer + IF (myworkid == master) THEN + CALL h5screate_simple_f(rank, dimsf, fspace_id, ier) + !PRINT *,'h5screate_simple_f ',ier + IF (livar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_INTEGER, fspace_id, dset_id, ier) + IF (lfvar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_DOUBLE, fspace_id, dset_id, ier) + IF (ldvar) CALL h5dcreate_f(file_id, TRIM(var_name), H5T_NATIVE_DOUBLE, fspace_id, dset_id, ier) + !PRINT *,'h5dcreate_f ',ier + ELSE + CALL h5dopen_f(file_id, TRIM(var_name), dset_id, ier) + !PRINT *,'h5dopen_f ',ier + CALL h5dget_space_f(dset_id, fspace_id, ier) + !PRINT *,'h5dget_space_f ',ier + END IF + + ! Select Hyperslab + CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F,offset, chunk_dims, ier) + !PRINT *,'h5sselect_hyperslab_f ',ier + + ! Get Memory Space + CALL h5screate_simple_f(rank, chunk_dims, mspace_id, ier) + !PRINT *,'h5screate_simple_f ',ier + + ! Enable Chunking + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl_id, ier) + !PRINT *,'h5pcreate_f ',ier + CALL h5pset_chunk_f(dcpl_id, rank, chunk_dims, ier) + !PRINT *,'h5pset_chunk_f ',ier + + ! Write dataset + IF (livar) CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, INTVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id) + IF (lfvar) CALL h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE, FLTVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id) + IF (ldvar) CALL h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE, DBLVAR, dimsf, ier, mem_space_id = mspace_id, file_space_id = fspace_id) + !PRINT *,'h5dwrite_f ',ier + + ! Close down + CALL h5sclose_f(fspace_id, ier) + CALL h5sclose_f(mspace_id, ier) + CALL h5dclose_f(dset_id, ier) + + ! Close the file + CALL h5fclose_f(file_id, ier) + + ! Close the fortran interface + CALL h5close_f(ier) + END IF + CALL MPI_BARRIER(MPI_COMM_BEAMS,ierr_mpi) + IF (ierr_mpi /=0) CALL handle_err(MPI_BARRIER_ERR,'beams3d_write_parhdf5',ierr_mpi) + !IF (i == 1) STOP + END DO + +!DEC$ ENDIF + + ! Deallocate Helpers + DEALLOCATE(dimsf,chunk_dims,counts,offset) + RETURN +!----------------------------------------------------------------------- +! End Subroutine +!----------------------------------------------------------------------- + END SUBROUTINE beams3d_write1d_parhdf5 + END MODULE beams3d_write_par From f746979977b9b5c4367f312b20a4b306adbd381a Mon Sep 17 00:00:00 2001 From: lazersos Date: Thu, 22 Aug 2019 15:20:30 +0200 Subject: [PATCH 10/57] Fix for STELLOPT and BEAMS3D/ASCOT integration --- STELLOPTV2/Sources/General/stellopt_paraexe.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 index adc123c67..788ad07f0 100644 --- a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 +++ b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 @@ -56,7 +56,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) lread_input_beams => lread_input, lvmec_beams => lvmec, & lverb_beams => lverb, lbeam_beams => lbeam, & lpies_beams => lpies, lspec_beams => lspec, & - lmgrid_beams => lmgrid, & + lmgrid_beams => lmgrid, lascot_beams => lascot, & lvessel_beams => lvessel, lcoil_beams => lcoil, & lrestart_beams => lrestart, lbeam_simple_beams => lbeam_simple, & lflux_beams => lflux, lplasma_only_beams => lplasma_only, & @@ -296,6 +296,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) lspec_beams = .FALSE. lcoil_beams = .FALSE. lmgrid_beams = .FALSE. + lascot_beams = .FALSE. lraw_beams = .FALSE. lvessel_beams = .FALSE. lvac_beams = .FALSE. From 9b0a47b55732ecd3920855ddc803b81684fc85e3 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 23 Aug 2019 12:53:21 +0200 Subject: [PATCH 11/57] Now working with ADAS, still have a few things to fix --- BEAMS3D/Sources/beams3d_follow.f90 | 10 ++++++++++ BEAMS3D/Sources/beams3d_grid.f90 | 2 +- BEAMS3D/Sources/beams3d_write.f90 | 5 ----- SHARE/make_macports.inc | 13 +++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_follow.f90 b/BEAMS3D/Sources/beams3d_follow.f90 index 74bad53bd..fcd1badcd 100644 --- a/BEAMS3D/Sources/beams3d_follow.f90 +++ b/BEAMS3D/Sources/beams3d_follow.f90 @@ -399,6 +399,16 @@ SUBROUTINE beams3d_follow B_lines(0:npoinc,mystart:myend) = REAL(myworkid) END SELECT END IF + + IF (lverb) THEN + CALL backspace_out(6,36) + CALL FLUSH(6) + WRITE(6,'(36X)',ADVANCE='no') + CALL FLUSH(6) + CALL backspace_out(6,36) + WRITE(6,*) + CALL FLUSH(6) + END IF ! Check for crash istate = 0 diff --git a/BEAMS3D/Sources/beams3d_grid.f90 b/BEAMS3D/Sources/beams3d_grid.f90 index 2989708a6..90892aad2 100644 --- a/BEAMS3D/Sources/beams3d_grid.f90 +++ b/BEAMS3D/Sources/beams3d_grid.f90 @@ -43,7 +43,7 @@ MODULE beams3d_grid win_MODB, win_TE, win_NE, win_TI, win_ZEFF_ARR,& win_S_ARR, win_U_ARR, win_POT_ARR, win_BR4D, win_BPHI4D, & win_BZ4D, win_MODB4D, win_TE4D, win_NE4D, win_TI4D, win_ZEFF4D, & - win_S4D, win_U4D, win_POT4D, win_req_axis,win_zeq_axis + win_S4D, win_U4D, win_POT4D, win_req_axis, win_zeq_axis REAL(rprec) :: rmin, rmax, zmin, zmax, phimin, phimax, tmin, tmax, delta_t, & vc_adapt_tol, phiedge_eq REAL(rprec), POINTER :: raxis(:), zaxis(:), phiaxis(:) diff --git a/BEAMS3D/Sources/beams3d_write.f90 b/BEAMS3D/Sources/beams3d_write.f90 index 99ce38830..8bb583a59 100644 --- a/BEAMS3D/Sources/beams3d_write.f90 +++ b/BEAMS3D/Sources/beams3d_write.f90 @@ -131,14 +131,12 @@ SUBROUTINE beams3d_write(write_type) IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'nvertex',ier) CALL write_var_hdf5(fid,'wall_vertex',nvertex,3,ier,DBLVAR=vertex,ATT='Wall Verticies (x,y,z) [m]',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'wall_vertex',ier) - !DEALLOCATE(vertex) END IF IF (ASSOCIATED(face)) THEN CALL write_scalar_hdf5(fid,'nface',ier,INTVAR=nface,ATT='Number of Wall Faces',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'nface',ier) CALL write_var_hdf5(fid,'wall_faces',nface,3,ier,INTVAR=face,ATT='Wall Faces',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'wall_faces',ier) - !DEALLOCATE(face) END IF CASE('TRAJECTORY_PARTIAL') CALL open_hdf5('beams3d_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.false.) @@ -168,7 +166,6 @@ SUBROUTINE beams3d_write(write_type) CALL write_var_hdf5(fid,'wall_strikes',nface,ier,INTVAR=ihit_array,& ATT='Wall Strikes',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'wall_strikes',ier) - !CALL wall_free(ier,MPI_COMM_SHARMEM) END IF CASE('TRAJECTORY_FULL') CALL open_hdf5('beams3d_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.false.) @@ -231,7 +228,6 @@ SUBROUTINE beams3d_write(write_type) CALL write_var_hdf5(fid,'wall_strikes',nface,ier,INTVAR=ihit_array,& ATT='Wall Strikes',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'wall_strikes',ier) - !CALL wall_free(ier,MPI_COMM_SHARMEM) END IF CASE('DIAG') CALL open_hdf5('beams3d_'//TRIM(id_string)//'.h5',fid,ier,LCREATE=.false.) @@ -282,7 +278,6 @@ SUBROUTINE beams3d_write(write_type) WRITE(iunit,*) weight WRITE(iunit,*) beam WRITE(iunit,*) e_beams - !WRITE(iunit,*) p_beams IF (.not.ldepo) THEN WRITE(iunit,*) shine_through WRITE(iunit,*) ndot_prof diff --git a/SHARE/make_macports.inc b/SHARE/make_macports.inc index dc58c9cd1..e689f3c84 100644 --- a/SHARE/make_macports.inc +++ b/SHARE/make_macports.inc @@ -65,14 +65,11 @@ ####################################################################### # NTCC Options ####################################################################### - LNTCC = F - NTCC_INC = -I/opt/local/mod - NTCC_LIB = -L/opt/local/lib -lpreact -lsigsub -laladdinsub \ - -lpreact -lpspline -lportlib -lezcdf -# NTCC_INC = -I/Users/slazerso/Sims_PPPL/STELLOPT/NTCC/MAC/mod -# NTCC_LIB = -L/Users/slazerso/Sims_PPPL/STELLOPT/NTCC/MAC/lib \ -# -lpreact -lsigsub -laladdinsub -lpreact -lpspline \ -# -lportlib -lezcdf + LNTCC = T + NTCC_INC = -I/Users/lazerson/Sims_Work/pub/mod + NTCC_LIB = -L/Users/lazerson/Sims_Work/pub/lib \ + -lpreact -lsigsub -laladdinsub -lpreact -lpspline \ + -lportlib -lezcdf ####################################################################### # HDF5 Options From dc4f2a160765b4aee3995bbd232a3bda4ece85ce Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 23 Aug 2019 14:06:13 +0200 Subject: [PATCH 12/57] Should be working now --- BEAMS3D/Sources/beams3d_init.f90 | 4 +-- BEAMS3D/Sources/beams3d_input_mod.f90 | 6 ++++ BEAMS3D/Sources/beams3d_physics_mod.f90 | 7 ++++ BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 40 +++++++++++++---------- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index e4f1d4569..b9154ab8e 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -129,11 +129,11 @@ SUBROUTINE beams3d_init END IF ! ZEFF IF (nzeff>0) THEN - CALL EZspline_init(ZEFF_spl_s,nti,bcs1_s,ier) + CALL EZspline_init(ZEFF_spl_s,nzeff,bcs1_s,ier) IF (ier /=0) CALL handle_err(EZSPLINE_ERR,'beams3d_init7',ier) ZEFF_spl_s%isHermite = 1 ZEFF_spl_s%x1 = ZEFF_AUX_S(1:nzeff) - CALL EZspline_setup(ZEFF_spl_s,ZEFF_AUX_F(1:nti),ier,EXACT_DIM=.true.) + CALL EZspline_setup(ZEFF_spl_s,ZEFF_AUX_F(1:nzeff),ier,EXACT_DIM=.true.) IF (ier /=0) CALL handle_err(EZSPLINE_ERR,'beams3d_init8',ier) END IF ! POTENTIAL diff --git a/BEAMS3D/Sources/beams3d_input_mod.f90 b/BEAMS3D/Sources/beams3d_input_mod.f90 index e52b21954..4c2db4910 100644 --- a/BEAMS3D/Sources/beams3d_input_mod.f90 +++ b/BEAMS3D/Sources/beams3d_input_mod.f90 @@ -177,6 +177,12 @@ SUBROUTINE read_beams3d_input(filename, istat) npot = npot + 1 END DO + IF (nzeff < 2) THEN + ZEFF_AUX_S(1:6) = (/0.0,0.2,0.4,0.6,0.8,1.0/) + ZEFF_AUX_F(1:6) = (/1.0,1.0,1.0,1.0,1.0,1.0/) + nzeff = 6 + END IF + nparticles = 0 DO WHILE ((r_start_in(nparticles+1) >= 0.0).and.(nparticles Date: Mon, 26 Aug 2019 10:04:41 +0200 Subject: [PATCH 13/57] Added missing date and description attributes to Options --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 3a1c2fe95..181f4cd05 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -64,6 +64,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'options', options_gid, ier) CALL write_att_hdf5(options_gid,'active',qid_str,ier) CALL h5gcreate_f(options_gid,'opt_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date','08/22/19',ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'SIM_MODE',ier,DBLVAR=DBLE(3)) CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) From 35d54dadf8d93bee6c8912185dd809e2f7a9309c Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 26 Aug 2019 14:40:43 +0200 Subject: [PATCH 14/57] Minor mod so attributes stored as scalar rather than vector --- LIBSTELL/Sources/Modules/ez_hdf5.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LIBSTELL/Sources/Modules/ez_hdf5.f90 b/LIBSTELL/Sources/Modules/ez_hdf5.f90 index 533157044..9f4690a5f 100644 --- a/LIBSTELL/Sources/Modules/ez_hdf5.f90 +++ b/LIBSTELL/Sources/Modules/ez_hdf5.f90 @@ -138,7 +138,8 @@ SUBROUTINE write_att_hdf5(loc_id,ATT_NAME,ATT,ierr) ierr = 0 attrlen=LEN(TRIM(ATT)) data_dims(1)=1 - CALL h5screate_simple_f(drank, ddims, aspace_id, ierr) + !CALL h5screate_simple_f(drank, ddims, aspace_id, ierr) + CALL h5screate_f(H5S_SCALAR_F,aspace_id,ierr) IF (ierr /=0) RETURN CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, ierr) IF (ierr /=0) RETURN From 86dfa8e731279d05a33a6bf52c53eb743dbc1566 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 26 Aug 2019 14:41:37 +0200 Subject: [PATCH 15/57] The output now runs with ASCOT5 --- BEAMS3D/Sources/beams3d_follow.f90 | 16 ++- BEAMS3D/Sources/beams3d_lines.f90 | 4 +- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 119 ++++++++++++++++------ 3 files changed, 108 insertions(+), 31 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_follow.f90 b/BEAMS3D/Sources/beams3d_follow.f90 index fcd1badcd..89179a599 100644 --- a/BEAMS3D/Sources/beams3d_follow.f90 +++ b/BEAMS3D/Sources/beams3d_follow.f90 @@ -419,8 +419,8 @@ SUBROUTINE beams3d_follow IF (ALLOCATED(w)) DEALLOCATE(w) IF (ALLOCATED(iwork)) DEALLOCATE(iwork) - ! Handle WALL Heat MAp !DEC$ IF DEFINED (MPI_OPT) + ! Handle WALL Heat MAp ier = 0 IF (ASSOCIATED(ihit_array)) THEN i = MPI_UNDEFINED @@ -434,6 +434,20 @@ SUBROUTINE beams3d_follow END IF !DEC$ ENDIF +!DEC$ IF DEFINED (MPI_OPT) + IF (myid_sharmem == master) i = 0 + CALL MPI_COMM_SPLIT( MPI_COMM_BEAMS,i,myworkid,MPI_COMM_LOCAL,ierr_mpi) + IF (myid_sharmem == master) THEN + partvmax = MAXVAL(MAXVAL(ABS(vll_lines),DIM=2),DIM=1) + CALL MPI_ALLREDUCE(MPI_IN_PLACE,partvmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,MPI_COMM_LOCAL,ierr_mpi) + CALL MPI_COMM_FREE(MPI_COMM_LOCAL,ierr_mpi) + END IF + CALL MPI_BARRIER(MPI_COMM_BEAMS, ierr_mpi) +!DEC$ ELSE + partvmax = MAXVAL(MAXVAL(ABS(vll_lines),DIM=2),DIM=1) +!DEC$ ENDIF + + !DEC$ IF DEFINED (MPI_OPT) CALL beams3d_write_parhdf5(0, npoinc, 1, nparticles, mystart, myend, 'R_lines', DBLVAR=R_lines) CALL beams3d_write_parhdf5(0, npoinc, 1, nparticles, mystart, myend, 'PHI_lines', DBLVAR=PHI_lines) diff --git a/BEAMS3D/Sources/beams3d_lines.f90 b/BEAMS3D/Sources/beams3d_lines.f90 index 758ca6e3e..dd2f3e2d0 100644 --- a/BEAMS3D/Sources/beams3d_lines.f90 +++ b/BEAMS3D/Sources/beams3d_lines.f90 @@ -26,7 +26,9 @@ MODULE beams3d_lines INTEGER :: ns_prof = 50 INTEGER :: nparticles, nsteps, myline, mybeam, mytdex, myend, mystart_save,myend_save REAL(rprec) :: xlast,ylast,zlast ! for storing position - REAL(rprec) :: moment, mycharge, myZ, mymass, myv_neut(3), B_temp(4), rand_prob, cum_prob, tau, next_t, dt_out + REAL(rprec) :: moment, mycharge, myZ, mymass, myv_neut(3), & + B_temp(4), rand_prob, cum_prob, tau, next_t, & + dt_out, partvmax LOGICAL, ALLOCATABLE :: neut_lines(:,:) REAL(rprec), ALLOCATABLE :: shine_through(:) REAL(rprec), ALLOCATABLE :: ndot_prof(:,:),power_prof(:,:),epower_prof(:,:),ipower_prof(:,:),j_prof(:,:) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 181f4cd05..e85a80026 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -44,8 +44,10 @@ SUBROUTINE beams3d_write_ascoth5(write_type) INTEGER :: ier, iunit, i, d1, d2, d3 INTEGER(HID_T) :: options_gid, bfield_gid, efield_gid, plasma_gid, & neutral_gid, wall_gid, marker_gid, qid_gid - CHARACTER(LEN=10) :: qid_str + DOUBLE PRECISION :: dbl_temp DOUBLE PRECISION, ALLOCATABLE :: rtemp(:,:,:), r1dtemp(:) + CHARACTER(LEN=10) :: qid_str + CHARACTER(LEN=8) :: temp_str8 !----------------------------------------------------------------------- ! Begin Subroutine !----------------------------------------------------------------------- @@ -64,43 +66,65 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'options', options_gid, ier) CALL write_att_hdf5(options_gid,'active',qid_str,ier) CALL h5gcreate_f(options_gid,'opt_'//qid_str, qid_gid, ier) - CALL write_att_hdf5(qid_gid,'date','08/22/19',ier) + CALL DATE_AND_TIME(DATE=temp_str8) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'SIM_MODE',ier,DBLVAR=DBLE(3)) CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USE_USERDEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(0.01)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0.01)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0.01)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(0.01)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(1.0E-8)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(20)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(1.0E-8)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0.1)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0.1)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(2)) CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'DISABLE_FIRSTORDER_GCTRANS',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_RHOLIM',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_WALLHIT',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(600)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(1.0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(1800)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(2.0)) CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_POLOIDALORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_TOROIDALORBS',ier,DBLVAR=DBLE(pi2*1000)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_5D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_6D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO5D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO6D',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(1000)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(1.5)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_POLOIDALORBS',ier,DBLVAR=DBLE(100)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_TOROIDALORBS',ier,DBLVAR=DBLE(100)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_5D',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_6D',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO5D',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENABLE_DIST_RHO6D',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_R',ier,DBLVAR=raxis(1)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_R',ier,DBLVAR=raxis(nr)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_Z',ier,DBLVAR=zaxis(1)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_Z',ier,DBLVAR=zaxis(nz)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_PHI',ier,DBLVAR=phiaxis(1)*180/pi) + CALL write_var_hdf5(qid_gid,'DIST_MAX_PHI',ier,DBLVAR=phiaxis(nphi)*180/pi) + CALL write_var_hdf5(qid_gid,'DIST_MIN_RHO',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_RHO',ier,DBLVAR=DBLE(2.0)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_THETA',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_THETA',ier,DBLVAR=DBLE(360)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_TIME',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_TIME',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_CHARGE',ier,DBLVAR=DBLE(-2)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_CHARGE',ier,DBLVAR=DBLE(2)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_R',ier,DBLVAR=DBLE(nr)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_Z',ier,DBLVAR=DBLE(nz)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_PHI',ier,DBLVAR=DBLE(nphi)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_RHO',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_THETA',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_TIME',ier,DBLVAR=DBLE(npoinc)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_CHARGE',ier,DBLVAR=DBLE(5)) + CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) ! If we enable this we need to write more CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(options_gid, ier) @@ -110,6 +134,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'bfield', bfield_gid, ier) CALL write_att_hdf5(bfield_gid,'active',qid_str,ier) CALL h5gcreate_f(bfield_gid,'B_STS_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'b_nr',ier,INTVAR=nr) CALL write_var_hdf5(qid_gid,'b_nphi',ier,INTVAR=nphi) CALL write_var_hdf5(qid_gid,'b_nz',ier,INTVAR=nz) @@ -155,6 +181,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'efield', efield_gid, ier) CALL write_att_hdf5(efield_gid,'active',qid_str,ier) CALL h5gcreate_f(efield_gid,'E_1DS_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) IF (npot < 1) THEN ! Because we can run with E=0 ALLOCATE(r1dtemp(5)) r1dtemp = 0 @@ -185,6 +213,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'plasma', plasma_gid, ier) CALL write_att_hdf5(plasma_gid,'active',qid_str,ier) CALL h5gcreate_f(plasma_gid,'plasma_1D_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'nion',ier,INTVAR=1) CALL write_var_hdf5(qid_gid,'nrho',ier,INTVAR=nr) CALL write_var_hdf5(qid_gid,'znum',ier,INTVAR=1) @@ -217,6 +247,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'neutral', neutral_gid, ier) CALL write_att_hdf5(neutral_gid,'active',qid_str,ier) CALL h5gcreate_f(neutral_gid,'N0_3D_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'nr',ier,INTVAR=nr) CALL write_var_hdf5(qid_gid,'nphi',ier,INTVAR=nphi) CALL write_var_hdf5(qid_gid,'nz',ier,INTVAR=nz) @@ -246,6 +278,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL h5gcreate_f(fid,'wall', wall_gid, ier) CALL write_att_hdf5(wall_gid,'active',qid_str,ier) CALL h5gcreate_f(wall_gid,'wall_3D_'//qid_str, qid_gid, ier) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL write_var_hdf5(qid_gid,'nelements',ier,INTVAR=nface) ALLOCATE(rtemp(3,nface,3)) DO i = 1, nface @@ -287,8 +321,34 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_att_hdf5(marker_gid,'active',qid_str,ier) CALL h5gcreate_f(marker_gid,'gc_'//qid_str, qid_gid, ier) CALL write_var_hdf5(qid_gid,'n',ier,INTVAR=nparticles) + CALL DATE_AND_TIME(DATE=temp_str8) + CALL write_att_hdf5(qid_gid,'date',temp_str8,ier) + CALL write_att_hdf5(qid_gid,'description','Data initialized from BEAMS3D',ier) CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(marker_gid, ier) + !-------------------------------------------------------------- + ! Update options + !-------------------------------------------------------------- + CALL h5gopen_f(fid,'options', options_gid, ier) + CALL h5gopen_f(options_gid,'opt_'//qid_str, qid_gid, ier) + CALL write_var_hdf5(qid_gid,'DIST_MIN_VR',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_VR',ier,DBLVAR=DBLE(partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_VPHI',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_VPHI',ier,DBLVAR=DBLE(partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_VZ',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_VZ',ier,DBLVAR=DBLE(partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_VPA',ier,DBLVAR=DBLE(-partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_VPA',ier,DBLVAR=DBLE(partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MIN_VPE',ier,DBLVAR=DBLE(-partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_MAX_VPE',ier,DBLVAR=DBLE(partvmax)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VR',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPHI',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VZ',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPA',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPE',ier,DBLVAR=DBLE(16)) + CALL h5gclose_f(qid_gid, ier) + CALL h5gclose_f(options_gid, ier) + ! Close file CALL close_hdf5(fid,ier) IF (ier /= 0) CALL handle_err(HDF5_CLOSE_ERR,'beams3d_ascot5_'//TRIM(id_string)//'.h5',ier) END IF @@ -302,16 +362,17 @@ SUBROUTINE beams3d_write_ascoth5(write_type) d3 = 2 ALLOCATE(rtemp(d1:d2,13,1)) DO i = d1, d2 - !CALL RANDOM_NUMBER(rand_prob) + CALL RANDOM_NUMBER(dbl_temp) rtemp(i,1,1) = R_lines(d3,i) rtemp(i,2,1) = PHI_lines(d3,i) rtemp(i,3,1) = Z_lines(d3,i) rtemp(i,4,1) = 0.5*mass(i)*vll_lines(d3,i)*vll_lines(d3,i) - rtemp(i,5,1) = SQRT(2*B_lines(d3,i)*moment_lines(d3,i)/mass(i)) ! v_perp - rtemp(i,5,1) = rtemp(i,5,1)/(rtemp(i,5,1)+vll_lines(d3,i)) ! pitch - rtemp(i,6,1) = 0.0 ! zeta + rtemp(i,5,1) = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! v_perp^2 + rtemp(i,5,1) = vll_lines(d3,i)/SQRT(rtemp(i,5,1)+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch + !rtemp(i,5,1) = rtemp(i,5,1)/(rtemp(i,5,1)+vll_lines(d3,i)) ! pitch + rtemp(i,6,1) = dbl_temp*pi2 ! zeta rtemp(i,7,1) = mass(i) ! mass - rtemp(i,8,1) = charge(i) + rtemp(i,8,1) = Zatom(i) rtemp(i,9,1) = NINT(mass(i)*5.97863320194E26) ! Anum rtemp(i,10,1) = Zatom(i) rtemp(i,11,1) = 1.0 ! weight @@ -326,7 +387,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/pitch', DBLVAR=rtemp(:,5,1)) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/zeta', DBLVAR=rtemp(:,6,1)) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/mass', DBLVAR=rtemp(:,7,1)) - CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/charge', DBLVAR=rtemp(:,8,1)) + CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/charge', INTVAR=INT(rtemp(:,8,1))) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/anum', INTVAR=INT(rtemp(:,9,1))) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/znum', INTVAR=INT(rtemp(:,10,1))) CALL beams3d_write1d_parhdf5( 1, nparticles, d1, d2, '/marker/gc_'//qid_str//'/weight', DBLVAR=rtemp(:,11,1)) From a11718199fd152f1818fc64f2db5b12b440afaa9 Mon Sep 17 00:00:00 2001 From: Samuel Lazerson Date: Mon, 26 Aug 2019 14:52:58 +0200 Subject: [PATCH 16/57] Added lascot to output vars in HDF5 --- BEAMS3D/Sources/beams3d_write.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BEAMS3D/Sources/beams3d_write.f90 b/BEAMS3D/Sources/beams3d_write.f90 index 8bb583a59..40441e4e4 100644 --- a/BEAMS3D/Sources/beams3d_write.f90 +++ b/BEAMS3D/Sources/beams3d_write.f90 @@ -18,7 +18,7 @@ SUBROUTINE beams3d_write(write_type) zaxis, phiaxis, S_ARR, U_ARR, POT_ARR, & ZEFF_ARR, TE, TI, NE USE beams3d_runtime, ONLY: id_string, npoinc, nbeams, beam, t_end, lverb, lflux, & - lvmec, lpies, lspec, lcoil, lmgrid, lbeam, & + lvmec, lpies, lspec, lcoil, lmgrid, lbeam, lascot, & lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & HDF5_OPEN_ERR,HDF5_WRITE_ERR,& HDF5_CLOSE_ERR, BEAMS3D_VERSION, weight, e_beams, p_beams,& @@ -73,6 +73,8 @@ SUBROUTINE beams3d_write(write_type) IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'ldepo',ier) CALL write_scalar_hdf5(fid,'lcollision',ier,BOOVAR=lcollision,ATT='Collisionall Operators Flag',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'lcollision',ier) + CALL write_scalar_hdf5(fid,'lascot',ier,BOOVAR=lascot,ATT='ASCOT5 Output Flag',ATT_NAME='description') + IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'lascot',ier) CALL write_scalar_hdf5(fid,'nr',ier,INTVAR=nr,ATT='Number of Radial Gridpoints',ATT_NAME='description') IF (ier /= 0) CALL handle_err(HDF5_WRITE_ERR,'nr',ier) CALL write_scalar_hdf5(fid,'nphi',ier,INTVAR=nphi,ATT='Number of Toroidal Gridpoints',ATT_NAME='description') From af1d093c93a0c5a8d2d5429eab3de489d65c59f1 Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 27 Aug 2019 10:31:04 +0200 Subject: [PATCH 17/57] Updates to defaults and checking for errors --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index e85a80026..2b9012fbc 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -25,7 +25,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & HDF5_OPEN_ERR,HDF5_WRITE_ERR,& HDF5_CLOSE_ERR, BEAMS3D_VERSION, weight, e_beams, p_beams,& - charge, Zatom, mass, ldepo, v_neut,lcollision, pi, pi2 + charge, Zatom, mass, ldepo, v_neut,lcollision, pi, pi2, t_end_in USE safe_open_mod, ONLY: safe_open USE wall_mod, ONLY: nface,nvertex,face,vertex,ihit_array, wall_free USE beams3d_write_par @@ -91,7 +91,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'ENDCOND_ENERGYLIM',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_WALLHIT',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(MAXVAL(t_end_in))) CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(1800)) CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(2.0)) CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) @@ -117,9 +117,9 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'DIST_MAX_TIME',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'DIST_MIN_CHARGE',ier,DBLVAR=DBLE(-2)) CALL write_var_hdf5(qid_gid,'DIST_MAX_CHARGE',ier,DBLVAR=DBLE(2)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_R',ier,DBLVAR=DBLE(nr)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_Z',ier,DBLVAR=DBLE(nz)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_PHI',ier,DBLVAR=DBLE(nphi)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_R',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_Z',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_PHI',ier,DBLVAR=DBLE(16)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_RHO',ier,DBLVAR=DBLE(16)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_THETA',ier,DBLVAR=DBLE(16)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_TIME',ier,DBLVAR=DBLE(npoinc)) @@ -380,6 +380,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) rtemp(i,13,1) = i END DO WHERE(rtemp(:,4,1)==0) rtemp(:,5,1)=0.0 ! avoid NAN pitch angle + WHERE(rtemp(:,1,1) Date: Tue, 27 Aug 2019 15:11:10 +0200 Subject: [PATCH 18/57] Switch energy from J to eV --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 2b9012fbc..15a6827be 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -48,6 +48,9 @@ SUBROUTINE beams3d_write_ascoth5(write_type) DOUBLE PRECISION, ALLOCATABLE :: rtemp(:,:,:), r1dtemp(:) CHARACTER(LEN=10) :: qid_str CHARACTER(LEN=8) :: temp_str8 + + + DOUBLE PRECISION, PARAMETER :: e_charge = 1.60217662E-19 !e_c !----------------------------------------------------------------------- ! Begin Subroutine !----------------------------------------------------------------------- @@ -366,9 +369,10 @@ SUBROUTINE beams3d_write_ascoth5(write_type) rtemp(i,1,1) = R_lines(d3,i) rtemp(i,2,1) = PHI_lines(d3,i) rtemp(i,3,1) = Z_lines(d3,i) - rtemp(i,4,1) = 0.5*mass(i)*vll_lines(d3,i)*vll_lines(d3,i) - rtemp(i,5,1) = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! v_perp^2 - rtemp(i,5,1) = vll_lines(d3,i)/SQRT(rtemp(i,5,1)+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch + dbl_temp = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! V_perp^2 + rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp)*e_charge + !rtemp(i,5,1) = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! v_perp^2 + rtemp(i,5,1) = vll_lines(d3,i)/SQRT(dbl_temp+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch !rtemp(i,5,1) = rtemp(i,5,1)/(rtemp(i,5,1)+vll_lines(d3,i)) ! pitch rtemp(i,6,1) = dbl_temp*pi2 ! zeta rtemp(i,7,1) = mass(i) ! mass From cae13fe643646e710de60292949a6802d2105d73 Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 27 Aug 2019 15:35:12 +0200 Subject: [PATCH 19/57] Back to J --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 15a6827be..0000b9965 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -370,10 +370,8 @@ SUBROUTINE beams3d_write_ascoth5(write_type) rtemp(i,2,1) = PHI_lines(d3,i) rtemp(i,3,1) = Z_lines(d3,i) dbl_temp = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! V_perp^2 - rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp)*e_charge - !rtemp(i,5,1) = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! v_perp^2 + rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp) rtemp(i,5,1) = vll_lines(d3,i)/SQRT(dbl_temp+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch - !rtemp(i,5,1) = rtemp(i,5,1)/(rtemp(i,5,1)+vll_lines(d3,i)) ! pitch rtemp(i,6,1) = dbl_temp*pi2 ! zeta rtemp(i,7,1) = mass(i) ! mass rtemp(i,8,1) = Zatom(i) From 57c04a9d6af658514a9b84ae101fa381bd9ecb9e Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 27 Aug 2019 16:08:31 +0200 Subject: [PATCH 20/57] Finally got the units squared away, ASCOT runs --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 0000b9965..693725035 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -76,11 +76,11 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'ENABLE_ADAPTIVE',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'RECORD_MODE',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USE_USERDEFINED',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(1.0E-8)) + CALL write_var_hdf5(qid_gid,'FIXEDSTEP_USERDEFINED',ier,DBLVAR=DBLE(5.0E-8)) CALL write_var_hdf5(qid_gid,'FIXEDSTEP_GYRODEFINED',ier,DBLVAR=DBLE(20)) CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_ORBIT',ier,DBLVAR=DBLE(1.0E-8)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0.1)) - CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(0.1)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_TOL_CCOL',ier,DBLVAR=DBLE(0.01)) + CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(1.0)) CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(2)) CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(1)) @@ -96,7 +96,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'ENDCOND_MAXORBS',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_SIMTIME',ier,DBLVAR=DBLE(MAXVAL(t_end_in))) CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_CPUTIME',ier,DBLVAR=DBLE(1800)) - CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(2.0)) + CALL write_var_hdf5(qid_gid,'ENDCOND_MAX_RHO',ier,DBLVAR=DBLE(0.99)) CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_RHO',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_ENERGY',ier,DBLVAR=DBLE(1000)) CALL write_var_hdf5(qid_gid,'ENDCOND_MIN_THERMAL',ier,DBLVAR=DBLE(1.5)) @@ -370,10 +370,10 @@ SUBROUTINE beams3d_write_ascoth5(write_type) rtemp(i,2,1) = PHI_lines(d3,i) rtemp(i,3,1) = Z_lines(d3,i) dbl_temp = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! V_perp^2 - rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp) + rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp)*e_charge rtemp(i,5,1) = vll_lines(d3,i)/SQRT(dbl_temp+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch rtemp(i,6,1) = dbl_temp*pi2 ! zeta - rtemp(i,7,1) = mass(i) ! mass + rtemp(i,7,1) = NINT(mass(i)*5.97863320194E26) ! mass rtemp(i,8,1) = Zatom(i) rtemp(i,9,1) = NINT(mass(i)*5.97863320194E26) ! Anum rtemp(i,10,1) = Zatom(i) From 909215b37c9d386571ba62f2c4ed10b24e4a3e6e Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 28 Aug 2019 09:41:51 +0200 Subject: [PATCH 21/57] Fixed bug in code related to an attempt to use a extcur instead of extcur_in --- BEAMS3D/Sources/beams3d_init_coil.f90 | 30 +++++++------------- FIELDLINES/Sources/fieldlines_init_coil.f90 | 31 ++++++++------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_init_coil.f90 b/BEAMS3D/Sources/beams3d_init_coil.f90 index ff9f3b939..5b84146b1 100644 --- a/BEAMS3D/Sources/beams3d_init_coil.f90 +++ b/BEAMS3D/Sources/beams3d_init_coil.f90 @@ -49,26 +49,17 @@ SUBROUTINE beams3d_init_coil mylocalmaster = master ! Read the input file for the EXTCUR array, NV, and NFP - IF (.not. ALLOCATED(extcur) .and. lcoil) THEN - IF (mylocalid == mylocalmaster) THEN - iunit = 11 - OPEN(UNIT=iunit, FILE='input.' // TRIM(id_string), STATUS='OLD', IOSTAT=ier) - IF (ier /= 0) CALL handle_err(FILE_OPEN_ERR,id_string,ier) - CALL read_indata_namelist(iunit,ier) - IF (ier /= 0) CALL handle_err(VMEC_INPUT_ERR,id_string,ier) - CLOSE(iunit) - END IF + IF (mylocalid == mylocalmaster) THEN + iunit = 11 + OPEN(UNIT=iunit, FILE='input.' // TRIM(id_string), STATUS='OLD', IOSTAT=ier) + IF (ier /= 0) CALL handle_err(FILE_OPEN_ERR,id_string,ier) + CALL read_indata_namelist(iunit,ier) + IF (ier /= 0) CALL handle_err(VMEC_INPUT_ERR,id_string,ier) + CLOSE(iunit) + END IF !DEC$ IF DEFINED (MPI_OPT) - CALL MPI_BCAST(extcur_in,nigroup,MPI_REAL, mylocalmaster, MPI_COMM_LOCAL,ierr_mpi) + CALL MPI_BCAST(extcur_in,nigroup,MPI_REAL, mylocalmaster, MPI_COMM_LOCAL,ierr_mpi) !DEC$ ENDIF - DO i = 1, SIZE(extcur_in,DIM=1) - IF (ABS(extcur_in(i)) > 0) nextcur = i - END DO - ALLOCATE(extcur(nextcur+1),STAT=ier) - IF (ier /= 0) CALL handle_err(ALLOC_ERR,'EXTCUR',ier) - extcur = 0.0 - extcur(1:nextcur) = extcur_in(1:nextcur) - END IF ! Read the coils file CALL parse_coils_file(TRIM(coil_string)) @@ -157,7 +148,7 @@ SUBROUTINE beams3d_init_coil bphi_temp = 0 bz_temp = 0 DO ig = 1, nextcur - IF (extcur(ig) == 0) CYCLE + IF (extcur_in(ig) == 0) CYCLE CALL bfield(raxis(i), phiaxis(j), zaxis(k), br, bphi, bz, IG = ig) br_temp = br_temp + br bphi_temp = bphi_temp + bphi @@ -184,7 +175,6 @@ SUBROUTINE beams3d_init_coil ! Free Variables CALL cleanup_biotsavart - IF (ALLOCATED(extcur)) DEALLOCATE(extcur) !DEC$ IF DEFINED (MPI_OPT) CALL MPI_BARRIER(MPI_COMM_LOCAL,ierr_mpi) diff --git a/FIELDLINES/Sources/fieldlines_init_coil.f90 b/FIELDLINES/Sources/fieldlines_init_coil.f90 index b9cc8ee94..0f5996feb 100644 --- a/FIELDLINES/Sources/fieldlines_init_coil.f90 +++ b/FIELDLINES/Sources/fieldlines_init_coil.f90 @@ -48,27 +48,18 @@ SUBROUTINE fieldlines_init_coil mylocalmaster = master ! Read the input file for the EXTCUR array, NV, and NFP - IF (.not. ALLOCATED(extcur) .and. lcoil) THEN - IF (mylocalid == mylocalmaster) THEN - iunit = 11 - OPEN(UNIT=iunit, FILE='input.' // TRIM(id_string), STATUS='OLD', IOSTAT=ier) - IF (ier /= 0) CALL handle_err(FILE_OPEN_ERR,id_string,ier) - CALL read_indata_namelist(iunit,ier) - IF (ier /= 0) CALL handle_err(VMEC_INPUT_ERR,id_string,ier) - CLOSE(iunit) - END IF + IF (mylocalid == mylocalmaster) THEN + iunit = 11 + OPEN(UNIT=iunit, FILE='input.' // TRIM(id_string), STATUS='OLD', IOSTAT=ier) + IF (ier /= 0) CALL handle_err(FILE_OPEN_ERR,id_string,ier) + CALL read_indata_namelist(iunit,ier) + IF (ier /= 0) CALL handle_err(VMEC_INPUT_ERR,id_string,ier) + CLOSE(iunit) + END IF !DEC$ IF DEFINED (MPI_OPT) - CALL MPI_BCAST(extcur_in,nigroup,MPI_REAL, mylocalmaster, MPI_COMM_LOCAL,ierr_mpi) - IF (ierr_mpi /=0) CALL handle_err(MPI_BCAST_ERR,'fieldlines_init_coil',ierr_mpi) + CALL MPI_BCAST(extcur_in,nigroup,MPI_REAL, mylocalmaster, MPI_COMM_LOCAL,ierr_mpi) + IF (ierr_mpi /=0) CALL handle_err(MPI_BCAST_ERR,'fieldlines_init_coil',ierr_mpi) !DEC$ ENDIF - DO i = 1, nigroup - IF (ABS(extcur_in(i)) > 0) nextcur = i - END DO - ALLOCATE(extcur(nextcur+1),STAT=ier) - IF (ier /= 0) CALL handle_err(ALLOC_ERR,'EXTCUR',ier) - extcur = 0.0 - extcur(1:nextcur) = extcur_in(1:nextcur) - END IF ! Read the coils file CALL parse_coils_file(TRIM(coil_string)) @@ -150,6 +141,7 @@ SUBROUTINE fieldlines_init_coil bphi_temp = 0.0; bz_temp = 0.0; DO ig = 1, nextcur + IF (extcur_in(ig) == 0) CYCLE CALL afield(raxis(i), phiaxis(j), zaxis(k), br, bphi, bz, IG = ig) br_temp = br_temp + br bphi_temp = bphi_temp + bphi @@ -204,7 +196,6 @@ SUBROUTINE fieldlines_init_coil ! Free Variables CALL cleanup_biotsavart - IF (ALLOCATED(extcur)) DEALLOCATE(extcur) !DEC$ IF DEFINED (MPI_OPT) CALL MPI_BARRIER(MPI_COMM_LOCAL,ierr_mpi) From 10c54d3f25478345fa11b82e0ac4e7c0488035b9 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 28 Aug 2019 09:44:48 +0200 Subject: [PATCH 22/57] Fix so we can run a deposition run with full field --- BEAMS3D/Sources/beams3d_init.f90 | 3 ++- BEAMS3D/Sources/beams3d_init_vmec.f90 | 4 ++-- BEAMS3D/Sources/beams3d_main.f90 | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index b9154ab8e..b577925d0 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -89,6 +89,7 @@ SUBROUTINE beams3d_init IF (ldepo) WRITE(6,'(A)') ' DEPOSITION ONLY!' IF (lw7x) WRITE(6,'(A)') ' W7-X BEAM Model!' IF (lascot) WRITE(6,'(A)') ' ASCOT5 OUTPUT ON!' + IF (lplasma_only) WRITE(6,'(A)') ' MAGNETIC FIELD FROM PLASMA ONLY!' CALL FLUSH(6) END IF @@ -195,7 +196,7 @@ SUBROUTINE beams3d_init END IF ! Setup vessel - IF (lvessel .and. (.not. lplasma_only .or. ldepo)) THEN + IF (lvessel .and. (.not. lplasma_only)) THEN CALL wall_load_txt(TRIM(vessel_string),ier,MPI_COMM_BEAMS) IF (lverb) CALL wall_info(6) CALL FLUSH(6) diff --git a/BEAMS3D/Sources/beams3d_init_vmec.f90 b/BEAMS3D/Sources/beams3d_init_vmec.f90 index 68b70fd58..29eee6d36 100644 --- a/BEAMS3D/Sources/beams3d_init_vmec.f90 +++ b/BEAMS3D/Sources/beams3d_init_vmec.f90 @@ -161,8 +161,8 @@ SUBROUTINE beams3d_init_vmec END IF - ! If only plasma response then put a wall at the plasma boundary Unless doing depo calc - IF (lplasma_only .and. .not.ldepo) THEN + ! If we ask for a plasma-only run and don't provide a vessel then make one. + IF (lplasma_only .and. .not.lvessel) THEN lvessel = .TRUE. ! Do this so the other parts of the code know there is a vessel k = ns CALL wall_load_mn(DBLE(rmnc(1:mnmax,k)),DBLE(zmns(1:mnmax,k)),DBLE(xm),-DBLE(xn),mnmax,120,120,COMM=MPI_COMM_BEAMS) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index 437b21283..bd6f72a9b 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -138,7 +138,6 @@ PROGRAM BEAMS3D lhitonly = .true. case ("-depo") ldepo = .true. - lplasma_only = .true. case ("-raw") lraw = .true. case ("-w7x") From ec335ccedf5996c1892a11502ef9f4a05c3ea9d9 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 28 Aug 2019 11:27:54 +0200 Subject: [PATCH 23/57] Now using beam Z and Zeff in deposition calc --- BEAMS3D/Sources/beams3d_main.f90 | 2 ++ BEAMS3D/Sources/beams3d_physics_mod.f90 | 17 +++++++++++------ BEAMS3D/Sources/beams3d_write.f90 | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index bd6f72a9b..3f58a81ee 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -256,6 +256,8 @@ PROGRAM BEAMS3D CALL beams3d_free CALL wall_free(ier,MPI_COMM_BEAMS) !DEC$ IF DEFINED (MPI_OPT) + CALL MPI_BARRIER(MPI_COMM_BEAMS, ierr_mpi) + IF (ierr_mpi /= 0) CALL handle_err(MPI_BARRIER_ERR, 'beams3d_main', ierr_mpi) ierr_mpi=0 CALL MPI_FINALIZE(ierr_mpi) IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_FINE_ERR, 'beams3d_main', ierr_mpi) diff --git a/BEAMS3D/Sources/beams3d_physics_mod.f90 b/BEAMS3D/Sources/beams3d_physics_mod.f90 index 968b05522..fe0e3e381 100644 --- a/BEAMS3D/Sources/beams3d_physics_mod.f90 +++ b/BEAMS3D/Sources/beams3d_physics_mod.f90 @@ -443,7 +443,7 @@ SUBROUTINE beams3d_follow_neut(t, q) tilocal = tilocal*1D-3 telocal = telocal*1D-3 zeff_temp = SUM(zefflocal)/DBLE(num_depo) - zeff_temp = 1 +! zeff_temp = 1 !DEC$ IF DEFINED (NTCC) !-------------------------------------------------------------- @@ -455,18 +455,23 @@ SUBROUTINE beams3d_follow_neut(t, q) ! eabeam beam energy in keV/nucleon ! tatarg target energy in keV/nucleon ! n array size - ! izbeam Beam Z - ! iztarg Target Z + ! izbeam Beam Z (always int) + ! iztarg Target Z (can be real) ! btsigv cross section - CALL adas_btsigv(2,1,energy,tilocal,num_depo,1,1,sigvii,ier) ! Ion Impact ionization cross-section term. - CALL adas_btsigv(1,1,energy,tilocal,num_depo,1,1,sigvcx,ier) ! Charge Exchange ionization cross-section term. + CALL adas_btsigv(2,1,energy,tilocal,num_depo,myZ,zeff_temp,sigvii,ier) ! Ion Impact ionization cross-section term. + CALL adas_btsigv(1,1,energy,tilocal,num_depo,myZ,zeff_temp,sigvcx,ier) ! Charge Exchange ionization cross-section term. ! Arguments to sigvte(zneut,tevec,n1,sigv_adas,istat) ! zneut charge (=1) ! tevec electron temperature [keV] ! n1 array size ! This formula comes from the ADAS description of how to use the functions. (M. Gorelenkova) telocal = telocal + to3*0.000544602984424355*energy - CALL adas_sigvte_ioniz(1,telocal,num_depo,sigvei,ier) ! Electron Impact ionization cross-section term. + CALL adas_sigvte_ioniz(myZ,telocal,num_depo,sigvei,ier) ! Electron Impact ionization cross-section term. + ! Do this because Ztarg changes for each point. + !DO l = 1, num_depo + ! CALL adas_btsigv(2,1,energy,tilocal(l),1,myZ,zefflocal(l),sigvii(l),ier) ! Ion Impact ionization cross-section term. + ! CALL adas_btsigv(1,1,energy,tilocal(l),1,myZ,zefflocal(l),sigvcx(l),ier) ! Charge Exchange ionization cross-section term. + !END DO !DEC$ ELSE IF (myworkid == master) THEN WRITE(6,*) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' diff --git a/BEAMS3D/Sources/beams3d_write.f90 b/BEAMS3D/Sources/beams3d_write.f90 index 40441e4e4..1e14995b0 100644 --- a/BEAMS3D/Sources/beams3d_write.f90 +++ b/BEAMS3D/Sources/beams3d_write.f90 @@ -24,7 +24,7 @@ SUBROUTINE beams3d_write(write_type) HDF5_CLOSE_ERR, BEAMS3D_VERSION, weight, e_beams, p_beams,& charge, Zatom, mass, ldepo, v_neut,lcollision USE safe_open_mod, ONLY: safe_open - USE wall_mod, ONLY: nface,nvertex,face,vertex,ihit_array, wall_free + USE wall_mod, ONLY: nface,nvertex,face,vertex,ihit_array USE mpi_params !----------------------------------------------------------------------- ! Input Variables From 12a71054855fb95e19196a7c3f9c6a79467d9477 Mon Sep 17 00:00:00 2001 From: lazersos Date: Wed, 28 Aug 2019 13:26:00 +0200 Subject: [PATCH 24/57] Couple of updates so BEAMS3D interace to STELLOPT remains correct --- BEAMS3D/Sources/beams3d_init.f90 | 2 +- STELLOPTV2/Sources/General/stellopt_orbits.f90 | 14 ++++++++++---- STELLOPTV2/Sources/General/stellopt_paraexe.f90 | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index b577925d0..80ea16322 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -56,7 +56,7 @@ SUBROUTINE beams3d_init IF (lverb) WRITE(6,'(A)') '----- Input Parameters -----' !DEC$ IF DEFINED (MPI_OPT) CALL MPI_BARRIER(MPI_COMM_BEAMS,ierr_mpi) - IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BARRIER_ERR,'beams3d_init',ierr_mpi) + IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_BARRIER_ERR,'beams3d_init0',ierr_mpi) !DEC$ ENDIF IF (lvmec .and. lread_input) THEN diff --git a/STELLOPTV2/Sources/General/stellopt_orbits.f90 b/STELLOPTV2/Sources/General/stellopt_orbits.f90 index 017076e42..47138f941 100644 --- a/STELLOPTV2/Sources/General/stellopt_orbits.f90 +++ b/STELLOPTV2/Sources/General/stellopt_orbits.f90 @@ -11,12 +11,13 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) !----------------------------------------------------------------------- USE stellopt_runtime, ONLY: proc_string, bigno, rprec, pi2 USE equil_utils, ONLY: get_equil_RZ, get_equil_Bflx,& - get_equil_ne, get_equil_te, get_equil_ti + get_equil_ne, get_equil_te, get_equil_ti, & + get_equil_zeff USE equil_vals, ONLY: nfp, rho, orbit_lost_frac USE stellopt_targets, ONLY: sigma_orbit, vll_orbit, mu_orbit,& nu_orbit, nv_orbit, nsd, np_orbit, mass_orbit, Z_orbit,& vperp_orbit, nsd - USE stellopt_vars, ONLY: ne_type, te_type, ti_type, ne_norm + USE stellopt_vars, ONLY: ne_type, te_type, ti_type, ne_norm, zeff_type USE read_wout_mod, ONLY: rmax_surf, rmin_surf, zmax_surf !DEC$ IF DEFINED (BEAMS3D_OPT) ! BEAMS3D Libraries @@ -26,8 +27,9 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) TE_AUX_S_BEAMS => TE_AUX_S, TE_AUX_F_BEAMS => TE_AUX_F, & NE_AUX_S_BEAMS => NE_AUX_S, NE_AUX_F_BEAMS => NE_AUX_F, & TI_AUX_S_BEAMS => TI_AUX_S, TI_AUX_F_BEAMS => TI_AUX_F, & + ZEFF_AUX_S_BEAMS => ZEFF_AUX_S, ZEFF_AUX_F_BEAMS => ZEFF_AUX_F, & BEAMS3D_VERSION - USE beams3d_grid, ONLY: nte, nne, nti, rmin, rmax, zmin, zmax, & + USE beams3d_grid, ONLY: nte, nne, nti, nzeff, rmin, rmax, zmin, zmax, & phimin, phimax USE beams3d_lines, ONLY: lost_lines !DEC$ ENDIF @@ -119,18 +121,21 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) END IF ! Initialize temperature profiles - nne = NBEAM_PROF; nte = NBEAM_PROF; nti = NBEAM_PROF + nne = NBEAM_PROF; nte = NBEAM_PROF; nti = NBEAM_PROF; nzeff = NBEAM_PROF DO ik = 1, NBEAM_PROF s_val = DBLE(ik-1)/DBLE(NBEAM_PROF-1) NE_AUX_S_BEAMS(ik) = s_val TE_AUX_S_BEAMS(ik) = s_val TI_AUX_S_BEAMS(ik) = s_val + ZEFF_AUX_S_BEAMS(ik) = s_val CALL get_equil_ne(s_val,TRIM(ne_type),v_val,iflag) NE_AUX_F_BEAMS(ik) = v_val CALL get_equil_te(s_val,TRIM(te_type),v_val,iflag) TE_AUX_F_BEAMS(ik) = v_val CALL get_equil_ti(s_val,TRIM(ti_type),v_val,iflag) TI_AUX_F_BEAMS(ik) = v_val + CALL get_equil_zeff(s_val,TRIM(zeff_type),v_val,iflag) + ZEFF_AUX_F_BEAMS(ik) = v_val END DO IF (lscreen) THEN @@ -138,6 +143,7 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) WRITE(6,'(A,F7.2,A,F7.2,A,I4)') ' Ne = [',MINVAL(NE_AUX_F_BEAMS)/1E19,',',MAXVAL(NE_AUX_F_BEAMS)/1E19,'] 10^19 [m^-3]; Nne: ',nne WRITE(6,'(A,F7.2,A,F7.2,A,I4)') ' Te = [',MINVAL(TE_AUX_F_BEAMS)/1000,',',MAXVAL(TE_AUX_F_BEAMS)/1000,'] [keV]; Nte: ',nte WRITE(6,'(A,F7.2,A,F7.2,A,I4)') ' Ti = [',MINVAL(TI_AUX_F_BEAMS)/1000,',',MAXVAL(TI_AUX_F_BEAMS)/1000,'] [keV]; Nti: ',nti + WRITE(6,'(A,F7.2,A,F7.2,A,I4)') ' Zeff = [',MINVAL(ZEFF_AUX_F_BEAMS),',',MAXVAL(ZEFF_AUX_F_BEAMS),'] [keV]; Nti: ',nzeff CALL FLUSH(6) END IF diff --git a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 index 788ad07f0..f6fe16c8c 100644 --- a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 +++ b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 @@ -285,7 +285,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) IF (ierr_mpi /= MPI_SUCCESS) CALL handle_err(MPI_ERR,'stellopt_paraexe',ierr_mpi) ! Set vars so BEAMS3D knows it's being called from stellopt - CALL MPI_COMM_DUP(MPI_COMM_BEAMS, MPI_COMM_MYWORLD, ierr_mpi) + CALL MPI_COMM_DUP(MPI_COMM_MYWORLD, MPI_COMM_BEAMS, ierr_mpi) CALL MPI_COMM_SPLIT_TYPE(MPI_COMM_BEAMS, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, MPI_COMM_SHARMEM, ierr_mpi) CALL MPI_COMM_RANK(MPI_COMM_SHARMEM, myid_sharmem, ierr_mpi) CALL BCAST_BEAMS3D_INPUT(master,MPI_COMM_MYWORLD,ierr_mpi) From ff632f40820cbf022370e39fe3b4b4a7e8b6a9e8 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 14:46:28 +0200 Subject: [PATCH 25/57] Fixed bugs related to STELLOPT/BEAMS3D coupling --- BEAMS3D/Sources/beams3d_free.f90 | 87 +++++++++++++------ BEAMS3D/Sources/beams3d_main.f90 | 2 +- BEAMS3D/Sources/beams3d_read.f90 | 44 +++++----- .../STELLOPT_TEST/BEAMS3D/input.BEAMS3D | 18 ++-- .../Sources/General/stellopt_orbits.f90 | 8 +- .../Sources/General/stellopt_paraexe.f90 | 10 ++- 6 files changed, 105 insertions(+), 64 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_free.f90 b/BEAMS3D/Sources/beams3d_free.f90 index 7d4a71c71..1cb855492 100644 --- a/BEAMS3D/Sources/beams3d_free.f90 +++ b/BEAMS3D/Sources/beams3d_free.f90 @@ -4,7 +4,7 @@ ! Date: 12/15/2014 ! Description: Deallocate and free all arrays. !----------------------------------------------------------------------- - SUBROUTINE beams3d_free + SUBROUTINE beams3d_free(IN_COMM) !----------------------------------------------------------------------- ! Libraries !----------------------------------------------------------------------- @@ -25,6 +25,7 @@ SUBROUTINE beams3d_free !----------------------------------------------------------------------- IMPLICIT NONE INTEGER :: ier + INTEGER, INTENT(INOUT), OPTIONAL :: IN_COMM !----------------------------------------------------------------------- ! External Functions ! A00ADF NAG Detection @@ -63,33 +64,63 @@ SUBROUTINE beams3d_free IF (ALLOCATED(B_lines)) DEALLOCATE(B_lines) IF (ALLOCATED(weight)) DEALLOCATE(weight) IF (ALLOCATED(beam)) DEALLOCATE(beam) - IF (ASSOCIATED(req_axis)) CALL mpidealloc(req_axis,win_req_axis) - IF (ASSOCIATED(zeq_axis)) CALL mpidealloc(zeq_axis,win_zeq_axis) - IF (ASSOCIATED(raxis)) CALL mpidealloc(raxis,win_raxis) - IF (ASSOCIATED(phiaxis)) CALL mpidealloc(phiaxis,win_phiaxis) - IF (ASSOCIATED(zaxis)) CALL mpidealloc(zaxis,win_zaxis) - IF (ASSOCIATED(B_R)) CALL mpidealloc(B_R,win_B_R) - IF (ASSOCIATED(B_PHI)) CALL mpidealloc(B_PHI,win_B_PHI) - IF (ASSOCIATED(B_Z)) CALL mpidealloc(B_Z,win_B_Z) - IF (ASSOCIATED(MODB)) CALL mpidealloc(MODB,win_MODB) - IF (ASSOCIATED(S_ARR)) CALL mpidealloc(S_ARR,win_S_ARR) - IF (ASSOCIATED(U_ARR)) CALL mpidealloc(U_ARR,win_U_ARR) - IF (ASSOCIATED(TE)) CALL mpidealloc(TE,win_TE) - IF (ASSOCIATED(TI)) CALL mpidealloc(TI,win_TI) - IF (ASSOCIATED(NE)) CALL mpidealloc(NE,win_NE) - IF (ASSOCIATED(ZEFF_ARR)) CALL mpidealloc(ZEFF_ARR,win_ZEFF_ARR) - IF (ASSOCIATED(POT_ARR)) CALL mpidealloc(POT_ARR,win_POT_ARR) - IF (ASSOCIATED(BR4D)) CALL mpidealloc(BR4D,win_BR4D) - IF (ASSOCIATED(BPHI4D)) CALL mpidealloc(BPHI4D,win_BPHI4D) - IF (ASSOCIATED(BZ4D)) CALL mpidealloc(BZ4D,win_BZ4D) - IF (ASSOCIATED(MODB4D)) CALL mpidealloc(MODB4D,win_MODB4D) - IF (ASSOCIATED(TE4D)) CALL mpidealloc(TE4D,win_TE4D) - IF (ASSOCIATED(NE4D)) CALL mpidealloc(NE4D,win_NE4D) - IF (ASSOCIATED(TI4D)) CALL mpidealloc(TI4D,win_TI4D) - IF (ASSOCIATED(ZEFF4D)) CALL mpidealloc(ZEFF4D,win_ZEFF4D) - IF (ASSOCIATED(S4D)) CALL mpidealloc(S4D,win_S4D) - IF (ASSOCIATED(U4D)) CALL mpidealloc(U4D,win_U4D) - IF (ASSOCIATED(POT4D)) CALL mpidealloc(POT4D,win_POT4D) + IF (PRESENT(IN_COMM)) THEN + IF (ASSOCIATED(req_axis)) CALL mpidealloc(req_axis,win_req_axis) + IF (ASSOCIATED(zeq_axis)) CALL mpidealloc(zeq_axis,win_zeq_axis) + IF (ASSOCIATED(raxis)) CALL mpidealloc(raxis,win_raxis) + IF (ASSOCIATED(phiaxis)) CALL mpidealloc(phiaxis,win_phiaxis) + IF (ASSOCIATED(zaxis)) CALL mpidealloc(zaxis,win_zaxis) + IF (ASSOCIATED(B_R)) CALL mpidealloc(B_R,win_B_R) + IF (ASSOCIATED(B_PHI)) CALL mpidealloc(B_PHI,win_B_PHI) + IF (ASSOCIATED(B_Z)) CALL mpidealloc(B_Z,win_B_Z) + IF (ASSOCIATED(MODB)) CALL mpidealloc(MODB,win_MODB) + IF (ASSOCIATED(S_ARR)) CALL mpidealloc(S_ARR,win_S_ARR) + IF (ASSOCIATED(U_ARR)) CALL mpidealloc(U_ARR,win_U_ARR) + IF (ASSOCIATED(TE)) CALL mpidealloc(TE,win_TE) + IF (ASSOCIATED(TI)) CALL mpidealloc(TI,win_TI) + IF (ASSOCIATED(NE)) CALL mpidealloc(NE,win_NE) + IF (ASSOCIATED(ZEFF_ARR)) CALL mpidealloc(ZEFF_ARR,win_ZEFF_ARR) + IF (ASSOCIATED(POT_ARR)) CALL mpidealloc(POT_ARR,win_POT_ARR) + IF (ASSOCIATED(BR4D)) CALL mpidealloc(BR4D,win_BR4D) + IF (ASSOCIATED(BPHI4D)) CALL mpidealloc(BPHI4D,win_BPHI4D) + IF (ASSOCIATED(BZ4D)) CALL mpidealloc(BZ4D,win_BZ4D) + IF (ASSOCIATED(MODB4D)) CALL mpidealloc(MODB4D,win_MODB4D) + IF (ASSOCIATED(TE4D)) CALL mpidealloc(TE4D,win_TE4D) + IF (ASSOCIATED(NE4D)) CALL mpidealloc(NE4D,win_NE4D) + IF (ASSOCIATED(TI4D)) CALL mpidealloc(TI4D,win_TI4D) + IF (ASSOCIATED(ZEFF4D)) CALL mpidealloc(ZEFF4D,win_ZEFF4D) + IF (ASSOCIATED(S4D)) CALL mpidealloc(S4D,win_S4D) + IF (ASSOCIATED(U4D)) CALL mpidealloc(U4D,win_U4D) + IF (ASSOCIATED(POT4D)) CALL mpidealloc(POT4D,win_POT4D) + ELSE + IF (ASSOCIATED(req_axis)) DEALLOCATE(req_axis) + IF (ASSOCIATED(zeq_axis)) DEALLOCATE(zeq_axis) + IF (ASSOCIATED(raxis)) DEALLOCATE(raxis) + IF (ASSOCIATED(phiaxis)) DEALLOCATE(phiaxis) + IF (ASSOCIATED(zaxis)) DEALLOCATE(zaxis) + IF (ASSOCIATED(B_R)) DEALLOCATE(B_R) + IF (ASSOCIATED(B_PHI)) DEALLOCATE(B_PHI) + IF (ASSOCIATED(B_Z)) DEALLOCATE(B_Z) + IF (ASSOCIATED(MODB)) DEALLOCATE(MODB) + IF (ASSOCIATED(S_ARR)) DEALLOCATE(S_ARR) + IF (ASSOCIATED(U_ARR)) DEALLOCATE(U_ARR) + IF (ASSOCIATED(TE)) DEALLOCATE(TE) + IF (ASSOCIATED(TI)) DEALLOCATE(TI) + IF (ASSOCIATED(NE)) DEALLOCATE(NE) + IF (ASSOCIATED(ZEFF_ARR)) DEALLOCATE(ZEFF_ARR) + IF (ASSOCIATED(POT_ARR)) DEALLOCATE(POT_ARR) + IF (ASSOCIATED(BR4D)) DEALLOCATE(BR4D) + IF (ASSOCIATED(BPHI4D)) DEALLOCATE(BPHI4D) + IF (ASSOCIATED(BZ4D)) DEALLOCATE(BZ4D) + IF (ASSOCIATED(MODB4D)) DEALLOCATE(MODB4D) + IF (ASSOCIATED(TE4D)) DEALLOCATE(TE4D) + IF (ASSOCIATED(NE4D)) DEALLOCATE(NE4D) + IF (ASSOCIATED(TI4D)) DEALLOCATE(TI4D) + IF (ASSOCIATED(ZEFF4D)) DEALLOCATE(ZEFF4D) + IF (ASSOCIATED(S4D)) DEALLOCATE(S4D) + IF (ASSOCIATED(U4D)) DEALLOCATE(U4D) + IF (ASSOCIATED(POT4D)) DEALLOCATE(POT4D) + ENDIF IF (ALLOCATED(R_start)) DEALLOCATE(R_start) IF (ALLOCATED(phi_start)) DEALLOCATE(phi_start) IF (ALLOCATED(Z_start)) DEALLOCATE(Z_start) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index 3f58a81ee..fbdd3ccea 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -253,7 +253,7 @@ PROGRAM BEAMS3D CALL beams3d_diagnostics ! Clean up - CALL beams3d_free + CALL beams3d_free(MPI_COMM_SHARMEM) CALL wall_free(ier,MPI_COMM_BEAMS) !DEC$ IF DEFINED (MPI_OPT) CALL MPI_BARRIER(MPI_COMM_BEAMS, ierr_mpi) diff --git a/BEAMS3D/Sources/beams3d_read.f90 b/BEAMS3D/Sources/beams3d_read.f90 index 80c370088..3ef5f0657 100644 --- a/BEAMS3D/Sources/beams3d_read.f90 +++ b/BEAMS3D/Sources/beams3d_read.f90 @@ -161,25 +161,25 @@ SUBROUTINE beams3d_read IF (ier /= 0) CALL handle_err(HDF5_READ_ERR,'nphi',ier) CALL read_scalar_hdf5(fid,'nz',ier,INTVAR=nz) IF (ier /= 0) CALL handle_err(HDF5_READ_ERR,'nz',ier) - IF (ASSOCIATED(raxis)) CALL mpidealloc(raxis,win_raxis) - IF (ASSOCIATED(zaxis)) CALL mpidealloc(zaxis,win_zaxis) - IF (ASSOCIATED(phiaxis)) CALL mpidealloc(phiaxis,win_phiaxis) - IF (ASSOCIATED(B_R)) CALL mpidealloc(B_R,win_B_R) - IF (ASSOCIATED(B_Z)) CALL mpidealloc(B_Z,win_B_Z) - IF (ASSOCIATED(B_PHI)) CALL mpidealloc(B_PHI,win_B_PHI) - IF (ASSOCIATED(S_ARR)) CALL mpidealloc(S_ARR,win_S_ARR) - IF (ASSOCIATED(U_ARR)) CALL mpidealloc(U_ARR,win_U_ARR) - IF (ASSOCIATED(POT_ARR)) CALL mpidealloc(POT_ARR,win_POT_ARR) - CALL mpialloc(raxis, nr, myid_sharmem, 0, MPI_COMM_SHARMEM, win_raxis) - CALL mpialloc(phiaxis, nphi, myid_sharmem, 0, MPI_COMM_SHARMEM, win_phiaxis) - CALL mpialloc(zaxis, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_zaxis) - CALL mpialloc(B_R, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_B_R) - CALL mpialloc(B_PHI, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_B_PHI) - CALL mpialloc(B_Z, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_B_Z) - CALL mpialloc(MODB, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_MODB) - CALL mpialloc(POT_ARR, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_POT_ARR) - CALL mpialloc(S_ARR, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_S_ARR) - CALL mpialloc(U_ARR, nr, nphi, nz, myid_sharmem, 0, MPI_COMM_SHARMEM, win_U_ARR) + IF (ASSOCIATED(raxis)) DEALLOCATE(raxis) + IF (ASSOCIATED(zaxis)) DEALLOCATE(zaxis) + IF (ASSOCIATED(phiaxis)) DEALLOCATE(phiaxis) + IF (ASSOCIATED(B_R)) DEALLOCATE(B_R) + IF (ASSOCIATED(B_Z)) DEALLOCATE(B_Z) + IF (ASSOCIATED(B_PHI)) DEALLOCATE(B_PHI) + IF (ASSOCIATED(S_ARR)) DEALLOCATE(S_ARR) + IF (ASSOCIATED(U_ARR)) DEALLOCATE(U_ARR) + IF (ASSOCIATED(POT_ARR)) DEALLOCATE(POT_ARR) + ALLOCATE(raxis(nr)) + ALLOCATE(phiaxis(nphi)) + ALLOCATE(zaxis(nz)) + ALLOCATE(B_R(nr,nphi,nz)) + ALLOCATE(B_PHI(nr,nphi,nz)) + ALLOCATE(B_Z(nr,nphi,nz)) + ALLOCATE(MODB(nr,nphi,nz)) + ALLOCATE(POT_ARR(nr,nphi,nz)) + ALLOCATE(S_ARR(nr,nphi,nz)) + ALLOCATE(U_ARR(nr,nphi,nz)) CALL read_var_hdf5(fid,'raxis',nr,ier,DBLVAR=raxis) IF (ier /= 0) CALL handle_err(HDF5_READ_ERR,'raxis',ier) CALL read_var_hdf5(fid,'zaxis',nz,ier,DBLVAR=zaxis) @@ -212,7 +212,7 @@ SUBROUTINE beams3d_read CALL read_var_hdf5(fid,'wall_faces',nface,3,ier,INTVAR=face) IF (ier /= 0) CALL handle_err(HDF5_READ_ERR,'wall_faces',ier) CALL read_var_hdf5(fid,'wall_strikes',nface,ier,INTVAR=ihit_array) - IF (ier /= 0) DEALLOCATE(ihit_array) + !IF (ier /= 0) DEALLOCATE(ihit_array) END IF ier = 0 @@ -224,9 +224,7 @@ SUBROUTINE beams3d_read !DEC$ ELSE - WRITE(6,'(A)') ' FILE: '//'beams3d_'//TRIM(id_string)//'.bin' - CALL safe_open(iunit,ier,'beams3d_'//TRIM(id_string)//'.bin','replace','unformatted') - CLOSE(iunit) + !DEC$ ENDIF !----------------------------------------------------------------------- diff --git a/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D index 36a403fef..064bc5a48 100644 --- a/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D +++ b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D @@ -135,11 +135,13 @@ ! Particle Transport ! Mu = 0.5*m*v*v/B or (Thermal Energy)/B !------------------------------------------------------------------------ - NU_ORBIT = 20 - NV_ORBIT = 20 + NU_ORBIT = 10 + NV_ORBIT = 10 NP_ORBIT = 20 VLL_ORBIT = 20*7.76E5 ! 50 [keV] VLL_ORBIT = 20*5.00E5 + MASS_ORBIT = 1.6726219E-27 + Z_ORBIT = 1.0 ! 5-> 100[ev] num2str(((5:95/19:100).*1000)*1.60217733E-19./1.5,'%20.10E') MU_ORBIT = 5.3405911000E-16 1.0681182200E-15 1.6021773300E-15 2.1362364400E-15 2.6702955500E-15 3.2043546600E-15 3.7384137700E-15 4.2724728800E-15 4.8065319900E-15 5.3405911000E-15 @@ -148,21 +150,21 @@ TARGET_ORBIT(10) = 0.0 SIGMA_ORBIT(10) = 1.0 / &BEAMS3D_INPUT - NR = 201 - NZ = 201 - NPHI = 60 + NR = 128 + NZ = 128 + NPHI = 36 RMIN = 4.36000000000000E-01 RMAX = 2.43600000000000E+00 ZMIN = -1.00000000000000E+00 ZMAX = 1.00000000000000E+00 PHIMIN = 0.00000000000000E+00 PHIMAX = 2.09439510239000E+00 - NPOINC = 200 + NPOINC = 20 ! T_END_IN = 2*0.000001 ! T_END_IN = 2*0.00003 ! T_END_IN = 2*0.00006 -! T_END_IN = 2*0.0001 - T_END_IN = 2*0.003 + T_END_IN = 2*0.0001 +! T_END_IN = 2*0.003 INT_TYPE = 'LSODE' FOLLOW_TOL = 1.00000000000000E-09 VC_ADAPT_TOL = 1.00000000000000E-06 diff --git a/STELLOPTV2/Sources/General/stellopt_orbits.f90 b/STELLOPTV2/Sources/General/stellopt_orbits.f90 index 47138f941..322639a51 100644 --- a/STELLOPTV2/Sources/General/stellopt_orbits.f90 +++ b/STELLOPTV2/Sources/General/stellopt_orbits.f90 @@ -28,7 +28,7 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) NE_AUX_S_BEAMS => NE_AUX_S, NE_AUX_F_BEAMS => NE_AUX_F, & TI_AUX_S_BEAMS => TI_AUX_S, TI_AUX_F_BEAMS => TI_AUX_F, & ZEFF_AUX_S_BEAMS => ZEFF_AUX_S, ZEFF_AUX_F_BEAMS => ZEFF_AUX_F, & - BEAMS3D_VERSION + BEAMS3D_VERSION, mass_beams, charge_beams USE beams3d_grid, ONLY: nte, nne, nti, nzeff, rmin, rmax, zmin, zmax, & phimin, phimax USE beams3d_lines, ONLY: lost_lines @@ -75,6 +75,8 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) s_min = 1 s_max = 0 tf = MAXVAL(t_end_in) + MASS_BEAMS(1) = mass_orbit ! do this to diagnostic routine outputs the correct number + CHARGE_BEAMS(1) = Z_orbit*1.602176565E-19 DO ik = 1, nsd IF (sigma_orbit(ik) .ge. bigno) CYCLE DO v = 1, nv_orbit @@ -110,8 +112,9 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) END DO nparticles_start = nparts - 1 IF (lscreen) THEN - WRITE(6, '(/,a,f5.2)') 'BEAMS3D Version ', BEAMS3D_VERSION WRITE(6,'(A)') '----- Particle Initialization -----' + WRITE(6,'(A,I2)') ' Z = ',NINT(Z_orbit) + WRITE(6,'(A,ES10.2)') ' M = ',mass_orbit WRITE(6,'(A,F9.5,A,F9.5,A,I6)') ' S = [',s_min,',',s_max,']; NS: ',COUNT(sigma_orbit .lt. bigno) WRITE(6,'(A,F9.5,A,F9.5,A,I4)') ' U = [',0.0,',',pi2*(nu_orbit-1)/nu_orbit,']; NU: ',nu_orbit WRITE(6,'(A,F9.5,A,F9.5,A,I4)') ' V = [',0.0,',',pi2*(nv_orbit-1)/nv_orbit/2,']; NV: ',nv_orbit @@ -135,6 +138,7 @@ SUBROUTINE stellopt_orbits(lscreen,iflag) CALL get_equil_ti(s_val,TRIM(ti_type),v_val,iflag) TI_AUX_F_BEAMS(ik) = v_val CALL get_equil_zeff(s_val,TRIM(zeff_type),v_val,iflag) + IF (v_val < 1) v_val = 1 ZEFF_AUX_F_BEAMS(ik) = v_val END DO diff --git a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 index f6fe16c8c..b7892cca0 100644 --- a/STELLOPTV2/Sources/General/stellopt_paraexe.f90 +++ b/STELLOPTV2/Sources/General/stellopt_paraexe.f90 @@ -60,7 +60,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) lvessel_beams => lvessel, lcoil_beams => lcoil, & lrestart_beams => lrestart, lbeam_simple_beams => lbeam_simple, & lflux_beams => lflux, lplasma_only_beams => lplasma_only, & - lcollision_beams => lcollision, & + lcollision_beams => lcollision, lw7x_beams => lw7x, & coil_string_beams => coil_string, mgrid_string_beams => mgrid_string,& vessel_string_beams => vessel_string, restart_string_beams => restart_string, & lraw_beams => lraw, nbeams_beams => nbeams, & @@ -309,6 +309,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) lbeam_beams = .FALSE. lread_input_beams = .FALSE. lcollision_beams = .FALSE. + lw7x_beams = .FALSE. id_string_beams = TRIM(file_str) coil_string_beams = '' mgrid_string_beams = '' @@ -347,6 +348,11 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) CALL MPI_BCAST(t_end_in,nparticles_start,MPI_REAL8, master, MPI_COMM_MYWORLD,ierr_mpi) nparticles_beams = nparticles_start + ! Print some stuff to screen + IF (lscreen) THEN + WRITE(6, '(a,f5.2)') 'BEAMS3D Version ', BEAMS3D_VERSION + END IF + ! Initialize the code CALL beams3d_init CALL MPI_BARRIER(MPI_COMM_MYWORLD,ierr_mpi) @@ -361,7 +367,7 @@ SUBROUTINE stellopt_paraexe(in_parameter_1,in_parameter_2,lscreen) CALL beams3d_diagnostics ! Deallocate Arrays - CALL beams3d_free + CALL beams3d_free(MPI_COMM_SHARMEM) CALL wall_free(ier,MPI_COMM_SHARMEM) ! Free the Shared Memory region From b893e2285f040f325e08535bb6ebbb7b307cf7db Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 14:48:27 +0200 Subject: [PATCH 26/57] Restoring test input file --- BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D index 064bc5a48..e87603eab 100644 --- a/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D +++ b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/input.BEAMS3D @@ -135,8 +135,8 @@ ! Particle Transport ! Mu = 0.5*m*v*v/B or (Thermal Energy)/B !------------------------------------------------------------------------ - NU_ORBIT = 10 - NV_ORBIT = 10 + NU_ORBIT = 20 + NV_ORBIT = 20 NP_ORBIT = 20 VLL_ORBIT = 20*7.76E5 ! 50 [keV] VLL_ORBIT = 20*5.00E5 @@ -159,12 +159,12 @@ ZMAX = 1.00000000000000E+00 PHIMIN = 0.00000000000000E+00 PHIMAX = 2.09439510239000E+00 - NPOINC = 20 + NPOINC = 200 ! T_END_IN = 2*0.000001 ! T_END_IN = 2*0.00003 ! T_END_IN = 2*0.00006 - T_END_IN = 2*0.0001 -! T_END_IN = 2*0.003 +! T_END_IN = 2*0.0001 + T_END_IN = 2*0.003 INT_TYPE = 'LSODE' FOLLOW_TOL = 1.00000000000000E-09 VC_ADAPT_TOL = 1.00000000000000E-06 From deec1d8ba16f9415a5558b8077eee71105250980 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 15:54:26 +0200 Subject: [PATCH 27/57] VMECplot.py can now plot to files --- pySTEL/VMECplot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pySTEL/VMECplot.py b/pySTEL/VMECplot.py index 22417c17f..0781bd08e 100755 --- a/pySTEL/VMECplot.py +++ b/pySTEL/VMECplot.py @@ -82,6 +82,7 @@ def __init__(self): self.ui.rhoslider.valueChanged.connect(self.CutSelect) self.ui.uslider.valueChanged.connect(self.CutSelect) self.ui.vslider.valueChanged.connect(self.CutSelect) + self.ui.savebutton.clicked.connect(self.plot_to_file) def FileSelect(self,i): self.vmec_data=read_vmec(self.ui.FileName.currentText()) @@ -315,6 +316,10 @@ def TransformVMEC(self, i): self.b_u=cfunct(self.theta,self.zeta,self.vmec_data['bsubumnc'],self.vmec_data['xm'],self.vmec_data['xn']) self.b_v=cfunct(self.theta,self.zeta,self.vmec_data['bsubvmnc'],self.vmec_data['xm'],self.vmec_data['xn']) + def plot_to_file(self,i): + text = self.ui.saveas_filename.toPlainText(); + self.fig.savefig('./'+text, dpi=300) + if __name__ == "__main__": app = QApplication(sys.argv) From 1989fbf4cd54833f1848898e3c56b60336060f4b Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 16:00:42 +0200 Subject: [PATCH 28/57] STELLOPT OPTplot plotting to file enabled --- pySTEL/STELLOPT.py | 4 ++++ pySTEL/STELLOPT.ui | 32 +++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/pySTEL/STELLOPT.py b/pySTEL/STELLOPT.py index 735f28edc..63b49ac48 100755 --- a/pySTEL/STELLOPT.py +++ b/pySTEL/STELLOPT.py @@ -90,6 +90,7 @@ def __init__(self): # Callbacks (OPT_plot Tab) self.ui.ButtonLoadSTELLOPT.clicked.connect(self.LoadSTELLOPT) self.ui.ComboBoxOPTplot_type.currentIndexChanged.connect(self.UpdateOptplot) + self.ui.ButtonPlotSTELLOPT.clicked.connect(self.PlotSTELLOPT) def UpdateMpol(self): strtmp = self.ui.TextMpol.text() @@ -1736,6 +1737,9 @@ def UpdateOptplot(self): self.ax2.set_xlim((0,1)) self.canvas2.draw() + def PlotSTELLOPT(self,i): + text = self.ui.saveasSTELLOPT.toPlainText(); + self.fig2.savefig('./'+text, dpi=300) diff --git a/pySTEL/STELLOPT.ui b/pySTEL/STELLOPT.ui index 1a59b0e75..e50afb873 100644 --- a/pySTEL/STELLOPT.ui +++ b/pySTEL/STELLOPT.ui @@ -1138,6 +1138,36 @@ Load stellopt + + + + 460 + 10 + 110 + 32 + + + + Plot Figure + + + + + + 600 + 10 + 141 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(png,pdf,jpg)</p></body></html> + + @@ -1147,7 +1177,7 @@ 0 0 893 - 20 + 22 From 3f1cdb4de8b010d06f2d40e247548a6bece3ed05 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 16:10:06 +0200 Subject: [PATCH 29/57] Added plot functionality to FIELDLINES --- pySTEL/FIELDLINESplot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pySTEL/FIELDLINESplot.py b/pySTEL/FIELDLINESplot.py index 30f3a59bd..f41e9f6c1 100755 --- a/pySTEL/FIELDLINESplot.py +++ b/pySTEL/FIELDLINESplot.py @@ -75,6 +75,7 @@ def __init__(self): self.ui.rhoslider.valueChanged.connect(self.CutSelect) self.ui.uslider.valueChanged.connect(self.CutSelect) self.ui.vslider.valueChanged.connect(self.CutSelect) + self.ui.savebutton.clicked.connect(self.plot_to_file) def FileSelect(self,i): self.fieldlines_data=read_fieldlines(self.ui.FileName.currentText()) @@ -207,7 +208,7 @@ def update_plot(self,i): rmax = np.amax(self.fieldlines_data['raxis']) self.ax.plot(self.fieldlines_data['R_lines'][k:self.nsteps-1:self.npoinc,:],\ self.fieldlines_data['Z_lines'][k:self.nsteps-1:self.npoinc,:],\ - '.k',markersize=0.3) + '.k',markersize=0.1) self.ax.set_xlabel('R [m]') self.ax.set_ylabel('Z [m]') self.ax.set_title('Poincaré Plot') @@ -284,6 +285,10 @@ def update_plot(self,i): self.fig.delaxes(self.ax) self.canvas.draw() + def plot_to_file(self,i): + text = self.ui.saveas_filename.toPlainText(); + self.fig.savefig('./'+text, dpi=300) + if __name__ == "__main__": app = QApplication(sys.argv) From 2ce9dea214295e69b7112bedd1cd8d6cb9fbc4f9 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 16:16:55 +0200 Subject: [PATCH 30/57] LIBSTELL automatically builds the shared_release version of the code. --- LIBSTELL/makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LIBSTELL/makefile b/LIBSTELL/makefile index 3341499ca..99a8ef2c1 100644 --- a/LIBSTELL/makefile +++ b/LIBSTELL/makefile @@ -19,6 +19,7 @@ release: @rm -f $(REL)\*.f; rm -f $(REL)\*.f90 @rm -f $(MYHOME)/$(EXE_F) @-(umask 022; rm -f $(MYHOME)/$(EXE_F); ln -fs $(REL_PATH)/$(EXE_F) $(MYHOME) 2> /dev/null; umask 077) + @make shared_release @echo "Release version - libstell.a - is now updated" @echo "To free up space, delete all *.o files from Release" @echo "" @@ -37,7 +38,7 @@ clean_release: @echo "CLEAN REMAKE IN PROGRESS" @cd $(REL); make -f $(MAKE) clean @make release -# @make shared_release + @make shared_release clean_debug: @echo "CLEAN REMAKE IN PROGRESS" From 5241218c062996e3a6a967212f908edbf6616186 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 16:17:46 +0200 Subject: [PATCH 31/57] Fixed spacing bug --- LIBSTELL/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LIBSTELL/makefile b/LIBSTELL/makefile index 99a8ef2c1..cc915fe5d 100644 --- a/LIBSTELL/makefile +++ b/LIBSTELL/makefile @@ -19,7 +19,7 @@ release: @rm -f $(REL)\*.f; rm -f $(REL)\*.f90 @rm -f $(MYHOME)/$(EXE_F) @-(umask 022; rm -f $(MYHOME)/$(EXE_F); ln -fs $(REL_PATH)/$(EXE_F) $(MYHOME) 2> /dev/null; umask 077) - @make shared_release + @make shared_release @echo "Release version - libstell.a - is now updated" @echo "To free up space, delete all *.o files from Release" @echo "" From 5ab4ea92b3df9fc2bfa79e6a7f8b31bf33519006 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 30 Aug 2019 20:13:42 +0200 Subject: [PATCH 32/57] Added test case for STELLOPT_BEAMS3D --- .../BEAMS3D/test_STELLOPT_BEAMS3D.py | 44 +++++++++++++++++++ BENCHMARKS/makefile | 1 + 2 files changed, 45 insertions(+) create mode 100755 BENCHMARKS/STELLOPT_TEST/BEAMS3D/test_STELLOPT_BEAMS3D.py diff --git a/BENCHMARKS/STELLOPT_TEST/BEAMS3D/test_STELLOPT_BEAMS3D.py b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/test_STELLOPT_BEAMS3D.py new file mode 100755 index 000000000..aa4c0d900 --- /dev/null +++ b/BENCHMARKS/STELLOPT_TEST/BEAMS3D/test_STELLOPT_BEAMS3D.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import sys, os +sys.path.insert(0, '../../../pySTEL/') +import numpy as np #For Arrays +from math import pi +from libstell.stellopt import read_stellopt + +try: + qtCreatorPath=os.environ["STELLOPT_PATH"] +except KeyError: + print("Please set environment variable STELLOPT_PATH") + sys.exit(1) + +failtol = 5.0 +filename='stellopt.BEAMS3D' +data=read_stellopt(filename) +if not data: + print('ERROR Opening File: '+filename) + sys.exit(0) + +print('STELLOPT_VERSION: ' + str(data['VERSION'])) +print('==== Scalars ====') +varlist={} +varlist['ORBIT_equil']=0.765625 +lfail = 0; +for temp in varlist: + act = varlist[temp] + cal = data[temp] + perct = 100*(abs(act-cal)/act) + print(' '+temp+': '+str(cal)+' '+str(act)+' '+str(int(perct))+'%') + if perct > failtol: + lfail = 1 +print('=================') + +if (lfail): + print(' STATUS: FAIL!!!!!') +else: + print(' STATUS: PASS') + +sys.exit(0) + + + + diff --git a/BENCHMARKS/makefile b/BENCHMARKS/makefile index beef27fa7..7e5d2d6a2 100644 --- a/BENCHMARKS/makefile +++ b/BENCHMARKS/makefile @@ -125,6 +125,7 @@ test_stellopt_basic: test_stellopt_beams3d: @echo $(MPI_RUN) $(MPI_RUN_OPTS_LG) $(MYHOME)/xstelloptv2 input.BEAMS3D @cd $(STELLOPT_TEST_DIR)/BEAMS3D; $(MPI_RUN) $(MPI_RUN_OPTS_LG) $(MYHOME)/xstelloptv2 input.BEAMS3D; rm -f *_opt* + @cd $(STELLOPT_TEST_DIR)/BEAMS3D && ./compare_STELLOPT_BEAMS3D.py @echo "" test_stellopt_iota_lmdif: From c8502ca0c19d93b05dee83d7811c9126eb9a2253 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 2 Sep 2019 11:28:12 +0200 Subject: [PATCH 33/57] Bug fix for BOOTSJ --- STELLOPTV2/Sources/Chisq/chisq_bootstrap.f90 | 16 +++++------ .../Sources/General/stellopt_bootsj.f90 | 28 +++++++++++++++---- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/STELLOPTV2/Sources/Chisq/chisq_bootstrap.f90 b/STELLOPTV2/Sources/Chisq/chisq_bootstrap.f90 index 2c3a5edcd..6ab55e2ec 100644 --- a/STELLOPTV2/Sources/Chisq/chisq_bootstrap.f90 +++ b/STELLOPTV2/Sources/Chisq/chisq_bootstrap.f90 @@ -60,16 +60,16 @@ SUBROUTINE chisq_bootstrap(target,sigma,niter,iflag) mtargets = mtargets + 1 targets(mtargets) = target(ik) sigmas(mtargets) = sigma(ik) - CALL get_equil_nustar(rhoar(ik),nustar,ier) + CALL get_equil_nustar(rhoar(ik-1),nustar,ier) IF (ier == -1) nustar=0 facnu = 1./(1.+nustar) ier = 0 - CALL get_equil_jdotb(rhoar(ik),avg_jdotb,ier) + CALL get_equil_jdotb(rhoar(ik-1),avg_jdotb,ier) ! Scale avg_jdotb if net toroidal current is present beam_jdotb = 0.0 boot_jdotb = 0.0 IF ((dex1>4) .and. (dex2>4)) THEN - s = rhoar(ik) + s = rhoar(ik-1) CALL get_equil_beamj(s,j_beam,ier) CALL get_equil_bootj(s,j_boot,ier) !CALL eval_prof_spline(dex1,beamj_aux_s(1:dex1),beamj_aux_f(1:dex1),s,j_beam,ier) @@ -79,15 +79,15 @@ SUBROUTINE chisq_bootstrap(target,sigma,niter,iflag) ELSE IF ((ABS(curtor) > 0) .and. (l_boot_all)) THEN boot_jdotb = avg_jdotb * aibs(ik)/curtor END IF - IF (ABS(ajBbs(ik)) < 1.0E-30) ajBbs(ik) = 0.0 - IF (ABS(bsnorm(ik)) < 1.0E-30) bsnorm(ik) = 0.0 - vals(mtargets) = ABS(boot_jdotb-ajBbs(ik)*facnu) - sig_temp = ABS(ajBbs(ik)*facnu) + IF (ABS(ajBbs(ik-1)) < 1.0E-30) ajBbs(ik-1) = 0.0 + IF (ABS(bsnorm(ik-1)) < 1.0E-30) bsnorm(ik-1) = 0.0 + vals(mtargets) = ABS(boot_jdotb-ajBbs(ik-1)*facnu) + sig_temp = ABS(ajBbs(ik-1)*facnu) !IF (sig_temp > 1.0E3) sigmas(mtargets) = sig_temp*10. IF (sig_temp > 1.0E4) sigmas(mtargets) = sig_temp*10. IF (sig_temp > 1.0E5) sigmas(mtargets) = sig_temp*1.0 IF (sig_temp > 1.0E6) sigmas(mtargets) = sig_temp*0.2 - IF (iflag == 1) WRITE(iunit_out,'(10ES22.12E3)') target(ik),sigmas(mtargets),vals(mtargets),rhoar(ik),avg_jdotb,beam_jdotb,boot_jdotb,ajBbs(ik),facnu,bsnorm(ik) + IF (iflag == 1) WRITE(iunit_out,'(10ES22.12E3)') target(ik),sigmas(mtargets),vals(mtargets),rhoar(ik-1),avg_jdotb,beam_jdotb,boot_jdotb,ajBbs(ik-1),facnu,bsnorm(ik-1) END IF END DO ELSE diff --git a/STELLOPTV2/Sources/General/stellopt_bootsj.f90 b/STELLOPTV2/Sources/General/stellopt_bootsj.f90 index cac1dc9f0..0596f6b64 100644 --- a/STELLOPTV2/Sources/General/stellopt_bootsj.f90 +++ b/STELLOPTV2/Sources/General/stellopt_bootsj.f90 @@ -219,9 +219,19 @@ SUBROUTINE stellopt_bootsj(lscreen,iflag) dense(ir) = dense(ir) + 1.E-36_dp END DO ELSE + IF(lscreen_bootsj) THEN + WRITE(6,*) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' + WRITE(6,*) '!! WARNING: tempres >=0 detected !!' + WRITE(6,*) '!! Using pressure profile !!' + WRITE(6,*) '!! and ATE(0) ATI(0) for !!' + WRITE(6,*) '!! profile spec. To use !!' + WRITE(6,*) '!! profiles set AUX_F vars !!' + WRITE(6,*) '!! and tempres < 0. !!' + WRITE(6,*) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' + END IF ! Setup some variables - tempe0 = ate(0) !central electron temperature in keV - tempi0 = ati(0) !central ion temperature in keV + tempe0 = ate(0)*1000 !central electron temperature in keV + tempi0 = ati(0)*1000 !central ion temperature in keV pres0 = 1.6022E-19_DP !Normalization of P=N*ec Note we want eV and m^-3 at this point ! Mimic behavior (if ate/i >0 then use as central values and scale density) if (tempe0.le.0 .or. tempi0.le.0) tempres = abs(tempres) @@ -244,6 +254,9 @@ SUBROUTINE stellopt_bootsj(lscreen,iflag) CALL MPI_BCAST(dense,irdim,MPI_DOUBLE_PRECISION,master,MPI_COMM_MYWORLD,ierr_mpi) CALL MPI_BCAST(tempi1,irdim,MPI_DOUBLE_PRECISION,master,MPI_COMM_MYWORLD,ierr_mpi) !DEC$ ENDIF + WHERE (tempe1 <10) tempe1 = 10 + WHERE (tempi1 <10) tempi1 = 10 + WHERE (dense <1E17) tempi1 = 1E17 tempe1 = tempe1/1000. ! [eV] to [keV] tempi1 = tempi1/1000. ! [eV] to [keV] dense = dense/(1.0E+20) ! [m^-3] to 10^20 [m^-3] @@ -258,10 +271,13 @@ SUBROUTINE stellopt_bootsj(lscreen,iflag) call smooth1 (dense, 1, irup, work, 0.0) call positiv (dense, irup, 2) DEALLOCATE(work) - i1 = irup - 1 - a = tempe1(irup) + tempi1(irup)/zeff1 - a1 = tempe1(i1) + tempi1(i1)/zeff1 - dense(irup) = dense(i1)*a1*betar(irup)/(a*betar(i1)+1.E-36_dp) + ! This was to control the density at the edge but can have + ! some seriously disasterous concequeneces. + !i1 = irup - 1 + !a = tempe1(irup) + tempi1(irup)/zeff1 + !a1 = tempe1(i1) + tempi1(i1)/zeff1 + !dense(irup) = dense(i1)*a1*betar(irup)/(a*betar(i1)+1.E-36_dp) + !IF (myworkid == master) WRITE(6,*) a, a1, betar(i1) dex_zeff = MINLOC(zeff_aux_s(2:),DIM=1) IF (myworkid == master) THEN IF (dex_zeff > 4) THEN From 8f7f1252ebfbfb2a3b2cfbc790b7f8a5aa78c4d1 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 2 Sep 2019 13:26:13 +0200 Subject: [PATCH 34/57] Added test routine for test_stellopt_basic --- .../BASIC/test_STELLOPT_BASIC.py | 241 ++++++++++++++++++ BENCHMARKS/makefile | 1 + 2 files changed, 242 insertions(+) create mode 100755 BENCHMARKS/STELLOPT_TEST/BASIC/test_STELLOPT_BASIC.py diff --git a/BENCHMARKS/STELLOPT_TEST/BASIC/test_STELLOPT_BASIC.py b/BENCHMARKS/STELLOPT_TEST/BASIC/test_STELLOPT_BASIC.py new file mode 100755 index 000000000..584c16d66 --- /dev/null +++ b/BENCHMARKS/STELLOPT_TEST/BASIC/test_STELLOPT_BASIC.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +import sys, os +sys.path.insert(0, '../../../pySTEL/') +import numpy as np #For Arrays +from math import pi +from libstell.stellopt import read_stellopt + +try: + qtCreatorPath=os.environ["STELLOPT_PATH"] +except KeyError: + print("Please set environment variable STELLOPT_PATH") + sys.exit(1) + +failtol = 1.0 +filename='stellopt.BASIC' +data=read_stellopt(filename) +if not data: + print('ERROR Opening File: '+filename) + sys.exit(0) + +print('STELLOPT_VERSION: ' + str(data['VERSION'])) +print('==== Scalars ====') +varlist={} +varlist['ASPECT_equil']=4.365254725961 +varlist['BETA_equil']=0.04247495078898 +varlist['CURTOR_equil']=-174295.7864085 +varlist['PHIEDGE_equil']=0.514386 +varlist['RBTOR_equil']=2.31287385883 +varlist['R0_equil']=1.577564814145 +varlist['VOLUME_equil']=2.978717214537 +varlist['WP_equil']=192549.3826145 + +lfail = 0; +for temp in varlist: + act = varlist[temp] + cal = data[temp] + perct = 100*(abs(act-cal)/act) + print(' '+temp+': '+str(cal)+' '+str(act)+' '+str(int(perct))+'%') + if perct > failtol: + lfail = 1 +print('==== Vectors ====') +varlist={} +varlist['NELINE_equil']=np.array([3.95345058e+19, 4.36360683e+19, 4.99104825e+19, 4.97151700e+19, + 4.95198575e+19, 4.98942064e+19, 4.96012377e+19, 4.98942064e+19, + 4.95035814e+19, 4.96988939e+19, 4.97965502e+19, 4.98942064e+19, + 4.98942064e+19, 4.97965502e+19, 4.96175137e+19, 4.93245450e+19, + 4.96988939e+19, 4.99104825e+19, 4.91292325e+19, 4.99104825e+19, + 4.95035814e+19, 4.96988939e+19, 4.94059252e+19, 4.95198575e+19, + 4.99104825e+19, 4.92268887e+19, 4.97965502e+19, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00]) +varlist['FARADAY_equil']=np.array([4.84998780e+18, 6.24317187e+18, 8.39064373e+18, 8.14363282e+18, + 7.89449225e+18, 7.64778243e+18, 7.41316933e+18, 7.17963385e+18, + 6.95571009e+18, 6.73951176e+18, 6.51854676e+18, 6.31307331e+18, + 6.10757300e+18, 5.88221215e+18, 5.72549427e+18, 5.51922842e+18, + 5.31235082e+18, 5.16342405e+18, 5.02947813e+18, 4.85267423e+18, + 4.69890718e+18, 4.59685470e+18, 4.35154824e+18, 4.16795625e+18, + 3.75018462e+18, 3.03325623e+18, 1.53056359e+18, 0.00000000e+00, + 0.00000000e+00, 0.00000000e+00]) +varlist['NE_s']=np.array([1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 0.96957385, 0.84646266, 0.73568288, 0.63801306, + 0.55223125, 0.47629871, 0.40872552, 0.34854282, 0.29505716, + 0.24772617, 0.20610905, 0.16984279, 0.13862508, 0.11219288, + 0.09028815, 0.07261778, 0.05883508, 0.04855828, 0.04140966, + 0.03704126, 0.03510144, 0.03514874, 0.03662914, 0.03897247, + 0.04168458, 0.04436424, 0.04668542, 0.04838872, 0.04928902, + 0.04928902, 0.04838871, 0.0466854 , 0.04436422, 0.04168456, + 0.03897244, 0.03662911, 0.03514871, 0.03510141, 0.03704123, + 0.04140964, 0.04855827, 0.05883507, 0.07261778, 0.09028817, + 0.1121929 , 0.13862512, 0.16984284, 0.20610911, 0.24772625, + 0.29505725, 0.34854292, 0.40872564, 0.47629885, 0.55223141, + 0.63801326, 0.73568311, 0.84646294, 0.96957417, 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 , + 1.5 , 1.5 , 1.5 , 1.5 , 1.5 ]) +varlist['PRESS_equil']=np.array([0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0.00356007, 0.10317417, 0.27333325, 0.4405629 , + 0.57717972, 0.68235512, 0.76240732, 0.8236392 , 0.87070981, + 0.90676707, 0.93399534, 0.95408327, 0.96848 , 0.97848388, + 0.98523448, 0.98968045, 0.99255109, 0.99437192, 0.99548419, + 0.99610292, 0.99636549, 0.99635918, 0.99615936, 0.99583395, + 0.99544388, 0.99504027, 0.99467565, 0.99439976, 0.99425121, + 0.99425121, 0.99439976, 0.99467565, 0.99504027, 0.99544389, + 0.99583395, 0.99615936, 0.99635919, 0.9963655 , 0.99610292, + 0.9954842 , 0.99437192, 0.99255109, 0.98968045, 0.98523448, + 0.97848387, 0.96847999, 0.95408324, 0.93399531, 0.90676702, + 0.87070974, 0.8236391 , 0.76240719, 0.68235494, 0.57717947, + 0.44056257, 0.27333285, 0.10317382, 0.00355998, 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , 0. ]) +varlist['TE_equil']=np.array([ 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 15.72535141, 471.93466094, 1251.16179877, + 2016.86183312, 2642.32855325, 3123.80103486, 3490.24658493, + 3770.53721693, 3986.01084074, 4151.07586804, 4275.72919465, + 4367.69463013, 4433.60523516, 4479.40053224, 4510.29898452, + 4530.64038085, 4543.77692186, 4552.09961238, 4557.19092162, + 4560.03532475, 4561.23607489, 4561.20724367, 4560.29358245, + 4558.80212399, 4557.00527658, 4555.15370836, 4553.48728126, + 4552.22684386, 4551.54761757, 4551.54762009, 4552.22685118, + 4553.4872927 , 4555.15372296, 4557.00529326, 4558.80214174, + 4560.29360037, 4561.20726105, 4561.23609115, 4560.03533943, + 4557.19093423, 4552.09962206, 4543.77692687, 4530.64037808, + 4510.29896895, 4479.40049662, 4433.6051699 , 4367.6945234 , + 4275.72903243, 4151.07563383, 3986.01051412, 3770.53677015, + 3490.24597718, 3123.8002062 , 2642.32742509, 2016.86033644, + 1251.15999803, 471.93305271, 15.72497415, 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. ]) +varlist['TI_equil']=np.array([ 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 419.3295522 , 1399.26565903, 2318.86350702, 3010.40265007, + 3500.70094519, 3850.59735456, 4103.29831952, 4283.67729567, + 4407.31942591, 4486.67775334, 4533.38148369, 4558.2982752 , + 4570.46635216, 4575.80343379, 4576.95395338, 4574.16622035, + 4565.04416692, 4541.39934793, 4484.19841661, 4363.2706522 , + 4146.04902532, 3803.27472154, 3297.42472342, 2570.70460722, + 1583.83503038, 480.43382735, 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. , + 0. , 0. , 0. , 0. ]) +varlist['BALLOON_grate']=np.array([-0.03990522, -0.04518164, -0.0494775 , -0.04971083, -0.05074736, + -0.0573415 , -0.06015736, -0.06090567, -0.06153402, -0.06276648, + -0.06350834, -0.06358018, -0.06444599, -0.0686625 , -0.07489275, + -0.08117313, -0.08618688, -0.09018186, -0.09306346, -0.09518754, + -0.0965164 , -0.09723828, -0.09734684, -0.09696629, -0.09622158, + -0.09536947, -0.09483969, -0.09523124, -0.09709229, -0.10051332, + -0.10489826, -0.10956414, -0.11387223, -0.11761073, -0.12060108, + -0.12291505, -0.12448427, -0.12540642, -0.12562028, -0.12521477, + -0.12413147, -0.12245412, -0.12014725, -0.11730966, -0.11398747, + -0.11045001, -0.10715209, -0.10495739, -0.10488095, -0.10761541, + -0.11300195, -0.12003461, -0.12745773, -0.13430544, -0.14010697, + -0.14464713, -0.14803223, -0.15026516, -0.15162906, -0.15213036, + -0.15211251, -0.15147167, -0.15057178, -0.14922869, -0.14782754, + -0.14599961, -0.14414553, -0.14203976, -0.13974788, -0.13723878, + -0.13481565, -0.13196189, -0.12974734, -0.12743523, -0.12686892, + -0.12538196, -0.12473499, -0.11769686, -0.11060464, -0.08907185, + -0.07101456, 0.02692876, 0.06124561, 0.09033339, 0.08985875, + 0.0850165 , 0.04413507, -0.05680148, -0.07107962, 0.04761966, + 0.07757839, -0.08986066, -0.13631851, -0.14806962, -0.15080767, + -0.14896531, -0.14438368, 0. ]) +varlist['BOOTSTRAP_equil']=np.array([3.85718780e+03, 1.51673234e+04, 1.85012176e+04, 2.41980280e+04, + 2.92562402e+04, 3.18460059e+04, 2.04026861e+04, 1.23054894e+05, + 8.75165889e+04, 9.01672796e+04, 9.66660274e+04, 1.05872690e+05, + 1.14200446e+05, 1.25481331e+05, 1.36315634e+05, 1.45948802e+05, + 1.65810560e+05, 1.72263029e+05, 1.83355166e+05, 1.92387658e+05, + 2.16825289e+05, 2.24590433e+05, 2.36393629e+05, 2.48683954e+05, + 2.61566520e+05, 2.72901408e+05, 2.84612241e+05, 2.94218294e+05, + 3.00934288e+05, 3.21790791e+05, 3.30871879e+05, 3.38792509e+05, + 3.47458745e+05, 3.57107508e+05, 3.69484009e+05, 3.77114861e+05, + 3.76393464e+05, 3.97977418e+05, 4.00242758e+05, 4.42188237e+05, + 4.26086757e+05, 4.52142268e+05, 4.53617500e+05, 4.54063144e+05, + 4.78105281e+05, 4.30076096e+05, 4.01979266e+05, 3.71379297e+05, + 3.63535343e+05, 3.04100698e+05, 4.05152059e+05, 3.08347956e+05, + 2.41084045e+05, 2.61893416e+05, 1.60376714e+05, 1.18800097e+05, + 3.12960167e+04, 9.47938496e+04, 3.04688074e+05, 7.03386988e+05, + 1.70773847e+06, 6.95203950e+06, 3.93208364e+06, 2.05327097e+06, + 1.47152028e+06, 1.19620236e+06, 1.02414199e+06, 9.17540704e+05, + 8.46111889e+05, 7.14997490e+05, 7.04187119e+05, 5.91587301e+05, + 6.73049795e+05, 5.74466774e+05, 5.22471489e+05, 3.92249811e+05, + 7.23543333e+05, 5.46439403e+05, 4.70307980e+05, 4.21811031e+05, + 4.08608323e+05, 3.82927636e+05, 3.39154185e+05, 3.24220776e+05, + 2.88983266e+05, 2.61852738e+05, 2.33963543e+05, 2.06567246e+05, + 1.81422825e+05, 1.58247150e+05, 1.37226695e+05, 1.18073624e+05, + 1.00134878e+05, 8.26981795e+04, 6.48743695e+04, 2.93854222e+04, + 1.66634282e+01, 3.23192605e+00]) +varlist['NEO_equil']=np.array([1.63413710e-07, 9.80975460e-08, 1.40018104e-07, 2.23263416e-07, + 3.34833150e-07, 4.77100154e-07, 6.54455270e-07, 8.46328241e-07, + 1.10627654e-06, 1.40112674e-06, 1.73987339e-06, 2.07047000e-06, + 2.49976706e-06, 2.95859091e-06, 3.52409362e-06, 4.10077533e-06, + 4.78950967e-06, 5.55386606e-06, 6.17144255e-06, 7.25163813e-06, + 8.16573216e-06, 9.23759340e-06, 1.04274761e-05, 1.17103325e-05, + 1.29735882e-05, 1.42241588e-05, 1.61575153e-05, 1.78712398e-05, + 1.97005177e-05, 2.17053611e-05, 2.46114404e-05, 2.66004016e-05, + 2.95497981e-05, 3.24869797e-05, 3.54516205e-05, 3.92841807e-05, + 4.29363015e-05, 4.66599832e-05, 5.07656932e-05, 5.55192183e-05, + 6.01255823e-05, 6.51884285e-05, 7.12579480e-05, 7.70544973e-05, + 8.39062275e-05, 9.02668765e-05, 9.74049299e-05, 1.05035996e-04, + 1.13637852e-04, 1.22301898e-04, 1.31255686e-04, 1.41376396e-04, + 1.51408537e-04, 1.63833654e-04, 1.75001106e-04, 1.87333892e-04, + 2.00188832e-04, 2.13000910e-04, 2.26868016e-04, 2.42305667e-04, + 2.58025140e-04, 2.75317541e-04, 2.91705716e-04, 3.11310184e-04, + 3.28606707e-04, 3.46704664e-04, 3.66149088e-04, 3.89828481e-04, + 4.12562562e-04, 4.36199326e-04, 4.61269781e-04, 4.87136470e-04, + 5.11665886e-04, 5.44143759e-04, 5.73673866e-04, 6.06906606e-04, + 6.44264622e-04, 6.82322008e-04, 7.21182448e-04, 7.62235381e-04, + 8.11181931e-04, 8.60175932e-04, 9.08288729e-04, 9.69578735e-04, + 1.02774625e-03, 1.09225976e-03, 1.16468775e-03, 1.24113111e-03, + 1.31051497e-03, 1.39311746e-03, 1.49768512e-03, 1.58641325e-03, + 1.67897462e-03, 1.79730056e-03, 1.89253483e-03, 2.01038413e-03, + 2.12641224e-03, 2.26630404e-03]) +varlist['TXPORT_equil']=np.array([0.09589212, 0.09667091, 0.095876 , 0.09536677, 0.09626293, + 0.0979782 , 0.09970561, 0.10079448, 0.09998995, 0.09477011, + 0.0906425 , 0.08752357, 0.08491442, 0.08499796, 0.0914881 ]) +for temp in varlist: + act = varlist[temp] + cal = data[temp] + div = np.where(act==0,1,act) + perct = 100*sum(abs(act-cal)/div) + print(' '+temp+': '+str(cal[0])+' '+str(act[0])+' '+str(int(perct))+'%') + if perct > failtol: + lfail = 1 +print('=================') + +if (lfail): + print(' STATUS: FAIL!!!!!') +else: + print(' STATUS: PASS') + +sys.exit(0) + + + + diff --git a/BENCHMARKS/makefile b/BENCHMARKS/makefile index 7e5d2d6a2..1da0ca40f 100644 --- a/BENCHMARKS/makefile +++ b/BENCHMARKS/makefile @@ -120,6 +120,7 @@ test_stellopt_gade: test_stellopt_basic: @echo $(MPI_RUN) $(MPI_RUN_OPTS_MD) $(MYHOME)/xstelloptv2 input.BASIC @cd $(STELLOPT_TEST_DIR)/BASIC; $(MPI_RUN) $(MPI_RUN_OPTS_MD) $(MYHOME)/xstelloptv2 input.BASIC; rm -f *_opt* + @cd $(STELLOPT_TEST_DIR)/BASIC && ./compare_STELLOPT_BASIC.py @echo "" test_stellopt_beams3d: From 8b34aee510a5a4f281989c264593d4ac847e2b3d Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 3 Sep 2019 13:21:45 -0400 Subject: [PATCH 35/57] fix out of date mpi include --- TORLINES/Sources/torlines_init_wout.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TORLINES/Sources/torlines_init_wout.f90 b/TORLINES/Sources/torlines_init_wout.f90 index 224f7a765..11f674634 100644 --- a/TORLINES/Sources/torlines_init_wout.f90 +++ b/TORLINES/Sources/torlines_init_wout.f90 @@ -38,6 +38,9 @@ SUBROUTINE torlines_init_wout USE mpi_params USE EZspline_obj USE EZspline +!DEC$ IF DEFINED (MPI_OPT) + use mpi +!DEC$ ENDIF !----------------------------------------------------------------------- ! Local Variables ! iunit File Unit Number @@ -51,9 +54,6 @@ SUBROUTINE torlines_init_wout ! rho_in VMEC Rho !----------------------------------------------------------------------- IMPLICIT NONE -!DEC$ IF DEFINED (MPI_OPT) - INCLUDE 'mpif.h' -!DEC$ ENDIF INTEGER :: iunit, ier, mn, im, in, ik , i, j, ns1, k1,mn0,& u,v INTEGER :: bcs1(2) From 9c84e995c21dcab6cc4c6064db3198f738e242d5 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Thu, 5 Sep 2019 09:42:51 -0400 Subject: [PATCH 36/57] Update benchmark cases --- BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF | 4 ++-- BENCHMARKS/VMEC_TEST/compare_QAS.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF b/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF index a99bd2441..79790cf95 100644 --- a/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF +++ b/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF @@ -56,11 +56,11 @@ FTOL = 1.00E-06 XTOL = 1.00E-06 GTOL = 1.00E-30 - FACTOR = 1.0 + FACTOR = 100.0 EPSFCN = 1.00E-06 MODE = 1 LKEEP_MINS = T - NOPTIMIZERS = 8 + NOPTIMIZERS = -1 !----------------------------------------------------------------------- ! OPTIMIZED QUANTITIES !----------------------------------------------------------------------- diff --git a/BENCHMARKS/VMEC_TEST/compare_QAS.py b/BENCHMARKS/VMEC_TEST/compare_QAS.py index 2a8e616fd..82d41a5df 100755 --- a/BENCHMARKS/VMEC_TEST/compare_QAS.py +++ b/BENCHMARKS/VMEC_TEST/compare_QAS.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -import sys, os sys.path.insert(0, '../../pySTEL/') +import sys, os +sys.path.insert(0, '../../pySTEL/') import numpy as np #For Arrays from math import pi from libstell.libstell import read_vmec From 6c13c55b1d97f750ea77987c25240c168f208cb3 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Thu, 5 Sep 2019 09:44:08 -0400 Subject: [PATCH 37/57] Fix several non-initialized / non-allocated errors in VMEC2000; update LIBSTELL.dep in debug --- LIBSTELL/Debug/LIBSTELL.dep | 33 +++++++++++++++++++ LIBSTELL/Sources/Modules/read_wout_mod.f90 | 16 ++++----- VMEC2000/Sources/General/funct3d.f | 1 + .../Initialization_Cleanup/allocate_ns.f | 6 ++++ VMEC2000/Sources/Input_Output/eqfor.f | 2 +- VMEC2000/Sources/Input_Output/wrout.f | 32 ++++++++++-------- .../Sources/TimeStep/parallel_vmec_module.f90 | 18 +++++----- 7 files changed, 76 insertions(+), 32 deletions(-) diff --git a/LIBSTELL/Debug/LIBSTELL.dep b/LIBSTELL/Debug/LIBSTELL.dep index 28e323b8f..68d38db22 100644 --- a/LIBSTELL/Debug/LIBSTELL.dep +++ b/LIBSTELL/Debug/LIBSTELL.dep @@ -1,6 +1,9 @@ # Microsoft Developer Studio Generated Dependency File, included by LIBSTELL.mak +mpi_sharmem.o : + xvec_eval.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -140,6 +143,7 @@ integration_path.o : \ init_bg_currents.o : \ + mpi_inc.o \ biotsavart.o \ bcoils_mod.o \ mpi_params.o \ @@ -167,6 +171,7 @@ init_saddle_currents.o : \ init_saddle_wsurf.o : \ + mpi_inc.o \ mpi_params.o \ saddle_surface.o @@ -497,6 +502,7 @@ crosovr.o : \ DE_driver.o : \ + mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -511,6 +517,7 @@ DE_Evaluate.o : \ MAP.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -518,6 +525,7 @@ MAP.o : \ eval_x_queued.o : \ + mpi_inc.o \ safe_open_mod.o \ stel_kinds.o @@ -528,6 +536,7 @@ MAP_HYPERS.o : \ MAP_LINEAR.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -535,6 +544,7 @@ MAP_LINEAR.o : \ GENERIC_Evolve.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -542,6 +552,7 @@ GENERIC_Evolve.o : \ MAP_PLANE.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -549,6 +560,7 @@ MAP_PLANE.o : \ DE_Evolve.o : \ + mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -556,6 +568,7 @@ DE_Evolve.o : \ PSO_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -563,6 +576,7 @@ PSO_Evolve.o : \ DE2_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -570,12 +584,14 @@ DE2_Evolve.o : \ ROCKET_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o de_mpi.o : \ + mpi_inc.o \ de_mod.o \ mpi_params.o @@ -598,6 +614,7 @@ enorm.o : \ fdjac_mod.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o @@ -616,6 +633,7 @@ ga_decode.o : \ GA_driver.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o \ @@ -623,6 +641,7 @@ GA_driver.o : \ ga_evalout.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -632,6 +651,7 @@ ga_evaluate.o : \ ga_fitness_mpi.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -641,32 +661,38 @@ ga_fitness_parallel.o : \ ga_initial.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o ga_micro.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_mutate.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_newgen.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_niche.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_possibl.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -676,6 +702,7 @@ GA_preset.o : \ ga_restart.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o @@ -694,12 +721,14 @@ ga_shuffle.o : \ ga_sp.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o lmdif.o : \ + mpi_inc.o \ fdjac_mod.o \ lmpar_mod.o \ mpi_params.o \ @@ -721,6 +750,7 @@ lmpar.o : \ lmpar_mod.o : \ + mpi_inc.o \ safe_open_mod.o \ fdjac_mod.o \ mpi_params.o \ @@ -1005,6 +1035,7 @@ read_boozer_mod.o : \ read_response.o : \ + mpi_inc.o \ bsc_cdf.o \ ezcdf.o \ mpi_params.o \ @@ -1208,6 +1239,7 @@ li_gesl.o : \ stepopt_mp.o : \ + mpi_inc.o \ stel_kinds.o \ fdjac_mod.o \ safe_open_mod.o \ @@ -1215,6 +1247,7 @@ stepopt_mp.o : \ mgrid_field_mod.o : \ + mpi_inc.o \ stel_kinds.o \ mgrid_mod.o \ ezspline_obj.o \ diff --git a/LIBSTELL/Sources/Modules/read_wout_mod.f90 b/LIBSTELL/Sources/Modules/read_wout_mod.f90 index 14487d908..8ad753609 100755 --- a/LIBSTELL/Sources/Modules/read_wout_mod.f90 +++ b/LIBSTELL/Sources/Modules/read_wout_mod.f90 @@ -2336,12 +2336,12 @@ SUBROUTINE Compute_Currents(bsubsmnc_, bsubsmns_, & USE stel_constants, ONLY: mu0 IMPLICIT NONE - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubsmnc_ - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubsmns_ - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubumnc_ - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubumns_ - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubvmnc_ - REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubvmns_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubsmnc_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubsmns_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubumnc_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubumns_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubvmnc_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubvmns_ REAL(rprec), DIMENSION(:), INTENT(in) :: xm_nyq_ REAL(rprec), DIMENSION(:), INTENT(in) :: xn_nyq_ @@ -2352,8 +2352,8 @@ SUBROUTINE Compute_Currents(bsubsmnc_, bsubsmns_, & REAL(rprec), DIMENSION(:,:), INTENT(out) :: currumnc_ REAL(rprec), DIMENSION(:,:), INTENT(out) :: currvmnc_ - REAL(rprec), DIMENSION(:,:), INTENT(out) :: currumns_ - REAL(rprec), DIMENSION(:,:), INTENT(out) :: currvmns_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(out) :: currumns_ + REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(out) :: currvmns_ !----------------------------------------------- ! L o c a l V a r i a b l e s diff --git a/VMEC2000/Sources/General/funct3d.f b/VMEC2000/Sources/General/funct3d.f index 0dba7f7fe..ee91f4a2c 100644 --- a/VMEC2000/Sources/General/funct3d.f +++ b/VMEC2000/Sources/General/funct3d.f @@ -512,6 +512,7 @@ SUBROUTINE funct3d (lscreen, ier_flag) xtempa = xc CALL getrz(xc) #endif + IF (ictrl_prec2d .EQ. 3) THEN gc(:neqs2) = scalxc(:neqs2)*(xc(:neqs2)+xcdot(:neqs2)) ELSE diff --git a/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f b/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f index c9b168058..ed05d7340 100644 --- a/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f +++ b/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f @@ -176,6 +176,7 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) STOP 'allocation error #10 in allocate_ns' END IF pxc(:neqs2) = zero + pscalxc(:neqs2) = zero END IF IF (ALLOCATED(pxc_old)) THEN @@ -189,6 +190,10 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) ALLOCATE(gc(neqs2), xcdot(neqs2), xsave(neqs2), & xstore(neqs2), col_scale(neqs2), stat=istat1) xstore = zero + xcdot = zero + gc = zero + xsave = zero + col_scale = zero IF (istat1 .NE. 0) THEN STOP 'allocation error #9 in allocate_ns' END IF @@ -199,6 +204,7 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) STOP 'allocation error #10 in allocate_ns' END IF xc(:neqs2) = zero + scalxc = zero END IF IF (ALLOCATED(xc_old)) THEN diff --git a/VMEC2000/Sources/Input_Output/eqfor.f b/VMEC2000/Sources/Input_Output/eqfor.f index 1b7f12e3c..97b863c9f 100644 --- a/VMEC2000/Sources/Input_Output/eqfor.f +++ b/VMEC2000/Sources/Input_Output/eqfor.f @@ -693,7 +693,7 @@ SUBROUTINE eqfor(br, bz, bsubu, bsubv, tau, rzl_array, ier_flag) vvc_smaleli = smaleli ! Save result for v3fit. betai = 2*factor*sump musubi = vnorm*factor*musubi - dmusubi_meas = 2*twopi*factor*delphid*rbtor + dmusubi_meas = 2*twopi*factor*delphid_exact*rbtor ! delphid replaced; czhu 20190904 lambda = p5*smaleli + betai s11 = er - rshaf*sigr0 !Shafranov def. based on RT, Eq.(12) s12 = er - rcen*sigr0 !R = Rgeometric diff --git a/VMEC2000/Sources/Input_Output/wrout.f b/VMEC2000/Sources/Input_Output/wrout.f index 717342418..22df564e1 100644 --- a/VMEC2000/Sources/Input_Output/wrout.f +++ b/VMEC2000/Sources/Input_Output/wrout.f @@ -33,7 +33,7 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, #ifdef NETCDF USE ezcdf USE read_wout_mod, ONLY: Compute_Currents, - 1 vn_version, vn_extension, vn_mgrid, + 1 vn_version, vn_extension, vn_mgrid, 1 vn_magen, vn_therm, vn_gam, vn_maxr, vn_minr, vn_maxz, vn_fp, 2 vn_radnod, vn_polmod, vn_tormod, vn_maxmod, vn_maxit, vn_actit, 3 vn_asym, vn_recon, vn_free, vn_error, vn_aspect, vn_beta, @@ -1113,14 +1113,16 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, END DO END DO END DO MN3 - - gmns(:,js) = gmn(:) - bmns(:,js) = bmn(:) - bsubumns(:,js) = bsubumn(:) - bsubvmns(:,js) = bsubvmn(:) - bsubsmnc(:,js) = bsubsmn(:) - bsupumns(:,js) = bsupumn(:) - bsupvmns(:,js) = bsupvmn(:) + + IF (lasym) THEN + gmns(:,js) = gmn(:) + bmns(:,js) = bmn(:) + bsubumns(:,js) = bsubumn(:) + bsubvmns(:,js) = bsubvmn(:) + bsubsmnc(:,js) = bsubsmn(:) + bsupumns(:,js) = bsupumn(:) + bsupvmns(:,js) = bsupvmn(:) + END IF #ifdef _ANIMEC pparmns(:,js) = pparmn(:) ppermns(:,js) = ppermn(:) @@ -1132,11 +1134,13 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, #endif END DO RADIUS3 - gmns(:,1) = 0; bmns(:,1) = 0 - bsubumns(:,1) = 0 - bsubvmns(:,1) = 0 - bsubsmnc(:,1) = 2*bsubsmnc(:,2) - bsubsmnc(:,3) - bsupumns(:,1) = 0; bsupvmns(:,1) = 0 + IF (lasym) THEN + gmns(:,1) = 0; bmns(:,1) = 0 + bsubumns(:,1) = 0 + bsubvmns(:,1) = 0 + bsubsmnc(:,1) = 2*bsubsmnc(:,2) - bsubsmnc(:,3) + bsupumns(:,1) = 0; bsupvmns(:,1) = 0 + END IF #ifdef _ANIMEC hotdmns(:,1) = 0; pparmns(:,1) = 0; ppermns(:,1) = 0 pbprmns(:,1) = 0; ppprmns(:,1) = 0 diff --git a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 index 90aa3c5a9..64e517352 100644 --- a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 +++ b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 @@ -54,15 +54,15 @@ MODULE parallel_vmec_module CHARACTER*100 :: envvar CHARACTER*100 :: envval - REAL(dp) :: bcyclic_comp_time - REAL(dp) :: bcyclic_comm_time - REAL(dp) :: waitall_time - REAL(dp) :: dgemm_time - REAL(dp) :: dgetrf_time - REAL(dp) :: dgetrs_time - REAL(dp) :: dgemv_time - REAL(dp) :: ForwardSolveLoop_time - REAL(dp), DIMENSION(12) :: t + REAL(dp) :: bcyclic_comp_time = 0 + REAL(dp) :: bcyclic_comm_time = 0 + REAL(dp) :: waitall_time = 0 + REAL(dp) :: dgemm_time = 0 + REAL(dp) :: dgetrf_time = 0 + REAL(dp) :: dgetrs_time = 0 + REAL(dp) :: dgemv_time = 0 + REAL(dp) :: ForwardSolveLoop_time = 0 + REAL(dp), DIMENSION(12) :: t=0 REAL(dp) :: allgather_time=0 REAL(dp) :: allreduce_time=0 From f2934ee8106d2be59f50d3258c30621476736e64 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Thu, 5 Sep 2019 09:54:22 -0400 Subject: [PATCH 38/57] upload two new pppl make.inc --- SHARE/make_pppl_czhu_gcc.inc | 412 +++++++++++++++++++++++++++++++++ SHARE/make_pppl_czhu_intel.inc | 412 +++++++++++++++++++++++++++++++++ 2 files changed, 824 insertions(+) create mode 100644 SHARE/make_pppl_czhu_gcc.inc create mode 100644 SHARE/make_pppl_czhu_intel.inc diff --git a/SHARE/make_pppl_czhu_gcc.inc b/SHARE/make_pppl_czhu_gcc.inc new file mode 100644 index 000000000..50afa2f3e --- /dev/null +++ b/SHARE/make_pppl_czhu_gcc.inc @@ -0,0 +1,412 @@ +####################################################################### +# Define Basic Utilities +####################################################################### + SHELL = /bin/sh + PWD1 = `pwd` + MYHOME = $(HOME)/bin + PRECOMP:= /lib/cpp -traditional -DLINUX + COMPILE = $(FC) + COMPILE_FREE = $(FC) -ffree-form -ffree-line-length-none -ffixed-line-length-none + LINK = ld $(FLAGS) -o + LINK_AR = ar -ruv + LINK_C = $(CC) -shared -Wl,--no-undefined -Wl,-export-dynamic + +####################################################################### +# Define Compiler Flags +####################################################################### + FLAGS_R = -O2 -fexternal-blas + FLAGS_D = -g -O0 -fexternal-blas -fcheck=all -fbacktrace -Wextra \ + -Wtarget-lifetime -fbounds-check -ffpe-trap=zero -finit-real=snan + +# Crutch for broken module vars + NETCDF_F = $(NETCDF_FORTRAN_HOME) + NETCDF_C = $(NETCDF_C_HOME) + HDF5_HOME = $(HDF5_PARALLEL_HOME) + #NETCDF_F = /usr/pppl/gcc/6.1-pkgs/netcdf-fortran-4.4.4 + #NETCDF_C = /usr/pppl/gcc/6.1-pkgs/netcdf-c-4.4.1 + + LIBS = -lopenblas -L$(SCALAPACK_HOME)/lib -lscalapack + +# BLACS requires full links to library files + LIBS += ${BLACS_HOME}/lib/blacs_MPI-LINUX-0.a + LIBS += ${BLACS_HOME}/lib/blacsF77init_MPI-LINUX-0.a + LIBS += ${BLACS_HOME}/lib/blacsCinit_MPI-LINUX-0.a + +####################################################################### +# MPI Options +####################################################################### + LMPI = T + MPI_COMPILE = mpifort + MPI_COMPILE_FREE = mpifort -ffree-form \ + -ffree-line-length-none -ffixed-line-length-none + MPI_COMPILE_C = mpicc + MPI_LINK = mpicc -shared -pthread -Wl,--no-undefined -Wl,-export-dynamic + MPI_RUN = srun + MPI_RUN_OPTS = -N 2 -n 64 -p general -t 2:00:00 -J STELLOPT_BENCH + MPI_RUN_OPTS_SM = -N 2 -n 64 -p general -t 2:00:00 -J STELLOPT_BENCH + MPI_RUN_OPTS_MD = -N 4 -n 128 -p general -t 2:00:00 -J STELLOPT_BENCH + MPI_RUN_OPTS_LG = -N 8 -n 256 -p general -t 2:00:00 -J STELLOPT_BENCH + +####################################################################### +# NAG Options +####################################################################### + LNAG = F + NAG_LIB = -L$(NAG_ROOT)/lib -lnag_nag + +####################################################################### +# NETCDF Options +####################################################################### + LNETCDF = T + NETCDF_INC = -I$(NETCDF_F)/include -I$(NETCDF_C)/include + NETCDF_LIB = -L$(NETCDF_C)/lib -lnetcdf -L$(NETCDF_F)/lib -lnetcdff + +####################################################################### +# NTCC Options +####################################################################### + LNTCC = T + NTCC_INC = -I$(NTCCHOME)/mod + NTCC_LIB = -L$(NTCCHOME)/lib -laladdinsub -lr8slatec -ladpak\ + -lcppsub -lcomput -lpspline -lportlib -lezcdf -lmds_sub \ + -lmdstransp -lvaxonly + +####################################################################### +# HDF5 Options +####################################################################### + LHDF5 = T + HDF5_INC = -I$(HDF5_HOME)/include + HDF5_LIB = -L$(HDF5_HOME)/lib -lhdf5_hl -lhdf5_fortran -lhdf5 \ + -lhdf5hl_fortran -lpthread -lz -lm + +####################################################################### +# PGPLOT Options +####################################################################### + LPGPLOT = F + PGPLOT_INC = + PGPLOT_LIB = -L$(PGPLOT_DIR) -lpgplot -L/usr/X11R6/lib -lX11 + +####################################################################### +# SILO Options +####################################################################### + LSILO = F + SILO_INC = -I$(SILOHOME)/include + SILO_LIB = -L$(SILOHOME)/lib -lsilo + +####################################################################### +# DKES/NEO Options +####################################################################### + LDKES = T + LNEO = T + +####################################################################### +# GENE Options +####################################################################### + LGENE = F + GENE_INC = -I$(GENE_PATH) + GENE_DIR = $(GENE_PATH) + LIB_GENE = libgene.a + GENE_LIB = $(GENE_DIR)/$(LIB_GENE) \ + -L$(FFTW_HOME)/lib -lfftw3 \ + -L$(SLEPC_DIR)/$(PETSC_ARCH)/lib -lslepc \ + -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc -lX11 + +####################################################################### +# COILOPT++ Options +####################################################################### + LCOILOPT = F + COILOPT_INC = -I$(COILOPT_PATH) + COILOPTPP_DIR = $(COILOPT_PATH) + LIB_COILOPTPP = libcoilopt++.a + COILOPT_LIB = $(COILOPT_PATH)/$(LIB_COILOPTPP) \ + -L$(GSLHOME)/lib -lgsl -lgslcblas -lstdc++ + +####################################################################### +# TERPSICHORE Options +####################################################################### + LTERPSICHORE= F + TERPSICHORE_INC = -I$(TERPSICHORE_PATH) + TERPSICHORE_DIR = $(TERPSICHORE_PATH) + LIB_TERPSICHORE = libterpsichore.a + TERPSICHORE_LIB = $(TERPSICHORE_DIR)/$(LIB_TERPSICHORE) + +####################################################################### +# TRAVIS Options +####################################################################### + LTRAVIS= F + TRAVIS_DIR = $(TRAVIS_PATH) + LIB_TRAVIS = libtravis64_sopt.a + LIB_MCONF = libmconf64.a + TRAVIS_LIB = $(TRAVIS_DIR)/lib/$(LIB_TRAVIS) \ + $(TRAVIS_DIR)/mag_conf/lib/$(LIB_MCONF) -lstdc++ + +####################################################################### +# REGCOIL Options +####################################################################### + LREGCOIL= T + REGCOIL_DIR = $(REGCOIL_PATH) + REGCOIL_INC = -I$(REGCOIL_DIR) + LIB_REGCOIL = libregcoil.a + REGCOIL_LIB = $(REGCOIL_DIR)/$(LIB_REGCOIL) -fopenmp + +####################################################################### +# SFINCS Options +####################################################################### + + LSFINCS = F + SFINCS_DIR = $(SFINCS_PATH) + SFINCS_INC = -I$(SFINCS_DIR) + LIB_SFINCS = libsfincs.a + SFINCS_LIB = $(SFINCS_DIR)/$(LIB_SFINCS) \ + -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc -lX11 + +####################################################################### +# LIBSTELL Shared Options +####################################################################### +LIB_SHARE = -lc -lgfortran -lstdc++ -lmpi -lmpi_mpifh -lz -lc -lm -lpthread $(LIBS) -lc + +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +# DO NOT EDIT BELOW HERE DO NOT EDIT BELOW HERE + +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### + +# Some Initial stuff +# HOME_BIN = $(MYHOME) +HOME_BIN = ../../ +MOD1_PATH = -I$(MYHOME)/libstell_dir +MOD_PATH = +CLEAN_ARCH = +LIB_DIR = ../../LIBSTELL +LIB = libstell.a + +# Handle Which Code is being CALLED +ifeq ($(MAKECMDGOALS),xstelloptv2) + PRECOMP += -DBNORM -DBEAMS3D_OPT -DJINV_OPT -DTXPORT_OPT -DDIAGNO_OPT -DSKS -DSKS2 + VMEC_DIR ?= ../../VMEC2000 + LIB_VMEC= libvmec.a + MOD_PATH+= -I$(VMEC_DIR)/$(LOCTYPE) + BEAMS3D_DIR = ../../BEAMS3D + LIB_BEAMS3D = libbeams3d.a + MOD_PATH+= -I$(BEAMS3D_DIR)/$(LOCTYPE) + BOOTSJ_DIR = ../../BOOTSJ + LIB_BOOTSJ = libbootsj.a + MOD_PATH+= -I$(BOOTSJ_DIR)/$(LOCTYPE) + BNORM_DIR = ../../BNORM + LIB_BNORM = libbnorm.a + MOD_PATH+= -I$(BNORM_DIR)/$(LOCTYPE) + BOOZ_DIR = ../../BOOZ_XFORM + LIB_BOOZ= libbooz.a + MOD_PATH+= -I$(BOOZ_DIR)/$(LOCTYPE) + COBRA_DIR = ../../COBRAVMEC + LIB_COBRA = libcobra.a + MOD_PATH+= -I$(COBRA_DIR)/$(LOCTYPE) + DIAGNO_DIR = ../../DIAGNO + LIB_DIAGNO= libdiagno.a + MOD_PATH+= -I$(DIAGNO_DIR)/$(LOCTYPE) + JINV_DIR = ../../J_INVARIANT + LIB_JINV = libjinv.a + MOD_PATH+= -I$(JINV_DIR)/$(LOCTYPE) + MGRID_DIR= ../../MAKEGRID + LIB_MGRID= libmakegrid.a + MOD_PATH+= -I$(MGRID_DIR)/$(LOCTYPE) + LIB_LINK= $(VMEC_DIR)/$(LOCTYPE)/$(LIB_VMEC) \ + $(BEAMS3D_DIR)/$(LOCTYPE)/$(LIB_BEAMS3D) \ + $(BOOTSJ_DIR)/$(LOCTYPE)/$(LIB_BOOTSJ) \ + $(BNORM_DIR)/$(LOCTYPE)/$(LIB_BNORM) \ + $(BOOZ_DIR)/$(LOCTYPE)/$(LIB_BOOZ) \ + $(COBRA_DIR)/$(LOCTYPE)/$(LIB_COBRA) \ + $(DIAGNO_DIR)/$(LOCTYPE)/$(LIB_DIAGNO) \ + $(JINV_DIR)/$(LOCTYPE)/$(LIB_JINV) \ + $(MGRID_DIR)/$(LOCTYPE)/$(LIB_MGRID) + ifeq ($(LDKES),T) + DKES_DIR = ../../DKES + LIB_DKES = libdkes.a + MOD_PATH += -I$(DKES_DIR)/$(LOCTYPE) + PRECOMP += -DDKES_OPT + LIB_LINK += $(DKES_DIR)/$(LOCTYPE)/$(LIB_DKES) + else + DKES_DIR = + LIB_DKES = + endif + ifeq ($(LNEO),T) + NEO_DIR = ../../NEO + LIB_NEO = libneo.a + MOD_PATH += -I$(NEO_DIR)/$(LOCTYPE) + PRECOMP += -DNEO_OPT + LIB_LINK += $(NEO_DIR)/$(LOCTYPE)/$(LIB_NEO) + else + NEO_DIR = + LIB_NEO = + endif +else ifeq ($(MAKECMDGOALS),help) +else ifeq ($(MAKECMDGOALS),test_stellopt) +else ifeq ($(MAKECMDGOALS),test_stellopt_coilopt) +else ifeq ($(MAKECMDGOALS),test_stellopt_gene) +else ifeq ($(MAKECMDGOALS),test_stellopt_regcoil) +else ifeq ($(MAKECMDGOALS),test_stellopt_sfincs) +else ifeq ($(MAKECMDGOALS),test_stellopt_terpsichore) +else ifeq ($(MAKECMDGOALS),test_stellopt_travis) +else + LGENE = F + LCOILOPT = F + LSFINCS = F + LREGCOIL= F + LTERPSICHORE = F + LTRAVIS = F +# LYOURNEWCODE = F +endif +ifeq ($(MAKECMDGOALS),xanimec) + PRECOMP += -D_ANIMEC +endif +ifeq ($(MAKECMDGOALS),xvmec2000) + PRECOMP += -DSKS -DSKS2 +endif +ifeq ($(MAKECMDGOALS),xsiesta) + PRECOMP += -DSKS -DSKS2 +endif +ifeq ($(MAKECMDGOALS),xgtovmi) + ifeq ($(LPGPLOT),T) + MOD1_PATH += $(PGPLOT_INC) + LIB_LINK += $(PGPLOT_LIB) + endif +endif +ifeq ($(MAKECMDGOALS),xdes_plot) + ifeq ($(LPGPLOT),T) + MOD1_PATH += $(PGPLOT_INC) + LIB_LINK += $(PGPLOT_LIB) + endif +endif + +# Other Codes +ifeq ($(LGENE),T) + MOD1_PATH += $(GENE_INC) + PRECOMP += -DGENE + MOD_PATH += -I$(GENE_DIR) +else + GENE_LIB = + GENE_DIR = + LIB_GENE = +endif +ifeq ($(LCOILOPT),T) + MOD1_PATH += $(COILOPT_INC) + PRECOMP += -DCOILOPTPP + MOD_PATH += -I$(COILOPTPP_DIR) +else + COILOPT_LIB = + COILOPTPP_DIR = + LIB_COILOPTPP = +endif +ifeq ($(LTERPSICHORE),T) + MOD1_PATH += $(TERPSICHORE_INC) + PRECOMP += -DTERPSICHORE + MOD_PATH += -I$(TERPSICHORE_DIR) +else + TERPSICHORE_LIB = + TERPSICHORE_DIR = + LIB_TERPSICHORE = +endif +ifeq ($(LTRAVIS),T) + PRECOMP += -DTRAVIS +else + TRAVIS_LIB = + TRAVIS_DIR = + LIB_TRAVIS = +endif +ifeq ($(LSFINCS),T) + MOD1_PATH += $(SFINCS_INC) + PRECOMP += -DSFINCS + MOD_PATH += -I$(SFINCS_DIR) +else + SFINCS_LIB = + SFINCS_DIR = + LIB_SFINCS = +endif +ifeq ($(LREGCOIL),T) + MOD1_PATH += $(REGCOIL_INC) + PRECOMP += -DREGCOIL + MOD_PATH += -I$(REGCOIL_DIR) +else + REGCOIL_LIB = + REGCOIL_DIR = + LIB_REGCOIL = +endif + +# Handle other codes +LIB_LINK += $(GENE_LIB) $(COILOPT_LIB) $(TERPSICHORE_LIB) $(TRAVIS_LIB) $(SFINCS_LIB) $(REGCOIL_LIB) + +# Add libraries to LIB_LINK +# LIB_LINK+= $(MYHOME)/libstell.a $(LIBS) +# This version avoids referencing the bin directory for the symbolic link to lib. +# Which we can't reference since we now have the awk file in the main directory. +LIB_LINK+= $(LIB_DIR)/$(LOCTYPE)/$(LIB) $(LIBS) + +# 3rd Party Libs +ifeq ($(LMPI),T) + PRECOMP += -DMPI_OPT + COMPILE = $(MPI_COMPILE) + COMPILE_FREE = $(MPI_COMPILE_FREE) + LINK = $(MPI_COMPILE) $(FLAGS) -o + LINK_C = $(MPI_LINK) +endif +ifeq ($(LNETCDF),T) + MOD1_PATH += $(NETCDF_INC) + PRECOMP += -DNETCDF + LIB_LINK += $(NETCDF_LIB) + MOD_PATH += $(NETCDF_INC) + LIB_SHARE += $(NETCDF_LIB) +endif +ifeq ($(LHDF5),T) + MOD1_PATH += $(HDF5_INC) + PRECOMP += -DLHDF5 -DH5_USE_16_API + LIB_LINK += $(HDF5_LIB) + MOD_PATH += $(HDF5_INC) + LIB_SHARE += $(HDF5_LIB) +endif +ifeq ($(LNAG),T) + PRECOMP += -DNAG + LIB_LINK += $(NAG_LIB) + LIB_SHARE += $(NAG_LIB) +endif +ifeq ($(LNTCC),T) + MOD1_PATH += $(NTCC_INC) + PRECOMP += -DLADAS -DNTCC + LIB_LINK += $(NTCC_LIB) + MOD_PATH += $(NTCC_INC) + LIB_SHARE += $(NTCC_LIB) +endif +ifeq ($(LSILO),T) + MOD1_PATH += $(SILO_INC) + PRECOMP += -DSILO_AVAI + LIB_LINK += $(SILO_LIB) + LIB_SHARE += $(SILO_LIB) +endif + +# This is hear because of MPI above resetting LINK +ifeq ($(MAKECMDGOALS),libstell.a) + LINK = $(LINK_AR) + COMPILE += -fPIC + COMPILE_FREE += -fPIC + INC_PATH = +endif +ifeq ($(MAKECMDGOALS),libstell.so) + LINK = $(LINK_C) + LIB_LINK = $(LIB_SHARE) + COMPILE += -fPIC + COMPILE_FREE += -fPIC + INC_PATH = +endif + +#This must come here +MOD_PATH+= -I diff --git a/SHARE/make_pppl_czhu_intel.inc b/SHARE/make_pppl_czhu_intel.inc new file mode 100644 index 000000000..9b599a556 --- /dev/null +++ b/SHARE/make_pppl_czhu_intel.inc @@ -0,0 +1,412 @@ +####################################################################### +# Define Basic Utilities +####################################################################### + SHELL = /bin/sh + PWD1 = `pwd` + MYHOME = $(HOME)/bin + PRECOMP:= fpp -C -P -DLINUX + COMPILE = ifort + COMPILE_FREE = ifort + LINK = ld $(FLAGS) -o + LINK_AR = ar -ruv + LINK_C = $(CC) -shared -Wl,--no-undefined -Wl,-export-dynamic + +####################################################################### +# Define Compiler Flags +####################################################################### + FLAGS_R = -mcmodel=large -O2 -m64 -unroll0 -fno-alias -ip -traceback \ + -init=zeros,arrays -I${MKLROOT}/include -mkl + FLAGS_D = -O0 -g -traceback -check all -check bounds \ + -check noarg_temp_created -check uninit \ + -ftrapuv -init=snan,arrays -debug all -I${MKLROOT}/include -mkl + + NETCDF_F = $(NETCDF_FORTRAN_HOME) + NETCDC_F = $(NETCDF_C_HOME) + + LIBS = ${MKLROOT}/lib/intel64/libmkl_blas95_lp64.a \ + ${MKLROOT}/lib/intel64/libmkl_lapack95_lp64.a -lpthread -lm -ldl \ + -L$(SCALAPACK_HOME)/lib -lscalapack + +# BLACS requires full links to library files + LIBS += ${BLACS_HOME}/lib/blacs_MPI-LINUX-0.a + LIBS += ${BLACS_HOME}/lib/blacsF77init_MPI-LINUX-0.a + LIBS += ${BLACS_HOME}/lib/blacsCinit_MPI-LINUX-0.a + +####################################################################### +# MPI Options +####################################################################### + LMPI = T + MPI_COMPILE = mpifort + MPI_COMPILE_FREE = mpifort + MPI_COMPILE_C = mpicc + MPI_LINK = mpifort -shared -fpic + MPI_RUN = srun + MPI_RUN_OPTS = -n 64 -p general -t 5:00:00 -J STELLOPT_BENCH + +####################################################################### +# NAG Options +####################################################################### + LNAG = F + NAG_LIB = -L$(NAG_ROOT)/lib -lnag_nag + +####################################################################### +# NETCDF Options +####################################################################### + LNETCDF = T + NETCDF_INC = -I$(NETCDF_F)/include -I$(NETCDF_C)/include + NETCDF_LIB = -L$(NETCDF_C)/lib -lnetcdf -L$(NETCDF_F)/lib -lnetcdff + +####################################################################### +# NTCC Options +####################################################################### + LNTCC = T + NTCC_INC = -I$(NTCCHOME)/mod + NTCC_LIB = -L$(NTCCHOME)/lib -laladdinsub -lr8slatec -ladpak\ + -lcppsub -lcomput -lpspline -lportlib -lezcdf -lmds_sub \ + -lmdstransp -lvaxonly +# NTCC_LIB = $(NTCCHOME)/lib/aladdinsub.a +# NTCC_LIB += $(NTCCHOME)/lib/r8slatec.a +# NTCC_LIB += $(NTCCHOME)/lib/adpak.a +# NTCC_LIB += $(NTCCHOME)/lib/cppsub.a +# NTCC_LIB += $(NTCCHOME)/lib/comput.a +# NTCC_LIB += $(NTCCHOME)/lib/pspline.a +# NTCC_LIB += $(NTCCHOME)/lib/portlib.a +# NTCC_LIB += $(NTCCHOME)/lib/ezcdf.a +# NTCC_LIB += $(NTCCHOME)/lib/mds_sub.a +# NTCC_LIB += $(NTCCHOME)/lib/mdstransp.a +# NTCC_LIB += $(NTCCHOME)/lib/vaxonly.a + +####################################################################### +# HDF5 Options +####################################################################### + LHDF5 = T + HDF5_INC = -I$(HDF5_HOME)/include + HDF5_LIB = -L$(HDF5_HOME)/lib -lhdf5_hl -lhdf5_fortran -lhdf5 \ + -lhdf5hl_fortran -lpthread -lz -lm + +####################################################################### +# PGPLOT Options +####################################################################### + LPGPLOT = F + PGPLOT_INC = + PGPLOT_LIB = -L$(PGPLOT_DIR) -lpgplot -L/usr/X11R6/lib -lX11 + +####################################################################### +# SILO Options +####################################################################### + LSILO = F + SILO_INC = -I$(SILOHOME)/include + SILO_LIB = -L$(SILOHOME)/lib -lsilo + +####################################################################### +# DKES/NEO Options +####################################################################### + LDKES = T + LNEO = T + +####################################################################### +# GENE Options +####################################################################### + LGENE = F + GENE_INC = -I$(GENE_PATH) + GENE_DIR = $(GENE_PATH) + LIB_GENE = libgene.a + GENE_LIB = $(GENE_DIR)/$(LIB_GENE) \ + -L$(FFTW_HOME)/lib -lfftw3 \ + -L$(SLEPC_DIR)/$(PETSC_ARCH)/lib -lslepc \ + -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc -lX11 + +####################################################################### +# COILOPT++ Options +####################################################################### + LCOILOPT = F + COILOPT_INC = -I$(COILOPT_PATH) + COILOPTPP_DIR = $(COILOPT_PATH) + LIB_COILOPTPP = libcoilopt++.a + COILOPT_LIB = $(COILOPT_PATH)/$(LIB_COILOPTPP) \ + -L$(GSLHOME)/lib -lgsl -lgslcblas -lstdc++ + +####################################################################### +# TERPSICHORE Options +####################################################################### + LTERPSICHORE= T + TERPSICHORE_INC = -I$(TERPSICHORE_PATH) + TERPSICHORE_DIR = $(TERPSICHORE_PATH) + LIB_TERPSICHORE = libterpsichore.a + TERPSICHORE_LIB = $(TERPSICHORE_DIR)/$(LIB_TERPSICHORE) + +####################################################################### +# TRAVIS Options +####################################################################### + LTRAVIS= F + TRAVIS_DIR = $(TRAVIS_PATH) + LIB_TRAVIS = libtravis64_sopt.a + LIB_MCONF = libmconf64.a + TRAVIS_LIB = $(TRAVIS_DIR)/lib/$(LIB_TRAVIS) \ + $(TRAVIS_DIR)/mag_conf/lib/$(LIB_MCONF) -lstdc++ + +####################################################################### +# REGCOIL Options +####################################################################### + LREGCOIL= T + REGCOIL_DIR = $(REGCOIL_PATH) + REGCOIL_INC = -I$(REGCOIL_DIR) + LIB_REGCOIL = libregcoil.a + REGCOIL_LIB = $(REGCOIL_DIR)/$(LIB_REGCOIL) -fopenmp + +####################################################################### +# SFINCS Options +####################################################################### + + LSFINCS = F + SFINCS_DIR = $(SFINCS_PATH) + SFINCS_INC = -I$(SFINCS_DIR) + LIB_SFINCS = libsfincs.a + SFINCS_LIB = $(SFINCS_DIR)/$(LIB_SFINCS) \ + -L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc -lX11 + +####################################################################### +# LIBSTELL Shared Options +####################################################################### +LIB_SHARE = -lc -lgfortran -lstdc++ -lmpi -lmpi_mpifh -lz -lc -lm -lpthread $(LIBS) -lc + +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +# DO NOT EDIT BELOW HERE DO NOT EDIT BELOW HERE + +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### +####################################################################### + +# Some Initial stuff +# HOME_BIN = $(MYHOME) +HOME_BIN = ../../ +MOD1_PATH = -I$(MYHOME)/libstell_dir +MOD_PATH = +CLEAN_ARCH = +LIB_DIR = ../../LIBSTELL +LIB = libstell.a + +# Handle Which Code is being CALLED +ifeq ($(MAKECMDGOALS),xstelloptv2) + #PRECOMP += -DBNORM -DBEAMS3D_OPT -DJINV_OPT -DTXPORT_OPT -DDIAGNO_OPT -DSKS -DSKS2 + PRECOMP += -DBNORM -DJINV_OPT -DTXPORT_OPT -DDIAGNO_OPT -DSKS -DSKS2 + VMEC_DIR ?= ../../VMEC2000 + LIB_VMEC= libvmec.a + MOD_PATH+= -I$(VMEC_DIR)/$(LOCTYPE) + BEAMS3D_DIR = ../../BEAMS3D + LIB_BEAMS3D = libbeams3d.a + MOD_PATH+= -I$(BEAMS3D_DIR)/$(LOCTYPE) + BOOTSJ_DIR = ../../BOOTSJ + LIB_BOOTSJ = libbootsj.a + MOD_PATH+= -I$(BOOTSJ_DIR)/$(LOCTYPE) + BNORM_DIR = ../../BNORM + LIB_BNORM = libbnorm.a + MOD_PATH+= -I$(BNORM_DIR)/$(LOCTYPE) + BOOZ_DIR = ../../BOOZ_XFORM + LIB_BOOZ= libbooz.a + MOD_PATH+= -I$(BOOZ_DIR)/$(LOCTYPE) + COBRA_DIR = ../../COBRAVMEC + LIB_COBRA = libcobra.a + MOD_PATH+= -I$(COBRA_DIR)/$(LOCTYPE) + DIAGNO_DIR = ../../DIAGNO + LIB_DIAGNO= libdiagno.a + MOD_PATH+= -I$(DIAGNO_DIR)/$(LOCTYPE) + JINV_DIR = ../../J_INVARIANT + LIB_JINV = libjinv.a + MOD_PATH+= -I$(JINV_DIR)/$(LOCTYPE) + MGRID_DIR= ../../MAKEGRID + LIB_MGRID= libmakegrid.a + MOD_PATH+= -I$(MGRID_DIR)/$(LOCTYPE) + LIB_LINK= $(VMEC_DIR)/$(LOCTYPE)/$(LIB_VMEC) \ + $(BEAMS3D_DIR)/$(LOCTYPE)/$(LIB_BEAMS3D) \ + $(BOOTSJ_DIR)/$(LOCTYPE)/$(LIB_BOOTSJ) \ + $(BNORM_DIR)/$(LOCTYPE)/$(LIB_BNORM) \ + $(BOOZ_DIR)/$(LOCTYPE)/$(LIB_BOOZ) \ + $(COBRA_DIR)/$(LOCTYPE)/$(LIB_COBRA) \ + $(DIAGNO_DIR)/$(LOCTYPE)/$(LIB_DIAGNO) \ + $(JINV_DIR)/$(LOCTYPE)/$(LIB_JINV) \ + $(MGRID_DIR)/$(LOCTYPE)/$(LIB_MGRID) + ifeq ($(LDKES),T) + DKES_DIR = ../../DKES + LIB_DKES = libdkes.a + MOD_PATH += -I$(DKES_DIR)/$(LOCTYPE) + PRECOMP += -DDKES_OPT + LIB_LINK += $(DKES_DIR)/$(LOCTYPE)/$(LIB_DKES) + else + DKES_DIR = + LIB_DKES = + endif + ifeq ($(LNEO),T) + NEO_DIR = ../../NEO + LIB_NEO = libneo.a + MOD_PATH += -I$(NEO_DIR)/$(LOCTYPE) + PRECOMP += -DNEO_OPT + LIB_LINK += $(NEO_DIR)/$(LOCTYPE)/$(LIB_NEO) + else + NEO_DIR = + LIB_NEO = + endif +else + LGENE = F + LCOILOPT = F + LTERPSICHORE = F + LTRAVIS = F + LREGCOIL= F + LSFINCS = F +# LYOURNEWCODE = F +endif +ifeq ($(MAKECMDGOALS),xanimec) + PRECOMP += -D_ANIMEC +endif +ifeq ($(MAKECMDGOALS),xvmec2000) + PRECOMP += -DSKS -DSKS2 +endif +ifeq ($(MAKECMDGOALS),xsiesta) + PRECOMP += -DSKS -DSKS2 +endif +ifeq ($(MAKECMDGOALS),xgtovmi) + ifeq ($(LPGPLOT),T) + MOD1_PATH += $(PGPLOT_INC) + LIB_LINK += $(PGPLOT_LIB) + endif +endif +ifeq ($(MAKECMDGOALS),xdes_plot) + ifeq ($(LPGPLOT),T) + MOD1_PATH += $(PGPLOT_INC) + LIB_LINK += $(PGPLOT_LIB) + endif +endif + +# Other Codes +ifeq ($(LGENE),T) + MOD1_PATH += $(GENE_INC) + PRECOMP += -DGENE + MOD_PATH += -I$(GENE_DIR) +else + GENE_LIB = + GENE_DIR = + LIB_GENE = +endif +ifeq ($(LCOILOPT),T) + MOD1_PATH += $(COILOPT_INC) + PRECOMP += -DCOILOPTPP + MOD_PATH += -I$(COILOPTPP_DIR) +else + COILOPT_LIB = + COILOPTPP_DIR = + LIB_COILOPTPP = +endif +ifeq ($(LTERPSICHORE),T) + MOD1_PATH += $(TERPSICHORE_INC) + PRECOMP += -DTERPSICHORE + MOD_PATH += -I$(TERPSICHORE_DIR) +else + TERPSICHORE_LIB = + TERPSICHORE_DIR = + LIB_TERPSICHORE = +endif +ifeq ($(LTRAVIS),T) + PRECOMP += -DTRAVIS +else + TRAVIS_LIB = + TRAVIS_DIR = + LIB_TRAVIS = +endif +ifeq ($(LSFINCS),T) + MOD1_PATH += $(SFINCS_INC) + PRECOMP += -DSFINCS + MOD_PATH += -I$(SFINCS_DIR) +else + SFINCS_LIB = + SFINCS_DIR = + LIB_SFINCS = +endif +ifeq ($(LREGCOIL),T) + MOD1_PATH += $(REGCOIL_INC) + PRECOMP += -DREGCOIL + MOD_PATH += -I$(REGCOIL_DIR) +else + REGCOIL_LIB = + REGCOIL_DIR = + LIB_REGCOIL = +endif + +# Handle other codes +LIB_LINK += $(GENE_LIB) $(COILOPT_LIB) $(TERPSICHORE_LIB) $(TRAVIS_LIB) $(SFINCS_LIB) $(REGCOIL_LIB) + +# Add libraries to LIB_LINK +# LIB_LINK+= $(MYHOME)/libstell.a $(LIBS) +# This version avoids referencing the bin directory for the symbolic link to lib. +# Which we can't reference since we now have the awk file in the main directory. +LIB_LINK+= $(LIB_DIR)/$(LOCTYPE)/$(LIB) $(LIBS) + +# 3rd Party Libs +ifeq ($(LMPI),T) + PRECOMP += -DMPI_OPT + COMPILE = $(MPI_COMPILE) + COMPILE_FREE = $(MPI_COMPILE_FREE) + LINK = $(MPI_COMPILE) $(FLAGS) -o + LINK_C = $(MPI_LINK) +endif +ifeq ($(LNETCDF),T) + MOD1_PATH += $(NETCDF_INC) + PRECOMP += -DNETCDF + LIB_LINK += $(NETCDF_LIB) + MOD_PATH += $(NETCDF_INC) + LIB_SHARE += $(NETCDF_LIB) +endif +ifeq ($(LHDF5),T) + MOD1_PATH += $(HDF5_INC) + PRECOMP += -DLHDF5 -DH5_USE_16_API + LIB_LINK += $(HDF5_LIB) + MOD_PATH += $(HDF5_INC) + LIB_SHARE += $(HDF5_LIB) +endif +ifeq ($(LNAG),T) + PRECOMP += -DNAG + LIB_LINK += $(NAG_LIB) + LIB_SHARE += $(NAG_LIB) +endif +ifeq ($(LNTCC),T) + MOD1_PATH += $(NTCC_INC) + PRECOMP += -DLADAS -DNTCC + LIB_LINK += $(NTCC_LIB) + MOD_PATH += $(NTCC_INC) + LIB_SHARE += $(NTCC_LIB) +endif +ifeq ($(LSILO),T) + MOD1_PATH += $(SILO_INC) + PRECOMP += -DSILO_AVAI + LIB_LINK += $(SILO_LIB) + LIB_SHARE += $(SILO_LIB) +endif + +# This is hear because of MPI above resetting LINK +ifeq ($(MAKECMDGOALS),libstell.a) + LINK = $(LINK_AR) + COMPILE += -fPIC + COMPILE_FREE += -fPIC + INC_PATH = +endif +ifeq ($(MAKECMDGOALS),libstell.so) + LINK = $(LINK_C) + LIB_LINK = $(LIB_SHARE) + COMPILE += -fPIC + COMPILE_FREE += -fPIC + INC_PATH = +endif + +#This must come here +MOD_PATH+= -I From 030a08dfe33c9f4b5b67ecff2e71ea1c1fac5fc0 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 3 Sep 2019 13:21:45 -0400 Subject: [PATCH 39/57] fix out of date mpi include --- TORLINES/Sources/torlines_init_wout.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TORLINES/Sources/torlines_init_wout.f90 b/TORLINES/Sources/torlines_init_wout.f90 index 224f7a765..11f674634 100644 --- a/TORLINES/Sources/torlines_init_wout.f90 +++ b/TORLINES/Sources/torlines_init_wout.f90 @@ -38,6 +38,9 @@ SUBROUTINE torlines_init_wout USE mpi_params USE EZspline_obj USE EZspline +!DEC$ IF DEFINED (MPI_OPT) + use mpi +!DEC$ ENDIF !----------------------------------------------------------------------- ! Local Variables ! iunit File Unit Number @@ -51,9 +54,6 @@ SUBROUTINE torlines_init_wout ! rho_in VMEC Rho !----------------------------------------------------------------------- IMPLICIT NONE -!DEC$ IF DEFINED (MPI_OPT) - INCLUDE 'mpif.h' -!DEC$ ENDIF INTEGER :: iunit, ier, mn, im, in, ik , i, j, ns1, k1,mn0,& u,v INTEGER :: bcs1(2) From 349ad548e8f477a512e8f354d24a6f0afe90aa57 Mon Sep 17 00:00:00 2001 From: lazersos Date: Fri, 6 Sep 2019 15:47:39 +0200 Subject: [PATCH 40/57] Minor bug update for consitency with ORNL version --- .../Sources/TimeStep/parallel_vmec_module.f90 | 70 ++++++------------- 1 file changed, 23 insertions(+), 47 deletions(-) diff --git a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 index 90aa3c5a9..ef7454240 100644 --- a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 +++ b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 @@ -414,9 +414,16 @@ SUBROUTINE FinalizeRunVmec(INCOMM) #if defined(MPI_OPT) CALL MPI_Comm_free(INCOMM, MPI_ERR) IF(LIFFREEB) CALL MPI_Comm_free(VAC_COMM,MPI_ERR) - INCOMM=0; VAC_COMM = 0 - rank = 0; par_ns = 0; nranks = 1 !SAL - grank = 0; gnranks = 1; vrank = 0; vnranks = 1; last_ns = -1; !SAL + INCOMM=0 + VAC_COMM = 0 + rank = 0 + IF (.not.LV3FITCALL) par_ns = 0 + nranks = 1 + grank = 0 + gnranks = 1 + vrank = 0 + vnranks = 1 + last_ns = -1 NS_RESLTN=0 vlactive = .FALSE. #endif @@ -925,8 +932,6 @@ SUBROUTINE GatherReordered4XArray(arr) INTEGER :: i INTEGER :: blksize, numjs INTEGER, ALLOCATABLE, DIMENSION(:) :: counts, disps - REAL(dp), ALLOCATABLE, DIMENSION(:,:,:,:) :: sendbuf - REAL(dp), ALLOCATABLE, DIMENSION(:) :: recvbuf REAL(dp) :: allgvton, allgvtoff !----------------------------------------------- IF (nranks.EQ.1 .OR. .NOT.lactive) THEN @@ -936,9 +941,7 @@ SUBROUTINE GatherReordered4XArray(arr) CALL second0(allgvton) blksize = (par_ntor + 1)*(par_mpol1 + 1)*3*par_ntmax - numjs = trglob - tlglob+1 - ALLOCATE(sendbuf(0:par_ntor,0:par_mpol1,1:3*par_ntmax,numjs)) - ALLOCATE(recvbuf(par_ns*blksize)) + numjs = trglob - tlglob + 1 ALLOCATE(counts(nranks),disps(nranks)) DO i = 1, nranks @@ -950,18 +953,9 @@ SUBROUTINE GatherReordered4XArray(arr) disps(i) = disps(i - 1) + counts(i - 1) END DO #if defined(MPI_OPT) - sendbuf(0:par_ntor,0:par_mpol1,1:3*par_ntmax,1:numjs)= & - arr(0:par_ntor,0:par_mpol1,1:3*par_ntmax,tlglob:trglob) - CALL MPI_Allgatherv(sendbuf, numjs*blksize, MPI_REAL8, recvbuf, & + CALL MPI_Allgatherv(MPI_IN_PLACE, numjs*blksize, MPI_REAL8, arr, & counts, disps, MPI_REAL8, NS_COMM, MPI_ERR) - DO i = 1, nranks - numjs = trglob_arr(i) - tlglob_arr(i) + 1 - arr(0:par_ntor,0:par_mpol1,1:3*par_ntmax,tlglob_arr(i):trglob_arr(i)) = & - RESHAPE(recvbuf(disps(i)+1:disps(i)+counts(i)),& - (/par_ntor+1,par_mpol1+1,3*par_ntmax,numjs/)) - END DO #endif - DEALLOCATE(sendbuf, recvbuf) DEALLOCATE(counts, disps) CALL second0(allgvtoff) allgather_time = allgather_time + (allgvtoff-allgvton) @@ -976,8 +970,6 @@ SUBROUTINE Gather2XArray(arr) INTEGER :: i INTEGER :: par_nsmin, par_nsmax, blksize, numjs INTEGER, ALLOCATABLE, DIMENSION(:) :: counts, disps - REAL(dp), ALLOCATABLE, DIMENSION(:,:) :: sendbuf - REAL(dp), ALLOCATABLE, DIMENSION(:) :: recvbuf REAL(dp) :: allgvton, allgvtoff !----------------------------------------------- IF (nranks.EQ.1 .OR. .NOT.lactive) THEN @@ -986,33 +978,23 @@ SUBROUTINE Gather2XArray(arr) CALL second0(allgvton) - blksize=par_nznt - numjs=trglob-tlglob+1 - ALLOCATE(sendbuf(par_nznt,numjs)) - ALLOCATE(recvbuf(par_ns*blksize)) + blksize = par_nznt + numjs = trglob - tlglob+1 ALLOCATE(counts(nranks),disps(nranks)) - DO i=1,nranks - counts(i)=(trglob_arr(i)-tlglob_arr(i)+1)*blksize + DO i = 1, nranks + counts(i) =(trglob_arr(i) - tlglob_arr(i) + 1)*blksize END DO disps(1) = 0 DO i = 2, nranks - disps(i) = disps(i - 1) + counts(i - 1) + disps(i) = disps(i - 1) + counts(i - 1) END DO #if defined(MPI_OPT) - sendbuf(1:par_nznt,1:numjs) = arr(1:par_nznt,tlglob:trglob) - CALL MPI_Allgatherv(sendbuf, numjs*blksize, MPI_REAL8, recvbuf, & + CALL MPI_Allgatherv(MPI_IN_PLACE, numjs*blksize, MPI_REAL8, arr, & counts, disps, MPI_REAL8, NS_COMM, MPI_ERR) - DO i = 1, nranks - numjs = trglob_arr(i) - tlglob_arr(i) + 1 - arr(1:par_nznt,tlglob_arr(i):trglob_arr(i)) = & - RESHAPE(recvbuf(disps(i)+1:disps(i)+counts(i)),& - (/par_nznt,numjs/)) - END DO #endif - DEALLOCATE(sendbuf, recvbuf) DEALLOCATE(counts, disps) CALL second0(allgvtoff) allgather_time = allgather_time + (allgvtoff-allgvton) @@ -1023,7 +1005,6 @@ END SUBROUTINE Gather2XArray SUBROUTINE Gather1XArray(arr) !----------------------------------------------- REAL(dp), DIMENSION(par_ns), INTENT(INOUT) :: arr - REAL(dp), ALLOCATABLE, DIMENSION(:) :: sendbuf, recvbuf INTEGER :: i, numjs INTEGER, ALLOCATABLE, DIMENSION(:) :: counts, disps @@ -1035,27 +1016,22 @@ SUBROUTINE Gather1XArray(arr) CALL second0(allgvton) - numjs=trglob-tlglob+1 - ALLOCATE (sendbuf(numjs),recvbuf(par_ns)) + numjs = trglob - tlglob + 1 ALLOCATE(counts(nranks),disps(nranks)) DO i=1,nranks - counts(i)=(trglob_arr(i)-tlglob_arr(i)+1) + counts(i) = (trglob_arr(i) - tlglob_arr(i) + 1) END DO disps(1)=0 - DO i=2,nranks - disps(i)=disps(i-1)+counts(i-1) + DO i = 2,nranks + disps(i)= disps(i - 1) +counts(i - 1) END DO #if defined(MPI_OPT) - sendbuf(1:numjs) = arr(tlglob:trglob) - CALL MPI_Allgatherv(sendbuf, numjs, MPI_REAL8, recvbuf, counts, & + CALL MPI_Allgatherv(MPI_IN_PLACE, numjs, MPI_REAL8, arr, counts, & disps, MPI_REAL8, NS_COMM, MPI_ERR) #endif - arr = recvbuf - - DEALLOCATE(sendbuf, recvbuf) DEALLOCATE(counts, disps) CALL second0(allgvtoff) allgather_time = allgather_time + (allgvtoff - allgvton) From dcf05d6fcaea35095a8702b1a883ccc337ec8db5 Mon Sep 17 00:00:00 2001 From: Samuel Lazerson Date: Mon, 9 Sep 2019 08:25:52 +0200 Subject: [PATCH 41/57] Updated Draco script --- SHARE/make_draco.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SHARE/make_draco.inc b/SHARE/make_draco.inc index ecc07054e..824fbd8d4 100644 --- a/SHARE/make_draco.inc +++ b/SHARE/make_draco.inc @@ -128,7 +128,7 @@ LIB_TRAVIS = libtravis64_sopt.a LIB_MCONF = libmconf64.a TRAVIS_LIB = $(TRAVIS_DIR)/lib/$(LIB_TRAVIS) \ - $(TRAVIS_DIR)/magconf/lib/$(LIB_MCONF) -lstdc++ + $(TRAVIS_DIR)/mag_conf/lib/$(LIB_MCONF) -lstdc++ ####################################################################### # SFINCS Options From 352bea592ae4333029e9365a2b69fbd63389d535 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 9 Sep 2019 11:49:15 +0200 Subject: [PATCH 42/57] Added base file for testing orbits --- BENCHMARKS/BEAMS3D_TEST/input.ORBITS | 41 +++++++++++++++++++++++++ BENCHMARKS/BEAMS3D_TEST/wout_ORBITS.nc | Bin 0 -> 67112 bytes 2 files changed, 41 insertions(+) create mode 100644 BENCHMARKS/BEAMS3D_TEST/input.ORBITS create mode 100644 BENCHMARKS/BEAMS3D_TEST/wout_ORBITS.nc diff --git a/BENCHMARKS/BEAMS3D_TEST/input.ORBITS b/BENCHMARKS/BEAMS3D_TEST/input.ORBITS new file mode 100644 index 000000000..4ce3a3f6c --- /dev/null +++ b/BENCHMARKS/BEAMS3D_TEST/input.ORBITS @@ -0,0 +1,41 @@ +&INDATA +!----- Runtime Parameters ----- + DELT = 1.00000000000000E+00 + NITER = 20000 + NSTEP = 200 + TCON0 = 1.00000000000000E+00 + NS_ARRAY = 16 32 64 128 + FTOL_ARRAY = 1.0E-30 1.0E-30 1.0E-30 1.0E-20 + NITER_ARRAY = 1000 2000 4000 20000 +!----- Grid Parameters ----- + LASYM = F + NFP = 1 + MPOL = 2 + NTOR = 0 + PHIEDGE = 6.28 + PHIEDGE = 15.7 +!----- Free Boundary Parameters ----- + LFREEB = F +!----- Pressure Parameters ----- + GAMMA = 0.00000000000000E+00 + BLOAT = 0.00000000000000E+00 + SPRES_PED = 0.00000000000000E+00 + PRES_SCALE = 0.00000000000000E+00 + PMASS_TYPE = 'power_series' + AM = 1.00000000000000E+00 -1.00000000000000E+00 0.00000000000000E+00 + 0.00000000000000E+00 -1.00000000000000E+00 1.00000000000000E+00 +!----- Current/Iota Parameters ----- + NCURR = 0 + PIOTA_TYPE = 'power_series' + AI = 1.0 -0.25 -0.50 +!----- Axis Parameters ----- + RAXIS = 1.00000000000000E+01 + ZAXIS = 0.00000000000000E+00 +!----- Boundary Parameters ----- +RBC( 0, 0) = 1.0000000000e+01 ZBS( 0, 0) = 0.0000000000e+00 +RBC( 0, 1) = 1.0000000000e+00 ZBS( 0, 1) = 1.0000000000e+00 +!RBC( 1, 1) = 5.0000000000e-05 ZBS( 1, 1) = -5.0000000000e-05 +!RBC( 1, 2) = 0.0000000000e+00 ZBS( 1, 2) = 0.0000000000e+00 +!RBC( 1, 3) = 5.0000000000e-05 ZBS( 1, 3) = 5.0000000000e-05 +!----- Created by write_vmec 13-Jan-2012 15:12:17 ----- +/ diff --git a/BENCHMARKS/BEAMS3D_TEST/wout_ORBITS.nc b/BENCHMARKS/BEAMS3D_TEST/wout_ORBITS.nc new file mode 100644 index 0000000000000000000000000000000000000000..1ba58adbca70b47e64e8bd7f8dd30ffc57567322 GIT binary patch literal 67112 zcmeFZ2UHYG*Y``#IfE!UNe~buiB&@eNg`kXMRJfNQG$X2MUsGuiV;M_04PQTr5hzG zU_dYrAUWrZ+?r9&%X!XuJkNXY_uX%;@3q#N{&iRXtM;zFtGauJVe}1*s3?9ECIn{m zVs!KNb5d4TQC9v@@AhAHs!Mg%|5c}~`cucVtWH_wM_Wn+dOv?BzW_IPQVq!#^Uq@^ z|A;+Hb+rCYApt?8BMJ&q8@j+C_h9!B@-Z*z*x${=&v`HTnA8znkh7b2XfXLW7Hw%l zy!}Y^Bwv>bX)Ipo#SrEm6zm<~@3eH{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 Subject: [PATCH 43/57] Fixed bug which would prevent test particle runs --- BEAMS3D/Sources/beams3d_init.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BEAMS3D/Sources/beams3d_init.f90 b/BEAMS3D/Sources/beams3d_init.f90 index 80ea16322..b267d519c 100644 --- a/BEAMS3D/Sources/beams3d_init.f90 +++ b/BEAMS3D/Sources/beams3d_init.f90 @@ -185,7 +185,7 @@ SUBROUTINE beams3d_init END IF ! Put the plasma field on the background grid - IF (lvmec .and. .not.lvac .and. nte > 0) THEN + IF (lvmec .and. .not.lvac) THEN CALL mpialloc(req_axis, nphi, myid_sharmem, 0, MPI_COMM_SHARMEM, win_req_axis) CALL mpialloc(zeq_axis, nphi, myid_sharmem, 0, MPI_COMM_SHARMEM, win_zeq_axis) CALL beams3d_init_vmec From a0ded774a0be078c6a44cb53e4553229bbcc9dda Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 9 Sep 2019 16:54:27 +0200 Subject: [PATCH 44/57] Added testing routine for BEAMS3D (banana orbit info) --- BENCHMARKS/BEAMS3D_TEST/input.ORBITS | 36 ++++++++++ BENCHMARKS/BEAMS3D_TEST/test_ORBITS.py | 98 ++++++++++++++++++++++++++ BENCHMARKS/makefile | 9 +++ 3 files changed, 143 insertions(+) create mode 100755 BENCHMARKS/BEAMS3D_TEST/test_ORBITS.py diff --git a/BENCHMARKS/BEAMS3D_TEST/input.ORBITS b/BENCHMARKS/BEAMS3D_TEST/input.ORBITS index 4ce3a3f6c..30978fe84 100644 --- a/BENCHMARKS/BEAMS3D_TEST/input.ORBITS +++ b/BENCHMARKS/BEAMS3D_TEST/input.ORBITS @@ -39,3 +39,39 @@ RBC( 0, 1) = 1.0000000000e+00 ZBS( 0, 1) = 1.0000000000e+00 !RBC( 1, 3) = 5.0000000000e-05 ZBS( 1, 3) = 5.0000000000e-05 !----- Created by write_vmec 13-Jan-2012 15:12:17 ----- / +&BEAMS3D_INPUT + NR = 128 + NZ = 128 + NPHI = 32 + RMIN = 9.00 + RMAX = 11.00 + ZMIN = -1.00 + ZMAX = 1.00 + PHIMIN = 0.00000000000000E+00 + PHIMAX = 6.28318530718 + INT_TYPE = 'LSODE' + FOLLOW_TOL = 1.00000000000000E-08 + VC_ADAPT_TOL = 1.00E-03 + R_START_IN = 40*10.5 + Z_START_IN = 40*0.0 + PHI_START_IN = 40*0.0 + CHARGE_IN = 40*1.60217733E-19 + MASS_IN = 40*1.6726231E-27 + ZATOM_IN = 40*1.0 + T_END_IN = 40*1.0E-3 + NPOINC = 1000 + VLL_START_IN = 4.3767277259E+04 8.7521428600E+04 1.3124934778E+05 1.7493796783E+05 2.1857428054E+05 2.6214535568E+05 + 3.0563836005E+05 3.4904057609E+05 3.9233942017E+05 4.3552246036E+05 4.7857743375E+05 5.2149226315E+05 + 5.6425507318E+05 6.0685420574E+05 6.4927823469E+05 6.9151597983E+05 7.3355652011E+05 7.7538920600E+05 + 8.1700367103E+05 8.5838984243E+05 8.9953795097E+05 9.4043853987E+05 9.8108247275E+05 1.0214609408E+06 + 1.0615654689E+06 1.1013879211E+06 1.1409205047E+06 1.1801557741E+06 1.2190866335E+06 1.2577063383E+06 + 1.2960084967E+06 1.3339870693E+06 1.3716363692E+06 1.4089510599E+06 1.4459261541E+06 1.4825570104E+06 + 1.5188393303E+06 1.5547691543E+06 1.5903428569E+06 1.6255571421E+06 + MU_START_IN = 3.2040342566E-15 3.2030734306E-15 3.2014733340E-15 3.1992358826E-15 3.1963637506E-15 3.1928603627E-15 + 3.1887298836E-15 3.1839772059E-15 3.1786079357E-15 3.1726283762E-15 3.1660455093E-15 3.1588669756E-15 + 3.1511010522E-15 3.1427566301E-15 3.1338431883E-15 3.1243707683E-15 3.1143499465E-15 3.1037918055E-15 + 3.0927079046E-15 3.0811102500E-15 3.0690112633E-15 3.0564237505E-15 3.0433608700E-15 3.0298361006E-15 + 3.0158632094E-15 3.0014562196E-15 2.9866293783E-15 2.9713971254E-15 2.9557740614E-15 2.9397749174E-15 + 2.9234145242E-15 2.9067077830E-15 2.8896696366E-15 2.8723150412E-15 2.8546589399E-15 2.8367162358E-15 + 2.8185017680E-15 2.8000302866E-15 2.7813164309E-15 2.7623747069E-15 +/ diff --git a/BENCHMARKS/BEAMS3D_TEST/test_ORBITS.py b/BENCHMARKS/BEAMS3D_TEST/test_ORBITS.py new file mode 100755 index 000000000..9687d8cff --- /dev/null +++ b/BENCHMARKS/BEAMS3D_TEST/test_ORBITS.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +import sys, os +sys.path.insert(0, '../../pySTEL/') +import numpy as np #For Arrays +from math import pi +from libstell.beams3d import read_beams3d + +try: + qtCreatorPath=os.environ["STELLOPT_PATH"] +except KeyError: + print("Please set environment variable STELLOPT_PATH") + sys.exit(1) + +lfail = 0 +failtol = 1.0 +filename='beams3d_ORBITS.h5' +data=read_beams3d(filename) +if not data: + print('ERROR Opening File: '+filename) + sys.exit(0) + +# Calc values +rho = np.sqrt(data['S_lines']) +rho_max = np.max(rho,axis=1) +rho_min = np.min(rho,axis=1) +data['delta'] = rho_max-rho_min +x = data['R_lines']-10.0 +y = data['Z_lines'] +theta = np.arctan2(y,x) +theta = np.where(theta > np.pi,theta-pi,theta) +data['turning'] = np.max(theta,axis=1) +data['R0']=data['R_lines'][:,0] +data['R1']=data['R_lines'][:,1] +data['R100']=data['R_lines'][:,100] +data['R500']=data['R_lines'][:,500] + +print('BEAMS3D VERSION: ' + str(data['VERSION'])) +print('==== Vectors ====') +varlist={} +varlist['turning']=np.array([0.12275448, 0.1788069, 0.23483922, 0.29094046, 0.34722868, 0.40375728, + 0.46065893, 0.51799329, 0.57587523, 0.63441059, 0.69368621, 0.75391989, + 0.81514834, 0.87755329, 0.94131251, 1.0066042, 1.073641, 1.14261056, + 1.21404663, 1.2880335, 1.36508321, 1.44570684, 1.53053939, 1.62039918, + 1.71639094, 1.81999506, 1.93335501, 2.05975875, 2.20481267, 2.37949053, + 2.61309783, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, + 0.00000000, 0.00000000, 0.00000000, 0.00000000 ]) +varlist['delta']= np.array([0.00946046, 0.01374876, 0.01800757, 0.02223544, 0.026432, 0.03059698,\ + 0.03473095, 0.038831, 0.04289777, 0.04693171, 0.05093049, 0.05489528,\ + 0.05882575, 0.06272063, 0.06658121, 0.07040614, 0.07419578, 0.07794811,\ + 0.08166657, 0.08535033, 0.08900042, 0.09261682, 0.09619758, 0.09974838,\ + 0.10326324, 0.10674989, 0.11020544, 0.11363556, 0.11703701, 0.12041313,\ + 0.12377785, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000,\ + 0.00000000, 0.00000000, 0.00000000, 0.00000000]) +varlist['R0'] = np.array([10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5,\ + 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, \ + 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5]) +varlist['R1'] = np.array([10.49999249, 10.4999768, 10.49995341, 10.49992237, 10.49988369, 10.49983742,\ + 10.49978361, 10.49972231, 10.49965359, 10.49957753, 10.49949421, 10.49940373,\ + 10.49930618, 10.49920166, 10.49909031, 10.49897222, 10.49884755, 10.49871641,\ + 10.49857895, 10.49843531, 10.49828565, 10.49813011, 10.49796888, 10.49780209,\ + 10.49762991, 10.49745252, 10.49727009, 10.49708281, 10.49689083, 10.49669435,\ + 10.49649352, 10.49628857, 10.49607966, 10.49586693, 10.49565066, 10.49543094,\ + 10.49520799, 10.49498197, 10.49475306, 10.49452144]) +varlist['R100'] = np.array([10.49952811, 10.49841904, 10.49681967, 10.49483304, 10.492617, 10.49038081,\ + 10.48835247, 10.48679273, 10.48597115, 10.48610144, 10.48735746, 10.48975565,\ + 10.49305676, 10.49667017, 10.4994585, 10.49956161, 10.49424657, 10.47989742,\ + 10.45232043, 10.40751938, 10.3430584, 10.25952967, 10.16163861, 10.05781398,\ + 9.95865638, 9.87499126, 9.81717158, 9.79843648, 9.84903473, 10.06874637,\ + 10.6121399, 9.52383909, 10.30811992, 9.75552682, 9.55757415, 9.49714706,\ + 9.53072501, 9.65828663, 9.8739292, 10.13929343]) +varlist['R500'] = np.array([10.50935564, 10.51357954, 10.51765357, 10.52124379, 10.52347226, 10.52254675,\ + 10.51578596, 10.50004569, 10.4733993, 10.43816937, 10.40258562, 10.38083631, + 10.38821076, 10.43096549, 10.48682747, 10.48925378, 10.38571913, 10.24399162, + 10.19729589, 10.3383645, 10.57590636, 10.4012457, 10.04725902, 10.08337319, + 10.4931221, 10.02518826, 9.89786486, 10.5743704, 9.68899905, 10.29549756, + 10.40735214, 9.48140819, 9.51059377, 9.7825418, 10.21186358, 9.52381988, + 10.35010235, 9.61176158, 9.92985194, 10.13460947]) +for temp in varlist: + act = varlist[temp] + cal = data[temp] + cal = np.where(act==0,0,cal) + div = np.where(act==0,1,act) + perct = 100*sum(abs(act-cal)/div) + print(' '+temp+': '+str(cal[0])+' '+str(act[0])+' '+str(int(perct))+'%') + if perct > failtol: + lfail = 1 +print('=================') + +if (lfail): + print(' STATUS: FAIL!!!!!') +else: + print(' STATUS: PASS') + +sys.exit(0) + + + + diff --git a/BENCHMARKS/makefile b/BENCHMARKS/makefile index 1da0ca40f..48233713d 100644 --- a/BENCHMARKS/makefile +++ b/BENCHMARKS/makefile @@ -7,6 +7,7 @@ # Setup Subdirectories VMEC_TEST_DIR = VMEC_TEST DIAGNO_TEST_DIR = DIAGNO_TEST + BEAMS3D_TEST_DIR = BEAMS3D_TEST STELLOPT_TEST_DIR = STELLOPT_TEST # We do the following to handle Testing on Large Systems @@ -68,6 +69,13 @@ test_diagno: @cd $(DIAGNO_TEST_DIR); ./compare_DIIID_m24n0s99_nfp1.py @echo "" +test_beams3d: + @echo "Beginning testing of BEAMS3D" + @cd $(BEAMS3D_TEST_DIR); rm -f *.h5 *.txt; + @echo $(MPI_RUN) $(MPI_RUN_OPTS_SM) $(MYHOME)/xbeams3d -vmec ORBITS -plasma + @cd $(BEAMS3D_TEST_DIR); ./test_ORBITS.py + @echo "" + test_stellopt: @echo "Beginning testing of STELLOPT" $(MAKE) test_stellopt_lmdif @@ -232,5 +240,6 @@ help: @echo " COMMANDS" @echo " test_vmec Tesing of VMEC" @echo " test_diagno Tesing of DIAGNO" + @echo " test_beams Tesing of BEAMS3D" @echo " test_stellopt Tesing of STELLOPT" @echo " clean_test Remove files generated by tests" From b71f7a1107d24d2e12e5a179821f8c172af986d9 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 9 Sep 2019 16:54:57 +0200 Subject: [PATCH 45/57] Added routine to read beams3d output --- pySTEL/libstell/beams3d.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pySTEL/libstell/beams3d.py diff --git a/pySTEL/libstell/beams3d.py b/pySTEL/libstell/beams3d.py new file mode 100644 index 000000000..8ad4f7be2 --- /dev/null +++ b/pySTEL/libstell/beams3d.py @@ -0,0 +1,30 @@ +def read_beams3d(file): + import h5py + import numpy as np + beams_data = {} + #read file + with h5py.File(file,'r') as f: + # Logicals + for temp in ['lascot', 'lbeam', 'lbeam_simple', 'lcoil', 'lcollision', 'ldepo', 'lflux', 'lmgrid', 'lpies', 'lspec',\ + 'lvac', 'lvessel', 'lvmec']: + if temp in f: + beams_data[temp] = np.int(f[temp][0]) + # Integers + for temp in ['nbeams', 'nface', 'nparticles', 'nphi', 'npoinc', 'nz', 'nsteps', 'nvertex', 'nz']: + if temp in f: + beams_data[temp] = np.int(f[temp][0]) + # Floats + for temp in ['VERSION','iota0']: + if temp in f: + beams_data[temp] = np.float(f[temp][0]) + # Arrays + for temp in ['B_PHI', 'B_R', 'B_Z', 'B_lines', 'NE', 'PE_lines', 'PHI_lines', 'PI_lines', 'POT_ARR', 'R_lines',\ + 'S_ARR', 'S_lines', 'Shinethrough', 'TE', 'TI', 'U_ARR', 'U_lines', 'ZEFF_ARR', 'Z_lines', 'Zatom', \ + 'charge','mass','moment_lines','neut_lines','phiaxis','raxis','t_end','vll_lines','wall_faces','wall_strikes',\ + 'wall_vertex','zaxis']: + if temp in f: + beams_data[temp] = np.array(f[temp][:]) + # Make derived arrays + beams_data['X_lines'] = beams_data['R_lines']*np.cos(beams_data['PHI_lines']) + beams_data['Y_lines'] = beams_data['R_lines']*np.sin(beams_data['PHI_lines']) + return beams_data \ No newline at end of file From dd08b382b249e165b75c7b1e5279061cb7e5c06d Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 9 Sep 2019 17:10:12 +0200 Subject: [PATCH 46/57] Fix for BEAMS3D test --- BENCHMARKS/makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BENCHMARKS/makefile b/BENCHMARKS/makefile index 48233713d..f6244a296 100644 --- a/BENCHMARKS/makefile +++ b/BENCHMARKS/makefile @@ -73,6 +73,7 @@ test_beams3d: @echo "Beginning testing of BEAMS3D" @cd $(BEAMS3D_TEST_DIR); rm -f *.h5 *.txt; @echo $(MPI_RUN) $(MPI_RUN_OPTS_SM) $(MYHOME)/xbeams3d -vmec ORBITS -plasma + @cd $(BEAMS3D_TEST_DIR); $(MPI_RUN) $(MPI_RUN_OPTS_SM) $(MYHOME)/xbeams3d -vmec ORBITS -plasma @cd $(BEAMS3D_TEST_DIR); ./test_ORBITS.py @echo "" @@ -240,6 +241,6 @@ help: @echo " COMMANDS" @echo " test_vmec Tesing of VMEC" @echo " test_diagno Tesing of DIAGNO" - @echo " test_beams Tesing of BEAMS3D" + @echo " test_beams3d Tesing of BEAMS3D" @echo " test_stellopt Tesing of STELLOPT" @echo " clean_test Remove files generated by tests" From eb288dd7806188b0a56cc9259768d0192057ed7a Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Mon, 9 Sep 2019 11:54:51 -0400 Subject: [PATCH 47/57] update stellopt_version --- STELLOPTV2/Sources/Modules/stellopt_runtime.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STELLOPTV2/Sources/Modules/stellopt_runtime.f90 b/STELLOPTV2/Sources/Modules/stellopt_runtime.f90 index 69c7f541e..c7f18c9ec 100644 --- a/STELLOPTV2/Sources/Modules/stellopt_runtime.f90 +++ b/STELLOPTV2/Sources/Modules/stellopt_runtime.f90 @@ -210,7 +210,7 @@ MODULE stellopt_runtime CHARACTER(256) :: id_string, opt_type, proc_string, & proc_string_old, screen_str, xvec_file - REAL(rprec), PARAMETER :: STELLOPT_VERSION = 2.65 + REAL(rprec), PARAMETER :: STELLOPT_VERSION = 2.70 REAL(rprec), PARAMETER :: bigno = 1.0E+10 !----------------------------------------------------------------------- From 395de605f93f8daa729705a3aa3a61e82d77b3c3 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Mon, 9 Sep 2019 13:33:43 -0400 Subject: [PATCH 48/57] revert input.IOTA_LMDIF --- BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF b/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF index 79790cf95..a99bd2441 100644 --- a/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF +++ b/BENCHMARKS/STELLOPT_TEST/IOTA_LMDIF/input.IOTA_LMDIF @@ -56,11 +56,11 @@ FTOL = 1.00E-06 XTOL = 1.00E-06 GTOL = 1.00E-30 - FACTOR = 100.0 + FACTOR = 1.0 EPSFCN = 1.00E-06 MODE = 1 LKEEP_MINS = T - NOPTIMIZERS = -1 + NOPTIMIZERS = 8 !----------------------------------------------------------------------- ! OPTIMIZED QUANTITIES !----------------------------------------------------------------------- From 7b9be126390b32d48323d51a8ca1fc958fa4ec39 Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 10 Sep 2019 09:57:20 +0200 Subject: [PATCH 49/57] Fixed energy and pitch angle for ASCOT interface --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 61 +++++++++++++---------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 693725035..7f6d22a0f 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -19,7 +19,7 @@ SUBROUTINE beams3d_write_ascoth5(write_type) zaxis, phiaxis, S_ARR, U_ARR, POT_ARR, & ZEFF_ARR, TE, TI, NE, req_axis, zeq_axis, npot, & POT_SPL_S, ezspline_interp, phiedge_eq, TE_spl_s, & - NE_spl_s, TI_spl_s, ZEFF_spl_s + NE_spl_s, TI_spl_s, ZEFF_spl_s, nne, nte, nti, nzeff USE beams3d_runtime, ONLY: id_string, npoinc, nbeams, beam, t_end, lverb, lflux, & lvmec, lpies, lspec, lcoil, lmgrid, lbeam, & lvessel, lvac, lbeam_simple, handle_err, nparticles_start, & @@ -83,11 +83,18 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DRHO',ier,DBLVAR=DBLE(1.0)) CALL write_var_hdf5(qid_gid,'ADAPTIVE_MAX_DPHI',ier,DBLVAR=DBLE(2)) CALL write_var_hdf5(qid_gid,'ENABLE_ORBIT_FOLLOWING',ier,DBLVAR=DBLE(1)) - CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(1)) + IF (lbeam) THEN + CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) + ELSE + CALL write_var_hdf5(qid_gid,'ENABLE_COULOMB_COLLISIONS',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(1)) + END IF CALL write_var_hdf5(qid_gid,'DISABLE_FIRSTORDER_GCTRANS',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_ENERGY_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_PITCH_CCOLL',ier,DBLVAR=DBLE(0)) - CALL write_var_hdf5(qid_gid,'DISABLE_GCDIFF_CCOLL',ier,DBLVAR=DBLE(0)) CALL write_var_hdf5(qid_gid,'ENDCOND_SIMTIMELIM',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_CPUTIMELIM',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'ENDCOND_RHOLIM',ier,DBLVAR=DBLE(0)) @@ -120,13 +127,13 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'DIST_MAX_TIME',ier,DBLVAR=DBLE(1)) CALL write_var_hdf5(qid_gid,'DIST_MIN_CHARGE',ier,DBLVAR=DBLE(-2)) CALL write_var_hdf5(qid_gid,'DIST_MAX_CHARGE',ier,DBLVAR=DBLE(2)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_R',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_Z',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_PHI',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_RHO',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_THETA',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_R',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_Z',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_PHI',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_RHO',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_THETA',ier,DBLVAR=DBLE(8)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_TIME',ier,DBLVAR=DBLE(npoinc)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_CHARGE',ier,DBLVAR=DBLE(5)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_CHARGE',ier,DBLVAR=DBLE(2)) CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) ! If we enable this we need to write more CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(options_gid, ier) @@ -225,14 +232,16 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'charge',ier,INTVAR=1) CALL write_var_hdf5(qid_gid,'mass',ier,INTVAR=1) ALLOCATE(rtemp(nr,5,1)) + rtemp = 0 + rtemp(:,5,1) = 1 DO i = 1, nr - rtemp(i,1,1)=DBLE(i-1)/DBLE(nr-1) - CALL EZspline_interp( TE_spl_s, rtemp(i,1,1), rtemp(i,2,1), ier) - CALL EZspline_interp( NE_spl_s, rtemp(i,1,1), rtemp(i,3,1), ier) - CALL EZspline_interp( TI_spl_s, rtemp(i,1,1), rtemp(i,4,1), ier) - CALL EZspline_interp( ZEFF_spl_s, rtemp(i,1,1), rtemp(i,5,1), ier) - rtemp(i,5,1)=rtemp(i,3,1)/rtemp(i,5,1) + rtemp(i,1,1)=DBLE(i-1)/DBLE(nr-1) END DO + IF (nte > 0) CALL EZspline_interp( TE_spl_s, nr, rtemp(:,1,1), rtemp(:,2,1), ier) + IF (nne > 0) CALL EZspline_interp( NE_spl_s, nr, rtemp(:,1,1), rtemp(:,3,1), ier) + IF (nti > 0) CALL EZspline_interp( TI_spl_s, nr, rtemp(:,1,1), rtemp(:,4,1), ier) + IF (nzeff > 0) CALL EZspline_interp( ZEFF_spl_s, nr, rtemp(:,1,1), rtemp(:,5,1), ier) + rtemp(:,5,1)=rtemp(:,3,1)/rtemp(:,5,1) CALL write_var_hdf5( qid_gid, 'rho', nr, ier, DBLVAR=rtemp(1:nr,1,1)) CALL write_var_hdf5( qid_gid, 'etemperature', nr, ier, DBLVAR=rtemp(1:nr,2,1)) CALL write_var_hdf5( qid_gid, 'edensity', nr, ier, DBLVAR=rtemp(1:nr,3,1)) @@ -344,11 +353,11 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'DIST_MAX_VPA',ier,DBLVAR=DBLE(partvmax)) CALL write_var_hdf5(qid_gid,'DIST_MIN_VPE',ier,DBLVAR=DBLE(-partvmax)) CALL write_var_hdf5(qid_gid,'DIST_MAX_VPE',ier,DBLVAR=DBLE(partvmax)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_VR',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPHI',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_VZ',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPA',ier,DBLVAR=DBLE(16)) - CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPE',ier,DBLVAR=DBLE(16)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VR',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPHI',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VZ',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPA',ier,DBLVAR=DBLE(8)) + CALL write_var_hdf5(qid_gid,'DIST_NBIN_VPE',ier,DBLVAR=DBLE(8)) CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(options_gid, ier) ! Close file @@ -362,17 +371,19 @@ SUBROUTINE beams3d_write_ascoth5(write_type) ! 2: Gyrocenter d1 = LBOUND(R_lines,DIM=2) d2 = UBOUND(R_lines,DIM=2) - d3 = 2 + d3 = 0 + IF (lbeam) d3 = 2 ALLOCATE(rtemp(d1:d2,13,1)) DO i = d1, d2 CALL RANDOM_NUMBER(dbl_temp) + rtemp(i,6,1) = dbl_temp*pi2 ! zeta rtemp(i,1,1) = R_lines(d3,i) rtemp(i,2,1) = PHI_lines(d3,i) rtemp(i,3,1) = Z_lines(d3,i) dbl_temp = 2*B_lines(d3,i)*moment_lines(d3,i)/mass(i) ! V_perp^2 - rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp)*e_charge + rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp)/e_charge + !rtemp(i,4,1) = 0.5*mass(i)*(vll_lines(d3,i)*vll_lines(d3,i)+dbl_temp) rtemp(i,5,1) = vll_lines(d3,i)/SQRT(dbl_temp+vll_lines(d3,i)*vll_lines(d3,i)) ! pitch - rtemp(i,6,1) = dbl_temp*pi2 ! zeta rtemp(i,7,1) = NINT(mass(i)*5.97863320194E26) ! mass rtemp(i,8,1) = Zatom(i) rtemp(i,9,1) = NINT(mass(i)*5.97863320194E26) ! Anum From b6bbaa09a49ec491a2d2ec6e8255339e112d1436 Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 10 Sep 2019 09:59:31 +0200 Subject: [PATCH 50/57] Ignoring files in the BEAMS3D test area --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 915311368..bf4155526 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ CMakeLists.txt */Debug/*.f90 */Debug/*.f BENCHMARKS/STELLOPT_TEST/*/* +BENCHMARKS/BEAMS3D_TEST/* update* COILGEOM bin From 7a55d1e59505433d4f0ce5b8f228cb787b40452b Mon Sep 17 00:00:00 2001 From: lazersos Date: Tue, 10 Sep 2019 14:36:26 +0200 Subject: [PATCH 51/57] Few minor bug fixes to run benchmark with ASCOT --- BEAMS3D/Sources/beams3d_write_ascoth5.f90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 index 7f6d22a0f..8b9bf71b6 100644 --- a/BEAMS3D/Sources/beams3d_write_ascoth5.f90 +++ b/BEAMS3D/Sources/beams3d_write_ascoth5.f90 @@ -134,7 +134,12 @@ SUBROUTINE beams3d_write_ascoth5(write_type) CALL write_var_hdf5(qid_gid,'DIST_NBIN_THETA',ier,DBLVAR=DBLE(8)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_TIME',ier,DBLVAR=DBLE(npoinc)) CALL write_var_hdf5(qid_gid,'DIST_NBIN_CHARGE',ier,DBLVAR=DBLE(2)) - CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) ! If we enable this we need to write more + CALL write_var_hdf5(qid_gid,'ENABLE_ORBITWRITE',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ORBITWRITE_MODE',ier,DBLVAR=DBLE(1)) + CALL write_var_hdf5(qid_gid,'ORBITWRITE_NPOINT',ier,DBLVAR=DBLE(npoinc)) + CALL write_var_hdf5(qid_gid,'ORBITWRITE_INTERVAL',ier,DBLVAR=DBLE(MAXVAL(t_end_in))/DBLE(npoinc)) + CALL write_var_hdf5(qid_gid,'ORBITWRITE_TOROIDALANGLES',ier,DBLVAR=DBLE(0)) + CALL write_var_hdf5(qid_gid,'ORBITWRITE_POLOIDALANGLES',ier,DBLVAR=DBLE(0)) CALL h5gclose_f(qid_gid, ier) CALL h5gclose_f(options_gid, ier) From 043997553791907d90d16fa052bfaa7992ad0414 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 10 Sep 2019 11:22:30 -0400 Subject: [PATCH 52/57] Revert "Fix several non-initialized / non-allocated errors in VMEC2000; update LIBSTELL.dep in debug" This reverts commit 6c13c55b1d97f750ea77987c25240c168f208cb3. --- LIBSTELL/Debug/LIBSTELL.dep | 33 ------------------- LIBSTELL/Sources/Modules/read_wout_mod.f90 | 16 ++++----- VMEC2000/Sources/General/funct3d.f | 1 - .../Initialization_Cleanup/allocate_ns.f | 6 ---- VMEC2000/Sources/Input_Output/eqfor.f | 2 +- VMEC2000/Sources/Input_Output/wrout.f | 32 ++++++++---------- .../Sources/TimeStep/parallel_vmec_module.f90 | 18 +++++----- 7 files changed, 32 insertions(+), 76 deletions(-) diff --git a/LIBSTELL/Debug/LIBSTELL.dep b/LIBSTELL/Debug/LIBSTELL.dep index 68d38db22..28e323b8f 100644 --- a/LIBSTELL/Debug/LIBSTELL.dep +++ b/LIBSTELL/Debug/LIBSTELL.dep @@ -1,9 +1,6 @@ # Microsoft Developer Studio Generated Dependency File, included by LIBSTELL.mak -mpi_sharmem.o : - xvec_eval.o : \ - mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -143,7 +140,6 @@ integration_path.o : \ init_bg_currents.o : \ - mpi_inc.o \ biotsavart.o \ bcoils_mod.o \ mpi_params.o \ @@ -171,7 +167,6 @@ init_saddle_currents.o : \ init_saddle_wsurf.o : \ - mpi_inc.o \ mpi_params.o \ saddle_surface.o @@ -502,7 +497,6 @@ crosovr.o : \ DE_driver.o : \ - mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -517,7 +511,6 @@ DE_Evaluate.o : \ MAP.o : \ - mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -525,7 +518,6 @@ MAP.o : \ eval_x_queued.o : \ - mpi_inc.o \ safe_open_mod.o \ stel_kinds.o @@ -536,7 +528,6 @@ MAP_HYPERS.o : \ MAP_LINEAR.o : \ - mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -544,7 +535,6 @@ MAP_LINEAR.o : \ GENERIC_Evolve.o : \ - mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -552,7 +542,6 @@ GENERIC_Evolve.o : \ MAP_PLANE.o : \ - mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -560,7 +549,6 @@ MAP_PLANE.o : \ DE_Evolve.o : \ - mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -568,7 +556,6 @@ DE_Evolve.o : \ PSO_Evolve.o : \ - mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -576,7 +563,6 @@ PSO_Evolve.o : \ DE2_Evolve.o : \ - mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -584,14 +570,12 @@ DE2_Evolve.o : \ ROCKET_Evolve.o : \ - mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o de_mpi.o : \ - mpi_inc.o \ de_mod.o \ mpi_params.o @@ -614,7 +598,6 @@ enorm.o : \ fdjac_mod.o : \ - mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o @@ -633,7 +616,6 @@ ga_decode.o : \ GA_driver.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o \ @@ -641,7 +623,6 @@ GA_driver.o : \ ga_evalout.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -651,7 +632,6 @@ ga_evaluate.o : \ ga_fitness_mpi.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -661,38 +641,32 @@ ga_fitness_parallel.o : \ ga_initial.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o ga_micro.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o ga_mutate.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o ga_newgen.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o ga_niche.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o ga_possibl.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -702,7 +676,6 @@ GA_preset.o : \ ga_restart.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o @@ -721,14 +694,12 @@ ga_shuffle.o : \ ga_sp.o : \ - mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o lmdif.o : \ - mpi_inc.o \ fdjac_mod.o \ lmpar_mod.o \ mpi_params.o \ @@ -750,7 +721,6 @@ lmpar.o : \ lmpar_mod.o : \ - mpi_inc.o \ safe_open_mod.o \ fdjac_mod.o \ mpi_params.o \ @@ -1035,7 +1005,6 @@ read_boozer_mod.o : \ read_response.o : \ - mpi_inc.o \ bsc_cdf.o \ ezcdf.o \ mpi_params.o \ @@ -1239,7 +1208,6 @@ li_gesl.o : \ stepopt_mp.o : \ - mpi_inc.o \ stel_kinds.o \ fdjac_mod.o \ safe_open_mod.o \ @@ -1247,7 +1215,6 @@ stepopt_mp.o : \ mgrid_field_mod.o : \ - mpi_inc.o \ stel_kinds.o \ mgrid_mod.o \ ezspline_obj.o \ diff --git a/LIBSTELL/Sources/Modules/read_wout_mod.f90 b/LIBSTELL/Sources/Modules/read_wout_mod.f90 index 8ad753609..14487d908 100755 --- a/LIBSTELL/Sources/Modules/read_wout_mod.f90 +++ b/LIBSTELL/Sources/Modules/read_wout_mod.f90 @@ -2336,12 +2336,12 @@ SUBROUTINE Compute_Currents(bsubsmnc_, bsubsmns_, & USE stel_constants, ONLY: mu0 IMPLICIT NONE - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubsmnc_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubsmns_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubumnc_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubumns_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubvmnc_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(in) :: bsubvmns_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubsmnc_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubsmns_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubumnc_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubumns_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubvmnc_ + REAL(rprec), DIMENSION(:,:), INTENT(in) :: bsubvmns_ REAL(rprec), DIMENSION(:), INTENT(in) :: xm_nyq_ REAL(rprec), DIMENSION(:), INTENT(in) :: xn_nyq_ @@ -2352,8 +2352,8 @@ SUBROUTINE Compute_Currents(bsubsmnc_, bsubsmns_, & REAL(rprec), DIMENSION(:,:), INTENT(out) :: currumnc_ REAL(rprec), DIMENSION(:,:), INTENT(out) :: currvmnc_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(out) :: currumns_ - REAL(rprec), DIMENSION(:,:), ALLOCATABLE, INTENT(out) :: currvmns_ + REAL(rprec), DIMENSION(:,:), INTENT(out) :: currumns_ + REAL(rprec), DIMENSION(:,:), INTENT(out) :: currvmns_ !----------------------------------------------- ! L o c a l V a r i a b l e s diff --git a/VMEC2000/Sources/General/funct3d.f b/VMEC2000/Sources/General/funct3d.f index ee91f4a2c..0dba7f7fe 100644 --- a/VMEC2000/Sources/General/funct3d.f +++ b/VMEC2000/Sources/General/funct3d.f @@ -512,7 +512,6 @@ SUBROUTINE funct3d (lscreen, ier_flag) xtempa = xc CALL getrz(xc) #endif - IF (ictrl_prec2d .EQ. 3) THEN gc(:neqs2) = scalxc(:neqs2)*(xc(:neqs2)+xcdot(:neqs2)) ELSE diff --git a/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f b/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f index ed05d7340..c9b168058 100644 --- a/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f +++ b/VMEC2000/Sources/Initialization_Cleanup/allocate_ns.f @@ -176,7 +176,6 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) STOP 'allocation error #10 in allocate_ns' END IF pxc(:neqs2) = zero - pscalxc(:neqs2) = zero END IF IF (ALLOCATED(pxc_old)) THEN @@ -190,10 +189,6 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) ALLOCATE(gc(neqs2), xcdot(neqs2), xsave(neqs2), & xstore(neqs2), col_scale(neqs2), stat=istat1) xstore = zero - xcdot = zero - gc = zero - xsave = zero - col_scale = zero IF (istat1 .NE. 0) THEN STOP 'allocation error #9 in allocate_ns' END IF @@ -204,7 +199,6 @@ SUBROUTINE allocate_ns (linterp, neqs2_old) STOP 'allocation error #10 in allocate_ns' END IF xc(:neqs2) = zero - scalxc = zero END IF IF (ALLOCATED(xc_old)) THEN diff --git a/VMEC2000/Sources/Input_Output/eqfor.f b/VMEC2000/Sources/Input_Output/eqfor.f index 97b863c9f..1b7f12e3c 100644 --- a/VMEC2000/Sources/Input_Output/eqfor.f +++ b/VMEC2000/Sources/Input_Output/eqfor.f @@ -693,7 +693,7 @@ SUBROUTINE eqfor(br, bz, bsubu, bsubv, tau, rzl_array, ier_flag) vvc_smaleli = smaleli ! Save result for v3fit. betai = 2*factor*sump musubi = vnorm*factor*musubi - dmusubi_meas = 2*twopi*factor*delphid_exact*rbtor ! delphid replaced; czhu 20190904 + dmusubi_meas = 2*twopi*factor*delphid*rbtor lambda = p5*smaleli + betai s11 = er - rshaf*sigr0 !Shafranov def. based on RT, Eq.(12) s12 = er - rcen*sigr0 !R = Rgeometric diff --git a/VMEC2000/Sources/Input_Output/wrout.f b/VMEC2000/Sources/Input_Output/wrout.f index 22df564e1..717342418 100644 --- a/VMEC2000/Sources/Input_Output/wrout.f +++ b/VMEC2000/Sources/Input_Output/wrout.f @@ -33,7 +33,7 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, #ifdef NETCDF USE ezcdf USE read_wout_mod, ONLY: Compute_Currents, - 1 vn_version, vn_extension, vn_mgrid, + 1 vn_version, vn_extension, vn_mgrid, 1 vn_magen, vn_therm, vn_gam, vn_maxr, vn_minr, vn_maxz, vn_fp, 2 vn_radnod, vn_polmod, vn_tormod, vn_maxmod, vn_maxit, vn_actit, 3 vn_asym, vn_recon, vn_free, vn_error, vn_aspect, vn_beta, @@ -1113,16 +1113,14 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, END DO END DO END DO MN3 - - IF (lasym) THEN - gmns(:,js) = gmn(:) - bmns(:,js) = bmn(:) - bsubumns(:,js) = bsubumn(:) - bsubvmns(:,js) = bsubvmn(:) - bsubsmnc(:,js) = bsubsmn(:) - bsupumns(:,js) = bsupumn(:) - bsupvmns(:,js) = bsupvmn(:) - END IF + + gmns(:,js) = gmn(:) + bmns(:,js) = bmn(:) + bsubumns(:,js) = bsubumn(:) + bsubvmns(:,js) = bsubvmn(:) + bsubsmnc(:,js) = bsubsmn(:) + bsupumns(:,js) = bsupumn(:) + bsupvmns(:,js) = bsupvmn(:) #ifdef _ANIMEC pparmns(:,js) = pparmn(:) ppermns(:,js) = ppermn(:) @@ -1134,13 +1132,11 @@ SUBROUTINE wrout(bsq, gsqrt, bsubu, bsubv, bsubs, bsupv, bsupu, #endif END DO RADIUS3 - IF (lasym) THEN - gmns(:,1) = 0; bmns(:,1) = 0 - bsubumns(:,1) = 0 - bsubvmns(:,1) = 0 - bsubsmnc(:,1) = 2*bsubsmnc(:,2) - bsubsmnc(:,3) - bsupumns(:,1) = 0; bsupvmns(:,1) = 0 - END IF + gmns(:,1) = 0; bmns(:,1) = 0 + bsubumns(:,1) = 0 + bsubvmns(:,1) = 0 + bsubsmnc(:,1) = 2*bsubsmnc(:,2) - bsubsmnc(:,3) + bsupumns(:,1) = 0; bsupvmns(:,1) = 0 #ifdef _ANIMEC hotdmns(:,1) = 0; pparmns(:,1) = 0; ppermns(:,1) = 0 pbprmns(:,1) = 0; ppprmns(:,1) = 0 diff --git a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 index 64e517352..90aa3c5a9 100644 --- a/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 +++ b/VMEC2000/Sources/TimeStep/parallel_vmec_module.f90 @@ -54,15 +54,15 @@ MODULE parallel_vmec_module CHARACTER*100 :: envvar CHARACTER*100 :: envval - REAL(dp) :: bcyclic_comp_time = 0 - REAL(dp) :: bcyclic_comm_time = 0 - REAL(dp) :: waitall_time = 0 - REAL(dp) :: dgemm_time = 0 - REAL(dp) :: dgetrf_time = 0 - REAL(dp) :: dgetrs_time = 0 - REAL(dp) :: dgemv_time = 0 - REAL(dp) :: ForwardSolveLoop_time = 0 - REAL(dp), DIMENSION(12) :: t=0 + REAL(dp) :: bcyclic_comp_time + REAL(dp) :: bcyclic_comm_time + REAL(dp) :: waitall_time + REAL(dp) :: dgemm_time + REAL(dp) :: dgetrf_time + REAL(dp) :: dgetrs_time + REAL(dp) :: dgemv_time + REAL(dp) :: ForwardSolveLoop_time + REAL(dp), DIMENSION(12) :: t REAL(dp) :: allgather_time=0 REAL(dp) :: allreduce_time=0 From 02178ebeba2e295059d5646c78cc0e18fc0f60c7 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 10 Sep 2019 11:25:51 -0400 Subject: [PATCH 53/57] revert VMEC changes, fix LIBSTELL dependance --- LIBSTELL/Debug/LIBSTELL.dep | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/LIBSTELL/Debug/LIBSTELL.dep b/LIBSTELL/Debug/LIBSTELL.dep index 28e323b8f..68d38db22 100644 --- a/LIBSTELL/Debug/LIBSTELL.dep +++ b/LIBSTELL/Debug/LIBSTELL.dep @@ -1,6 +1,9 @@ # Microsoft Developer Studio Generated Dependency File, included by LIBSTELL.mak +mpi_sharmem.o : + xvec_eval.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -140,6 +143,7 @@ integration_path.o : \ init_bg_currents.o : \ + mpi_inc.o \ biotsavart.o \ bcoils_mod.o \ mpi_params.o \ @@ -167,6 +171,7 @@ init_saddle_currents.o : \ init_saddle_wsurf.o : \ + mpi_inc.o \ mpi_params.o \ saddle_surface.o @@ -497,6 +502,7 @@ crosovr.o : \ DE_driver.o : \ + mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -511,6 +517,7 @@ DE_Evaluate.o : \ MAP.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -518,6 +525,7 @@ MAP.o : \ eval_x_queued.o : \ + mpi_inc.o \ safe_open_mod.o \ stel_kinds.o @@ -528,6 +536,7 @@ MAP_HYPERS.o : \ MAP_LINEAR.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -535,6 +544,7 @@ MAP_LINEAR.o : \ GENERIC_Evolve.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -542,6 +552,7 @@ GENERIC_Evolve.o : \ MAP_PLANE.o : \ + mpi_inc.o \ mpi_params.o \ safe_open_mod.o \ gade_mod.o \ @@ -549,6 +560,7 @@ MAP_PLANE.o : \ DE_Evolve.o : \ + mpi_inc.o \ de_mod.o \ gade_mod.o \ mpi_params.o \ @@ -556,6 +568,7 @@ DE_Evolve.o : \ PSO_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -563,6 +576,7 @@ PSO_Evolve.o : \ DE2_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ gade_mod.o \ @@ -570,12 +584,14 @@ DE2_Evolve.o : \ ROCKET_Evolve.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o de_mpi.o : \ + mpi_inc.o \ de_mod.o \ mpi_params.o @@ -598,6 +614,7 @@ enorm.o : \ fdjac_mod.o : \ + mpi_inc.o \ safe_open_mod.o \ mpi_params.o \ stel_kinds.o @@ -616,6 +633,7 @@ ga_decode.o : \ GA_driver.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o \ @@ -623,6 +641,7 @@ GA_driver.o : \ ga_evalout.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -632,6 +651,7 @@ ga_evaluate.o : \ ga_fitness_mpi.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -641,32 +661,38 @@ ga_fitness_parallel.o : \ ga_initial.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o ga_micro.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_mutate.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_newgen.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_niche.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o ga_possibl.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o @@ -676,6 +702,7 @@ GA_preset.o : \ ga_restart.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o @@ -694,12 +721,14 @@ ga_shuffle.o : \ ga_sp.o : \ + mpi_inc.o \ ga_mod.o \ mpi_params.o \ safe_open_mod.o lmdif.o : \ + mpi_inc.o \ fdjac_mod.o \ lmpar_mod.o \ mpi_params.o \ @@ -721,6 +750,7 @@ lmpar.o : \ lmpar_mod.o : \ + mpi_inc.o \ safe_open_mod.o \ fdjac_mod.o \ mpi_params.o \ @@ -1005,6 +1035,7 @@ read_boozer_mod.o : \ read_response.o : \ + mpi_inc.o \ bsc_cdf.o \ ezcdf.o \ mpi_params.o \ @@ -1208,6 +1239,7 @@ li_gesl.o : \ stepopt_mp.o : \ + mpi_inc.o \ stel_kinds.o \ fdjac_mod.o \ safe_open_mod.o \ @@ -1215,6 +1247,7 @@ stepopt_mp.o : \ mgrid_field_mod.o : \ + mpi_inc.o \ stel_kinds.o \ mgrid_mod.o \ ezspline_obj.o \ From 94acfeaf161c02c2049917160c8ce203f986c169 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 10 Sep 2019 15:03:52 -0400 Subject: [PATCH 54/57] revise intel flags --- SHARE/make_pppl_czhu_intel.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SHARE/make_pppl_czhu_intel.inc b/SHARE/make_pppl_czhu_intel.inc index 9b599a556..d2e1b1d81 100644 --- a/SHARE/make_pppl_czhu_intel.inc +++ b/SHARE/make_pppl_czhu_intel.inc @@ -15,10 +15,10 @@ # Define Compiler Flags ####################################################################### FLAGS_R = -mcmodel=large -O2 -m64 -unroll0 -fno-alias -ip -traceback \ - -init=zeros,arrays -I${MKLROOT}/include -mkl + -init=zero,arrays -I${MKLROOT}/include -mkl FLAGS_D = -O0 -g -traceback -check all -check bounds \ -check noarg_temp_created -check uninit \ - -ftrapuv -init=snan,arrays -debug all -I${MKLROOT}/include -mkl + -ftrapuv -init=zero,arrays -debug all -I${MKLROOT}/include -mkl NETCDF_F = $(NETCDF_FORTRAN_HOME) NETCDC_F = $(NETCDF_C_HOME) From 180e738f61566d8383a0e489fadcb8be2b8b5f3f Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 16 Sep 2019 08:25:50 +0200 Subject: [PATCH 55/57] Outputs HDF5 Version information in BEAMS3D --- BEAMS3D/Sources/beams3d_main.f90 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index fbdd3ccea..e40cb94c5 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -14,6 +14,9 @@ PROGRAM BEAMS3D USE wall_mod, ONLY: wall_free USE mpi_params USE mpi_inc +!DEC$ IF DEFINED (LHDF5) + USE hdf5 +!DEC$ ENDIF !----------------------------------------------------------------------- ! Local Variables @@ -25,6 +28,7 @@ PROGRAM BEAMS3D !----------------------------------------------------------------------- IMPLICIT NONE integer :: numargs, i, ier, nshar, vmajor, vminor, liblen + integer :: h5major, h5minor, h5rel integer, parameter :: arg_len = 256 character(LEN=MPI_MAX_LIBRARY_VERSION_STRING) :: mpi_lib_name character*(arg_len) :: arg1 @@ -47,6 +51,9 @@ PROGRAM BEAMS3D CALL MPI_COMM_SIZE(MPI_COMM_SHARMEM, nshar, ierr_mpi) ! MPI CALL MPI_GET_VERSION(vmajor,vminor,ier) CALL MPI_GET_LIBRARY_VERSION(mpi_lib_name,liblen,ier) +!DEC$ ENDIF +!DEC$ IF DEFINED (LHDF5) + CALL H5GET_LIBVERSION_F(h5major, h5minor, h5rel, ier) !DEC$ ENDIF pi = 4.0 * ATAN(1.0) pi2 = 8.0 * ATAN(1.0) @@ -180,6 +187,10 @@ PROGRAM BEAMS3D END DO DEALLOCATE(args) WRITE(6, '(a,f5.2)') 'BEAMS3D Version ', BEAMS3D_VERSION +!DEC$ IF DEFINED (LHDF5) + WRITE(6,'(A)') '----- HDF5 Parameters ----' + WRITE(6,'(A,I2,2(A,I2.2))') ' HDF5_version: ', h5major,'.',h5minor,' release: ',h5rel +!DEC$ ENDIF WRITE(6,'(A)') '----- MPI Parameters -----' WRITE(6,'(A,I2,A,I2.2)') ' MPI_version: ', vmajor,'.',vminor WRITE(6,'(A,A)') ' ', TRIM(mpi_lib_name(1:liblen)) From 60490ebe3abfae446826e0d65ffbf73e31855801 Mon Sep 17 00:00:00 2001 From: lazersos Date: Mon, 16 Sep 2019 08:32:34 +0200 Subject: [PATCH 56/57] BEAMS3D: Outputs Parallel HDF5 message if enabled --- BEAMS3D/Sources/beams3d_main.f90 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BEAMS3D/Sources/beams3d_main.f90 b/BEAMS3D/Sources/beams3d_main.f90 index e40cb94c5..43450cb76 100644 --- a/BEAMS3D/Sources/beams3d_main.f90 +++ b/BEAMS3D/Sources/beams3d_main.f90 @@ -28,7 +28,7 @@ PROGRAM BEAMS3D !----------------------------------------------------------------------- IMPLICIT NONE integer :: numargs, i, ier, nshar, vmajor, vminor, liblen - integer :: h5major, h5minor, h5rel + integer :: h5major, h5minor, h5rel, h5par integer, parameter :: arg_len = 256 character(LEN=MPI_MAX_LIBRARY_VERSION_STRING) :: mpi_lib_name character*(arg_len) :: arg1 @@ -54,7 +54,12 @@ PROGRAM BEAMS3D !DEC$ ENDIF !DEC$ IF DEFINED (LHDF5) CALL H5GET_LIBVERSION_F(h5major, h5minor, h5rel, ier) + h5par = 0 !DEC$ ENDIF +!DEC$ IF DEFINED (HDF5_PAR) + h5par = 1 +!DEC$ ENDIF + pi = 4.0 * ATAN(1.0) pi2 = 8.0 * ATAN(1.0) mu0 = (16.0E-7) * ATAN(1.0) @@ -188,7 +193,11 @@ PROGRAM BEAMS3D DEALLOCATE(args) WRITE(6, '(a,f5.2)') 'BEAMS3D Version ', BEAMS3D_VERSION !DEC$ IF DEFINED (LHDF5) - WRITE(6,'(A)') '----- HDF5 Parameters ----' + IF (h5par > 0) THEN + WRITE(6,'(A)') '----- HDF5 (Parallel) Parameters -----' + ELSE + WRITE(6,'(A)') '----- HDF5 Parameters -----' + ENDIF WRITE(6,'(A,I2,2(A,I2.2))') ' HDF5_version: ', h5major,'.',h5minor,' release: ',h5rel !DEC$ ENDIF WRITE(6,'(A)') '----- MPI Parameters -----' From c90a4cbdf2f141c353aba909ce2cc6c8222dd031 Mon Sep 17 00:00:00 2001 From: Caoxiang Zhu Date: Tue, 17 Sep 2019 15:24:33 -0400 Subject: [PATCH 57/57] remove the make shared_release --- LIBSTELL/makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/LIBSTELL/makefile b/LIBSTELL/makefile index cc915fe5d..fce363405 100644 --- a/LIBSTELL/makefile +++ b/LIBSTELL/makefile @@ -19,7 +19,6 @@ release: @rm -f $(REL)\*.f; rm -f $(REL)\*.f90 @rm -f $(MYHOME)/$(EXE_F) @-(umask 022; rm -f $(MYHOME)/$(EXE_F); ln -fs $(REL_PATH)/$(EXE_F) $(MYHOME) 2> /dev/null; umask 077) - @make shared_release @echo "Release version - libstell.a - is now updated" @echo "To free up space, delete all *.o files from Release" @echo "" @@ -38,7 +37,6 @@ clean_release: @echo "CLEAN REMAKE IN PROGRESS" @cd $(REL); make -f $(MAKE) clean @make release - @make shared_release clean_debug: @echo "CLEAN REMAKE IN PROGRESS"