rice-solar-physics / HYDRAD

HYDrodynamics and RADiation Code for computing solutions to field-aligned hydrodynamic equations in coronal loops
MIT License
9 stars 4 forks source link

Segfault with certain options #98

Open junverferth opened 1 year ago

junverferth commented 1 year ago

Issue: Picking both beam heating and power law radiation losses leads to a seg fault.

Cause: The changes to Radiation_Model/source/radiation.cpp from commit:b39b7a7 as part of pull #90 that added in a set of if statements determining when to initialize the radiation object. Selecting electron beam heating and power law radiation sets the condition that the radiation object is needed for ionization states in the beam calculation but never initialized.

Proposed Fix: Adding in Initialise( szFilename ); at the end of the else statement (line 40) fixes the issue, though in that case the set of if statements appears redundant.

jwreep commented 1 year ago

Perhaps the logic could be rearranged a tad.

if !defined (USE_POWER_LAW_RADIATIVE_LOSSES)

could be changed to

if !defined (USE_POWER_LAW_RADIATIVE_LOSSES) || (defined (BEAM_HEATING) && defined(USE_POWER_LAW_RADIATIVE_LOSSES))

if I got the syntax correct . . .

junverferth commented 1 year ago

Alternatively, #if defined(BEAM_HEATING) Initialise( szFilename ); else (current set of if statements)

that would ensure that whenever the beam is used, you get the ionization fractions, and then only if you need them on without a beam.

sjbradshaw commented 1 year ago

Thanks for debugging this. Much appreciated! I’ve updated the master HYDRAD repository on GitHub.

Cheers,

Steve

From: junverferth @.> Sent: Thursday, July 27, 2023 12:46 PM To: rice-solar-physics/HYDRAD @.> Cc: Subscribed @.***> Subject: Re: [rice-solar-physics/HYDRAD] Segfault with certain options (Issue #98)

Alternatively,

if defined(BEAM_HEATING)

Initialise( szFilename ); else (current set of if statements)

that would ensure that whenever the beam is used, you get the ionization fractions, and then only if you need them on without a beam.

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https:/github.com/rice-solar-physics/HYDRAD/issues/98*issuecomment-1654105256__;Iw!!BuQPrrmRaQ!nVB7rfsBZF5jobOhyowCKMmp-TBgEccXJboGZfcOFE7SReFaGY8cf8VN_b-SWph-vwf7MJVXsWj7gwBOlhr077syy1Em8I82z_o$ , or unsubscribe https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ACC6C7QKULGEVETUZQCRSJ3XSKSNRANCNFSM6AAAAAA22CP4JM__;!!BuQPrrmRaQ!nVB7rfsBZF5jobOhyowCKMmp-TBgEccXJboGZfcOFE7SReFaGY8cf8VN_b-SWph-vwf7MJVXsWj7gwBOlhr077syy1Emubedszo$ . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/ACC6C7SRIYQ34ALLBXVCXY3XSKSNRA5CNFSM6AAAAAA22CP4JOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTCS6SKQ.gif Message ID: @.***>