|
[Sponsors] |
November 30, 2020, 15:37 |
If scheme doesn't work
|
#1 |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
Hi, I have write this udf but the if statement seems not work. Someone can help me?
#include "udf.h" DEFINE_ADJUST(dudy, domain) { Thread *t; cell_t c; real xc[ND_ND]; real x; real y; thread_loop_c(t, domain) { begin_c_loop(c, t) { C_CENTROID(xc, c, t); x = xc[0]; y = xc[1]; if(y < 0 && x<6) { C_UDMI(c, t, 0) = -(C_V(c, t)*C_U_G(c, t)[1]) } else if(y<0 && x>6) { C_UDMI(c, t, 0) = -(C_V(c, t)*-C_U_G(c, t)[1]) } else if(y>0 && x<6) { C_UDMI(c, t, 0) = -(-C_V(c, t)*C_U_G(c, t)[1]) } else if(y>0 && x>6) { C_UDMI(c, t, 0) = -(-C_V(c, t)*-C_U_G(c, t)[1]) } } end_c_loop(c, t) } } |
|
November 30, 2020, 22:10 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
how could you know that it doesnt work?
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 1, 2020, 03:28 |
|
#3 |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
||
December 1, 2020, 03:41 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Try this, to see if it works:
Code:
DEFINE_ADJUST(dudy, domain) { Thread *t; cell_t c; real xc[ND_ND]; real x; real y; thread_loop_c(t, domain) { begin_c_loop(c, t) { C_CENTROID(xc, c, t); x = xc[0]; y = xc[1]; if(y < 0 && x<6) { C_UDMI(c, t, 0) = 1; } else if(y<0 && x>6) { C_UDMI(c, t, 0) = 2; } else if(y>0 && x<6) { C_UDMI(c, t, 0) = 3; } else if(y>0 && x>6) { C_UDMI(c, t, 0) = 4; } } end_c_loop(c, t) } } |
|
December 1, 2020, 03:52 |
|
#5 | |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
Quote:
Where I forgot some semicolons? |
||
December 1, 2020, 13:38 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You forgot semicolons where i changed the code, obviously.
You also forgot to show the test result. How does UDM 0 look like if you plot with this UDF? |
|
December 1, 2020, 13:40 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
And does this give errors?
Code:
DEFINE_ADJUST(dudy, domain) { Thisshouldgiveanerror() ; } |
|
December 1, 2020, 13:57 |
|
#8 |
New Member
Italia
Join Date: Oct 2020
Posts: 19
Rep Power: 6 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Implementation of QUICK scheme | Romuald Skoda | Main CFD Forum | 11 | November 6, 2017 22:20 |
Problem using Central differencing scheme with LES WALE | selvam2487 | CFX | 8 | July 23, 2017 16:33 |
forward diff scheme vs backward diff scheme | zdunol | Main CFD Forum | 5 | November 30, 2015 14:42 |
RP_Set_Integer does not work in parallel | 86lolo | Fluent UDF and Scheme Programming | 2 | July 3, 2014 12:37 |
Why FVM for high-Re flows? | Zhong Lei | Main CFD Forum | 23 | May 14, 1999 14:22 |