Help with a biomass pyrolisis 2D simulation

Hello everyone,
I am doing my final grade proyect about fluizided bed pyrolisis.
I try copying the tutorial silane pyrolysis and adjusting it to biomass reactions
Haven’t seen any kind of reaction with the established rates and chemistry.
Please ignore the stoichiometry of the reaction or the initial cellulose, hemicellulose, and lignin of my biomass. I’m just testing that the kinetics work.
If you guys can have a look and give me any advice it would be awesome. (31.2 MB)

Hello Daniel.

The file you have written called usr_rates.f.txt needs to be called usr_rates.f

The .txt extension means it is not being picked up by the compiler as a Fortran source file, and is ignored.

After renaming it, I find there are compilation errors. You need to fix the code. I’m not going to do your project for you :slight_smile: but if you get stuck with the debugging, please follow up here and I will help you.

I see from the upload that you are working on Windows. I just tested the building the solver on Windows, and while it works fine, the First error/Next error buttons at the bottom of the build popup don’t work on the WIndows platform. Debugging is a bit easier on Linux because clicking on the errors will bring you directly to the error in the built-in editor window. I’ll get this fixed for the Windows users. For now, just read the error messages in the build popup and follow your nose …

Good luck,

– Charles

I didnt expect you to give me more clues :stuck_out_tongue_closed_eyes: I will keep working. I knew that I was stuck in a silly thing and that was driving me crazy. Expect your name to be on my paper Charles!

1 Like

Here’s something that will make your compile/edit/debug cycle a lot smoother. We will release this as a bug-fix shortly but you don’t have to wait.

Here’s a fix for the error handing in the build popup. This will make it easier to track down your errors.

Find the file, it should be in a location like:


(replace anaconda3 with mambaforge if using the alternative Miniforge/mamba installation)

Change lines 32-37 from

RE_PERCENT_DONE = re.compile(r"^\[([ 1][ 0-9][0-9])%\]")
RE_COMPILER_ERROR = re.compile(r"^([A-Za-z/.0-9_]+):([0-9]+):([0-9]+):")
RE_LINK_ERROR = re.compile(r"^([A-Za-z/.0-9_]+):([0-9]+):")

WINDOWS = platform.system() == "Windows"


RE_PERCENT_DONE = re.compile(r"^\[([ 1][ 0-9][0-9])%\]")
WINDOWS = platform.system() == "Windows"
if WINDOWS: # File names contain drive letters
    RE_COMPILER_ERROR = re.compile(r"^([A-Z]:[A-Za-z/.0-9_\\]+):([0-9]+):([0-9]+):$")
    RE_LINK_ERROR = re.compile(r"^([A-Z]:[A-Za-z/.0-9_\\]+):([0-9]+):$")
    RE_COMPILER_ERROR = re.compile(r"^([A-Za-z/.0-9_]+):([0-9]+):([0-9]+):$")
    RE_LINK_ERROR = re.compile(r"^([A-Za-z/.0-9_]+):([0-9]+):$")

and restart MFiX. After this the First error/Next error buttons will work and it should be much easier to find your errors. In general, just fix the first error and recompile - often something like a semicolon instead of a comma or mismatched parens will generate a “cascade” of false warnings after the “real” error.

– Charles

Hey Charles,
Do you know what is happening with the RATES error? The error handing works wonderful btw. (22.7 MB)


Error: Two main PROGRAMs at (1) and (2)

You have an END statement in usr_rates.f on line 213 and another one on 243. I do not know why these are in your code. The “Syntax error in IF clause” is a confusing message but the message that gave it away was the Two main PROGRAMs

Taking these out, you will find a different set of errors:


  230 |          RATES(RX6)  = (EP_s(IJK,1)*(0.65*K3C*c_ACEL+0.4*K3H*c_AHCEL+0.25*K3L*c_ALIN)-((RATES(RX1)+RATES(RX2)+RATES(RX3)+RATES(RX4)+RATES(RX5)+RATES(RX6))*(1/2167)-RATES(RX9)*(1/2333))*0.001)
      |                                                                                                                                                                             1
Error: Symbol rx9 at (1) has no IMPLICIT type; did you mean rx2?


  125 | IF(X_s(IJK,CEL) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  129 | IF(X_s(IJK,HCEL) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  133 | IF(X_s(IJK,LIN) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  137 | IF(X_s(IJK,ACEL) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  141 | IF(X_s(IJK,AHCEL) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  145 | IF(X_s(IJK,ALIN) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

  149 | IF(X_s(IJK,CAR) > c_Limiter) then
      |      1
Error: Rank mismatch in array reference at (1) (2/3)

Addressing these one at a time:

rx9 is clearly incorrect since there are only 6 reactions but I don’t know which reaction you intended here.

Also, I should point out that expressions line 1/2167 and 1/2333 will evaluate to 0, since they are integer expressions. This is probably not what you want.
Compiling with -Wall will point this out to you:

  230 | 1)+RATES(RX2)+RATES(RX3)+RATES(RX4)+RATES(RX5)+RATES(RX6))*(1/2167)-RATES(RX9)*(1/2333))*0.001)
      |                                                             1

Warning: Integer division truncated to constant ‘0’ at (1) [-Winteger-division]

So, change the 1 to a 1.0 (or even better 1.0D0 to do the computation in double-precision) - as this example illustrates -

      program main
      write(*,*) (1/2333)
      write(*,*) (1.0/2333)
      write(*,*) (1.0D0/2333)
      end program



The rest of the errors are all due to you accessing x_s with the wrong number of array indexes. The array arguments are IJK (cell), solids phase, then species within that phase. You have it correct in some places like L126 where you have X_s(IJK,1,CEL) but all the places that say X_s(IJK,CEL) etc need to be fixed.

@Engineer98 did you get this sorted out?

I think the chemistry is too heavy for getting results, as my tutor had told me. The simulation takes too much time. I am trying different discretization schemes.
Have a look if you want, (I’ve also attached it to you in a email) (31.1 MB)