|
[Sponsors] |
October 25, 2016, 02:07 |
problem with UDF compile
|
#1 |
New Member
Tamilnadu
Join Date: Oct 2016
Posts: 7
Rep Power: 10 |
Hello everyone,
I'm trying to compile UDF in the fluent but at the time of compiling it is showing the following error to each UDF at assigning the function everytime. UDF 1 for n = no * exp(-(R*T/(Alpha+(beta*T))^2)*ln(p_o/p)^2) #include "udf.h" DEFINE_ADJUST(ads,domain) { Thread *t; real E,A,P; cell_t c; thread_loop_c (t,domain) { begin_c_loop (c,t) { real tem = C_T(c,t); P=C_P(c,t)+RP_Get_Real("operating-pressure"); E=3080+18.9*tem; A=8.314*tem*log(1.47E9/P); C_UDSI(c, t, ads) = 71.6*(exp(-((A*A) / (E*E)))); error is in this line } end_c_loop (c,t) } } error in compiling this file is error C2296: '*' : illegal, left operand has type 'void (*)(Domain *)' Can anyone please help me with this? |
|
October 25, 2016, 06:39 |
|
#2 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
have you defined the UDS? If yes, try to assign this value in DEFINE_EXECUTE_AT_END and see if it works.
|
|
October 25, 2016, 08:46 |
|
#3 |
New Member
Tamilnadu
Join Date: Oct 2016
Posts: 7
Rep Power: 10 |
i don't understand the defining UDS here,
ads is the function name i'm using to define 'n' and in C_UDSI macro im assigning it. And how to assign the value in DEFINE_EXECUTE_AT_END ? Thank you. |
|
October 25, 2016, 09:36 |
|
#4 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
All the information I am writing is in the manual... |
||
October 26, 2016, 01:22 |
|
#5 |
New Member
Tamilnadu
Join Date: Oct 2016
Posts: 7
Rep Power: 10 |
This is the complete UDF i'm doing for mass source term
it is (mass source term) Sm = X* d(n,t) the first code i posted for n only in this udf i'm adding to it calls the n every calculating Sm here #include "udf.h" DEFINE_ADJUST(ads,domain) { Thread *t; real E,A,P,ads; cell_t c; thread_loop_c (t,domain) { begin_c_loop (c,t) { real tem = C_T(c,t); P=C_P(c,t)+RP_Get_Real("operating-pressure"); E=3080+18.9*tem; A=8.314*tem*log(1.47E9/P); C_UDSI(c, t, ads) = 71.6*(exp(-((A*A) / (E*E)))); "error C2296 in this line" } end_c_loop (c,t) } } DEFINE_ADJUST(q_ads,domain) { Thread *t; cell_t c; real dt,q_ads; thread_loop_c(t,domain) begin_c_loop (c,t) { dt=RP_Get_Real("physical-time-step"); C_UDSI(c,t,q_ads)=C_UDSI_M1(c,t,q_ads)+0.15*dt*(C_ UDSI_M1(c,t,ads)-C_UDSI_M1(c,t,q_ads)); "error C2296 in this line" } end_c_loop(c,t) } DEFINE_ADJUST(d_ads, domain) { Thread *t; cell_t c; real d_ads; thread_loop_c(t, domain) { begin_c_loop(c, t) { C_UDSI(c, t, d_ads) = -0.532224*0.15*(C_UDSI(c, t, ads) - C_UDSI(c, t, q_ads)); "error C2296 in this line" } end_c_loop(c, t) } } DEFINE_SOURCE(m_src,c,t,dS,eqn) { dS[eqn]=0.0; return C_UDSI_M1(c, t, d_ads); "error C2296 in this line" } error in compiling this file is error C2296: '*' : illegal, left operand has type 'void (*)(Domain *)' this is coming in each time assigning functions. Can you please check this once ? |
|
October 26, 2016, 05:39 |
|
#6 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
add this at the begging of you code enum /* UDSs */ { ads, q_ads, NUM_UDS }; |
||
October 26, 2016, 05:42 |
|
#7 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
#include "udf.h"
enum { ads, q_ads, d_ads, }; DEFINE_ADJUST(define_ads,domain) { Thread *t; real E,A,P; cell_t c; real tem; thread_loop_c(t,domain) { begin_c_loop(c,t) { tem = C_T(c,t); P=C_P(c,t)+RP_Get_Real("operating-pressure"); E=3080.0+18.9*tem; A=8.314*tem*log(1.47e9/P); C_UDSI(c,t,0) = 71.6*(exp(-((A*A) / (E*E)))); } end_c_loop(c,t) } } DEFINE_ADJUST(define_q_ads,domain) { Thread *t; cell_t c; real dt; thread_loop_c(t,domain) { begin_c_loop(c,t) { dt=RP_Get_Real("physical-time-step"); C_UDSI(c,t,q_ads)=C_UDSI_M1(c,t,q_ads)+0.15*dt*(C_ UDSI_M1(c,t,ads)-C_UDSI_M1(c,t,q_ads)); } end_c_loop(c,t) } } DEFINE_ADJUST(define_d_ads, domain) { Thread *t; cell_t c; thread_loop_c(t, domain) { begin_c_loop(c,t) { C_UDSI(c, t, d_ads) = -0.532224*0.15*(C_UDSI(c, t, ads) - C_UDSI(c, t, q_ads)); } end_c_loop(c,t) } } DEFINE_SOURCE(m_src,c,t,dS,eqn) { dS[eqn]=0.0; return C_UDSI_M1(c, t, d_ads); } Here is your code, it compiles now. You had many issues, for example ads, q_ads and d_ads must be integer numbers, not real numbers. Moreover, they cannot be at the same time the name of the macro itself (I have change the name of the macro "define_ads" and so on. Check the code, since I don't know what do you want to do and I might have made some modifications that don't work in your case. Regards |
|
November 3, 2016, 07:08 |
error received a fatal signal (Segmentation fault)
|
#8 |
New Member
Tamilnadu
Join Date: Oct 2016
Posts: 7
Rep Power: 10 |
Thank you for the reply now my UDF is compiling but while intializing the model showing below error
" received a fatal signal (Segmentation fault)" Can you please help me with this what might be the problem ? |
|
November 3, 2016, 08:19 |
|
#9 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
You can add messages to your code, so you will be able to see where it stops. use something like Message("1"); . YOUR CODE . Message("2"); |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent 6.3.26 on Linux does not compile an UDF | Entwistle | Fluent UDF and Scheme Programming | 1 | March 4, 2014 15:49 |
Mesh UDF problem | kornetka | Fluent UDF and Scheme Programming | 4 | July 25, 2013 07:54 |
compile a udf or interpret it? | ndabir | Fluent UDF and Scheme Programming | 1 | July 14, 2012 03:49 |
Help! Compiled UDF problem 4 Wave tank tutorial | Shane | FLUENT | 1 | September 3, 2010 03:32 |
udf compile in parallel system | tahereh | FLUENT | 1 | December 9, 2008 10:48 |