|
[Sponsors] |
April 12, 2018, 09:48 |
DPM Property
|
#1 |
Member
sunil kumar
Join Date: May 2016
Posts: 80
Rep Power: 10 |
I am trying to implement a UDF to calculate the density of DPM droplets but for some reason this just returns the value 4230 every time
DEFINE_DPM_PROPERTY(density,c,t,tp,T) { real rho; if (T < 385) { rho = (1 - TP_USER_REAL(tp,0)) * 4230 + TP_USER_REAL(tp,0) * (1053.73 - 1.2412*T + 2.27199e3*T*T - 3.764e6*T*T*T); } else { rho = (1 - TP_USER_REAL(tp,0)) * 4230 + TP_USER_REAL(tp,0) * 697; } return rho; } |
|
April 13, 2018, 04:10 |
|
#2 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi Skumar112,
Well, if TP_USER_REAL(tp,0) is 0.0, then 4230. is the correct answer in all circumstances. So perhaps you should check that TP_USER_REAL(tp,0) is behaving as you expected. By the way, something is badly wrong with the polynomial in T: it returns values around -2e14 at T=385K. One way to debug this kind of UDF is to pick one in every X visits to the UDF, and to print out all the steps in that visit's calculations, using Message to print to the Fluent window. X could be 10000 or 1000000 or whatever, depending on the size of the simulation. How do you pick one in X? -- one way is to define a "static int counter=0;" outside the UDF, and inside the UDF "if(++counter > 1000000) { counter=0; Message(...);}". Good luck! Ed |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for DPM property | ksgr | FLUENT | 2 | July 12, 2017 04:51 |
Define DPM property function in temp | Ahmed21 | Fluent UDF and Scheme Programming | 3 | July 7, 2017 15:13 |
DPM injection mass flow rate | kingpots | ANSYS | 0 | November 22, 2012 12:12 |
how to use DPM from DPM file unsteady? | Cloud | FLUENT | 0 | November 10, 2011 05:25 |
slow after mesh for enhanced wall treat DPM | joshkemp | FLUENT | 0 | May 1, 2007 18:20 |