Skip to content

Commit

Permalink
THRIFT: Interpolate EparB from THRIFT and provide it as input for PENTA
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchcoelho committed Nov 20, 2024
1 parent 1224c6f commit cafaf84
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions THRIFT/Sources/thrift_penta.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SUBROUTINE thrift_penta(lscreen,iflag)
te, ne, dtedrho, dnedrho, EparB, JBS_PENTA, etapar_PENTA, rho_temp, J_temp, eta_temp
REAL(rprec), DIMENSION(:,:), ALLOCATABLE :: ni,ti, dtidrho, dnidrho
REAL(rprec), DIMENSION(:,:), ALLOCATABLE :: D11, D13, D33
TYPE(EZspline1_r8) :: J_spl, eta_spl
TYPE(EZspline1_r8) :: EparB_spl, J_spl, eta_spl
INTEGER :: bcs0(2)
!-----------------------------------------------------------------------
! BEGIN SUBROUTINE
Expand All @@ -62,6 +62,17 @@ SUBROUTINE thrift_penta(lscreen,iflag)
JBS_PENTA = 0.0; etapar_PENTA = 0.0

IF (myworkid == master) THEN

! EparB Spline
bcs1=(/ 0, 0/)
CALL EZspline_init(EparB_spl,nsj,bcs1,ier)
IF (ier /=0) CALL handle_err(EZSPLINE_ERR,'thrift_penta: eparb',ier)
EparB_spl%isHermite = 0
EparB_spl%x1 = SQRT(THRIFT_S)
CALL EZspline_setup(EparB_spl,THRIFT_EPARB(:,mytimestep),ier,EXACT_DIM=.true.)
IF (ier /=0) CALL handle_err(EZSPLINE_ERR,'thrift_penta: eparb',ier)
!

DO k = 1, ns_dkes
mysurf = DKES_K(k)
s = DBLE(mysurf-1) / DBLE(ns_eq-1)
Expand Down Expand Up @@ -99,14 +110,14 @@ SUBROUTINE thrift_penta(lscreen,iflag)
CALL get_prof_tiprime(rho, THRIFT_T(mytimestep), j, dtidrho(k,j))
CALL get_prof_niprime(rho, THRIFT_T(mytimestep), j, dnidrho(k,j))
END DO

!EparB
EparB(k) = 0.0_rprec !! temporary... cannot do THRIFT_EPARB(mysurf,mytimestep) since this is defined in thrift grid, not vmec... interpolation?

! EparB
ier = 0
CALL EZSpline_interp(EparB_spl, rho, EparB(k), ier)
END DO


! print *, 'master_thrift_penta: dkes_d11', DKES_D11
CALL EZspline_free(EparB_spl,ier)
END IF

#if defined(MPI_OPT)
CALL MPI_BCAST(rho_k,ns_dkes,MPI_DOUBLE_PRECISION,master,MPI_COMM_MYWORLD,ierr_mpi)
CALL MPI_BCAST(iota,ns_dkes,MPI_DOUBLE_PRECISION,master,MPI_COMM_MYWORLD,ierr_mpi)
Expand Down

0 comments on commit cafaf84

Please sign in to comment.