|
[Sponsors] |
February 25, 2014, 00:08 |
An important question about DPM_Erosion UDF
|
#1 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
I am writing a UDF to calculate the erosion. I opened a User_Defined memory locations and set a name for it, but I store any value in that UDM. How can I store any data in my UDM? Here is the UDF:
/************************************************** ********************* UDF for Calculating Erosion ************************************************** **********************/ #include "udf.h" DEFINE_EXECUTE_ON_LOADING(on_loading, libname) { Set_User_Memory_Name(0,"ER1_model"); } enum /* Enumeration of used User-Defined Memory Locations. */ { ER1_model, /* Erosion model.*/ }; DEFINE_DPM_EROSION(erudf, particle, t, f, normal, theta, vel, mdot) { real Avec[ND_ND]; real er, f_dia,f_angle; real f_ss316; real f_tmp; Domain *d; cell_t c; thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,ER1_model) =0.002; } end_c_loop(c,t) } } |
|
February 25, 2014, 03:05 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
C_UDMI(c,t,0) =0.002;
|
|
February 25, 2014, 11:10 |
|
#3 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
I also tried that, and it did not work. Is there any specific way to store data in udm for dpm_erosion macro? I can store my data in other macros?
|
|
February 25, 2014, 11:12 |
|
#4 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Quote:
Did you have problems with compiling? Interpreting? Running the simulation? Showing the results? What exactly did not work? |
||
February 25, 2014, 11:17 |
|
#5 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
The problem is when I want to see the results, it always shows that my UDM is zero, however I put that equal to 0.002. Why does not show 0.002 in the results? Thanks,
|
|
February 25, 2014, 11:20 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Are you sure that your udf erudf is used? Did you hook it at the right place?
Test it by adding a Message("test\n"); somewhere, and see if it shows up in the screen. |
|
February 25, 2014, 11:26 |
|
#7 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
Yes, after compiling I can see and select it in discrete phase model section. Should i do something else to hook that up? Thanks.
|
|
February 25, 2014, 11:37 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
No, you hooked it in the correct way.
But I now had a better look at your UDF, and it makes no sense to me. What are you trying to do? What do you want the user defined memory to store? |
|
February 25, 2014, 11:44 |
|
#9 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
I am trying to calculate the erosion and then store that in my UDM. But first i just wanted to test my UDM and see if it can show the value that I have already specified for that in my UDF. So I just put that equal to 0.002, and I checked that in XY plot and I picked the wall that I want to calculate erosion on that. Instead of showing 0.002 it just shows zero.
If I can store my value in my UDM then I will add my erosion equation based on the particle velocity and impact angle and other things. Thanks, |
|
February 25, 2014, 11:51 |
|
#10 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
So what you want is to set the UDM at the surface where the particle reflects equal to 0.002. That is a smart test.
But why do you use the thread_loops? I think that your problem is there... What you do here: Code:
thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,ER1_model) =0.002; } end_c_loop(c,t) } I think you need the much simpler version: change the UDM of face f to 0.002. In other words: Code:
F_UDMI(f,t,ER1_model) =0.002; |
|
February 25, 2014, 12:04 |
|
#11 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
Thank you very much for your help. I removed the loop and just added F_UDMI code that you wrote, but in XY Plot it still shows zero. If I put the face value equal to a number for example 0.002, can I see that in the result (XY plot) or I must put that number for the cell center by C_UDMI and then I will be able to see it in my XY Plot? How can I be sure that UDM reflects my calculation in my UDF?
|
|
February 26, 2014, 03:12 |
|
#12 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
I just checked some old code I once made for something similar, and I had the same problem as you did: the plots stayed zero. (If my memory were better, it would have saved us both some time...)
The way I solved it then, translated to your situation: Code:
F_UDMI(f,t,0) = 0.002; C_UDMI(F_C0(f,t),THREAD_T0(t),0) = 0.002; I don't know why this was necessary, and maybe it is sufficient to only use the second line. I hope it helps! |
|
March 1, 2014, 14:50 |
|
#13 |
Member
Join Date: May 2009
Posts: 58
Rep Power: 16 |
Thank you, it works now!
c0 = F_C0(f, t); t0 = THREAD_T0(t); C_UDMI(c0, t0, 0) =F_UDMI(f,t,0); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
my important question, UDF | hamid1 | FLUENT | 1 | October 12, 2011 10:57 |
Quick question RE: UDF | Dylan | FLUENT | 2 | August 22, 2007 15:47 |
UDF question | Kerem | FLUENT | 0 | April 3, 2006 19:24 |
A question about the dynamic mesh UDF | Tango | FLUENT | 1 | November 27, 2003 02:56 |
a question about UDF | Wenbin | FLUENT | 0 | November 12, 2003 10:24 |