[mesa-users] how to personalize when mesa saves a new profile

Bill Paxton paxton at kitp.ucsb.edu
Wed Jun 5 11:56:10 EDT 2013

On Jun 5, 2013, at 2:56 AM, Diego Bossini wrote:

> Hi , Bill
> now seems everythings ok!
> many thanks!

excellent!  you are very welcome.   glad we found a solution.

> I take this opportunity to make you another question: 
> I would like to personalize when mesa saves a new profile, i.e. substituting the step in model_number with,
> for example, a step in center_h1 or in luminosity, or maybe a combination of several condition.
> Is it possible without change the standard mesa code?

you can do this in your run_star_extras.  

in the extras_finish_step routine, check to see if you want to save a profile.
if so, call save_profile in star_lib, or, if you have a specific filename,
call star_write_profile_info.    

The state information, such as center_h1 when last wrote a profile, 
can go in variables declared at the top level of run_star_extras
(before the "contains").  You can initialize them in extras_startup.

You'll want to set this up so that it works when you do ./re,
so you need to have the state information saved in photos
and restored on restarts.  The necessary machinery for that
is already available in the run_star_extras routines. 
Find the text 
	"routines for saving and restoring extra data so can do restarts"
Move the 3 integer parameter definitions to the top of the file 
and uncomment them.  Edit subroutine move_extra_info to have
calls on move_int for integer state variables, move_flg for
logical's, and move_dbl for double precision reals.

alloc_extra_info is called from extras_startup to allocate space 
for your state variables by calling star_alloc_extras.

store_extra_info is called from extras_finish_step to copy
your state into the s% extra arrays to be saved in photos.

unpack_extra_info is called from extras_startup when
doing a restart.  it restores your state variables by copying
them from the s% extra arrays that were saved in the photo.

Good luck!


More information about the Mesa-users mailing list