[mesa-users] extra heat source in mesa star
Bill Paxton
paxton at kitp.ucsb.edu
Thu Dec 9 13:26:58 EST 2010
Hi Yevgeni,
As you know, there are a couple of simple schemes for adding energy, either uniformly by setting the 'extra_power_source' control or near surface to model irradiation by setting 'flux_for_hemisphere_irradiation'. But your case goes beyond those.
The general scheme for adding extra heat involves writing a few lines of code. Look at star/public/other_energy.f. The routine 'do_other_energy' is called from inside star to set the vector 's% extra_heat'. The value of s% extra_heat(k) is in ergs/g/sec; it will be added to the energy generation term for cell k along with nuclear reactions. You'll want to change that to set extra_heat(k) according the your rule. You can access information such as the radius for the outer edge of cell k as s% r(k). Here is a little example that turns on extra heat depending on radius.
subroutine do_other_energy(s, ierr)
! set s% extra_heat(k) to ergs/g/sec average for cell k
use const_def, only: Rsun
type (star_info), pointer :: s
integer, intent(out) :: ierr
integer :: k
ierr = 0
! here is an example of calculating extra_heat for each cell.
do k = 1, s% nz
if (s% r(k) > 0.7*Rsun .and. s% r(k) < 0.9*Rsun) then
s% extra_heat(k) = 1d3*exp(-10*(s% r(k) - 0.8*Rsun)**2) ! 10^3 erg/g/s at peak
end if
end do
s% d_extra_heat_dlnd(:) = 0 ! obsolete and will go away in future release
s% d_extra_heat_dlnT(:) = 0 ! obsolete and will go away in future release
end subroutine do_other_energy
After you edit other_energy.f, change to the mesa/star/test directory and do
./mk
./ck
./export
The ./ck should not produce any output (that means it is okay).
The ./export makes your changes available to your work directories.
In the not-too-distant future I'll be changing the way this works to make it a bit easier (by using the Fortran2003 feature of having pointers to procedures as elements of derived types). But until then, you'll need to go through the sequence of edit, make & export from star/test, and then remake and run in your work directory.
Let me know how it goes!
Cheers,
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20101209/de560738/attachment.html>
More information about the Mesa-users
mailing list