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
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.
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.
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 */
temp = F_T(f,t);
F_UDMI(f,t,0) = (temp - tmin) / (tmax-tmin);
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.
Yes method works :D
Thank you, now im just working on my inlet vel udf
|All times are GMT -4. The time now is 23:46.|