# [mesa-users] boundary condition

Bill Paxton paxton at kitp.ucsb.edu
Thu Dec 16 12:30:48 EST 2010

```Hi 張世昕,

BTW: Forgive my ignorance, but could you provide me with a westernized name I can use when I send you mail?
I'm completely stumped by 張世昕     ;- )

On Dec 16, 2010, at 7:29 AM, 張世昕 wrote:

> 1. Because we are interested in the planet with a core, then need to modify the inner boundary condition.

That's a very interesting idea!   Up to now, I've only used non-standard inner boundary conditions
when I've been modeling the envelope of a neutron star, but the same scheme should work for
the rocky core of a giant planet.

You are the first person to ask about setting the inner BCs -- up to now, I'm the only one to have
used that feature!   So it may take us a few tries before I manage to explain it well enough for you.

I changed the inner BCs in 3 stages.   The numeric values in the following are for a neutron star,
so you'll of course need to change them for your case.

First, relax M_center to desired mass:
relax_M_center = .true.
new_mass = 1.4
dlgm_per_step = 1d-3
relax_M_center_dt = 3.1558149984d-1 ! secyer*1d-8

relax_R_center = .true.
new_R_center = 1d6 ! in cm
dlgR_per_step = 1d-2
relax_R_center_dt = 3.1558149984d-1 ! secyer*1d-8

Third, L_center to desired core luminosity -- depends on mdot.
relax_L_center = .true.
new_L_center = 1e33 ! in ergs/second
dlgL_per_step = 1d-2
relax_L_center_dt = 3.1558149984d-1 ! secyer*1d-8

The 'new_mass' is in Msun units.
dlgm_per_step and relax_M_center_dt determine how fast the value of M_center is changed
during the relaxation to the desired value.  If you try to change too fast, it will fail.  In that case,
you need to reduce dlgm_per_step and/or relax_M_center_dt.   This part is trial-and-error.

Once you've gotten it too successfully change M_center, then you can go on to doing R_center.
Again, it is a trial-and-error process to find values for dlgR_per_step and relax_R_center_dt
that will let the relaxation go to completion.

Finally, if you want heat flow out from the core, you can set L_center.  Otherwise,
you can just let L_center = 0 to thermally disconnect the core from the rest.

> 2. I wonder where to find the source code relates to the "mass_change" in the &controls namelist.

You are welcome to look at the private source code, but think twice before making changes!
Once you modify that code, you are on your own in that the mesa developers won't be able (or willing)
to help you with code that you have changed in the private files.

That said, the mass change code is in star/private/adjust_mass.f

> 3. When I use "simple_photosphere" instead of "tau_100_table" in the "very_low_mass" module,
>     something wrong with the timestep.

That's an excellent one!  The "very_low_mass" test case assumes use of the non-grey atmosphere tables.
It uses starting models from mesa/data/star_data/very_low_mass_models which are all created
using the "tau_100_table" option.  That option puts the outer edge of the model at an optical depth of 100.
When you switch to "simple_photosphere", the outer edge of the model jumps abruptly to an
optical depth of 2/3.  And it turns out that the change from 100 to 2/3 is too big for the code to deal
with in a single step.   That is leading to convergence failures, which in turn cause the code to try
using a smaller timestep.  But even reducing the timestep isn't enough, so the code eventually such a
small timestep that it gives up.

I think this is another case where we need to let the model "relax" to what we want.  So at the same time
that you switch from tau_100_table to simple_photosphere, let's tell the system to use tau=100 for
the outer surface.   We do that by the following controls in the &star_job part of the inlist:

new_tau_factor = 150
set_tau_factor = .true. ! change tau_factor without reconverging.

The surface optical depth will now be = (2/3)*150 = 100.

If that works, then relax the tau_factor down from 150 to 1 by the following:
relax_tau_factor = .true. ! gradually change tau_factor, reconverging at each step.
new_tau_factor = 1
dlogtau_factor = 0.1 ! change log10(tau_factor) by at most this amount per step

The 'dlogtau_factor' determines how fast the relaxation process changes the tau_factor;
you may have to reduce it if the code has trouble converging.

Please let me know how it goes.   Using mesa to do what you propose is very exciting, but it won't be easy to get going!
However, I think if you stick with it, you'll be able to get some nice results.

Best wishes,
Bill Paxton

```