function out = make_He_consts_v22();

% This function creates and saves a structure with relevant constants and
% external data for get_He_age.  
%
% Syntax: make_He_consts_v22
% (no arguments)
%
% See the text documentation or the code itself for what the constants
% actually are. 
%
% This modified from Al-Be code by Greg Balco, Jan 2014
%
% Written by Greg Balco -- Berkeley Geochronology Center
% balcs@u.washington.edu -- balcs@bgc.org
% February, 2008
% Part of the CRONUS-Earth online calculators: 
%      http://hess.ess.washington.edu/math
%
% Copyright 2001-2007, University of Washington
% 2008-, Greg Balco
% All rights reserved
% Developed in part with funding from the National Science Foundation.
%
% This software is under development and is not licensed for use or distribution.  

He_consts.version = 'None';
He_consts.prepdate = fix(clock);


% Effective attenuation length for spallation in rock
% Commonly accepted value: 160 g/cm2
% For discussion see Gosse and Phillips (2000)

He_consts.Lsp = 160;



% Reference production rates at SLHL for spallation according to various
% scaling schemes. Letter codes De, Du, Li, and St refer to
% scaling schemes of Desilets et al. (2006), Dunai (2001), Lifton (2006),
% and Stone (2000) respectively. The final letter code Lm refers to the
% paleomagnetically corrected version of the Lal 1991/Stone 2000 scaling
% factors.
%

% He-3 production rates. Nonmeaningful values here. 

He_consts.P3_ref_St = 120;
He_consts.delP3_ref_St = 10;

He_consts.P3_ref_Lm = 120; 
He_consts.delP3_ref_Lm = 10;

He_consts.P3_ref_De = 120;
He_consts.delP3_ref_De = 10;

He_consts.P3_ref_Du = 120;
He_consts.delP3_ref_Du = 10;

He_consts.P3_ref_Li = 120;
He_consts.delP3_ref_Li = 10;



% Paleomagnetic records for use in time-dependent production rate schemes
% Derived from Nat Lifton's compilation of paleomagnetic data from
% various sources. See Lifton et al. (2006) and Pigati and Lifton (2005).

% Load the magnetic field data
load PMag_Mar07
% Relative dipole moment and time vector
He_consts.M = MM0; 
He_consts.t_M = t_M; 
% These start at 7500 yr -- time slices are 7500,8500,9500,10500,11500
% in order to use data from Yang et al; subsequent time slices are 
% 12000:1000:800000 for SINT800 data; final two time points are 801000
% and Inf. 

% Cutoff rigidity blocks for past 6900 yr. 
% TTRc and IHRC are lon x lat x time blocks of Rc values for the past 
% 6900 years.
% Both are derived by Nat Lifton from the magnetic field reconstructions of
% Korte and Constable. 
% TTRC has cutoff rigidity obtained by trajectory tracing -- these are for
% the Lifton and Desilets scaling factors. IHRc has cutoff rigidity
% obtained by finding magnetic inclination and horizontal field strength
% from the field model, then applying Equation 2 of Dunai(2001). 
He_consts.TTRc = TTRc; % data block
He_consts.IHRc = IHRc; % data block
He_consts.lat_Rc = lat_Rc; % lat and lon indices for Rc data block
He_consts.lon_Rc = lon_Rc;
He_consts.t_Rc = t_Rc; % time vector for Rc data block

% Effective pole positions and field strengths inferred from K and C field
% reconstructions for last 7000 yr. These are used in the
% paleomagnetically-corrected implementation of the Lal SF. They are for
% the same times as the RC slices in the data block above. Again,
% generated by Nat Lifton -- hence KCL = Korte-Constable-Lifton. 

He_consts.MM0_KCL = MM0_KCL;
He_consts.lat_pp_KCL = lat_pp_KCL;
He_consts.lon_pp_KCL = lon_pp_KCL;

% Solar variability from Lifton et al. 2005
% Has been averaged and resampled to the same time slices as everything
% else. 

He_consts.S = S; 
He_consts.SInf = 0.95; % Long-term mean S value;

% Finish up

save He_consts_Jan2014 He_consts

disp(['He constants version ' He_consts.version]);
disp('Saved'); 


