|
[Sponsors] |
May 24, 2005, 11:18 |
user-defined memory
|
#1 |
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 |
|
May 24, 2005, 11:33 |
Re: user-defined memory
|
#2 |
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.
|
|
May 24, 2005, 11:44 |
Re: user-defined memory
|
#3 |
Guest
Posts: n/a
|
Use a global variable. Luca
|
|
May 24, 2005, 11:54 |
Re: user-defined memory
|
#4 |
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 |
|
May 24, 2005, 11:54 |
Re: user-defined memory
|
#5 |
Guest
Posts: n/a
|
Alec
Thanks for the suggestion, but I would like to reduce the looping if at all possible. Mark |
|
May 24, 2005, 11:58 |
Re: user-defined memory
|
#6 |
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
|
|
May 24, 2005, 12:40 |
Re: user-defined memory
|
#7 |
Guest
Posts: n/a
|
Hi Luca,
Do you also declare that variable as "extern" inside the function? Mark |
|
May 24, 2005, 12:43 |
Re: user-defined memory
|
#8 |
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? |
|
June 8, 2005, 01:17 |
Re: user-defined memory
|
#9 |
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.
|
|
February 10, 2020, 10:04 |
|
#10 | |
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 13 |
Quote:
something like this: Code:
// Include Necessary Libraries // #include "udf.h" // Global Variables int counter; // Initialization Function DEFINE_INIT(initialization,d) { } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble setting user scalar and user memory names | tstorm | FLUENT | 6 | November 23, 2022 03:58 |
How can I allocate user defined memory? | MASOUD | Fluent UDF and Scheme Programming | 1 | November 20, 2014 02:12 |
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 |