Skip to content

Commit

Permalink
Addresses #639, where free-bound emissivities were being calculated m…
Browse files Browse the repository at this point in the history
…ultiple times.

The basic fix was to increase the number of sets of fb emissivities that could be
stored.
  • Loading branch information
kslong committed Nov 17, 2019
1 parent 26e4790 commit 82579fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/python.h
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ xband;
#define NTEMPS 60 // The number of temperatures which are stored in each fbstruct
/* NSH this was increased from 30 to 60 to take account of 3 extra OOM
intemperature we wanted to have in fb */
#define NFB 10 // The maximum number of frequency intervals for which the fb emission is calculated
#define NFB 20 // The maximum number of frequency intervals for which the fb emission is calculated

struct fbstruc
{
Expand Down
10 changes: 8 additions & 2 deletions source/recomb.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,8 @@ init_freebound (t1, t2, f1, f2)
double xinteg_fb ();
int nput;

//OLD Log ("init_freebound %10.3e %10.3e %10.3e %10.3e\n", t1, t2, f1, f2);


if (nfb == 0)
{
Expand Down Expand Up @@ -930,15 +932,19 @@ been calculated for these conditions, and if so simply return.
*/
i = 0;
while ((freebound[i].f1 != f1 || freebound[i].f2 != f2) && i < nfb)
{

//OLD Log ("init_freebound: test: %d %10.3e %10.3e Want %10.3e %10.3e\n", i, freebound[i].f1, freebound[i].f2, f1, f2);
i++;
}

if (i < nfb)
{
return (0);
}

/* We have to calculate a new set of freebound data */
if (i == NFB - 1)
if (i == NFB)
{
/* We've filled all the available space in freebound so we start recycling elements, assuming that the latest
* ones are still likelyt to be needed
Expand All @@ -963,7 +969,7 @@ on the assumption that the fb information will be reused.
*/


Log ("init_freebound: Creating recombination emissivites between %e and %e\n", f1, f2);
Log ("init_freebound: Creating recombination emissivites between %e and %e in stucture element %d\n", f1, f2, nput);


freebound[nput].f1 = f1;
Expand Down

0 comments on commit 82579fc

Please sign in to comment.