fBase_eval1d_thet Function

private function fBase_eval1d_thet(sf, deriv, nthet, thet) result(base1d_thet)

evaluate special 1D base in theta direction (cos(mt_i),sin(mt_i)) or its derivative(s) on a given set of points for tensor-product evaluation of 2D sin and cos base: sin(mthet-nzeta) = sin(mthet)cos(nzeta)-cos(mthet)sin(nzeta) == dot_product( (sin(mthet),-cos(mthet)) , (cos(nzeta),sin(nzeta))) cos(mthet-nzeta) = cos(mthet)cos(nzeta)+sin(mthet)sin(nzeta) == dot_product( (cos(mthet), sin(mthet)) , (cos(nzeta),sin(nzeta))) so for the 1D base, mTotal1d depends on using sin/cos/sin+cos base.

Arguments

Type IntentOptional Attributes Name
class(t_fBase), intent(in) :: sf

self

integer, intent(in) :: deriv

=0: base, =1: dthet , =2: dthet^2

integer, intent(in) :: nthet

number of points in theta

real(kind=wp), intent(in) :: thet(1:nthet)

theta 1D point positions

Return Value real(kind=wp), (1:nthet,1:2,1:sf%mTotal1D)


Called by

proc~~fbase_eval1d_thet~~CalledByGraph proc~fbase_eval1d_thet fBase_eval1d_thet proc~fbase_evaldof_xn_tens t_fBase%fBase_evalDOF_xn_tens proc~fbase_evaldof_xn_tens->proc~fbase_eval1d_thet proc~evaluate_base_tens evaluate_base_tens proc~evaluate_base_tens->proc~fbase_evaldof_xn_tens proc~evaluate_base_tens_all evaluate_base_tens_all proc~evaluate_base_tens_all->proc~fbase_evaldof_xn_tens proc~fbase_test fBase_test proc~fbase_test->proc~fbase_evaldof_xn_tens proc~fbase_init t_fBase%fBase_init proc~fbase_test->proc~fbase_init proc~fbase_init->proc~fbase_test proc~fbase_copy t_fBase%fBase_copy proc~fbase_copy->proc~fbase_init proc~fbase_new fBase_new proc~fbase_new->proc~fbase_init proc~base_new Base_new proc~base_new->proc~fbase_new proc~bff_convert_to_modes t_boundaryFromFile%bff_convert_to_modes proc~bff_convert_to_modes->proc~fbase_new proc~get_boozer_sinterp t_sfl_boozer%Get_Boozer_sinterp proc~get_boozer_sinterp->proc~fbase_new proc~hmap_axisnb_init_params hmap_axisNB_init_params proc~hmap_axisnb_init_params->proc~fbase_new proc~init_base Init_Base proc~init_base->proc~fbase_new proc~init_base->proc~base_new proc~sfl_boozer_new sfl_boozer_new proc~sfl_boozer_new->proc~fbase_new proc~transform_angles_sinterp Transform_Angles_sinterp proc~transform_angles_sinterp->proc~fbase_new interface~t_hmap_axisnb t_hmap_axisNB interface~t_hmap_axisnb->proc~hmap_axisnb_init_params proc~hmap_axisnb_init hmap_axisNB_init interface~t_hmap_axisnb->proc~hmap_axisnb_init proc~buildtransform_sfl t_transform_sfl%BuildTransform_SFL proc~buildtransform_sfl->proc~get_boozer_sinterp proc~buildtransform_sfl->proc~transform_angles_sinterp proc~get_boozer get_boozer proc~get_boozer->proc~get_boozer_sinterp proc~hmap_axisnb_init->proc~hmap_axisnb_init_params proc~init_gvec_to_jorek init_gvec_to_jorek proc~init_gvec_to_jorek->proc~init_base interface~readstate ReadState proc~init_gvec_to_jorek->interface~readstate proc~initmhd3d t_functional_mhd3d%InitMHD3D proc~initmhd3d->proc~base_new proc~initmhd3d->proc~bff_convert_to_modes proc~readstatefilefromascii ReadStateFileFromASCII proc~readstatefilefromascii->proc~base_new proc~transform_sfl_init t_transform_sfl%transform_SFL_init proc~transform_sfl_init->proc~base_new interface~readstate->proc~readstatefilefromascii proc~transform_sfl_new transform_sfl_new proc~transform_sfl_new->proc~transform_sfl_init proc~restartfromstate RestartFromState proc~restartfromstate->interface~readstate

Source Code

FUNCTION fBase_eval1d_thet(sf,deriv,nthet,thet) RESULT(base1d_thet)
! MODULES
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
  CLASS(t_fBase), INTENT(IN   ) :: sf         !! self
  INTEGER       , INTENT(IN   ) :: deriv !! =0: base, =1: dthet , =2: dthet^2
  INTEGER       , INTENT(IN   ) :: nthet       !! number of points in theta
  REAL(wp)      , INTENT(IN   ) :: thet(1:nthet)   !! theta 1D point positions
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
  REAL(wp)                      :: base1d_thet(1:nthet,1:2,1:sf%mTotal1D)
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
  INTEGER :: m,m_max,i
  REAL(wp):: mm
!===================================================================================================================================
m_max=sf%mn_max(1)

SELECT CASE(deriv)
CASE(0)
  IF((sf%sin_cos.EQ._SIN_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D SINE
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,1+m)  = SIN(mm*thet(:))
      base1d_thet(:,2,1+m)  =-COS(mm*thet(:))
    END DO
  END IF
  IF((sf%sin_cos.EQ._COS_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D cosine
    i=sf%mTotal1D-(sf%mn_max(1)+1) !=offset, =0 if cos, =m_max+1 if sincos
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,i+1+m)  =COS(mm*thet(:))
      base1d_thet(:,2,i+1+m)  =SIN(mm*thet(:))
    END DO
  END IF
CASE(1)
  IF((sf%sin_cos.EQ._SIN_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D SINE
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,1+m)  = mm*COS(mm*thet(:))
      base1d_thet(:,2,1+m)  = mm*SIN(mm*thet(:))
    END DO
  END IF
  IF((sf%sin_cos.EQ._COS_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D cosine
    i=sf%mTotal1D-(sf%mn_max(1)+1) !=offset, =0 if cos, =m_max+1 if sincos
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,i+1+m)  =-mm*SIN(mm*thet(:))
      base1d_thet(:,2,i+1+m)  = mm*COS(mm*thet(:))
    END DO
  END IF
CASE(2)
  IF((sf%sin_cos.EQ._SIN_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D SINE
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,1+m)  =-mm*mm*SIN(mm*thet(:))
      base1d_thet(:,2,1+m)  = mm*mm*COS(mm*thet(:))
    END DO
  END IF
  IF((sf%sin_cos.EQ._COS_).OR.(sf%sin_cos.EQ._SINCOS_))THEN !2D cosine
    i=sf%mTotal1D-(sf%mn_max(1)+1) !=offset, =0 if cos, =m_max+1 if sincos
    DO m=0,m_max
      mm=REAL(m,wp)
      base1d_thet(:,1,i+1+m)  =-mm*mm*COS(mm*thet(:))
      base1d_thet(:,2,i+1+m)  =-mm*mm*SIN(mm*thet(:))
    END DO
  END IF
  CASE DEFAULT
    CALL abort(__STAMP__, &
         "fBase_eval1d_thet: derivative must be 0,1,2 !")
  END SELECT
END FUNCTION fBase_eval1d_thet