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/)
-   -   Filtering Adjust using position (https://www.cfd-online.com/Forums/fluent-udf/234767-filtering-adjust-using-position.html)

PierceH March 17, 2021 15:15

Filtering Adjust using position
 
Hello,


I implemented a user defined scalar which outputs entropy flux, however, I now want it to only do so within a defined x and y region. I thought I was on the right track but cant get this to interpret.

Quote:

DEFINE_ADJUST(adjust1,d)
{
Thread *t;
cell_t c;
real xc[ND_ND];
thread_loop_c (t,d)

{
begin_c_loop (c,t)


C_CENTROID(xc,c,t)

if (xc[0]} >0.25)
X = 1;
else
X = 0;
return X;



C_UDSI(c,t,0)= X*(1006.43*log(C_T(c,t)/255.556) -287.04*log((C_P(c,t)+p_gauge)/p_free));

end_c_loop(c,t)
}
}






AlexanderZ March 17, 2021 23:49

p_gauge
p_free
are not defined in code, fix it.
compile code

Code:

#include "udf.h"


DEFINE_ADJUST(adjust1,d)
{
Thread *t;
cell_t c;
real xc[ND_ND];
int X;
thread_loop_c (t,d)

{
begin_c_loop (c,t)


C_CENTROID(xc,c,t)

if (xc[0] >0.25)
X = 1;
else
X = 0;

C_UDSI(c,t,0)= X*(1006.43*log(C_T(c,t)/255.556) -287.04*log((C_P(c,t)+p_gauge)/p_free));

end_c_loop(c,t)
}



All times are GMT -4. The time now is 02:03.