0

Visualizing grid blocks

Dears,

 

I have the attached MESH file generated using MESHMAKER. I would like to know if there is a simple Python code that enables me to read and visualize the grid blocks in Pyvista.

 

Thanks in advance 

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Refaat,

    toughio's has some mesh generating capabilities that provide more flexibility than TOUGH's built-in meshmaker (although MINC is not currently supported).

    In your case, your mesh can be easily generated (and visualized) with toughio with the following script:

    import toughio
    
    dx = [1.0, 1.0, 2.0, 4.0, 4.0, 8.0, 15.0, 20.0, 30.0, 40.0, 50.0, 50.0, 100.0, 150.0, 50.0, 150.0, 300.0, 50.0, 475.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 500.0, 1.e-3]
    dy = [7.0, 6.0, 6.0, 2.5, 1.0, 2.5, 6.0, 12.0, 6.0, 3.0, 3.0, 3.0, 6.0, 12.0, 6.0, 3.0, 3.0, 3.0, 6.0, 12.0, 6.0, 3.0, 3.0, 3.0, 6.0, 12.0, 6.0, 3.0, 3.0, 3.0, 6.0, 12.0, 6.0, 3.0]
    dz = 10 * [5.0]
    mesh = toughio.meshmaker.structured_grid(dx, dy, dz)
    mesh.plot(show_edges=True, notebook=False)
    

    I might add a function to generate a mesh by reading a MESHMAKER block.

    Like
    • Keurfon Luu Thanks. Yes, this technique is more flexible. I think it is needed to add a line to write the generated mesh in MESH file.

      Like
    • Refaat G Hashish Yeah, to export to MESH file, simply run:

      mesh.write_tough()
      

      In addition, you can also define initial and boundary conditions and then write MESH and INCON files at the same time with the option "incon":

      mesh.write_tough(incon=True)

      See documentation here: https://keurfonluu.github.io/toughio/examples/co2_leakage_along_a_fault/2_generate_mesh_and_incon_files.html#sphx-glr-examples-co2-leakage-along-a-fault-2-generate-mesh-and-incon-files-py

      Like
    • Keurfon Luu I got it. Thanks a lot !

      Like
    • Keurfon Luu I am trying to use toughio to generate mesh with the following grid size:

      dx = [2901.070796, 1490.477176, 252.8552933, 138.3925339, 75.74487841, 41.45661939, 22.69, 12.41867059, 6.796975727, 3.720114701, 2.036089865, 1.114390892, 0.60992743, 0.333824938, 0.182708768, 0.05, 0.182708768, 0.333824938, 0.60992743, 1.114390892, 2.036089865, 3.720114701, 6.796975727, 12.41867059, 22.69, 22.69, 12.41867059, 6.796975727, 3.720114701, 2.036089865, 1.114390892, 0.60992743, 0.333824938, 0.182708768, 0.05, 0.182708768, 0.333824938, 0.60992743, 1.114390892, 2.036089865, 3.720114701, 6.796975727, 12.41867059, 22.69, 41.45661939, 75.74487841, 138.3925339, 252.8552933, 1490.477176, 2901.070796]

      When I get the the MESH file of the grid model (attached), I find the coordinates are rounded to the nearest integer.

      A3L44          rock37.7112e+02                        4953.0    5129.0      -2.5
      A3L45          rock31.5422e+03                        4953.0    5129.0     -10.0
      A3L46          rock23.0845e+03                        4953.0    5129.0     -25.0
      A3L47          rock31.0025e+04                        4953.0    5129.0     -67.5
      A3L48          rock31.5422e+04                        4953.0    5129.0    -150.0
      A3L49          rock31.5422e+04                        4953.0    5129.0    -250.0
      A3L50          rock31.5422e+04                        4953.0    5129.0    -350.0
      A3L51          rock31.5422e+04                        4953.0    5129.0    -450.0
      A3L52          rock31.5422e+04                        4953.0    5129.0    -550.0
      A3L53          rock31.5422e+04                        4953.0    5129.0    -650.0
      A3L54          rock31.5422e+04                        4953.0    5129.0    -750.0
      A3L55          rock31.5422e+04                        4953.0    5129.0    -850.0
      A3L56          rock31.5422e+04                        4953.0    5129.0    -950.0
      A3L57          rock11.5422e+04                        4953.0    5129.0   -1050.0

      I wounder if can use the code to generate mesh with accurate coordinates (numbers with 3 decimals).

      Like
  • I have used your Toughio code to convert a FLAC3d grid to tough mesh. now i need to check if the converted mesh is correct . can there a simple way to visualize the tough mesh in 3D ??

     

    Thank you in advance

    Like
Like Follow
  • 2 mths agoLast active
  • 6Replies
  • 257Views
  • 3 Following