[Mesa-users] Equivalents to use_zero_dLdm_outer_BC in newer MESA releases
Ebraheem Farag
ekfarag at asu.edu
Fri Jul 12 15:12:00 UTC 2024
Hi Benjamin,
I apologize for leading you astray, you are correct in that this is
probably not the best way to reimplement this feature.
It seems the best, most immediate way to reimplement this boundary
condition is to directly modify the internal star routines, although I
don't know how well it will behave without some testing. I have given it
one try for you, but that is all I can offer. Anything further will
probably have to be done as a feature request on the MESA github,
https://github.com/MESAHub/mesa/issues.
I've attached a modified version of the hydro_eqns.f90 file contained
inside $MESA_DIR/star/private/ and a diff.txt file showing the differences
between this file and the default shipped with MESA.
to implement this, paste this file into $MESA_DIR/star/private/,
------
cd $MESA_DIR/star/
./clean
./mk
./export
------
then go to your model directory and turn "s% lextra(1) = .true." in your
run_star_extras.f90 to toggle this boundary condition, you can decide where
and when for yourself :).
I have only tested that this compiles and doesn't interfere with the normal
run of a test_suite model, i.e. I have barely tested this, so be ready if
you encounter issues, and it's probably best to double check my work in
case I haven't implemented this correctly. Anything further will have to be
done/documented on the github. Another thing to note is that, this bc might
not make the difference between your model converging or not, so be
prepared when nothing changes and your model crashes for another reason
that looks similar.
best of luck.
-EbF
On Thu, Jul 11, 2024 at 5:37 PM Benjamin Herfray <
benjamin.herfray at mail.mcgill.ca> wrote:
> Hi Ebraheem,
>
> Thank you for your help. If I understand correctly, the
> use_other_surface_PT hook requires us to impose a fixed outer temperature
> and pressure boundary condition, which in my specific case I do not want to
> do. Though please correct me if I am wrong and there is a way to implement
> the hook without fixing T and p. If not, do you know if this can be
> achieved with any other hooks that allow for more freedom---i.e. , not
> requiring us to fix T and p?
>
> Thanks,
> Benjamin
> ------------------------------
> *From:* Ebraheem Farag <ekfarag at asu.edu>
> *Sent:* Tuesday, 9 July 2024 17:17
> *To:* Benjamin Herfray <benjamin.herfray at mail.mcgill.ca>
> *Cc:* mesa-users at lists.mesastar.org <mesa-users at lists.mesastar.org>
> *Subject:* Re: [Mesa-users] Equivalents to use_zero_dLdm_outer_BC in
> newer MESA releases
>
> You don't often get email from ekfarag at asu.edu. Learn why this is
> important
> <https://urldefense.com/v3/__https://aka.ms/LearnAboutSenderIdentification__;!!IKRxdwAv5BmarQ!cuxQa-duJlEj3WjSXds7NmwygGu1pz4rWuX2_ZpuPgBSZwuJmLoVq7ScHKFe7iICoi9bpNr5B4fCAR-lhQHLckrI8pQaBOb_ijXL$>
> Hi Benjamin,
>
> This boundary condition was probably removed during some pruning (from
> r15140 -> r21.12.1, one of the biggest internal clean ups of the code base
> since its inception) as it was not being used. You can probably reimplement
> it using a use_other_surface_PT hook in the run_star_extras.f90 similar
> to how the boundary conditions on the conductive flame test suite are
> implemented, see
> https://docs.mesastar.org/en/release-r24.03.1/test_suite/conductive_flame.html
> <https://urldefense.com/v3/__https://docs.mesastar.org/en/release-r24.03.1/test_suite/conductive_flame.html__;!!IKRxdwAv5BmarQ!cuxQa-duJlEj3WjSXds7NmwygGu1pz4rWuX2_ZpuPgBSZwuJmLoVq7ScHKFe7iICoi9bpNr5B4fCAR-lhQHLckrI8pQaBNZ2smGu$>
> .
>
> You just need to look into "./private/hydro_eqns.f90" in r15140, find "
> *subroutine* set_zero_dL_dm_BC" and paste it into your
> use_other_surface_PT hook in the run_star_extras.f90 and tweak
> accordingly.
>
> I hope this helps. If you feel this outer boundary condition is important
> and should be reimplemented into the code base as a default option, I
> suggest opening an issue thread on the MESA github
> https://github.com/MESAHub/mesa/issues
> <https://urldefense.com/v3/__https://github.com/MESAHub/mesa/issues__;!!IKRxdwAv5BmarQ!cuxQa-duJlEj3WjSXds7NmwygGu1pz4rWuX2_ZpuPgBSZwuJmLoVq7ScHKFe7iICoi9bpNr5B4fCAR-lhQHLckrI8pQaBAo9wdbq$>
> to make your case :).
>
> -EbF
>
> On Tue, Jul 9, 2024 at 9:34 AM Benjamin Herfray via Mesa-users <
> mesa-users at lists.mesastar.org> wrote:
>
> Hello MESA users,
>
> I've been trying to run simulations of stellar winds during type-I X-ray
> bursts using version r24.03.1. In order to try to counter problems with
> density inversions developing near the outer layers of the atmosphere I
> would like to impose boundary conditions on the luminosity—specifically, I
> would like to impose dL/dm = 0 at the outer boundary. This is similar to
> the methods described in Yu & Weinberg, 2018 (
> https://doi.org/10.3847/1538-4357/aad045
> <https://urldefense.com/v3/__https://doi.org/10.3847/1538-4357/aad045__;!!IKRxdwAv5BmarQ!bk6TKa_fsuOzH32gDnHkWkhQLjQmM6bCZbZybr_JO604FPuhKJvQSzGk7VrTAHXCwIi75agxEARks4mV3G_dXHZLO6M0iw$>)
> and Guichandut & Cumming, 2021 (https://doi.org/10.3847/1538-4357/ace43c
> <https://urldefense.com/v3/__https://doi.org/10.3847/1538-4357/ace43c__;!!IKRxdwAv5BmarQ!bk6TKa_fsuOzH32gDnHkWkhQLjQmM6bCZbZybr_JO604FPuhKJvQSzGk7VrTAHXCwIi75agxEARks4mV3G_dXHaJQJjRnA$>)
> who used older versions of MESA.
>
> Older versions of MESA (I believe up to r15140) have the control
> use_zero_dLdm_outer_BC to impose L(1) = L(2), however this was removed in
> subsequent versions with no explanation of the change in the changelog.
>
> Does anyone know why this was removed, and is there a combination of
> controls present in the current version of MESA that I can use to have the
> equivalent effect as use_zero_dLdm_outer_BC? Or would I have to implement
> this as a custom condition through run_star_extras?
>
> Thank you,
> Benjamin Herfray
> _______________________________________________
> mesa-users at lists.mesastar.org
>
> https://urldefense.com/v3/__https://lists.mesastar.org/mailman/listinfo/mesa-users__;!!IKRxdwAv5BmarQ!bk6TKa_fsuOzH32gDnHkWkhQLjQmM6bCZbZybr_JO604FPuhKJvQSzGk7VrTAHXCwIi75agxEARks4mV3G_dXHZtuWppvQ$
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20240712/24f6f7cf/attachment.htm>
-------------- next part --------------
804,807d803
< if (s% lxtra(1)) then
< call set_zero_dL_dm_BC(ierr)
< end if
<
1126,1147d1121
< subroutine set_zero_dL_dm_BC(ierr)
< integer, intent(out) :: ierr
< logical, parameter :: skip_partials = .false.
< include 'formats'
< ierr = 0
< if (s% L(1) <= 0d0) then
< resid_ad = s% L(1) - s% L(2)
< call save_eqn_residual_info( &
< s, 1, nvar, s% i_equL, resid_ad, 'set_zero_dL_dm_BC', ierr)
< if (.not. skip_partials) then
< call e00(s,s% i_equL,s% i_lum,1,nvar,1d0)
< call ep1(s,s% i_equL,s% i_lum,1,nvar,-1d0)
< end if
< return
< end if
< resid_ad = s% L(2)/s% L(1) - 1d0
< call save_eqn_residual_info( &
< s, 1, nvar, s% i_equL, resid_ad, 'set_zero_dL_dm_BC', ierr)
< if (skip_partials) return
< call e00(s,s% i_equL,s% i_lum,1,nvar,-s% L(2)/(s% L(1)*s% L(1)))
< call ep1(s,s% i_equL,s% i_lum,1,nvar,1d0/s% L(1))
< end subroutine set_zero_dL_dm_BC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hydro_eqns.f90
Type: application/octet-stream
Size: 47134 bytes
Desc: not available
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20240712/24f6f7cf/attachment.obj>
More information about the Mesa-users
mailing list