print_starwall_files_vtk.f90 3.12 KB
Newer Older
Serhiy Mochalskyy's avatar
Serhiy Mochalskyy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
subroutine print_starwall_files_vtk
use tri_w
use tri_p
use mpi_v
use resistive
use icontr
use contr_su
use coil2d

!-----------------------------------------------------------------------
implicit none
include "mpif.h"

integer  :: i,j
!-----------------------------------------------------------------------

if(rank==0) then

   140 format(a)
   141 format(a,i8,a)
   142 format(3es24.16)
   143 format(a,2i8)
   144 format(4i8)
  
   !===========================================================
   ! --- VTK: Control surface
   open(60, file='control.vtk')
      write(60,140) '# vtk DataFile Version 2.0'
      write(60,140) 'testdata'
      write(60,140) 'ASCII'
      write(60,140) 'DATASET POLYDATA'
      write(60,141) 'POINTS', 3*ntri_p, ' float'
      do i = 1, ntri_p
           do j = 1, 3
              write(60,142) xp(i,j), yp(i,j), zp(i,j)
           end do
      end do
      write(60,143) 'POLYGONS', ntri_p, ntri_p*4
      do i = 1, ntri_p
          write(60,144) 3, 3*(i-1), 3*(i-1)+1, 3*(i-1)+2
      end do
      write(60,141) 'POINT_DATA', 3*ntri_p
      write(60,140) 'SCALARS potentials float'
      write(60,140) 'LOOKUP_TABLE default'
      do i = 1, 3*ntri_p
          write(60,144) mod(i/3,5) !###
      end do
   close(60)
   !===========================================================

   !===========================================================
   ! --- VTK: Wall
   open(60, file='wall.vtk')
        write(60,140) '# vtk DataFile Version 2.0'
        write(60,140) 'testdata'
        write(60,140) 'ASCII'
        write(60,140) 'DATASET POLYDATA'
        write(60,141) 'POINTS', npot_w, ' float'
        do i = 1, npot_w
           write(60,142) xyzpot_w(i,:)
        end do
        write(60,143) 'POLYGONS', ntri_w, ntri_w*4
        do i = 1, ntri_w
            write(60,144) 3, jpot_w(i,:)-1
        end do
        write(60,141) 'POINT_DATA', npot_w
        write(60,140) 'SCALARS potentials float'
        write(60,140) 'LOOKUP_TABLE default'
        do i = 1, npot_w
           write(60,144) mod(i,3) !###
        end do
    close(60)
   !===========================================================

   !===========================================================
   ! --- VTK: Coils
   open(60, file='coils.vtk')
        write(60,140) '# vtk DataFile Version 2.0'
        write(60,140) 'testdata'
        write(60,140) 'ASCII'
        write(60,140) 'DATASET POLYDATA'
        write(60,141) 'POINTS', 3*ntri_c, ' float'
        do i = 1, ntri_c
            write(60,142) x_coil(i,1), z_coil(i,1), y_coil(i,1)
            write(60,142) x_coil(i,2), z_coil(i,2), y_coil(i,2)
            write(60,142) x_coil(i,3), z_coil(i,3), y_coil(i,3)
       end do
       write(60,143) 'POLYGONS', ntri_c, ntri_c*4
       do i = 1, ntri_c
          write(60,144) 3, 3 * i - (/ 3, 2, 1 /)
       end do
       write(60,141) 'POINT_DATA', 3*ntri_c
       write(60,140) 'SCALARS potentials float'
       write(60,140) 'LOOKUP_TABLE default'
       do i = 1, ntri_c
          write(60,142) 0.d0
      end do
   close(60)
   !===========================================================

endif

if(rank==0) deallocate(xyzpot_w)

end subroutine print_starwall_files_vtk