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

Strange error in UDF compiling (version:19R3+VS2015)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2019, 10:40
Post Strange error in UDF compiling (version:19R3+VS2015)
  #1
New Member
 
You Wu
Join Date: Nov 2018
Posts: 16
Rep Power: 7
Youwu is on a distinguished road
Hi,
I'm using ANSYS fluent19R3 + vs2015, and when i try to build my UDF, i received such an error:
...\...\src\myudf.c(424) : error C2143: syntax error : missing ') 'before 'const'
...\...\src\myudf.c(424) : error C2059: syntax error : ') '
here I post my code around line 424:
begin_f_loop(f,tf)
{
f_node_loop(f,tf,n)
{
v=F_NODE(f,tf,n);/*this is line 424*/
if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
NODE_Z(v)=NODE_Z(v)+disfn[kk];

}
kk=kk+1;
}
}
The same thing happens in ANSYS fluent 17.2
But the strangest thing is when i build and load myudf in ANSYS fluent 17.0 + VS2010 it works well. i can see the boundary motion in the animation and no error appears.
I double checked my udf and make sure it's caused by spelling problems, Can anyone help me out?Thank you.
Youwu is offline   Reply With Quote

Old   October 23, 2019, 21:22
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
Is v defined well?
actually no idea, cause the code is not full. I cant check it on my computer

best regards
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 23, 2019, 22:50
Default
  #3
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,673
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
1) It is a compiler error
2) it's probably related to a missing library


Quote:
Originally Posted by Youwu View Post
But the strangest thing is when i build and load myudf in ANSYS fluent 17.0 + VS2010 it works well.

You are running Fluent v17 w/ VS2010 on the same machine or a different machine? Make sure you have the same libraries on all machines. Installing a VS3000 does not mean that you do not need to install the older libraries.
LuckyTran is offline   Reply With Quote

Old   October 23, 2019, 23:21
Default
  #4
New Member
 
You Wu
Join Date: Nov 2018
Posts: 16
Rep Power: 7
Youwu is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
Is v defined well?
actually no idea, cause the code is not full. I cant check it on my computer

best regards
Thank you for your reply. Yes, all definitions are correct, like Node *v here. Actually myudf works well on the old version fluent and VS, so I thought there might be some differences between different versions that caused my problems. The full code is just too long, I will attach a file if necessary.
Youwu is offline   Reply With Quote

Old   October 23, 2019, 23:27
Default
  #5
New Member
 
You Wu
Join Date: Nov 2018
Posts: 16
Rep Power: 7
Youwu is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
1) It is a compiler error
2) it's probably related to a missing library





You are running Fluent v17 w/ VS2010 on the same machine or a different machine? Make sure you have the same libraries on all machines. Installing a VS3000 does not mean that you do not need to install the older libraries.
Thank you for your advice. Fluent17/17.2/19R3 are not in the same machine so I’m building my UDF on 3 different machines. I’ll check out my vs libraries, or maybe I should reinstall vs
Youwu is offline   Reply With Quote

Old   October 28, 2019, 09:28
Default
  #6
New Member
 
You Wu
Join Date: Nov 2018
Posts: 16
Rep Power: 7
Youwu is on a distinguished road
Hi,
Finally, my friend and I worked out a solution.
As you can see, there is an array named disfn[] in the loop. I defined this array at the beginning of the code but I didn't post it. But after debugging, we found that there was a problem with the way we defined disfn[].

I first defined the disfn[] as follows:
#define n 100
real disfn[n];
This way of declaration is correct in C, and also acceptable for fluent version 17.0. However, in fluent 19R3, this declaration will cause an error in F_NODE (I don't know why). so I have to change it into:
real disfn[100];
then error C2143 is fixed.
Although the problem has been solved. But I still don't know why the previous declaration can't be used in the new fluent. Maybe some macros are different between versions.
I hope it can help somebody else. Use "#define" carefully.
Youwu is offline   Reply With Quote

Reply

Tags
fluent - udf


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
UDF compiling error Weiqiang Liu Fluent UDF and Scheme Programming 3 March 3, 2019 20:28
Strange error building UDF rik Fluent UDF and Scheme Programming 4 December 5, 2018 08:35
UDF compiling error Weiqiang Liu FLUENT 2 November 21, 2018 09:36
UDF Compiling / Parallel mode MV78 Fluent UDF and Scheme Programming 6 May 29, 2018 05:02
ERROR in compiling UDF stefanos Fluent UDF and Scheme Programming 1 April 25, 2012 07:37


All times are GMT -4. The time now is 21:30.