 ## Fluids

Tagged:

• Sumit_Kumar
Subscriber

Hi all,

I had a query while doing a DPM simulation. Basically, I am trying to inject two types of particles from the inlet of a pipe. The properties I wanted to use were (Particle 1: Diameter 1mm, Quantity-10000, Particle 2: Diameter 2 mm, Quantity-5000). Is there a way that I can get a result with both of them injected at the same time? If yes, please do elaborate a bit on the procedure.

I am trying to attempt this with dense discrete particle modelling and as eulerian. If this assumption is incorrect, do let me know so I can fix it as well.

• Rob
Ansys Employee
You'll need two injections. However, you're confusing particles and parcels. For a surface injection we inject one parcel (stream) from each facet centre. If you leave all the "scale by area" and parcel settings as default each parcel for each injection will contain an equal fraction of the injected mass.
Now, the next bit. If the system is dilute, ie volume fraction is under about 12% DPM model is fine. Above that and DDPM or Eulerian is needed. The latter two invariably result in a transient solution so you need to decide ahead of running the model.
• Sumit_Kumar
Subscriber
Hi Rob,
I understood the second part. But in the first part, say I want to fix how many particles I want to inject, how to you think I should do that? I feel that once the number of particles are set, each parcel would have a symmetric amount of particles injected
• DrAmine
Ansys Employee
Steady state we talk about streams of particles. The number of streams at a surface will correspond to number of faces unless you allow fir random seeds and here you can tell how many streams you want to inject.
Unsteady ymsimilar thought but now we have particle parcels and here you can tell to inject over certain duration plus number of seeds.
• satri
Subscriber
I want to define a particle property that is not there in this list and i want to use that new particle property say (property1) in DEFINE_DPM_SCALAR_UPDATE user-defined function.
Can I use anyone property in the above list (The property that will not affect eh physics of my simulation) as a placeholder for the property1 that I am defining and use that placeholder value in my DEFINE_DPM_SCALAR_UPDATE?
say the value (specific heat/latent heat) will not affect the physics of my simulation can I put the property1 value in place of specific heat and then use that specific heat in my DEFINE_DPM_SCALAR_UPDATE.
I am using Viscus RNG k-e and discrete phase method as models in the simulation
Please let me know if ansys allows us to do so?

• satri
Subscriber
Also In case, i define this property using the procedure mentioned above can I vary this property1 for all the particles that i will inject? say i will inject 100 particles and I want o give a property1 value of 101.5 to first particle, the property1 value of 112.5 for the second particle and property value of 103.7 for the third particle... can i achieve this with DPM_DEFINE_PROPERTY UDF?
• DrAmine
Ansys Employee
Which property do you want to change?
• DrAmine
Ansys Employee
Yes you can vary the property based on the injection ID or Material of particles: check if they are coming from same injection and have same density or not.
• satri
Subscriber
I want to assign charge to a particle using the latent heat/ specific heat property as a place holder. because charge is not part of material property in DEFINE_DPM_PROPERTY list.
Something like this I want to vary this charge in same injection.
I have an Injection ID of 1 where i am injecting 100 particles. I want to assign different charges to every single particle.
My initial thought was to define this as a scalar. But i cannot assign more than 50 scalars in fluent so I thought at least if I can use any predefined property as a placeholder i can reassign that property every time my particle ID changes.
Please let me know if this is possible to achieve?

• satri
Subscriber
And as far as hooking up DEFINE_DPM_PROPERTY goes ansys fluent is not allowing me to link this UDF that i created to the particle at all. I am able to compile this UDF and I have put it in the same folder as my case file.
But even though i click on Change/Create as given in the documentation nothing happens  I don't see udf in the drop-down list at all. Am I missing any step?(I am following the documentation as given below) • satri
Subscriber
Also, i am trying to hook up the UDF that i created and Ansys is not recognizing this at all  I am following the same steps as outlined in the documentation below. I do not see Cp coming in the list of DPM property • Rob
Ansys Employee
Looking at the panels you're trying to alter the database entry, and not the material property. The second image is the particle material property, and cp will only be visible when you turn on the energy equation. Messing with the thermal properties may not end well, as these will effect how the energy equation works, and is likely to cause interesting side effects.
Do you really want each parcel to have a different charge? A scalar will track a charge value on the parcels so I'm not sure why you'd need more than 50 scalars.

• satri
Subscriber
I see. If I will encounter side effects then I will try to avoid them. But how would I go about with scalars?
It's not necessary that I need to have more than 50 scalars. I would be happy if I could assign 10 different charges. (But it is necessary that i assign different charges in the same injection)
For example, I have 100 parcels
parcels with ID- 1-10 will get charge C1
parcels with ID- 11-20 will get charge C2
parcels with ID- 21-30 will get charge C3... so on
If this is achievable then should I use DEFINE_DPM_PROPERTY or any other function? please let me know.

