Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ conserving total angular momentum. See
Bug Fixes
---------

When ``add_double_points_to_pulse_data`` is enabled, the composition
gradient used to place double points (see
:ref:`reference/controls:threshold_grad_mu_for_double_point`) is now
evaluated from the mean molecular weight of the composition alone,
``abar/(1 + zbar)``, rather than from ``mu`` (which includes the free
electrons supplied by the EOS). Previously, partial ionization zones
could trigger double points where the composition is uniform,
introducing spurious density discontinuities into exported pulsation
models; as faces crossed the threshold from one model to the next,
oscillation frequencies could jump discontinuously. Pulsation models
with double points may therefore differ from those written by earlier
versions.

Fixed a regex parsing issue in `shmesa change` that prevented controls like
`x_ctrl(1)` from being parsed correctly.

Expand Down
5 changes: 4 additions & 1 deletion star/defaults/controls.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@
! threshold_grad_mu_for_double_point
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

! threshold in grad_mu = dln(mu)/dln(P) for a double point to be written
! threshold in grad_mu = dln(mu)/dln(P) for a double point to be written. Here
! mu is the mean molecular weight of the composition alone (``abar/(1 + zbar)``,
! i.e. assuming full ionization), so that ionization zones do not trigger double
! points

! ::

Expand Down
14 changes: 11 additions & 3 deletions star/private/pulse_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ subroutine set_segment_indices (s, k_a, k_b, include_last_face)

logical, parameter :: dbg = .false.

real(dp) :: mu_comp(s%nz)
real(dp) :: grad_mu(s%nz)
logical :: mask(s%nz)
integer :: k
Expand All @@ -61,16 +62,23 @@ subroutine set_segment_indices (s, k_a, k_b, include_last_face)

if (s%add_double_points_to_pulse_data) then

! Calculate grad_mu
! Calculate grad_mu from the mean molecular weight of the
! composition alone, assuming full ionization. Using s%mu
! (which includes the free electrons supplied by the EOS)
! would also flag ionization zones, where the composition is
! uniform; double points placed there introduce spurious
! density discontinuities

mu_comp = s%abar(1:s%nz)/(1d0 + s%zbar(1:s%nz))

grad_mu(1) = 0d0

do k = 2, s%nz-1
grad_mu(k) = log(s%mu(k)/s%mu(k-1))/log(s%Peos(k)/s%Peos(k-1))
grad_mu(k) = log(mu_comp(k)/mu_comp(k-1))/log(s%Peos(k)/s%Peos(k-1))
end do

if (include_last_face) then
grad_mu(k) = log(s%mu(s%nz)/s%mu(s%nz-1))/log(s%Peos(s%nz)/s%Peos(s%nz-1))
grad_mu(k) = log(mu_comp(s%nz)/mu_comp(s%nz-1))/log(s%Peos(s%nz)/s%Peos(s%nz-1))
else
grad_mu(k) = 0d0
end if
Expand Down
Loading