icemc
earthmodel.hh
Go to the documentation of this file.
1 #ifndef EARTHMODEL_H
2 #define EARTHMODEL_H
3 
4 #include <string>
5 #include <cstdlib>
6 //#include "Primaries.h"
7 
8 class Primaries;
9 class Position;
10 class Vector;
11 class Interaction;
12 class IceModel;
13 using std::string;
14 
15 
16 
17 
19 //class EarthModel
20 //This class contains a model of the physical structure of the Earth, with information on shape,
21 //density at all points inside, and depth of water and ice on the surface.
22 //
23 // methods:
24 //
25 //IceThickness : Returns the thickness of ice in meters at a given Position or lon/lat.
26 //WaterDepth : Returns the depth of water in meters at a given Position or lon/lat.
27 //Surface : Returns the distance in meters from the center of the Earth to the surface,
28 // i.e. to the start of air.
29 //SurfaceAboveGeoid : Returns the distance in meters from the local geoid to the start of air.
30 //Geoid : Returns the height in meters of the geoid at a given Position or lon/lat.
31 //RockSurface : Returns the distance in meters from the center of the Earth to the end of rock
32 // (the begninning of the ice/water/air)
33 //GetSurfaceNormal : Returns a unit vector pointing in the direction of the surface normal at
34 // a given Position.
35 //Getchord
36 //
38 
40 class EarthModel {
41 
42 public:
43  EarthModel(int model = 0,int WEIGHTABSORPTION_SETTING=1);
44  virtual ~EarthModel();
45 // properties of the Earth
46  static constexpr double R_EARTH=6.378140E6; // radius of Earth in m at bulge
47 
48 
49  double radii[3];
50  // = {1.2e13,(EarthModel::R_EARTH-4.0E4)*(EarthModel::R_EARTH-4.0E4),EarthModel::R_EARTH*EarthModel::R_EARTH}; // average radii of boundaries between earth layers
51 
52  double volume; // sums the volume of medium (ice or salt)
53  double ice_area; // sums the area of the earth's surface that has antarctic ice underneath
54  double max_icevol_perbin; // maximum ice volume in any bin
56  virtual double Geoid(double latitude) ;
57  virtual double Geoid(const Position &pos) ;
58  virtual double IceThickness(double lon,double lat) ;
59  virtual double IceThickness(const Position& pos) ;
60  virtual double Surface(double lon,double lat) ;
61  virtual double Surface(const Position& pos) ;
62  virtual int InFirn(const Position& pos) ;
63  virtual double SurfaceDeepIce(const Position& pos) ;
64  virtual double SurfaceAboveGeoid(double lon,double lat) ;
65  virtual double SurfaceAboveGeoid(const Position& pos) ;
66  virtual double WaterDepth(double lon,double lat) ;
67  virtual double WaterDepth(const Position& pos) ;
68  virtual double RockSurface(double lon,double lat) ;
69  virtual double RockSurface(const Position& pos) ;
70  double GetDensity(double altitude, const Position earth_in, int& crust_entered, bool * inice = 0);
71  int Getchord(Settings *settings1,
72  double len_int_kgm2,
73  const Position &earth_in, // place where neutrino entered the earth
74  double distance_in_ice,
75  bool include_ice_absorption,
76  const Position &posnu, // position of the interaction
77  int inu,
78  double& chord, // chord length
79  double& probability_tmp, // weight
80  double& weight1_tmp,
81  double& nearthlayers, // core, mantle, crust
82  double myair,
83  double& total_kgm2, // length in kg m^2
84  int& crust_entered, // 1 or 0
85  int& mantle_entered, // 1 or 0
86  int& core_entered);
87 
88  Vector GetSurfaceNormal(const Position &r_out) ;
89  static double LongtoPhi_0isPrimeMeridian(double longitude); // convert longitude to phiwith 0 longitude being the prime meridian
90  static double LongtoPhi_0is180thMeridian(double longitude); // convert longitude to phi with 0 longitude being at the 180th meridian
91  void EarthCurvature(double *array,double depth_temp); // adjusts coordinates within the mine to account for the curvature of the earth.
92  Position WhereDoesItEnter(const Position &posnu,const Vector &nnu);
93 
94  /*Finds where we intersect the Geoid */
95  int GeoidIntersection(Vector x0,Vector p0, Position * int1, Position * int2, double extra_height = 5500, double * ds =0) const;
96 
97 
98 private:
99 
100 protected:
107 
108 
109  // pick method to step neutrino through the earth and get attenuation length
110  static constexpr int getchord_method=2; // 1=core,mantle,crust; 2=crust 2.0 model
111 
112  static const double GEOID_MAX; // parameters of geoid model
113  static const double GEOID_MIN;
114  static const double COASTLINE; // if the rf leaves from beyond this "coastline" (in degrees of latitude relative to south pole) it's not in antarctica. Real coastline is always closer than this.
115 
116  // parameters of the Crust 2.0 earth model
117  static constexpr int NLON=180; // number of bins in longitude for crust 2.0
118  static constexpr int NLAT=90; // number of bins in latitude
119  static constexpr int NPHI=180; // bins in longitude for visible ice in horizon
120  static const double MAXTHETA; // maximum value of theta in degrees in polar coordinates
121  double thetastep; // how big do you step in theta-> always 2deg with Crust 2.0
122  double phistep; // how big do you step in phi->always 2deg in Crust 2.0
123  static const int ILAT_COASTLINE;
124  double surfacer[NLON][NLAT]; // elevation at the surface (top of ice) compared to geoid (in meters)
125  double icer[NLON][NLAT]; // elevation at the *bottom* of ice layer (in meters)
126  double waterr[NLON][NLAT]; // elevation at the bottom of water layer (in meters)
127  double softsedr[NLON][NLAT]; // elevation at the bottom of soft set layer (in meters)
128  double hardsedr[NLON][NLAT]; // elev at bottom of hard sed layer (in meters)
129  double uppercrustr[NLON][NLAT]; // elev at bottom of upper crust layer (in meters)
130  double middlecrustr[NLON][NLAT]; // elev at bottom of middle crust layer (in meters)
131  double lowercrustr[NLON][NLAT]; // elev at bottom of lower crust layer (in meters)
132  double geoid[NLAT]; // realistic shape of earth-radius at each latitude (in meters)
133  double MIN_ALTITUDE_CRUST; // maximum depth of crust- determines when to start stepping
134  //double MAX_VOL; // maximum volume of ice in a bin in Crust 2.0 - not used
135  double elevationarray[NLON][NLAT]; // If no water, measures the elevation (relative to geoid, in meters) of the top of the ice or rock (i.e., air interface). If there is water, measures elevation to bottom of water. (There may or may not be ice on top of the water.)
136  double waterthkarray[NLON][NLAT]; // thickness of water layer (in km)
137  double icethkarray[NLON][NLAT]; // thickness of ice layer (in km)
138  double softsedthkarray[NLON][NLAT]; // thickness of soft sed layer (in km)
139  double hardsedthkarray[NLON][NLAT]; // thickness of hard sed layer (in km)
140  double uppercrustthkarray[NLON][NLAT]; // thickness of upper crust layer (in km)
141  double middlecrustthkarray[NLON][NLAT]; // thickness of middle crust layer (in km)
142  double lowercrustthkarray[NLON][NLAT]; // thickness of lower crust layer (in km)
143  double crustthkarray[NLON][NLAT]; // total thickness of crust (in km)
144  double waterdensityarray[NLON][NLAT]; // density of water layer bin by bin
145  double icedensityarray[NLON][NLAT]; // density of ice layer bin by bin
146  double softseddensityarray[NLON][NLAT]; // density of soft sed layer
147  double hardseddensityarray[NLON][NLAT]; // density of hard sed layer
148  double uppercrustdensityarray[NLON][NLAT]; // density of upper crust layer
149  double middlecrustdensityarray[NLON][NLAT]; // density of middle crust layer
150  double lowercrustdensityarray[NLON][NLAT]; // density of lower crust layer
151  double area[NLAT]; // area of a bin at a given latitude- calculated once
152  double average_iceth; // average ice thickness over the continent-calculated once
153 
155  //methods
156  void ReadCrust(string);
157  double SmearPhi(int ilon, double rand);
158  double SmearTheta(int ilat, double rand) ;
159  double dGetTheta(int itheta) ;
160  double dGetPhi(int ilon) ;
161  void GetILonILat(const Position&,int& ilon,int& ilat) ;
162  double GetLat(double theta) ;
163  double GetLon(double phi) ;
164  Vector PickPosnuForaLonLat(double lon,double lat,double theta,double phi); // given that an interaction occurs at a lon and lat, pick an interaction position in the ice
165 
166 }; //class EarthModel
167 
168 
169 constexpr double densities[3]={14000.,3400.,2900.}; // average density of each earth layer
170 
171 #endif
static constexpr double R_EARTH
Definition: earthmodel.hh:46
double uppercrustr[NLON][NLAT]
Definition: earthmodel.hh:129
static const double MAXTHETA
Definition: earthmodel.hh:120
double GetLat(double theta)
Definition: earthmodel.cc:207
double ice_area
Definition: earthmodel.hh:53
static double LongtoPhi_0isPrimeMeridian(double longitude)
Definition: earthmodel.cc:119
double waterthkarray[NLON][NLAT]
Definition: earthmodel.hh:136
static constexpr int NPHI
Definition: earthmodel.hh:119
virtual ~EarthModel()
Definition: earthmodel.cc:116
virtual double WaterDepth(double lon, double lat)
Definition: earthmodel.cc:199
int FIXEDELEVATION
Definition: earthmodel.hh:104
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Definition: vector.hh:27
double GetLon(double phi)
Definition: earthmodel.cc:211
double dGetPhi(int ilon)
Definition: earthmodel.cc:974
double total_kgm2
Definition: icemc.cc:370
double middlecrustr[NLON][NLAT]
Definition: earthmodel.hh:130
int weightabsorption
Definition: earthmodel.hh:106
double waterdensityarray[NLON][NLAT]
Definition: earthmodel.hh:144
static const int ILAT_COASTLINE
Definition: earthmodel.hh:123
int crust_entered
Definition: icemc.cc:393
double crustthkarray[NLON][NLAT]
Definition: earthmodel.hh:143
double max_icevol_perbin
Definition: earthmodel.hh:54
static constexpr int getchord_method
Definition: earthmodel.hh:110
double icethkarray[NLON][NLAT]
Definition: earthmodel.hh:137
double area[NLAT]
Definition: earthmodel.hh:151
virtual double RockSurface(double lon, double lat)
Definition: earthmodel.cc:183
Ice thicknesses and water depth.
Definition: icemodel.hh:88
double radii[3]
Definition: earthmodel.hh:49
double hardsedthkarray[NLON][NLAT]
Definition: earthmodel.hh:139
static constexpr int NLON
Definition: earthmodel.hh:117
double surfacer[NLON][NLAT]
Definition: earthmodel.hh:124
This class is a 3-vector that represents a position on the Earth&#39;s surface.
Definition: position.hh:26
double softseddensityarray[NLON][NLAT]
Definition: earthmodel.hh:146
void GetILonILat(const Position &, int &ilon, int &ilat)
Definition: earthmodel.cc:981
static const double GEOID_MIN
Definition: earthmodel.hh:113
virtual double IceThickness(double lon, double lat)
Definition: earthmodel.cc:159
double hardsedr[NLON][NLAT]
Definition: earthmodel.hh:128
int FLATSURFACE
Definition: earthmodel.hh:105
void EarthCurvature(double *array, double depth_temp)
Definition: earthmodel.cc:994
static const double COASTLINE
Definition: earthmodel.hh:114
Functions you need to generate a primary interaction including cross sections and picking charged cur...
Definition: Primaries.h:83
double nearthlayers
Definition: icemc.cc:250
double lowercrustdensityarray[NLON][NLAT]
Definition: earthmodel.hh:150
void ReadCrust(string)
Definition: earthmodel.cc:689
double lowercrustr[NLON][NLAT]
Definition: earthmodel.hh:131
static double LongtoPhi_0is180thMeridian(double longitude)
Definition: earthmodel.cc:132
int mantle_entered
Definition: icemc.cc:394
double phistep
Definition: earthmodel.hh:122
virtual double SurfaceDeepIce(const Position &pos)
Definition: earthmodel.cc:171
double softsedr[NLON][NLAT]
Definition: earthmodel.hh:127
double average_iceth
Definition: earthmodel.hh:152
static const double GEOID_MAX
Definition: earthmodel.hh:112
int CONSTANTICETHICKNESS
Definition: earthmodel.hh:102
double GetDensity(double altitude, const Position earth_in, int &crust_entered, bool *inice=0)
Definition: earthmodel.cc:220
Reads in and stores input settings for the run.
Definition: Settings.h:35
double icedensityarray[NLON][NLAT]
Definition: earthmodel.hh:145
double volume
Definition: earthmodel.hh:52
double SmearTheta(int ilat, double rand)
Definition: earthmodel.cc:669
double waterr[NLON][NLAT]
Definition: earthmodel.hh:126
Vector PickPosnuForaLonLat(double lon, double lat, double theta, double phi)
Definition: earthmodel.cc:941
double uppercrustthkarray[NLON][NLAT]
Definition: earthmodel.hh:140
double middlecrustthkarray[NLON][NLAT]
Definition: earthmodel.hh:141
EarthModel(int model=0, int WEIGHTABSORPTION_SETTING=1)
Definition: earthmodel.cc:38
virtual double Geoid(double latitude)
Definition: earthmodel.cc:147
virtual double SurfaceAboveGeoid(double lon, double lat)
Definition: earthmodel.cc:191
int core_entered
Definition: icemc.cc:395
virtual double Surface(double lon, double lat)
Definition: earthmodel.cc:175
double thetastep
Definition: earthmodel.hh:121
Position WhereDoesItEnter(const Position &posnu, const Vector &nnu)
Definition: earthmodel.cc:1014
double softsedthkarray[NLON][NLAT]
Definition: earthmodel.hh:138
double elevationarray[NLON][NLAT]
Definition: earthmodel.hh:135
double max_icethk_perbin
Definition: earthmodel.hh:55
int CONSTANTCRUST
Definition: earthmodel.hh:103
int inu
Definition: icemc.cc:124
double icer[NLON][NLAT]
Definition: earthmodel.hh:125
double lowercrustthkarray[NLON][NLAT]
Definition: earthmodel.hh:142
double MIN_ALTITUDE_CRUST
Definition: earthmodel.hh:133
double dGetTheta(int itheta)
Definition: earthmodel.cc:970
double hardseddensityarray[NLON][NLAT]
Definition: earthmodel.hh:147
int Getchord(Settings *settings1, double len_int_kgm2, const Position &earth_in, double distance_in_ice, bool include_ice_absorption, const Position &posnu, int inu, double &chord, double &probability_tmp, double &weight1_tmp, double &nearthlayers, double myair, double &total_kgm2, int &crust_entered, int &mantle_entered, int &core_entered)
Definition: earthmodel.cc:280
double geoid[NLAT]
Definition: earthmodel.hh:132
int EARTH_MODEL
Definition: earthmodel.hh:101
static constexpr int NLAT
Definition: earthmodel.hh:118
virtual int InFirn(const Position &pos)
Definition: earthmodel.cc:166
int GeoidIntersection(Vector x0, Vector p0, Position *int1, Position *int2, double extra_height=5500, double *ds=0) const
Definition: earthmodel.cc:1079
Vector GetSurfaceNormal(const Position &r_out)
Definition: earthmodel.cc:611
double SmearPhi(int ilon, double rand)
Definition: earthmodel.cc:658
double middlecrustdensityarray[NLON][NLAT]
Definition: earthmodel.hh:149
constexpr double densities[3]
Definition: earthmodel.hh:169
Shape of the earth, ice thicknesses, profiles of earth layers, densities, neutrino absorption...
Definition: earthmodel.hh:40
Stores everything about a particular neutrino interaction. Interaction.
Definition: Primaries.h:136
double uppercrustdensityarray[NLON][NLAT]
Definition: earthmodel.hh:148