Ticket #4 (closed defect: worksforme)

Opened 1 year ago

Last modified 6 months ago

NaN in ion_solver

Reported by: rporter@pa.uky.edu Assigned to: somebody
Priority: major Milestone: C08.01
Component: H chemistry (deprecated) Version:
Keywords: Cc:

Description (Last modified by rjrw)

The below input will blow an assert in iso_continuum_lower, but this is a trickle down effect. The root cause (well, at least rooter) is that source[0] and source[1] are NaN at line 909 of ion_solver causing dense.xIonDense[0][0] and dense.xIonDense[0][0] to be NaN. There should be a catch for NaN before ion_solver exits. It took me a long time to find out what was going on. A NaN check in the right place would have gotten to the problem much more quickly. I put this code at line 769, it does the job:
for( i=0; i<ion_range; i++ )
{ /* is this blows, source[i] is NaN */
ASSERT( source[i] == source[i] ); }
Here's the input:
title BLR std
set nend 2500
iterate 3
phi(h) 6.000000
hden 12.000000
atom he-like element helium levels resolved 10
atom he-like element helium levels collapsed 40
agn 6.00 -1.40 -0.50 -1.0
background z=0
stop column density 23.000000
normalize to label "inci" 1215

Change History

12/21/06 17:53:21 changed by rporter

This is due to CO_init being called twice.

01/04/07 11:29:52 changed by gary

  • component changed from component1 to H chemistry.

(in reply to: ↑ description ) 06/25/07 13:43:02 changed by rjrw

  • description changed.

Replying to rporter@pa.uky.edu:

The below input will blow an assert in iso_continuum_lower, but this is a trickle down effect. The root cause (well, at least rooter) is that source[0] and source[1] are NaN at line 909 of ion_solver causing dense.xIonDense[0][0] and dense.xIonDense[0][0] to be NaN. There should be a catch for NaN before ion_solver exits. It took me a long time to find out what was going on. A NaN check in the right place would have gotten to the problem much more quickly. I put this code at line 769, it does the job: for( i=0; i<ion_range; i++ )
{ /* is this blows, source[i] is NaN */
ASSERT( source[i] == source[i] ); } Here's the input: title BLR std
set nend 2500
iterate 3
phi(h) 6.000000
hden 12.000000
atom he-like element helium levels resolved 10
atom he-like element helium levels collapsed 40
agn 6.00 -1.40 -0.50 -1.0
background z=0
stop column density 23.000000
normalize to label "inci" 1215

(in reply to: ↑ description ) 06/25/07 13:51:34 changed by rjrw

  • description changed.

Replying to rporter@pa.uky.edu:

...or you could just enable trapping at compile time (e.g. use the -Ktrap=fp argument to pgCC when compiling maincl.cpp) and it will automatically trap when a NaN gets generated anywhere.

06/25/07 13:53:28 changed by rjrw

...or you could just enable trapping at compile time (e.g. use the -Ktrap=fp argument to pgCC when compiling maincl.cpp) and it will automatically trap when a NaN gets generated anywhere.

06/25/07 14:26:47 changed by rjrw

  • description changed.

12/01/07 12:30:56 changed by rjrw

  • status changed from new to closed.
  • resolution set to worksforme.
  • milestone set to branch off C08.XX release.