Skip to content

Instantly share code, notes, and snippets.

@Corwinpro
Last active February 29, 2016 10:18
Show Gist options
  • Select an option

  • Save Corwinpro/6d8f2d6067f4eda63788 to your computer and use it in GitHub Desktop.

Select an option

Save Corwinpro/6d8f2d6067f4eda63788 to your computer and use it in GitHub Desktop.
#ifndef LASER_FIELD_H
#define LASER_FIELD_H
#include "mytype.h"
#include "reader.h"
#include <cmath>
#include <complex> // std::complex, std::abs
class Laser
{
void PrintCurState(); //Write current laser intensity
bool Check(); //Check laser properties correctness
public:
cRead read;
Laser();
~Laser(){};
void Make(); //Read laser properties from file
void Print(FILE * fp); //Write laser properties to file
double LaserEnergy; //Laser Energy [J]
double LaserWL; //Laser wavelength [m]
double LaserDiam; //Laser Spatial Diameter [m]
double LaserPulseWidth; //Laser Pulsewidth [sec]
double LaserPulseCenter;//Laser pulse center [sec]
double LaserYPosition; //Laser Position [m]
double LaserZPosition; //Laser Position [m]
double Intensity; //Laser intensity
double LaserOmega; //Laser omega
double LaserK; //Laser wavenumber
};
class Laser_Field
{
//double tau; //Time interval for the changed field to calculate
//int BulkCells; //Number of bulk cells
//int TimeLayers; //Number of time layers requiered for a numerical scheme
double * FullEField; // Electrical Field array
R8 * ForceX; // array for analytical force value storage
//void CalcFieldAnalytic(); //Analytically dependent field calculation /Shneider/
//void CalcFieldNumerical(); //Numerical Scheme
//void SetInitialField(); //Setting initial field value to Field
//void SetBoundaryField(); //Setting boundary field conditions
complex<double> * EL_plus;
complex<double> * EL_minus;
complex<double> * ER_plus;
complex<double> * ER_minus;
double * E_Interference;
int count_field_write;
void CalcInterference(); // calc <E^2> = 1/2 |E1+E2|^2
public:
const R8 epsilon0;
const R8 mu0;
const R8 molAlpha;
R8 Sparam;
R8 BulkLength;
FILE * file;
bool AnalytModel;
bool LayerModel;
void CalcForce_Analytical(); //analytical model of applied force #CalcForce()
void CalcForce_LayerModel();
void CalcField_LayerModel();
R8 ExternalForceX(R8 position); //Returns a force applyed to a particle. MolAlpha, time and position are required
void VelocityChange(V8 * vel, V8 * pos, R8 step, int gas, int cell);
void CalcForce(); // after ParallelerCollect calculate force gradients
void ParallelCollect();
void Make();
Laser_Field():epsilon0(8.854187817620389E-12),molAlpha(1.83e-40),mu0(1.26e-6){ //1.83
FullEField = NULL;
ForceX = NULL;
EL_plus = NULL;
EL_minus = NULL;
ER_plus = NULL;
ER_minus = NULL;
E_Interference = NULL;
}
~Laser_Field(){
delete [] FullEField;
delete [] ForceX;
}
};
class MacroParameters
{
int ArrSize;
R8 EffWL;
R8 EffK;
R8 EffOmega;
int StartCell;
R8 GetDenstAmplitude(R8 phase); //calculates assumed sin-like density amplitude by the given phase
R8 DenstDiffToMinimize(R8 phase); //function to be minimized during sin-like density processing
R8 DenstFromSinDeviation(R8 phase);
public:
void Make();
R8 * denst;
void DenstGather(); //gather number density over all procs using paral_parent.h
R8 * refractIndex;
void refractIndexGather(); //calc refr index based on *denst
R8 DenPhase;
R8 DenAmplitude;
R8 DenAverage;
void GetDenstForm(); //process density into sin-like signal with DenAmplitude, DenPhase and DenAverage
void GetDenstForm(int CellNumber); //process density into sin-like signal with DenAmplitude, DenPhase and DenAverage
FILE * file;
FILE * fileT;
MacroParameters()
{
R8 * denst = NULL;
R8 * refractIndex = NULL;
}
~MacroParameters(){
delete [] denst;
delete [] refractIndex;
fclose(fileT);
}
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment