1
1
! =====================================================================
2
2
!
3
- ! S p e c f e m 3 D G l o b e V e r s i o n 5 . 0
3
+ ! S p e c f e m 3 D G l o b e V e r s i o n 5 . 1
4
4
! --------------------------------------------------
5
5
!
6
6
! Main authors: Dimitri Komatitsch and Jeroen Tromp
7
7
! Princeton University, USA
8
8
! and University of Pau / CNRS / INRIA, France
9
9
! (c) Princeton University / California Institute of Technology and University of Pau / CNRS / INRIA
10
- ! March 2010
10
+ ! April 2011
11
11
!
12
12
! This program is free software; you can redistribute it and/or modify
13
13
! it under the terms of the GNU General Public License as published by
25
25
!
26
26
! =====================================================================
27
27
28
+
28
29
program create_slice_VTK
29
30
30
31
! this programs creates a vtk file that specifies the (velocity) model values on each element point,
@@ -39,7 +40,7 @@ program create_slice_VTK
39
40
! cd to your SPECFEM3D_GLOBE root directory:
40
41
! > cd SPECFEM3D_GLOBE/
41
42
! create symbolic link:
42
- ! > ln -s UTILS/Visualization/Paraview/create_slice_VTK.f90
43
+ ! > ln -s UTILS/Visualization/Paraview/create_slice_VTK.f90
43
44
! compile with:
44
45
! > f90 -o xcreate_slice_VTK create_slice_VTK.f90
45
46
! run :
@@ -69,7 +70,7 @@ program create_slice_VTK
69
70
real x, y, z, dat
70
71
integer numpoin, iglob, n1, n2, n3, n4, n5, n6, n7, n8
71
72
integer iglob1, iglob2, iglob3, iglob4, iglob5, iglob6, iglob7, iglob8
72
-
73
+
73
74
74
75
! starts here--------------------------------------------------------------------------------------------------
75
76
do i = 1 , 6
@@ -114,7 +115,7 @@ program create_slice_VTK
114
115
print * ,' no file: ' ,trim (arg(1 ))
115
116
stop ' Error opening slices file'
116
117
endif
117
-
118
+
118
119
do while (1 == 1 )
119
120
read (20 ,' (a)' ,iostat= ios) sline
120
121
if (ios /= 0 ) exit
@@ -155,11 +156,11 @@ program create_slice_VTK
155
156
print * ,' error ' ,ios
156
157
print * ,' file:' ,trim (dimension_file)
157
158
stop ' Error opening file'
158
- endif
159
+ endif
159
160
read (27 ,* ) nspec(it)
160
161
read (27 ,* ) nglob(it)
161
162
close (27 )
162
-
163
+
163
164
164
165
enddo
165
166
@@ -173,8 +174,8 @@ program create_slice_VTK
173
174
do it = 1 , num_node
174
175
175
176
iproc = node_list(it)
176
-
177
-
177
+
178
+
178
179
print * , ' '
179
180
print * , ' Reading slice ' , iproc
180
181
write (prname_topo,' (a,i6.6,a,i1,a)' ) trim (in_topo_dir)// ' /proc' ,iproc,' _reg' ,ir,' _'
@@ -192,11 +193,11 @@ program create_slice_VTK
192
193
data (:,:,:,:) = - 1.e10
193
194
read (27 ) data (:,:,:,1 :nspec(it))
194
195
close (27 )
195
-
196
+
196
197
print * ,trim (data_file)
197
198
print * ,' min/max value: ' ,minval (data (:,:,:,1 :nspec(it))),maxval (data (:,:,:,1 :nspec(it)))
198
199
print *
199
-
200
+
200
201
! topology file
201
202
topo_file = trim (prname_topo) // ' solver_data_2' // ' .bin'
202
203
open (unit = 28 ,file = trim (topo_file),status= ' old' ,action= ' read' , iostat = ios, form= ' unformatted' )
@@ -214,7 +215,7 @@ program create_slice_VTK
214
215
read (28 ) zstore(1 :nglob(it))
215
216
read (28 ) ibool(:,:,:,1 :nspec(it))
216
217
close (28 )
217
-
218
+
218
219
219
220
write (mesh_file,' (a,i1,a)' ) trim (outdir)// ' /' // ' reg_' ,ir,' _' // trim (filename)
220
221
print * , trim (mesh_file)
@@ -250,12 +251,12 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, &
250
251
include " constants.h"
251
252
252
253
integer :: nspec,nglob
253
-
254
- ! global coordinates
254
+
255
+ ! global coordinates
255
256
integer , dimension (NGLLX,NGLLY,NGLLZ,nspec) :: ibool
256
257
real (kind= CUSTOM_REAL), dimension (nglob) :: xstore_dummy,ystore_dummy,zstore_dummy
257
258
258
- ! gll data values array
259
+ ! gll data values array
259
260
real (kind= CUSTOM_REAL), dimension (NGLLX,NGLLY,NGLLZ,nspec) :: gll_data
260
261
261
262
! file name
@@ -266,81 +267,81 @@ subroutine write_VTK_data_gll_cr(nspec,nglob, &
266
267
! write source and receiver VTK files for Paraview
267
268
write (IMAIN,* ) ' vtk file: '
268
269
write (IMAIN,* ) ' ' ,prname_file(1 :len_trim (prname_file))// ' .vtk'
269
-
270
+
270
271
open (IOVTK,file= prname_file(1 :len_trim (prname_file))// ' .vtk' ,status= ' unknown' )
271
272
write (IOVTK,' (a)' ) ' # vtk DataFile Version 3.1'
272
273
write (IOVTK,' (a)' ) ' material model VTK file'
273
274
write (IOVTK,' (a)' ) ' ASCII'
274
275
write (IOVTK,' (a)' ) ' DATASET UNSTRUCTURED_GRID'
275
-
276
+
276
277
! writes out all points for each element, not just global ones
277
278
write (IOVTK, ' (a,i12,a)' ) ' POINTS ' , nspec* 8 , ' float'
278
279
do ispec= 1 ,nspec
279
- i = ibool(1 ,1 ,1 ,ispec)
280
+ i = ibool(1 ,1 ,1 ,ispec)
280
281
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
281
-
282
+
282
283
i = ibool(NGLLX,1 ,1 ,ispec)
283
284
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
284
-
285
+
285
286
i = ibool(NGLLX,NGLLY,1 ,ispec)
286
287
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
287
-
288
+
288
289
i = ibool(1 ,NGLLY,1 ,ispec)
289
- write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
290
-
290
+ write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
291
+
291
292
i = ibool(1 ,1 ,NGLLZ,ispec)
292
293
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
293
-
294
+
294
295
i = ibool(NGLLX,1 ,NGLLZ,ispec)
295
296
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
296
-
297
+
297
298
i = ibool(NGLLX,NGLLY,NGLLZ,ispec)
298
299
write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
299
-
300
+
300
301
i = ibool(1 ,NGLLY,NGLLZ,ispec)
301
- write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
302
+ write (IOVTK,' (3e18.6)' ) xstore_dummy(i),ystore_dummy(i),zstore_dummy(i)
302
303
enddo
303
304
write (IOVTK,* ) " "
304
305
305
306
! note: indices for vtk start at 0
306
- write (IOVTK,' (a,i12,i12)' ) " CELLS " ,nspec,nspec* 9
307
+ write (IOVTK,' (a,i12,i12)' ) " CELLS " ,nspec,nspec* 9
307
308
do ispec= 1 ,nspec
308
309
write (IOVTK,' (9i12)' ) 8 ,(ispec-1 )* 8 ,(ispec-1 )* 8+1 ,(ispec-1 )* 8+2 ,(ispec-1 )* 8+3 ,&
309
310
(ispec-1 )* 8+4 ,(ispec-1 )* 8+5 ,(ispec-1 )* 8+6 ,(ispec-1 )* 8+7
310
311
enddo
311
312
write (IOVTK,* ) " "
312
-
313
+
313
314
! type: hexahedrons
314
315
write (IOVTK,' (a,i12)' ) " CELL_TYPES " ,nspec
315
316
write (IOVTK,* ) (12 ,ispec= 1 ,nspec)
316
317
write (IOVTK,* ) " "
317
-
318
+
318
319
! writes out gll-data (velocity) for each element point
319
320
write (IOVTK,' (a,i12)' ) " POINT_DATA " ,nspec* 8
320
321
write (IOVTK,' (a)' ) " SCALARS gll_data float"
321
322
write (IOVTK,' (a)' ) " LOOKUP_TABLE default"
322
323
do ispec = 1 ,nspec
323
- i = ibool(1 ,1 ,1 ,ispec)
324
+ i = ibool(1 ,1 ,1 ,ispec)
324
325
write (IOVTK,' (3e18.6)' ) gll_data(1 ,1 ,1 ,ispec)
325
-
326
+
326
327
i = ibool(NGLLX,1 ,1 ,ispec)
327
328
write (IOVTK,' (3e18.6)' ) gll_data(NGLLX,1 ,1 ,ispec)
328
-
329
+
329
330
i = ibool(NGLLX,NGLLY,1 ,ispec)
330
331
write (IOVTK,' (3e18.6)' ) gll_data(NGLLX,NGLLY,1 ,ispec)
331
-
332
+
332
333
i = ibool(1 ,NGLLY,1 ,ispec)
333
- write (IOVTK,' (3e18.6)' ) gll_data(1 ,NGLLY,1 ,ispec)
334
-
334
+ write (IOVTK,' (3e18.6)' ) gll_data(1 ,NGLLY,1 ,ispec)
335
+
335
336
i = ibool(1 ,1 ,NGLLZ,ispec)
336
337
write (IOVTK,' (3e18.6)' ) gll_data(1 ,1 ,NGLLZ,ispec)
337
-
338
+
338
339
i = ibool(NGLLX,1 ,NGLLZ,ispec)
339
340
write (IOVTK,' (3e18.6)' ) gll_data(NGLLX,1 ,NGLLZ,ispec)
340
-
341
+
341
342
i = ibool(NGLLX,NGLLY,NGLLZ,ispec)
342
343
write (IOVTK,' (3e18.6)' ) gll_data(NGLLX,NGLLY,NGLLZ,ispec)
343
-
344
+
344
345
i = ibool(1 ,NGLLY,NGLLZ,ispec)- 1
345
346
write (IOVTK,' (3e18.6)' ) gll_data(1 ,NGLLY,NGLLZ,ispec)
346
347
enddo
0 commit comments