acroucher / PyTOUGH

A Python library for automating TOUGH2 simulations of subsurface fluid and heat flow
GNU Lesser General Public License v3.0
95 stars 36 forks source link

.json() conversion from TOUGH2 dat #56

Open pierecnlnd opened 3 months ago

pierecnlnd commented 3 months ago

Hello,

Firstly, thank you for the straightforward conversion using the json() method. Recently, I have been studying simulation with TOUGH2 and acquired the .dat file from Petrasim extraction. I have diligently followed the provided instructions, including utilizing the rectgeo methods for the grid and renaming blocks. However, despite these efforts, I am encountering the error attached below. I would greatly appreciate your assistance in resolving this issue. Thank you for your consideration.

Best regards, mpc

The code from t2data import * dat = t2data( filename='TS090524.dat' ) geo = dat.grid geo_mg, geo_mg_naming = geo.rectgeo() geo_mg.write('gTS090524.dat') geo_map = dat.grid.blockmap(geo_mg) geo_map = {v: k for k, v in geo_map.items()} dat.rename_blocks(geo_map) dat.json( geo=geo_mg, mesh_filename='gTS090524' )

The error `Traceback (most recent call last): File "C:\Users\piere\Try Running\Using PyTOUGH\waiwera_conversion_research\test1.py", line 31, in dat.json( File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2791, in json jsondata.update(self.mesh_json(geo, mesh_filename)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2076, in mesh_json con = self.grid.connection[blknames]


KeyError: ('  a 2', '  a 1')`
acroucher commented 3 months ago

hi, I think I can see what the problem is. Petrasim is using a different way of ordering the blocks in the connections, so PyTOUGH is looking for e.g. connection (' a 2', ' a 1') but not finding it, because it's there as (' a 1', ' a 2').

I will try to modify rectgeo() so that it respects the way blocks are ordered in the connections in the original data file. That should fix the problem.

pierecnlnd commented 3 months ago

Thank you for your acknowledgment. It would be greatly appreciated if you could update the code to address the connection issue. I eagerly await the update.

acroucher commented 3 months ago

I have just pushed a commit to the PyTOUGH testing branch which should address this problem. Are you able to install the testing branch and test it?

I tried it on another data file generated by Petrasim. I modified your script slightly:

from t2data import *
import json

dat = t2data(filename='model.dat')
geo, blockmap = dat.grid.rectgeo()
geo.write('gmodel.dat')

dat.rename_blocks(blockmap, invert = True)
j = dat.json(geo, 'gmodel.msh', eos = 1)

with open('model.json', 'w') as f:
    json.dump(j, f, indent = 2, sort_keys = True)

Main changes:

pierecnlnd commented 3 months ago

Thank you for your prompt response. It appears that the error regarding blockmap naming inversion has been resolved. However, a new issue has arisen concerning generation. I have attached the .dat file extracted from my Petrasim for your reference. I would appreciate your assistance in resolving this new issue.

