CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > 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 Display Modes
Old   July 1, 2010, 14:27
Default reading "global" variables in a UDF macro?
  #1
New Member
 
Join Date: Jul 2010
Posts: 7
Rep Power: 7
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, 21:22
Default
  #2
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
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
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem converting fluent mesh vinz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 22 August 26, 2015 17:25
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 06:28
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 01:29
DEFINE_DPM_OUTPUT macro UDF HELP Puneet FLUENT 3 November 28, 2003 11:55


All times are GMT -4. The time now is 17:26.