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

reading "global" variables in a UDF macro?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2010, 15:27
Default reading "global" variables in a UDF macro?
  #1
New Member
 
Join Date: Jul 2010
Posts: 8
Rep Power: 16
bawfuls is on a distinguished road
I'm not sure if what I want to do is possible. I'm using the DEFINE_SOURCE macro, and I'd like to read source terms from a pre-existing data file. I understand I could use DEFINE_RW_FILE to read the entire file into an array, and search the array for the term I need. However, this would be reading in the file to a large array every time the UDF gets called (i.e. for every cell in the mesh) and feels like an inefficient programing method. What I'd rather do is have fluent read in the data file to an array once, and then have the DEFINE_SOURCE macro search that array for the proper value each time it's called.

Is there any way to do this?
bawfuls is offline   Reply With Quote

Old   July 1, 2010, 22:22
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by bawfuls View Post
I'm not sure if what I want to do is possible. I'm using the DEFINE_SOURCE macro, and I'd like to read source terms from a pre-existing data file. I understand I could use DEFINE_RW_FILE to read the entire file into an array, and search the array for the term I need. However, this would be reading in the file to a large array every time the UDF gets called (i.e. for every cell in the mesh) and feels like an inefficient programing method. What I'd rather do is have fluent read in the data file to an array once, and then have the DEFINE_SOURCE macro search that array for the proper value each time it's called.

Is there any way to do this?
Use UDM, and read the array into UDM when loading the library. DEFINE_EXECUTE_ON_LOADING
gearboy 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
[Commercial meshers] Problem converting fluent mesh vinz OpenFOAM Meshing & Mesh Conversion 28 October 12, 2015 07:37
UDF to record FLUENT solver variables... mariachi FLUENT 1 February 3, 2010 23:18
problem when converting mesh (made by ICEM) using fluentMeshToFoam Forrest_Lei OpenFOAM 11 October 16, 2009 07:28
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 02:29
DEFINE_DPM_OUTPUT macro UDF HELP Puneet FLUENT 3 November 28, 2003 11:55


All times are GMT -4. The time now is 09:56.