CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Fluent DPM UDF Diverges in parallel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2018, 10:26
Default Fluent DPM UDF Diverges in parallel
  #1
Member
 
sunil kumar
Join Date: May 2016
Posts: 80
Rep Power: 10
skumar112 is on a distinguished road
Hello

I am trying to employ the inert heating law as a UDF In fluent however when I run it in parallel it diverges. This does not happen when run in series, in the fluent manual it states that no additional adjustments need to be made for DPM UDF's run in parallel. Any suggestions what may be going wrong here?

DEFINE_DPM_LAW(Heating,tp,ci)
{
/* get the cell and Thread that the particle is currently in */
cphase_state_t *c = &(tp->cphase[0]);
Thread *t = TP_CELL_THREAD(tp);
mp = TP_MASS(tp);
Dp = DPM_DIAM_FROM_VOL(mp / TP_RHO(tp));
Ap = DPM_AREA(Dp);
Tp = TP_T(tp);
dt = TP_DT(tp);
real Pr = c->sHeat * c->mu / c->tCond;
real Nu = 2.0 + 0.6 * sqrt(tp->Re) * pow(Pr, 1./3.);
real h = Nu * c->tCond / Dp;
TP_T(tp) = Tp + dt * h * Ap * (c->temp - Tp) / (mp * tp->Cp);
}
skumar112 is offline   Reply With Quote

Old   April 4, 2018, 06:39
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by skumar112 View Post
Hello

I am trying to employ the inert heating law as a UDF In fluent however when I run it in parallel it diverges. This does not happen when run in series, in the fluent manual it states that no additional adjustments need to be made for DPM UDF's run in parallel. Any suggestions what may be going wrong here?
No answer to your real question, but you should clean your code! Declare your variables (I am surprised you were able to compile this...), and don't introduce variables that you never use (such as t).


Code:
DEFINE_DPM_LAW(Heating,tp,ci)
{
/* get the cell and Thread that the particle is currently in */
   cphase_state_t *c = &(tp->cphase[0]);
/* the line above is not the normal way to find the cell! 
   instead use cell_t c = TP_CELL(tp);
*/
   real mp = TP_MASS(tp);                               
   real Dp = DPM_DIAM_FROM_VOL(mp / TP_RHO(tp));      
   real Ap = DPM_AREA(Dp);                                   
   real Tp = TP_T(tp);                                
   real dt = TP_DT(tp);
   real Pr = c->sHeat * c->mu / c->tCond;
/* all "c->" contructions are under-the-hood constructions, that might work now but fail later. Don't do this, just use the normal Fluent way:
   c->mu should be C_MU(c,t) for example.
  To do this, you should re-add the thread t that I removed. */

   real Nu = 2.0 + 0.6 * sqrt(tp->Re) * pow(Pr, 1./3.);   
   real h = Nu * c->tCond / Dp;                   
   TP_T(tp) = Tp + dt * h * Ap * (c->temp - Tp) / (mp * tp->Cp);
 /* tp->Cp is actually DPM_SPECIFIC_HEAT(tp,t)? */
}
pakk is offline   Reply With Quote

Old   April 4, 2018, 09:29
Default
  #3
Member
 
sunil kumar
Join Date: May 2016
Posts: 80
Rep Power: 10
skumar112 is on a distinguished road
I had declared the variables globally outside of the function I have managed to fix this thank you for your help
skumar112 is offline   Reply With Quote

Old   August 30, 2018, 11:04
Default Same Problem
  #4
New Member
 
Alec H.
Join Date: Aug 2018
Posts: 4
Rep Power: 8
ahouse8 is on a distinguished road
Hi, I am having the same problem with a relatively simple UDF of mine. When I run in serial, it converges with no problem. In parallel, it diverges at random timesteps, but will always diverge.

What steps did you take to solve your problem?
ahouse8 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FLUENT Parallel Problem (UDF) soheilr Fluent UDF and Scheme Programming 1 June 16, 2016 08:55
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari Fluent UDF and Scheme Programming 0 August 19, 2010 04:09
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari FLUENT 0 August 19, 2010 04:01
Hooking a DPM Particle Heat and Mass Transfer UDF to FLUENT subhankar_bhandari Main CFD Forum 0 August 19, 2010 04:01
UDF for PARALLEL FLUENT Cfdtoy FLUENT 0 March 14, 2004 01:55


All times are GMT -4. The time now is 10:51.