Skip to content

Commit

Permalink
Update for mesa 23.05.01
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfarmer committed Jun 16, 2023
1 parent 3d48602 commit 8f76d1b
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 278 deletions.
13 changes: 8 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Currently supported MESA versions:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* 22.11.01

* 23.05.1

Then run::

Expand All @@ -34,6 +34,9 @@ You will now have a executable called ``bbq`` which can be ran with ``./bbq`` to
This file can be moved outside of the
source folder if wanted, it has no dependencies on the src folder.

Note that the test suite will likely only pass with the newest MESA version supported. This is due to changes in the reaction
rates between MESA versions which mean the test suite output needs updating for each release.


Documentation
~~~~~~~~~~~~~
Expand Down Expand Up @@ -65,10 +68,10 @@ There are currently four modes that can be ran, each mode has its own inlist opt
* hydrostatic


A note on inputs/outputs, the base units for all quantities are: temperatures in Kelvin, densities in g/cm^{-3}, time in seconds, and composition in abundances.
A note on inputs/outputs, the base units for all quantities are: temperatures in Kelvin, densities in g/cm^{-3}, time in seconds, and composition in mass fractions.
Some quantities may be in log10 when specified.

The current set of default options can be found in the ``defaults/`` folder. Like MESA if you change anythin in the ``defaults`` folder you must recompile
The current set of default options can be found in the ``defaults/`` folder. Like MESA if you change anything in the ``defaults`` folder you must recompile
``bbq`` for the changes to take effect.


Expand Down Expand Up @@ -103,13 +106,13 @@ Other inlists exist which specify the nuclear physics and EOS used.
BBQ inlist
~~~~~~~~~~

The ``bbq`` inlist is the main driver inlists and is where you set which mode to operate in as well as the nuclear network used.
The ``bbq`` inlist is the main driver inlist and is where you set which mode to operate in as well as the nuclear network used.

eos inlist
~~~~~~~~~~

The ``eos`` inlist is the same as the MESA EOS inlist and can contain anything that inlist specifies. It is the only inlist that allows
for nesting of other inlists.
for nesting of other inlists.
See `MESA's eos options <https://docs.mesastar.org/en/release-r22.11.1/reference/eos.html>`_ for the full set of supported options.


Expand Down
30 changes: 24 additions & 6 deletions src/lib_bbq.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module bbq_lib
public :: inputs_t,outputs_t
public :: net_setup, write_isos, write_iso_names, write_output, do_burn

real(dp), parameter :: ABS_ERR=1d-4

type inputs_t
integer :: id
Expand Down Expand Up @@ -351,12 +352,13 @@ end subroutine set_global_nuc_opts

subroutine do_burn(in, out, bbq_in, ierr)
type(inputs_t),intent(in) :: in
type(outputs_t),intent(out) :: out
type(outputs_t),intent(inout) :: out
type(bbq_t),target :: bbq_in
type(nuclear_t), pointer :: nuc=>null()
integer, intent(out) :: ierr

real(dp) :: eta, logRho, logT, Rho, T, xsum, eps_nuc, d_eps_nuc_dRho, d_eps_nuc_dT, avg_eps_nuc
real(dp) :: eta, logRho, logT, Rho, T, xsum, eps_nuc, d_eps_nuc_dRho, d_eps_nuc_dT, avg_eps_nuc, &
eps_neu

logical,parameter :: burn_dbg=.false.

Expand Down Expand Up @@ -444,14 +446,15 @@ subroutine do_burn(in, out, bbq_in, ierr)
bbq_in% stptry, bbq_in% max_steps, bbq_in% eps, bbq_in% odescal, &
.true., .false., burn_dbg, burn_finish_substep, &
ending_x, out% eps_nuc_categories, &
avg_eps_nuc, out% eps_neu, &
avg_eps_nuc, eps_neu, &
out% nfcn, out% njac, out% nstep, &
out% naccpt, out% nrejct, ierr)

if(out% nstep >= bbq_in% max_steps) ierr = -1

out% eps_nuc = avg_eps_nuc * in% time
out% xa = ending_x
out% eps_neu = eps_neu

call check_output(in, out, bbq_in, ierr)

deallocate(times,log10Ts_f1, log10Rhos_f1,etas_f1, log10Ps_f1, &
ending_x)
Expand All @@ -468,6 +471,22 @@ end subroutine burn_finish_substep

end subroutine do_burn

subroutine check_output(in, out, bbq_in, ierr)
type(inputs_t),intent(in) :: in
type(outputs_t),intent(inout) :: out
type(bbq_t),target :: bbq_in
integer, intent(inout) :: ierr

if(out% nstep >= bbq_in% max_steps) ierr = -1

if(abs(sum(out% xa) - 1.0) > ABS_ERR ) then
write(*,*) "Bad xa sum found", sum(out% xa),abs(sum(out% xa) - 1.0),ABS_ERR
ierr = -1
else
out% xa = out% xa/sum(out% xa)
end if

end subroutine check_output

subroutine write_isos(bbq_in, filename)
type(bbq_t) :: bbq_in
Expand Down Expand Up @@ -499,7 +518,6 @@ subroutine write_output(in, out, fout)
type(outputs_t) :: out
integer :: fout,j


write(fout,'(I0,1X,2(1pe26.16,1X))', ROUND='COMPATIBLE',ADVANCE='no') in% id, out% eps_nuc, out% eps_neu

do j=1, size(out% xa)
Expand Down
Loading

0 comments on commit 8f76d1b

Please sign in to comment.