Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
lithium_tests.pl 8.24 KiB
#!/usr/bin/env perl
use 5.16.0;
use strict;
use rob_misc;
use binary_grid2;
use binary_grid::C; # backend : C or Perl
use Sort::Key qw(nsort);
use Histogram;
use Maths_Double;

# tests of the lithium code

# which tests to run?
pertests() if(0);

my %tests=(
    single_stars=>0,
    binary_stars=>1
    );

my $titles=1; # 0 for talk
my $fortalk=0; # set to 1 for annotations for the talk
#print gphead();exit;

# make population with default physics
my $population = binary_grid2->new(
    'lithium_hbb_multiplier'  => 1.0,
    'lithium_GB_post_1DUP'    => 0.0,
    'lithium_GB_post_Heflash' => 0.0,
    'gb_reimers_eta'          => 0.5,
    'nova_retention_fraction' => 1.0,
    'vb'                      => 1,
    'metallicity'             => 0.02,
    'max_evolution_time'      => 13700.0,
    'nthreads'                => rob_misc::ncpus(),
    'yields_dt'               => 1,
    );
$population->parse_args();


# star-by-star plots
my $starsdir='/tmp/listars';
mkdirhier ($starsdir);

my %isotopes = $population->isotope_hash();
my %cols = map { state $c=1; $_ => $c++ } ('t','M','M0','R',
					   'kw','ntp','XLi','epsLi',
					   'tagb');
my $Alabel = $fortalk ? 'A(Li)=log(Li/H)+12' : '{/Symbol e}_{Li7}';

my @plots=(
    {
     'xlabel'=>'Radius/Rsun',
     'ylabel'=>'Number of thermal pulses',
     'xcol'=>$cols{R},
     'ycol'=>$cols{ntp},
    },
    {
     'xlabel'=>'Time on TPAGB/years',
     'ylabel'=>,$Alabel,
     'xcol'=>$cols{tagb},
     'ycol'=>$cols{epsLi},
     'xrange'=>'0:'.($fortalk ? '250000' : '1e6'),
     'yrange'=>'-1:*'
    },
    {
     'xlabel'=>'Time on TPAGB/years',
     'ylabel'=>'X_{Li7}',
     'xcol'=>$cols{tagb},
     'ycol'=>-$cols{XLi},