48 double abundold=0. , abundnew=0.;
78 for( ion=0; ion <= (nelem+1); ++ion )
81 if( OldFracs[nelem][ion]/Abund > 1e-4 &&
88 change =
MAX2(change, one );
90 if( change>bigchange )
93 abundold = OldFracs[nelem][ion]/Abund;
110 ASSERT( abundold>0. && abundnew>0. );
115 for( ion=0; ion <= (nelem+1); ++ion )
126 fprintf(
ioQQQ,
" element %li converged? %c ",nelem,
TorF(lgConverg_v));
127 for( ion=0; ion<(nelem+1); ++ion )
133 return( lgConverg_v );
144 double O_HIonRate_New , O_HIonRate_Old;
152 static double SecondOld;
153 static long int nzoneOTS=-1;
154 # define LOOP_ION_LIMIT 10
160 static double SumOTS=0. , OldSumOTS[2]={0.,0.};
219 for( nelem=ipISO; nelem<
LIMELM;++nelem )
224 save_iso_grnd[ipISO][nelem] =
StatesElem[ipISO][nelem][0].Pop;
249 " ConvBase called. %.2f Te:%.3e HI:%.3e HII:%.3e H2:%.3e Ne:%.3e htot:%.3e CSUP:%.2e Conv?%c\n",
307 bool lgIonizTrimCalled =
false;
308 static long int nZoneCalled = 0;
328 lgIonizTrimCalled =
true;
342 # if !defined(NDEBUG)
408 " ConvBase4 ionization driver loop_ion %li converged? %c reason not converged %s\n" ,
474 for( nelem=0; nelem<
LIMELM; ++nelem )
476 for( ion=0; ion<nelem+1; ++ion )
486 for( i=0; i<
nUTA; ++i )
495 ionbal.
UTA_heat_rate[UTALines[i].Hi->nelem-1][UTALines[i].Hi->IonStg-1] += rateone*UTALines[i].Coll.heat;
499 enum {DEBUG_LOC=
false};
503 fprintf(
ioQQQ,
"DEBUG UTA %3i %3i %.3f %.2e %.2e %.2e\n",
504 UTALines[i].Hi->nelem , UTALines[i].Hi->IonStg , UTALines[i].WLAng ,
505 rateone, UTALines[i].Coll.heat,
506 UTALines[i].Coll.heat*
dense.
xIonDense[UTALines[i].Hi->nelem-1][UTALines[i].Hi->IonStg-1] );
703 OldSumOTS[0] = OldSumOTS[1];
704 OldSumOTS[1] = SumOTS;
731 if( (OldSumOTS[0]-OldSumOTS[1]) * ( OldSumOTS[1] - SumOTS ) < 0. )
757 enum {DEBUG_LOC=
false};
759 if( DEBUG_LOC && (
nzone>110) )
780 enum {DEBUG_LOC=
false};
782 if( DEBUG_LOC && (
nzone>200) )
784 fprintf(
ioQQQ,
"debug otsss\t%li\t%.3e\t%.3e\t%.3e\n",
821 " ConvBase return. %.2f Te:%.3e HI:%.3e HII:%.3e H2:%.3e Ne:%.3e htot:%.3e CSUP:%.2e Conv?%c\n",
844 for( ion=0; ion<nelem+2; ++ion )
889 fprintf(
ioQQQ,
"PROBLEM ConvBase sets lgAbort since nPres2Ioniz exceeds limPres2Ioniz.\n");
995 for( nelem=ipISO; nelem<
LIMELM;++nelem )
1030 fprintf(
ioQQQ ,
"ABORT flag set since STOP nTotalIoniz was set and reached.\n");
1038 static int iter_punch=-1;
1045 "%li\t%.4e\t%.4e\t%.4e\n",