src: use hypot and norm2 when possible

This commit is contained in:
Michele Guerini Rocco 2021-12-19 02:35:24 +01:00
parent 18c1126d28
commit 96359bc3fd
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
4 changed files with 10 additions and 10 deletions

View File

@ -147,8 +147,8 @@ contains
! print ne, Te, q, Jphi versus psi, rhop, rhot
call print_bres(bres)
call print_prof
call print_maps(bres, xgcn, &
0.01_wp_*sqrt(params%antenna%pos(1)**2 + params%antenna%pos(2)**2), &
call print_maps(bres, xgcn, &
norm2(params%antenna%pos(1:2)) * 0.01_wp_, &
sin(params%antenna%beta*degree))
! ========= pre-proc prints END =========

View File

@ -53,7 +53,7 @@ subroutine gray_jetto1beam(ijetto, mr, mz, r, z, psin, psia, rax, zax, &
use limiter, only : limiter_set_globals=>set_globals
real(wp_) :: r0m
r0m = sqrt(params%antenna%pos(1)**2 + params%antenna%pos(2)**2)*0.01_wp_
r0m = norm2(params%antenna%pos(1:2)) * 0.01_wp_
call range2rect(params%misc%rwall, max(r0m, r(mr)), z(1), z(mz), &
data%equilibrium%rlim, data%equilibrium%zlim)
! Set the global variables of `limiter`

View File

@ -28,7 +28,7 @@ program main
call read_parameters(opts%params_file, params)
call params_set_globals(params)
! Read the input data into set the global variables
! Read the input data and set the global variables
! of the respective module. Note: order matters.
call init_equilibrium(params, data)
call init_profiles(params%profiles, params%equilibrium%factb, data%profiles)
@ -332,7 +332,7 @@ contains
.or. params%raytracing%ipass < 0) then
block
real(wp_) :: rmxm, r0m, z0m, dzmx
r0m = sqrt(params%antenna%pos(1)**2 + params%antenna%pos(2)**2)* 0.01_wp_
r0m = norm2(params%antenna%pos(1:2)) * 0.01_wp_
dzmx = abs(params%raytracing%ipass) * &
params%raytracing%dst * params%raytracing%nstep * 0.01_wp_
z0m = params%antenna%pos(3) * 0.01_wp_
@ -446,8 +446,8 @@ contains
! Print ne, Te, q, Jphi versus psi, rhop, rhot
call print_bres(bres)
call print_prof
call print_maps(bres, xgcn, &
0.01_wp_*sqrt(params%antenna%pos(1)**2 + params%antenna%pos(2)**2), &
call print_maps(bres, xgcn, &
norm2(params%antenna%pos(1:2)) *0.01_wp_ , &
sin(params%antenna%beta*degree))
! ========= pre-proc prints END =========

View File

@ -72,9 +72,9 @@ subroutine inters_linewall(xv,kv,rw,zw,nw,sint,normw)
dzw = zw(iint+1)-zw(iint)
xint = xv(1) + sint*kv(1)
yint = xv(2) + sint*kv(2)
rint = sqrt(xint**2+yint**2)
l = sqrt(drw**2+dzw**2)
kxy = sqrt(kv(1)**2+kv(2)**2)
rint = hypot(xint, yint)
l = hypot(drw, dzw)
kxy = norm2(kv(1:2))
normw(3) = -drw/l
if (rint>zero) then
normw(1) = xint/rint*dzw/l