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/)
-   -   DEFINE_SOURCE - Problem (https://www.cfd-online.com/Forums/fluent-udf/88255-define_source-problem.html)

Hgyn May 12, 2011 05:45

DEFINE_SOURCE - Problem
 
Hello,
I'm trying to write a UDF for an laminar duct flow that effects the fluid like there is a semi-high wall in the middle. This is what i have:

#include "udf.h"

DEFINE_SOURCE(xmom,cell,thread,dS,eqn)
{
real source, CON = 10000.0;
face_t f;
Domain *domain;
domain = Get_Domain(1);

int zone_ID = 12;
Thread *rand = Lookup_Thread(domain,zone_ID);

begin_f_loop(f, rand)
{
source=-CON*C_U(cell,thread);
/* dS[eqn]=-CON; */
}
end_f_loop(f, rand)
return source;
}

Zone 12 is a wall which is adjusted on interior.
But the UDF is not working the way it should.
What's my fault.

Thanks

Amir May 12, 2011 15:41

Hi,
your UDF has some logical errors.
you loop over faces of your thread and then include source to the whole domain!!!
you have to separate a zone near the plate and include source to that.

Hgyn May 13, 2011 09:21

Thanks for your reply, I understand what you mean, so I implement a if-else-condition, but what can I use as condition, or how can I realise that the flow is just influenced at that position?

Amir May 13, 2011 09:35

As I said before, you have permission to add source terms to cells, so separate a zone near your area and then hook the UDF over separated zone in boundary condition panel.

Hgyn May 13, 2011 09:56

Got it, thanks a lot


All times are GMT -4. The time now is 05:00.