How to use "t2data.run()" in PyTOUGH

I'm very new to TOUGH2 and I started using PyTOUGH.

I tried running a sample code "Horizontal 1D Model" in PyTOUGH's wiki page,

but I got following error message:


sh: 1: t2eos1: not found
Traceback (most recent call last):
  File "horizontal_1D.py", line 64, in <module>
    lst = t2listing('horiz1D.listing')
  File "/home/tough/.pyenv/versions/3.5.1/lib/python3.5/site-packages/t2listing.py", line 176, in __init__
    raise Exception('Could not detect simulator type.')
Exception: Could not detect simulator type.


At that time,  I used exectutable file "xt2_eos1" compiled from eos1.f, meshm.f, t2cg22.f, t2f.f and t2solv.f.

And I specified  " t2.data.run(simulator="xt2_eos1") ".


Does anyone know how to use method of "t2.data.run()" ??



3 replies

    • Tao_Wang
    • 5 yrs ago
    • Reported - view

    Hi shohei narita, 


    I have come up with the same problem in using itough2 V7.1.0 source code on Ubuntu 16.04. I am a new Linux and Tough learner.


    I tried to run the sample code "Horizontal 1D Model" in PyTOUGH's wiki page, one-by-one code line, and it got the following error message:


    sh: 1: t2eos1: not found


    So I tried to compile the exectutable file "xt2_eos1", by using "gfortran -o xt2_eos1 -g -fdefault-real-8 -falign-commons eos1t2.f t2cg22.f meshm.f t2f.f t2solv.f", but I did not find the exectutable file "xt2_eos1" in the Sourcecode file.


    I changed the code line dat.run(simulator = 't2eos1') as dat.run(simulator = 'xt2_eos1'), and still got the same error message:

    sh: 1: xt2_eos1: not found


    Can you provide some help?


    • Finsterle GeoConsulting
    • Stefan_Finsterle
    • 5 yrs ago
    • Reported - view

    Please contact the PyTOUGH developers about this issue. It seems PyTOUGH has "hardwired" the name of a TOUGH2 executable it is looking for. But it simply does not make sense to try to run iTOUGH2 through PyTOUGH if PyTOUGH seems to call TOUGH2 instead of iTOUGH2. Recompiling iTOUGH2 (using a list of source code files that are from TOUGH2 rather than iTOUGH2) is definitely the wrong approach. I'm sure there is an easy way to adapt PyTOUGH to accomplish what you want to do.

    Good luck!

    • Shohei_Narita.1
    • 5 yrs ago
    • Reported - view

    Tao and Stefan


    I have successfully ran the simulation without using the command "t2data.run(simulator="xt2_eos1")."

    Recently, I have used the following simple command in a python file:


    from os import system

    system( './xt2_eos1' + '<' + 'input.dat' + '>' 'output.listing')


    The 'system' method in 'os' module can directly call csh command in a python script. This is very useful.

Content aside

  • 5 yrs agoLast active
  • 3Replies
  • 501Views
  • 3 Following