Skip to content

reconstruct eos/kap on faces for mlt/tdc#987

Open
Debraheem wants to merge 14 commits into
mainfrom
EbF/mlt_tdc_face
Open

reconstruct eos/kap on faces for mlt/tdc#987
Debraheem wants to merge 14 commits into
mainfrom
EbF/mlt_tdc_face

Conversation

@Debraheem
Copy link
Copy Markdown
Member

This branch was birthed out of doing some testing with tdc pulsations, where I was benchmarking where TDC decoupled versus RSP.

At the moment, TDC and mlt used P and kap and other quantites which are averaged onto cell faces. Probably more thermodynamically consistent is to use the face averaged T and rho to recalculate the opacity or eos, which is what use_face_values_eos_and_kap_mlt_tdc does in this pr.

Claim: using use_face_values_eos_and_kap_mlt_tdc allows mesa to converge significantly better on courser mesh, when the opacity or other eos quantity is not well resolved at the cell face.

Example:

Below i show a 9M cepheid which would be fine in RSP, because RSP is cell centered, but in MESA-TDC features in the mesh from a poorly interpolated opacity cause ringing in kappa -> gradr -> L -> Lc -> (unphysical oscillations in the pulsations). By using use_face_values_eos_and_kap_mlt_tdc, these features are eliminated. The only other solution I could find was to double or triple the mesh resolution in MESA to get similar smoothness to RSP at this particular resolution, and sometimes that wasn't enough.

light_curves_logL_vs_day

With use_face_values_eos_and_kap_mlt_tdc the face_averaged primitives T and rho etc, are used to computes the face eos and kap quantities using an additional eos call, instead of averaging the Pressure and opacity and other thermodynamic quantities on cell faces. This generates a more accurate reconstruction at the cost of an extra eos call. I refactored things such that we minimize the number of times eos calls are made though. This is done by storing the face values in global star pointers.

This is a dev control for now, but if it is useful for low resolution meshes, it could be potentially useful as a global default, pending testing and time.

The TDC_Cepheid_9M test case can be removed before this branch is merged, but it serves as a test case for now. (We can squash this pr as well, if we merge.)

@Debraheem Debraheem added kap Opacity module eos Equation of state module labels May 4, 2026
@Debraheem Debraheem requested a review from evbauer as a code owner May 4, 2026 22:48
@Debraheem Debraheem added the tdc label May 4, 2026
@Debraheem Debraheem requested review from rhdtownsend May 4, 2026 23:09
Comment thread star/private/hydro_temperature.f90 Outdated
Co-authored-by: Warrick Ball <W.H.Ball@bham.ac.uk>
@Debraheem
Copy link
Copy Markdown
Member Author

Debraheem commented May 26, 2026

Here is a graphic of what this pr is attempting to do:

mlt_tdc_face_reconstruction_with_opacity_bump

@Debraheem
Copy link
Copy Markdown
Member Author

A few more extreme examples of what undersampling an opacity bump might look like. The point is that, this undersampling can happen with any reconstructed quantity be it from the opacity or any of the many eos quantities including the face pressure. Having a mesh that accurately resolves all of these is much more complicated, and potentially expensive than reconstructing them self consistently. However, In the limit of infinite mesh density, the old averaging procedure should reproduce the results of this new approach.

mlt_tdc_opacity_bump_variants

@Debraheem
Copy link
Copy Markdown
Member Author

Debraheem commented May 26, 2026

This is all made worse when the model is not hydrostatic, and a fixed lagrangian mass shell moves back and forth across one of these bumps, in which case the model can switch back and forth between under to over predicting the opacity depending on the location of the cells with respect to a feature in the opacity or any other quantity. My example I shared above of a pulsating Cepheid is one where the opacity being underesolved leads to oscillations kap_face -> gradr -> oscillations in the Lc and Lr coming out mlt/tdc.

Obviously remesh can help avoid this, but if you're remeshing scheme is not helping conserve a particular eos/kap quantity of interest, you might still run into this issue and not know it.

@fxt44
Copy link
Copy Markdown
Member

fxt44 commented May 29, 2026

oohh, i like this idea of interpolating the (T, rho) primitives, then calling the microphysics.

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

Labels

eos Equation of state module kap Opacity module tdc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants