Hotfixes to C94
Home Up Other versions Revision history The future etcetera Acknowledgements Contacts, Mailing list Links Site map, search




Hot Fixes to C94.00

These are small changes that will be incorporated in the next revision of the code, or ways to work around problems in the current version. These only apply to the current version of the code stored on this site. In the following, the corrections that should be made are indicated by line numbers within specific files.

2002 April 19, Although the code was defended against too many interpolate continuum points, it did not announce and stop after encountering the problem.  The interpolate command can be used to enter a table of points to define the continuum shape.  There is a limit of 2000 points (the value of NCELL) due to the size of several vectors.  When too many points were entered the code did defend itself against exceeding the array bounds, but should have stopped in this case.  The test for stopping was flawed, with the effect that the table of interpolated points was limited to 1998 values and no error was reported. 

To correct edit routine parseinterp.c and change line 138 to read

else if( j >= NCELL - 2 )

That is, change the ">" to a ">=".  When this problem occurs the solution is to increase NCELL (in cddefines.h) to a value greater than the number of interpolate points in the continuum.

Thanks to David Ardila and Henrik Spoon for finding this problem.

2001 July 4, A wavelength variable could cause some systems to crash with a floating point exception.  Edit file iwavlen.c, and change the code at line 15 from

     iWavLen_v = (long)(t->WLAng + 0.5);


if( t->WLAng >= (float)LONG_MAX )
     /* set to zero if larger than a long int */
     iWavLen_v = 0;
     iWavLen_v = (long)(t->WLAng + 0.5);

Additionally, it is necessary to include the limits.h header file that defines LONG_MAX, by adding the line

#include <limits.h>

to the includes at the top of the file.

Thanks for Julian M. Pittard and Pat Romano for help with this problem.  

2000 Dec 02, The values of the reflected continuum in the output could be orders of magnitude too large, due to division by an inappropriate variable.  These number are not usually printed, but will be if the print diffuse continuum command is entered.  The reflected emission predicted with the punch continuum commands is correct however.  This error mainly affected continuum points below the Lyman edge.  To correct this problem edit routine lineset1.c, and remove the occurrences of "/opac.tmn[ipPredCont[i]-1]" on lines 607, 611, and 617.  After this correction the lines will read as follows:

	/* >>chng 00 dec 02, hotfix, remove three occurences of /opac.tmn[ipPredCont[i]-1] */
	/* reflected toal continuum (dif+incident emitted inward direction) */
	ConRef = rfield.refcon[ipPredCont[i]-1]/rfield.widflx[ipPredCont[i]-1]*
		rfield.anu2[ipPredCont[i]-1]*EN1RYD /*/opac.tmn[ipPredCont[i]-1]*//radius.GeoDil;
	/* reflected part of INCIDENT continuum (only incident) */
	ConIn = rfield.reflux[ipPredCont[i]-1]/rfield.widflx[ipPredCont[i]-1]*
		rfield.anu2[ipPredCont[i]-1]*EN1RYD /*/opac.tmn[ipPredCont[i]-1]*//radius.GeoDil;
	/* outward continuum */
	ConOt = (rfield.outcon[ipPredCont[i]-1]+ rfield.ConOutNoInter[ipPredCont[i]-1])/

Thanks for Kirk Korista for pointing out the problem.  

2000 Oct 13, The offset for the H-minus opacity in the total opacity stack was added with the wrong sign.  In routine hmole.c change line 272 from

ipOffSet = iphminCom.iphmin + OpacPoint.iphmop;


ipOffSet = OpacPoint.iphmop - (iphminCom.iphmin-1);

This error was discovered during internal testing.  The effect was to mitigate H- photodissociation heating, which is a significant heating source in clouds exposed to a strong IR continuum (ApJ, 347, 656) .  The bug had negligible effect on roughly 3/4 of the nebular models in the test suite.  In the remaining cases fixing the bug resulting in low ionization lines such as the optical [OI], [SII], [NII], and [OII] lines becoming 10 - 15% stronger.

The error was introduced some time ago, and is present in the last released version of C90 as well.

2000 August 8.  The opacities produced by the punch element opacity command are wrong.  They have only partial, not total, cross sections.  The problem only affects the output from this command.

2000 March 28.  Volume-weighted mean ionization and temperatures printed at the end of the calculation are incorrect for highly spherical geometries.  Edit routine mean.c and change line 41 to read

	dcv = dc*radius.r1r0sq;

(i.e., change dVeff to r1r0sq).  Many thanks to Valentina Luridiana and Monica Relaņo for discovering the problem.

2000 March 23.  The inward and total optical depths of the HeI l10830Å line were initialized to large values in a static spherical geometry.  This inhibited convergence in low-density models.  Edit routine tauout.c and delete lines 582 through 587.  The block to delete is the following

	/* HeI 10830 when static */
	if( sphere.lgStatic )
		he3tau[IPT10830-1].TauIn = 100.;
		he3tau[IPT10830-1].TauTot = 200.;

This only affects static spherical geometries, and its main effect was to slow convergence.  Many thanks to Valentina Luridiana for discovering the problem.

2000 March 21.  Internal testing found that underflow on 32 bit machines could cause a correct mathematical expression to overestimate the continuum pumping rate for permitted lines.  This did affect predictions at the 10-15% level in models that were optically thin in the Lyman lines.  To protect against this, edit routine RTMakeStat and change line 105 from

    if( t->dTau * radius.dReff > 0. )
    if( t->dTau * radius.dReff > 1e-8 )

similarly, change line 147 from

    if( t->dTau * radius.dReff > 0. )
    if( t->dTau * radius.dReff > 1e-8 )

2000 March 9.  The code will crash if the grain abundance is less than 1E-38 of its ISM value.  Logic has been added to detect this condition and stop with an explanation of why.  It is better to turn off grains rather than setting their abundances to extremely low values.  Thanks to Mizuki Isogai for discovering this problem.

2000 March 1.  Command keywords that end in trailing spaces are not recognized when no trailing space is entered.  As an example, in the command "print on" the keyword is actually "on " with spaces on either side of the "on".  The keyword will not be recognized if the last space is not entered.  This will be fixed in the next update, but for now simply add trailing spaces to such commands.

Many thanks to Pasquale Panuzzo for discovering this problem.

2000 Feb 17.  Internal testing found that overflow could cause a floating exception on HP machines, like UK's SDX.  This happened when a line's wavelength in Angstroms was greater than a long int of the platform.  This only occurs on HP machines, and this fix need not be done for other machines.  On an SPP edit iwavlen.c, and include the header file limits.h:  at the top of the file include the line

#include <limits.h>

after line 14 add the following code

if( t->WLAng >= LONG_MAX )
	/* set to zero if larger than a long int */
	return( 0 );

This does not affect any predictions, only the overflow exception, and only on HP platforms.

2000 Jan 1.  Internal testing found certain parameters where the code could crash due to overflow.  This happens when the outer edge of the model occurs within the HeII zone of the nebula.  

Edit routine lindst.c and add the following include at line 13:

#include "facexp.h"

Next change "opac.tmn" near line 41 to "facexp.ExpZone".  The statement will then read

rfield.outlin[ipnt-1] += (float)(xInten/(rfield.anu[ipnt-1]*EN1RYD)*

This does not affect predictions, only the overflow exception.

Hit Counter
Last changed 03/31/03.
Return to the Cloudy Home Page.
Copyright 1978-2003 Gary J. Ferland