Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot Static 3D Mesh from .dat File #54

Open
pierecnlnd opened this issue Dec 25, 2023 · 7 comments
Open

Plot Static 3D Mesh from .dat File #54

pierecnlnd opened this issue Dec 25, 2023 · 7 comments

Comments

@pierecnlnd
Copy link

I am seeking to read a .dat file and visualize the mesh static data in actual x, y, and z coordinates. Are there any built-in methods available in PyTough that I can utilize for this purpose?

@acroucher
Copy link
Owner

Yes, but you will need a mulgrid geometry file for your mesh. Then you can do 2D layer or slice visualization of any quantity using the mulgrid layer_plot() and slice_plot() methods, or export to VTK files for 3D visualization.

@pierecnlnd
Copy link
Author

Thank you, sir. Actually, I am still learning to use mulgrid but I already use software like Petrasim to create grid geometry. Is there any methods that you can recommend to convert either from mulgrid to .dat (Petrasim) or vice versa?

@acroucher
Copy link
Owner

If by ".dat" you mean the TOUGH2 input data file, then PyTOUGH does have methods for converting between .dat and mulgrid. If you have a mulgrid geometry you can use the t2grid.fromgeo() method to create the grid inside the .dat file. If you have a .dat file you can reverse-engineer a mulgrid geometry using the t2grid.rectgeo() method, but only if your grid is rectangular.

@medhay36
Copy link

medhay36 commented Feb 2, 2024

If by ".dat" you mean the TOUGH2 input data file, then PyTOUGH does have methods for converting between .dat and mulgrid. If you have a mulgrid geometry you can use the t2grid.fromgeo() method to create the grid inside the .dat file. If you have a .dat file you can reverse-engineer a mulgrid geometry using the t2grid.rectgeo() method, but only if your grid is rectangular.

Hello dear Adrian,

Can you please give us the full syntax of 't2grid.rectgeo()' ?
My TOUGH2 input data file is named INFILE.dat

I tried the following syntax but got errors
dat.grid=t2grid().rectgeo(origin_block =None, atmos_volume =1.e25, remove_inactive =True, atmos_type =2,
justify ='r',spaces =True, layer_snap =0.1, block_order =None,convention = 2, chars = ascii_lowercase + ascii_uppercase)

@acroucher
Copy link
Owner

That syntax looks ok. The obvious thing that can go wrong with rectgeo() is that the grid is not actually rectangular (e.g. it has areas of local refinement). What kind of errors did you get?

@medhay36
Copy link

medhay36 commented Feb 8, 2024

That syntax looks ok. The obvious thing that can go wrong with rectgeo() is that the grid is not actually rectangular (e.g. it has areas of local refinement). What kind of errors did you get?

Hello Adrian,

this is the most revealant error i encounter

ValueError: All-NaN slice encountered

image

@acroucher
Copy link
Owner

It looks like maybe your input file doesn't have block centres in the grid? You will definitely need those before you can make a geometry from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants