More helpful error messages when asking for impossible output

Suggestions for improvements, new features, etc.
Post Reply
User avatar
warrick
Posts: 84
Joined: Wed Aug 28, 2013 2:47 am

More helpful error messages when asking for impossible output

Post by warrick » Wed Mar 30, 2022 10:31 am

Hi,

Some stellar model formats don't support certain types of outputs. This is already described neatly in the documentation by the definition on the model capabilities page. But if the user actually tries to run some combinations, the code can either (a) report zero without mentioning that output isn't possible or (b) crash with a FPE or segfault.

For example, if I convert Model S to AMDL format and ask for `L_star` in the summary output, I quietly get a column of zeros.

If I ask for `W` or `eta`, I get

Code: Select all

...
#0  0x7eff5f6c874f in ???
#1  0x6e1b1b in __gyre_wave_MOD_dw_dx
	at /home/wball/code/gyre/6.0.1/src/build/gyre_wave.f90:1066
#2  0x6ea443 in __gyre_wave_MOD_eta._omp_fn.0
	at /home/wball/code/gyre/6.0.1/src/build/gyre_wave.f90:2564
#3  0x7eff5fcffde1 in GOMP_parallel
	at /home/user/sdk2-tmp/build/gcc/libgomp/parallel.c:171
#4  0x6d4ace in __gyre_wave_MOD_eta
	at /home/wball/code/gyre/6.0.1/src/build/gyre_wave.f90:2564
#5  0x49a7ca in cache_wave_
	at /home/wball/code/gyre/6.0.1/src/build/gyre_summary.f90:432
#6  0x49b503 in __gyre_summary_MOD_cache
	at /home/wball/code/gyre/6.0.1/src/build/gyre_summary.f90:352
#7  0x40bc78 in process_mode_ad
	at /home/wball/code/gyre/6.0.1/src/build/gyre.f90:423
#8  0x83dbd5 in __gyre_bracket_search_MOD_bracket_search
	at /home/wball/code/gyre/6.0.1/src/build/gyre_bracket_search.f90:185
#9  0x40a08d in gyre
	at /home/wball/code/gyre/6.0.1/src/build/gyre.f90:288
#10  0x40bcf7 in main
	at /home/wball/code/gyre/6.0.1/src/build/gyre.f90:54
Floating point exception (core dumped)
where the problem is possibly that `L_star` is zero in the offending line:

Code: Select all

    select type (ml => this%cx%model())
    class is (evol_model_t)
       t_dyn = sqrt(ml%R_star**3/(G_GRAVITY*ml%M_star))
       t_kh = (G_GRAVITY*ml%M_star**2/ml%R_star)/ml%L_star ! <- causes error, perhaps because ml%L_star is zero
    class default
       t_dyn = 1._WP
       t_kh = 1._WP
    end select
I haven't looked at the source recently so I'm not sure if it already has knowledge of the model capabilities. But I imagine there could be a versatile scheme to more gracefully handle the user asking for impossible outputs.

Happy to investigate further and open an issue (and maybe even a PR!).

Cheers,
Warrick

User avatar
rhtownsend
Site Admin
Posts: 397
Joined: Sun Mar 31, 2013 4:22 pm

Re: More helpful error messages when asking for impossible output

Post by rhtownsend » Mon Apr 04, 2022 12:37 pm

I'd love to see stuff like this fixed, but I don't think it's worth doing until I've implemented some significant changes to how models are represented. Those changes will bring the ability to query which model data are valid.

Post Reply