2

Hello guys . Does anybody know how to simulate the deformation of the soil caused by fluidflow in both TOUGH and FLAC3D? Thanks

84 replies

null
    • Keurfon_Luu
    • 4 yrs ago
    • Reported - view

    Unfortunately, it is not as straightforward as it sounds.

    The "easiest" way that does not require access to TOUGH source code is to make FLAC3D call TOUGH at each time step and import the pressure and temperature from TOUGH into FLAC. For two-way coupling (stress-induced porosity/permeability changes), you should update TOUGH input files before calling TOUGH in FLAC3D.

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu I cant put that in that directory I can only put it in the dowloads

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu hello, I was able to extract the Izma file but when I run the code I do not know where the save file is saved. the file I am supposed to extract information from. I did not get any error but I can not find the file

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Floriane Youzan I could put the Izma file in the directory and could import tough save file into flac3D by using the command save = toughio.read_output("SAVE") and there is no error but I do not know how to apply the save information into the FLAC 3D file

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan You shouldn't save the data to FLAC3D file, you should import pressure and temperature data arrays from TOUGH in FLAC3D's Python, and then use itasca Python's module built in FLAC3D to import these arrays directly into FLAC3D's zones.

      Assuming that your grid is loaded, the following code will import pressure and temperature calculated by TOUGH to FLAC3D's zones:

      import toughio
      import itasca as it
      
      # Load SAVE file
      save = toughio.read_output("SAVE")
      
      # Loop over FLAC3D's zones and set pressure and temperature
      for i, zone in enumerate(it.zone.list()):
          zone.set_pp(save.data["X1"][i])
          zone.set_temp(save.data["X6"][i])

      You must change the primary variable names depending on the EOS you are using. From your SAVE file, I guessed that you are using EOS7R so pressure corresponds to variable X1 and temperature to variable X6.

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu thank you

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Floriane Youzan `it went through but they said zonebasedpp must be on

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu it went through but they said ZONEBASEDPP must be on

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan 

      import itasca as it
      
      it.command("zone fluid zone-based-pp on")
      

      If you are using module thermal, also add:

      it.command("zone thermal zone-based-temp on")
      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu they say model is not configured for FluidModule and then i added model configure fluid at the beginning of the code and it threw an error

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan To put it briefly, you can use 3 different languages in FLAC3D: FLAC3D commands, FISH and Python. Obviously, Python only accepts Python instructions.

      Since

      model configure fluid

      is a FLAC3D command, you cannot use it as-is in a Python script. However, FLAC3D's commands can be used within a Python script using the function "it.command":

      import itasca as it
      
      it.command("model configure fluid")
      
      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu another error

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan Can you share your script?

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu nevermind, i think the code is good but we need to update FLAC to get options for "thermal". I have a question though, what would this code solve because I am tryimg to solve the mechanical state to a time step Dt and I dont see time in the whole thing. or is it a step will be done later

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu hey here is my script

      Import toughio

      Import Itasca as it

       it.command(“model configure fluid”)

      it.command(“zone fluid zone-based-pp on”)

       

      save = toughio.read_output("SAVE")

      for i, zone in enumerate(it.zone.list()):

          zone.set_pp(save.data["X1"][i])

      we do not want to deal with any thermal options so I did not use the last line of code you suggested.

      here is the error I got

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan What do you get with?

      it.zone.count()

      and

      save.data["X1"].size

      If your TOUGH MESH file has been created with toughio from your FLAC3D grid, you should have the same number of zones in both.

      Have you imported your FLAC3D grid before running the script?

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu for the zone count I got 18648 and the save size I got 6216

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu I AM pretty sure I did it the right way, please take a look at both my files and let me know. please

      thanks

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan Looks like you imported your grid in FLAC3D thrice (18648 = 3 x 6216).

      Run the FLAC3D command "model new" in FLAC3D's console (or "it.command("model new")" in FLAC3D's iPython's console), then reimport your grid once, and run your script again.

      Note that at this current stage, you have merely imported the steady state results from TOUGH into FLAC3D. You should now loop over FLAC3D time steps (see my early answer).

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu i run the command without importing the grid at first right?

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu I was able to fix the size issue and now both of my MESH have the same size but the thing is when I run the code, nothing happens

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu I was able to fix the size issue and now both of my MESH have the same size but the thing is when I run the code, nothing happens

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan What do you mean? The sample code so far only imports pore pressure calculated by TOUGH in FLAC3D. As I said earlier, you should now loop over time steps and sequentially couples TOUGH and FLAC3D:

      t = 0.0
      dt = 3600.0  # Time step, let's say one hour time step
      tmax = 24.0 * 3600.0  # Simulation time, let's say one day
      while t < tmax:
          # Code to solve fluid flow with TOUGH (e.g., using subprocess to call TOUGH)
          subprocess.call(...)
      
          # Import pore pressure in FLAC3D
          save = toughio.read_output("SAVE")
          for i, zone in enumerate(it.zone.list()):
              zone.set_pp(save.data["X1"][i])
      
          # Solve mechanical state in FLAC3D
          it.command(f"model solve mechanical time {dt}")
      
          # Prepare next time step for TOUGH
          # Modify input file using toughio
          # Rename SAVE file to INCON and modify porosity and/or permeability for each zone
          # (see Rutqvist et al., 2002 for equations)
          ...
      
          # Increment simulation time
          t += dt
      
      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu hey, thank you for your reply. so far I only ran the first part of the code and I was expecting some kind of response or an output file . I attached a picture of the code. I got a .temp file but it didn't have valuable information

      • Keurfon_Luu
      • 4 yrs ago
      • Reported - view

      Floriane Youzan No response, no problem. It means that the code ran successfully.

      Now, FLAC3D can use pore pressure from TOUGH to update the mechanical state.

      • Floriane_Youzan
      • 4 yrs ago
      • Reported - view

      Keurfon Luu just time make sure , the time is in second ?

Content aside

  • 2 Likes
  • 2 yrs agoLast active
  • 84Replies
  • 1017Views
  • 6 Following