evaluate 1D-radial profiles and their derivatives with respect to rho
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n_s |
number of evaluation points |
||
| real, | intent(in), | DIMENSION(n_s) | :: | s |
radial evaluation points |
|
| integer, | intent(in) | :: | deriv |
order of the derivative in rho |
||
| character(len=*), | intent(in) | :: | var |
selection string: which profile to evaluate |
||
| real, | intent(out), | DIMENSION(n_s) | :: | result |
values of the profile |
SUBROUTINE evaluate_profile(n_s, s, deriv, var, result) ! MODULES USE MODgvec_rProfile_base, ONLY: c_rProfile USE MODgvec_MHD3D_Vars, ONLY: iota_profile, pres_profile, Phi_profile, chi_profile ! INPUT/OUTPUT VARIABLES ------------------------------------------------------------------------------------------------------! INTEGER, INTENT(IN) :: n_s !! number of evaluation points REAL, INTENT(IN), DIMENSION(n_s) :: s !! radial evaluation points INTEGER, INTENT(IN) :: deriv !! order of the derivative in rho CHARACTER(LEN=*), INTENT(IN) :: var !! selection string: which profile to evaluate REAL, INTENT(OUT), DIMENSION(n_s) :: result !! values of the profile ! LOCAL VARIABLES -------------------------------------------------------------------------------------------------------------! INTEGER :: i ! loop variable CLASS(c_rProfile), ALLOCATABLE :: input_profile ! CODE ------------------------------------------------------------------------------------------------------------------------! SELECT CASE(TRIM(var)) CASE("iota") IF(.NOT.ALLOCATED(iota_profile)) CALL abort(__STAMP__, & 'ERROR in profile evaluation: iota profile not initialized',& TypeInfo="InitializationError") input_profile = iota_profile CASE("p") IF(.NOT.ALLOCATED(pres_profile)) CALL abort(__STAMP__, & 'ERROR in profile evaluation: pressure profile not initialized',& TypeInfo="InitializationError") input_profile = pres_profile CASE("chi") IF(.NOT.ALLOCATED(chi_profile)) CALL abort(__STAMP__, & 'ERROR in profile evaluation: chi profile not initialized',& TypeInfo="InitializationError") input_profile = chi_profile CASE("Phi") IF(.NOT.ALLOCATED(Phi_profile)) CALL abort(__STAMP__, & 'ERROR in profile evaluation: Phi profile not initialized',& TypeInfo="InitializationError") input_profile = Phi_profile CASE DEFAULT CALL abort(__STAMP__, & 'ERROR: variable "'//TRIM(var)//'" not recognized') END SELECT DO i = 1,n_s result(i) = input_profile%eval_at_rho(s(i),deriv) END DO SDEALLOCATE(input_profile) END SUBROUTINE evaluate_profile