[cig-commits] r21754 - seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS

dkomati1 at geodynamics.org dkomati1 at geodynamics.org
Sun Apr 7 17:27:31 PDT 2013


Author: dkomati1
Date: 2013-04-07 17:27:31 -0700 (Sun, 07 Apr 2013)
New Revision: 21754

Modified:
   seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90
   seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.cfg
   seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.net
Log:
improved the code to display a CUBIT SPECFEM mesh with OpenDX


Modified: seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90
===================================================================
--- seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90	2013-04-08 00:10:54 UTC (rev 21753)
+++ seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/convert_CUBIT_SPECFEM_mesh_to_OpenDX.f90	2013-04-08 00:27:31 UTC (rev 21754)
@@ -1,19 +1,27 @@
 
   program convert_CUBIT_SPECFEM_to_DX
 
-! Dimitri Komatitsch, CNRS Marseille, France, March 2013
+! Dimitri Komatitsch, CNRS Marseille, France, April 2013
 
 ! convert CUBIT files that are in SPECFEM3D_Cartesian format to OpenDX format for visualization
 
   implicit none
 
+! this is for HEX8; the code below probably works for HEX27 as well, it will just display the first 8 points
+! i.e. it will display HEX27 elements as if they were HEX8
+  integer, parameter :: NGNOD = 8
+
   integer :: nspec,npoin
   integer :: ispec,ipoin
-  integer :: iread,idummy
+  integer :: ipoin_read,ispec_read,imat_read
   integer :: i1,i2,i3,i4,i5,i6,i7,i8
 
   real, dimension(:), allocatable :: x,y,z
 
+  integer, dimension(:), allocatable :: imat
+
+  integer, dimension(:,:), allocatable :: ibool
+
   real :: xread,yread,zread
   real :: val_color
 
@@ -24,10 +32,10 @@
     allocate(y(npoin))
     allocate(z(npoin))
     do ipoin = 1,npoin
-      read(23,*) iread,xread,yread,zread
-      x(iread) = xread
-      y(iread) = yread
-      z(iread) = zread
+      read(23,*) ipoin_read,xread,yread,zread
+      x(ipoin_read) = xread
+      y(ipoin_read) = yread
+      z(ipoin_read) = zread
     enddo
     close(23)
 
@@ -45,16 +53,30 @@
 ! open SPECFEM3D_Cartesian topology file to read the mesh elements
   open(unit=23,file='mesh_file',status='old',action='read')
   read(23,*) nspec
+  allocate(imat(nspec))
+  allocate(ibool(NGNOD,nspec))
 
   write(11,*) 'object 2 class array type int rank 1 shape 8 items ',nspec,' data follows'
 
 ! read local elements in this slice and output global DX elements
   do ispec=1,nspec
-    read(23,*) idummy,i1,i2,i3,i4,i5,i6,i7,i8
+    read(23,*) ispec_read,i1,i2,i3,i4,i5,i6,i7,i8
+    ibool(1,ispec_read) = i1
+    ibool(2,ispec_read) = i2
+    ibool(3,ispec_read) = i3
+    ibool(4,ispec_read) = i4
+    ibool(5,ispec_read) = i5
+    ibool(6,ispec_read) = i6
+    ibool(7,ispec_read) = i7
+    ibool(8,ispec_read) = i8
+  enddo
 
 ! point order in OpenDX is 4,1,8,5,3,2,7,6, *not* 1,2,3,4,5,6,7,8 as in AVS or SPECFEM
 ! and point numbers start at 0 rather than 1
-    write(11,"(i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9)") i4-1,i1-1,i8-1,i5-1,i3-1,i2-1,i7-1,i6-1
+  do ispec=1,nspec
+    write(11,"(i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9,1x,i9)") &
+                 ibool(4,ispec)-1,ibool(1,ispec)-1,ibool(8,ispec)-1,ibool(5,ispec)-1,&
+                 ibool(3,ispec)-1,ibool(2,ispec)-1,ibool(7,ispec)-1,ibool(6,ispec)-1
   enddo
 
   close(23)
