interp_nRE Subroutine

public subroutine interp_nRE(params, Y_R, Y_PHI, Y_Z, PSIp, EPHI, ne, Te, nRE, nAr0, nAr1, nAr2, nAr3, nD, nD1, g_test, fRE_out, rho1D)

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(in) :: params
real(kind=rp), intent(in) :: Y_R
real(kind=rp), intent(in) :: Y_PHI
real(kind=rp), intent(in) :: Y_Z
real(kind=rp), intent(out) :: PSIp
real(kind=rp), intent(out) :: EPHI
real(kind=rp), intent(out) :: ne
real(kind=rp), intent(out) :: Te
real(kind=rp), intent(out) :: nRE
real(kind=rp), intent(out) :: nAr0
real(kind=rp), intent(out) :: nAr1
real(kind=rp), intent(out) :: nAr2
real(kind=rp), intent(out) :: nAr3
real(kind=rp), intent(out) :: nD
real(kind=rp), intent(out) :: nD1
real(kind=rp), intent(in) :: g_test
real(kind=rp), intent(out) :: fRE_out
real(kind=rp), intent(in), optional :: rho1D

Calls

proc~~interp_nre~~CallsGraph proc~interp_nre interp_nRE ezspline_interp ezspline_interp proc~interp_nre->ezspline_interp proc~check_if_in_profiles_domain_p check_if_in_profiles_domain_p proc~interp_nre->proc~check_if_in_profiles_domain_p ezspline_error ezspline_error proc~interp_nre->ezspline_error

Called by

proc~~interp_nre~~CalledByGraph proc~interp_nre interp_nRE proc~sample_hollmann_distribution_1dtransport sample_Hollmann_distribution_1Dtransport proc~sample_hollmann_distribution_1dtransport->proc~interp_nre proc~get_hollmann_distribution_1dtransport get_Hollmann_distribution_1Dtransport proc~get_hollmann_distribution_1dtransport->proc~sample_hollmann_distribution_1dtransport

Contents

Source Code


Source Code

subroutine interp_nRE(params,Y_R,Y_PHI,Y_Z,PSIp,EPHI,ne,Te,nRE, &
     nAr0,nAr1,nAr2,nAr3,nD,nD1,g_test,fRE_out,rho1D)
  TYPE(KORC_PARAMS), INTENT(IN) 	:: params
  REAL(rp),INTENT(IN)   :: Y_R,Y_PHI,Y_Z,g_test
  REAL(rp),INTENT(OUT)   :: PSIp,EPHI,ne,Te,nRE,fRE_out
  REAL(rp),INTENT(OUT)   :: nAr0,nAr1,nAr2,nAr3,nD,nD1
  REAL(rp)   :: RHON
  INTEGER(is),DIMENSION(1)   :: flag_cache
  REAL(rp), INTENT(IN),optional  :: rho1D

  flag_cache=1_is
  call check_if_in_profiles_domain_p(1,(/Y_R/),(/Y_PHI/),(/Y_Z/), &
       flag_cache)

  if (flag_cache(1).ne.0_is) then
     call EZspline_interp(bfield_2d%A,efield_2d%PHI, &
          profiles_2d%ne,profiles_2d%Te, &
          profiles_2d%nRE,profiles_2d%nAr0,profiles_2d%nAr1, &
          profiles_2d%nAr2,profiles_2d%nAr3,profiles_2d%nD,profiles_2d%nD1, &
          profiles_2d%RHON,Y_R,Y_Z, &
          PSIp,EPHI,ne,Te,nRE,nAr0,nAr1,nAr2,nAr3,nD,nD1,RHON,ezerr)
     call EZspline_error(ezerr)

     !write(6,*) 'RHON',RHON
     
     if ((RHON.le.1).and.(RHON.gt.0)) then
        if(present(rho1D)) RHON=rho1D
        
        call EZspline_interp(hollmann_2d%fRE_E,RHON,g_test,fRE_out,ezerr)  
        call EZspline_error(ezerr)
        if (ezerr .NE. 0) then ! We flag the particle as lost          
           write(6,*) 'R,Z',Y_R*params%cpp%length,Y_Z*params%cpp%length
           write(6,*) 'RHON',RHON
        end if

     else
        fRE_out=0._rp       
     endif
     
     if (fRE_OUT.lt.0) fRE_OUT=0._rp
  else
     fRE_OUT=0._rp
     nRE=0._rp
  endif
  
end subroutine interp_nRE