[mesa-users] PP vs CNO
Josiah Schwab
jwschwab at berkeley.edu
Mon Nov 3 18:32:05 EST 2014
Hi Willie,
> I am trying to prepare an exercise based on
> http://mesastar.org/teaching-materials/graduate-course-berkeley/pp-vs-cno
> posted last year by Josiah.
>
> &controls contains the following section
>
> ! tune nuclear networks
> ! rate_factor = 0 means fully off
> ! rate_factor = 1 means fully on
> net_pp_rate_factor = 1
> net_cno_rate_factor = 1
>
> I have to comment the last two lines to get the inlist to run.
>
> A search of $MESA_DIR/star/defaults finds no record of those controls
> in 6794.
Yes, this type of category based control appears to have been removed in
r6566, so I think r6208 is the last release where it is trivial to scale
the pp, cno, etc. rates.
> In $MESA_DIR/star/defaults/star_job.defaults lines 1472 - 1480 I find
>
> !### num_special_rate_factors
> !### reaction_for_special_factor
> !### special_rate_factor
> ! For using other special rate factors.
> ! `num_special_rate_factors` must be <= `max_num_special_rate_factors`.
>
> num_special_rate_factors = 0
> reaction_for_special_factor(:) = ''
> special_rate_factor(:) = 1
>
> Is this a new and improved version of those controls?
These factors are for specific (single) rates. To use them you set the
reaction_for_special_factor to the name of a reaction. The valid names
in a net are the strings shown in the 'name' column of the image that
you attached. The approach you showed with category name names won't
work with this variable.
As far as I can tell, there's no way to easily scale the rates of a
whole category of reactions like you used to be able to do. (Which
isn't unreasonable, such a thing isn't very physical.)
Three ways to do something similar come to my mind. If others have
suggestions, do chime in.
If you're willing to write out all of the reactions in a category by
name, you can just do it in the inlist. For example, to turn off the pp
chain, you might use something like
,----
| num_special_rate_factors = 8
|
| reaction_for_special_factor(1) = 'r34_pp2'
| reaction_for_special_factor(2) = 'r34_pp3'
| ...fill in the rest...
| special_rate_factor(:) = 0.0
`----
Somewhat similarly, you could have the students make a copy of the
basic.net file, and then edit it, commenting out sets of reactions that
you want to remove. (This is likely a little fiddly, especially with
the hard-wired nets.)
As usual, my preferred solution involves using run_star_extras.f. If
you are already distributing a work directory to the students, this may
even be the easiest.
Here's an extras_startup function that provides per-category scaling (at
least for the 3 categories you mentioned). I did a minimal check with
r6794 and it seemed to be doing as I intended.
,----
| integer function extras_startup(s, id, restart, ierr)
|
| use chem_def, only : ipp, icno, i3alf
| use net_def, only : Net_General_Info, get_net_ptr
| use rates_def, only: reaction_categories
|
| integer :: i, net_id
| type (Net_General_Info), pointer :: g
|
| type (star_info), pointer :: s
| integer, intent(in) :: id
| logical, intent(in) :: restart
| integer, intent(out) :: ierr
|
| ierr = 0
| call get_net_ptr(s% net_handle, g, ierr)
| if (ierr /= 0) return
|
| ierr = 0
| extras_startup = 0
| if (.not. restart) then
| call alloc_extra_info(s)
| else ! it is a restart
| call unpack_extra_info(s)
| end if
|
| do i = 1, g% num_reactions
| net_id = g% reaction_id(i)
| if (net_id > 0) then
| select case (reaction_categories(net_id))
| case (ipp)
| s% rate_factors(i) = s% x_ctrl(1)
| case (icno)
| s% rate_factors(i) = s% x_ctrl(2)
| case (i3alf)
| s% rate_factors(i) = s% x_ctrl(3)
| case default
| continue
| end select
| end if
| end do
|
| end function extras_startup
`----
and then your inlist might look like
,----
| ! tune nuclear networks
| ! 0 means fully off
| ! 1 means fully on
| x_ctrl(1) = 1 ! pp chain
| x_ctrl(2) = 0 ! cno cycle
| x_ctrl(3) = 0 ! triple alpha
`----
with the x_ctrl variables taking place of the old controls.
Hope that helps,
Josiah
More information about the Mesa-users
mailing list