| 1 | package Physics::UEMColumn::Pulse; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Physics::UEMColumn::Pulse - Class representing a pulse for the Physics::UEMColumn simulation | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | use Physics::UEMColumn alias => ':standard'; | ||
| 13 | |||
| 14 | my $pulse = Pulse->new( | ||
| 15 | velocity => '1e8 m/s', | ||
| 16 | number => 1e6, | ||
| 17 | ); | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | use Moose; | ||
| 22 | use namespace::autoclean; | ||
| 23 | |||
| 24 | use Method::Signatures; | ||
| 25 | |||
| 26 | use MooseX::Types::NumUnit qw/num_of_unit/; | ||
| 27 | use Physics::UEMColumn::Auxiliary ':constants'; | ||
| 28 | |||
| 29 | # user specified attributes | ||
| 30 | |||
| 31 | =head1 ATTRIBUTES | ||
| 32 | |||
| 33 | The L<Physics::UEMColumn::Pulse> class defines many attributes, however most are semi-private. From a practical perspective the user need only interact with the first three. The latter however, allow for a more physical creation of the pulse and thus are available to the user. | ||
| 34 | |||
| 35 | =over | ||
| 36 | |||
| 37 | =item C<velocity> | ||
| 38 | |||
| 39 | The velocity of a pulse. This is required and may be zero, though note that without further acceleration the simulation may never come to completion. Unit: m/s | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | has 'velocity' => ( isa => num_of_unit('m/s'), is => 'rw', required => 1 ); | ||
| 44 | |||
| 45 | =item C<location> | ||
| 46 | |||
| 47 | The location of the center of the pulse within the column. Default is C<0>, Unit: m | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | has 'location' => ( isa => num_of_unit('m'), is => 'rw', default => 0 ); | ||
| 52 | |||
| 53 | =item C<number> | ||
| 54 | |||
| 55 | Number of electrons contained in the pulse. Default is C<1> | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | has 'number' => ( isa => 'Num', is => 'rw', default => 1 ); | ||
| 60 | |||
| 61 | my $unit_sigma = num_of_unit('m^2'); | ||
| 62 | my $unit_eta = num_of_unit('(kg m / s)^2'); | ||
| 63 | my $unit_gamma = num_of_unit('kg m^2 / s'); | ||
| 64 | |||
| 65 | # variance attributes | ||
| 66 | |||
| 67 | =item C<sigma_t> / C<sigma_z> | ||
| 68 | |||
| 69 | The spatial variance in the transverse and longitudinal direction respectively. Computing an initial value for C<sigma_z> is still a matter of much interest in the community. Any initialization seen in this code is rather naive. Unit: m^2 | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | has 'sigma_t' => ( isa => $unit_sigma, is => 'rw', lazy => 1, builder => '_make_sigma_t' ); | ||
| 74 | has 'sigma_z' => ( isa => $unit_sigma, is => 'rw', lazy => 1, builder => '_make_sigma_z' ); | ||
| 75 | |||
| 76 | =item C<eta_t> / C<eta_z> | ||
| 77 | |||
| 78 | The local momentum variance in the transverse and longitudinal directions respectively. A value of 0 would imply a perfectly mono-chromated pulse (though this is unphysical). Unit: (kg m / s)^2 | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | has 'eta_t' => ( isa => $unit_eta, is => 'rw', lazy => 1, builder => '_make_eta_t' ); | ||
| 83 | has 'eta_z' => ( isa => $unit_eta, is => 'rw', lazy => 1, builder => '_make_eta_z' ); | ||
| 84 | |||
| 85 | =item C<gamma_t> / C<gamma_z> | ||
| 86 | |||
| 87 | The momentum chirp in the transverse and longitudinal directions respectively. A value of zero would mean that the front, back and center of the pulse all have the same average momentum. Computing an initial value for C<gamma_z> is still a matter of much interest in the community. Any initialization seen in this code is rather naive. Unit: kg m^2 / s | ||
| 88 | |||
| 89 | =cut | ||
| 90 | |||
| 91 | has 'gamma_t' => ( isa => $unit_gamma, is => 'rw', lazy => 1, builder => '_make_gamma_t' ); | ||
| 92 | has 'gamma_z' => ( isa => $unit_gamma, is => 'rw', lazy => 1, builder => '_make_gamma_z' ); | ||
| 93 | |||
| 94 | =item C<liouville_gamma2_t> / C<liouville_gamma2_z> | ||
| 95 | |||
| 96 | The value of the product of C<sigma> and C<eta> in the transverse and longitudinal directions respectively. Since it can be easily shown that these pulses obey Liouville's Theorem, this product is unchanged during propagation. This value is used internally to reduce the number of equations to solve and thus increase solution speed. This value should not be changed manually but will be calculated from values given to quantities above. | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | has 'liouville_gamma2_t' => ( isa => 'Num', is => 'rw', lazy => 1, builder => '_make_lg2_t' ); | ||
| 101 | has 'liouville_gamma2_z' => ( isa => 'Num', is => 'rw', lazy => 1, builder => '_make_lg2_z' ); | ||
| 102 | |||
| 103 | |||
| 104 | # variance attribute initializers | ||
| 105 | method _make_sigma_t () { | ||
| 106 | return $self->initial_width ** 2 / 2; | ||
| 107 | } | ||
| 108 | method _make_sigma_z () { | ||
| 109 | return $self->initial_length ** 2 / 2; | ||
| 110 | } | ||
| 111 | |||
| 112 | method _make_eta_t () { | ||
| 113 | return me * $self->excess_photoemission_energy / 3; | ||
| 114 | } | ||
| 115 | method _make_eta_z () { | ||
| 116 | return $self->eta_t() / 4; | ||
| 117 | } | ||
| 118 | |||
| 119 | method _make_gamma_t () { | ||
| 120 | return 0; | ||
| 121 | } | ||
| 122 | method _make_gamma_z () { | ||
| 123 | return 0; | ||
| 124 | } | ||
| 125 | |||
| 126 | method _make_lg2_t () { | ||
| 127 | return $self->sigma_t * $self->eta_t; | ||
| 128 | } | ||
| 129 | method _make_lg2_z () { | ||
| 130 | return $self->sigma_z * $self->eta_z; | ||
| 131 | } | ||
| 132 | |||
| 133 | # initialization-only attributes | ||
| 134 | |||
| 135 | =item C<initial_width> / C<initial_length> | ||
| 136 | |||
| 137 | These attributes are for convenience only. They may be used to initialize the variance attriutes above. They represent the initial half-width 1/e maximum (HW1/eM) width or length of the pulse. Unit: m | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | my $unit_length = num_of_unit('m'); | ||
| 142 | has 'initial_width' => ( isa => $unit_length, is => 'ro', default => '1 mm' ); | ||
| 143 | has 'initial_length' => ( isa => $unit_length, is => 'ro', default => '1 mm' ); | ||
| 144 | |||
| 145 | =item C<initial_width> / C<initial_length> | ||
| 146 | |||
| 147 | This attribute is for convenience only. It may be used to initialize the variance attriutes above. It represents the excess photoemission energy imparted to the electrons in the pulse by simple photoemission. Unit: J | ||
| 148 | |||
| 149 | =cut | ||
| 150 | |||
| 151 | has 'excess_photoemission_energy' => ( isa => num_of_unit('J'), is => 'ro', default => '0.5 eV' ); | ||
| 152 | |||
| 153 | # propagation history | ||
| 154 | |||
| 155 | =item C<data> | ||
| 156 | |||
| 157 | Holder for an array reference to the raw propagation history data. This should not be changed manually. | ||
| 158 | |||
| 159 | =cut | ||
| 160 | |||
| 161 | has 'data' => ( isa => 'ArrayRef', is => 'rw', default => sub { [] } ); | ||
| 162 | |||
| 163 | =back | ||
| 164 | |||
| 165 | =cut | ||
| 166 | |||
| 167 | __PACKAGE__->meta->make_immutable; | ||
| 168 | |||
| 169 | 1; | ||
| 170 | |||
| 171 | =head1 SOURCE REPOSITORY | ||
| 172 | |||
| 173 | L<http://github.com/jberger/Physics-UEMColumn> | ||
| 174 | |||
| 175 | =head1 AUTHOR | ||
| 176 | |||
| 177 | Joel Berger, E<lt>joel.a.berger@gmail.comE<gt> | ||
| 178 | |||
| 179 | =head1 COPYRIGHT AND LICENSE | ||
| 180 | |||
| 181 | Copyright (C) 2012-2013 by Joel Berger | ||
| 182 | |||
| 183 | This library is free software; you can redistribute it and/or modify | ||
| 184 | it under the same terms as Perl itself. | ||
| 185 |