Consultation about UDF

Hello teachers, I want to implement a function of inlet-outlet-inlet boundary for the particle continuous loop under DEM, which should require writing a UDF, but I’m clueless, could you give me some guidance? Thank you very much.
The details are as follows: Assuming that there are 0.5 kg of particles to be reacted, they are filled into the reactor from the inlet boundary of the upper part of the reactor and discharged from the outlet boundary of the lower part of the reactor, and then these discharged particles are loaded into the reactor from the inlet boundary to continue carrying out the reaction, and the cycle continues until the particles have been completely reacted.

Do you also need to recycle the gas phase? If so, you can try to use the cyclic BC and maybe spread the particles in the x-direction when you recycle them at the top.

Thank you so much for your reply!
I didn’t describe the problem clearly, sorry.
I meant that the high-temperature gas enters from the bottom gas_inlet and is discharged from the top gas_outlet; The particles are injected from the top particle_inlet, and after a certain period of time, the top particle_inlet stops injecting new particles, while the existing particles automatically enter from the top particle_inlet to form a cycle when they move to the bottom of the reactor.

@jeff.dietiker @cgw Hello, dear teachers, could you give me some further guidance? Is this UDF difficult to write?

Have you studied the existing UDF tutorials, such as the pulsating_fluid_bed_2d?

First, you need to allow particles to leave the bottom, which is defined as a mass inlet, not a pressure outlet. This can be done by setting BC_PO_APPLY_TO_DES(BCV)=.TRUE., where BCV in the BC ID of the bottom outlet.

Then you need to count the number of particles going out. If you plan to run this in dmp mode, you need to gather the counts from each process. Then to re-inject them, you need to do something similar to des/set_bc_dem_mi.f where we set PI_COUNT and PI_FACTOR. The tricky part is if the outlet is larger than the inlet and you are fully packed at teh bottom, then you won’t have enough room to inject particles at the top. This may not be the case here since you have a hopper that limits the amount of particles trickling down.

Not the easier UDF to write though, will require some time to figure out.

Thank you very much for your reply. Its so helpful for me, and I will study it.

Sorry to interrupt again, senpai. I can’t figure out how the particles as they flow out from the reactor can have their state at that time (e.g., density, temperature, component ratios) recorded, and assigned to the inlet of the reactor. Because the state of each particle is different, I think it is so complicated. I have an idea: write the state of the particles flowing out from the lower part in an external file, and then let the inlet read it, I don’t know if it is feasible. Could you give me some additional guidance in that? More thanks.

We are planning to implement a BC type that will recycle particles from one outlet to an inlet, but this will take a few months before it is released.

Are you running in serial or DMP mode? If you are running in serial, my suggestion is to make the bottom inlet (where the particles exit) and the top inlet the same size. Then you can just overwrite the y-coordinate of the particles when they leave the bottom so they now are at the top.

If you are using DMP then it becomes a lot more complicated because of the communication between ranks.

Thank you for the guidance! I want to run in DMP mode, But it looks complicated, so let me look into it. And looking forward to the release of the cyclic boundary condition feature.

Dear jeff., I would like to ask if the circlic BC is only for particles and has no effect on gases that it is equivalent to a no-slip wall. Thank you!
The particles in the below images are performing a y-cyclic, the first image looks normal, but the second image looks like the gas is also performing a y-cyclic.



Now I understand your point, thanks alot. But I only want to recycle the particles, don’t let the gas recycle. Is there an easy way to change the code so that the particles are circulated and the gas is not.

Sorry, I already provided my suggestions above. What you want to do is not currently supported. Others may have a better idea for a quick fix.

Well, thank you anyway.