ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
update_fdf.f90
Go to the documentation of this file.
1 subroutine update_fdf(equilibrium, xaxis)
2 !----------------------------------------------------------------------
3 ! subroutine to calculate FF' from <j_tor> and p' (in SI)
4 !----------------------------------------------------------------------
5 
6  use itm_types
7  use mod_parameter, only : mu0, twopi
8  use mod_dat
9  use mod_helena_io, only : iu6
10  use mod_mesh, only : nr
11  use mod_profiles
12  use helena_spline
13 
14  use phys_functions
16  use euitm_schemas
17 
18  implicit none
19 
20  type (type_equilibrium), intent(inout) :: equilibrium
21 
22  real(r8), intent(in) :: xaxis
23 
24  type(spline_coefficients) :: fdf_spline
25 
26  real(r8), dimension(nr) :: psi_new, fdf_new
27  real(r8), dimension(3) :: abltg
28  integer(itm_i4) :: i
29 
30  if (verbosity > 1) write(iu6, *) "updating FF' based on <j_tor> and p'"
31 
32 !-- calculate new FF' from flux surface averaged Grad-Shafranov equation
33 !-- Attention: FF' and p' in HELENA are with respect to Psi in [Wb].
34 ! In Grad-Shafranov equation, however, with respect to Psi [Wb/rad].
35  do i = 1, nr
36  fdf_new(i) = mu0 * (equilibrium%profiles_1d%jphi(i) &
37  - flux_surface_average(i, xaxis, 1._r8, 0._r8, current_averaging, &
38  r_major) * equilibrium%eqgeometry%geom_axis%r * twopi &
39  * equilibrium%profiles_1d%pprime(i)) &
40  / flux_surface_average(i, xaxis, 1._r8, 0._r8, current_averaging, &
41  one_over_r) * equilibrium%eqgeometry%geom_axis%r / twopi
42  end do
43 
44 !-- store as new FF'
45  equilibrium%profiles_1d%ffprime = fdf_new
46 
47 !-- calculate new gamma profile from p' and FF'
48 ! (relative normalization only, not SI)
49  if (hbt) then
50  fdf_new = mu0 * equilibrium%profiles_1d%pprime &
51  + equilibrium%profiles_1d%ffprime &
52  / equilibrium%eqgeometry%geom_axis%r**2
53  else
54  fdf_new = equilibrium%profiles_1d%ffprime
55  end if
56 
57 !-- renomalize fdf_new to 1 on axis
58  fdf_new = fdf_new / fdf_new(1)
59 
60 !-- normalized psi
61  psi_new = equilibrium%profiles_1d%psi / equilibrium%profiles_1d%psi(nr)
62 
63 !-- calculate new equidistant gamma profile fdf based on fdf_new
64  call allocate_spline_coefficients(fdf_spline, nr)
65  call spline(nr, psi_new, fdf_new, 0._r8, 0._r8, 2, fdf_spline)
66  do i = 1, npts
67  fdf(i) = spwert(nr, psivec(i), fdf_spline, psi_new, abltg, 0)
68  end do
69 
70  call deallocate_spline_coefficients(fdf_spline)
71 
72  return
73 end subroutine update_fdf
subroutine allocate_spline_coefficients(spline, n)
subroutine spline(N, X, Y, ALFA, BETA, TYP, A, B, C, D)
Definition: solution6.f90:655
REAL *8 function spwert(N, XWERT, A, B, C, D, X, ABLTG)
Definition: solution6.f90:155
subroutine update_fdf(equilibrium, xaxis)
Definition: update_fdf.f90:1
real(r8) function, public flux_surface_average(i, xaxis, a, F_dia, type, func)
subroutine deallocate_spline_coefficients(spline)
real(r8) function one_over_r(a, x, xr, xs, yr, ys, psi, psir, F_dia)
real(r8) function r_major(a, x, xr, xs, yr, ys, psi, psir, F_dia)