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 source term in the UDS (https://www.cfd-online.com/Forums/fluent-udf/227232-source-term-uds.html)

POSTHU May 21, 2020 09:01

The source term in the UDS
 
1 Attachment(s)
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.

vinerm May 21, 2020 09:47

Source Term
 
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.

POSTHU May 21, 2020 10:15

Quote:

Originally Posted by vinerm (Post 771458)
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.

vinerm May 21, 2020 11:46

Integral
 
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.


All times are GMT -4. The time now is 11:06.