Highlighted

corrector converge problem

Pioneer
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 Siemens Phenom
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);

Re: corrector converge problem

Siemens Phenom Siemens Phenom
Siemens Phenom
Forget about my question about the dynamic library compiler tool I forgot about that tool!

Re: corrector converge problem

Pioneer
Pioneer

okay.
my questions are:
1. What does 'corrector converge failed' message mean?
2. What is algorithm that TFPHE model and half heat exchanger model compute inlet pressure from input mass flow rate?
According to manual, they compute mass flow rate from given pressure drop and temperature. However, from my experience, they can compute inlet pressure from given mass flow rate. does Amesim compute this by iteration? If it does so, How can user make a code computing inlet pressure from given mass flow rate ?