Hello,developers!
The solver crashes while running the study, does anyone know why?
This is my bug report.Could you look at this for me, please?
combustioncase_2023-11-26T204747.588165.zip (4.5 MB)
I’ll take a look when I get a chance. But these kinds of “Access violations” usually occur when a particle has left the domain. This is typically due to either poor mesh quality, or walls/particles being too soft and passing through boundaries instead of bouncing off.
Another thing to try is to run in serial mode (no SMP) to see if this is an SMP issue
-
I note that you are running MFiX 22.3.1. When you get a chance, upgrade to the latest version (23.3.2)
-
While compiling your UDF code (
usr_rates.f
) I get the following warning:
Building Fortran object CMakeFiles/udfs.dir/tmp/combustioncase_2023-11-26T204747.588165/usr_rates.f.o
/tmp/combustioncase_2023-11-26T204747.588165/usr_rates.f:146:12:
146 | RATES(R3_Homogeneous) = c_CH4*c_H2O*KERT3
| 1
Warning: Legacy Extension: REAL array index at (1)
/tmp/combustioncase_2023-11-26T204747.588165/usr_rates.f:147:12:
and similar warnings for lines 147 and 148
107 DOUBLE PRECISION :: r3_homogeneous
108 DOUBLE PRECISION :: r4_homogeneous
109 DOUBLE PRECISION :: r5_homogeneous
...
146 RATES(R3_Homogeneous) = c_CH4*c_H2O*KERT3
147 RATES(R4_Homogeneous) = c_CO*c_H2O*KERT4
148 RATES(R5_Homogeneous) = c_CO2*c_H2*KERT5
You have declared r3_homogeneous
as a double-precision value so it is incorrect to use it as an array index - the compiler is warning you about this, although allowing it. (It should probably be treated as a fatal error). Furthermore, this variable is uninitialized so you are essentially writing into a random location in the RATES
array, triggering the access violation. (MFiX should show you more detail about where the error happened, perhaps if you upgrade to a more recent version you will get better error reports).
The array indices for RATES
have to be integers corresponding to the reactions you have defined. These names are defined in a file species.inc
which is created when you build the solver. Here are your reactions:
and here is the generated
species.inc
:
INTEGER, PARAMETER :: CO = 1
INTEGER, PARAMETER :: O2 = 2
INTEGER, PARAMETER :: CO2 = 3
INTEGER, PARAMETER :: H2 = 4
INTEGER, PARAMETER :: H2O = 5
INTEGER, PARAMETER :: CH4 = 6
INTEGER, PARAMETER :: SiO2_2 = 1
INTEGER, PARAMETER :: Moisture = 1
INTEGER, PARAMETER :: Char = 2
INTEGER, PARAMETER :: Ash = 3
INTEGER, PARAMETER :: Volatile = 4
INTEGER, PARAMETER :: R3 = 1
INTEGER, PARAMETER :: R4 = 2
INTEGER, PARAMETER :: R5 = 3
INTEGER, PARAMETER :: Pyrolysis = 1
INTEGER, PARAMETER :: Dring = 2
INTEGER, PARAMETER :: R1 = 3
INTEGER, PARAMETER :: R2 = 4
Note that there is no reaction called R3_Homogeneous
. Take out the definitions of r[345]_homogeneous
at lines 107-109 and use the correct indices at 146-148.
Thanks!I try to take out the definitions of r[345]_homogeneous
at lines 107-109 and use the correct indices at 146-148,but the problem remains unresolved.Is there anything else I can try? How can grid quality be improved?
Please upload your modified files
Error message (are you seeing this?)
#0 c3m_usr_rates1
at combustioncase_2023-11-29T213105.947494/usr_rates.f:148
#1 stiffchemclass_MOD_tsolverconstructor
at chem/stiff_chem.f90:264
#2 stiff_chem_MOD_stiff_chem_solver
at chem/stiff_chem_mod.f:88
#3 step_MOD_chem_mass
at time_step.f:214
#4 run_fluid
at mfix.f:205
#5 run_mfix
at mfix.f:145
#6 main_MOD_run_mfix0
at main.f:85
Line 148 of usr_rates.f
148 ReactionRates(IJK,l) = RATES(L)
[Current thread is 1 (Thread 0x7fdd41b616c0 (LWP 24845))]
(gdb) print ReactionRates
$1 = <not allocated>
You need to set ReactionRates array size
if you are going to use that array
Thank you! The previous problem has been solved, but I have a new problem: access conflicts cause the solver to crash. This is my error report, please help me to see how to solve it.
combustioncase_2023-12-03T163151.356831.zip (6.3 MB)
Some kind of memory corruption is happening here
The debugger tells me
63 DES_RATES(Dring) = 5.13d6*exp(-8.79d7/(8314.d0*Tp))*MW_s(1,MOISTURE)
(gdb) p des_rates
value requires 944905285042854617 bytes, which is more than max-value-size
That number is absurdly large. I’m not sure what’s causing this, it may take a little while to debug.
– Charles
The problem is at line 32 of your usr_rates_des.f
Change
INTEGER, INTENT(OUT) :: DES_RATES(:)
to
INTEGER, INTENT(OUT) :: DES_RATES(NO_OF_DES_RXNS)
and the case runs.
Thanks! Problem solved!