Problem using chemical reactions

Hi, MFiX community. I have been trying to use chemical reactions based on the documentation and the methane combustion example. Then I set up a simple case using the single phase solver. I have two files in the directory: the usr_rates.f to define the reaction rates and the .mfx file. Both are attached here
methane_comb.mfx (13.1 KB)
usr_rates.f (764 Bytes)

However, when I create the custom solver through build_mfixsolver I get the error: Cannot assign to a named constant at (1) (…)
build_mfixsolver

It seems to be a fortran error, but I do not understand where is the source because I just copied the example in: 4.13.3.5. Example: Methane Combustion with UDF — MFiX 19.2.0 documentation
I also found weird the fact that the Fluid Cell Index is defined as Double. Tried to change it to int, but it did not seem to have any effect.

Is there some other file in which I have to create another configuration or to add reactions it’s just the usr_rates.f or usr_rates_des.f?

Besides, if I wanted to use properties like gas density, viscosity, etc from an UDF, for example, usr_properties.f, how should the structure of the code be? Is there a template somewhere? I’d like to learn how to do it. Thank you!

This is a fortran compiling error. Update usr_rates.f so that the passed RATES variable is defined as below. You can also copy this directly from the usr_rates.f distributed with the source.

DOUBLE PRECISION, DIMENSION(NO_OF_RXNS), INTENT(OUT) :: RATES

All reactions have to be defined in the rates files. I don’t follow your last question.

It worked. Thank you. As you mentioned I also found it in the right way in the adiabaticFlame case in the source.

My last question was about how to define variable density, viscosity or another property using a file.f. I am just trying to learn more about the structure of these files so I can properly use them. I have read the user manual section about UDF but I cannot find information about how to build my own. Could you point to me some reference?

Take a look at the following case:
mfix/legacy_tutorials/Solvent_Absorption

The case is dated, but it should give you an idea of how this works.

Thank you. I’m having a look at the usr_properties.f file, besides others.

hi crspx
I downloaded your file and I get a compiling error。
Then I changed your usr_rate.f by the solution of jmusser but it does not run。
Can you send me a correct usr_rate.f 。
my email is 1017500384@qq.com