@@ -67,8 +89,16 @@
     write(11,*) 'object 3 class array type float rank 0 items ',nspec,' data follows'
 
 ! read local elements in this slice and output global DX elements
+  open(unit=23,file='materials_file',status='old',action='read')
   do ispec=1,nspec
-    val_color = 1.0 ! dummy uniform color
+! beware: elements may not be listed in increasing order, they can appear in any order
+    read(23,*) ispec_read,imat_read
+    imat(ispec_read) = imat_read
+  enddo
+  close(23)
+
+  do ispec=1,nspec
+    val_color = imat(ispec) ! use material property read to color the elements
     write(11,*) val_color
   enddo
 

Modified: seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.cfg
===================================================================
--- seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.cfg	2013-04-08 00:10:54 UTC (rev 21753)
+++ seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.cfg	2013-04-08 00:27:31 UTC (rev 21754)
@@ -1,16 +1,16 @@
 //
-// time: Sun Feb 20 16:26:15 2005
+// time: Mon Apr  8 02:25:28 2013
 //
-// version: 3.2.0 (format), 4.3.2 (DX)
+// version: 3.2.0 (format), 4.4.4 (DX)
 //
 //
-// panel[0]: position = (0.0750,0.6982), size = 0.2781x0.1611, startup = 1, devstyle = 1
+// panel[0]: position = (0.0750,0.6981), size = 0.2781x0.1611, startup = 1, devstyle = 1
 // title: value = Control Panel
 //
 // workspace: width = 500, height = 500
 // layout: snap = 0, width = 50, height = 50, align = NN
 //
-// panel[2]: position = (0.3609,0.6982), size = 0.2773x0.1611, startup = 1, devstyle = 1
+// panel[2]: position = (0.3609,0.6981), size = 0.2771x0.1611, startup = 1, devstyle = 1
 // title: value = Control Panel
 //
 // workspace: width = 500, height = 500
@@ -18,16 +18,16 @@
 //
 // node Image[2]:
 // depth: value = 24
-// window: position = (0.0000,0.1631), size = 0.5664x0.6338
+// window: position = (0.0000,0.1630), size = 0.5661x0.6343
 // input[1]: defaulting = 0, value = "Image_2"
 // input[4]: defaulting = 0, value = 1
-// input[5]: defaulting = 0, value = [360000 130000 -9842.12]
-// input[6]: defaulting = 0, value = [293951 33251.2 58936.7]
-// input[7]: defaulting = 0, value = 72798.2
-// input[8]: defaulting = 0, value = 711
-// input[9]: defaulting = 0, value = 0.85443
-// input[10]: defaulting = 0, value = [0.244732 0.445238 0.861319]
-// input[11]: defaulting = 1, value = 30.0001
+// input[5]: defaulting = 0, value = [67000 67000 -30000]
+// input[6]: defaulting = 0, value = [430621 -380714 207366]
+// input[7]: defaulting = 0, value = 334244.0
+// input[8]: defaulting = 0, value = 1073
+// input[9]: defaulting = 0, value = 0.600652
+// input[10]: defaulting = 0, value = [-0.103508 0.398975 0.911101]
+// input[11]: defaulting = 1, value = 30.0
 // input[12]: defaulting = 0, value = 0
 // input[14]: defaulting = 0, value = 1
 // input[15]: defaulting = 0, value = "none"

Modified: seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.net
===================================================================
--- seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.net	2013-04-08 00:10:54 UTC (rev 21753)
+++ seismo/3D/SPECFEM3D/trunk/utils/Visualization/opendx_AVS/visualize_mesh_DX_new.net	2013-04-08 00:27:31 UTC (rev 21754)
@@ -1,7 +1,7 @@
 //
