From: Bill P. <pa...@ki...> - 2011-03-11 05:34:14
|
On Mar 10, 2011, at 9:02 PM, Theodore Arthur Sande wrote: > Dear mesa-users, > > I have a simple question. I wish to define a new controls namelist variable, > e.g. average_h1_min, that specifies the minimum value for average_h1, beyond > which evolution should be terminated. > > I assume this is simple to do. Should just experiment with the suggestions > adumbrated in "8. Adding your own code to control MESA star"? Or must I make > modifications somewhere else in the code requiring recompilation? The key point > is that I wish to have the numeric value read from the controls namelist. Hi, Good question. Looks like I better add "xa_average_upper_limit_species" in addition to the current "xa_central_upper_limit_species" and "xa_surface_lower_limit_species". But you don't have to wait for me to make a new release if you are willing to write a few lines yourself. In your work/src directory you'll find run_star_extras.f. It has a line include 'standard_run_star_extras.dek' that you now should replace by the contents of star/public/standard_run_star_extras.dek Then find the 'extras_check_model' routine. In that routine you'll find the following lines: if (.false. .and. s% star_mass_h1 < 0.35d0) then ! stop when star hydrogen mass drops to specified level extras_check_model = terminate write(*, *) 'have reached desired hydrogen mass' return end if Replace by these: if (s% star_mass_h1/s% star_mass <= s% x_ctrl(1)) then ! stop when star hydrogen mass fraction drops to specified level extras_check_model = terminate write(*, *) 'have reached desired hydrogen mass fraction' return end if In your inlist, you should set x_ctrl(1) to your desired limit. Now do ./mk in your work directory and give it a try. Let me know how it goes. Cheers, Bill |