[Mesa-users] Unable to add extra heating to stars

Warrick Ball W.H.Ball at bham.ac.uk
Tue Dec 6 17:18:40 UTC 2022


Hi Shafaat,

I think this is closely related to the question you asked about a month ago [1] to which I replied [2] explaining that the `extra_heat` variable is now of a type from the automatic differentiation module.  I don't have a complete solution but in principle think what you need to do is assign the derivatives to things like `s% extra_heat(k)% d1Array(j)` where `j` is the index of the relevant variable.

The indices are defined from line 259 onward in `star_data/public/star_data_def.inc` and you can use those index names (you might need `use star_data_def` in your `run_star_extras.f90`). e.g., instead of

     s% d_extra_heat_dlnR00(k) = 0d0

I think you'd set

     s% extra_heat% d1Array(i_lnR_00) = 0d0

I stand to be corrected though, since I haven't used these `auto_diff` types myself.

That said, all the derivatives you're getting errors on so far are being set to zero, in which case I think you can just use something like

     s% extra_heat(k)% d1Array(:) = 0

This is a good question though, since I don't think this is adequately documented.  If nothing else, I'll update the module documentation for `auto_diff` to point to where the indices of the `auto_diff_real_star_order1` are found.

Cheers,
Warrick

[1] https://lists.mesastar.org/pipermail/mesa-users/2022-November/014153.html
[2] https://lists.mesastar.org/pipermail/mesa-users/2022-November/014154.html

___________

Warrick Ball
Postdoc, School of Physics and Astronomy
University of Birmingham, Edgbaston, Birmingham B15 2TT
W.H.Ball at bham.ac.uk
+44 (0)121 414 4552

On Tue, 6 Dec 2022, mesa-users at lists.mesastar.org wrote:

> Hello,
> I am trying to adapt codes from a paper and add extra heating to my stellar evolution model. However, whenever I try to make the file (./mk), I run into the following problem:
> 
> ➜  work ./mk
> 
> gfortran -Wno-uninitialized -fno-range-check -fmax-errors=7  -fprotect-parens -fno-sign-zero -fbacktrace -ggdb -finit-real=snan -fopenmp -fbounds-check -Wuninitialized -Warray-bounds -ggdb -ffree-form -ffree-line-length-none -x f95-cpp-input
> -I/Users/jareddiks/Downloads/mesa-r21.12.1/include -I../src -c ../src/run_star_extras.f90
> 
> ../src/run_star_extras.f90:103:36:
> 
> 
>   103 |              s% d_extra_heat_dlnR00(k) = 0d0
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlnr00' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:104:36:
> 
> 
>   104 |              s% d_extra_heat_dlnRp1(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlnrp1' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:105:36:
> 
> 
>   105 |              s% d_extra_heat_dlndm1(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlndm1' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:106:36:
> 
> 
>   106 |              s% d_extra_heat_dlnd00(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlnd00' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:107:36:
> 
> 
>   107 |              s% d_extra_heat_dlndp1(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlndp1' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:109:36:
> 
> 
>   109 |              s% d_extra_heat_dlnTm1(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlntm1' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> ../src/run_star_extras.f90:110:36:
> 
> 
>   110 |              s% d_extra_heat_dlnT00(k) = 0.
> 
>       |                                    1
> 
> Error: 'd_extra_heat_dlnt00' at (1) is not a member of the 'star_info' structure; did you mean 'extra_heat'?
> 
> compilation terminated due to -fmax-errors=7.
> 
> make: *** [run_star_extras.o] Error 1
> 
> 
> FAILED
> 
> 
> I'm guessing the following problem may be due to a version error. I've looked into the MESA change log but I'm not sure how to get rid of this error. 
> 
> 
> Is there any way I might just find a workaround/avoid it?  That would be really helpful. 
> 
> 
> Thank you!
> 
> 
> Regards,
> 
> Shafaat
> 
> 
>


More information about the Mesa-users mailing list