Segmentation fault in calc_cp_des

Hello, after I added the fluid species to the case, the solver crashed in the calculation (it can run when setting the type), may I ask what might be the cause?

Please attach your files (main menu > create bug report) so someone can take a look.

3d_fluidized_bed_2024-11-21T001608.557019.zip (20.7 MB)

What do you mean by

?

The stl file 1.stl is missing. It says it’s locationis D:\\Mch\\mfix\\1.stl. The stl file should be copied to the project directory. Is mfix the name of your project directory?

1.STL (684 Bytes)

Sorry, an message error occurred. What I want to say is that the case will work without setting the fluid species.

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000557607efcad7 in des_thermo::calc_cp_des (pnp=1)
    at mfix/src/model/des/des_thermo_mod.f:118
118	      lTs = DES_T_s(pNP)
(gdb) p pNP
$1 = 1
(gdb) p DES_T_s
$2 = <not allocated>

Energy equations are not enabled, so this array is not allocated. But I’m not sure why we got to calc_cp_des without energy equations. If I enable energy equations, I get a different error message about no species being defined.

Here’s the full stack trace:

#0  0x0000557607efcad7 in des_thermo::calc_cp_des (pnp=1)
    at mfix/src/model/des/des_thermo_mod.f:118
#1  0x000055760836c64b in calc_thermo_des_mod::calc_thermo_des ()
    at mfix/src/model/des/calc_thermo_des.f:48
#2  0x0000557607f47189 in pic_time_march_mod::pic_time_step (pic_iters=1)
    at mfix/src/model/des/pic/time_march_pic.f90:131
#3  0x0000557607e566b1 in run_mfix::run_pic ()
    at mfix/src/model/mfix.f:239

In calc_thermo_des:

      IF(.NOT.ENERGY_EQ .AND. .NOT.ANY_SPECIES_EQ) RETURN

In your case, energy_eq is not set, but species_eq is set for the fluid phase (species_eq(0) = .True.) so we are getting into cal_cp_des and attempting to access the unallocated DES_T_s array.

Until we get a fix in the code, your options are to either turn off species equations, or turn on energy equations.

Thanks for your bug report, and your patience.

– Charles

After enabling energy equations in the Model pane, you must visit the Solids pane so that c_ps0 (constant specific heat) is set… this does not happen immediately when energy equations are enabled, but only when the Solids pane is opened (I will fix this for the next release)

After doing this, the next error message is

These bc_ keys will get set if you visit the Boundary conditons pane, and select each boundary condition (you can use the down-arrow key). Unfortunately, when selecting BC4 (“outlet”), an error popup appears:

Error: 'QTableWidget' object has no attribute 'isEnbled'

This should be isEnabled not isEnbled, this will be corrected in the next release.

This error can be safely ignored, since it only has to do with setting a color in the GUI. (click Cancel on the error popup).

If you want to, you can edit the file %CONDA_PREFIX%\Lib\site-packages\mfixgui\bcs.py and fix the typo (it’s on line 3988), but this is not necessary.

The error will also disappear if you remove the 0.0 mass fraction for N2 in the optional inputs, or correct the mass fractions so they sum to 1:

After getting all the keys set we run into a new problem:

I will follow up on this in another posting.

Thanks for your bug report, and your patience.

– Charles

#1  0x562504765b61 in __des_reaction_model_mod_MOD_des_reaction_model
	at /mfix/src/model/des/des_reaction_model.f:109
#2  0x562504768f0f in __des_thermo_newvalues_mod_MOD_des_thermo_newvalues
	at mfix/src/model/des/des_thermo_newvalues.f:75
#3  0x56250430e1b7 in __pic_time_march_mod_MOD_pic_time_step
	at mfix/src/model/des/pic/time_march_pic.f90:145
#4  0x56250421d6b0 in run_pic
	at mfix/src/model/mfix.f:239
#5  0x56250421dade in run_mfix_
	at mfix/src/model/mfix.f:158
#6  0x56250421e575 in mfix
	at mfix/src/model/mfix.f:326
#7  0x56250421ec75 in main
	at mfix/src/model/mfix.f:296

Floating point exception (core dumped) 

Core was generated by `./mfixsolver -f ./mfix.dat'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x0000562504765b61 in des_reaction_model_mod::des_reaction_model ()
    at mfix/src/model/des/des_reaction_model.f:109
109	         FORALL(NN=1:DIMENSION_N_S)
(gdb) list
104	
105	         WHERE(PARTICLE_STATE(:MAX_PIP) == NORMAL_PARTICLE)            &
106	            sum_X_s(:MAX_PIP) = sum(DES_X_s(:MAX_PIP,:), DIM=2)
107	
108	! renormalize the species mass fractions
109	         FORALL(NN=1:DIMENSION_N_S)
110	            WHERE(PARTICLE_STATE(:MAX_PIP) == NORMAL_PARTICLE) &
111	               DES_X_s(:MAX_PIP,NN) = DES_X_s(:MAX_PIP,NN)  / sum_X_s(:MAX_PIP)
112	         END FORALL
113	
(gdb) p sum_x_s
$1 = (0, <repeats 200 times>, ...)
(gdb) p des_x_s
$2 = ((0, <repeats 200 times>, ...))

We’re getting a zero-division error because sum_X_s is all 0’s. But I’m not sure why this code is even being called, since there are no reactions in your case.

Looking at des_thermo_newvalues:

! Update particle from reactive chemistry process.
      IF(ANY_SPECIES_EQ .AND. .NOT.DES_EXPLICITLY_COUPLED)&
         CALL DES_REACTION_MODEL

Ok, we’re calling DES_REACTION_MODEL because species_eq is set. I think the best option for this case is to go back to square 1, and turn OFF both energy equations and species equations.

Sorry for the trouble!

– Charles

Thank you for your patient reply. I have learned a lot!But I still have a question, if I turn off the energy equations and the species equations, can I still calculate the concentration distribution of different gases in the case?

No, if you want to track species concentrations you need to have species equations on.

We need to fix some code in MFiX to deal with the case where species equations are enabled for the gas phase but not the solids phase. We hope to have this in place for the next release (24.4, at the end of December) but I cannot guarantee this.

I think the best thing for you to do in this case is enable energy equations, and also turn them on for the solids phase, and define at least one solid species.

Let us know if this works for you.

– Charles

Thanks to your patient answer. I have defined solid species and the problem is solved.