Gyoto
GyotoPolishDoughnut.h
Go to the documentation of this file.
1 
12 /*
13  Copyright (c) 2012-2015 Frederic Vincent, Odele Straub, Thibaut Paumard
14 
15  This file is part of Gyoto.
16 
17  Gyoto is free software: you can redistribute it and/or modify
18  it under the terms of the GNU General Public License as published by
19  the Free Software Foundation, either version 3 of the License, or
20  (at your option) any later version.
21 
22  Gyoto is distributed in the hope that it will be useful,
23  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  GNU General Public License for more details.
26 
27  You should have received a copy of the GNU General Public License
28  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #ifndef __GyotoPolishDoughnut_H_
32 #define __GyotoPolishDoughnut_H_
33 
34 namespace Gyoto{
35  namespace Astrobj { class PolishDoughnut; }
36  class FactoryMessenger;
37 }
38 
39 #include <GyotoStandardAstrobj.h>
40 #include <GyotoFunctors.h>
41 #include <GyotoHooks.h>
42 #include <GyotoBlackBodySpectrum.h>
43 
54 : public Astrobj::Standard,
55  protected Gyoto::Hook::Listener
56 {
57  friend class Gyoto::SmartPointer<Gyoto::Astrobj::PolishDoughnut>;
58 
59  // Data :
60  // -----
61 protected:
62  SmartPointer<Spectrum::BlackBody> spectrumBB_;
63  double l0_;
64  double lambda_;
65  double W_surface_;
66  double W_centre_;
67  double r_cusp_;
68  double r_centre_;
69  double r_torusouter_ ;
70  double DeltaWm1_;
72  /*
73  WARNING! so far (jan. 2014) central_density_ is density_central
74  in standard Polish doughnut model, but it is
75  density_central*c2+pressure_central in Komissarov model
76  */
78  double central_temperature_;
79  double beta_;
80  double aa_;
81  double aa2_;
83  bool komissarov_;
85 
87 
92  double deltaPL_;
93  double expoPL_;
94 
95  bool adaf_;
97  double ADAFdensity_;
98 
99  bool changecusp_;
102  double rintorus_;
103 
104  // Constructors - Destructor
105  // -------------------------
106 public:
107  GYOTO_OBJECT; // This object has Properties
108 #ifdef GYOTO_USE_XERCES
109  // We need to filter some properties when writing XML
110  void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const;
111 #endif
112  PolishDoughnut() ;
113  PolishDoughnut(const PolishDoughnut& ) ;
114  virtual PolishDoughnut* clone() const;
115  virtual ~PolishDoughnut() ;
116 
117 
118  // Mutators / assignment
119  // ---------------------
120 public:
121  // Accessors
122  // ---------
123 public:
124  double getL0() const;
125  // void setL0(double l0); set by lambda_
126 
127  double lambda() const;
128  void lambda(double lambda);
129 
130  double centralDensity() const;
131  double centralDensity(std::string const &unit) const;
132  void centralDensity(double density);
133  void centralDensity(double density, std::string const &unit);
134 
135  double centralTempOverVirial() const;
136  void centralTempOverVirial(double val);
137 
138  double centralTemp() const;
139  void centralTemp(double val);
140 
141  double beta() const;
142  void beta(double beta);
143 
144  void spectralOversampling(size_t);
145  size_t spectralOversampling() const ;
146 
147  bool changeCusp() const;
148  void changeCusp(bool t);
149  bool komissarov() const;
150  void komissarov(bool komis);
151  bool angleAveraged() const;
152 
156  void angleAveraged(bool komis);
157 
158  void nonThermalDeltaExpo(std::vector<double> const &v);
159  std::vector<double> nonThermalDeltaExpo() const;
160  void angmomrinner(std::vector<double> const &v);
161  std::vector<double> angmomrinner() const;
162  void adafparams(std::vector<double> const &v);
163  std::vector<double> adafparams() const;
164  void adaf(bool t);
165  bool adaf() const;
166  void setParameter(Gyoto::Property const &p,
167  std::string const & name,
168  std::string const & content,
169  std::string const & unit);
170 
171 
172  // Read only members, depend on lambda
173  double getWsurface() const;
174  double getWcentre() const;
175  double getRcusp() const;
176  double getRcentre() const;
177 
178  using Standard::metric;
179  virtual void metric(Gyoto::SmartPointer<Gyoto::Metric::Generic>);
180 
181  // ASTROBJ API
182  // -----------
183  int Impact(Photon *ph, size_t index,
184  Astrobj::Properties *data);
185 
186  virtual double operator()(double const coord[4]) ;
187 
188  // ASTROBJ processHitQuantities API
189  // --------------------------------
190 protected:
196  virtual void tell(Gyoto::Hook::Teller * msg);
197  virtual void getVelocity(double const pos[4], double vel[4]) ;
199 
209  virtual void integrateEmission(double * I, double * boundaries,
210  size_t* chaninds, size_t nbnu,
211  double dsem, double *cph, double *co) const;
212 
213  virtual double emission(double nu_em, double dsem, double coord_ph[8],
214  double coord_obj[8]) const;
215  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
216  double dsem, double coord_ph[8],
217  double coord_obj[8]=NULL) const ;
218 
219  virtual void radiativeQ(double Inu[], double Taunu[],
220  double nu_em[], size_t nbnu,
221  double dsem, double coord_ph[8],
222  double coord_obj[8]=NULL) const ;
223 
224  double emissionBrems(double nu_em, double nu_crit,
225  double numax, double T_electron,
226  double n_e, double n_j,
227  double amplification,
228  double Cbrems,
229  int comptonorder) const;
231  double emissionSynch(double nu_em, double nu_crit,
232  double numax, double nu_0,
233  double T_electron,
234  double amplification,
235  double Csynch,
236  double alpha1, double alpha2,
237  double alpha3, double preff,
238  int comptonorder) const;
239  double emissionSynchro_komissarov_direction(double Theta_elec,
240  double number_density,
241  double nuem,
242  double nuc,
243  double theta
244  ) const;
245  double emissionSynchro_komissarov_averaged(double Theta_elec,
246  double number_density,
247  double nuem,
248  double nuc
249  ) const;
250  double emissionSynchro_komissarov_averaged_integ(double Theta_elec,
251  double number_density,
252  double nuem,
253  double nuc
254  ) const;
255  double emissionSynchro_komissarov_PL_direction(
256  double number_density_PL,
257  double nuem, double nuc,
258  double theta_mag) const;
259  double emissionSynchro_komissarov_PL_averaged(
260  double number_density_PL,
261  double nuem, double nuc
262  ) const;
263  double absorptionSynchro_komissarov_PL_direction(
264  double number_density_PL,
265  double nuem, double nuc,
266  double theta_mag) const ;
268  double number_density_PL,
269  double nuem, double nuc
270  ) const;
272  double transmission(double nuem, double dsem, double coord_ph[8]) const ;
273  double BBapprox(double nuem, double Te) const;
274  static double funcxM(double alpha1, double alpha2, double alpha3, double xM);
276  // PURELY INTERNAL TO ASTROBJ
277  // --------------------------
278  private:
279  double potential(double r, double theta) const;
281 
294  public:
296  PolishDoughnut * papa;
297  virtual double operator() (double) const;
298  };
299  friend class intersection_t;
300 
312  public:
326  double const * par;
327  const PolishDoughnut * papa;
328  virtual double operator() (double) const;
329  };
331 
340  public:
341  const PolishDoughnut * papa;
342  virtual double operator() (double) const;
343  };
344 
345  public:
346  static double bessi0(double xx);
347  static double bessi1(double xx);
348  static double bessk0(double xx);
349  static double bessk1(double xx);
350  static double bessk(int nn, double xx);
351 
352  // Outputs
353  // -------
354  public:
355 
357  friend std::ostream& operator<<(std::ostream& , const PolishDoughnut& ) ;
358 
359  public:
360 
361 
362 };
363 
364 #endif
double l0_
Angular momentum. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:63
double getL0() const
Get PolishDoughnut::l0_.
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
virtual double operator()(double const coord[4])
Function defining the object interior.
A toroïdal accretion structure.
Definition: GyotoPolishDoughnut.h:53
bool defangmomrinner_
true if torus defined from l0 and rin
Definition: GyotoPolishDoughnut.h:101
static double funcxM(double alpha1, double alpha2, double alpha3, double xM)
Mahadevan 96 fit function.
double DeltaWm1_
1./(W_centre_ - W_surface_);
Definition: GyotoPolishDoughnut.h:70
static double bessi1(double xx)
Modified Bessel function I1
friend std::ostream & operator<<(std::ostream &, const PolishDoughnut &)
Display.
virtual PolishDoughnut * clone() const
Cloner.
Tellers tell Listeners when they mutate.
Classes with an operator() method.
double central_density_
Central density in kg/L (same as g cm^-3)
Definition: GyotoPolishDoughnut.h:71
double lambda_
Adimentionned angular momentum.
Definition: GyotoPolishDoughnut.h:64
size_t spectralOversampling() const
Get PolishDoughnut::spectral_oversampling_.
int Impact(Photon *ph, size_t index, Astrobj::Properties *data)
Does a photon at these coordinates impact the object?
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:354
double emissionBrems(double nu_em, double nu_crit, double numax, double T_electron, double n_e, double n_j, double amplification, double Cbrems, int comptonorder) const
Bremsstrahlung proxy for emission()
bool komissarov_
1 if Komissarov model is integrated
Definition: GyotoPolishDoughnut.h:83
bool changeCusp() const
Get PolishDoughnut::komissarov_.
virtual void getVelocity(double const pos[4], double vel[4])
Fluid velocity field.
bool adaf_
true to switch to an ADAF model rather tha Polish doughnut
Definition: GyotoPolishDoughnut.h:95
Astronomical objects defined bya a potential/distance.
double centralTempOverVirial() const
Get PolishDoughnut::centraltemp_over_virial_.
A functor like double (func) (double) const.
Definition: GyotoFunctors.h:57
double aa2_
aa_2
Definition: GyotoPolishDoughnut.h:81
virtual void tell(Gyoto::Hook::Teller *msg)
Update PolishDoughnut::aa_.
double beta_
Tcenter in K.
Definition: GyotoPolishDoughnut.h:79
size_t spectral_oversampling_
Oversampling used in integrateEmission()
Definition: GyotoPolishDoughnut.h:82
bool rochelobefilling_
true if torus filling its Roche lobe
Definition: GyotoPolishDoughnut.h:100
bool angle_averaged_
1 if Komissarov model should be angle averaged
Definition: GyotoPolishDoughnut.h:84
double aa_
PolishDoughnut::gg_ spin, cached when setting PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:80
static double bessk0(double xx)
Modified Bessel function K0
double lambda() const
Get PolishDoughnut::lambda_.
double ADAFdensity_
ADAF central density.
Definition: GyotoPolishDoughnut.h:97
intersection_t intersection
double intersection(double) Functor
Definition: GyotoPolishDoughnut.h:330
double getRcusp() const
Get PolishDoughnut::r_cusp_.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
double W_centre_
Potential central value. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:66
virtual void integrateEmission(double *I, double *boundaries, size_t *chaninds, size_t nbnu, double dsem, double *cph, double *co) const
∫ν1ν2 Iν dν (or jν)
double centraltemp_over_virial_
Tcenter/Tvirial
Definition: GyotoPolishDoughnut.h:77
double r_cusp_
Cusp radius in geometrical units. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:67
double const * par
Parameter array.
Definition: GyotoPolishDoughnut.h:326
double W_surface_
Potential surface value. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:65
double absorptionSynchro_komissarov_PL_averaged(double number_density_PL, double nuem, double nuc) const
Synchrotron proxy for emission()
double potential(double r, double theta) const
Potential defining shape, used by operator()()
Pointers performing reference counting.
Definition: GyotoProperty.h:41
double beta() const
Get PolishDoughnut::beta_.
double r_torusouter_
Torus outer coordinate radius. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:69
double centralTemp() const
Get PolishDoughnut::central_temperature_.
I might listen to a Teller.
Definition: GyotoHooks.h:64
void setParameter(Gyoto::Property const &p, std::string const &name, std::string const &content, std::string const &unit)
Set parameter by Property (and name)
virtual SmartPointer< Metric::Generic > metric() const
Get the Metric gg_.
double BBapprox(double nuem, double Te) const
Approximated Black-Body function.
double ADAFtemperature_
ADAF central temperature.
Definition: GyotoPolishDoughnut.h:96
bool changecusp_
true to apply the fishy rcusp_ change (to be changed)
Definition: GyotoPolishDoughnut.h:99
double getRcentre() const
Get PolishDoughnut::r_centre_.
bool komissarov() const
Get PolishDoughnut::komissarov_.
Astronomical objects defined bya a potential/distance.
Definition: GyotoStandardAstrobj.h:84
virtual double emission(double nu_em, double dsem, double coord_ph[8], double coord_obj[8]) const
Specific intensity Iν
static double bessk(int nn, double xx)
Modified Bessel function.
double getWcentre() const
Get PolishDoughnut::W_centre_.
double outerradius(double) Functor class
Definition: GyotoPolishDoughnut.h:339
I_nu(nu, T) = cst_*2*h*nu^3/c^2/(exp(h*nu/k*T)-1.);.
double transcendental(double) Functor class
Definition: GyotoPolishDoughnut.h:311
static double bessk1(double xx)
Modified Bessel function K1
double intersection(double) Functor class
Definition: GyotoPolishDoughnut.h:293
static double bessi0(double xx)
Modified Bessel function I0
double getWsurface() const
Get PolishDoughnut::W_surface_.
double transmission(double nuem, double dsem, double coord_ph[8]) const
Transmission: exp( αν * dsem )
double expoPL_
exponent of the non-thermal powerlaw = -expoPL_
Definition: GyotoPolishDoughnut.h:93
double deltaPL_
fraction of thermal energy in non-thermal electrons
Definition: GyotoPolishDoughnut.h:92
double centralDensity() const
Get PolishDoughnut::central_density_.
double r_centre_
Central radius in geometrical units. Tied to PolishDoughnut::lambda_.
Definition: GyotoPolishDoughnut.h:68
double rintorus_
Inner radius of the doughnut.
Definition: GyotoPolishDoughnut.h:102
virtual double integrateEmission(double nu1, double nu2, double dsem, double c_ph[8], double c_obj[8]=NULL) const
∫ν1ν2 Iν dν (or jν)
void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const
Output a single Property to XML.
bool angleAveraged() const
Get PolishDoughnut::angle_averaged_.