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

Auto-compile error

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2017, 08:56
Question Auto-compile error
  #1
Member
 
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 13
twcp0104 is on a distinguished road
Hi everybody,

So I have this annoying error that pops up every day:

when I save a case with a UDF library attached to it and then go to reopen it, fluent tries to do this auto-compile thing. It would be very useful, but it keeps throwing segmentation errors that don't happen when I compile the normal way. Specifically these segmentation errors happen when I use F_AREA or F_CENTROID in the DEFINE_ON_LOAD macro. From that I imagine that fluent hasn't fully loaded the mesh from the saved case yet, but I could be wrong.

Anybody has an idea of how to fix this?

I can give more information including the code. I'm using ANSYS Fluent 16.0 with Visual Studio 13 for compiling.
twcp0104 is offline   Reply With Quote

Old   January 24, 2017, 03:32
Default
  #2
Member
 
KirMaks
Join Date: Aug 2016
Posts: 34
Rep Power: 9
kirmaks is on a distinguished road
Hallo,

it may happen if Your UDF is using some data which is generated during the solver run like gradients of the variables. You may check Your code and comment out such places and see if UDF is loaded without errors afterwards. Then You may try to check if the data are present with constructions similar to
Code:
if (NULL != THREAD_STORAGE(t,SV_U_G) )
in Your UDF. Best regards Maksim
kirmaks is offline   Reply With Quote

Old   January 24, 2017, 06:45
Default
  #3
Member
 
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 13
twcp0104 is on a distinguished road
Quote:
Originally Posted by kirmaks View Post
Hallo,

it may happen if Your UDF is using some data which is generated during the solver run like gradients of the variables. You may check Your code and comment out such places and see if UDF is loaded without errors afterwards. Then You may try to check if the data are present with constructions similar to
Code:
if (NULL != THREAD_STORAGE(t,SV_U_G) )
in Your UDF. Best regards Maksim
Thanks for the reply.

So, yes, I've been doing that. The code seems to reject the F_AREA, F_CENTROID, THREAD_ID macros present on the EXECUTE_ON_LOADING macro, which led me to believe that the mesh was not available during loading. Is that true?
twcp0104 is offline   Reply With Quote

Old   January 25, 2017, 03:31
Default
  #4
Member
 
KirMaks
Join Date: Aug 2016
Posts: 34
Rep Power: 9
kirmaks is on a distinguished road
Hallo,

You may try to replace EXECUTE_ON_LOADING with EXECUTE_ON_DEMAND and call the second macro before starting the iterations. Then You will be sure that the mesh and data are loaded.

Regards, Maksim
kirmaks is offline   Reply With Quote

Old   January 25, 2017, 14:44
Default
  #5
Member
 
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 13
twcp0104 is on a distinguished road
Quote:
Originally Posted by kirmaks View Post
Hallo,

You may try to replace EXECUTE_ON_LOADING with EXECUTE_ON_DEMAND and call the second macro before starting the iterations. Then You will be sure that the mesh and data are loaded.

Regards, Maksim
Hi, thanks for the reply.

So... yeah... what I have been doing (to preserve my sanity) is including everything that was in the EXECUTE_ON_LOADING in the DEFINE_INIT so that it would load after the mesh was loaded. I'd still really like to have it in the EXECUTE_LOADING macro though, but what are you gonna do.

I am right in thinking that that the loading phase for the EXECUTE_ON_LOADING happens before the mesh is loaded? because that doesn't seem to make sense to me
twcp0104 is offline   Reply With Quote

Old   February 2, 2017, 14:50
Default
  #6
Member
 
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 13
twcp0104 is on a distinguished road
Just to close the thread: the conclusion was that when using the DEFINE_ON_LOADING macro, you dont always have access to the macros that access the mesh variables like F_AREA and F_CENTROID. long story short, if you use these macros and fluent tries to auto-compile, you'll get a segmentation fault.

The solution was to move the problematic code to the DEFINE_INIT macro. The initialization is run after the mesh has been loaded and I haven't had a problem since.
twcp0104 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
DPM udf error haghshenasfard FLUENT 0 April 13, 2016 07:35
error compiling modified applications yvyan OpenFOAM Programming & Development 21 March 1, 2016 05:53
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
[swak4Foam] groovyBC: problems compiling: "flex: not found" and "undefined reference to ..." sega OpenFOAM Community Contributions 12 February 17, 2010 10:30
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23


All times are GMT -4. The time now is 00:08.