是用law吗?我也是刚学,看到这个
4.5.4 DEFINE_DPM_INJECTION_INIT
功能和使用方法的介绍
你可以使用DEFINE_DPM_INJECTION_INIT macro when you want to initialize injections by specifying the particle properties at the time of injection.
Macro:
DEFINE_DPM_INJECTION_INIT ( name, I)
Argument types:
Injection *I
Function returns:
void
There are two arguments to DEFINE_DPM_INJECTION_INIT: name and I. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 I is a variable that is passed by the FLUENT solver to your UDF.
I is a pointer to the Injection structure which is a container for the particles being created. This function is called twice for each Injection before the first DPM iteration, and then called once for each Injection before the particles are injected into the domain at each subsequent DPM iteration.
Your UDF can initialize a particle's injection properties such as location, diameter, and velocity.
下面编译的UDF名字为init_random_diameter, initializes the particle diameter ( P_DIAM) with a randomized distribution in the range from 10 -5 m to 10 -3 m. The initial particle density ( P_RHO) is set to 1 kg/m 3. Initial particle mass is computed accordingly.
/*********************************************************************/
/* UDF that initializes particle injection properties */
/*********************************************************************/
#include "udf.h"
#include "random.h" /* not included in udf.h so must include here */
DEFINE_DPM_INJECTION_INIT(init_random_diameter,I)
{
Particle *p;
CX_Message("Initializing Injection: %s with random diameter\n",I->name);
loop(p,I->p) /* Standard Fluent Looping Macro to get
particle streams in an Injection */
{
p->flow_rate = 1.e-4;
P_DIAM(p) = 1.e-5 + fabs(cheap_gauss_random())*1.e-3;
P_RHO(p) = 1.0;
P_MASS(p) = P_RHO(p)*M_PI*pow(P_DIAM(p),3.0)/6.0;
}
},
There are three arguments to DEFINE_DPM_LAW: name, p, and ci. name is the
name of the UDF, specified by you. 当你的 UDF 编译和连接时,你为函数所选择
的名字会在 FLUENT 图形用户界面中变得可见,且可被选择。 p and ci are
variables that are passed by the FLUENT solver to your UDF.
p is a pointer to a Tracked_Particle structure that contains data relating to the particle
being tracked. This pointer can be used as an argument to the macros defined in
Section 5.7 to obtain information about particle properties (e.g., injection properties).
ci is an integer that indicates whether the continuous and discrete phases are coupled
(equal to 1 if coupled with continuous phase, 0 if not coupled).
Your UDF can define custom laws for particle properties (mass, diameter,
temperature, etc.) as the droplet or particle exchanges mass and energy with its
surroundings.
是用law吗?我也是刚学,看到这个
4.5.4 DEFINE_DPM_INJECTION_INIT
功能和使用方法的介绍
你可以使用DEFINE_DPM_INJECTION_INIT macro when you want to initialize injections by specifying the particle properties at the time of injection.
Macro:
DEFINE_DPM_INJECTION_INIT ( name, I)
Argument types:
Injection *I
Function returns:
void
There are two arguments to DEFINE_DPM_INJECTION_INIT: name and I. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 I is a variable that is passed by the FLUENT solver to your UDF.
I is a pointer to the Injection structure which is a container for the particles being created. This function is called twice for each Injection before the first DPM iteration, and then called once for each Injection before the particles are injected into the domain at each subsequent DPM iteration.
Your UDF can initialize a particle's injection properties such as location, diameter, and velocity.
下面编译的UDF名字为init_random_diameter, initializes the particle diameter ( P_DIAM) with a randomized distribution in the range from 10 -5 m to 10 -3 m. The initial particle density ( P_RHO) is set to 1 kg/m 3. Initial particle mass is computed accordingly.
/*********************************************************************/
/* UDF that initializes particle injection properties */
/*********************************************************************/
#include "udf.h"
#include "random.h" /* not included in udf.h so must include here */
DEFINE_DPM_INJECTION_INIT(init_random_diameter,I)
{
Particle *p;
CX_Message("Initializing Injection: %s with random diameter\n",I->name);
loop(p,I->p) /* Standard Fluent Looping Macro to get
particle streams in an Injection */
{
p->flow_rate = 1.e-4;
P_DIAM(p) = 1.e-5 + fabs(cheap_gauss_random())*1.e-3;
P_RHO(p) = 1.0;
P_MASS(p) = P_RHO(p)*M_PI*pow(P_DIAM(p),3.0)/6.0;
}
},
应该是DEFINE_DPM_LAW吧,我本来也是考虑在哪里加载,后来看到UDF帮助里这一段写的
There are three arguments to DEFINE_DPM_LAW: name, p, and ci. name is the
name of the UDF, specified by you. 当你的 UDF 编译和连接时,你为函数所选择
的名字会在 FLUENT 图形用户界面中变得可见,且可被选择。 p and ci are
variables that are passed by the FLUENT solver to your UDF.
p is a pointer to a Tracked_Particle structure that contains data relating to the particle
being tracked. This pointer can be used as an argument to the macros defined in
Section 5.7 to obtain information about particle properties (e.g., injection properties).
ci is an integer that indicates whether the continuous and discrete phases are coupled
(equal to 1 if coupled with continuous phase, 0 if not coupled).
Your UDF can define custom laws for particle properties (mass, diameter,
temperature, etc.) as the droplet or particle exchanges mass and energy with its
surroundings.
觉得应该是用DEFINE_DPM_LAW编写 因为里面提到粒子直径了
DEFINE_DPM_LAW里有一段话里说的可以用来定义粒子质量,直径,温度等 所以我觉得应该是在这里加载
我想做一个DPM中颗粒质量流量随时间变化的UDF 求教