0

Read/write file access w/PEST protocol

I am attempting to use the iTOUGH2 PEST protocol using a bash script as my forward-model executable.  This script includes multiple calls of a TOUGHREACT simulation with file manipulation in between to set up restarts.  However, it appears that some of the file manipulations do not operate correctly.  For example, part of the bash script includes the command 'mv SAVE INCON' (which, in Linux and Mac lingo, moves the file SAVE to a file INCON).  However, this command gets ignored when I attempt to run itough2 with the ">>> FORWARD" COMPUTATION option.  When I run the batch script without invoking iTOUGH2, this command works.  Are there limits on the batch-script commands that be included in Executables called by iTOUGH2-PEST, or am I running into another kind of problem? I'd be happy to include file if it helps. 

10 replies

null
    • Finsterle GeoConsulting
    • Stefan_Finsterle
    • 4 yrs ago
    • Reported - view

    Hi Mikey,

    iTOUGH2 does not know or care too much about what's in the script file. It also does not affect it (i.e., if you script works independently from iTOUGH2, it should also work when called from iTOUGH2).

    Not sure what you mean by "gets ignored"; do you get an error message? Try to redirect standard error in your script, e.g.:

     

    echo "Hard word ahead: try to move stuff" >> fort.99

    mv SAVE INCON >> fort.99 2>&1 >> fort.99

    echo "Glad this is done, or is it? Let me check:" >> fort.99

    ls -l SAVE INCON >> fort.99

     

    Then look in the *.msg file.

    Alternatively, send me all your input files.

    Stefan

      • Castleberry
      • 4 yrs ago
      • Reported - view

      Stefan Finsterle 

      Here are the contents of Meshmaker (This makes a radial grid with radius 224m and depth 10m, 

      RZ2DL
      RADII
          3
          0.0e00    5.0e-2    7.0e-2                                                   
      LOGAR
         30          1.0e2    7.0e-2
      RADII
          1
         5.001e2      
      LAYER
          1
          1.0e01  

      I fail to  understand why RADII
          1
         5.001e2  (500.1 ) is mentioned here, Wht is the logic through which this value is inputted in the meshmaker file?

      someone please shed some light on this??

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

      telegramboy 

      The logic here is that you want a high-resolution mesh up to a distance of 100 m; then you add one more element with an outer radius of 500 m. This acts as an (almost) constant pressure/saturation/temperature boundary condition.

      This is not a MESHMAKER issue, which allows you to do whatever you want. It is up to the user to define the model domain and discretization so it fits the simulation problem at hand.

      Stefan

      • Castleberry
      • 4 yrs ago
      • Reported - view

      Stefan Finsterle Thank you for answering, 

      But you answered only the first part

      How does this meshmaker input creates Rmax=224m

      It is mentioned in the tutorial description, that this input file

      creates a mesh which is a cylinder with a radius of 224 m and depth=10m,

      I understand depth but I don't understand how 224m radius is made with this file entries. Plz shed some light on this

    • Mikey_Hannon
    • 4 yrs ago
    • Reported - view

    Stefan Finsterle

    I think I found my problem.  In between restarts, I had a step where I remove the files providing initial conditions for flow (INCON) and the initial conditions for chemical equations (inchem).  I did this by trying to run the command 'rm {INCON,inchem}'.  This worked when running the shell script directly, but when attempting to run this using iTOUGH, it did not recognize the command.  I think it was looking for a file named '{INCON,inchem}' rather than recognizing I wanted to delete both of the files.  When I split this command into 'rm INCON' followed by 'rm inchem', the issue went away.

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

    Why the curly bracket?

    rm INCON inchem

    should work as well.

    Stefan

      • Mikey_Hannon
      • 4 yrs ago
      • Reported - view

      The curly bracket is how I've always removed lists of files from a folder in a Unix/Linux environment.  Your suggestion worked as well.  Admittedly, my understanding of writing batch scripts is not comprehensive. : )

      Thanks for your help!

      • Castleberry
      • 4 yrs ago
      • Reported - view

      Stefan Finsterle 

      I am getting the error"

      NUMBER OF ELEMENTS SPECIFIED IN DATA BLOCK "ELEME" EXCEEDS ALLOWABLE MAXIMUM OF    2800
       INCREASE PARAMETER "MaxNum_Elem" IN MAIN PROGRAM, AND RECOMPILE

       >>>>>>>>>>   F L O W   S I M U L A T I O N   A B O R T E D   <<<<<<<<<< "

      I know I have to change this 2800 to somewhere around 50000 for it to run my simulation (26001 ) elements

      but i searched all files, couldn't locate where to change?

       

      I found the error comes from file HRS_Inputs.f

       

      but

       

      where to change this value of 2800 to 50000 ? i am perplexed , i am not familiar with fortran at all

      here's a snapshot of all files in the code and relevant code files are uploaded here.

      Please help me locate where to change 2800 to 50000

      i read the discussion

      https://tough.forumbee.com/t/y7xmf6/question-about-tough2-output

      but still couldn't do it

      • Mikey_Hannon
      • 4 yrs ago
      • Reported - view

      telegramboy 

      I believe you said you were running HydrateSim (a predecessor of TOUGH+Hydrate), correct?  It's difficult for me to answer this directly, as most of my experience in these matters deals with TOUGH2 or iTOUGH2, but I believe you should, as the error message states, find the variable "MaxNum_Elem" somewhere in your source-code files and change the value from 2800 to 50000.  Searching through the ones you provided (HRS_*.f), I could not find this anywhere.  If you have access to all of the source code files, though, you should be able to locate it, change its value, and recompile.  Perhaps someone else on the forum with experience with this could respond better.  In fact, you should re-post this on the TOUGH+ forum (as a new post, not as a reply to something unrelated).

      • Castleberry
      • 4 yrs ago
      • Reported - view

      Mikey Hannon ok i will repost it in tough+hydrate forum

      but the thing is, Tough+hydrate forum is literally dead, there is no one to answer. trust me, i 've waited for 1 whole year. anyways. thanks for your replt

      i have also searched all other files and couldn't find the the maximum no elements to replace?

      if u can send me email reply at : telegramkik@gmail.com, i will send you all the codes....just in case u have free time

      thanks 

Content aside

  • 4 yrs agoLast active
  • 10Replies
  • 84Views
  • 3 Following