CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF code for Interior Face (Missile Nozzle Exit)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2018, 17:09
Default UDF code for Interior Face (Missile Nozzle Exit)
  #1
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
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.
Attached Images
File Type: jpg silo.jpg (113.0 KB, 20 views)
Prabhumsrit is offline   Reply With Quote

Old   January 7, 2018, 22:36
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   January 7, 2018, 22:39
Default
  #3
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
Sir, compiling error not coming
Prabhumsrit is offline   Reply With Quote

Old   January 7, 2018, 22:40
Default
  #4
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
After run simulation only error occuring
Prabhumsrit is offline   Reply With Quote

Old   January 7, 2018, 22:41
Default
  #5
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
If I change ZONE ID TO boundry face running
Prabhumsrit is offline   Reply With Quote

Old   January 7, 2018, 22:41
Default
  #6
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
Here problem is interior face
Prabhumsrit is offline   Reply With Quote

Old   January 8, 2018, 02:56
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
there are a lot of problems...

why do you use 2 as thread, but in you picture interior has ID=6?
Code:
t= Lookup_Thread(d, 2);
As I understand you need only velocity magnitude, so you do not need any vector operations.

So try to find NV_MAG macros, and apply it to your problem,
Best regards
AlexanderZ is offline   Reply With Quote

Old   January 8, 2018, 13:29
Default
  #8
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 9
Prabhumsrit is on a distinguished road
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
Attached Images
File Type: jpg compilemsg.jpg (125.9 KB, 10 views)
File Type: jpg Error msg.jpg (125.9 KB, 9 views)
Prabhumsrit is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 17:07.