|
[Sponsors] |
UDF code for Interior Face (Missile Nozzle Exit) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 7, 2018, 17:09 |
UDF code for Interior Face (Missile Nozzle Exit)
|
#1 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
I'm trying to write a UDF to give a velocity at an interior face (Nozzle Exit). When I am trying to compiling following error was coming
Error: received a fatal signal (Segmentation fault). UDF file #include "udf.h" #include "mem.h" #include "math.h" DEFINE_EXECUTE_AT_END(Velocity) { Domain *d; face_t f; cell_t c0, c1 = -1; Thread *t, *t0, *t1 = NULL; real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; c0 = F_C0(f,t); t0 = F_C0_THREAD(f,t); F_AREA(A, f, t); d = Get_Domain(1); t= Lookup_Thread(d, 2); begin_c_loop { c1 = F_C1(f,t); /* Get cell on other side of face */ t1 = F_C1_THREAD(f,t); NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0); NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1); } end_f_loop (f, t) } Please find the attachement file of boundary condition Or Suggest me to write the UDF code to calculate interior face velocity. This is very useful for my project . advance Thanks for fast reply. |
|
January 7, 2018, 22:36 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
in your code:
begin_c_loop but end_f_loop (f, t) Your'd missed close brackets here: NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0) ) ; NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1) ) ; Once you click Build (compile udf library) look at console panel in Fluent, you will see information about errors Best regards |
|
January 7, 2018, 22:39 |
|
#3 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
Sir, compiling error not coming
|
|
January 7, 2018, 22:40 |
|
#4 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
After run simulation only error occuring
|
|
January 7, 2018, 22:41 |
|
#5 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
If I change ZONE ID TO boundry face running
|
|
January 7, 2018, 22:41 |
|
#6 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
Here problem is interior face
|
|
January 8, 2018, 02:56 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Fluent gave me this output, when I've tried to compile your code:
Code:
..\..\src\new_test1.c(20) : error C2065: 'begin_c_loop' : undeclared identifier ..\..\src\new_test1.c(20) : error C2143: syntax error : missing ';' before '{' ..\..\src\new_test1.c(23) : fatal error C1057: unexpected end of file in macro expansion why do you use 2 as thread, but in you picture interior has ID=6? Code:
t= Lookup_Thread(d, 2); So try to find NV_MAG macros, and apply it to your problem, Best regards |
|
January 8, 2018, 13:29 |
|
#8 |
New Member
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9 |
Dear Mr. AlexanderZ
#include "udf.h" #include "mem.h" DEFINE_EXECUTE_AT_END(Velocity) { Domain *d; face_t f; cell_t c0, c1 = -1; Thread *t, *t0, *t1 = NULL; real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; c0 = F_C0(f,t); t0 = F_C0_THREAD(f,t); F_AREA(A, f, t); d = Get_Domain(1); t= Lookup_Thread(d, 6); begin_f_loop(f,t) { c1 = F_C1(f,t); /* Get cell on other side of face */ t1 = F_C1_THREAD(f,t); NV_MAG(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0)); NV_MAG(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1)); } end_f_loop (f, t) } Whatever u telling is correct. I want magnitude of velocity at interior face(nozzle exit). Compiling and Error msg is attached Please send any simple example to calculate the magnitude of velocity at the interior face. Thanks for fast reply |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difficulty with UDF code for HEAT FLUX | etudiant_IITB | Fluent UDF and Scheme Programming | 1 | December 7, 2015 09:07 |
Having trouble adapting serial UDF to work in parallel | muyuntao | Fluent UDF and Scheme Programming | 1 | November 10, 2015 14:42 |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
something wrong when compiling udf, however the code is correct when interpreting | richard ben | Fluent UDF and Scheme Programming | 7 | May 11, 2013 08:36 |
compressible flow in a counterflow nozzle | d.vamsidhar | FLUENT | 0 | November 24, 2005 02:45 |