# what's -1.#IND?

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

 February 6, 2013, 12:24 #2 Member   Join Date: Feb 2012 Posts: 58 Rep Power: 7 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?

February 10, 2013, 20:08
#3
Senior Member

Ehsan Asgari
Join Date: Apr 2010
Posts: 312
Rep Power: 10
Quote:
 Originally Posted by Raymond.Leoi 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

February 12, 2013, 09:11
#4
New Member

Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 9
Quote:
 Originally Posted by Raymond.Leoi 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;
return source;```

February 19, 2013, 08:42
#5
Member

Join Date: Feb 2012
Posts: 58
Rep Power: 7
Thanks for your suggestion, Akm. DS=0. means that the source term is fedback explicitly.

Quote:
 Originally Posted by akm 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;```

 February 20, 2013, 14:11 #6 New Member   Raghuvir Join Date: May 2012 Location: India Posts: 2 Rep Power: 0 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.

 Thread Tools Display Modes Linear Mode

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