The error. Traceback (most recent call last): File "C:\Users\piere\Try Running\Using PyTOUGH\waiwera_conversion_research\test1.py", line 29, in <module> j = dat.json(geo, 'gT1DP290424.msh', eos=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2825, in json jsondata.update(self.generators_json(geo, jsondata['eos']['name'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2573, in generators_json g = generator_json(gen) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2502, in generator_json g = delv_generator_json(g, gen) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\piere\AppData\Roaming\Python\Python311\site-packages\t2data.py", line 2419, in delv_generator_json if gen.ltab > 1: ^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int'

T1DP290424.zip

acroucher commented 3 months ago

OK, thanks for that, one of your generators has a blank LTAB and I wasn't checking for it. I have pushed another fix to the testing branch. It seems to convert your model to JSON ok now.

I did notice that your two DELV generators appear to have bottomhole pressures for the deliverability defined as 85 Pa and 95 Pa - they seem very low?

pierecnlnd commented 3 months ago

Thank you again for your response. I am pleased to inform you that the Python file runs flawlessly. My objective in building the model is to analyze the pressure, temperature, and tracer sensitivity by manipulating the porosity and permeability parameters so I set the pressure to 80-90 bar actually, is it change to Pa all of a sudden?

I have revised the code accordingly (attached). However, upon executing it in Waiwera, I encountered the following error (attached). I would appreciate your assistance in resolving this issue.

The code

from t2data import * import json

dat = t2data(filename='T1DP290424.dat') geo, blockmap = dat.grid.rectgeo() geo.write('gT1DP290424.dat')

dat.rename_blocks(blockmap, invert = True) geo.write('gT1DP290424.msh') j = dat.json(geo, 'gT1DP290424.msh', eos=1)

with open('T1DP290424.json', 'w') as f: json.dump(j, f, indent = 2, sort_keys = True)

The error `- [info, input, default, {"eos.primary.scale.temperature": 0.100000E+03}] [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Unexpected data in file [0]PETSC ERROR: File is not a valid Gmsh file, expecting $MeshFormat [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.15.5, unknown [0]PETSC ERROR: /opt/waiwera/build/waiwera on a release named 7f8ae59c7ee3 by Unknown Fri May 10 05:46:55 2024 [0]PETSC ERROR: Configure options --download-fblaslapack --download-triangle --download-netcdf --download-exodusii --download-pnetcdf --download-ptscotch --download-chaco --download-zlib --download-hdf5 --with-debugging=0 COPTFLAGS="-O3 -march=x86-64 -mtune=generic" CXXOPTFLAGS="-O3 -march=x86-64 -mtune=generic" FOPTFLAGS="-O3 -march=x86-64 -mtune=generic" [0]PETSC ERROR: #1 GmshExpect() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexgmsh.c:267 [0]PETSC ERROR: #2 DMPlexCreateGmshFromFile() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexgmsh.c:1392 [0]PETSC ERROR: #3 DMPlexCreateFromFile() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexcreate.c:3642 [0]PETSC ERROR: #4 User provided function() at User file:0 [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger [0]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind [0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors [0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run [0]PETSC ERROR: to get more information on the crash. [0]PETSC ERROR: #5 User provided function() at unknown file:0 [0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash. application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0

Error running Waiwera in Docker container 7f8ae59c7ee3.`

pierecnlnd commented 3 months ago

I just open the '.msh' file and it's fine. image

When I run waiwera, it still show this error. [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Unexpected data in file [0]PETSC ERROR: File is not a valid Gmsh file, expecting $Entities [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.15.5, unknown [0]PETSC ERROR: /opt/waiwera/build/waiwera on a release named 1dd8aa37f3f9 by Unknown Sat May 11 12:31:42 2024 [0]PETSC ERROR: Configure options --download-fblaslapack --download-triangle --download-netcdf --download-exodusii --download-pnetcdf --download-ptscotch --download-chaco --download-zlib --download-hdf5 --with-debugging=0 COPTFLAGS="-O3 -march=x86-64 -mtune=generic" CXXOPTFLAGS="-O3 -march=x86-64 -mtune=generic" FOPTFLAGS="-O3 -march=x86-64 -mtune=generic" [0]PETSC ERROR: #1 GmshExpect() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexgmsh.c:267 [0]PETSC ERROR: #2 DMPlexCreateGmsh() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexgmsh.c:1510 [0]PETSC ERROR: #3 DMPlexCreateGmshFromFile() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexgmsh.c:1409 [0]PETSC ERROR: #4 DMPlexCreateFromFile() at /opt/waiwera/external/PETSc/src/dm/impls/plex/plexcreate.c:3642 [0]PETSC ERROR: #5 User provided function() at User file:0

pierecnlnd commented 3 months ago

Following the export from the Gmsh application, the model runs smoothly without any issues. However, I remain uncertain about the underlying differences. Nevertheless, I appreciate your assistance thus far. Thank you.

acroucher commented 3 months ago

In your script above you are writing the mesh file using the line:

geo.write('gT1DP290424.msh')

which won't work - the write() method will write the mulgrid geometry out in MULgraph geometry file format, not GMSH.

You would need to use the mulgrid write_mesh() method to export it to GMSH format. See the PyTOUGH user guide for details.

There are various versions of the GMSH format, and the PETSc library that Waiwera uses doesn't support the latest ones yet. Depending on which version of GMSH and meshio you have installed, it may by default write the mesh out to a version of the GMSH format not supported by PETSc. For that reason it is usually safest to specify the version explicitly when you write, e.g.:

geo.write_mesh('gT1DP290424.msh', file_format = 'gmsh22')
acroucher commented 3 months ago

I have just found out a bit more about this. The meshio library used by PyTOUGH can write GMSH mesh files in two GMSH file formats, 2.2 and 4.1. PETSc does in fact support both of them. The 4.1 format introduced a new optional section called $Entities. By default, meshio doesn't write this section, but PETSc expects it to be present and will complain if it isn't, as you saw, saying it isn't a valid GMSH file.

When you wrote out your mesh from GMSH itself it would have written the $Entities section, giving you a mesh that PETSc was happy with.

I have suggested to the PETSc developers that they make the $Entities section optional. That may take some time. So in the meantime, as I said, it is usually safest to stick to GMSH file format 2.2, by specifying file_format = 'gmsh22' when you write the mesh from PyTOUGH.

pierecnlnd commented 3 months ago

Thank you for the comprehensive explanation. I have now scaled up my simulation to incorporate topography. However, after converting using the same method, I noticed that several blocks are missing and not available in the '.json' file after the conversion from '.dat'. I would appreciate any insights you could provide to resolve this issue.

pierecnlnd commented 3 months ago

As you are aware, PetraSim utilizes a layer-based surface for topography input, whereas PyTOUGH employs a staircase style.

acroucher commented 3 months ago

Yes, that can happen for example if you have topography represented by a top layer that is allowed to have different surface elevations in different columns. PyTOUGH's mulgrid does allow this, but Waiwera does not - incomplete layers are allowed (i.e. upper layers not having all columns present) but the surface elevation of each column must be equal to a layer top elevation. If that results in an inaccurate topography you need to refine the upper layers.

If your mulgrid geometry does not satisfy this requirement you can use its snap_columns_to_nearest_layers() method.

There are two reasons Waiwera does not support different column surface elevations in the top layer. First, it results in mesh faces that do not satisfy the orthogonality criterion (TOUGH2 also assumes orthogonality, but some users ignore this). Second, it results in a mesh that is not easily representable by the commonly-used mesh file formats, e.g. GMSH or ExodusII, used by PETSc and Waiwera.

pierecnlnd commented 2 months ago

Hi @acroucher,

Thank you for your response. I will try that method.

Currently, I am aiming to create a better grid using the refine() method and subsequently optimize() it as mentioned in the documentation. Here is the code I have written:

from t2data import *
from t2grids import *
from mulgrids import *

geo = mulgrid().rectangular(
    xblocks=[250]*6,
    yblocks=[250]*6,
    zblocks=[50]*200,
    origin=[0.,0.,0.],
    atmos_type=0,
    convention=2
)

xmin = 500
xmax = 1000
ymin = 500
ymax = 1000

polygon = [
    np.array([xmin,ymin]),
    np.array([xmin,ymax]),
    np.array([xmax,ymax]),
    np.array([xmax,ymin]),
]

ref_col = []
ref_col_bisect = []

for col in geo.column.values():
    if col.in_polygon(polygon):
        ref_col.append(col)
        ref_col_bisect.append(True)

geo.refine(ref_col,False)

geo.optimize()

geo.layer_plot()

However, I encountered the following error:

TypeError Traceback (most recent call last)
Cell In[10], line 36
     32 ref_col_bisect.append(True)
     34 geo.refine(ref_col, False)
---> 36 geo.optimize()
     38 geo.layer_plot()

File ~\AppData\Roaming\Python\Python311\site-packages\mulgrids.py:3063, in mulgrid.optimize(self, nodenames, connection_angle_weight, column_aspect_weight, column_skewness_weight, pest)
    3060 return np.array(result)
    3061 x0 = np.array([self.node[nodename].pos for
    3062 nodename in nodenames]).reshape(2 * num_nodes)
-> 3063 x1, success = leastsq(f, x0)
    3064 if success > 4:
    3065 raise Exception('scipy leastsq() optimization routine did not converge.')

File c:\Users\piere\AppData\Local\Programs\Python\Python311\Lib\site-packages\scipy\optimize\_minpack_py.py:419, in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
    416 m = shape[0]
    418 if n > m:
--> 419 raise TypeError(f"Improper input: func input vector length N={n} must"
    420 f" not exceed func output vector length M={m}")
    422 if epsfcn is None:
    423 epsfcn = finfo(dtype).eps

It seems there is a mismatch in the input vector length N and the output vector length M. I would appreciate any guidance you can provide to resolve this issue.

Thank you.

acroucher commented 2 months ago

It's usually not a good idea to try and optimize the entire mesh - depending on the mesh, it may have more degrees of freedom than constraints for the optimization.

So you should only optimize the nodes that need optimizing. In this case, after a local refinement, it's usually just the nodes in the new triangular transition columns that need optimizing.

So you can do something like this:

opt_cols = [col for col in geo.columnlist if col.num_nodes == 3] # only triangular columns
opt_nodes = geo.nodes_in_columns(opt_cols) # nodes in the triangular columns
opt_node_names = [n.name for n in opt_nodes] # extract node names

geo.optimize(opt_node_names)
pierecnlnd commented 2 months ago

Thanks, the code run perfectly.

from t2data import *
from t2grids import *
from mulgrids import *

def refine_and_optimize(geo, polygon):
    ref_cols = [col for col in geo.columnlist if col.in_polygon(polygon)]

    geo.refine(ref_cols,False)

    opt_cols = [col for col in geo.columnlist if col.num_nodes == 3] 
    opt_nodes = geo.nodes_in_columns(opt_cols) 
    opt_node_names = [n.name for n in opt_nodes] 

    geo.optimize(opt_node_names)

    return geo

geo = mulgrid().rectangular(
    xblocks=[250]*6,
    yblocks=[250]*6,
    zblocks=[50]*200,
    origin=[0.,0.,0.],
    atmos_type=0,
    convention=2
)

xmin = 500
xmax = 1000
ymin = 500
ymax = 1000

polygon = [
    np.array([xmin,ymin]),
    np.array([xmin,ymax]),
    np.array([xmax,ymax]),
    np.array([xmax,ymin]),
]

geo = refine_and_optimize(geo, polygon)

geo.layer_plot()

image

acroucher commented 2 months ago

Another reason not to optimize the whole mesh is that even if it does work, it will probably move your mesh boundaries, which you usually don't want.

pierecnlnd commented 1 month ago

Dear @acroucher ,

Regarding the surface columns issue, I have discovered that the model exhibits the same error even without varied elevation on the surface. Could you please assist me with resolving this matter?

Thank you for your help.

Best regards, mpc MXZ001.zip

pierecnlnd commented 1 month ago

The code

def convert_tough_waiwera(dat_filename, root=None):
    if root != None:
        dat_path = os.path.join(root, f'{dat_filename}.dat')
        geo_path = os.path.join(root, f'g{dat_filename}.dat')
        msh_path = os.path.join(root, f'g{dat_filename}.msh')
        json_path = os.path.join(root, f'{dat_filename}.json')

    dat = t2data(filename=dat_path)

    geo, blockmap = dat.grid.rectgeo()
    geo.write(geo_path)
    geo.write_mesh(msh_path,file_format='gmsh22')

    dat.rename_blocks(blockmap, invert = True)
    geo.snap_columns_to_nearest_layers()

    j = dat.json(geo, msh_path, eos=1)

    with open(json_path, 'w') as f:
        json.dump(j, f, indent = 2, sort_keys = True)

The error

Warning: Appending zeros to replace the missing physical tag data.
Warning: Appending zeros to replace the missing geometrical tag data.
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[14], [line 1](vscode-notebook-cell:?execution_count=14&line=1)
----> [1](vscode-notebook-cell:?execution_count=14&line=1) convert_tough_waiwera('MXZ001', os.path.join(os.getcwd(), 'model/'))

Cell In[13], [line 17](vscode-notebook-cell:?execution_count=13&line=17)
     [14](vscode-notebook-cell:?execution_count=13&line=14) dat.rename_blocks(blockmap, invert = True)
     [15](vscode-notebook-cell:?execution_count=13&line=15) geo.snap_columns_to_nearest_layers()
---> [17](vscode-notebook-cell:?execution_count=13&line=17) j = dat.json(geo, msh_path, eos=1)
     [19](vscode-notebook-cell:?execution_count=13&line=19) with open(json_path, 'w') as f:
     [20](vscode-notebook-cell:?execution_count=13&line=20)     json.dump(j, f, indent = 2, sort_keys = True)

File ~\AppData\Roaming\Python\Python311\site-packages\t2data.py:2826, in t2data.json(self, geo, mesh_filename, atmos_volume, incons, eos, bdy_incons, mesh_coords)
   [2824](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2824) if bdy_incons is None:
   [2825](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2825)     bdy_incons = effective_incs
-> [2826](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2826) jsondata.update(self.boundaries_json(geo, bdy_incons, atmos_volume,
   [2827](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2827)                                      jsondata['eos']['name'],
   [2828](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2828)                                      mesh_coords, tracer_data))
   [2829](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2829) jsondata.update(self.generators_json(geo, jsondata['eos']['name'],
   [2830](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2830)                                      tracer_data))
   [2831](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2831) return jsondata

File ~\AppData\Roaming\Python\Python311\site-packages\t2data.py:2681, in t2data.boundaries_json(self, geo, bdy_incons, atmos_volume, eos, mesh_coords, tracer)
   [2679](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2679) interior_blkname = names[0]
   [2680](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2680) interior_blk = self.grid.block[interior_blkname]
-> [2681](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2681) cell_index = geo.block_name_index[interior_blkname] - geo.num_atmosphere_blocks
   [2682](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2682) if blk.centre is None:
   [2683](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/piere/Kuliah/PB6098%20Prop%20Thesis/Reservoir%20Simulation/Model_2D_xz/MXZ001/~/AppData/Roaming/Python/Python311/site-packages/t2data.py:2683)     if vertical_connection:

KeyError: ' 2802'
acroucher commented 1 month ago

I think you also need to make sure the block order of your renamed t2grid agrees with the ordering in the geometry. You can do that by adding a line:

dat.grid.reorder(geo = geo)

just after the call to dat.rename_blocks(). If I do that, the error no longer occurs.

pierecnlnd commented 1 month ago

Thank you, the conversion ran perfectly. It also works when I change the atmos_type to 1. However, when I run it in Waiwera, I encounter the following error: error.txt Could you please assist me with this issue?

Best regards, mpc

acroucher commented 1 month ago

It looks like you have a problem with permissions - so the Waiwera Docker image isn't able to create the output HDF5 file. There are a few things you need to be careful of with Docker - it only has permissions to access the current directory and the ones below it, so e.g. you can't run an input file in directories above the current one.

I can't tell exactly what the issue is without knowing the command you used to run it. But there is some stuff in the user guide which may help:

https://waiwera.readthedocs.io/en/testing/run.html#file-paths-when-running-with-docker

It could also be an issue with directory delimiters if you have any in your input file - they need to be POSIX-style (forward slash not Windows-style backslash), because Docker is running Linux inside the container.

acroucher commented 1 month ago

I just noticed another issue - your JSON file had a bunch of additional weird boundary conditions with negative cell indices. I realised this is because in your original TOUGH2 data file there are connections between the atmosphere blocks (not sure why that would ever be a good idea - presumably an artefact of PetraSim).

I've pushed a fix (b338423ee94d24e6440a9b778b03cc7195178e93) to the PyTOUGH testing branch so that these connections are now ignored and the resulting JSON file just has one boundary condition at the surface with 100 cells.

pierecnlnd commented 1 month ago

The model in TOUGH2 is actually having the top layer rocks as the atmosphere material with fixed state condition. The reference of the model is https://doi.org/10.1016/j.geothermics.2018.10.001

pierecnlnd commented 1 month ago

Thanks @acroucher , I just found out that the json file containing full path that can't be read in waiwera. The model is now running perfectly.