Skip to content

Three component phase separation for ultramassive white dwarfs, part 2 - #863

Open
evbauer wants to merge 36 commits into
mainfrom
three_component_PS
Open

Three component phase separation for ultramassive white dwarfs, part 2#863
evbauer wants to merge 36 commits into
mainfrom
three_component_PS

Conversation

@evbauer

@evbauer evbauer commented Sep 30, 2025

Copy link
Copy Markdown
Member

Updated code in phase_separation.f90 and a new wd_o_ne_3_phase test suite.

Updated code in phase_separation.f90 and a new wd_o_ne_3_phase test suite.
@evbauer evbauer self-assigned this Sep 30, 2025
@evbauer

evbauer commented Sep 30, 2025

Copy link
Copy Markdown
Member Author

@mcastrotapia I've pushed a few "housekeeping" fixes to get the static analysis script to pass, so you might want to merge this branch into your fork to stay up to date.

Anyway, this PR will eventually be the one that merges the code into main once I get a chance to review the substance of the code. So I'll either leave comments/questions here for you or push changes directly on this branch. If you end up needing to push substantial code updates, you can open a new PR onto this three_component_PS branch, and then if we merge them those changes will eventually make their way into MESA main via this PR.

Thanks for submitting this code!

@mcastrotapia

Copy link
Copy Markdown

Thanks for the fixes and for reviewing the PR! I will merge the branch into my fork, and I'll be attentive to comments/questions and updates.

Comment thread star/private/phase_separation.f90 Outdated
Comment thread star/private/phase_separation.f90 Outdated
Comment thread star/private/phase_separation.f90 Outdated
Comment thread star/private/phase_separation.f90
Comment thread star/private/phase_separation.f90 Outdated
Comment thread star/private/phase_separation.f90 Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self for later: update run_star_extras, rn script, etc to make this a fully-fledged test case and integrate it into do1_test_source for the test suite.

Comment thread star/private/phase_separation.f90 Outdated
@evbauer

evbauer commented Apr 15, 2026

Copy link
Copy Markdown
Member Author

We'll also need to add some documentation of the new options in controls.defaults.

Comment thread star/private/phase_separation.f90 Outdated
Comment thread star/private/phase_separation.f90 Outdated
@evbauer

evbauer commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Converting the plain text .dat files to hdf5 has saved quite a bit of space. The previous files took up about 250 MB, and the hdf5 files now take up only 5.4 MB. This will probably save some time on file i/o as well. However, I'm now getting a crash in a call to set_micro_vars after 3 component phase separation gets underway in the test case, so I'll need to check if I've translated everything properly.

evbauer added 12 commits June 15, 2026 16:04
The rate of phase separation heating is somewhat mesh and timestep
dependent. It should get the integrated amount of energy right, but
we are not resolving the spatial and time scales over which it occurs.
This led to an undesirable behavior at small time steps where
crystallizing a zone could cause enough mixing to generate a transient
heating spike. When localized near the crystallization front, this
could re-melt previously crystallized material in an unphysical
way. The smoothing approach here redistributes this energy throughout
the inner half of the star, which should prevent re-melting, so we at
least get the right amount of energy into the stellar interior, while
we might not be precisely locating it in the right place.
This changes the default behavior somewhat, so I've included an
inlist flag in case somebody wants to turn this off to reproduce
previously published behavior.
Comment thread star/test_suite/wd_o_ne_3_phase/README.rst Outdated
@evbauer
evbauer marked this pull request as ready for review July 31, 2026 22:57
@evbauer
evbauer requested a review from rhdtownsend as a code owner July 31, 2026 22:57
@evbauer

evbauer commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

I believe we're finally ready on this one! (assuming the tests pass)

Perhaps we should add a changelog entry?

@VincentVanlaer VincentVanlaer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some small comments, which can be resolved easily or can be postponed. I think you should add a changelog entry, this feature certainly deserves it!

write(*,*) 'invalid phase_separation_option'
stop
end if

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need a check for ierr here, otherwise smooth_eps_phase_sep will hide the error. Since neither functions actually set ierr to anything else than zero, the ierr parameter could also be removed.

Comment on lines +607 to +615
if (components=='CONe') then
filename = trim(phase_sep_data_dir) // '/CONe_deltaO.h5'
else if (components=='NeOMg') then
filename = trim(phase_sep_data_dir) // '/NeOMg_deltaO.h5'
else if (components=='ONeNa') then
filename = trim(phase_sep_data_dir) // '/ONeNa_deltaO.h5'
else if (components=='COMg') then
filename = trim(phase_sep_data_dir) // '/COMg_deltaMg.h5'
end if

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how often these data reads are called. If it is on the order of 1 to 10s of times per run its probably fine. Otherwise we might want to keep this around in memory. This isn't a blocker for me to merge in since it is a new feature anyway (and disabled by default?) and leave it for a rainy day.

Comment on lines +7572 to +7574
! if true, redistribute all heating associated with phase
! separation evenly throughout the inner half of the white dwarf
! (prevents unphysical localized spikes at small time steps)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to document the choice for the inner half (could be arbitrary, but I think it would nice for the user to know why).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants