An error occured when running the modified solver

Hello everyone, I’m trying to write some programs in mfix to calculate the Poisson equation. It calls the function solve_lin_eq for solving linear equations, but the following error occurs during runtime:

Error: Unexpected solver message:

malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)’ failed.

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:

#0 pthread_kill_implementation

at ./nptl/pthread_kill.c:44

#1 pthread_kill_internal

at ./nptl/pthread_kill.c:78

#2 GI___pthread_kill

at ./nptl/pthread_kill.c:89

#3 GI_raise

at … /sysdeps/posix/raise.c:26

#4 GI_abort

at ./stdlib/abort.c:79

#5 malloc_assert

at ./malloc/malloc.c:307

#6 sysmalloc

at ./malloc/malloc.c:2617

#7 int_malloc

at ./malloc/malloc.c:4407

#8 GI___libc_malloc

at ./malloc/malloc.c:3329

#9 data_transfer_init

at … /… /… /libgfortran/io/transfer.c:3218

#10 exit_MOD_mfix_exit

at exit.f:42

#11 error_manager_MOD_log_message

at error_manager_mod.f:277

#12 solve_lin_eq_mod_MOD_solve_lin_eq

at solve_lin_eq.f:165

#13 solve_poisson_e_field_mod_MOD_solve_poisson_equation

at test/solve_poisson_e_field.f:97

#14 calc_e_field_mod_MOD_calc_e_field

at test/calc_e_field.f:49

#15 iterate_MOD_post_iterate

at test/iterate.f:530

#16 run_fluid

at mfix.f:195

#17 run_mfix

at mfix.f:145

#18 main_MOD_run_mfix0

at main.f:85

#19 start_thread

at ./nptl/pthread_create.c:442

The 13th and 14th files were added by myself to the solver. Does anyone know what this error message means? Thank you for any help!

The short answer is that some type of memory corruption has occurred. If you want us to look into this, please attach all your files. The easiest way to do this is to select “Submit bug report” from the main menu, then upload the resulting ZIP file. Thanks.

Thanks for your reply. I tried to click the “submit bug report” button, but it keeps getting stuck. Does it work properly? Or i’ll attach my files just after a little more modifications.

Sorry, this is a known problem with MFIX 24.4.1. It was fixed in MFiX 25.1.2. You can just attach your individual files.

I have attached my files here. The program uses some functions in original code, like PARTICLE_IN_CELL, BC_PHI and SOLVE_LIN_EQ, in order to solve the poission equation in DEM. I guess some parameters have set wrongly when I call these functions. Thanks for your help!
test.zip (32.5 MB)

I have used MFIX-25.1.2 and submitted a bug report. Thanks for your help
cyclone_sms_2025-07-09T171549.806609.zip (30.8 MB)

OK, I’ll take a look at this as soon as I have a chance.

The fact that you are getting a malloc error points to memory corruption.

I rebuilt the solver with Fortran flags -fcheck=all,no-array-temps (see Code Gen Options (The GNU Fortran Compiler) ) to enable additional run-time checking. Note that this will be the default for the “Debug” build type in the next MFiX release (25.2). Until then you can specify this in the “Custom” flags input:

With these additional checks, I get this error, pointing to a problem in your calc_e_field.f:

At line 80 of file /tmp/cyclone_sms_2025-07-09T171549.806609/calc_e_field.f
Fortran runtime error: Pointer argument 'pic' is not associated

Error termination. Backtrace:
#0  0x7f1442e2ab10 in __calc_e_field_mod_MOD_charge_in_cell
	at /tmp/cyclone_sms_2025-07-09T171549.806609/calc_e_field.f:80
#1  0x7f1442e2c6a1 in __calc_e_field_mod_MOD_calc_e_field
	at /tmp/cyclone_sms_2025-07-09T171549.806609/calc_e_field.f:48
#2  0x7f1442e2f1e0 in usr3_des_
	at /tmp/cyclone_sms_2025-07-09T171549.806609/usr3_des.f:28
#3  0x7f144243eb5d in __des_time_march_MOD_des_time_end
	at /home/cgw/Work/NETL/mfix/model/des/des_time_march.f:474
#4  0x7f1442918860 in run_dem
	at /home/cgw/Work/NETL/mfix/model/mfix.f:222

Thanks for your help! I have found my mistake in the code.

However, when I tried to build the solver with Fortran flags ‘-fcheck=all,no-array-temps’ according to your suggestion, it always had another error, so I could not get the error report the same as yours:

At line 69 of file main.f
Fortran runtime error: Actual string length is shorter than the declared one for dummy argument ‘mfix_dat_filename’ (-96/1000)

Error termination. Backtrace:
#0 PyEval_EvalFrameDefault
at Python/bytecodes.c:2706
#1 start_thread
at ./nptl/pthread_create.c:442

This won’t happen when using DEBUG build type in release 25.1.2. What should I do?


This will be fixed in the upcoming 25.2 release.

In the meanwhile, you can apply the attached patch:
patch.txt (1.5 KB)
Download it and then:

$ cd $CONDA_PREFIX/share/mfix/src
$ patch -p1 < patch.txt