Float invalid operation in usr rates des

I’m running the following program with an invalid floating point operation, I don’t know what causes it and how to fix it, can you please help me out? Thank you very much!
biomass pyrolysis-0301.mfx (27.3 KB)
usr_rates.f (4.5 KB)
usr_rates_des.f (3.4 KB)

Here’s my error message.

The error message points to line 75 of usr_rates_des.f:

DES_RATES(Pyrolysis) = 5.0d6*exp(-1.2d8/(8314*Tp))*MW_s(1,VOLATILE)

You are trying to use MW_s(1,VOLATILE) i.e. for phase 1 which is not defined. It is only defined for phase2. It is better to use MW_s(pM,VOLATILE). You are already exiting the routine is the particle phase is 1.

So replace line 75 by:

DES_RATES(Pyrolysis) = 5.0d6*exp(-1.2d8/(8314*Tp))*MW_s(pM,VOLATILE)

When you see this kind of errors, you can add a print statement above line 75. You know something is wrong on line 75. This can only come from Tp or MW_s(1,VOLATILE). Print the values of Tp and MW_s(1,VOLATILE) and it will show that MW_s(1,VOLATILE) has an incorrect value because it is not defined.

1 Like

Ok, my problem has been solved, thanks! Can I ask again how to code the print statement?

I use

write(*,*)  "Message", variable, "etc"