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 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)*C_UDSI_G(cell,thread,0) /
- C_UDSI_G(cell,thread,2)*C_UDSI_G(cell,thread,0) /
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;
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?
It seems that you have a divide by zero problem, check your UDS value to make sure everything's right.
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.
in your case it should be:
Thanks for your suggestion, Akm. DS=0. means that the source term is fedback explicitly.
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.
source = -( C_UDSI(c,t,1) ) / (8.8514e-12) ;
dS[eqn] = 0 ;
return source ;
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 */
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.
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.
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.
|All times are GMT -4. The time now is 00:02.|