summaryrefslogtreecommitdiff
path: root/lpic/src/pulse.h
blob: b71214797334de792dce2c0c6933010567a69e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
   This file is part of LPIC++, a particle-in-cell code for
   simulating the interaction of laser light with plasma.

   Copyright (C) 1994-1997 Roland Lichters

   LPIC++ is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

//////////////////////////////////////////////////////////////////////////////////////////
//
// laser pulses : linear, sin, sin^2
//
//////////////////////////////////////////////////////////////////////////////////////////


#ifndef PULSE_H
#define PULSE_H

#include <common.h>
#include <math.h>
#include <error.h>
#include <parameter.h>
#include <fstream>
#include <iomanip>
#include <readfile.h>

//////////////////////////////////////////////////////////////////////////////////////////

class pulse_component {
private:
  char errname[filename_size];

public:
//  int    Q;
  
  double Qy;            // polarization dependent
  double Qz;            // "
  double shift;         // relative shift between y and z for circular polarization

  int    shape;         // 1=linear, 2=sin, 3=sinsqr
  int    polarization;  // 1=s, 2=p, 3=circular
  double a0;            // dimensionless amplitude
  double raise;         // raise time in fundamental periods
  double duration;      // pulse duration in fundamental periods
  double delay;         // time before puls starts propagation
  double phase;         // phaseshift
  double chirp;         // linear chirp "d omega/d t" in "fundamental frequency / fundamental period" = 2 pi T^-2
  double nharm;         // frequency in omega at the middle ("center") of the pulse
  double center;        // middle of the pulse

  void   read_parameters( parameter &p, char *side, int component );
  double           field( double t, int pol ); // pol=0 -> y, pol=1 -> z
  double        envelope( double t );
};

class input_pulse {
private:
  char errname[filename_size];
  
public:
  int    Q;

/*  int    shape;         // 1=linear, 2=sin, 3=sinsqr
  int    polarization;  // 1=s, 2=p, 3=circular
  double a0;            // dimensionless amplitude of 1omega light
  double raise;         // raise time in periods
  double duration;      // pulse duration in periods
  double delay;         // time before puls starts propagation
  double a2, a3, an;    // amplitudes of 2omega, 3omega and nomega
  double p2, p3, pn;    // phases of 2omega, 3omega and nomega
  double d2, d3, dn;    // relative delays of 2omega, 3omega and nomega
  double nharm;         // frequency nomega over omega  */

  pulse_component pcs [4];

  int    Q_save;
  double save_step;

  double time_start, time_stop;  // simulation time interval in periods

  int    Q_restart;

  readfile rf;
  input_pulse( parameter &p, char *side, int pulse_number );
  void save( parameter &p, int pulse_number );
};

//////////////////////////////////////////////////////////////////////////////////////////

class pulse {

private:

  static int pulse_number; // counts elements of type pulse

  input_pulse input;

  char   errname[filename_size];
  char   *path;

public:

/*  double Qy;            // polarization dependent
  double Qz;            // "
  double shift;         // relative shift between y and z for circular polarization */


            pulse( parameter &p, char *side );
  void      save( double t_start, double t_stop, double t_step );
  double    field( double t, int pol );
/*  double    field( double t );
  double envelope( double t );*/
};


//////////////////////////////////////////////////////////////////////////////////////////

#endif