# defining UDS scalar

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

 February 12, 2002, 16:36 defining UDS scalar #1 sivakumar Guest   Posts: n/a hi all, can anyone please tell me if there is some other way(other than using enum) by which i can define the user defined scalar. i want to know this because if i define them as enumerated variables their range is that of integer values and hence my calculations are going crazy. any help will be greatly appreciated. thank you, sivakumar

 February 12, 2002, 20:42 Re: defining UDS scalar #2 Greg Perkins Guest   Posts: n/a What!!!!! Just use an integer to point to the index of the uds. Ie uds 0 is stored in C_UDSI(cell,thread,0). The kth one is stored in C_UDSI(cell,thread,k) where k is an integer. The actual value of C_UDSI will be a real - not an integer!!!!! Greg ps in the udf manual they use an enum definition to define the index - this is a programmers choice, but the actual indexes are just integers. In some of my code I use simple calcs on the index to determine the right location, ie C_UDSI(cell,thread,UDS_BASE_IDX+i) where UDS_BASE_IDX and i are integers etc.

 March 12, 2002, 08:42 Re: defining UDS scalar #4 Matthew Brannock Guest   Posts: n/a Hi Greg, Quite a good idea with respect to making the code easier to read. But what do you mean by saying that it can make things easier by being able to "change the location of the uds (each run-time) and not change your code at all"? By "location" I assume you mean the index number your scalar is assigned to. I understand that it would make it easier to swap around the index numbers between scalars, but why would you want to do this? The only case that I can think of is if you reduce the number of scalars by taking out index numbers that are mid-range. Also, how can you change the "location" at each run-time, wouldn't you have to recompile the UDF first? They might be silly questions but the reason I ask is that I want to take full advantage of this method. cheers, Matthew.

 March 12, 2002, 21:53 Re: defining UDS scalar #5 Greg Perkins Guest   Posts: n/a Hi Matthew, well, what I've done is to extend Fluent to handle a secondary phases with species, etc etc. In this case I read a text file which defines the phases and species in the model - in a sense it is like a secondary case file. Then using this file I allocate uds's to solve various eqns by using an index. Thus in the code I have something like, #define CELL_PHASE_SP(c,t,p,i) C_UDSI(c,t,Index[p][i]) thus the actual location of the ith species of the pth phase can change from run to run, and there's no need to recompile the udfs. My case, is ratehr extreme, since I'm adding substantial capabilities that extend Fluent quite a lot. One day I expect they will have some of these features - say in Fluent 6.5! But in some cases, I use hybrid models/methods which are required for my problem and won't be in any standard CFD code. Really, the only use for this is to make your code more modular, more readable and thus easier to maintain.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48 Peter023 FLUENT 7 April 7, 2014 02:02 jalarron Fluent UDF and Scheme Programming 0 June 23, 2010 04:58 Jun FLUENT 3 August 26, 2003 17:26 Matthew Brannock FLUENT 3 February 15, 2002 08:10

All times are GMT -4. The time now is 23:25.