ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
write_old_equilibrium.f90
Go to the documentation of this file.
1 subroutine write_old_equilibrium(path, equilibrium_out)
2 !----------------------------------------------------------------------------
3 ! This subroutine writes out the resulting HELENA equilibrium for use
4 ! by ILSA.
5 !----------------------------------------------------------------------------
6 
7  use itm_types
8  use mod_dat, only : zgeo
9  use mod_map
10  use mod_mesh, only : nr
11  use mod_parameter, only : twopi, mu0
12 
13  use euitm_schemas
14  use mod_helena_io
15 
16  implicit none
17 
18  type (type_equilibrium) :: equilibrium_out
19  character(len = 132) :: path
20 
21  character (len=30), parameter :: file_old_map_out = 'old_equilibrium'
22 
23  real(r8) :: rmag, bmag
24  integer(itm_i4) :: i, j
25 
26  rmag = equilibrium_out%global_param%mag_axis%position%r
27  bmag = equilibrium_out%global_param%mag_axis%bphi
28 
29 !-------------------- write output for ILSA ---------------------------
30  open (unit = out_map, file = trim(adjustl(path)) // file_old_map_out, &
31  status = 'replace', form = 'formatted', action = 'write', iostat = i_error)
32 
33  write(out_map, 3) nr - 1, nchi
34  write(out_map, 1) (cs(i), i = 1, nr)
35  write(out_map, 1) (equilibrium_out%profiles_1d%q(i), i = 1, nr)
36  write(out_map, 2) 0._r8, dqs(nr)
37  write(out_map, 1) (dqs(i), i = 2, nr)
38  write(out_map, 1) (0._r8, i = 1, nr)
39  write(out_map, 2) 0._r8, 0._r8
40  write(out_map, 1) (chi(i), i = 1, nchi)
41  write(out_map, 1) ((equilibrium_out%coord_sys%g_11(i, j) &
42  / (twopi * rmag * bmag)**2, j = 1, nchi), i = 2, nr)
43  write(out_map, 1) ((equilibrium_out%coord_sys%g_12(i, j) &
44  / (twopi * bmag), j = 1, nchi), i = 2, nr)
45  write(out_map, 2) equilibrium_out%profiles_1d%psi(nr) / (twopi &
46  * bmag * rmag**2), equilibrium_out%eqgeometry%a_minor / rmag
47  write(out_map, 1) ((1._r8 / equilibrium_out%coord_sys%g_33(i, j) &
48  / rmag**2, j = 1, nchi), i = 2, nr)
49  write(out_map, 4) 1._r8
50  write(out_map, 1) (equilibrium_out%profiles_1d%pressure(i) &
51  / bmag**2 * mu0, i = 1, nr)
52  write(out_map, 2) 0._r8, dp0(nr)
53  write(out_map, 1) (equilibrium_out%profiles_1d%F_dia(i) / (rmag &
54  * bmag), i = 1, nr)
55  write(out_map, 2) 0._r8, 0._r8
56 !----------------------------------------- additional data for vacuum --
57  write(out_map, 1) ((equilibrium_out%eqgeometry%boundary(1)%r(j) &
58  - equilibrium_out%eqgeometry%geom_axis%r) &
59  / equilibrium_out%eqgeometry%a_minor, j = 1, nchi)
60  write(out_map, 1) ((equilibrium_out%eqgeometry%boundary(1)%z(j) &
61  - zgeo) / equilibrium_out%eqgeometry%a_minor, j = 1, nchi)
62  write(out_map, 4) equilibrium_out%eqgeometry%a_minor &
63  / equilibrium_out%eqgeometry%geom_axis%r
64  write(out_map, 1) (((equilibrium_out%coord_sys%position%r(i, j) &
65  - equilibrium_out%eqgeometry%geom_axis%r) &
66  / equilibrium_out%eqgeometry%a_minor, j = 1, nchi), i = 2, nr)
67  write(out_map, 1) (((equilibrium_out%coord_sys%position%z(i, j) &
68  - zgeo) / equilibrium_out%eqgeometry%a_minor, j = 1, nchi), &
69  i = 2, nr)
70  close(out_map)
71 
72 1 format(4e16.8)
73 2 format(2e16.8)
74 3 format(2i6)
75 4 format(e16.8)
76 
77 end subroutine write_old_equilibrium
subroutine write_old_equilibrium(path, equilibrium_out)