Particle cooling rate  UDF
Hi all,
I want to simulate the cooling process of hot metal particles using air. The problem is that using the Langrangian approach the particle is calculated with one average Temperature and is really important to know the rate dT/dt inside the particle. So I suppose this can be done only through a UDF . I am thinking to implement all the heat transfer equations for tha particle through the UDF but my problem is how I will connect the heat transfer between the particle and the fluid. What I want to say is how I can define that the particleīs temperature that Fluent uses is the one at the outer surface?? One other question is how can I store and read the value of the Temperature at the previous timestep? thank you very much in advance! 
Can anyone help me? I donīt think that I am asking something really complicated! It is urgent to finish it by Sunday!
I just want to know how I can define that the temperature at the outer surface should be used for the next step as particle temperature fot the heat exchange between particle and fluid! Thanks! 
Quote:
http://www.pasteit.in/1745 
Thank you mali28 for your answer. But I donīt think that you understood correctly my question, perhaps because I didnīt explain properly.
What I want to do is to calculate through the UDF a function T(r) where r is the diameter of particle! because according to the temperature and some criterias it would be calculated the thickness of the solid part of the particle. After calculating this value I want to pass back to fluent the outer surface particle temperature calculated from the UDF for example T(4) where 4=mm as the P_T(p). Can you help me with this? Thanks again for your reply 
Quote:
You will need to use a numerical method in UDF to solve the temperature gradient within the particle. I used CrankNicholson method as well as Fully implicit backward (FIB) method to solve the partial differential equation for heat transfer in a sphere. FIB method is comparably less computationally expensive. Here is the code I used in MATLAB to evaluate the temperature gradient using FIB method. You will first need to specify the number of grid points (in the radius) where you want the temperature to be evaluated. Then use FIB to discretise the equations. The apply Gaussian elimination method to solve the unknowns. You can use the same technique to solve it in UDF. http://www.pasteit.in/1748 
I think this would assume that thermal gradients within the particle are handled properly. I've read nothing in the Fluent manual to suggest that the outofthebox treatment of Lagrangian particles is anything other than a lumped capacitance solution (i.e. the particle temperature is constant throughout). You should verify the correctness of this assumption by taking a look at the Biot number of your particle(s).
ComputerGUy Quote:

Thank you very much both for your answer.
I think that my assumption is not wrong as long as I return to Fluent the value of the outer surface as the particle temperature and then I calculate the temperature profile within the particle through the UDF. The only think is I donīt know how to pass this information back. I don`t think that writing for example P_T(p) = 1500 is correct. Does anyone of you know how can I define it at the UDF 
P_T(p)=1500 is absolutely fine, so long as p is a pointer to a particle. It will need to be placed in the appropriate loop (which loops over all particles in an Injection), or in a routine which passes the p pointer directly.
Have a look here: Here or Here For some DPMspecific macros. The second link, in particular, has an instance where the particle temperature is set. Quote:

Thank you very much ComputerGuy for your answer! I will try this and if I have a problem I will post it!
As soon as I manage to write the appropriate UDF I will post it also at this thread! Thank you very much again! 
Hi again, I start writing the following UDF, I am not sure if I programmed everything correclty as I am new to the UDF field. The first part should read all the injections and write the temperature value at each time step as UDMI.
The second part should include all the appropriate equations to calculate the heat transfer inside the particle but I again I donīt know if I read correctly the values and set the parameters! I would be really grateful if someone of you could help me with this stuff. Thank you very much in advance!!! :) #include"udf.h" #include"dpm.h" DEFINE_ON_DEMAND(UDMInit) { /* run this first to initialize your UDM*/ Domain *d; /* declare domain pointer since it is not passed a */ /* argument to DEFINE macro */ real PS_temp; Thread *ct; cell_t c; Particle *p; /* Loop over all cell threads in the domain */ loop(p,I>p) /* Standard Fluent Looping Macro to get particle streams in an Injection */ { cell = P_CELL(p,t); /* Get the cell and thread that the particle is currently in */ cthread = P_CELL_THREAD(p); PS_temp = P_T(p,t); /* PS_temp Particle outer surface Temperature */ C_UDMI(c,t,0) = PS_temp; } } DEFINE_ADJUST(tparticle, d) { real PS_temp; real Q; real PSnew_temp; Thread *ct; cell_t c; Particle *p; #define dx=0.000001 /* step to iterate inside the particle */ loop(p,I>p) { begin_c_loop(c,t) { PSnew_temp= P_CELL(p,t); k=0,0029*PSnew_temp^6 + 0,08*PSnew_temp^5  0,8523*PSnew_temp^4 + 4,3974*PSnew_temp^3  11,448*PSnew_temp^2 + 14,239*PSnew_temp  4,8363 /* thermal conductivity depending on Temperature */ Q=k*(P_DIAM(p)/2)*(PSnew_tempC_UDMI(c,t,0)) /*calculate the heat between two steps! */ /* now I am trying a way to implement what is happening within the particle and the solidification criteria! /* } end_c_loop(c,t) } 
Theodoros,
I assume your code isn't working, which is why you've posted it here. There are a few syntax errors with the code. The first one which is clear is:
You cannot use ^ to define exponentiation. You need to use pow (double base, double exponent); I also don't know that C/Fluent supports localization; you'll probably need to convert you numbers with commas "0,0029" into numbers with decimals "0.0029"
You need something like: Code:
DEFINE_ON_DEMAND(UDMInit) ComputerGuy Quote:

All times are GMT 4. The time now is 16:48. 