Chemical equations are limited to 512 characters

Hello all,

What is the maximum number of chemical reactions that can be defined for fluid and particle phases in MFiX? The User Guide states that “Chemical equations are limited to 512 characters”. This is unclear to me. Does this mean 512 characters per reaction or 512 unique reactions?

Hi Oluwafemi

The 512 character limit is for each reaction. Although a single reaction can be split across multiple lines using the & character (as in this example)

VolatileRelease {
    chem_eq = "Coal --> 0.0372042*CH4 + 0.0868098*H2_REF_ELEMENT +" &
        " 0.00760988*CO + 0.00949242*H2S_anharmonic + 0.040739*HCN +"&
        " 0.0101847*NH3_Anharmonic + 0.433707*Carb"
}

the total definition must not be longer than 512 characters. Since the standard line length is 80, this comes to about 6 lines. If you have reactions which are longer than this, let us know.

The total number of reactions is 100:

model/param_mod.f
! Maximum number of reactions defined in data file
      INTEGER, PARAMETER :: DIMENSION_RXN = 100

– Charles

1 Like

If you use the MFiX GUI, you will not be writing the reactions by hand, and will get a warning if you reach the built-in limits.

Thank you, Charles. I am going to go ahead and explain the larger context for this question. I am testing a case to run multiple solid phases. Each solid phase has 32 reactions. I have been able to run with 3 reacting particle phases. The simulation crashes when I add the 4th with this error message.

 >>>>>#################################################################
ERROR parse_rxn.f:761
 Please refer to the Readme file on the required input format and make
 the necessary corrections to the data file.
 **********************************************************************
 to 512 characters.
 lChemEq:  D09 --> 0.4*CH2O + 0.49*CO + 0.39*CO2 + 0.1*H2 +                                                                                                                                                                                                                                                                                                                                                               ~JazF 0.4*H2O + 0.05*HCOOH + 0.1*C2H4 + 0.3*CH4 + 0.975*D03 +
 INPUT: " 0.37*D28 + 0.51*D26 + 0.01*D25 + 0.325*D24 + 0.075*D20 +"&
 <<<<<#################################################################


 **********************************************************************
 Fatal error reported on one or more processes. The .LOG file
 may contain additional information about the failure.
 **********************************************************************

The reaction being complained about is by no means the 101th.

I have added the case for your reference.
case.zip (500.1 KB)

Thanks. Attaching the case file is the best way to help us help you.

Running the case locally, I can reproduce the error. The length of the reaction is only 231 characters so you shouldn’t have run into the limit. And the error message is garbled - I’m perplexed by the characters ~JazF appearing there, since this is nowhere in the input, amd the phrase to 512 characters looks like a part of a sentence. I think there’s some kind of memory corruption going on here - I’m also seeing a message double free or corruption (out)

This case has a lot of complex reactions and it looks like you have found a bug in MFiX (Congratulations!). We are looking into the problem. Thanks for reporting.

– Charles

1 Like

That may be true, but the problem is in fact caused by too many reactions being defined. There are 194 reactions in this file and MFiX only allows 100. The error message should be clearer, but it looks like a buffer overrun may have caused the message to be garbled. I will try to improve the error-handling here.

You can edit model/param_mod.f and increase DIMENSION_RXN:

! Maximum number of reactions defined in data file
      INTEGER, PARAMETER :: DIMENSION_RXN = 500

after this, clean and build again and your reaction limit will be increased. Note that experts I talked to here think you have too many reactions, so this is not recommended, but it will get your case to run.

After making that change I found a new error running your case - it terminated with

At line 653 of file /home/cgw/Work/NETL/mfix/model/check_data/check_output_control.f
Fortran runtime error: Insufficient data descriptors in format after reversion

That’s hardly a helpful message! But looking at check_output_control.f, there is a misformatted FORTRAN “format” statement which wanted to tell you:

4460  format('Monitors cannot collect both Eulerian and Lagrangian data.',&
           &/'Correct the case setup file.')

So you have invalid monitor definitions. I’m not sure exactly which monitors are causing this. But by removing all the monitor_ keys from the file, I did get your case to run. I’ve gotten to t = 0.000695, it’s predicting about 200 days of runtime, on a single CPU.

1 Like

Thank you for the clarity, Charles. The number of reactions is artificially inflated because I have used 4 different solid phases. I will run this and compare results with single-phase simulation.

Does this mean 100 reactions per phase?

100 total. There does not seem to be a per-phase limit.

1 Like