# [Mesa-users] Limiting the final radius of a simulation

Ali Pourmand pourmand at ualberta.ca
Wed Feb 15 19:48:59 UTC 2023

```Dear Ebraheem and Francis,

Thank you very much for your replies!
I had one question though, how do we specify what variable we are using
"when_to_stop_rtol" for? I tried it several times but it didn't have any
effect.
I have attached a sample inlist I am using.

On Wed, Feb 15, 2023 at 12:02 PM Ebraheem Farag <ekfarag at asu.edu> wrote:

> Hello Ali,
>
> If you're trying to stop at a specific radius, there are a few &controls
> <https://docs.mesastar.org/en/release-r22.11.1/reference/controls.html#photosphere-r-upper-limit> that
> can help:
>
> stop when photosphere_r is greater than this limit, in Rsun units
>
> photosphere_r_upper_limit = 1d99
>
>
> stop when photosphere_r is less than this limit, in Rsun units
>
> photosphere_r_lower_limit = -1d99
>
>
>
> You can set a tolerance on your stopping condition using the &controls
> <https://docs.mesastar.org/en/release-r22.11.1/reference/controls.html#when-to-stop-rtol>
>  'when_to_stop_rtol':
>
> Relative error criteria when hitting stop target time. The system will
> automatically redo with a smaller timestep to hit a stopping target. It
> calculates the following “error” term and retries if it is > 1.
>
> error = abs(value - target_value)/ &        (when_to_stop_atol + when_to_stop_rtol*max(abs(value),abs(target_value)))
>
> when_to_stop_rtol = 1d99
>
>
> in your case you could set.
>
> when_to_stop_rtol = 1d-2 # for 0.01 precision, I use 1d-3 typically...
>
>
> 'delta_lgR_limit' adjusts how large of a logarithmic change in the
> stellar radius is allowed in each solver timestep, so it might help the
> time resolution of your models, but won't exactly improve your stopping
> condition.
>
> I hope this helps!
>
> -EbF
>
>
> On Wed, Feb 15, 2023 at 11:24 AM Ali Pourmand via Mesa-users <
> mesa-users at lists.mesastar.org> wrote:
>
>> Hello,
>>
>>  I want to stop several different MESA runs at the same final
>> (photospheric) radius (with a certain precision), but since the physics is
>> slightly different in each, I can't stop at the exact same radius. I
>> realize that one could decrease the timesteps of evolution to achieve this,
>> but was wondering if there is an easier way to achieve this.
>>
>> I am already using the stop to limit the photospheric radius command, but
>> it always stops with a certain precision.
>>
>> What I want is a way to tell the code to stop when the photosphere
>> reaches 7+-0.01 solar radii , is there any command that could achieve that?
>> I tried delta_lgR_limit, but I don't think that does what I have in my
>> mind.
>>
>> best
>> Ali Pourmand
>> M.Sc. Student
>> University of Alberta
>> _______________________________________________
>> mesa-users at lists.mesastar.org
>>
>> https://urldefense.com/v3/__https://lists.mesastar.org/mailman/listinfo/mesa-users__;!!IKRxdwAv5BmarQ!YmagYdCG8_pS3vclu4IVf5A1KVI4YnXJrDXsGkGxNAo1nXX0t8RniyeS5XH7dQ03YuyYGOKa06ZVymwG9BU-jP-j\$
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20230215/61eb910f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inlist1
Type: application/octet-stream
Size: 2695 bytes
Desc: not available
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20230215/61eb910f/attachment.obj>
```