TOUGHREACT compilation using gfortran MinGW-error message

Dear Community,

I would like to compile TOUGHREACT (version: TR-OMP_Source_v3.3.2-OMP) using gfortran with MinGW.

I typed make eos1 -f makefile_gf, and had the attached error message.

Would it be possible for me to have your help to resolve this issue?


Kyung Jae Lee

8replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • By the way, in the chempar_v3.inc, it's currently written as follows.


          parameter (mpri=45,maqx=225,mmin=60,mgas=10,mexc=15,mads=45,
         +   MXsites = 4, msurf=5, mpads=10, ntmp=20,
         +   mechm=5,                                                       !number of mineral kinetic rate mechanisms
         +   mechsp=14,                                                      !number of species in product term for mineral kinetics
         +   mrx=40,                                                        !number of aqueous kinetic reactions     
         +   mechaq=14,                                                      !number of aqueous kinetic mechanisms
         +   maqsp=20,                                                       !number of species in aqueous kinetic rate eq.  
         +   nc=mpri,ng=mgas,nmgas=mgas,
         +   mtot=mpri+maqx+mexc+mads,
         +   mnr=mpri+mmin+mgas+msurf+2,
         +   maqt=mpri+maqx)

  • Update: I resolved this problem by revising the parameters in the chempar_v3.inc as follows.

          parameter (mpri=20,maqx=70,mmin=32,mgas=5,mexc=5,mads=45,
         +   MXsites = 4, msurf=5, mpads=10, ntmp=20,


    However, I have a new error now as attached.

    I will keep trying to figure this out, but I would appreciate your help if you know how to resolve it.

    • Kyung Jae Lee 

      Hi Kyung Jae. I think the warnings are ok. I've never used MinGW, but it just looks like the error is a compiler option problem. The gfortran makefile I created was tested on a Mac, and an older version (pre-2017) for V3.32-OMP. I can check with a newer version of gfortran, but only on Mac or Linux.



    • Eric Sonnenthal 

      Thank you very much for your insight, Eric.

      My current compiling option in the makefile_gf is 

      FFLAGS = -O2 -fstack-arrays -fdefault-integer-8 -fdefault-real-8 -fdefault-double-8 -malign-double -fopenmp -Wl,-stack_size,0x80000000.


      In my previous experience (so far, I have developed lots of variants of TOUGH+ family codes, which are based on f90, by compiling with FFLAGS = -o3 -ffree-form -ffree-line-length-none in MinGW at Windows machine), MinGW have compiled well, so I will need to test many compiling options in my computer.


      Best regards,

      Kyung Jae 

    • Eric Sonnenthal 

      Hi, Eric,

      I could compile the code by removing the stack size part in the compiling option; I am not sure if it's ok though.

      (FFLAGS = -O2 -fstack-arrays -fdefault-integer-8 -fdefault-real-8 -fdefault-double-8 -malign-double -fopenmp)

      But it turns out that my machine can't run this treactv332omp_eos1_gf.exe, which gives me "Access is denied" error message. I guess that this is because, I tried to run this parallel code in the windows PC.

      Thus, would it be possible for me to know if I can compile TR-OMP_Source_v3.3.2-OMP either in serial or make OPM working in the window PC?

      I would greatly appreciate your consideration.

      Kyung Jae

    • Kyung Jae Lee 

      Hi Kjung Jae,

      This likely a result of trying to compile under one operating system and running under another. I've passed along this issue to Keni Zhang, who is now helping the TOUGH developers. You should hear back from him soon. It may be easier to email him directly (kzhang@lbl.gov) and cc me and Nic Spycher (elsonnenthal@lbl.gov, nspycher@lbl.gov) so we know how the problem is resolved. 



    • Kyung Jae Lee 

      Hi Kjung Jae,

      TOUGHREACT is the only TOUGH-family code using OpenMP, which is very efficient and speeds up the chemical reaction calculations (which often account for 90% or more of the cpu time) linearly with the number of processors, even for very small meshes that have complex geochemical systems. However, these parallel libraries cannot be statically linked with most compilers now, and therefore they need to be installed as well as the paths defined in login files (like .bashrc on Linux or .bash_profile on Mac). We'll figure out how to get the codes to access the libraries more seamlessly, since some compilers keep changing where the libraries are installed.


  • Hi Kyung Jae,

    The default memory requirement for distributed TR-OMP_Source_v3.3.2-OMP package seems a little bit too aggressive. For successful compilation, you may need to reduce the memory requirement size. The most effective way is to reduce parameter PARAMETER (MNEL = 999999) and MNCON = 3000000 to smaller ones (which is given in the file flowpar_v3.inc) , for example MNEL=30000, MNCON=100000. You may compile the codes in the cygwin and should not have problem. 

    For best way to run toughreact on Windows, I would suggest you compile the codes in the Microsoft Visual Studio. You can do it in following way:

    (1) Install Visual studio (2017 or later version).

    (2) Install  oneAPI HPC Toolkit (you got free Intel Fortran Compiler from this platform!)

    (3)  Run Visual studio and create a new Intel Fortran Console Application Project (select it from the dialogue menu)

    (4) Add all the TR-OMP_Source_v3.3.2-OMP package Fortran source codes (*.f) to the project as source files (only one module source file allow a time, you can only add one of the eco2n_v3.f, eos1_v3.f, eos2_v3.f .......); add all the .inc files to the project as Head files. (don't forget to edit the flowpar_v3.inc to reduce MNEL and MNCON)

    (5) From the Project property menu select: Project->Property->Fortran->Language->Process OpenMP Directives, turn on OPENMP option  (/Qopenmp)

    (6) The compilation target and the Project property must be consistent.  if you compile the codes for "Release" "X64", the properties change should also did for "Release" "X64" at step 5. 

    (6) build the project, you should get the executable,. TOUGHREACT with Intel Fortran may have better performance than the one compiled with gfortran.

    If you have further problem, please let me know. Good luck. 

Like1 Follow
  • 4 mths agoLast active
  • 8Replies
  • 37Views
  • 3 Following