[cig-commits] [commit] devel: Add visualization tool with Medit for earth chunk (2ca2b91)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Nov 20 10:08:35 PST 2014
Repository : https://github.com/geodynamics/specfem3d
On branch : devel
Link : https://github.com/geodynamics/specfem3d/compare/b43c63c4cea034e3e6f647cebc591fb4c2ab3894...fb5ff57e01f82037a9b22ebd3c3c184e9e4f14f6
>---------------------------------------------------------------
commit 2ca2b919f65623f365f11c2de1d2681f0dc2ac45
Author: Clément Durochat <c.durochat at gmail.com>
Date: Thu Nov 20 18:38:16 2014 +0100
Add visualization tool with Medit for earth chunk
>---------------------------------------------------------------
2ca2b919f65623f365f11c2de1d2681f0dc2ac45
src/meshfem3D/meshfem3D.f90 | 8 +-
.../HEX27/visualize_HEX27_chunk_w_medit.f90 | 123 +++++++++++++++++++++
.../HEX8/visualize_HEX8_chunk_w_medit.f90 | 94 ++++++++++++++++
.../HOWTO_use_this_tool | 110 ++++++++++++++++++
4 files changed, 332 insertions(+), 3 deletions(-)
diff --git a/src/meshfem3D/meshfem3D.f90 b/src/meshfem3D/meshfem3D.f90
index bbcf6bb..1bf997a 100644
--- a/src/meshfem3D/meshfem3D.f90
+++ b/src/meshfem3D/meshfem3D.f90
@@ -419,11 +419,13 @@
stop 'Done creating a chunk of the earth Mesh (HEX8 elements), see directory MESH/'
else if (NGNOD == 27) then
+ ! provisional
+ stop 'Creating a chunk of the earth Mesh with HEX27 elements is implmented but not validated yet for coupling with DSM'
+
! creates mesh in MESH/
-!! call earth_chunk_HEX27_Mesher(NGNOD)
+ call earth_chunk_HEX27_Mesher(NGNOD)
! done with mesher
- stop 'Creating a chunk of the earth Mesh with HEX27 elements is implmented but not validated yet'
-!! stop 'Done creating a chunk of the earth Mesh (HEX27 elements), see directory MESH/'
+ stop 'Done creating a chunk of the earth Mesh (HEX27 elements), see directory MESH/'
else
stop 'Bad number of nodes per hexahedron : NGNOD must be equal to 8 or 27'
diff --git a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90 b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90
new file mode 100755
index 0000000..d6823f9
--- /dev/null
+++ b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27/visualize_HEX27_chunk_w_medit.f90
@@ -0,0 +1,123 @@
+PROGRAM visualize_HEX27_chunk_w_medit
+
+ implicit none
+
+ integer :: np, nhex, nquad, ios, i, nsph, nq1, nq2, nq3, nq4, nq5, nq6, nhexdecoup, nqdecoup
+ integer :: s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, &
+ s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27
+ integer :: sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ real*8 :: p1, p2, p3
+
+ open(unit=10,file='nodes_coords_file',status='unknown',iostat=ios)
+ open(unit=11,file='mesh_file',status='unknown',iostat=ios)
+ open(unit=31,file='absorbing_surface_file_bottom',status='unknown',iostat=ios)
+ open(unit=32,file='absorbing_surface_file_xmax',status='unknown',iostat=ios)
+ open(unit=33,file='absorbing_surface_file_xmin',status='unknown',iostat=ios)
+ open(unit=34,file='absorbing_surface_file_ymax',status='unknown',iostat=ios)
+ open(unit=35,file='absorbing_surface_file_ymin',status='unknown',iostat=ios)
+ open(unit=36,file='free_surface',status='unknown',iostat=ios)
+
+ open(unit=20,file='test_out_HEX27.mesh',status='unknown',iostat=ios)
+
+ READ(10,*) np
+ READ(11,*) nhex
+ READ(31,*) nq1
+ READ(32,*) nq2
+ READ(33,*) nq3
+ READ(34,*) nq4
+ READ(35,*) nq5
+ READ(36,*) nq6
+
+ PRINT*, 'CAUTION : the value for the number of faces on the free surface is hard imposed (225) !'
+
+ nq6 = 225 !! pourquoi ??
+
+ nhexdecoup = 8*nhex
+ nqdecoup = 4*(nq1 + nq2 + nq3 + nq4 + nq5 + nq6)
+
+ WRITE(20,*) 'MeshVersionFormatted 1'
+ WRITE(20,*) 'Dimension 3'
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Vertices'
+ WRITE(20,*) np
+
+ DO i=1,np
+ READ(10,*) nsph, p1, p2, p3
+ WRITE(20,*) p1, p2, p3, 1
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Quadrilaterals'
+ WRITE(20,*) nqdecoup
+
+
+ DO i=1,nq1
+ READ(31,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 2
+ WRITE(20,*) sf5, sf2, sf6, sf9, 2
+ WRITE(20,*) sf9, sf6, sf3, sf7, 2
+ WRITE(20,*) sf8, sf9, sf7, sf4, 2
+ ENDDO
+ DO i=1,nq2
+ READ(32,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 2
+ WRITE(20,*) sf5, sf2, sf6, sf9, 2
+ WRITE(20,*) sf9, sf6, sf3, sf7, 2
+ WRITE(20,*) sf8, sf9, sf7, sf4, 2
+ ENDDO
+ DO i=1,nq3
+ READ(33,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 2
+ WRITE(20,*) sf5, sf2, sf6, sf9, 2
+ WRITE(20,*) sf9, sf6, sf3, sf7, 2
+ WRITE(20,*) sf8, sf9, sf7, sf4, 2
+ ENDDO
+ DO i=1,nq4
+ READ(34,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 2
+ WRITE(20,*) sf5, sf2, sf6, sf9, 2
+ WRITE(20,*) sf9, sf6, sf3, sf7, 2
+ WRITE(20,*) sf8, sf9, sf7, sf4, 2
+ ENDDO
+ DO i=1,nq5
+ READ(35,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 2
+ WRITE(20,*) sf5, sf2, sf6, sf9, 2
+ WRITE(20,*) sf9, sf6, sf3, sf7, 2
+ WRITE(20,*) sf8, sf9, sf7, sf4, 2
+ ENDDO
+ DO i=1,nq6
+ READ(36,*) nsph, sf1, sf2, sf3, sf4, sf5, sf6, sf7, sf8, sf9
+ WRITE(20,*) sf1, sf5, sf9, sf8, 3
+ WRITE(20,*) sf5, sf2, sf6, sf9, 3
+ WRITE(20,*) sf9, sf6, sf3, sf7, 3
+ WRITE(20,*) sf8, sf9, sf7, sf4, 3
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Hexahedra'
+ WRITE(20,*) nhexdecoup
+
+ DO i=1,nhex
+ READ(11,*) nsph, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, &
+ s15, s16, s17, s18, s19, s20, s21, s22, s23, s24, s25, s26, s27
+!
+ WRITE(20,*) s1 , s9 , s21, s12, s13, s22, s27, s25, 1
+ WRITE(20,*) s9 , s2 , s10, s21, s22, s14, s23, s27, 1
+ WRITE(20,*) s21, s10, s3 , s11, s27, s23, s15, s24, 1
+ WRITE(20,*) s12, s21, s11, s4 , s25, s27, s24, s16, 1
+ WRITE(20,*) s13, s22, s27, s25, s5 , s17, s26, s20, 1
+ WRITE(20,*) s22, s14, s23, s27, s17, s6 , s18, s26, 1
+ WRITE(20,*) s27, s23, s15, s24, s26, s18, s7 , s19, 1
+ WRITE(20,*) s25, s27, s24, s16, s20, s26, s19, s8 , 1
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'End'
+
+ close(10)
+ close(11)
+ close(12)
+ close(20)
+
+END PROGRAM visualize_HEX27_chunk_w_medit
diff --git a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90 b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90
new file mode 100755
index 0000000..034a037
--- /dev/null
+++ b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8/visualize_HEX8_chunk_w_medit.f90
@@ -0,0 +1,94 @@
+PROGRAM visualize_HEX8_chunk_w_medit
+
+ implicit none
+
+ integer :: np, nhex, nquad, ios, i, nsph, nq1, nq2, nq3, nq4, nq5, nq6
+ integer :: s1, s2, s3, s4, s5, s6, s7, s8, sf1, sf2, sf3, sf4
+ real*8 :: p1, p2, p3
+
+ open(unit=10,file='nodes_coords_file',status='unknown',iostat=ios)
+ open(unit=11,file='mesh_file',status='unknown',iostat=ios)
+ open(unit=31,file='absorbing_surface_file_bottom',status='unknown',iostat=ios)
+ open(unit=32,file='absorbing_surface_file_xmax',status='unknown',iostat=ios)
+ open(unit=33,file='absorbing_surface_file_xmin',status='unknown',iostat=ios)
+ open(unit=34,file='absorbing_surface_file_ymax',status='unknown',iostat=ios)
+ open(unit=35,file='absorbing_surface_file_ymin',status='unknown',iostat=ios)
+ open(unit=36,file='free_surface',status='unknown',iostat=ios)
+
+ open(unit=20,file='test_out_HEX8.mesh',status='unknown',iostat=ios)
+
+ READ(10,*) np
+ READ(11,*) nhex
+
+ READ(31,*) nq1
+ READ(32,*) nq2
+ READ(33,*) nq3
+ READ(34,*) nq4
+ READ(35,*) nq5
+ READ(36,*) nq6
+
+ PRINT*, 'CAUTION : the value for the number of faces on the free surface is hard imposed (225) !'
+
+ nq6 = 225 !! pourquoi ??
+
+ nquad = nq1 + nq2 + nq3 + nq4 + nq5 + nq6
+
+ WRITE(20,*) 'MeshVersionFormatted 1'
+ WRITE(20,*) 'Dimension 3'
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Vertices'
+ WRITE(20,*) np
+
+ DO i=1,np
+ READ(10,*) nsph, p1, p2, p3
+ WRITE(20,*) p1, p2, p3, 1
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Quadrilaterals'
+ WRITE(20,*) nquad
+
+
+ DO i=1,nq1
+ READ(31,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 2
+ ENDDO
+ DO i=1,nq2
+ READ(32,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 2
+ ENDDO
+ DO i=1,nq3
+ READ(33,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 2
+ ENDDO
+ DO i=1,nq4
+ READ(34,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 2
+ ENDDO
+ DO i=1,nq5
+ READ(35,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 2
+ ENDDO
+ DO i=1,nq6
+ READ(36,*) nsph, sf1, sf2, sf3, sf4
+ WRITE(20,*) sf1, sf2, sf3, sf4, 3
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'Hexahedra'
+ WRITE(20,*) nhex
+
+ DO i=1,nhex
+ READ(11,*) nsph, s1, s2, s3, s4, s5, s6, s7, s8
+ WRITE(20,*) s1, s2, s3, s4, s5, s6, s7, s8, 1
+ ENDDO
+
+ WRITE(20,*) ' '
+ WRITE(20,*) 'End'
+
+ close(10)
+ close(11)
+ close(12)
+ close(20)
+
+END PROGRAM visualize_HEX8_chunk_w_medit
diff --git a/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HOWTO_use_this_tool b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HOWTO_use_this_tool
new file mode 100644
index 0000000..31c01cf
--- /dev/null
+++ b/utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HOWTO_use_this_tool
@@ -0,0 +1,110 @@
+!======================================================================================================================!
+
+This tool allows to visualize a chunk of the earth (with HEX8 or HEX27 elements) with the software Medit
+
+Reminder : to create a mesh of a earth chunk (in the case of coupling with DSM), the parameter MESH_A_CHUNK_OF_THE_EARTH
+in DATA/Par_file have to set .true., and this will be call a specific internal for that in meshfem3D.f90
+
+!======================================================================================================================!
+
+Step 1 : Install Medit
+----------------------
+
+Medit is a visualization software for meshes, created by Pascal Frey.
+
+To install it go to this page, section 'SCIENTIFIC VISUALIZATION' : https://www.ljll.math.upmc.fr/frey/software.html
+
+The Medit documentation (Caution : it is in french, and the html links in the page are obsolete) : https://www.ljll.math.upmc.fr/frey/logiciels/Docmedit.dir/index.html
+
+!======================================================================================================================!
+
+a/ HEX8 case (for HEX27 case, go l. 65) :
+
+!======================================================================================================================!
+
+Step 2a : Run the earth chunk mesher with NGNOD=8, for coupling with DSM
+------------------------------------------------------------------------
+
+In the case of coupling with DSM, when you run xmeshfem3D, a subdirectory MESH is created in the directory of
+the concerned example, and several files appears.
+
+Among them, copy the files below in utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8
+(path from the specfem3d main directory) :
+
+- nodes_coords_file
+- mesh_file
+- absorbing_surface_file_bottom
+- absorbing_surface_file_xmax
+- absorbing_surface_file_xmin
+- absorbing_surface_file_ymax
+- absorbing_surface_file_ymin
+- free_surface
+
+!======================================================================================================================!
+
+Step 3a : compile and run the tool
+----------------------------------
+
+From the directory utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX8, type :
+
+$ gfortran -o executable_name visualize_HEX8_chunk_w_medit.f90
+$ ./executable_name
+
+A file 'test_out_HEX8.mesh' will be created
+
+!======================================================================================================================!
+
+Step 4a : visualize with Medit
+------------------------------
+
+If the version of Medit you installed is aliased to 'medit', type :
+
+$ medit test_out_HEX8.mesh &
+
+!======================================================================================================================!
+
+b/ HEX27 case :
+
+!======================================================================================================================!
+
+Step 2b : Run the earth chunk mesher with NGNOD=27, for coupling with DSM
+-------------------------------------------------------------------------
+
+In the case of coupling with DSM, when you run xmeshfem3D, a subdirectory MESH is created in the directory of
+the concerned example, and several files appears.
+
+Among them, copy the files below in utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27
+(path from the specfem3d main directory) :
+
+- nodes_coords_file
+- mesh_file
+- absorbing_surface_file_bottom
+- absorbing_surface_file_xmax
+- absorbing_surface_file_xmin
+- absorbing_surface_file_ymax
+- absorbing_surface_file_ymin
+- free_surface
+
+!======================================================================================================================!
+
+Step 3b : compile and run the tool
+----------------------------------
+
+From the directory utils/Visualization/visualize_chunk_of_the_earth_with_MEDIT/HEX27, type :
+
+$ gfortran -o executable_name visualize_HEX27_chunk_w_medit.f90
+$ ./executable_name
+
+A file 'test_out_HEX27.mesh' will be created
+
+!======================================================================================================================!
+
+Step 4b : visualize with Medit
+------------------------------
+
+If the version of Medit you installed is aliased to 'medit', type :
+
+$ medit test_out_HEX27.mesh &
+
+CAUTION : the principle of this visualization in HEX27 elements, is to decompose
+HEX27 elements into eight HEX8 elements. So you will see HEX27 elements as eight HEX8 elements
More information about the CIG-COMMITS
mailing list