src/gray_core.f90: print profiles up to ψ_bnd

This commit is contained in:
Michele Guerini Rocco 2023-05-23 17:49:51 +02:00
parent 707dca1ab8
commit 69367ae981
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 29 additions and 8 deletions

View File

@ -142,7 +142,7 @@ contains
! print Btot=Bres ! print Btot=Bres
! print ne, Te, q, Jphi versus psi, rhop, rhot ! print ne, Te, q, Jphi versus psi, rhop, rhot
call print_bres(bres) call print_bres(bres)
call print_prof call print_prof(params%profiles)
call print_maps(bres, xgcn, & call print_maps(bres, xgcn, &
norm2(params%antenna%pos(1:2)) * 0.01_wp_, & norm2(params%antenna%pos(1:2)) * 0.01_wp_, &
sin(params%antenna%beta*degree)) sin(params%antenna%beta*degree))
@ -2180,27 +2180,48 @@ bb: do
end subroutine print_headers end subroutine print_headers
subroutine print_prof subroutine print_prof(params)
! Prints the (input) plasma kinetic profiles (unit 98) ! Prints the (input) plasma kinetic profiles (unit 55)
use gray_params, only : profiles_parameters
use equilibrium, only : q_spline, fq, frhotor, tor_curr_psi use equilibrium, only : q_spline, fq, frhotor, tor_curr_psi
use coreprofiles, only : density, temp use coreprofiles, only : density, temp
use units, only : uprfin, unit_active use units, only : uprfin, unit_active
implicit none implicit none
! suborutine arguments
type(profiles_parameters), intent(in) :: params
! local constants ! local constants
real(wp_), parameter :: eps = 1.e-4_wp_ real(wp_), parameter :: eps = 1.e-4_wp_
! local variables ! local variables
integer :: i integer :: i, N_data, N_tail
real(wp_) :: psin, rhot, jphi, dens, ddens real(wp_) :: rhot, jphi, dens, ddens
real(wp_) :: psin, dpsin, psin_last
if (.not. unit_active(uprfin)) return if (.not. unit_active(uprfin)) return
! N of profiles data points
N_data = q_spline%ndata
! parameters for the density tail (numerical profiles only)
if (params%iprof == 1) then
N_tail = N_data / 10 ! N of density tail points
psin_last = q_spline%data(N_data) ! last data point
dpsin = (params%psnbnd - psin_last) / N_tail ! Δψ for uniform grid
else
N_tail = 0
end if
write (uprfin, *) '#psi rhot ne Te q Jphi' write (uprfin, *) '#psi rhot ne Te q Jphi'
do i = 1, q_spline%ndata do i = 1, N_data + N_tail
psin = q_spline%data(i) if (i > N_data) then
psin = psin_last + dpsin*(i - N_data)
else
psin = q_spline%data(i)
end if
rhot = frhotor(sqrt(psin)) rhot = frhotor(sqrt(psin))
call density(psin, dens, ddens) call density(psin, dens, ddens)
jphi = tor_curr_psi(max(eps, psin)) jphi = tor_curr_psi(max(eps, psin))

View File

@ -502,7 +502,7 @@ contains
! Print ne, Te, q, Jphi versus psi, rhop, rhot ! Print ne, Te, q, Jphi versus psi, rhop, rhot
call print_bres(bres) call print_bres(bres)
call print_prof call print_prof(params%profiles)
call print_maps(bres, xgcn, & call print_maps(bres, xgcn, &
norm2(params%antenna%pos(1:2)) *0.01_wp_ , & norm2(params%antenna%pos(1:2)) *0.01_wp_ , &
sin(params%antenna%beta*degree)) sin(params%antenna%beta*degree))