Accessing solution data in UDF
In paragraph 5.1 of the UDF Manual you can read this sentence about accessing solution data in user defined function:
" For all types of data except specifc heat, the word "access" refers to reading and writing data. "
I attempted to modify the species mass fraction C_YI(c,t,i) in the DEFINE_ADJUST macro, but I received an error message (ACCESS VIOLATION).
Is it really possible to modify such variable (and so I must look for a mistake in my code)? Have I misunderstood the Fluent Guide?
Thank you very much
Re: Accessing solution data in UDF
It doesn't normally make sense to modify C_YI(or any solved for variable) in your udfs. The reason for this is that Fluent solves for C_YI as part of the solution method.
If you want to force the solution of C_YI to be a specific value in a specific cell then you can write a udf source function to accomplish this. This will then ensure the "solution" provided by Fluent is consistent with your inputs. Otherwise Fluent will just overwrite any changes you make in C_YI.
To fix Y for species-0 to say 0.5 write a source term like
dS[eqn] = -1.0e8;
return 1.0e8*(0.5 - C_YI(cell,thread,0); }
Also I recommend using the Fluent 6 udf manual in preference to the Fluent 5 one. The new one is much more detailed and up-to-date than the old one. And in fact, there are very few changes in the udfs in Fluent 6, so you can safely use the documentation of Fluent 6 in writing udfs for Fluent 5 (of course you can't use specific models etc which aren't in 5).
You may want to use Fluent 6 as well, but some people have reported some strange behaviours over 5 so its wise to check it out before moving across.
|All times are GMT -4. The time now is 11:56.|