[mesa-users] grad_mu
Martin C.
martincs14 at gmail.com
Thu Aug 4 16:33:47 EDT 2016
Hi all,
How might I obtain/compute grad_mu in MESA?
There is s% gradL_composition_term, which according to
http://www.phys.huji.ac.il/~waldman/research/mesabrowser/html_code/include/star_data.inc.html
is
real(dp), pointer :: gradL_composition_term(:)
! in the literature, this term is often written as phi/delta*gradmu
But I would like just grad_mu which is dlnmu/dlnP I think.
Can I calculate it with a routine like this or is this nonsense?
subroutine calc_my_gradmu(my_gradmu, s)
implicit none
integer :: i
type (star_info), pointer :: s
real(dp) :: my_gradmu(s% nz), dP(s% nz), dmu(s % nz)
do i = 2, s% nz - 1
dP(i) = s% P(i-1) - s% P(i+1)
dmu(i) = s% mu(i-1) - s% mu(i+1)
end do
dP(1) = s% P(1)- s% P(2)
dP(s% nz) = s% P(s% nz-1) - s% P(s% nz)
dmu(1) = s% mu(1)- s% mu(2)
dmu(s% nz) = s% mu(s% nz-1) - s% mu(s% nz)
do i = 1, s% nz
my_gradmu(i) = s% P(i) / s% mu(i) * dmu(i) / dP(i)
end do
end subroutine calc_my_gradmu
thanks,
Martin
--
Martin C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20160804/56d1f260/attachment.html>
More information about the Mesa-users
mailing list