|
[Sponsors] |
Boundary Condition ID _ location_ udf code problem |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 25, 2018, 13:37 |
Boundary Condition ID _ location_ udf code problem
|
#1 |
New Member
Join Date: Jun 2012
Posts: 9
Rep Power: 14 |
Hello i have a question about setting the location with boundary condition ID
I have divided two section as A-B, B-C with boundary A,B,C. As original code, i set the boundary A,B,C with coordinate directly. Original Code ================================ #define A 6. #define B A+5. #define C B+4. DEFINE_SOURCE(xmom_src,c,t,dS,eqn) { int body; double src,x[ND_ND],loc,source; body=0; C_CENTROID(x,c,t); loc=x[0]; if ((loc > A) && (loc <= B)) body = 1; else if ((loc > B) && (loc <= C)) body = 2; switch (body) { case 1: src = 1/p; source = -src*C_U(c,t); dS[eqn] = -src; break; case 2: src = 1/p; source = -src*C_U(c,t); dS[eqn] = -src; break; default: source = 0.; dS[eqn] = 0.; } return source; } ================================= Now the boundary "B" is changed as the curved face. So i have to use the boundary condition ID. I have checked from BC panel and the ID of B was 191. From here, please anyone check my code. I am confusing where should be changed Changed code is shown below =================================== Changed code #define A 6. #define C A+9. DEFINE_SOURCE(xmom_src,c,t,dS,eqn) { int body; double src,x[ND_ND],loc,source; body=0; C_CENTROID(x,c,t); loc=x[0]; int ID = 191; /* Zone ID for top from Boundary Conditions task page */ Thread *B; B = Lookup_Thread(d, ID); if ((loc > A) && (loc <= B)) body = 1; else if ((loc > B) && (loc <= C)) body = 2; switch (body) { case 1: src = 1/p; source = -src*C_U(c,t); dS[eqn] = -src; break; case 2: src = 1/p; source = -src*C_U(c,t); dS[eqn] = -src; break; default: source = 0.; dS[eqn] = 0.; } return source; } ================================= |
|
April 25, 2018, 21:56 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
variable loc is coordinate along x axis, so you should define start/end of AB BC as x coordinate
recommendation: do not use double type in UDF, use real instead best regards |
|
April 25, 2018, 22:10 |
|
#3 |
New Member
Join Date: Jun 2012
Posts: 9
Rep Power: 14 |
hello AlexanderZ
That's what i am asking now. start/end of AB BC was x coordinate. But now i can not set B as x coordinate because it is curved I just tried changing only B as domain ID And then do i have to change the whole variable loc? |
|
April 25, 2018, 22:18 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
curved line is 2d line, so you need bouch x and y axis to define it.
for your case loc_x =x[0]; loc_y = x[1]; looks like you need to change your if statement best regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
3D Windturbine simulation in SU2 | k.vimalakanthan | SU2 | 15 | October 12, 2023 06:53 |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 02:27 |
Error - Solar absorber - Solar Thermal Radiation | MichaelK | CFX | 12 | September 1, 2016 06:15 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |