From MFIX-GUI, it can be seen particle-particle restitution coefficient is a constant in TFM. I wanna ask a question if particle-particle restitution coefficient can be a a variable? If so, which file should I compile it in？
Can you please tell us a little more about what you are trying to do? Do you want to change the coefficient for all particles, or on a per-particle level?
Thanks for your reply, Charles. Actually, the restitution coefficient (C_e) is a constant, I wanna try to change it to be a variable that changes over time. It probably needs a UDF like usr1.f or something. So is it a feasible method?
It should be doable. If you use the Lun kinetic theory model, you will also need to update
eta = 1/2x(1.0 + C_E)
Thanks, Jeff. So are there any codes as a reference? Or it should be written in usr1.f?
You can do it in usr1.f. Make sure you have
use constant, only: C_e, eta
so you can access and modify C_E and eta (if needed).
OK, thanks, Jeff. I’ll try it.
Hello, Jeff. Sorry to bother you again. Now I meet a new question. When I compiled usr1.f successfully, I removed C_e from MFIX-GUI. When I ran it, it occurred an error as follows:
Error 1101: Coefficient of restitution (C_E) not specified.
Please correct the project settings.
So I wanna know how to solve this problem, perhaps I should add some codes in .mfx(such as usr=ture)? I’m looking forward to your reply!
I think you should specify an initial value for
C_E so the data check passes at startup. After this, the value computed by your custom code should replace this initial value.
Hello, Charles. I have tried to specify value for C_E=0.98 in MFIX-GUI, and use usr1.f to replace this value. but I found the results are the same as these without usr1.f. So I tried to set C-e=0.86 in usr1.f. however it also didn’t work.
So I think if something wrong in the usr1.f. Please help me to see this code, appreciate it for you.
usr1.f (2.8 KB)
MN.mfx (17.9 KB)
I looked at your case, there are a few issues here.
- Here’s the relevant section of
usr1.f. I corrected the indentation to reflect the program structure, and added some
writestatements, which is a very useful debugging aid.
write(*,*) "*****USR1 IJKSTART3=", ijkstart3, "IJKEND3", ijkend3 DO IJK = ijkstart3, ijkend3 IF ( FLUID_AT(IJK) ) THEN Vim=1.5d0*sqrt_pi*sqrt(theta_m(IJK,1)) St=2268.D0*0.0046D0*Vim/(9.d0*0.00868d0) write(*,*) "***** IJK=", IJK, "C_E=", C_E C_E=(0.98-1.5d0*1001.d0*0.00005d0/(2268.d0*0.0046d0*C_e))*(1.d0-14/(small_number+St)) write(*,*) "***** CE new value", C_E EndIF EndDo RETURN END SUBROUTINE USR1
- Compiling and running this, none of the
******messages appear on the output. So
usr1is not running at all. Without setting the variable
call_usr, the user-defined subroutines are not used. So you have to turn this on:
After turning this on I’m still not seeing the messages on the console. The issue is that the USR1 function is called at the end of each time step. And the simulation time is never getting past 0.
t= 0.0000 Dt= 0.1029E-08 NIT= 2MbErr%=-0.5613E-08: Run diverged/stalled
Error from time_step.f:193
DT < DT_MIN. Recovery not possible!
If the job gets past the first time step without diverging, your code should get called and you should see the debug
- It’s hard to understand this line
you are computing a new value of
C_E in terms of the previous value … and this is happening in a loop. Is that really what you want to be doing? I would break this line up for clarity.
At first,I’m very grateful for your detailed answer,Charles. I think I don’t do it in a loop. Actually,I wanna change the restitution coefficient as following equation. Maybe there are something wrong with the codes, I’ll dedug it. Could you tell me if it is feasible in usr1.f?
Sorry, I’m not sure what you mean by ’ I think I don’t do it in a loop’, the code above clearly shows that the
C_E calculation is inside the
DO IJK = ijkstart3, ijkend3 loop.
I think what you are trying to do is possible, but I don’t know what all the terms in that equation are.
But the first step is to understand why your simulation is not getting past
t=0. Start by reading this section in the MFiX FAQ:
OK, thank you , Charles. I’ll try it.
Hello,Charles. I’m so sorry to bother you again. Because I don’t know the effect of “DO IJK = ijkstart3, ijkend3”. I just wanna calculate the restitution coefficient in every grid. It’s perhaps the same as the calculation of drag coefficient. I see the calculation of drag coefficient don’t use any loop, so I’m not sure if I’m supposed to use the loop.
C_E is a scalar, not an array, so I’m not sure what you mean by
restitution coefficient in every grid. It can vary in time, but not across the domain … unless you rewrite a whole bunch of code!
OK，I got it, Chalres. Thanks for your reply again!