An error occurred while compiling my UDF code

I encountered an error with Expecting END IF statement at (1) while building the solver,I don’t know how to solve it, can you help me? Here are my program files.Thank you very much!

c combustion.mfx (25.3 KB)
usr_rates.f (4.0 KB)
usr_rates_des.f (4.9 KB)

This erorr is not in the solver as distrubuted but in a UDF that you wrote. Please be clear when seeking help that the problem is in your code. I have created a new “udf” tag for all questions related to user-written code.

It helps to indent code properly - using some sort of IDE that is aware of Fortran code (I use Emacs) - the code you uploaded is a bit messy but when you have proper indentation it helps to show the structure of the IF/ENDIF blocks.

In usr_rates_des.f you have:

               IF(nRR >= R4) &!   2FC1 + O2 --> 2CO
                   ReactionRates(IJK,R4) = DES_RATES(R4)

clearly there needs to be an END IF to match that IF statement, and that is exactly what the error message from the compiler is trying to tell you.

I spoke too fast, the IF(nRR >= R4) does not have a THEN and it has a continuation character &, so this is a one-line IF statement that does not require an ENDIF. (I do not think this is good style, instead of the & I’d use THEN/ENDIF, which would be less confusing).

The problem is the IF statement on line 93, which is never closed. Proper indentation makes this much clearer. Here’s a copy of the file with the indentation fixed and the ENDIF added.

usr_rates_des.f (5.1 KB)

Thank you!
In the SpoutedBedCombustor tutorial, I’m having another problem with *** PAFC not specified, I’d like to ask what parameter PAFC refers to and where to change it?

Note that SpoutedBedCombustor is filed under “Legacy” tutorials which means it’s not fully developed, or guaranteed to work

This tutorial defines two new keywords in usr_init_namelist.f


Typically there would be some description for these keywords, but in this case that’s not present.

However in the mfix.dat in the same dir we find:

  PAFC =  0.6 ! Proximate analysis - Fixed Carbon

Hope this helps,
– Charles

Also, in general, it would be helpful if you mark a problem “solved” when your question has been answered, and start a new topic for a new question, instead of adding unrelated questions to an existing thread.