Skip to content

Commit e9ee5df

Browse files
committed
Fixes #262
Two changes have been made. - In run.c:parseInput(), a warning is generated if (!par->lte_only && par->nSolveIters<=par->nSolveItersDone && !allBitsSet(par->dataFlags, DS_mask_populations)). I.e. if the user has neither set pops values via a submitted grid file, nor requested any solver iterations. - In run.c:run(), gp[gi].mol[si].pops is malloc'd and filled with zeros whether par->doSolveRTE is set or not. Upshot of the changes are that, where previous the code would seg fault if the user left par->nSolveIters at default, now it will proceed, with a warning message. Any output images will contain zero contribution from line emission. An additional change: in run.c:run(), formerly the decision to set par->doSolveRTE depended on (par->nSolveIters>0 || par->lte_only), now it depends on (par->nSolveIters>par->nSolveItersDone || par->lte_only).
1 parent 1ce5905 commit e9ee5df

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/run.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,14 @@ exit(1);
978978

979979
par->edgeVelsAvailable=0; /* default value, this is set within getEdgeVelocities(). */
980980

981-
if(!silent && par->nSolveIters>0 && par->lte_only)
982-
warning("Requesting par.nSolveIters>0 will have no effect if LTE calculation is also requested.");
981+
if(!silent){
982+
if(par->lte_only){
983+
if(par->nSolveIters>0)
984+
warning("Requesting par->nSolveIters>0 will have no effect if LTE calculation is also requested.");
985+
}else if(par->nSolveIters<=par->nSolveItersDone && !allBitsSet(par->dataFlags, DS_mask_populations)){
986+
warning("No supplied pops values, and par->nSolveIters <= par->nSolveItersDone.");
987+
}
988+
}
983989

984990
/* Allocate moldata array.
985991
*/
@@ -1085,7 +1091,8 @@ exit(1);
10851091
par.doMolCalcs = (par.nLineImages>0);
10861092

10871093
}else{
1088-
if(par.nSolveIters>0 || par.lte_only) /* To save the user having to set par.doSolveRTE as well as par.nSolveIters>0 or par.lte_only. */
1094+
// if(par.nSolveIters>0 || par.lte_only) /* To save the user having to set par.doSolveRTE as well as par.nSolveIters>0 or par.lte_only. */
1095+
if(par.nSolveIters>par.nSolveItersDone || par.lte_only) /* To save the user having to set par->doSolveRTE as well as par->nSolveIters>0 or par->lte_only. */
10891096
par.doSolveRTE = TRUE;
10901097

10911098
par.doMolCalcs = par.doSolveRTE || par.nLineImages>0;
@@ -1146,8 +1153,10 @@ exit(1);
11461153
for(gi=0;gi<par.ncell;gi++){
11471154
for(si=0;si<par.nSpecies;si++){
11481155
gp[gi].mol[si].specNumDens = malloc(sizeof(double)*md[si].nlev);
1156+
gp[gi].mol[si].pops = malloc(sizeof(double)*md[si].nlev);
11491157
for(ei=0;ei<md[si].nlev;ei++){
11501158
gp[gi].mol[si].specNumDens[ei] = 0.0;
1159+
gp[gi].mol[si].pops[ei] = 0.0;
11511160
}
11521161
}
11531162
}

0 commit comments

Comments
 (0)