How to change particle-particle restitution coefficient to a variable by TFM?

Hello, everyone!
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?

– Charles

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 check_data\check_solids_continuum.f:128

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.

– Charles

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)

Hi Yuan.
I looked at your case, there are a few issues here.

  1. Here’s the relevant section of usr1.f. I corrected the indentation to reflect the program structure, and added some write statements, 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
  1. Compiling and running this, none of the ****** messages appear on the output. So usr1 is not running at all. Without setting the variable call_usr, the user-defined subroutines are not used. So you have to turn this on:

  1. 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.
    shot-2022-03-22_06-12-08

    t= 0.0000 Dt= 0.1029E-08 NIT= 2MbErr%=-0.5613E-08: Run diverged/stalled :frowning:
    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 ******* messages

  1. It’s hard to understand this line
C_E=(0.98-1.5d0*1001.d0*0.00005d0/(2268.d0*0.0046d0*C_e))*(1.d0-14/(small_number+St))

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.

– Charles

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?
1647949132(1)

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:

https://mfix.netl.doe.gov/doc/mfix/21.4/html/reference/faq.html#what-do-i-do-if-a-run-does-not-converge

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.
1647997681(1)

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!