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

Error in Loop???

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By vinerm
  • 1 Post By duri

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 29, 2020, 11:59
Default Error in Loop???
  #1
Member
 
j
Join Date: Apr 2020
Posts: 34
Rep Power: 0
buckngnr11 is on a distinguished road
I've been troubleshooting this final section of my UDF and I can't find the issue. When I run it, the simulation cuts out. I commented out the part I suspected would be the issue, but it still cuts out. So the if loop isn't the issue. I tried to display NodeArray[j] in a Message but this fails. Above, outside of the loop, however, I can display any index of NodeArray without issue. In the code attached I display the first value NodeArray[0], but I tried several values including the last value and they all display as expected. I've formatted nested for loops this way in other codes and haven't had any problems, but maybe this is the problem? It seems like the j loop has an issue but i loop if isolated works fine.
Attached Images
File Type: png Screen Shot 2020-04-29 at 11.54.31 AM.png (75.2 KB, 10 views)
buckngnr11 is offline   Reply With Quote

Old   April 29, 2020, 12:24
Default Error
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
It could be because of type difference. vn is a pointer defined using Node *vn. I am not sure how NodeArray is defined but by the specifier you are using for printing, it appears to be an integer. So, you cannot directly equate those. You have to use address of the NodeArray to assign it in vn provided Node is also an int, which it is not. Node is most likely a structure or a link list but I am not sure; it could be an integer.

Your if condition also has a mistake; it should be == and not =.
buckngnr11 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 29, 2020, 16:09
Default
  #3
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
Instead of

Node *vn

use,

int vn;
buckngnr11 likes this.
duri 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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
[Gmsh] Extrude on gmsh Pedro Felix OpenFOAM Meshing & Mesh Conversion 0 October 30, 2019 12:33
Need help setting up chtMultiRegion OskarT OpenFOAM Pre-Processing 1 September 25, 2019 15:51
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 02:09
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


All times are GMT -4. The time now is 10:16.