Cancel
Showing results for
Did you mean:
Highlighted

# corrector converge problem

Pioneer

I am tryng to apply friction factor that I derived from experiment. So, I  simply made my code with dynamic library  compiler tool. However, I got error  'At t = 1.17571e-010 and step size 1.17571e-29, the corrector repeateldy failed to converge' .  How can I revise my code?

{
/** ------------------------------------------------------------------------ **/
/** >>>>>>>>>>>>>>>>>>> INSERT Private Code HERE **/
double pii, tup;
pii = 3.141592;
if (*pa > *pb)
{tup = *taK;}
else
{tup = *tbK;}

double rhoa,rhob,rhoavg;
rhoa = tfrhoid_(nodeIda);
rhob = tfrhoid_(nodeIdb);
rhoavg = (rhoa+rhob)/2;

double mua,mub,muavg;
mua = tfmuid_(nodeIda);
mub = tfmuid_(nodeIdb);
muavg = (mua+mub)/2;

double Re,vel;
vel = *dm/ *area/ rhoavg;
Re = fabs(rhoavg*vel* (*dh)/muavg);

double dff; // darcy friction factor
if (Re <= 1e-5) {dff = 64*1e5;}
else{
dff = 21.48*pow(Re,-0.89)*4;
}
*dm = sign(*dP,*dP) *sqrt((*dP) * (*dh / (*length)) * (2 * rhoavg * pow((*area),2)) / (dff));

/** <<<<<<<<<<<<<<<<<<< END of Private Code **/
/** ------------------------------------------------------------------------ **/
}

3 REPLIES 3

# Re: corrector converge problem

Siemens Phenom
Very hard to say like this. What do you mean with "dynamic library compiler tool"? Did you make a new submodel?

The simplest way to start debugging is to print some outputs from your code:
amefprintf(stderr, "\ndebug flow value %d\n", *dm);

Siemens Phenom