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

what's -1.#IND?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 6, 2013, 10:45
Default what's -1.#IND?
  #1
Member
 
Join Date: Feb 2012
Posts: 57
Rep Power: 4
Raymond.Leoi is on a distinguished road
when I ran the following udf for the source of energy, s_p that I defined appears as a weired number, -1.#IND. Then
Error: Divergence detected in AMG solver: temperature
Error Object: #f

Any idea for this problem?

DEFINE_SOURCE(energy_source, cell, thread, dS, eqn)
{
real source;
real s_j, s_p;

s_j = -C_UDSI_DIFF(cell,thread,0)*NV_MAG2(C_UDSI_G(cell,t hread,0));

s_p = - C_UDSI_G(cell,thread,2)[0]*C_UDSI_G(cell,thread,0)[0] /
- C_UDSI_G(cell,thread,2)[1]*C_UDSI_G(cell,thread,0)[1] /
- C_UDSI_G(cell,thread,2)[2]*C_UDSI_G(cell,thread,0)[2];

s_p = -s_p*C_T(cell,thread)*C_UDSI_DIFF(cell,thread,0);

/* s_p = 0.; */
printf("s_j: %g\n", s_j);
printf("s_p: %g\n", s_p);

source = s_j + s_p;
dS[eqn] = 0.0;

return source;
}

Last edited by Raymond.Leoi; February 6, 2013 at 11:56.
Raymond.Leoi is offline   Reply With Quote

Old   February 6, 2013, 11:24
Default
  #2
Member
 
Join Date: Feb 2012
Posts: 57
Rep Power: 4
Raymond.Leoi is on a distinguished road
It seems IND indicates indefinite. However, I already initialize all those gradient in DEFINE_INIT. -1.#IND still comes up. How can I fix it?
Raymond.Leoi is offline   Reply With Quote

Old   February 10, 2013, 19:08
Default
  #3
Senior Member
 
Syavash
Join Date: Apr 2010
Location: Tehran, Karaj
Posts: 176
Rep Power: 6
syavash is on a distinguished road
Quote:
Originally Posted by Raymond.Leoi View Post
It seems IND indicates indefinite. However, I already initialize all those gradient in DEFINE_INIT. -1.#IND still comes up. How can I fix it?
Hi,

It seems that you have a divide by zero problem, check your UDS value to make sure everything's right.

Goodluck
syavash is offline   Reply With Quote

Old   February 12, 2013, 08:11
Default
  #4
akm
New Member
 
Join Date: Jan 2010
Location: United Kingdom
Posts: 27
Rep Power: 6
akm is on a distinguished road
Quote:
Originally Posted by Raymond.Leoi View Post
It seems IND indicates indefinite. However, I already initialize all those gradient in DEFINE_INIT. -1.#IND still comes up. How can I fix it?
What do you mean you have initialized the gradients?? C_UDSI_G is calculated by the solver itself, and cannot be initialized by the user.
Your problem might be because the gradients have not been assigned at the beginning of the iterations. You can use an 'if' condition to ensure that the gradients are available, otherwise return a zero source.

Code:
if (NULL != THREAD_STORAGE(thread,SV_UDS_I(0)) && NULL != T_STORAGE_R_NV(thread,SV_UDSI_G(0)))
{
   s_j = ...
   s_p = ...
   source = s_j+s_p;
   dS[eqn]= ...
   return source;
}
else
{
  dS[eqn]=0;
  return 0;
}
Also, i see that you have assigned dS[eqn] = 0. dS[] is the differential of the source term wrt the variable for which the source is given. dS is provided for better convergence.
in your case it should be:
Code:
s_p = -s_p*C_T(cell,thread)*C_UDSI_DIFF(cell,thread,0);
source = s_j + s_p;
dS[eqn] = s_p/C_T(cell,thread);
return source;
akm is offline   Reply With Quote

Old   February 19, 2013, 07:42
Default
  #5
Member
 
Join Date: Feb 2012
Posts: 57
Rep Power: 4
Raymond.Leoi is on a distinguished road
Thanks for your suggestion, Akm. DS=0. means that the source term is fedback explicitly.

Quote:
Originally Posted by akm View Post
What do you mean you have initialized the gradients?? C_UDSI_G is calculated by the solver itself, and cannot be initialized by the user.
Your problem might be because the gradients have not been assigned at the beginning of the iterations. You can use an 'if' condition to ensure that the gradients are available, otherwise return a zero source.

Code:
if (NULL != THREAD_STORAGE(thread,SV_UDS_I(0)) && NULL != T_STORAGE_R_NV(thread,SV_UDSI_G(0)))
{
   s_j = ...
   s_p = ...
   source = s_j+s_p;
   dS[eqn]= ...
   return source;
}
else
{
  dS[eqn]=0;
  return 0;
}
Also, i see that you have assigned dS[eqn] = 0. dS[] is the differential of the source term wrt the variable for which the source is given. dS is provided for better convergence.
in your case it should be:
Code:
s_p = -s_p*C_T(cell,thread)*C_UDSI_DIFF(cell,thread,0);
source = s_j + s_p;
dS[eqn] = s_p/C_T(cell,thread);
return source;
Raymond.Leoi is offline   Reply With Quote

Old   February 20, 2013, 13:11
Default
  #6
New Member
 
Raghuvir
Join Date: May 2012
Location: India
Posts: 2
Rep Power: 0
Raghuvir is on a distinguished road
Hi,I have a similar problem. I am working on adding a body force to navier stokes equation, which is a function of voltage and charge density.
I added Voltage and charge density as two UDS,0 and 1 respectively. For UDS'0' (volt), I use poissons potential equation i.e., del^2(V) = -rho_q/enod. So,diffusivity is -1 and source term is charge_density/e_nod. For UDS'1', I use charge conservation equation. i.e., grad(charge_density*mu_constant*E) = 0 where E = -grad(V). So, I use flux equation, calculate gradv term at face by taking average of two neighbour cells or zero if its boundary.

UDS-0 :-
source = -( C_UDSI(c,t,1) ) / (8.8514e-12) ;
dS[eqn] = 0 ;
return source ;

UDS-1:-


NV_VS_VS(fluxvec, =, C_UDSI_G(c0,t0,0), * , 0.5, + , C_UDSI_G (c1,t1,0) , * , 0.5 ) ;
flux = -NV_DOT(fluxvec, A)*2e-4; /* Average flux through face */
return flux;


Model :-

two electrodes surrounded by air. one electrode with 27k volt and charge density as 0.016. another electrode with 0 volt and o charge density.

PROBLEM :-


I get Nan values for UDS-1 (charge density) when I initialise it with anything except zero. If I initialise UDS-1 with 0 then the residual monitors of UDS-1 instantly go to e-43 values. But I see changes in UDS scalars only near electrodes and near domain boundaries, rest of the domain has constant UDS values.

I Tried
initialising without udf and then adding them after some iterations....but no luck.

I am guessing its sth to do with flux equation in that UDS-1 equation. Could anyone please help me with finding the error.
Raghuvir is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lift coefficient -1.#IND arashm FLUENT 0 July 28, 2010 11:13


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