41 strcpy(
conv.chNotConverged,
"Converged!" );
44 static double HbFracOutOld=-1. , HbFracOutNew=-1.;
45 HbFracOutOld = HbFracOutNew;
46 double a, total, BeamedIn;
47 long int ipTotal =
cdLine(
"TOTL" , 4861.36f , &a , &total );
48 long int ipInwd =
cdLine(
"INWD" , 4861.36f , &a , &BeamedIn );
49 HbFracOutNew = 1. - pow(10. , (BeamedIn-total));
54 bool lgReasonGiven =
false;
57 if(
nzone>3 && ipInwd>=0 && ipTotal>=0 )
60 if( fabs(HbFracOutNew-HbFracOutOld)/HbFracOutNew>
conv.autocv )
63 sprintf(
conv.chNotConverged,
"change in outward Hb");
67 fprintf(
save.ipPunConv,
" Change in outward Hb, "
68 "old=%.3e new=%.3e \n",
69 HbFracOutOld , HbFracOutNew);
75 for( nelem=ipISO; nelem <
LIMELM; nelem++ )
77 if(
dense.lgElmtOn[nelem] )
99 if(
iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauIn() > 0.5 )
102 if( fabs(
iso_sp[ipISO][nelem].trans(
iso_ctrl.nLyaLevel[ipISO],0).Emis().TauTot() -
103 iso_sp[ipISO][nelem].trans(
iso_ctrl.nLyaLevel[ipISO],0).Emis().TauIn()*
rt.DoubleTau) >
104 conv.autocv*fabs(
iso_sp[ipISO][nelem].trans(
iso_ctrl.nLyaLevel[ipISO],0).Emis().TauIn()*
rt.DoubleTau) )
111 sprintf(
conv.chNotConverged,
"%s-like Lya",
elementnames.chElementSym[ipISO] );
115 lgReasonGiven =
true;
116 fprintf(
save.ipPunConv,
" %s-like Lya thick, "
117 "nelem= %s iteration %li old %.3e new %.3e \n",
121 iso_sp[ipISO][nelem].trans(
iso_ctrl.nLyaLevel[ipISO],0).Emis().TauTot() ,
122 iso_sp[ipISO][nelem].trans(
iso_ctrl.nLyaLevel[ipISO],0).Emis().TauIn());
126 if( fabs(
iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauTot() -
127 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauIn()*
rt.DoubleTau) >
128 conv.autocv*fabs(
iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauIn()*
rt.DoubleTau) )
135 sprintf(
conv.chNotConverged,
"%s-like subord",
elementnames.chElementSym[ipISO] );
139 lgReasonGiven =
true;
140 fprintf(
save.ipPunConv,
" %s-like subord, nelem= %s iteration %li old %.3e new %.3e \n" ,
144 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauTot() ,
145 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauIn() );
158 if(
TauLines[i].Emis().TauIn() > 1. &&
167 sprintf(
conv.chNotConverged,
"level 1 line %.1f",
TauLines[i].WLAng() );
171 lgReasonGiven =
true;
172 fprintf(
save.ipPunConv,
" level 1 line %.1f iteration %li old %.3e new %.3e \n",
184 for( i=0; i<
NCOLD; ++i )
196 strcpy(
conv.chNotConverged,
"H mole col" );
200 lgReasonGiven =
true;
201 fprintf(
save.ipPunConv,
" H mole col species %li iteration %li old %.2e new %.2e H col den %.2e\n",
210 double biggestDiffer = 0.;
219 double differ = (double)fabs(
mole.species[i].column_old-
mole.species[i].column) ;
221 (differ >
conv.autocv*
mole.species[i].column) )
228 if( differ > biggestDiffer )
231 strcat(
conv.chNotConverged,
" column" );
234 biggestDiffer = differ;
239 lgReasonGiven =
true;
240 fprintf(
save.ipPunConv,
"%s, old:%.3e new:%.3e\n" ,
242 mole.species[i].column_old ,
243 mole.species[i].column );
258 strcpy(
conv.chNotConverged,
"Dynamics " );
261 lgReasonGiven =
true;
262 fprintf(
save.ipPunConv,
" Dynamics\n" );
267 if(
save.lgPunConv && lgConverged )
269 lgReasonGiven =
true;
270 fprintf(
save.ipPunConv,
" converged\n" );
282 strcpy(
conv.chNotConverged,
" " );