|
[Sponsors] |
April 29, 2020, 11:59 |
Error in Loop???
|
#1 |
Member
j
Join Date: Apr 2020
Posts: 34
Rep Power: 0 |
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.
|
|
April 29, 2020, 12:24 |
Error
|
#2 |
Senior Member
|
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 =.
__________________
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. |
|
April 29, 2020, 16:09 |
|
#3 |
Senior Member
duri
Join Date: May 2010
Posts: 245
Rep Power: 16 |
Instead of
Node *vn use, int vn; |
|
|
|
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 |