Skip to content

Commit

Permalink
Merge pull request #27 from PrincetonUniversity/develop
Browse files Browse the repository at this point in the history
Merge V2.70 into master
  • Loading branch information
Caoxiang Zhu authored Oct 30, 2019
2 parents bd4dca8 + f180f83 commit 05e013b
Show file tree
Hide file tree
Showing 53 changed files with 2,599 additions and 323 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CMakeLists.txt
*/Debug/*.f90
*/Debug/*.f
BENCHMARKS/STELLOPT_TEST/*/*
BENCHMARKS/BEAMS3D_TEST/*
update*
COILGEOM
bin
Expand Down
1 change: 1 addition & 0 deletions BEAMS3D/ObjectList
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ObjectFiles = \
beams3d_write_ascoth5.o \
beams3d_write_parhdf5.o \
beams3d_init_beams_w7x.o \
beams3d_lines.o \
Expand Down
12 changes: 12 additions & 0 deletions BEAMS3D/Release/BEAMS3D.dep
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ 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_write_parhdf5.o \
beams3d_grid.o


beams3d_write_parhdf5.o: \
../../LIBSTELL/Release/stel_kinds.o \
../../LIBSTELL/Release/ez_hdf5.o \
Expand Down
26 changes: 25 additions & 1 deletion BEAMS3D/Sources/beams3d_follow.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -409,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
Expand All @@ -424,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)
Expand Down
85 changes: 59 additions & 26 deletions BEAMS3D/Sources/beams3d_free.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
! Date: 12/15/2014
! Description: Deallocate and free all arrays.
!-----------------------------------------------------------------------
SUBROUTINE beams3d_free
SUBROUTINE beams3d_free(IN_COMM)
!-----------------------------------------------------------------------
! Libraries
!-----------------------------------------------------------------------
Expand All @@ -25,6 +25,7 @@ SUBROUTINE beams3d_free
!-----------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: ier
INTEGER, INTENT(INOUT), OPTIONAL :: IN_COMM
!-----------------------------------------------------------------------
! External Functions
! A00ADF NAG Detection
Expand Down Expand Up @@ -63,31 +64,63 @@ 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(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)
Expand Down
5 changes: 3 additions & 2 deletions BEAMS3D/Sources/beams3d_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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(:,:,:)
Expand Down
32 changes: 20 additions & 12 deletions BEAMS3D/Sources/beams3d_init.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,6 +88,8 @@ 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!'
IF (lplasma_only) WRITE(6,'(A)') ' MAGNETIC FIELD FROM PLASMA ONLY!'
CALL FLUSH(6)
END IF

Expand Down Expand Up @@ -128,11 +130,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
Expand Down Expand Up @@ -183,13 +185,27 @@ 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
ELSE IF (lpies .and. .not.lvac) THEN
!CALL beams3d_init_pies
ELSE IF (lspec .and. .not.lvac) THEN
!CALL beams3d_init_spec
END IF

! Setup vessel
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)
END IF

! For testing I put this here
IF (lascot) THEN
CALL beams3d_write_ascoth5('INIT')
END IF

! Construct 3D Profile Splines
IF (.not. lvac) THEN
Expand Down Expand Up @@ -249,14 +265,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
Expand Down
30 changes: 10 additions & 20 deletions BEAMS3D/Sources/beams3d_init_coil.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
33 changes: 29 additions & 4 deletions BEAMS3D/Sources/beams3d_init_vmec.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -79,6 +80,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)
Expand Down Expand Up @@ -106,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
Expand Down Expand Up @@ -135,9 +139,30 @@ 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

! 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)
Expand Down Expand Up @@ -264,7 +289,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
Expand Down
Loading

0 comments on commit 05e013b

Please sign in to comment.