Hot fixes to C05.07


The array index for the Rauch 2002 stellar atmospheres is incorrect when the default is used. To fix, edit stars_rauch02.c and change line 802 so that it sets ipTeff to 14 rather than 23. After the correction the line will read as follows:

		if( tval[NTVAL-1] == temp_star )
		/*lint +e777 test floats for equal */
		{
			ipTeff = 23;
		}

Many thanks to Marcin Hajduk for finding this problem. 2006 Feb 08.


The continuum array could have insane energies when the continuum intensity changes dramatically at certain energies. When this occurs the code will stop and declare insanity. To fix, edit cont_setintensity.c and add an if test following line 156. After the change the code (including two lines before and one line after the change) will read

			wanu[j] = MAX2( wanu[j] , rfield.emm );
			wanu[j] = MIN2( wanu[j] , rfield.egamry );
			/* >>chng 06 feb 03, the continuum binning can change dramatically
			 * at some energies - make sure that this cell does not overextend the
			 * boundaries of its neighbors */
			if( i > 0 && i < rfield.nupper-1 )
			{
				wanu[j] = MAX2( wanu[j] , rfield.anu[i-1] + 0.5*rfield.widflx[i-1] );
				wanu[j] = MIN2( wanu[j] , rfield.anu[i+1] - 0.5*rfield.widflx[i+1]  );
			}

			wfun[j] = fweigh[j]*ffun(wanu[j]);

Many thanks to Sergio Fajardo-Acosta for reporting this problem. 06 Feb 03.


The optimize temperatures command only recognized the keyword VOLUME and not volume. Change the variable chCard to chCap on line 598 of parse_optimze.c. After the change the line and the one before it will read

		strcpy( optimize.chTempWeight[optimize.nTempObs] , "radius" );
		/* >>chng 05 dec 29, from chCard to chCap, bug caught by Bohdan Melekh */
		if( lgMatch( "VOLUME" , chCap ) )

Many thanks to Bohdan Melekh for finding and fixing this problem. 05 Dec 29


The recombination contribution to [N II] l5755 was incorrect. Equation 1 from Liu et al. MNRAS 312, 585 was written in terms of the temperature scaled to 1e4 K. The code works in terms of the real temperature so the rate was too large by a factor of 1e40.3 or 15.8489. To fix this edit routine prt_lines_lv1_li_ve.c and change the code near line 365 to read as follows:

/*>>chng 05 dec 16, Liu et al. (2000) eqn 1 uses t = Te/10^4 K, not Te so phycon.te30 
 * is too large: (10^4)^0.3 = 16 - div by 15.8489 - bug caught by Kevin Blagrave */
   rec = CoolHeavy.xN2_A3_tot * HBeta *
   3.19 * phycon.te30 / 15.84893 * dense.xIonDense[ipNITROGEN][2]/dense.xIonDense[ipHYDROGEN][1] ;

Many thanks to Kevin Blagrave for finding and fixing this problem. 05 Dec 15


