Customize adding particles at runtime

I want to add particles at a custom location during runtime. Although it can be added successfully, an error will be reported when new particles come in contact with wall. I would like to ask for a solution.


above is UDF code in usr3.des.f

I’m not sure why your code is failing, will take a look when I have a chance (currently busy working on 21.2 release!). But I wanted to ask why you are using custom code to add particles instead of using a point source.

Thank you for your attention to my question.
My purpose is to use mfix to achieve particle fragmentation. For example, when the normal force of a particle is greater than a certain value, I delete the original particle (by calling the subroutine delete particle, this can be Realize), and then add two small particles according to the coordinates when the original particles are broken, which is equivalent to one particle broken into two, realizing particle replacement.
So I am studying how to add particles in custom locations. Point source may not achieve my goal.
I was recently looking for the reason for the error in adding particles. I tested some properties of custom added particles, and it did have a problem.

  1. I added two particles at the same position. It should be reported that the distance between the two particles is 0, but there is no such error.
  2. I added the impermeable surface, but the custom added particles can pass through.
  3. Custom added particles will not decelerate when they encounter other particles, they will continue to accelerate in the direction of acceleration, and knock other particles away. When they hit the wall, they will decelerate, and then an error will be reported.
    Thank you again for your attention to my problem, and hope to discuss and solve the problem together.

Hi. @lixiang0426 Can you post your entire MFiX project? Use the “Submit bug report” item in the main menu, it will create an archive containing your .mfx file, your usr*.f files, etc. It would also be helpful to have the full text stack trace (use copy/paste to copy the red text from the MFiX console window, rather than a screenshot). I will look at this as time permits.

– Charles

Hi. Charles.
Thank you for your attention to my question.
My city has a severe epidemic recently. I am working as a volunteer. I only saw your reply now. I am deeply sorry about it.
I use the “Submit bug report” and get a flie.I have uploaded this file in the attachment.
My purpose is to add particles at the specified location when mfix is running. Now I have made a small attempt to add a particle.
It can generate and move, but it will eventually report an error.
If I tick the “disable fluid solver”, it will not generate particles according to the instructions of “des_usr3.f”.
Thank you again for your attention to my problem, and hope to discuss and solve the problem together.
----Li Xiang
13_2021-07-29T161217.596242.zip (733.2 KB)

Li Xiang - no worries, we’re all operating in unusual circumstances. It’s great that you are volunteering. I hope the situation in your city improves soon.

I’m going to be out of the office for a few days. I will look at your case when I return next week, unless one of my colleagues gets to it before me.

Stay safe,

– Charles

@lixiang0426 - I just had a moment to look at your code.

It seems to me that you are not doing enough in your usr3_des.f. I am not an expert in this area but I suggest you look at the file
model/des/mass_inflow_dem.f
which implements mass inflows (another place where particles are added to the model)

In that file we find:


! Increment the number of particle on the processor by one. If the max
! number of particles is exceeded, set the error flag and cycle.
            PIP = PIP + 1
            CALL PARTICLE_GROW(PIP)
            MAX_PIP = max(PIP,MAX_PIP)

! Find the first free space in the particle existence array.
            NP_LP: DO NP = LS, MAX_PIP
               IF(IS_NONEXISTENT(NP)) THEN
                  LS = NP
                  EXIT NP_LP
               ENDIF
            ENDDO NP_LP

! Set the particle's global ID.
            iGLOBAL_ID(LS) = iMAX_GLOBAL_ID

! Set the properties of the new particle.
            CALL SET_NEW_PARTICLE_PROPS(BCV, M, LS, POS, IJKP)

Your usr3_des.f updates MAX_PIP but does not find space in the existence array and set the particle’s global ID and properties the way the code above does. I believe that if you take these extra steps, your problems might clear up.

– Charles

Dear Charles,thank you very much for your suggestion.
I followed the suggestions and tried, but it still doesn’t work.
I use the “Submit bug report” and get a flie again.I have uploaded this file in the attachment.
There must be something I didn’t notice.
Thank you again for your attention and enthusiastic help to my problem, and hope to solve this problem together.
– Li Xiang13_2021-08-05T140057.443823.zip (733.2 KB)

You forgot to set the des grid indices and other properties (volume, mass moment of inertia). Please see attached a basic setup for cold flow (no energy nor species equations). This is also not setup to run in parallel.

You want to be sure to not inject particles on top of existing particles. This would create large overlap and huge forces pushing particles as if they are blowing up. I am injecting them every 0.01 seconds (see DEM_INJECT_DT in usr0.f) and with initial velocity of 1 m/s in the x-direction so they have time to move away from the injection point.

13.mfx (14.4 KB)
usr0.f (2.2 KB)
usr3_des.f (3.4 KB)
usr_mod.f (507 Bytes)

2 Likes

That’s it, it didn’t report errors, thank you very much!