Gyoto
GyotoSimBridge.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2024 Aimar Nicolas, Irene Urso
10 
11  Gyoto is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  Gyoto is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef __GyotoSimBridge_H_
26 #define __GyotoSimBridge_H_
27 
28 #include <iostream>
29 #include <fstream>
30 #include <iomanip>
31 #include <cstring>
32 #include <string>
33 
34 #include <GyotoBlackBodySpectrum.h>
38 #include <GyotoFitsRW.h>
39 #include <GyotoStandardAstrobj.h>
40 #include <GyotoMetric.h>
41 
42 namespace Gyoto{
43  namespace Astrobj { class SimBridge; }
44 }
45 
99 
100  protected:
101  SmartPointer<Spectrum::BlackBody> spectrumBB_;
102  SmartPointer<Spectrum::KappaDistributionSynchrotron> spectrumKappaSynch_; // kappa-distribution synchrotron spectrum
103  SmartPointer<Spectrum::PowerLawSynchrotron> spectrumPLSynch_; // PL-distribution synchrotron spectrum
104  SmartPointer<Spectrum::ThermalSynchrotron> spectrumThermalSynch_; // Thermal distribution synchrotron spectrum
106 
109  std::string fprefix_;
110 
111  private:
115  bool BinFile_;
116  std::string emission_; // Type of emission : Black Body or synchrotron from electron distribution (thermal, PL, kappa)
117  double PLindex_;
118  double gammaMin_;
119  double gammaMax_;
120 
122 
124 
125  int emisInFile_[4];
126  int absInFile_[4];
127  int rotInFile_[3];
128 
129  protected:
130  //Number of dimensions (maximum 4D : [t, r, theta, phi] or [t, x, y, z]). When the number of dimension is lower than 4, the array of the complement dimension(s) is of length 1 (in the FITS files headers).
131  double* time_array_;
132  double* x1_array_;
133  double* x2_array_;
134  double* x3_array_;
135  double* nu_array_;
136  double* pitch_array_;
137 
138  int ntime_;
139  int nx1_;
140  int nx2_;
141  int nx3_;
142  int nnu_;
143  int npitch_;
144 
145  std::string* boundCond_;
146 
147  // Constructors - Destructor
148  // -------------------------
149  public:
150  GYOTO_OBJECT;
151 
152  SimBridge();
153 
154  SimBridge(const SimBridge& ) ;
155  virtual SimBridge* clone () const;
156 
157  virtual ~SimBridge();
158 
159  virtual std::string className() const ;
160  virtual std::string className_l() const ;
161 
162  // Accessors
163  // ---------
164  public:
165  void filePrefix(std::string const &d);
166  std::string filePrefix() const;
167  void PLindex(double pl);
168  double PLindex()const;
169  void gammaMin(double gmin);
170  double gammaMin() const;
171  void gammaMax(double gmax);
172  double gammaMax() const;
173  void circularMotion(bool t);
174  bool circularMotion() const;
175  void cunninghamVel(bool t);
176  bool cunninghamVel() const;
177  void floorTemperature(double t);
178  double floorTemperature()const;
179  void magnetization(double ss);
180  double magnetization() const;
181  void boundaryConditions(std::string const &sbc);
182  std::string boundaryConditions() const;
183  void emissionType(std::string const &kind);
184  std::string emissionType() const;
185 
186  virtual void radiativeQ(double Inu[], double Taunu[], double const nu_em[], size_t nbnu,
187  double dsem, state_t const &coord_ph, double const coord_obj[8]=NULL) const ;
188 
189  virtual void radiativeQ(double *Inu, double *Qnu, double *Unu, double *Vnu,
190  Eigen::Matrix4d *Onu, double const *nuem , size_t nbnu, double dsem,
191  state_t const &coord_ph, double const *coord_obj) const ;
192 
193  virtual void getVelocity(double const pos[4], double vel[4]);
194 
195  virtual double operator()(double const coord[4]);
196 
197  virtual void setParameters(Gyoto::FactoryMessenger *fmp) ;
198  virtual void fillProperty(Gyoto::FactoryMessenger *fmp,
199  Property const &p) const ;
200 
201  private:
202  int getIndex(double const tcur) const;
203 
204 };
205 
206 #endif
double * x3_array_
Third spatial dimension array ( in spherical, Z in Cartesian)
Definition: GyotoSimBridge.h:134
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
std::string filePrefix() const
Get the FITS filename prefix.
double floorTemperature() const
get the minimum of temperature (GRMHD case)
Object that read physical quantities from a set of FITS files comming from numerical simulations...
Definition: GyotoSimBridge.h:97
virtual std::string className_l() const
"simbridge"
std::string fprefix_
< FITS files prefix
Definition: GyotoSimBridge.h:109
Class for reading or writing data in FITS file. The data stored should be 1D array(s).
Definition: GyotoFitsRW.h:51
double * time_array_
array containing the time evolution of each FITS files
Definition: GyotoSimBridge.h:131
bool circularMotion() const
Get the flag which select the type of velocity.
double * x1_array_
First spatial dimension array (radius in spherical, X in Cartesian)
Definition: GyotoSimBridge.h:132
double gammaMax() const
Get the maximum gamma factor of the electron distribution function.
Thermal synchrotron spectrum.
Class to read/write jnu and anu in FITS File.
bool cunninghamvel_
1 if Cunningham prescription below risco, 0 if radial velocity below risco
Definition: GyotoSimBridge.h:114
virtual void getVelocity(double const pos[4], double vel[4])
Fluid velocity field.
double gammaMin_
minimum value of gamma for power law energy density
Definition: GyotoSimBridge.h:118
virtual SimBridge * clone() const
Cloner.
bool BinFile_
Define if the magnetic field is saved in FITS file or not.
Definition: GyotoSimBridge.h:115
Astronomical objects defined bya a potential/distance.
std::string * boundCond_
Table of string which store the boundary conditions of all dimensions.
Definition: GyotoSimBridge.h:145
double magnetization() const
Get magnetization paramater.
bool circularmotion_
1 if velocity is given in fits data file, 0 if circularmotion is directly given
Definition: GyotoSimBridge.h:113
double * pitch_array_
pitch angle array if quantities in FITS files are radiative coefficients
Definition: GyotoSimBridge.h:136
double floortemperature_
Set minimum of temperature.
Definition: GyotoSimBridge.h:123
Base class for metric description.
virtual std::string className() const
"SimBridge"
double * nu_array_
frequency array if quantities in FITS files are radiative coefficients
Definition: GyotoSimBridge.h:135
double * x2_array_
Second spatial dimension array ( in spherical, Y in Cartesian)
Definition: GyotoSimBridge.h:133
double gammaMax_
maximum value of gamma for power law energy density
Definition: GyotoSimBridge.h:119
SmartPointer< Spectrum::BlackBody > spectrumBB_
Black Body.
Definition: GyotoSimBridge.h:101
double PLindex() const
Get the power law index of the electron distribution function.
Namespace for the Gyoto library.
Definition: GyotoAnsi.h:245
double PLindex_
power law index such that density_elec(E) ∝ E-p
Definition: GyotoSimBridge.h:117
bool temperature_
1 if temperature is given in fits data file, 0 if emission coef is directly given ...
Definition: GyotoSimBridge.h:112
double magnetizationParameter_
magnetization parameter if magnetic field not present in FITS files
Definition: GyotoSimBridge.h:121
double gammaMin() const
Get the minimum gamma factor of the electron distribution function.
Pointers performing reference counting.
Definition: GyotoProperty.h:45
int emisInFile_[4]
Flag that specify which emission coefficients are in the FITS files.
Definition: GyotoSimBridge.h:125
int ntime_
length of time_array_
Definition: GyotoSimBridge.h:138
int nx3_
length of x3_array_
Definition: GyotoSimBridge.h:141
int npitch_
///< length of pitch_array_, optional
Definition: GyotoSimBridge.h:143
virtual void radiativeQ(double Inu[], double Taunu[], double const nu_em[], size_t nbnu, double dsem, state_t const &coord_ph, double const coord_obj[8]=NULL) const
emission and transmission together
Powerlaw synchrotron spectrum.
Astronomical objects defined bya a potential/distance.
Definition: GyotoStandardAstrobj.h:84
std::string boundaryConditions() const
Get the boundary condition array.
Powerlaw synchrotron spectrum.
std::string emissionType() const
Get emission type.
int rotInFile_[3]
Flag that specify which rotation coefficients are in the FITS files.
Definition: GyotoSimBridge.h:127
virtual void fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const
Output a single Property to XML.
I_nu(nu, T) = cst_*2*h*nu^3/c^2/(exp(h*nu/k*T)-1.);.
int nx1_
length of x1_array_
Definition: GyotoSimBridge.h:139
int absInFile_[4]
Flag that specify which absorption coefficients are in the FITS files.
Definition: GyotoSimBridge.h:126
int nnu_
///< length of nu_array_, optional
Definition: GyotoSimBridge.h:142
int nx2_
length of x2_array_
Definition: GyotoSimBridge.h:140
virtual void setParameters(Gyoto::FactoryMessenger *fmp)
Main loop in Subcontractor_t function.
bool cunninghamVel() const
Get the flag which select the velocity prescription below risco.