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

error C2063: 'PMV' : not a function

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 4, 2018, 16:45
Default error C2063: 'PMV' : not a function
  #1
New Member
 
Ahmed Hassan
Join Date: Nov 2017
Posts: 10
Rep Power: 9
Ahmed Hassan is on a distinguished road
Hello everyone,
I'm trying to write a UDF for a thermal comfort index called PMV (predicted mean vote) but i'm getting this error when compiling in fluent:
line 95.. error C2063: 'PMV' : not a function
what could be the problem here ?
Thank you in advance

this is my code:

#include "udf.h"
DEFINE_ADJUST(pd_myudf,d)
{
Thread *t;
cell_t c;
real t_myudf = C_T(c,t)-273.15;
real speed_u_myudf = C_U(c,t);
real speed_v_myudf = C_V(c,t);
real speed_w_myudf = C_W(c,t);
real turbu_k = C_K(c,t);
real mh2o_myudf = C_YI(c,t,1); /*mass friction of h2o 1????*/
real clo = 0.55;
real icl_myudf = 0.155*clo; /*clothing insulation*/
real tr_myudf = t_myudf;
real M_myudf = 58.0; /*metabolism, w/m2*/
real W_myudf = 0.0;
real p_myudf = 101325.0;
real turbu_tu;
real speed_myudf;
real pa_myudf;
real speedv;
real speedw;
real speedu;
real fcl_myudf;
real tcl1_myudf;
real tcl_myudf;
real tcl2_myudf;
real hc_myudf;
real temperary1_myudf;
real temperary2_myudf;
real a_myudf;
real b_myudf;
real c_myudf;
real d_myudf;
real e_myudf;
real f_myudf;
real L_myudf;
real ppd_myudf;
real pmv_myudf;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{

/*calculate pa_myudf*/
speedu = speed_u_myudf;
speedv = speed_v_myudf;
speedw = speed_w_myudf;
speed_myudf = sqrt(pow((speedu),2.0)+pow((speedv),2.0)+pow((spee dw),2.0)); /*magnitude of speed*/
if (speed_myudf<0.05) {speed_myudf=0.05;} /*for speed<0.05,use speed=0.05*/
turbu_tu = 100.0*(turbu_k)/(speed_myudf);
pa_myudf = (29.0*mh2o_myudf)/((18.0+(11.0*mh2o_myudf))*p_myudf);


/*Calculate fcl*/
{
if (icl_myudf<0.078)
{fcl_myudf = 1.0+(1.29*icl_myudf);}
else
{fcl_myudf = 1.05+0.645*icl_myudf;}
}

/*iterate to calculate tcl*/

tcl1_myudf = 40.0;
tcl2_myudf = 35.7-(0.028*(M_myudf-W_myudf))-(icl_myudf*(0.0000000396*fcl_myudf*(pow((tcl1_myud f+273.0),4.0)-pow((tr_myudf+273.0),4.0))))+(fcl_myudf*hc_myudf*( tcl1_myudf-t_myudf));
{
if (tcl1_myudf-tcl2_myudf>0.000001)
{tcl1_myudf=tcl2_myudf;}
}
tcl_myudf=tcl2_myudf;

/*Calculate hc*/
temperary1_myudf = 2.38*pow((tcl1_myudf-t_myudf),0.25);
temperary2_myudf = 12.1*pow((speed_myudf),0.5);
{
if (temperary1_myudf<temperary2_myudf)
{hc_myudf=temperary2_myudf;}
else
{hc_myudf=temperary1_myudf;}
}


/*for a shorter formula of L_myudf*/
a_myudf = 0.0000000396*fcl_myudf*(pow((tcl1_myudf+273.0),4.0 )-pow((tr_myudf+273.0),4.0));
b_myudf = fcl_myudf*hc_myudf*(tcl_myudf-t_myudf);
c_myudf = 0.00305*(5733.0-(6.99*(M_myudf-W_myudf))-pa_myudf);
d_myudf = 0.42*(M_myudf-W_myudf-58.15);
e_myudf = 0.000017*M_myudf*(5867.0-pa_myudf);
f_myudf = 0.0014*M_myudf*(34.0-t_myudf);
L_myudf = (M_myudf-W_myudf)-(a_myudf+b_myudf+c_myudf+d_myudf+e_myudf+f_myudf);


/*Calculate pmv_myudf*/
pmv_myudf(c,t)=((0.303*(exp(-0.036*M_myudf)))+0.028)*L_myudf;


/*Calculate ppd_myudf*/
ppd_myudf(c,t)=100.0-(95.0*exp(-0.03353*pow((pmv_myudf(c,t)),4.0)-0.2179*pow((pmv_myudf(c,t)),2.0)));
}
end_c_loop(c,t)
}
}
Ahmed Hassan is offline   Reply With Quote

Old   August 7, 2018, 03:55
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Line 95 is:
Code:
pmv_myudf(c,t)=((0.303*(exp(-0.036*M_myudf)))+0.028)*L_myudf;
Earlier, you defined pmv_myudf as
Code:
real pmv_myudf;
That means that pmv_myudf contains a single number.
But in line 95, you suddenly treat pmv_myudf as something that depends on c and t...


You can fix that by writing
Code:
pmv_myudf=((0.303*...

But you have another problem: your UDF does not do anything. It calculates a lot, but it does not do anything with the results of this calculation...
I can only guess what you need, but my guess would be that you want to store the PMV in something that you can access in Fluent. The correct location would be a User Defined Memory (UDM).


Make sure to add one UDM in Fluent, and then in your code make it

Code:
UDM(c,t,0)=((0.303*...

By the way: you have the same problem for PPD.
So, add another UDM, and in your code use
Code:
UDM(c,t,1)=100.0-(95*...

Then, after running this UDF, you can plot these variables in Fluent just as you would plot the temperature or velocity.
pakk is offline   Reply With Quote

Old   August 8, 2018, 22:08
Default
  #3
New Member
 
Ahmed Hassan
Join Date: Nov 2017
Posts: 10
Rep Power: 9
Ahmed Hassan is on a distinguished road
Thank you very much for your time and well explained answer ...
your guess about storing the PMV and accessing it in cfd post is right.
The first thing i did was to set the number of user defined memory locations to 2....

After following your advice the error was gone, but i got this warning:
(6) : warning C4700: uninitialized local variable 't' used
(6) : warning C4700: uninitialized local variable 'c' used

i moved all my defined variables inside the loop, and the file compiled successfully.....After that i opened the Function Hooks and added my UDF in the adjust panel...
Now the case is initialized successfully, but when i run it i get the following error:

Node 0: process 5628: Received signal SIGSEGV
======================================
Node 1: process 6940: Received signal SIGSEGV
======================================
Node 2: process 7560: Received signal SIGSEGV
======================================
Node 3: process 7836: Received signal SIGSEGV
======================================
MPI application rank 0 exited before MPI_finalize() with status 2

i searched the forum for any helpful answer but without success, your help will be much appreciated.... Thanks in advance

this is my final UDF:

#include "udf.h"
DEFINE_ADJUST(pd_myudf,d)
{
Thread *t;
cell_t c;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{

real t_myudf = C_T(c,t)-273.15;
real speed_u_myudf = C_U(c,t);
real speed_v_myudf = C_V(c,t);
real speed_w_myudf = C_W(c,t);
real turbu_k = C_K(c,t);
real mh2o_myudf = C_YI(c,t,1); /*mass friction of h2o 1????*/
real clo = 0.55;
real icl_myudf = 0.155*clo; /*clothing insulation*/
real tr_myudf = t_myudf;
real M_myudf = 58;
/*metabolism, w/m2*/
real W_myudf = 0;
real p_myudf = 101325;
real turbu_tu;
real speed_myudf;
real pa_myudf;
real speedv;
real speedw;
real speedu;
real fcl_myudf;
real tcl1_myudf;

real tcl_myudf;
real tcl2_myudf;
real hm_myudf;
real temperary1_myudf;
real temperary2_myudf;
real a_myudf;
real b_myudf;
real c_myudf;
real d_myudf;
real e_myudf;

real f_myudf;
real L_myudf;
real ppd_myudf;
real pmv_myudf;
/*calculate pa_myudf*/
speedu = speed_u_myudf;
speedv = speed_v_myudf;
speedw = speed_w_myudf;
speed_myudf = sqrt(pow((speedu),2)+pow((speedv),2)+pow((speedw), 2)); /*magnitude of speed*/

if (speed_myudf<0.05) {speed_myudf=0.05;} /*for speed<0.05,use speed=0.05*/
turbu_tu = 100*(turbu_k)/(speed_myudf);
pa_myudf = (29*mh2o_myudf)/((18+(11*mh2o_myudf))*p_myudf);
/*Calculate fcl*/
{
if (icl_myudf<0.078)
{fcl_myudf = 1+(1.29*icl_myudf);}
else
{fcl_myudf = 1.05+0.645*icl_myudf;}
}

/*iterate to calculate tcl*/
tcl1_myudf = 40;

/*Calculate hc*/
temperary1_myudf = 2.38*pow((tcl1_myudf-t_myudf),0.25);
temperary2_myudf = 12.1*pow((speed_myudf),0.5);
{
if (temperary1_myudf<temperary2_myudf)
{hm_myudf=temperary2_myudf;}
else
{hm_myudf=temperary1_myudf;}
}

tcl2_myudf = 35.7-(0.028*(M_myudf-W_myudf))-(icl_myudf*(0.0000000396*fcl_myudf*(pow((tcl1_myud f+273),4)-pow((tr_myudf+273),4))))+(fcl_myudf*hm_myudf*(tcl1 _myudf-t_myudf));
{
if (tcl1_myudf-tcl2_myudf>0.000001)
{tcl1_myudf=tcl2_myudf;}
}
tcl_myudf=tcl2_myudf;

/*for a shorter formula of L_myudf*/
a_myudf = 0.0000000396*fcl_myudf*(pow((tcl1_myudf+273),4)-pow((tr_myudf+273),4));

b_myudf = fcl_myudf*hm_myudf*(tcl_myudf-t_myudf);
c_myudf = 0.00305*(5733-(6.99*(M_myudf-W_myudf))-pa_myudf);
d_myudf = 0.42*(M_myudf-W_myudf-58.15);
e_myudf = 0.000017*M_myudf*(5867-pa_myudf);
f_myudf = 0.0014*M_myudf*(34-t_myudf);
L_myudf = (M_myudf-W_myudf)-(a_myudf+b_myudf+c_myudf+d_myudf+e_myudf+f_myudf);
{
/*Calculate pmv_myudf*/
pmv_myudf=((0.303*(exp(-0.036*M_myudf)))+0.028)*L_myudf;
C_UDMI(c,t,0) = pmv_myudf;

}
/*Calculate ppd_myudf*/
ppd_myudf=100-(95*exp(-0.03353*pow((C_UDMI(c,t,0)),4)-0.2179*pow((C_UDMI(c,t,0)),2)));
C_UDMI(c,t,1) = ppd_myudf;
}
end_c_loop(c,t)
}
}
Ahmed Hassan is offline   Reply With Quote

Old   February 7, 2019, 06:10
Default line 78: tcl1-myud: undeclared variable
  #4
New Member
 
hasna
Join Date: Feb 2019
Posts: 6
Rep Power: 7
hasnaabid is on a distinguished road
I want to thank you for sharing your thermal comfort program. In fact, trying to run this program I got an error message: 'line 78: tcl1-myud: undeclared variable'.
I would be grateful if you help me overcome this problem
hasnaabid is offline   Reply With Quote

Old   February 7, 2019, 07:10
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Check what line 78 in your code is...
pakk is offline   Reply With Quote

Old   February 7, 2019, 07:57
Default L78
  #6
New Member
 
hasna
Join Date: Feb 2019
Posts: 6
Rep Power: 7
hasnaabid is on a distinguished road
tcl2_myudf = 35.7-(0.028*(M_myudf-W_myudf))-(icl_myudf*(0.0000000396*fcl_myudf*(pow((tcl1_myud f+273),4)-pow((tr_myudf+273),4))))+(fcl_myudf*hm_myudf*(tcl1 _myudf-t_myudf));
hasnaabid is offline   Reply With Quote

Old   February 7, 2019, 09:26
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
And do you somewhere see the word "tcl1-myud"?
Once you found that, can you spot something wrong with it?
pakk is offline   Reply With Quote

Reply

Tags
c language, c2063, fluent, pmv, udf and programming


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
[mesh manipulation] RefineMesh Error and Foam warning jiahui_93 OpenFOAM Meshing & Mesh Conversion 4 March 3, 2018 12:32
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


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