Gyoto
GyotoPolishDoughnut.h
Go to the documentation of this file.
1 
12 /*
13  Copyright (c) 2012-2016 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
109 #ifdef GYOTO_USE_XERCES
110  // We need to filter some properties when writing XML
111  void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const;
112 #endif
113  PolishDoughnut() ;
114  PolishDoughnut(const PolishDoughnut& ) ;
115  virtual PolishDoughnut* clone() const;
116  virtual ~PolishDoughnut() ;
117 
118 
119  // Mutators / assignment
120  // ---------------------
121 public:
122  // Accessors
123  // ---------
124 public:
125  double getL0() const;
126  // void setL0(double l0); set by lambda_
127 
128  double lambda() const;
129  void lambda(double lambda);
130 
131  double centralDensity() const;
132  double centralDensity(std::string const &unit) const;
133  void centralDensity(double density);
134  void centralDensity(double density, std::string const &unit);
135 
136  double centralTempOverVirial() const;
137  void centralTempOverVirial(double val);
138 
139  double centralTemp() const;
140  void centralTemp(double val);
141 
142  double beta() const;
143  void beta(double beta);
144 
145  void spectralOversampling(size_t);
146  size_t spectralOversampling() const ;
147 
148  bool changeCusp() const;
149  void changeCusp(bool t);
150  bool komissarov() const;
151  void komissarov(bool komis);
152  bool angleAveraged() const;
153 
157  void angleAveraged(bool komis);
158 
159  void nonThermalDeltaExpo(std::vector<double> const &v);
160  std::vector<double> nonThermalDeltaExpo() const;
161  void angmomrinner(std::vector<double> const &v);
162  std::vector<double> angmomrinner() const;
163  void adafparams(std::vector<double> const &v);
164  std::vector<double> adafparams() const;
165  void adaf(bool t);
166  bool adaf() const;
167  void setParameter(Gyoto::Property const &p,
168  std::string const & name,
169  std::string const & content,
170  std::string const & unit);
171 
172 
173  // Read only members, depend on lambda
174  double getWsurface() const;
175  double getWcentre() const;
176  double getRcusp() const;
177  double getRcentre() const;
178 
179  using Standard::metric;
180  virtual void metric(Gyoto::SmartPointer<Gyoto::Metric::Generic>);
181 
182  // ASTROBJ API
183  // -----------
184  int Impact(Photon *ph, size_t index,
185  Astrobj::Properties *data);
186 
187  virtual double operator()(double const coord[4]) ;
188 
189  // ASTROBJ processHitQuantities API
190  // --------------------------------
191 protected:
197  virtual void tell(Gyoto::Hook::Teller * msg);
198  virtual void getVelocity(double const pos[4], double vel[4]) ;
200 
210  virtual void integrateEmission(double * I, double * boundaries,
211  size_t* chaninds, size_t nbnu,
212  double dsem, double *cph, double *co) const;
213 
214  virtual double emission(double nu_em, double dsem, double coord_ph[8],
215  double coord_obj[8]) const;
216  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
217  double dsem, double coord_ph[8],
218  double coord_obj[8]=NULL) const ;
219 
220  virtual void radiativeQ(double Inu[], double Taunu[],
221  double nu_em[], size_t nbnu,
222  double dsem, double coord_ph[8],
223  double coord_obj[8]=NULL) const ;
224 
225  double emissionBrems(double nu_em, double nu_crit,
226  double numax, double T_electron,
227  double n_e, double n_j,
228  double amplification,
229  double Cbrems,
230  int comptonorder) const;
232  double emissionSynch(double nu_em, double nu_crit,
233  double numax, double nu_0,
234  double T_electron,
235  double amplification,
236  double Csynch,
237  double alpha1, double alpha2,
238  double alpha3, double preff,
239  int comptonorder) const;
240  double emissionSynchro_komissarov_direction(double Theta_elec,
241  double number_density,
242  double nuem,
243  double nuc,
244  double theta
245  ) const;
246  double emissionSynchro_komissarov_averaged(double Theta_elec,
247  double number_density,
248  double nuem,
249  double nuc
250  ) const;
251  double emissionSynchro_komissarov_averaged_integ(double Theta_elec,
252  double number_density,
253  double nuem,
254  double nuc
255  ) const;
256  double emissionSynchro_komissarov_PL_direction(
257  double number_density_PL,
258  double nuem, double nuc,
259  double theta_mag) const;
260  double emissionSynchro_komissarov_PL_averaged(
261  double number_density_PL,
262  double nuem, double nuc
263  ) const;
264  double absorptionSynchro_komissarov_PL_direction(
265  double number_density_PL,
266  double nuem, double nuc,
267  double theta_mag) const ;
269  double number_density_PL,
270  double nuem, double nuc
271  ) const;
273  double transmission(double nuem, double dsem, double coord_ph[8]) const ;
274  double BBapprox(double nuem, double Te) const;
275  static double funcxM(double alpha1, double alpha2, double alpha3, double xM);
277  // PURELY INTERNAL TO ASTROBJ
278  // --------------------------
279  private:
280  double potential(double r, double theta) const;
282 
295  public:
297  PolishDoughnut * papa;
298  virtual double operator() (double) const;
299  };
300  friend class intersection_t;
301 
313  public:
327  double const * par;
328  const PolishDoughnut * papa;
329  virtual double operator() (double) const;
330  };
332 
341  public:
342  const PolishDoughnut * papa;
343  virtual double operator() (double) const;
344  };
345 
346  public:
347  static double bessi0(double xx);
348  static double bessi1(double xx);
349  static double bessk0(double xx);
350  static double bessk1(double xx);
351  static double bessk(int nn, double xx);
352 
353  // Outputs
354  // -------
355  public:
356 
358  friend std::ostream& operator<<(std::ostream& , const PolishDoughnut& ) ;
359 
360  public:
361 
362 
363 };
364 
365 #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:84
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
#define GYOTO_OBJECT_THREAD_SAFETY
Declare virtual bool isThreadSafe() const.
Definition: GyotoObject.h:99
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:331
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:327
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:45
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:340
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:312
static double bessk1(double xx)
Modified Bessel function K1
double intersection(double) Functor class
Definition: GyotoPolishDoughnut.h:294
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_.