User define memory storage
Hello,
I have written UDF for the breakage rate of Coulaloglou and Tavlarides model and interpreted in fluent 17.2 (for population balance modeling). However, I would like to store a memory of breakage rate. For the same I have used syntax C_UDMI (cell, thread, 0)=breakage rate. But, I am getting this stored value zero everywhere in the domain. Please suggest me the solution. Here is my UDF, ************************************************** ********************** UDF that computes the particle breakage frequency ************************************************** ***********************/ #include "udf.h" #include "sg_pb.h" #include "sg_mphase.h" DEFINE_PB_BREAK_UP_RATE_FREQ(break_up_freq_tav, cell, thread, d_1) { real epsi, alpha, f1, f2, rho_d=1.225; real C1 = 0.00481, C2 = 0.08, sigma = 0.072; Thread *tm = THREAD_SUPER_THREAD(thread);/*passed thread is phase*/ epsi = C_D(cell, tm); alpha = C_VOF(cell, thread); rho_d = C_R(cell, thread); f1 = C1*pow(epsi, 1./3.)/((1.+alpha)*pow(d_1, 2./3.)); f2 = -(C2*sigma*(1.+alpha)*(1.+alpha))/(rho_d*pow(epsi,2./3.)*pow(d_1, 5./3.)); C_UDMI(cell, thread, 0) = C1*f1*exp(f2); return C1*f1*exp(f2); } |
did you select the name that you specified in the DEFINE macro argument in the appropriate drop-down list under Phenomena in the Population Balance Model dialog box?
udf seems OK, most likely there is some problem with model settings you may try to put Message macro inside to see what is calculated, but make small mesh for this Code:
************************************************** ********************** |
Thank you so much for the reply, AlexanderZ.
By putting message macro inside, in fluent it gives error of "CX_Message0" not found (pc=211). My mesh is just 60000 elements only. |
60000 elements means 60000 messages in console
change message to printf or compile UDF best regards |
Thank you for the reply,
I am new to UDF, dont know much about UDF. Can you please tell me how to change message to printf |
Put the cursor directly after "Message0", press backspace 8 times, and press 'p' on your keyboard, followed by 'r', 'i', 'n', 't' and 'f'.
|
Thank you pakk,
it worked. But, still the calculated and stored value is zero everywhere, and lots of values (no. of values are more) are showing in fluent consol. how to tackle this. |
All those values are shown on your screen for a reason... Look at them!
|
this UDF is example from Fluent manual, if it doesn't work, it means you've missed something in settings of your model (not UDF)
did you hook it properly? best regards |
I think that dhiraj has no idea what we are trying to do here...
Dhiraj, the problem that you had was that you got zeros as result. AlexanderZ suggested to add some line that would help to know WHY you got zeros as result. Look at the last line of your code: Code:
return C1*f1*exp(f2);
And that is exactly what AlexanderZ suggested: he wanted you to print the values of f1 and f2 (and thinking ahead, he already added some more values to print). You say that you ran the code and saw many values on your screen. Great, look at them! What do they say for f1 and f2? Is f1 zero? Is f2 minus infinity? If you see (for example) that f1 is always zero, then you have made the problem smaller! Because then you can find out why f1 is zero. Again, look at the place in your code where f1 is defined, see which values it depends on, and print these values. And you might for example find out that the real problem is that epsi is always zero, because you are not running a turbulent simulation. Or it is something else. But you have to look at the values on your screen, we can not do that for you. |
All times are GMT -4. The time now is 04:05. |