init_profile_values_from_PROCESS Subroutine

public subroutine init_profile_values_from_PROCESS(rho, densities, temperatures, dr_densities, dr_temperatures)

Initializes the profile_values object from PROCESS' parabolic profiles

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: rho
real(kind=dp), intent(out), dimension(4):: densities
real(kind=dp), intent(out), dimension(4):: temperatures
real(kind=dp), intent(out), dimension(4):: dr_densities
real(kind=dp), intent(out), dimension(4):: dr_temperatures

Contents


Source Code

    subroutine init_profile_values_from_PROCESS(rho, densities, temperatures, dr_densities, dr_temperatures)
        !! Initializes the profile_values object from PROCESS' parabolic profiles
        !
        ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        use physics_variables, only: ne0,te0,alphan,&
                                     alphat,ti0,ni0,fdeut, dnalp, rminor
        use const_and_precisions, only: keV_

        real(dp), intent(in) :: rho

        real(dp),dimension(4) :: dens,temp, dr_dens, dr_temp
        real(dp) :: dense, densD,densT,densa, &
                    tempD,tempT,tempa,tempe, &
                    dr_tempe, dr_tempT, dr_tempD, dr_tempa,&
                    dr_dense, dr_densT, dr_densD, dr_densa, r
        real(dp), dimension(4), intent(out):: densities
        real(dp), dimension(4), intent(out):: temperatures
        real(dp), dimension(4), intent(out):: dr_densities
        real(dp), dimension(4), intent(out):: dr_temperatures

        r = rho * rminor

        tempe = te0 * (1-rho**2)**alphat * keV_ ! To SI units bc.. convenience I guess?
        tempT = ti0 * (1-rho**2)**alphat * keV_
        tempD = ti0 * (1-rho**2)**alphat * keV_
        tempa = ti0 * (1-rho**2)**alphat * keV_

        dense = ne0 * (1-rho**2)**alphan
        densT = (1-fdeut) * ni0 * (1-rho**2)**alphan
        densD = fdeut *ni0 * (1-rho**2)**alphan
        densa = dnalp*(1+alphan) * (1-rho**2)**alphan

        ! Derivatives in real space
        dr_tempe = -2.0d0 * 1.0d0/rminor * te0 * rho * (1.0d0-rho**2)**(alphat-1.0d0) * alphat * keV_
        dr_tempT = -2.0d0 * 1.0d0/rminor * ti0 * rho * (1.0d0-rho**2)**(alphat-1.0d0) * alphat * keV_
        dr_tempD = -2.0d0 * 1.0d0/rminor * ti0 * rho * (1.0d0-rho**2)**(alphat-1.0d0) * alphat * keV_
        dr_tempa = -2.0d0 * 1.0d0/rminor * ti0 * rho * (1.0d0-rho**2)**(alphat-1.0d0) * alphat * keV_

        dr_dense = -2.0d0 * 1.0d0/rminor * rho * ne0 *             (1.0d0-rho**2)**(alphan-1.0d0) * alphan
        dr_densT = -2.0d0 * 1.0d0/rminor * rho * (1-fdeut) * ni0 * (1.0d0-rho**2)**(alphan-1.0d0) * alphan
        dr_densD = -2.0d0 * 1.0d0/rminor * rho * fdeut *ni0 *      (1.0d0-rho**2)**(alphan-1.0d0) * alphan
        dr_densa = -2.0d0 * 1.0d0/rminor * rho * dnalp*(1+alphan)* (1.0d0-rho**2)**(alphan-1.0d0) * alphan

        dens(1) = dense
        dens(2) = densD
        dens(3) = densT
        dens(4) = densa

        temp(1) = tempe
        temp(2) = tempD
        temp(3) = tempT
        temp(4) = tempa

        dr_dens(1) = dr_dense
        dr_dens(2) = dr_densD
        dr_dens(3) = dr_densT
        dr_dens(4) = dr_densa

        dr_temp(1) = dr_tempe
        dr_temp(2) = dr_tempD
        dr_temp(3) = dr_tempT
        dr_temp(4) = dr_tempa

        densities = dens
        temperatures = temp
        dr_densities = dr_dens
        dr_temperatures = dr_temp

    end subroutine init_profile_values_from_PROCESS