When I was generating the mesh of a fluidized bed with two vertical internals, the following error was reported. All settings in the mesher were default. Lacking enough knowledge of the cut-cell part code, I don’t know what this error means and how to solve this problem. Can you please give me some guidance?

Error: Unexpected solver message:
Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
Backtrace for this error: #0 get_alpha_mod_MOD_get_3d_alpha_w_cut_cell
at cartesian_grid/get_alpha.f:954 #1 cut_cell_preproc_MOD_cut_cell_preprocessing
at cartesian_grid/cut_cell_preprocessing.f:114 #2 main_MOD_check_data
at main.f:708 #3 main_MOD_check_data
at main.f:597 #4 main_MOD_get_data
at main.f:579 #5 run_mfix
at mfix.f:130 #6 main_MOD_run_mfix0
at main.f:85 #7 libc_start_call_main
at …/sysdeps/nptl/libc_start_call_main.h:58 #8 libc_start_main_impl
at …/csu/libc-start.c:392

I’ve been trying to solve a problem for a while now, but I haven’t been successful yet. I’ve tried various methods, but none of them seem to work. I’m hoping someone here can help me out.

I think the main issue is that I don’t understand the meaning of this error message posted above. Can someone please explain it to me? And if possible, could you please give me some advice to avoid this problem?

The message is telling you that something went wrong with the math at line 954 of get_alpha.f
These FPEs (Floating Point Exceptions) are typically the result of either division by 0, square root or log of a negative value, or overflow.

Running in the debugger I find:

get_alpha_mod::get_3d_alpha_w_cut_cell ()
at /home/cgw/miniforge3/envs/mfix-git/share/mfix/src/model/cartesian_grid/get_alpha.f:954
954 Theta_Wt(IJK) = DELZ_Wt(IJK) / (DELZ_Wt(IJK) + DELZ_Wb(IJKP))
(gdb) p IJK
$1 = 1372627
(gdb) p DELZ_Wt(IJK)
$2 = 0.001
(gdb) p DELZ_Wb(IJKP)
$3 = -0.001

We got unlucky here and the two terms DELZ_Wt(IJK) and DELZ_Wb(IJKP) sum to 0, leading to a 0 in the denominator and the observed FPE.

I’m not sure what to do to prevent this, or why we don’t see this error more often. The code should probably be checking for this condition before attempting the division. @jeff.dietiker do you have any comment?

First, I strongly encourage you to use the procedural STL feature in the GUI when generating cylinders, these will be of much better quality than the vtk implicit or primitive shapes. Here you have thin elongated triangles that fall below the small angle tolerance. If you see a non-zero number of ignored facets, this means your geometry may not be waterproof and will lead to meshing issues.

BC STL file(s) successfully read.
Total number of BC facets read = 588
Number of valid facets = 562
Number of ignored facets = 26

You can keep all facets by setting the facet angle tolerance to zero (then you take the risk of having collapsed triangles).

When I have meshing issues, I usually start by increasing the snap tolerance to reduce the number of small cut cells. Then I play with the dot product tolerance (here I had to decrease it to get better intersection) or the intersection tolerance if the mesh is very fine. Below are the settings I used to get a decent mesh. I have not tried to run your model though.