CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

user-defined memory

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 24, 2005, 11:18
Default user-defined memory
  #1
Mark
Guest
 
Posts: n/a
Hi,

I am wondering if there is a way to pass a value of a variable from one routine to another. For example, I have a DEFINE_ON_DEMAND function that calculates a value for velocity. I want to pass this velocity to my DEFINE_PROFILE function. C_UDMI is a user-defined memory location for cells. Is there one for just a single value?

Thanks,

Mark
  Reply With Quote

Old   May 24, 2005, 11:33
Default Re: user-defined memory
  #2
Alec Eiffel
Guest
 
Posts: n/a
I dont know of any way other than UDM's to pass variables between macros. I suggest you put a thread loop in your DEFINE_ON_DEMAND macro and fills all cells in the domain with with the same velocity value in a UDM. Then when you access the UDM in DEFINE_PROFILE it doesnt matter which cell is accessed because they all have same value.
  Reply With Quote

Old   May 24, 2005, 11:44
Default Re: user-defined memory
  #3
Luca
Guest
 
Posts: n/a
Use a global variable. Luca
  Reply With Quote

Old   May 24, 2005, 11:54
Default Re: user-defined memory
  #4
Mark
Guest
 
Posts: n/a
For clarity, I am using compiled udfs.

Luca,

I have tried this but cannot seem to get it to work. I am relatively new with C and am trying to figure out where I declare the variables as "extern". Is it in the routine I am working with it? just in the .c file? or in a .h file which I then include?

Also, when using external variables do all of the routines have to be in the same .c file?

Thanks, Mark
  Reply With Quote

Old   May 24, 2005, 11:54
Default Re: user-defined memory
  #5
Mark
Guest
 
Posts: n/a
Alec

Thanks for the suggestion, but I would like to reduce the looping if at all possible.

Mark
  Reply With Quote

Old   May 24, 2005, 11:58
Default Re: user-defined memory
  #6
Luca
Guest
 
Posts: n/a
I use a unique file, if you have more than 1 file you should pay attention. I declare a variable outside an EXECUTE_ON_DEMAND or DEFINE_PROFILE funtion. This way I can modifiy its value outside the function. I hope to be clear. Luca
  Reply With Quote

Old   May 24, 2005, 12:40
Default Re: user-defined memory
  #7
Mark
Guest
 
Posts: n/a
Hi Luca,

Do you also declare that variable as "extern" inside the function?

Mark
  Reply With Quote

Old   May 24, 2005, 12:43
Default Re: user-defined memory
  #8
pUl|
Guest
 
Posts: n/a
Luca, is it possible to initialize UDM-0 with specified x and y values?

For instance, lets say we have a pipe and I know the experimental values of velocities at certain points in the radial direction. However, I do not wish to use these values in my CFD simulation. Instead, I wish to use these values later in one of my custom field functions that calculates say the sum of squared errors between the simulated and experimental velocities.

So how can I store user-specified values in a UDM for later postprocessing?
  Reply With Quote

Old   June 8, 2005, 01:17
Default Re: user-defined memory
  #9
Mahesh
Guest
 
Posts: n/a
I think u can use the UDM defined in 'on-demand' UDF to 'profile' udf. For post-processing, u can define another UDM with expt. values or define custom field function.
  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
How can I allocate user defined memory? MASOUD Fluent UDF and Scheme Programming 1 November 20, 2014 03:12
Trouble setting user scalar and user memory names tstorm FLUENT 5 April 19, 2013 01:45
user defined sourcen term xck1986 CFX 1 July 8, 2010 08:35
user defined turbulence model manuutin STAR-CD 5 October 14, 2009 05:29
Gradient of a User defined Variable Ramadas CFX 2 August 21, 2007 09:19


All times are GMT -4. The time now is 03:15.