Ansys Learning Forum Forums Discuss Simulation Fluids Quesiton about profile for fluent Reply To: Quesiton about profile for fluent

lzfneu
Subscriber
Dear Rob Thanks for your reply.
I want to import the heat generation rate (W/cm3) to the source term according to different x, y, z coordinations.
For example, the heat generation is 1000W/cm3 in the location x=1.11cm, y=2.22cm, z=3.33cm; and is 2000W/cm3 in the location x=8.88cm, y=9.99cm, z=10.10cm; 3000W/cm3 in the location x=20.22cm, y=30.33cm, z=40.44cm;
In order to achieve that, I write the source term as follows:
#include "udf.h"
DEFINE_SOURCE(test, c, t, dS, eqn)
{
real x[ND_ND];
real a, b, c, source;
C_CENTROID(x, c, t);
a=x[0]; b=x[1]; c=x[2]; // x,y,z coordinate
if(a==1.11 && b==2.22 && c==3.33) {source=1000;}
if(a==8.88 && b==9.99 && c==10.10) {source=2000;}
if(a==20.22 && b==30.33 && c==40.44) {source=3000;}
dS[eqn]=0;
return source;
}
Is it right?
And is there any convinent method to use if there are many x, y, z coordiantes and heat generations, thank you very much in advance.