Reaction in TFM fluid bed can not work

Hello everyone!
I am trying to use MFIX 21.2 to simulate the pyrolysis process of hydrocarbon organic matter and establish the DUF of reaction rate, but there is an error when compiling, I don’t know what is the problem?
reaction.mfx (21.2 KB)
usr_rates.f (3.4 KB)

Hi Raymond

The compiler output in that screenshot is garbled, I have not seen this behavior before. It should look like this:

We need to figure out why the text is corrupted on your system. Perhaps something to do with language or font settings? Can you tell me more about your OS? I may ask you to help me test a fix for this.

If this was working properly, clicking on the underlined line (or “First error” button) would take you to the offending line in the source code. In this case at L28 of usr_rates.f you have

  INCLUDE 'usrnlst.inc'

but there is no usrnst.inc in your project directory. This include is not necessary, as you have not added any user keywords. So, delete line 28 of your source file. You have the same include at L71, delete it there as well.

After fixing these I have more FORTRAN errors. It will be impossible for you to debug your UDF with the garbled output in the build popup. So until we get that fixed, you can build the solver by running the command

python -m mfixgui.build_mfixsolver -j -DCMAKE_Fortran_COMPILER=gfortran 

in your project directory, so you will at least be able to see the error messages in a legible form.

I can’t fix all the errors but I can give you some pointers:

   87 |       DOUBLE PRECISION ::  k_cracking_01,k_cracking_02,k_cracking_03,k_cracking_04,k_cracking_05&
      |                                                                                                 1
Error: Syntax error in data declaration at (1)
/tmp/ray/usr_rates.f:113:52:

You need a comma between cracking_05 and the continuation character &

After fixing this and a few other instances of the same problem, we are left with some undefined symbols. This is because the species and reactions referred to in usr_rates.f don’t seem to match what’s in your reaction.mfx. Here’s the compiler output, with its helpful “did you mean?” suggestions:


[ 97%] Building Fortran object CMakeFiles/udfs.dir/tmp/ray/usr_rates.f.o
/tmp/ray/usr_rates.f:113:52:

  113 |       RATES(Cracking_03) = ROP_g(IJK)*X_g(IJK,C20H40)/MW_G(C20H40)*KERT_03
      |                                                    1
Error: Symbol ‘c20h40’ at (1) has no IMPLICIT type; did you mean ‘c200h400’?
/tmp/ray/usr_rates.f:111:23:

  111 |       RATES(Cracking_01) = ROP_g(IJK)*X_g(IJK,C200H400)/MW_G(C200H400)*KERT_01
      |                       1
Error: Symbol ‘cracking_01’ at (1) has no IMPLICIT type; did you mean ‘e_cracking_01’?
/tmp/ray/usr_rates.f:112:23:

  112 |       RATES(Cracking_02) = ROP_g(IJK)*X_g(IJK,C200H400)/MW_G(C200H400)*KERT_02
      |                       1
Error: Symbol ‘cracking_02’ at (1) has no IMPLICIT type; did you mean ‘e_cracking_02’?
/tmp/ray/usr_rates.f:113:23:

  113 |       RATES(Cracking_03) = ROP_g(IJK)*X_g(IJK,C20H40)/MW_G(C20H40)*KERT_03
      |                       1
Error: Symbol ‘cracking_03’ at (1) has no IMPLICIT type; did you mean ‘e_cracking_03’?
/tmp/ray/usr_rates.f:114:23:

  114 |       RATES(Cracking_04) = ROP_g(IJK)*X_g(IJK,C20H40)/MW_G(C20H40)*KERT_04
      |                       1
Error: Symbol ‘cracking_04’ at (1) has no IMPLICIT type; did you mean ‘e_cracking_04’?
/tmp/ray/usr_rates.f:115:23:

  115 |       RATES(Cracking_05) = ROP_g(IJK)*X_g(IJK,C20H40)/MW_G(C20H40)*KERT_05
      |                       1
Error: Symbol ‘cracking_05’ at (1) has no IMPLICIT type; did you mean ‘k_cracking_05’?
/tmp/ray/usr_rates.f:100:19:

  100 |       E_cracking_05 = 98.05d3 !j/mol
      |                   1
Error: Symbol ‘e_cracking_05’ at (1) has no IMPLICIT type; did you mean ‘e_cracking_04’?
gmake[2]: *** [CMakeFiles/udfs.dir/build.make:79: CMakeFiles/udfs.dir/tmp/ray/usr_rates.f.o] Error 1

Hope this helps,

– Charles

@Raymond_Yu : If you copy and paste the text from the build popup (right click, “Select All”, “Copy”) then paste into a text editor, does it become normal? Is the build output just displaying in some bizarre font?

– Charles

Raymond - if you can, here’s something to try to help me test a potential fix for the garbled text.

First, locate the mfix installation directory. It should be

[home]/anaconda3/envs/mfix21.2/lib/python3.8/site-packages/mfixgui

Back up the files widgets/build_popup.py and uifiles/build_popup.ui before making the following edits:

in widgets/build_popup.py change the section starting at line 60 from

    le = ui.lineedit_command
    font = QFont("" if WINDOWS else "Monospace")
    font.setStyleHint(QFont.TypeWriter)
    metrics = QFontMetrics(font)
    tb.setFont(font)
    ui.min_width = metrics.width(" " * 120)

to

    le = ui.lineedit_command
    font = tb.font()
    metrics = QFontMetrics(font)
    ui.min_width = metrics.width(" " * 120)

and in uifiles/build_popup.ui change the section at line 303 from:

 <property name="font">
  <font>
   <family>Monospace</family>
  </font>
 </property>

to

 <property name="font">
  <font>
   <family>Courier New</family>
   <pointsize>12</pointsize>
  </font>
 </property>

If you can, give this a try and let me know if the build popup appears correctly with these changes. Thanks!

– Charles

I tried, but could not find python3.8 in the lib path.

I am running MFIX in the windows10 operating system, I have tried many times, garbled characters are only generated if a compilation fails. If I copy and paste the text into a text editor, it is normal. I guess it might be related to language or font Settings.

Thanks Raymond, I think I know what the problem is even though I’ve never seen the garbled text here. This should be fixed in the next release.

In the meanwhile you should be able to either copy/paste the compiler output to read the messages, or use

python -m mfixgui.build_mfixsolver -j -DCMAKE_Fortran_COMPILER=gfortran 

to build the solver - this way you’ll be able to read the error messages. Have you made any progress on getting your UDF to compile?

– Charles

Thank you very much! UDF still has some problems, which I am trying to solve now.

Hi, cgw,
My UDF has compiled successfully, but there is the following error when calculating.
image
I don’t know how to solve it.

Check the .LOG file, it should have more info on which variable went out of range.