-// time: Sun Feb 20 16:26:15 2005
+// time: Mon Apr  8 02:25:28 2013
 //
-// version: 3.2.0 (format), 4.3.2 (DX)
+// version: 3.2.0 (format), 4.4.4 (DX)
 //
 //
 // MODULE main
@@ -101,13 +101,13 @@
     // node Image[2]: x = 192, y = 540, inputs = 49, label = Image
     // input[1]: defaulting = 0, visible = 0, type = 67108863, value = "Image_2"
     // input[4]: defaulting = 0, visible = 0, type = 1, value = 1
-    // input[5]: defaulting = 0, visible = 0, type = 8, value = [360000 130000 -9842.12]
-    // input[6]: defaulting = 0, visible = 0, type = 8, value = [293951 33251.2 58936.7]
-    // input[7]: defaulting = 0, visible = 0, type = 5, value = 72798.2
-    // input[8]: defaulting = 0, visible = 0, type = 1, value = 711
-    // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.85443
-    // input[10]: defaulting = 0, visible = 0, type = 8, value = [0.244732 0.445238 0.861319]
-    // input[11]: defaulting = 1, visible = 0, type = 5, value = 30.0001
+    // input[5]: defaulting = 0, visible = 0, type = 8, value = [67000 67000 -30000]
+    // input[6]: defaulting = 0, visible = 0, type = 8, value = [430621 -380714 207366]
+    // input[7]: defaulting = 0, visible = 0, type = 5, value = 334244.0
+    // input[8]: defaulting = 0, visible = 0, type = 1, value = 1073
+    // input[9]: defaulting = 0, visible = 0, type = 5, value = 0.600652
+    // input[10]: defaulting = 0, visible = 0, type = 8, value = [-0.103508 0.398975 0.911101]
+    // input[11]: defaulting = 1, visible = 0, type = 5, value = 30.0
     // input[12]: defaulting = 0, visible = 0, type = 1, value = 0
     // input[14]: defaulting = 0, visible = 0, type = 1, value = 1
     // input[15]: defaulting = 0, visible = 0, type = 32, value = "none"
@@ -123,7 +123,7 @@
     // input[36]: defaulting = 0, visible = 0, type = 3, value = 1
     // input[41]: defaulting = 0, visible = 0, type = 32, value = "rotate"
     // depth: value = 24
-    // window: position = (0.0000,0.1631), size = 0.5664x0.6338
+    // window: position = (0.0000,0.1630), size = 0.5661x0.6343
     // internal caching: 1
     //
 main_Image_2_out_1,
@@ -536,12 +536,12 @@
 main_Image_2_in_1 = "Image_2";
 main_Image_2_in_3 = "X24,,";
 main_Image_2_in_4 = 1;
-main_Image_2_in_5 = [360000 130000 -9842.12];
-main_Image_2_in_6 = [293951 33251.2 58936.7];
-main_Image_2_in_7 = 72798.2;
-main_Image_2_in_8 = 711;
-main_Image_2_in_9 = 0.85443;
-main_Image_2_in_10 = [0.244732 0.445238 0.861319];
+main_Image_2_in_5 = [67000 67000 -30000];
+main_Image_2_in_6 = [430621 -380714 207366];
+main_Image_2_in_7 = 334244.0;
+main_Image_2_in_8 = 1073;
+main_Image_2_in_9 = 0.600652;
+main_Image_2_in_10 = [-0.103508 0.398975 0.911101];
 main_Image_2_in_11 = NULL;
 main_Image_2_in_12 = 0;
 main_Image_2_in_13 = NULL;
@@ -580,6 +580,6 @@
 main_Image_2_in_47 = NULL;
 main_Image_2_in_48 = NULL;
 main_Image_2_in_49 = NULL;
-Executive("product version 4 3 2");
+Executive("product version 4 4 4");
 $sync
 main();



More information about the CIG-COMMITS mailing list