The code can crash with an fpe for very density models. To fix, edit routine helike_level.c, and change line 783, variable iso.numLevels[ipHE_LIKE][nelem] to helike.numLevels[nelem]. After the change the code around this line will read:

		/* Along the iso-sequence, two of the 2^3Pj terms are always very nearly degenerate, these
		 * should have PopOpc equal to the sum of the two, the third should be left alone.	*/
		/*>>chng 05 nov 18, numLevels had been iso. which went to highest dim, and should have
		 * been only levels we are working with - bug caught by Kirk Korista */
		for( ipHi=ipHe2p1P; ipHi < helike.numLevels[nelem]; ipHi++ )
		{
			double sum;
			long OneOfDegenerate, OtherDegenerate;

Many thanks to Kirk Korista for reporting this problem. 05 Nov 18.


The grain emission continuum predicted by the punch grain continuum command is incorrect on second and later iterations. The storage arrays need to be reset to zero. Correct this by adding the following loop after line 314 of grains.c - after the correction the code will appear as follows:

if( gv.lgDustOn && gv.lgGrainPhysicsOn )
{
    long i;
    for( i=0; i < rfield.nupper; i++ )
    {
    /* >>chng 05 sep 08, zero on every iteration as per John Everett comment, PvH */
    gv.SilicateEmission[i] = 0.;
    gv.GraphiteEmission[i] = 0.;
}

for( nd=0; nd < gv.nBin; nd++ )
{
/* >>chng 97 jul 5, save and reset this
* save grain potential */

This only affects the punch grain continuum command. Many thanks to John Everett for discovering this problem. 05 Sep 08


An assert could be thrown for cases where the He++ abundance became very small. Edit routine radius_increment.c and change ERR_CHK at line 112 from 1.001 to 1.01. After the change the line will read as follows:

/* >>chng 05 feb 05, for very highly ionized sims, where N or O is He-like,
 * the error can approach 1%, and depends on the convergence criteria.
 * the code does not try to converge these quantities in an absolute sense, 
 * only the quantites relative to the electron or hydrogen density.  so it is not
 * safe to do the assert for small values 
 * change is to only do this branch if abundance is large enough to be detected by
 * the ionization convergence solvers */
/* >>chng 05 Sep 04 from 1.001 to 1.01 to block assert for faint He++ */
#define ERR_CHK	1.01
/* make sure that populations are valid, first check Pop2Ion  */

Many thanks to Yoshiki Matsuoka and Carmen Sanchez Contrera for reporting this problem. 05 Sep 04.


The set spectrum command incorrectly raised its argument to a power. This results in an FPE for reasonable resolving power. If you wish to use this command then file routine parse_set.c and change line 647 from the following:

i = 5;
punch.cp_resolving_power[punch.cp_npun] = (float)pow(10.,FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL));
if( lgEOL )

so that it reads as follows - simply remove the "pow(10.," and the trailing ")".

/* >>chng 05 aug 25, following had pow(number), so crashed for high resolv power
 * bug caught by Yan Changshou */
i = 5;
punch.cp_resolving_power[punch.cp_npun] = (float)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
if( lgEOL )

Bugs come in groups of three. The same mistake occurs at line 630 and 631 of the file. Do the same edit - change the existing lines, which read as follows;

punch.cp_range_min[punch.cp_npun] = (float)pow(10.,FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL));
punch.cp_range_max[punch.cp_npun] = (float)pow(10.,FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL));

after the change it will read as follows:

punch.cp_range_min[punch.cp_npun] = (float)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
punch.cp_range_max[punch.cp_npun] = (float)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);

Note that this command accepts only the energy in Rydbergs.

This only affect the set spectrum commands. Many thanks to Yan Changshou for reporting this problem. 05 Aug 25


An incorrect array index is used to zero a continuum array. Edit parse_interp.c lines 402-404, which originally read as

/* zero out remainder of array */
for( i=npairs; i < rfield.nupper; i++ )
{
    rfield.tFluxLog[rfield.ipspec][i] = 0.;
    rfield.tslop[rfield.ipspec][i] = 0.;
    rfield.tNuRyd[rfield.ipspec][i] = 0.;;
}

changing the occurrences of ipspec to nspec so that the block reads as follows

/* zero out remainder of array */
for( i=npairs; i < rfield.nupper; i++ )
{
    rfield.tFluxLog[rfield.nspec][i] = 0.;
    rfield.tslop[rfield.nspec][i] = 0.;
    rfield.tNuRyd[rfield.nspec][i] = 0.;
}

This has no effect on the physics but caused a memory access exception when the code is used as a routine. Many thanks for Ralf Quast for finding and fixing the problem. 05 Jul 27


An assert may be thrown in helike_cs on some system due to numerical imprecision. Edit helike_cs.c and change line 1647 from

ASSERT( aveRadius >= Bohr_rad );

to read as follows (this includes a few lines of code around it to place it in context)

ASSERT( aveRadius < 1.e-4 );
ASSERT( aveRadius > 3.9/LIMELM * Bohr_rad );
global_an = aveRadius;

This has no effect on results but will cause thrown asserts on some systems. 05 Jul 14


Return to HotFixes main page

Return to the StepByStep instructions

Return to  nublado.org