TAGGED: ansys-fluent, dpm-model, dpm-udfs, udf-compilation
-
-
June 27, 2022 at 3:02 pm
kamatsa
SubscriberHello. I am trying to introduce a force in the DPM_BODY_FORCE macro in the DPM model. The force is dependent on the flow velocity so I want to incorporate the flow velocity into the equation. My code is:
DEFINE_DPM_BODY_FORCE(DEP,tp,i)
{
double beta=L/D;
double xi=beta/sqrt((beta*beta-1));
double c1=0.5*log((xi+1)/(xi-1));
double f=xi*((1-xi*xi)*c1*xi+xi);
double Fd=0;
if (TP_POS(tp)[0] >= 0.05)
{
if(i == 1)
{
Fd = -1* (pi * km * epsilon * D * D * L / 6) / (alpha / (alpha - 1) - f) * pow(V / log(R2 / R1), 2) * pow(1 / TP_POS(tp)[1], 3)+pi*mu*D*4* fabs(TP_VEL(tp)[1])*(pow(beta,2)-1)/((2*pow(beta,2)-1)*(log(beta+sqrt(pow(beta,2)-1))/sqrt(pow(beta,2)-1)-beta));
}
else if (i == 0)
{
Fd = -1*pi * mu * D * fabs(C_U(c,t)-TP_VEL(tp)[0]) * 8 * (pow(beta, 2) - 1) / ((2 * pow(beta, 2) - 3) * (log(beta + sqrt(pow(beta, 2) - 1)) / sqrt(pow(beta, 2) - 1) + beta));
}
}
return(Fd/TP_MASS(tp));
}
I am getting the following error during compilation:
error: use of undeclared identifier 'c'
error: use of undeclared identifier 't'
Is this because I am using the flow variables in a different macro that does not have the variables t & c in its declaration. If yes, how do I fix this.
Some help would be appreciated. -
June 28, 2022 at 10:44 am
Rob
Ansys EmployeeHave a look at the example here https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v221/en/flu_udf/flu_udf_sec_define_dpm_body_force.html
-
June 28, 2022 at 11:50 am
DrAmine
Ansys EmployeeCheck the manual for more examples.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
3744
-
2573
-
1809
-
1236
-
594
© 2023 Copyright ANSYS, Inc. All rights reserved.