I am using a user-defined drag model by modifying the usr_drag.f
I compiled the solver as in the user manual.
The udf works on MFiX-on-WINDOWS, but it doesn’t work on MFiX-on-UBUNTU
I appreciate if somebody showed me what I did wrong
Here is the error from the MFiX output
Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
Backtrace for this error:
#0 0x7fa04851ed01 in ???
#1 0x7fa04851ded5 in ???
#2 0x7fa09626d20f in ???
#3 0x7fa048bdb57a in drag_usr_
at /home/a …"
My guess is you are dividing, zero or taking the square root of a negative number or a similar erroneous operation. Build the solver in debug mode, it will most of the time point to the line when the error occurs.
Thanks for your reply!
I tested the attached udf on Windows and it was working well. On Ubuntu I complied the custom solver using the coda code and using the GUI as well. The build is successful, but when I run the code the calculation stop and I got the error.
usr_drag.f (4.6 KB)
Did you build in debug mode? Compilers will behave differently on different systems. Most probably you divide by zero when Re=0 (zero relative velocity). Move the test on Re=0 before you actually divide by Re. Something like:
IF(Mug > 0.0) THEN
RE = EPg*DPM*VREL*ROg/Mug
RE = 1.0E+30
IF (RE == 0.0D0) THEN
lDgA = 0.0D0
IF (RE < 1000.0) THEN
C_d = (24.0D0/RE)*(1.0D0 + 0.15D0*(RE**0.687D0))
C_d = 0.440D0
IF (EPg <= 0.985 ) THEN ! (u_g = 0.40 m/s)
hD = 0.001820D0*EXP(EPg/0.156190D0) - 0.008660D0
hD = 1.0D0
IF (EPg <= 0.4 ) then
lDgA = 150.*(1.0D0 - EPg)*(1.0D0 - EPg)*Mug/EPg/DPM**2.+ &
1.75*(1.0D0 - EPg)*ROg*VREL/DPM
lDgA = (3.0D0/4.0D0)*C_d*EPg*(1.0D0 - EPg)*ROg*VREL* &