SPECFEM / specfem3d

SPECFEM3D_Cartesian simulates acoustic (fluid), elastic (solid), coupled acoustic/elastic, poroelastic or seismic wave propagation in any type of conforming mesh of hexahedra (structured or not).
GNU General Public License v3.0
406 stars 226 forks source link

geocubit wouldn't work on TrelisPro14.0.5:IndexError: tuple index out of range #769

Closed JimmyZJU closed 8 years ago

JimmyZJU commented 8 years ago

I have run block_mesh.py in homogenous_halfspace subfloder by Trelis. The running process is as fllowing. Trelis> #### Export to SESAME format using cubit2specfem3d.py of GEOCUBIT Trelis> Turning informational messages on. Finished Command: set info on

Echoing has been turned ON Finished Command: set echo on

1 elastic 1 (1, 2, 3, 4, 5, 6, 7, 8) HEX8 HEX8 QUAD4 2 face_topo (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 3 face_abs_xmin (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 4 face_abs_xmax (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 5 face_abs_ymin (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 6 face_abs_ymax (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 7 face_abs_bottom (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 8 face_abs (1, 2, 3, 4, 5, 6, 7, 8) SHELL4 HEX8 QUAD4 Preserving undo information...done Finished Command: compress

Turning informational messages off. Writing MESH/mesh_file..... number of elements: 20736 Ok Writing MESH/materials_file..... Ok Writing MESH/nodes_coords_file..... number of nodes: 23273 Ok Writing MESH/nummaterial_velocity_file.....

material properties:

(2, 1, 2800.0, 1500.0, 2300.0, 9000.0, 0.0) Ok Writing MESH/free_surface_file..... block name: face_topo id: 2 number of faces = 1296 Traceback (most recent call last): File "", line 1, in File "cubit2specfem3d.py", line 766, in export2SESAME sem_mesh.write(path=path_exporting_mesh_SPECFEM3D_SESAME) File "cubit2specfem3d.py", line 752, in write self.free_write(path+self.freename) File "cubit2specfem3d.py", line 606, in free_write nodes_ok=self.normal_check(nodes,normal) File "cubit2specfem3d.py", line 276, in normal_check p0=cubit.get_nodal_coordinates(nodes[0]) IndexError: tuple index out of range Trelis> Trelis> # all files needed by SCOTCH are now in directory MESH Trelis> Trelis>

danielpeter commented 8 years ago

the script "block_mesh.py" has been replaced by "create_mesh.py" in the newer versions of the devel branch. please update your SPECFEM3D version to the current devel branch if you need Trelis14+ support and try again with the new script.

JimmyZJU commented 8 years ago

Sorry, the problem haven't been solved. I have downloaded "create_mesh.py" in the code page: specfem3d/EXAMPLES/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/create_mesh.py And run "create_mesh.py" instead of "block_mesh.py", as the result, there still has something wrong with Trelis. The MSEH subfloder only have 7 items: free_surface_file(1kb), materials_file(466kb), mesh_file(2026kb), meshing.cub(1745kb), nodes_coords_file(1705kb), nummaterial_velocity_file(1kb), top.e(1448kb). There's no file about absorbing_surface at all, and the free_surface_file is not intact. The running process of Trelis is as fllowing. set node constraint on Finished Command: undo on \ Now playing C:\Users\Lenovo\Desktop\homogeneous_halfspace\create_mesh.py ** Trelis> #!/usr/bin/env python Trelis> Trelis> # "create_mesh.py" is a script that generates mesh specific to homogenous halfspace example Trelis> # i.e., a uniform mesh of 134 km x 134 km x 60 km with an element size 3.75 km. Trelis> # It is not applicable to other examples. Trelis> # to run this script from command line, python must have its PATH environment set such that it Trelis> # includes the path to CUBIT/Trelis (cubit.py). Trelis> # Trelis> # you can also explicitly set it here e.g. like: Trelis> #sys.path.append('/opt/Trelis-15.0/bin/') Trelis> ['G:\ZJU\Numerical Simulation\Trelis\GUI', 'G:/ZJU/Numerical Simulation/Trelis/structure', 'G:/ZJU/Numerical Simulation/Trelis/bin', 'G:\ZJU\Numerical Simulation\Trelis\bin\python27.zip', 'G:\ZJU\Numerical Simulation\Trelis\bin\DLLs', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\plat-win', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\lib-tk', 'G:\ZJU\Numerical Simulation\Trelis\bin', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\site-packages', ''] Trelis> # gets version string Trelis> Trelis> version: 14.0.5 Trelis> Trelis> # extracts major number Trelis> major version number: 14 Trelis> Trelis> # current work directory Trelis> pwd Current directory is 'C:\Users\Lenovo\Desktop\homogeneous_halfspace\' Trelis> Trelis> # Creating the volumes Trelis> reset Default CUBIT model file is 'C:\Users\Lenovo\Desktop\homogeneous_halfspace\cubit01.cub'

Finished Command: reset

Trelis> Trelis> # single volume Trelis> brick x 134000 y 134000 z 60000 Successfully created brick volume 1 Finished Command: brick x 134000 y 134000 z 60000

Trelis> volume 1 move x 67000 y 67000 z -30000 Finished Command: volume 1 move x 67000 y 67000 z -30000

Trelis> Trelis> # two merged volumes Trelis> #cubit.cmd('brick x 67000 y 134000 z 60000') Trelis> #cubit.cmd('volume 1 move x 33500 y 67000 z -30000') Trelis> #cubit.cmd('brick x 67000 y 134000 z 60000') Trelis> #cubit.cmd('volume 2 move x 100500 y 67000 z -30000') Trelis> #cubit.cmd('merge all') Trelis> Trelis> # Meshing the volumes Trelis> Trelis> Trelis> volume all size '+str(elementsize)) Finished Command: volume all size 3750

Trelis> mesh volume all Volume 1 (Volume 1) meshing scheme automatically set to submap. Matching intervals successful. Meshing Volume 1 (Volume 1) Generated 1296 faces for Surface 1 (Surface 1). Generated 1296 faces for Surface 2 (Surface 2). Generated 576 faces for Surface 3 (Surface 3). Generated 576 faces for Surface 4 (Surface 4). Generated 576 faces for Surface 5 (Surface 5). Generated 576 faces for Surface 6 (Surface 6). Generated 20736 hexes for Volume 1 (Volume 1). Volume 1 (Volume 1) meshing completed using scheme: submap

Meshing time: 0.111000 Finished Command: mesh volume all

Trelis> Trelis> # End of meshing Trelis> Trelis> # Trelis> # GEOCUBIT Trelis> # Trelis> # adds path to geocubit (if not setup yet)

Trelis> path: Trelis> ['G:\ZJU\Numerical Simulation\Trelis\GUI', 'G:/ZJU/Numerical Simulation/Trelis/structure', 'G:/ZJU/Numerical Simulation/Trelis/bin', 'G:\ZJU\Numerical Simulation\Trelis\bin\python27.zip', 'G:\ZJU\Numerical Simulation\Trelis\bin\DLLs', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\plat-win', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\lib-tk', 'G:\ZJU\Numerical Simulation\Trelis\bin', 'G:\ZJU\Numerical Simulation\Trelis\bin\lib\site-packages', '', '../../CUBIT_GEOCUBIT/'] Trelis>

Trelis> Trelis> ## Trelis> Traceback (most recent call last): File "", line 1, in ImportError: No module named geocubitlib Trelis> Trelis> # avoids assigning empty blocks Trelis> set duplicate block elements on Setting duplicate block elements to ON. Finished Command: set duplicate block elements on

Trelis> Trelis> # bounding faces Trelis> Traceback (most recent call last): File "", line 1, in NameError: name 'boundary_definition' is not defined Trelis> Traceback (most recent call last): File "", line 1, in NameError: name 'boundary_definition' is not defined Trelis> Trelis> # creates MESH/ directory for file output Trelis> Trelis> Trelis> # conversion to specfem-format Trelis> # use_explicit will explicitly assign material properties as block attributes

Trelis> Traceback (most recent call last): File "", line 37, in ImportError: No module named geocubitlib Trelis> # backup cubit Trelis> export mesh "MESH/top.e" dimension 3 overwrite

Using ExodusII API version 4.98 and DB version 4.98 to export "MESH/top.e".

Executive Exodus summary: Number of dimensions = 3 Number of element blocks = 1 Number of sidesets = 0 Number of nodesets = 0 Number of bc sets = 1 Number of elements = 20736 Number of nodes = 23273

Finished writing MESH/top.e Finished Command: export mesh "MESH/top.e" dimension 3 overwrite

Trelis> save as "MESH/meshing.cub" overwrite

Exported: 1 Volume

Successfully saved CUBIT file 'C:\Users\Lenovo\Desktop\homogeneous_halfspace\MESH\meshing.cub' Finished Command: save as "MESH/meshing.cub" overwrite

Trelis> Trelis> # all files needed by xdecompose_mesh are now in directory MESH/ Trelis>

danielpeter commented 8 years ago

Please make sure also that you updated all files in folder CUBIT_GEOCUBIT/ and that the path to folder CUBIT_GEOCUBIT/ is set correctly, see in create_mesh.py: (line 68)

#
# GEOCUBIT
#
# adds path to geocubit (if not setup yet)
sys.path.append('../../CUBIT_GEOCUBIT/')

either this is not correct in your setup or the file CUBIT_GEOCUBIT/geocubitlib/boundary_definition.py is missing in your installation. please check and update this line if necessary to find the right location. this will then automatically detect the boundaries of the mesh.

QuLogic commented 8 years ago

sorry for the code rendering above

Use triple-backticks for a code block instead of single backticks for inline code.

JimmyZJU commented 8 years ago

Thank you! It works out after update all the files in geocubitlib. But I want to know what's the difference between the function use_explicit=1 and use_explicit=0 when mesh files convert to specfem-format.The output files in MESH is same either I choose use_explicit=1 or use_explicit=0.

danielpeter commented 8 years ago

the use_explicit option basically chooses how to assign the material properties for the volume (or domain): (1) one way is to explicitly assign block attributes to the block of the corresponding volume, by commands like cubit.cmd('block '+str(id_block)+' attribute index 2 2800') # vp this is done when using use_explicit = 1. the final command cubit2specfem3d.export2SPECFEM3D('MESH/') will then create the corresponding MESH/nummaterial_velocity_file for all such defined block volumes/domains.

(2) the other option with use_explicit = 0 is to let geocubit deal with a dummy entry and the overwrite the nummaterial_velocity_file with a corresponding f=open(nummaterial_velocity_file,'w') statement at the end. this second way is chosen by default because geocubit can handle partitions for several processes and glues everything together automatically. thus adds some more sophistication when the model gets more complicated than just this single volume example.

you will find out by experimenting what is easier for your case. i used the first option quite a bit when manually constructing meshes with different domains (acoustic/elastic) to assign properties on blocks.

komatits commented 8 years ago

Hi Daniel,

Could you cut and paste your email below in the users manual?

Thanks, Dimitri.

On 16/06/2016 22:00, daniel peter wrote:

the use_explicit option basically chooses how to assign the material properties for the volume (or domain): (1) one way is to explicitly assign block attributes to the block of the corresponding volume, by commands like |cubit.cmd('block '+str(id_block)+' attribute index 2 2800') # vp| this is done when using |use_explicit = 1|. the final command |cubit2specfem3d.export2SPECFEM3D('MESH/')| will then create the corresponding |MESH/nummaterial_velocity_file| for all such defined block volumes/domains.

(2) the other option with |use_explicit = 0| is to let geocubit deal with a dummy entry and the overwrite the |nummaterial_velocity_file| with a corresponding |f=open(nummaterial_velocity_file,'w')| statement at the end. this second way is chosen by default because geocubit can handle partitions for several processes and glues everything together automatically. thus adds some more sophistication when the model gets more complicated than just this single volume example.

you will find out by experimenting what is easier for your case. i used the first option quite a bit when manually constructing meshes with different domains (acoustic/elastic) to assign properties on blocks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/geodynamics/specfem3d/issues/769#issuecomment-226596528, or mute the thread https://github.com/notifications/unsubscribe/AFjDKUoZPIYc-2zoncQNlBOqU4xmtFdGks5qMatIgaJpZM4I19ny.

Dimitri Komatitsch CNRS Research Director (DR CNRS), Laboratory of Mechanics and Acoustics, UPR 7051, Marseille, France http://komatitsch.free.fr

JimmyZJU commented 8 years ago

Thank you for your patiently answering indeed!