ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
mod_output.f90
Go to the documentation of this file.
1 module mod_output
2 
3  use itm_types
4 
5  implicit none
6 
7  character(len = 100) :: txtout(40)
8  logical :: diagnostics_on
9  logical :: standard_output, elite_output
10  logical :: profiles_output, additional_output
11  logical :: xmgrace_output
12  logical :: vec_file, eqdsk_file
13 
14  contains
15 
16  subroutine write_equidistant_profiles(equilibrium, pskn1, nr)
17 !-----------------------------------------------------------------------------
18 ! subroutine to write out high resolution equidistant profiles for a re-run
19 ! uses equilibrium CPO and transfer_1d
20 !-----------------------------------------------------------------------------
21 
22  use mod_dat, only : output, cpsurfin
23  use plot_data
24  use mod_profiles
25  use mod_helena_io
27  use euitm_schemas
28 
29  implicit none
30 
31 !-- number of grid points for equidistant radial grid
32  integer(itm_i4), parameter :: npts_out = 2000
33  integer(itm_i4), parameter :: profile_out = 22
34 
35  type (type_equilibrium), intent(in) :: equilibrium
36  real(r8), intent(in) :: pskn1(nr)
37  integer(itm_i4), intent(in) :: nr
38 
39  real(r8), dimension(npts_out) :: ps_equi, dp_equi, fdf_equi, p_equi, j_equi
40  integer(itm_i4) :: i
41 
42  do i = 1, npts_out
43  ps_equi(i) = pskn1(1) + dble(i - 1) / dble(npts_out - 1) &
44  * (pskn1(size(pskn1)) - pskn1(1))
45  end do
46 
47 !-- transfer profiles to equidistant psi grid
48  call transfer_1d_profile(pskn1, equilibrium%profiles_1d%jphi, &
49  ps_equi, j_equi, spline_type = 1)
50  call transfer_1d_profile(pskn1, equilibrium%profiles_1d%pprime, &
51  ps_equi, dp_equi, spline_type = 1)
52  call transfer_1d_profile(pskn1, equilibrium%profiles_1d%ffprime, &
53  ps_equi, fdf_equi, spline_type = 1)
54  call transfer_1d_profile(pskn1, equilibrium%profiles_1d%pressure, &
55  ps_equi, p_equi, spline_type = 1)
56 
57 !-- write out equidistant profiles for re-run
58  if (trim(output) == 'profiles' .or. trim(output) == 'full') then
59  open (unit = profile_out, file = trim(adjustl(path)) // 'psi.out', &
60  status = 'replace', form = 'formatted', action = 'write', &
61  iostat = i_error)
62  if (i_error /= 0) then
63  write(iu6, *) ' ERROR writing psi.out '
64  end if
65  write(profile_out, 26) (ps_equi(i) * cpsurfin, i = 1, npts_out)
66  close(profile_out)
67 
68  open (unit = profile_out, file = trim(adjustl(path)) // 'dp.out', &
69  status = 'replace', form = 'formatted', action = 'write', &
70  iostat = i_error)
71  if (i_error /= 0) then
72  write(iu6, *) ' ERROR writing dp.out '
73  end if
74  write(profile_out, 26) (dp_equi(i), i = 1, npts_out)
75  close(profile_out)
76 
77  open (unit = profile_out, file = trim(adjustl(path)) // 'p.out', &
78  status = 'replace', form = 'formatted', action = 'write', &
79  iostat = i_error)
80  if (i_error /= 0) then
81  write(iu6, *) ' ERROR writing p.out '
82  end if
83  write(profile_out, 26) (p_equi(i), i = 1, npts_out)
84  close(profile_out)
85 
86  open (unit = profile_out, file = trim(adjustl(path)) // 'fdf.out', &
87  status = 'replace', form = 'formatted', action = 'write', &
88  iostat = i_error)
89  if (i_error /= 0) then
90  write(iu6, *) ' ERROR writing fdf.out '
91  end if
92  write(profile_out, 26) (fdf_equi(i), i = 1, npts_out)
93  close(profile_out)
94 
95  open (unit = profile_out, file = trim(adjustl(path)) // 'j_tor.out', &
96  status = 'replace', form = 'formatted', action = 'write', &
97  iostat = i_error)
98  if (i_error /= 0) then
99  write(iu6, *) ' ERROR writing j_tor.out '
100  end if
101  write(profile_out, 26) (j_equi(i), i = 1, npts_out)
102  close(profile_out)
103 
104  end if
105 
106  26 format(e24.16)
107 
108  end subroutine write_equidistant_profiles
109 
110 end module mod_output
subroutine output(NGRID, betpol, zli3)
Definition: Eq2_m.f:1
subroutine write_equidistant_profiles(equilibrium, pskn1, nr)
Definition: mod_output.f90:16
subroutine transfer_1d_profile(x_in, f_in, x_out, f_out, df_out, spline_type, monotonic)