PyTOUGH icon indicating copy to clipboard operation
PyTOUGH copied to clipboard

Feature request: VTK import

Open tirons opened this issue 7 years ago • 2 comments

It does not appear that PyTOUGH has an import VTK feature? I am wondering how difficult that would be? I am willing to contribute.

I have VTK files (vts) which I have converted from PETREL GRDECL meshes. I want to close the loop and get them into TOUGH2/REACT for simulation.

Cheers

tirons avatar Mar 15 '18 23:03 tirons

You mean import from VTK to t2grid? That should be possible. Off the top of my head, I think it would involve:

  • constructing block names in some sensible way
  • calculating the block volumes and centroids, and connection areas and distances
  • assigning rock types? not sure if you have any rock data in your VTK- could just leave this out and assign a default rock type everywhere
  • assign default PARAM data

Implementation-wise, one question would be whether to use the VTK Python bindings or an alternative like meshio, to read the VTK mesh into Python. VTK may have geometric functions included for computing block volumes etc.? On the other hand, meshio is often more portable and less problematic than VTK.

acroucher avatar Mar 26 '18 22:03 acroucher

Thanks! Sorry to be getting back so late.

I've been using PyVTK bindings, and currently can already convert SUTRA and PETREL grids into VTK, and convert from VTK into SUTRA and PETREL/ECLIPSE. Basically, like you said, I just need to work on the conversion to TOUGH grids, which are specified in quite a different fashion than the columnar data in PETREL.

  • The block volumes are easy to calculate, there is a built in function for that in VTK.
  • Geometrical centre is also easy to calculate, connection distances are also easy, I need more familiarity with the TOUGH specifications to understand "connection areas" better.

I'll look into meshio, I have mainly been using vts (vtkStructuredGrid) which I don't think is supported by meshio.

I'll keep you appraised of my progress, if I have something worth sharing, I'll submit a pull request for pyTOUGH. Thanks!

-Trevor

On 26 March 2018 at 16:53, Adrian Croucher [email protected] wrote:

You mean import from VTK to t2grid? That should be possible. Off the top of my head, I think it would involve:

  • constructing block names in some sensible way
  • calculating the block volumes and centroids, and connection areas and distances
  • assigning rock types? not sure if you have any rock data in your VTK- could just leave this out and assign a default rock type everywhere
  • assign default PARAM data

Implementation-wise, one question would be whether to use the VTK Python bindings or an alternative like meshio, to read the VTK mesh into Python. VTK may have geometric functions included for computing block volumes etc.? On the other hand, meshio is often more portable and less problematic than VTK.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/acroucher/PyTOUGH/issues/15#issuecomment-376337644, or mute the thread https://github.com/notifications/unsubscribe-auth/APbWFJ_C0Xj3M8NwBlSragXJd-LVdH1Xks5tiXFqgaJpZM4StBko .

tirons avatar Apr 05 '18 14:04 tirons