|
[Sponsors] |
udf to access variables from a different case |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 12, 2011, 05:01 |
udf to access variables from a different case
|
#1 |
New Member
Join Date: Jun 2011
Posts: 18
Rep Power: 15 |
Hi all,
I would like to save some variables (for each cell) from one case and use those variables (as materials properties, for each cell) into another case. I am using the same mesh in both cases. Any hints on how to write a UDF for that? Cheers, Yashmash |
|
October 12, 2011, 09:01 |
|
#2 | |
Senior Member
|
Quote:
I know a procedure for your purpose but I don't know it's the best or not. You can do that by interpolating your desired data in (file->interpolate) and then read that in a new case in a same manner; but as you can see, you're permitted to interpolate special variables for which conservation equation has been solved; so there's a trick with a temporary UDS! First store your desired data in a UDS and ensure you've deactivated this scalar equation in (solve->control->solution), then you can interpolate this type of data. Bests,
__________________
Amir |
||
October 14, 2011, 04:08 |
|
#3 |
New Member
Join Date: Jun 2011
Posts: 18
Rep Power: 15 |
Hello Amir,
Thanks for your help. I have used your method successfully, however, I was hoping you could help me on another issue. Now that I have my uds in my other case, I want to use that variable in the calculation of my material property (material absorption coefficient in that case). I have written a UDF as follows: DEFINE_PROPERTY(abs_coeff,cell,thread) { Thread *t; cell_t c; real value = 0; real abs_coeff = 0; Domain *d; d = Get_Domain(1); /* Calculating the scattering coefficient */ thread_loop_c(t,d) { begin_c_loop(c,t) { value = C_UDSI(c,t,0); } end_c_loop(c,t) } abs_coeff = 4.22*value; return abs_coeff; } I have turned off the uds solver and am NOT re-initializing (since that would make my uds values equal to zero). But the values of absorption coefficient that is returned by fluent are not what I am expecting (they are constant throughout my domain, which shouldnt be the case since the values of my uds are not constant). Are the steps that I'm following ok? Where am I going wrong? Thanks a lot, Yashmash |
|
October 14, 2011, 04:29 |
|
#4 | |
Senior Member
|
Hi,
Your UDF is not correct. Do not use any loop in that .... Quote:
__________________
Amir |
||
October 14, 2011, 04:59 |
|
#5 |
New Member
Join Date: Jun 2011
Posts: 18
Rep Power: 15 |
Sweet! It works now..
Your assistance was much appreciated Amir, enjoy your week end |
|
January 25, 2012, 03:41 |
|
#6 |
New Member
Join Date: Jun 2011
Posts: 18
Rep Power: 15 |
Hi Amir,
I was hoping you could help me with the following UDF. I am running atime dependent eulerian model with 3 phases. My udf is to store into a UDS the time-averaged volume fraction of one of the phases. However the values that are returned are the time-averaged volume fractions divided by a constant (constant is 74). Please see my UDF below: #include "udf.h" #define Rtio2 4260 DEFINE_ON_DEMAND(TiO2_loading_gm3) { Thread *thread_ti; Thread *t; Thread *mix_thread; cell_t c; real vof_ti = 0; Domain *d; d = Get_Domain(3); /* Loop over all cell threads in the domain */ thread_loop_c(thread_ti,d) { /*thread_ti = THREAD_SUB_THREAD(mix_thread, 3);*/ /* Loop over all cells */ begin_c_loop(c,thread_ti) { vof_ti = C_STORAGE_R(c,thread_ti,SV_VOF_MEAN); C_UDSI(c, thread_ti, 0) = vof_ti; } end_c_loop(c,thread_ti) } } Your assistance is much appreciated, Thanks, Yash |
|
January 25, 2012, 10:10 |
|
#7 |
Senior Member
|
Hi,
I'm not sure if I can help here because I don't know what the "C_STORAGE_R(c,thread_ti,SV_VOF_MEAN)" performs exactly. but it seems strange if you want the averaged field by using a DEFINE_ON_DEMAND macro! If I was you, with a simple DEFINE_ADJUST macro store the desired variable in a UDS and .... Bests,
__________________
Amir |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to record FLUENT Solver variables... | mariachi | Fluent UDF and Scheme Programming | 11 | September 24, 2019 01:07 |
UDF Data access problems | Mosheraa | FLUENT | 4 | June 17, 2011 14:16 |
UDF to record FLUENT solver variables... | mariachi | FLUENT | 1 | February 3, 2010 23:18 |
can't access face variables ... | bart weisser | FLUENT | 2 | September 28, 2007 15:09 |
Error (ACCESS VIOLATION) with UDF | Ale | FLUENT | 2 | May 28, 2002 03:50 |