CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   DEFINE_DPM_BC -- mass flow rate of aborted particle (https://www.cfd-online.com/Forums/fluent-udf/160820-define_dpm_bc-mass-flow-rate-aborted-particle.html)

swtbkim October 13, 2015 22:42

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!

pakk October 14, 2015 11:03

Code:

I want to calculate the mass flow rate of aborted particles and display it in contour.
I am not 100% sure what you want to do. Is your goal is to calculate the mass flow rate that you see when you do a summary report? (See for example section 24.7.2.2.2 of Ansys Help 16.1.)
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:

My first idea was using user defined memory and P_FLOW_RATE(p).
This is not a plan. You describe which tools you have, but you don't say how you plan to use them. Suppose you would be building a birdhouse, the plan to build it would not be "use a saw and hammer". A plan could be "start by sawing the correct pieces, then nail them together".

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.

`e` October 17, 2015 00:49

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).

bigfish_1023 January 11, 2018 04:00

Quote:

Originally Posted by pakk (Post 568226)
Code:

I want to calculate the mass flow rate of aborted particles and display it in contour.
I am not 100% sure what you want to do. Is your goal is to calculate the mass flow rate that you see when you do a summary report? (See for example section 24.7.2.2.2 of Ansys Help 16.1.)
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:

This is not a plan. You describe which tools you have, but you don't say how you plan to use them. Suppose you would be building a birdhouse, the plan to build it would not be "use a saw and hammer". A plan could be "start by sawing the correct pieces, then nail them together".

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.

Hi, pakk. i encountered the similar problem. and i also want to export the position of the trapped particle. With using the Message Macro, P_POS(p) and P_FLOW_RATE(p), i obtained the mass flow rate of the trapped particles and corresponding position. The number of trapped particle stream i counted in the information of Message is same as the fluent computes itself. But to my surprise, the total of P_FLOW_RATE of trapped particles was larger than the inlet mass flow of particles. Please give me some advices on this issue. Thanks very much!

obscureed January 11, 2018 08:23

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.