Fail to output the temperature when model_type is 'EVOL'

Bug/problem reports for any of the GYRE executables (gyre_ad, gyre_nad, etc)
Post Reply
stefano
Posts: 8
Joined: Sat Feb 09, 2019 5:24 pm

Fail to output the temperature when model_type is 'EVOL'

Post by stefano » Fri Mar 15, 2019 5:27 pm

I was experimenting with the output of GYRE, in particular, mode_item_list in &ad_output. According to the documentation below

https://bitbucket.org/rhdtownsend/gyre/ ... es%20(6.0)

If model_type is 'EVOL', then I can request the temperature as output in details_item_list, however, when I do so I get the error below

Code: Select all

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7fe08cf7627f in ???
#1  0x4bf127 in ???
#2  0x42f783 in ???
#3  0x4e7bb1 in ???
#4  0x4e78cc in ???
#5  0x4588f5 in ???
#6  0x4072d3 in ???
#7  0x40851d in ???
#8  0x40575f in ???
#9  0x404c56 in ???
#10  0x7fe08cf623d4 in ???
#11  0x404c86 in ???
#12  0xffffffffffffffff in ???
srun: error: cnode3: task 0: Segmentation fault (core dumped)
GYRE runs well if I do not ask for the temperature in the output. In contrast, GYRE has no problem when I ask for the other outputs available when model_type is 'EVOL', that is, M_star, R_star, L_star, M_r , P, rho.

I think it would be handy to also get the temperature.

I have attached the FGONG stellar model and the gyre.in I used.
Attachments
FGONG_and_GYRE.IN.zip
(5.94 MiB) Downloaded 6 times

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

Re: Fail to output the temperature when model_type is 'EVOL'

Post by rhtownsend » Wed Mar 20, 2019 10:21 am

Hi Stefano --

Thanks for the report. I'll look into this (and also the problem with FGONG vs FAMDL frequencies).

cheers,

Rich

warrick
Posts: 51
Joined: Wed Aug 28, 2013 2:47 am

Re: Fail to output the temperature when model_type is 'EVOL'

Post by warrick » Wed Mar 20, 2019 10:25 am

Hi Stefano,

The main issue looks like a genuine bug: I also get an error when I try to add T as an output option for an FGONG file. So the documentation is advertising something that doesn't appear to be available, unless we've both missed some extra parameter.

From what I can see, the problem is that GYRE evaluates the temperature in the model using this expression (in gyre_evol_model.fpp)

Code: Select all

    T = (3._WP*this%coeff(I_BETA_RAD, pt)*this%P(pt)/A_RADIATION)**0.25_WP
but the BETA_RAD coefficient isn't defined when reading FGONG files (or FAMDL files, actually). I haven't experimented with hacking a fix.

By the way, you seem to be mixing up references to the documentation for GYRE 5.x and 6.x... I wasn't aware that the documentation for 6.0 existed! I can see that `details_item_list` has replaced `mode_item_list` but your inlists use `mode_item_list`, which implies that you're using 5.x. Please try to be consistent.

Finally, if you want to look around inside GYRE to find where problems like this are happening (at a small computational cost), you can build GYRE with more debug output by setting DEBUG?=yes in $GYRE_DIR/src/build/Make.inc.

Cheers,
Warrick

warrick
Posts: 51
Joined: Wed Aug 28, 2013 2:47 am

Re: Fail to output the temperature when model_type is 'EVOL'

Post by warrick » Wed Mar 20, 2019 10:39 am

Hi again Stefano,

The following modifications will allow you to get T from FGONG files, at least in GYRE 5.2, which is what I'm using. The way I did this was in essence to compare $GYRE_DIR/src/model/gyre_fgong_file.fpp with $GYRE_DIR/src/model/gyre_mesa_file.fpp and add lines related to beta_rad to gyre_fgong_file.fpp. First, this means we need to declare a variable, so I modified the preamble:

Code: Select all

...
    real(WP), allocatable       :: nabla_ad(:)
    real(WP), allocatable       :: beta_rad(:) ! I added this line
    real(WP), allocatable       :: delta(:)
...
Then I added a line to evaluate beta_rad, in this case before Omega_rot is allocated:

Code: Select all

...
    end where

    beta_rad = A_RADIATION*T**4/(3._WP*P) ! I added this line

    allocate(Omega_rot(n))
...
Finally, I added the line to "define" beta_rad is GYRE's sense.

Code: Select all

...
    call em%define(I_DELTA, delta)
    call em%define(I_NABLA_AD, nabla_ad)
    call em%define(I_BETA_RAD, beta_rad) ! I added this line

    call em%define(I_OMEGA_ROT, Omega_rot)
...
If you make these changes, don't forget to recompile GYRE.

You can probably make similar changes to FAMDL if you want the variable to be available in this case.

Rich can comment on whether this is the right thing to do but it worked for me without obviously breaking anything else.

Cheers,
Warrick

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

Re: Fail to output the temperature when model_type is 'EVOL'

Post by rhtownsend » Wed Mar 20, 2019 11:03 am

warrick wrote:
Wed Mar 20, 2019 10:25 am
Hi Stefano,

The main issue looks like a genuine bug: I also get an error when I try to add T as an output option for an FGONG file. So the documentation is advertising something that doesn't appear to be available, unless we've both missed some extra parameter.

From what I can see, the problem is that GYRE evaluates the temperature in the model using this expression (in gyre_evol_model.fpp)

Code: Select all

    T = (3._WP*this%coeff(I_BETA_RAD, pt)*this%P(pt)/A_RADIATION)**0.25_WP
but the BETA_RAD coefficient isn't defined when reading FGONG files (or FAMDL files, actually). I haven't experimented with hacking a fix.
Yep, that's right -- I had overlooked setting BETA_RAD for FGONG files. The fix is simple -- replace $GYRE_DIR/src/model/gyre_fgong_file.fpp with the attached file. (Of course, a more-permanent fix will be incliuded in the next release of GYRE).
By the way, you seem to be mixing up references to the documentation for GYRE 5.x and 6.x... I wasn't aware that the documentation for 6.0 existed! I can see that `details_item_list` has replaced `mode_item_list` but your inlists use `mode_item_list`, which implies that you're using 5.x. Please try to be consistent.
The Wiki pages for 6.0 are in preparation for the next public release. They're not to be trusted at the moment, as they are still in a state of flux!
Finally, if you want to look around inside GYRE to find where problems like this are happening (at a small computational cost), you can build GYRE with more debug output by setting DEBUG?=yes in $GYRE_DIR/src/build/Make.inc.
Thanks for bringing this to people's attention -- the debugging output often helps diagnose problems.

cheers,

Rich
Attachments
gyre_fgong_file.fpp.gz
(1.8 KiB) Downloaded 6 times

Post Reply