|
[Sponsors] |
July 26, 2013, 06:41 |
UDF Help
|
#1 |
New Member
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 13 |
Hey all,
Im currently writing a UDF. I calculate the force in an UDF called DEFINE_CG_MOTION The question is how do i use this force to trigger the inflow in another UDF called DEFINE_PROFILE I would use If Force > number DEFINE_PROFILE = 5 Else DEFINE_PROFILE = 0 but im not sure how to recall the force, as i get the error message, Force is not defined Thanks |
|
July 28, 2013, 09:29 |
|
#2 |
Member
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 41
Rep Power: 14 |
You could do this a variety of ways I imagine.
First of all though, does your DEFINE_CG_MOTION only provide a single value for the entire domain every time it runs? I never used this macro before, but anyway, you should look into both F_UDMI or C_UDMI. For a DEFINE_PROFILE, the macro is passed the thread so you would loop through either the faces or the cells for the F_UDMI and C_UDMI respectively. Are you familiar with how User-Defined Memory works? I can continue on if this seems like the path you want to go down. I also use Scheme variables, but you may find it easier just to stick with the UDM. Please post back if you have questions or would like further explanation. |
|
July 28, 2013, 16:41 |
|
#3 |
New Member
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 13 |
my cg_motion sums up all the forces around the faces of a object everytime it runs.
This is what i understand of the macros u mentioned. i can use F_UMI in my DEFINE_CG_MOTION to store the forces calculated and use Execute_on_demand? to use it in Define_PROFILE? or do i use the same macro F_UMI to retrieve the data? I will give this a try tomorrow morning. Jess |
|
July 28, 2013, 20:06 |
|
#4 |
Member
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 41
Rep Power: 14 |
The F_UDMI will store the value calculated from your UDF into each respective face on the thread. For instance an example from the manual:
/* Compute face temperature and store in user-defined memory */ begin_f_loop(f,t) { temp = F_T(f,t); F_UDMI(f,t,0) = (temp - tmin) / (tmax-tmin); } end_f_loop(f,t) You can see that the temperature is being retrieved by F_T(f,t) and after some manipulation it is stored in the respective face/thread combination of the face loop. If for instance F_UDMI(f,t,0) was equal to a constant, then the constant would be saved over every face/thread combination. Once you save the value of your forces in F_UDMI, you can then access it from any UDF, even the DEFINE_PROFILE. You shouldn't need an Execute_on_Demand macro. |
|
July 30, 2013, 07:54 |
|
#5 |
New Member
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 13 |
Yes method works
Thank you, now im just working on my inlet vel udf |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |