DEFINE_DPM_BC -- mass flow rate of aborted particle
I'm trying to practice DEFINE_DPM_BC example of UDF manual.
There, some particles are active and some aborted. I want to calculate the mass flow rate of aborted particles and display it in contour. My first idea was using user defined memory and P_FLOW_RATE(p). --> cell_t c; --> C_UDMI(c,t,0)=P_FLOW_RATE(p); But it didn't work. I don't know whether this idea is bad or there was just some mistake in coding. How can I do it? I just begin to learn about UDF and I don't know almost everything about UDF. So any help or idea will be highly appreciated! |
Code:
I want to calculate the mass flow rate of aborted particles and display it in contour. If your only goal would be to get the number, you can stop programming because it is already implemented in Fluent. But if you want to learn how to make UDFs, it is a good exercise. You say: Quote:
So, how would you calculate the mass flow rate if you were the computer? Just make a simple plan (in English or another "human" language) that the computer should follow. That is 80% of programming. If you do this properly, you will get a short, simple, easy, program. The other 20% is translating the human language into computer language. If you did the first 80% correctly, it will be just a few lines. If you did the first 80% poorly, this will be very annoying work. So spend time on getting the 'plan' ok. |
It sounds like you want to calculate the mass flow rate of particles on a cell-by-cell basis and display this distribution with contours. Try looping through all particles and adding their flow rate to the cell in which they reside (with user-defined memory). Because of the discrete nature of Lagrangian particle tracking, the contours may have patches (increase the number of particles to smooth the distribution).
|
Quote:
|
The recent discussion of bigfish_1023's case might be useful: see https://www.cfd-online.com/Forums/fl...pped-wall.html.
The overall plan of adding to User-Defined Memory during calls to DEFINE_DPM_BC sounds like a good start to me. My preference would be to aim for mesh-independent values, and hence to divide face impact rates by face area. Note that the parameters passed to DEFINE_DPM_BC relate to the wall face, not the cell. If you allocate a User-Defined Memory, then wall faces have it as well as cells, so you can add to F_UDMI(f,ft). You will eventually want a UDF (maybe DEFINE_ON_DEMAND) to set the UDM back to zero. Plotted contours typically use cell values, so you might also want to look up the cell and add to C_UDMI(c,ct) -- see the code snippets I posted in that other thread. |
All times are GMT -4. The time now is 19:11. |