CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

UDF Help

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 26, 2013, 05:41
Default UDF Help
  #1
New Member
 
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 3
Jess is on a distinguished road
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
Jess is offline   Reply With Quote

Old   July 28, 2013, 08:29
Default
  #2
Member
 
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 40
Rep Power: 5
Hershey is on a distinguished road
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.
Hershey is offline   Reply With Quote

Old   July 28, 2013, 15:41
Default
  #3
New Member
 
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 3
Jess is on a distinguished road
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
Jess is offline   Reply With Quote

Old   July 28, 2013, 19:06
Default
  #4
Member
 
Christopher Hershey
Join Date: Feb 2012
Location: East Lansing, Michigan
Posts: 40
Rep Power: 5
Hershey is on a distinguished road
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.
Hershey is offline   Reply With Quote

Old   July 30, 2013, 06:54
Default
  #5
New Member
 
Jessica
Join Date: Jul 2013
Location: England
Posts: 6
Rep Power: 3
Jess is on a distinguished road
Yes method works
Thank you, now im just working on my inlet vel udf
Jess is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
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


All times are GMT -4. The time now is 00:59.