GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
base_analens.h
1/*
2 * base_analens.h
3 *
4 * Created on: Jan 22, 2013
5 * Author: mpetkova
6 */
7
8#ifndef BASE_ANALENS_H_
9#define BASE_ANALENS_H_
10
11#include "quadTree.h"
12#include "source.h"
13#include "InputParams.h"
14#include "lens_halos.h"
15
16/*
17 * \brief An "analytic" model to represent a lens on a single plane.
18 *
19 * The lens consists of a "host" lens which is a non-singular isothermal ellipsoid (NSIE) plus axial distortion
20 * modes, substructures and stars.
21 *
22 *<pre>
23 * Input Parameters:
24 *
25 * **** Distortion parameters
26 * main_NDistortionModes Number of distortion modes to be used. If zero the other distortion parameters are not needed.
27 * main_perturb_beta
28 * main_kappa_peturb
29 * gamma_peturb
30 * monopole_peturb
31 * quadrapole_peturb
32 * hexopole_peturb
33 * octopole_peturb
34 *
35 * **** Substructure parameters
36 * main_sub_Ndensity Number density of substructures. They are distributed uniformly. If zero the other substructure parameters are not needed.
37 * main_sub_beta Logarithmic slope of the internal clump profile. Used if main_sub_type == powerlaw
38 * main_sub_alpha Logarithmic slope of the mass function.
39 * main_sub_Rsize Maximum radius of most massive substructure (see Metcalf & Amara 2012)
40 * main_sub_mass_max Maximum mass
41 * main_sub_mass_min Minimum mass
42 * main_sub_type Mass profile of clumps - 0 or nfw,1 or powerlaw, 2 or pointmass
43 *
44 * **** Stars parameters
45 * main_stars_N Total number of stars that will be used in the simulation. If zero the other star parameters are not needed.
46 * main_stars_fraction Fraction of surface denity in stars.
47 * main_stars_mass Mass of stars.
48 *
49 * The stars are not initially present. They must be implanted later.
50 *</pre>
51 *
52 * TODO: BEN finish this documentation.
53 */
54class LensHaloBaseNSIE : public LensHalo{
55public:
56 //LensHaloBaseNSIE(InputParams& params,const COSMOLOGY &cosmo);
57 LensHaloBaseNSIE();
58
59 virtual void abstractfunction() = 0; // pure virtual
60
61 virtual ~LensHaloBaseNSIE();
62
64 PosType getSigma_crit(){return Sigma_crit;}
66 PosType get_to(){return to;}
68 PosType get_Dl(){return Dl;}
70 PosType get_MpcToAsec(){return MpcToAsec;}
71
72 // private derived quantities
73
75 virtual PosType get_sigma(){return sigma;};
77 //PosType getRsize(){return Rsize;};
79 virtual PosType get_fratio(){return fratio;};
81 virtual PosType get_pa(){return pa;};
83 virtual PosType get_rcore(){return rcore;};
84
86 //bool AreSubStructImplanted(){return substruct_implanted;}
87 //PosType sub_sigmaScale;
88 //PosType sub_Ndensity;
90 //int sub_N;
91 //PosType **sub_x;
93 //PosType sub_beta;
95 //PosType sub_alpha;
97 //PosType sub_Rsize;
98 //PosType sub_Mmax;
99 //PosType sub_Mmin;
100 //PosType sub_theta_force;
101 //LensHalo *subs;
102 //TreeQuadHalos *sub_tree;
103 //IndexType *sub_substructures;
104 //ClumpInternal main_sub_type;
105
106 //void setZlens(PosType zlens);
107 void assignParams(InputParams& params,const COSMOLOGY &cosmo);
108 void PrintLens(bool show_substruct,bool show_stars);
109 void error_message1(std::string name,std::string filename);
110
111 virtual void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType const *xcm,bool subtract_point=false,PosType screening = 1);
112
113 // in randoimize_lens.c
114 //PosType averageSubMass();
115
116 // in readlens_ana.c
117 //void reNormSubstructure(PosType kappa_sub);
118 //void toggleStars(bool implanted);
119
120 PosType getHost_Dl(){return Dl;}
121
122 //PosType getEinstein_ro(){return Einstein_ro;}
123
124 PosType getPerturb_beta(){return perturb_beta;}
125 //IMFtype getIMF_type(){return main_stars_imf_type;}
126 EllipMethod getEllipMethod(){return main_ellip_method;}
127
128 int getPerturb_Nmodes(){return perturb_Nmodes;}
129 PosType *perturb_modes;
130
131 std::size_t Nparams() const;
132 PosType getParam(std::size_t p) const;
133 PosType setParam(std::size_t p, PosType value);
134
135 void printCSV(std::ostream& out, bool header = false) const;
136
138 KappaType phiNSIE(PosType const *xt,PosType f,PosType bc,PosType theta);
140 float get_zsourceref() { return zsource_reference ; }
141
142
143protected:
144
145 // make it uncopyable
146 void operator=(const LensHaloBaseNSIE &h){};
147 LensHaloBaseNSIE(const LensHaloBaseNSIE &h){};
148
150 PosType Sigma_crit;
152 PosType to;
154 PosType Dl;
156 PosType Einstein_ro;
157
159 float sigma;
161 float Rsize;
163 float fratio;
165 float pa;
167 float rcore;
168
169
170 // perturbations to host. These are protected so that in some derived classes they can or cann't be changed.
171 int perturb_Nmodes;
172 PosType perturb_beta;
173 PosType *perturb_rms;
174
175 bool substruct_implanted;
176
177 // private derived quantities
179 PosType MpcToAsec;
180
182 float zsource_reference;
183 PosType Ds, Dls;
184
185};
186
187namespace Utilities{
188 PosType RandomFromTable(PosType *table,unsigned long Ntable,long *seed);
189 void rotation(float *xout,float *xin,PosType theta);
190 void rotation(PosType *xout,PosType const *xin,PosType theta);
191}
192
193void alphaNSIE(PosType *alpha,double const *xt,PosType f,PosType bc,PosType theta);
194KappaType kappaNSIE(PosType const *xt,PosType f,PosType bc,PosType theta);
195void gammaNSIE(KappaType *gam,double const *xt,PosType f,PosType bc,PosType theta);
196KappaType invmagNSIE(PosType *x,PosType f,PosType bc,PosType theta,float *gam,float kap);
197
198PosType rmaxNSIE(PosType sigma,PosType mass,PosType f,PosType rc );
199PosType ellipticRadiusNSIE(PosType const *x,PosType f,PosType pa);
200void quadMomNSIE(float mass,float Rsize,float f,float rc,float theta,PosType *quad);
201
202
203// in powerlow.c
204
205void alphaPowLaw(PosType *alpha,PosType *x,PosType R,PosType mass,PosType beta,PosType *center,PosType Sigma_crit);
206KappaType kappaPowLaw(PosType *x,PosType R,PosType mass,PosType beta,PosType *center,PosType Sigma_crit);
207void gammaPowLaw(KappaType *gamma,PosType *x,PosType R,PosType mass,PosType beta,PosType *center,PosType Sigma_crit);
208KappaType phiPowLaw(PosType *x,PosType R,PosType mass,PosType beta,PosType *center,PosType Sigma_crit);
209
210
211
212// in nfw_lens.c
213void alphaNFW(PosType *alpha,PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
214 ,PosType *center,PosType Sigma_crit);
215KappaType kappaNFW(PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
216 ,PosType *center,PosType Sigma_crit);
217void gammaNFW(KappaType *gamma,PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
218 ,PosType *center,PosType Sigma_crit);
219
220// in lens_expand.c
221
222double lens_expand(double beta,double *mod,int Nmodes,PosType const *x,PosType *alpha,KappaType *gamma,KappaType *phi);
223
224// in FullRange/implant_stars.c
225
226//void implant_stars(Point *images,unsigned long Nimages,long *seed);
227//void substract_stars_disks(LensHaloBaseNSIE *lens,PosType *ray,PosType *alpha
228 // ,PosType *kappa,PosType *gamma);
229
230
231#endif /* BASE_ANALENS_H_ */
EllipMethod
Methods to make a previously isotropic halo elliptical.
Definition InputParams.h:86
The cosmology and all the functions required to calculated quantities based on the cosmology.
Definition cosmo.h:52
Structure for reading and writing parameters to and from a parameter file as well as a container for ...
Definition InputParams.h:99
A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
Definition lens_halos.h:56
Definition utilities.h:39
PosType RandomFromTable(PosType *table, unsigned long Ntable, long *seed)
Generates a random deviates drawn fEinstein_rom appEinstein_roximately the same as the values of tabl...
Definition randomize_lens.cpp:445
void rotation(float *xout, float *xin, PosType theta)
Rotates 2 dimensional point without changing input point.
Definition nsie.cpp:192
KappaType kappaNSIE(PosType const *xt, PosType f, PosType bc, PosType theta)
Convergence for non-singular isothermal ellipsoid, units or .
Definition nsie.cpp:88
PosType rmaxNSIE(PosType sigma, PosType mass, PosType f, PosType rc)
Elliptical radius of a NonSingular Isothermal Ellipsoid.
Definition nsie.cpp:151
void quadMomNSIE(float mass, float Rsize, float f, float rc, float theta, PosType *quad)
Definition nsie.cpp:353
void alphaNSIE(PosType *alpha, PosType const *xt, PosType f, PosType bc, PosType theta)
Deflection angle for non-singular isothermal ellipsoid in units of Einstein radii.
Definition nsie.cpp:14
PosType ellipticRadiusNSIE(PosType const *x, PosType f, PosType pa)
Elliptical radius given f and position angle of model.
Definition nsie.cpp:164
void gammaNSIE(KappaType *gam, PosType const *xt, PosType f, PosType bc, PosType theta)
Shear for non-singular isothermal ellipsoid, units or .
Definition nsie.cpp:111