Fit disrete data along flux surfaces as spline for each fourier mode
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | modes |
number of modes |
||
| integer, | intent(in) | :: | nFlux |
number of flux surfaces |
||
| integer, | intent(in) | :: | mabs(modes) |
filtered m-mode value |
||
| real(kind=wp), | intent(in) | :: | Xmn(modes,nFlux) |
fourier coefficients at all flux surfaces |
||
| type(t_cubspl), | intent(out) | :: | Xmn_Spl(modes) |
spline fitted fourier coefficients |
SUBROUTINE FitSpline(modes,nFlux,mAbs,Xmn,Xmn_Spl) ! MODULES USE MODgvec_VMEC_Vars, ONLY: rho ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES INTEGER, INTENT(IN) :: modes !! number of modes INTEGER, INTENT(IN) :: nFlux !! number of flux surfaces INTEGER, INTENT(IN) :: mabs(modes) !! filtered m-mode value REAL(wp), INTENT(IN) :: Xmn(modes,nFlux) !! fourier coefficients at all flux surfaces !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES TYPE(t_cubspl),INTENT(OUT):: Xmn_Spl(modes) !! spline fitted fourier coefficients !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES INTEGER :: iMode,iFlux REAL(wp) :: Xmn_val(nFlux) ! !=================================================================================================================================== DO iMode=1,modes !scaling with rho^|m| DO iFlux=2,nFlux IF(mabs(iMode).EQ.0)THEN Xmn_val(iFlux)=Xmn(iMode,iFlux) ELSE Xmn_val(iFlux)=Xmn(iMode,iFlux) /(rho(iFlux)**mabs(iMode)) END IF END DO !i !Parabolic extrapolation to axis with dx'(rho=0)=0.0_wp Xmn_val(1)=(Xmn_val(2)*rho(3)**2-Xmn_val(3)*rho(2)**2) /(rho(3)**2-rho(2)**2) Xmn_spl(iMode)=t_cubspl(rho,Xmn_val, BC=(/1,0/)) END DO !iMode END SUBROUTINE FitSpline