acroucher / PyTOUGH

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

3d hydrostatic example in AUTOUGH2_5 #18

Closed two-phaseflow closed 5 years ago

two-phaseflow commented 5 years ago

I am trying to prepare the input data for the 3d hydrostatic example to run in AUTOUGH2_5 (the teaching distribution that comes with TIM) but have been unable despite calling the convert_to_AUTOUGH2() method on the t2data object. AUTOUGH2 simply exits after I specify the name of the input file.

I have seen in the documentation there are some differences in the .dat file formats for TOUGH2 and AUTOUGH2, but haven't seen an example PyTOUGH script for creating an input file for AUTOUGH2, so I am guessing there are other methods I need to call or additional arguments I need to specify as parameters for the t2data object or the convert_to_AUTOUGH2() function, for example, the EOS... but I am not sure about what is necessary.

acroucher commented 5 years ago

I just tried this myself and found the problem was in the MULTI data block - the INFILE created by the script didn't have one, but convert_to_AUTOUGH2() was creating one and it didn't make sense.

For a problem as simple as this you don't really need to use convert_to_AUTOUGH2(). You can just add a SIMULATOR data block, and save the data file and incon file with the kinds of filenames AUTOUGH2 expects, e.g.:

dat = t2data('INFILE')
dat.simulator = 'AUTOUGH2.2EW'
dat.write('model.dat')

inc = t2incon('INCON')
inc.write('model.incon')

However I have also pushed a fix to the PyTOUGH testing branch so that convert_to_AUTOUGH2() now checks if the MULTI block exists before trying to modify it. So if you run that branch you should be able to substitute the dat.simulator = 'AUTOUGH2.2EW' line with dat.convert_to_AUTOUGH2() now and it should also work.

two-phaseflow commented 5 years ago

Thanks Adrian. I'm still running into issues, though... For one thing, the incon file is instantiated a bit different in the 3d hydrostatic example inc = dat.grid.incons() vs. the way you described above inc = t2incon('INCON')...

Judging by the listing file, there seems to be an issue with the EOS and/or the initial temperature/pressure conditions... I post part of it below

Using SIMUL AUTOUGH2.2 1***

acroucher commented 5 years ago

Sorry, perhaps I wasn't clear... the little script above is for converting the output of the original script for use with AUTOUGH2. But you probably want to adapt the original script so it produces AUTOUGH2-compatible output directly.

To do that:

1) add a line dat.simulator = 'AUTOUGH2.2EW', e.g. just after you create the t2data object 2) change the line that writes out the data file so it uses the kind of filename AUTOUGH2 expects, e.g. dat.write('model.dat') 3) same thing for the incon file, e.g. inc.write('model.incon')

two-phaseflow commented 5 years ago

Got it, seems to work now. I was indeed trying to use directly in the original 3d hydrostatic script but the problem was that I had dat = t2data('INFILE') instead of dat = t2data() (the latter which worked).