evaluate the n-th derivative of a radial profile with respect to rho ~sqrt(magnetic flux). NOTE: n has to be in [0,4] due to an explicit implementation of the product rule.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(c_rProfile) | :: | sf |
self |
|||
| real(kind=wp), | intent(in) | :: | rho |
rho position rho ~sqrt(magnetic flux) |
||
| integer, | intent(in), | optional | :: | deriv |
derivative in rho |
n-th derivative of a radial profile with respect to rho ~sqrt(magnetic flux).
FUNCTION rProfile_eval_at_rho(sf, rho, deriv) RESULT(derivative) ! MODULES !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CLASS(c_rProfile) :: sf !! self REAL(wp), INTENT(IN) :: rho !! rho position rho ~sqrt(magnetic flux) INTEGER, OPTIONAL, INTENT(IN) :: deriv !! derivative in rho !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL(wp) :: derivative !! n-th derivative of a radial profile with respect to rho ~sqrt(magnetic flux). !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES INTEGER :: deriv_case REAL(wp) :: rho2 !=================================================================================================================================== IF (PRESENT(deriv)) THEN deriv_case = deriv ELSE deriv_case = 0 END IF rho2 = rho2_derivative(rho,deriv=0) SELECT CASE(deriv_case) CASE(0) derivative = sf%eval_at_rho2(rho2, deriv=0) CASE(1) derivative = sf%eval_at_rho2(rho2,deriv=1)*rho2_derivative(rho,deriv=1) CASE(2) derivative = sf%rProfile_drho2(rho) CASE(3) derivative = sf%rProfile_drho3(rho) CASE(4) derivative = sf%rProfile_drho4(rho) CASE DEFAULT CALL abort(__STAMP__,& "error in rprofile: derivatives higher than 4 with respect to rho=sqrt(phi/phi_edge) are not implemented!") END SELECT END FUNCTION rProfile_eval_at_rho