• Rob
Ansys Employee
Which is a value associated with the parcels, why would you need more than one scalar? Each parcel carries the scalar value with it: I think you just need one scalar.
• satri
Subscriber
Ohh I thought you need to assign different scalars to particles. If that were the case it works very well for me.
I believe this is the function to initialize the scalar variables DEFINE_INIT(charge_initialize, d)
I am not sure how would you index the particle numbers. I am trying to use F_UDSI thinking that the 'i' in this is the particle index.
Is 'i' the particle index?
and can user-defined scalar "particle_charge" be initialized using the DEFINE_INIT function? • Rob
Ansys Employee
f_loops are for faces, have a look here https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v221/en/flu_udf/flu_udf_sec_define_dpm_injection_init.html and look carefully in the DEFINE_DPM_INJECTION_INIT part.
• satri
Subscriber
I see.. I have been reading that documentation and am not sure how i could define that, do i define the user defined scalar this way? or Is mw a user-defined scalar and i is the index?
I don't see mw getting explicitly called as user-defined scalar?
Is mw the user-defined scaler in this given example documentation?
• DrAmine
Ansys Employee
mw is a variable pointer to hold the molecular weights of the species. Same with yi but for mass fractions: both have nothing to do with user scalar.
• satri
Subscriber
I see.. so how would I define a user defined scaler and assign the particle charge property
// i =100 as i am injecting 100 particles
if (i < 10)
{PP_USER_REAL(p,i) = 1*1.6E-19;}
if (i<20)
{PP_USER_REAL(p,i) = 3*1.6E-19;}
Is there any example in the documentation that talks about how to define user-defined scalar? Because whenever i find a user defined scalar i cant get anything.. Is it termed differently in the documentation?

• DrAmine
Ansys Employee
Using DEFINE_DPM_SCALAR_UPDATE and using TP_USER_REAL(tp,i): i has nothing to do with particles: i is just the variable i (starting from 0). The Documentation does have an example for melting Index: rely on that ;)
• satri
Subscriber
Thank you for suggesting that... I am looking at the melting index example... I see that user_particle_vars is the user defined scalar.. But in the DEFINE_DPM_SCALAR_UPDATE how will i index through the 100 particles. I want to assign different values of charge to all the sets of 10 particles. Which is the particle index number?
is p the particle index?
lets say i want to define different melting indexes for all the particles in the above example.
{ cphase_state_t *c = &(p->cphase);
if (initialize)
{
/* this is the initialization call, set: * P_USER_REAL(p,0) contains the melting index, initialize to 0 * P_USER_REAL(p,1) contains the viscosity at the start of a time step*/
P_USER_REAL(p,0) = 0.; P_USER_REAL(p,1) = c->mu; }
else {
/* use a trapezoidal rule to integrate the melting index */
P_USER_REAL(p,0) += P_DT(p) * .5 * (1/P_USER_REAL(p,1) + 1/c->mu);
/* save current fluid viscosity for start of next step */
if (*p<10)
{P_USER_REAL(p,1) = c->mu; }
if (*p<20)
{P_USER_REAL(p,1) = c->3*mu; }
if (*p<30)
{P_USER_REAL(p,1) = c->3*mu; }
}
}
Please let me know if this is how you index through all the particle IDs to assign different melting indexes.

• satri
Subscriber
Thank you for suggesting that I see that user_particle_vars is the user defined scalar.
Lets say in the above example itself i am injecting 100 particles and i want to assign different melting index.
now in the DEFINE_DPM_SCALAR_UPDATE function how do i index through the different particle ids to assign it a different index?
is *p the particle index pointer?
/* update the user scalar variables */
{ cphase_state_t *c = &(p->cphase);
if (initialize) {
/* this is the initialization call, set: * P_USER_REAL(p,0) contains the melting index, initialize to 0 * P_USER_REAL(p,1) contains the viscosity at the start of a time step*/
P_USER_REAL(p,0) = 0.;
P_USER_REAL(p,1) = c->mu; }
else { /* use a trapezoidal rule to integrate the melting index */
P_USER_REAL(p,0) += P_DT(p) * .5 * (1/P_USER_REAL(p,1) + 1/c->mu);
/* save current fluid viscosity for start of next step */
if(*p < 10)
{P_USER_REAL(p,1) = c->mu; }
if(*p < 20 && *p>=10)
{P_USER_REAL(p,1) = c->3*mu; }
if(*p < 30 && *p>=20)
{P_USER_REAL(p,1) = c->4*mu; }
} }

• satri
Subscriber
if(*p < 10)
{P_USER_REAL(p,1) = c->mu; }
if(*p < 20 && *p>=10)
{P_USER_REAL(p,1) = c->3*mu; }
if(*p < 30 && *p>=20)
{P_USER_REAL(p,1) = c->4*mu; }
this is the place i am trying to index through all the particles and assign it different user defined scalar values.
Is this how you would index through the different particle id's?
• satri
Subscriber

For Everybody's benefit, I am writing this so that if anyone is trying to use any of the DPM property as a place holder. You can do so the above example is not helpful and will confuse you if you are new. And there are not many helpful resources that help you understand user-defined scalars. Anyway check this out if it helps you guys

if you have a randomization code for dpm injection

just type in

P_RHO(p)=2130.0;

P_T(p) = 5.0; // use this as place holder if you are not using temperature
P_TIME(p)= 0.0;//  use this as place holder if you are not using time you can use it as a communication channel

this helps you communicate between randomization code and cluster tracking code 