GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
pulsecalculation.h
Go to the documentation of this file.
1//#pragma once
2
3#include "superarray.h"
4#include "fft.h"
5#include "raytrace_usp.h"
6#include <vector>
7#include "superarray.h"
9
10
11
12namespace GOAT
13{
14 namespace raytracing
15 {
25
26template <class T> class pulseCalculation
27 {
28 public:
37 double findHitTime(int ObjNo);
39 void fieldCalculation(double omega);
40 void setPulseWidth(double dt);
41 void setSpatialResolution(double dx);
42 void setRefractiveIndexFunctions(std::vector<std::function<std::complex<double>(double) > > nList);
44 void setSpectralRanges(int n);
51 void setCenterWavelength(double wvl);
56 void setBandwidth(double dWvl);
62 void setRepetitionRate(double rep);
63
64 void field(double t);
65 void reset();
66 void setReferenceTime(double tref);
69 std::vector<SuperArray<std::vector<gridEntry> > > SA;
70 T rt;
71
72
73
74
75 // protected:
76 /* In this function the default values (trafoparms) for the calculations are set as follows:
77 * dt : 1E-14s
78 * wvl : 1.0µm
79 * nI : 1
80 *
81 */
82 void setDefaults();
84 // std::vector< std::vector<SuperArray<std::vector<gridEntry> > > > SA;
85 double domega;
86 double dWvl=0.02;
87 double dRWvl;
88 INDEX_TYPE nn; // number of cells over the whole width of the calculation space (i.e. 2*r0)
90
91 bool raytracingDone = false;
92
94 double tref = 0.0;
96 };
97
98// ------- some specializations ------------
99 class pulseCalculation_field : public pulseCalculation<Raytrace_field_usp>
100 {
101 public:
102 pulseCalculation_field(Scene& S) : pulseCalculation<Raytrace_field_usp>(S) {}
103 void addBoxDetector(Box* box) { rt.addBoxDetector(box); };
104 void field(double t);
105 };
106
107
109 {
110 double omega0 = 2.0 * M_PI * C_LIGHT_MU_FS / trafoparms.wvl;
111 double Domega = 8.0 * 4.0 * M_LN2 / trafoparms.dt;
112 std::cout << "Domega=" << Domega << std::endl;
113
114
115 // double Domega = 8 * M_PI * C_LIGHT_MU_FS * dWvl / (4.0 * trafoparms.wvl * trafoparms.wvl - dWvl * dWvl);
116 // double Domega = 2.0 * M_PI * C_LIGHT_MU_FS dWvl / (trafoparms.wvl * trafoparms.wvl);
117 double domega = Domega / (double)trafoparms.nI;
118 double omegaStart = omega0 - Domega / 2.0;
119 double omega;
120 double wvl1, wvl2;
121 rt = Raytrace_field_usp(S);
122 double wvl;
123 trafo.initResult(S.r0, rt.SE.nges[0], rt.SE.nges[1], rt.SE.nges[2], S.Obj, S.nObj);
124 // loop over the frequency ranges
125 for (int iOmega = 0; iOmega < trafoparms.nI; iOmega++)
126 {
127 omega = omegaStart + (double)iOmega * domega;
128 wvl = 2.0 * M_PI * C_LIGHT_MU_FS / omega; // center wavelength of the current range
129
130 // ------ for output only ------
131 wvl1 = 2.0 * M_PI * C_LIGHT_MU_FS / (omega - 0.5 * domega);
132 wvl2 = 2.0 * M_PI * C_LIGHT_MU_FS / (omega + 0.5 * domega);
133 std::cout << "% " << iOmega << ":start FFT (" << wvl << "µm)" << "\twvl1=" << wvl1 << "\twvl2=" << wvl2 << "\tomega=" << omega << std::endl << std::flush;
134
135 fieldCalculation(omega); // do the raytracing
136 trafo.calc(static_cast<std::vector<SuperArray<std::vector<gridEntry> > > >(rt.SA), omega - domega * 0.5, omega + domega * 0.5, t); // do the Fourier transform
137 }
138 }
139
140 }
141}
142
143#include "pulsecalculation.hpp"
class which represents a box (cuboid). It is derived by class ObjectShape This class is mainly used f...
Definition box.h:18
Class defining a scene with lightsources and objects. This is a container used to inform the Raytrace...
Definition raytrace.h:28
Template class to store arbitrary information in a 3D-grid This template class provides a virtual 3D-...
Definition superarray.h:26
This class calculates the time dependence of a field which calculated before.
Definition fft.h:50
void field(double t)
add a box as detector
void setCenterWavelength(double wvl)
Set center wavelength of the pulse.
INDEX_TYPE nn
number of cells over the whole width of the calculation space (i.e. 2*r0).
void setSpatialResolution(double dx)
sets the spatial resolution to a value near to dx
double dRWvl
spectral width of one subdivision
double findHitTime(int ObjNo)
Make an estimation, when the pulse hits the object the first time Often it is a problem,...
double dWvl
spectral width of the light (default 20nm)
void setNumReflex(int numReflex)
void setNumWavelengthsPerRange(int nS)
Set number of wavelengths per range. For the calculation, the spectral range is subdivided into a num...
std::vector< SuperArray< std::vector< gridEntry > > > SA
Here, all infos are stored to calculate the pulse (step lengths, index of the medium etc....
SuperArray< GOAT::maths::Vector< std::complex< double > > > SAres
void setPulseWidth(double dt)
Sets the spectral width according to the pulse width and adjusts the widht of the subdivisions.
void setRepetitionRate(double rep)
Set the repetition rate (in fs) The repetition rate is the frequency resolution within the calculatio...
bool raytracingDone
If true, the raytracing part was done and the field calculation starts directly.
void setSpectralRanges(int n)
Number of spectral ranges in which one raytracing calculation is made.
void fieldCalculation(double omega)
This function makes one raytracing step at frequency omega.
void field(double t)
This function calculates the fields at time. Keep in mind, that it works only if the class has the li...
void fieldCalculation()
This function makes the raytracing (normally only used internally)
void reset()
Clears all arrays.
double domega
spectral resolution
void setRefractiveIndexFunctions(std::vector< std::function< std::complex< double >(double) > > nList)
sets the list of functions, which describe the wavelength dependend refractive index (length must be ...
void setBandwidth(double dWvl)
Set Bandwith of the light source(s) Approximately,.
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
constexpr int INEL_MAX_NREFLEX
long long int INDEX_TYPE
Definition superarray.h:16
constexpr double C_LIGHT_MU_FS
speed of light in
Definition constants.h:18
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
Structure, which acts as a container for all informations needed to process the calculation.
Definition fft.h:25