# The source term in the UDS

 Register Blogs Members List Search Today's Posts Mark Forums Read

May 21, 2020, 09:01
The source term in the UDS
#1
New Member

MengqiangHu
Join Date: Feb 2019
Posts: 11
Rep Power: 3
Hi,

I am working on the UDS by fluent, and I want to set a source by UDF, I have coded a UDF like:

#include "udf.h"
DEFINE_SOURCE(uds1_source,c,t,dS,eqn)
{
real x[ND_ND];
real source;
real time;
C_CENTROID(x,c,t);
if (x[0]<3 && x[0]>2.9 && x[1]>=2.7 && x[1]<=2.8)
{
source = 1;
dS[eqn] = 0.;
}
else
{
source=0.;
dS[eqn] = 0.;
}
return source;
}

As you can see, I want the release rate of the source to be 1. But when I run the simulation, for example, until time 8.65s (The time step size is 0.001s). The integral of the scalar in the whole domain is 14.92015, which is strange. I think that the value should be 1*8.65=8.65, why this phenomenon happened? I am really confused about that.

Thank you.
Attached Images
 30.jpg (70.5 KB, 4 views)

 May 21, 2020, 09:47 Source Term #2 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,552 Blog Entries: 1 Rep Power: 28 That's because sources are always volumetric. That means you have to divide by the volume. For source value to be 1, you need to return 1/C_VOLUME. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared on the Forum

May 21, 2020, 10:15
#3
New Member

MengqiangHu
Join Date: Feb 2019
Posts: 11
Rep Power: 3
Quote:
 Originally Posted by vinerm That's because sources are always volumetric. That means you have to divide by the volume. For source value to be 1, you need to return 1/C_VOLUME.
Thanks for the reply, but I think there must be something wrong expect that. Because I have tried to modified the 1 by 1/C_VOLUME, but the phenomenon still exists. And 14.9 turned to 149000, so I think this may not be the real problem.

 May 21, 2020, 11:46 Integral #4 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,552 Blog Entries: 1 Rep Power: 28 That's because you are looking at something else while expecting something else. The area integral that you are reporting is product of area with the scalar and not scalar multiplied by time. This is not time integral but area integral. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared on the Forum