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/)
-   -   The diameter of particle keep constant (https://www.cfd-online.com/Forums/fluent-udf/236311-diameter-particle-keep-constant.html)

Shevin W. May 24, 2021 09:28

The diameter of particle keep constant
 
Hi, everyone! I am writting a DPM UDF for making the variation of particle diameter governed by R-P equation. Marco DEFINE_DPM_LAW was used, and this marco is hooked in the custom law of Fluent. But the diameter keeps constant after injection. I checked the UDF, found the UDF is not called when the calculation is in progress. The UDF and the hook progress are listed below, but i cannot find where goes wrong.:(:(

This is my UDF:

#include "udf.h"
#include "dpm.h"

#define Pv 3540.0
#define RhoL 998.2

DEFINE_DPM_LAW(bubble_growth,p,ci)
{
real sign;
Thread *t = TP_CELL_THREAD(p);
cell_t c = TP_CELL(p);
real P = C_P(c,t);
real dR,D;

/* first, define sign value*/
if (P-Pv == 0.)
{ sign = 0.; }
else if (P-Pv > 0.)
{ sign = -1.; }
else if (P-Pv < 0.)
{ sign = 1.; }
else
{ Message("wrong!"); }

/* compute new particle diameter*/
dR = TP_DT(p)*sign*sqrt(2./3.*abs(P-Pv)/RhoL);
D = TP_DIAM(p) + 2.0*dR;
if (D < 1.0e-6)
{ TP_DIAM(p) = 1.0e-6; }
else
{ TP_DIAM(p) = D; }

}

This is the process of UDF hook:
Setup → Models → Discrete Phase → Injections → set → Custom Laws
→ First law

AlexanderZ May 24, 2021 21:46

compile code, check syntax

try to change TP_* to P_* everywhere

Shevin W. May 24, 2021 22:30

Quote:

Originally Posted by AlexanderZ (Post 804571)
compile code, check syntax

try to change TP_* to P_* everywhere

Hollow, Alexander!
You are the first people helping me in CFD Online! Thank you very much! I have checked my UDF, and changed TP_* to P_* everywhere. The UDF is successfully complied in Fluent without any error. However, the particle diameter still keeps constant! I added a message into the law marco, and run the calculation. The message doesn't occur at the Fluent concole, indicating that the law marco isn't called when the calculation is on!

Are there something needed noted concering the progress of Law Marco hook? In my hook progress, the Law Marco is choosen in the injection-laws-custom-First law, and the switch Marco is choosen in the injection-laws-custom-Switching.

DEFINE_DPM_LAW(bubble_growth,p,ci)
{
cell_t cell;
Thread *cthread;

cell = P_CELL(p);
cthread = P_CELL_THREAD(p);

P_DIAM(p) = 6e-6;
P_RHO(p) = 1.0;

Message("program is under way!\n");
}

DEFINE_DPM_SWITCH(dpm_switch,p,ci)
{
P_CURRENT_LAW(p) = DPM_LAW_USER_1;
Message("law is switched!\n");

}

AlexanderZ May 25, 2021 03:59

looks like you've applied correct way to hook udf
This is the process of UDF hook:
Setup → Models → Discrete Phase → Injections → set → Custom Laws → First law

not sure, what could be a problem
you may try to find more information in Ansys Fluent Customization manual

Shevin W. May 25, 2021 04:06

Quote:

Originally Posted by AlexanderZ (Post 804589)
looks like you've applied correct way to hook udf
This is the process of UDF hook:
Setup → Models → Discrete Phase → Injections → set → Custom Laws → First law

not sure, what could be a problem
you may try to find more information in Ansys Fluent Customization manual

Thank you, Alexander!

I just settled this problem after noting this sentence in Ansys Help: you can specify custom laws for mass, diameter, and temperature properties as the droplet or particle exchanges mass and energy with its surroundings.

Best regards!
Shevin


All times are GMT -4. The time now is 04:17.