Loading...
Searching...
No Matches
WaveSimulation Class Reference

Simulate the evolution of a wave packet in 2 + 1 domensions. More...

`#include <WaveSimulation.hpp>`

## Public Member Functions

| WaveSimulation (double h, double dt, double T, double x_c, double y_c, double sigma_x, double sigma_y, double p_x, double p_y, double thickness, double pos_x, double ap_sep, double ap, uint32_t slits)
| Constructor for the WaveSimulation class.
| WaveSimulation (double h, double dt, double T, double x_c, double y_c, double sigma_x, double sigma_y, double p_x, double p_y)
| Constructor for the WaveSimulation class with no wall.
void | step ()
| Evolve a step forward in time.
void | simulate (std::string outfile, bool write_each_step=false)
| Evolve the wave packet until the time T has been reached and write U to file.
void | simulate (std::string outfile, std::vector< double > &steps)
| Evolve the wave packet and write U to fileto file at each time step in the vector given.
void | probability_deviation (std::string outfile, bool write_each_step=false)
| Write the deviation of the sum of the probability of U from 1.

## Private Member Functions

void | initialize_U (double x_c, double y_c, double sigma_x, double sigma_y, double p_x, double p_y)
| Initialize the U matrix using an unormalized Gaussian wave packet.
void | initialize_V (double thickness, double pos_x, double aperture_separation, double aperture, uint32_t slits)
| Initialize the V matrix.
void | initialize_V ()
| Initialize the V matrix with no wall.
void | initialize_A ()
| Initialize the A matrix according to the Crank-Nicolson method.
void | initialize_B ()
| Initialize the B matrix according to the Crank-Nicolson method.
void | write_U (std::ofstream &ofile)
| Write the U matrix in a single line to the file buffer given.

## Private Attributes

int32_t | M
| The size.
int32_t | N
| The size of the inner part.
arma::cx_mat | V
| The potential matrix.
arma::cx_mat | U
| The particle wave matrix.
arma::sp_cx_mat | B
| The B matrix.
arma::sp_cx_mat | A
| The A matrix.
double | h
| The step size in both x and y direction.
double | dt
| The step size int the time direction.
double | T
| The end time.

## Detailed Description

Simulate the evolution of a wave packet in 2 + 1 domensions.

Definition at line 22 of file WaveSimulation.hpp.

## Constructor & Destructor Documentation

## WaveSimulation() [1/2]

WaveSimulation::WaveSimulation | ( | double | h,
|  | double | dt,
|  | double | T,
|  | double | x_c,
|  | double | y_c,
|  | double | sigma_x,
|  | double | sigma_y,
|  | double | p_x,
|  | double | p_y,
|  | double | thickness,
|  | double | pos_x,
|  | double | ap_sep,
|  | double | ap,
|  | uint32_t | slits
| ) |  |

Constructor for the WaveSimulation class.

Parameters

  h | The step size in the x and y direction.
  dt | The step size in the temporal dimension.
  T | The total time to simulate.
  x_c | The center of the packet in the x direction.
  y_c | The center of the packet in the y direction.
  sigma_x | The The initial width in the x direction.
  sigma_y | The The initial width in the y direction.
  p_x | The wave packet momentum in the x direction.
  p_y | The wave packet momentum in the y direction.
  thickness | The thickness of the wall in the x direction.
  pos_x | The center of the wall in the x direction.
  ap_sep | The separation between each aperture.
  ap | The aperture width.
  slits | The number of slits.

## WaveSimulation() [2/2]

WaveSimulation::WaveSimulation | ( | double | h,
|  | double | dt,
|  | double | T,
|  | double | x_c,
|  | double | y_c,
|  | double | sigma_x,
|  | double | sigma_y,
|  | double | p_x,
|  | double | p_y
| ) |  |

Constructor for the WaveSimulation class with no wall.

Parameters

  h | The step size in the x and y direction.
  dt | The step size in the temporal dimension.
  T | The total time to simulate.
  x_c | The center of the packet in the x direction.
  y_c | The center of the packet in the y direction.
  sigma_x | The The initial width in the x direction.
  sigma_y | The The initial width in the y direction.
  p_x | The wave packet momentum in the x direction.
  p_y | The wave packet momentum in the y direction.

## Member Function Documentation

## initialize_U()

void WaveSimulation::initialize_U | ( | double | x_c,
|  | double | y_c,
|  | double | sigma_x,
|  | double | sigma_y,
|  | double | p_x,
|  | double | p_y
| ) |  |

private

Initialize the U matrix using an unormalized Gaussian wave packet.

Parameters

  x_c | The center of the packet in the x direction.
  y_c | The center of the packet in the y direction.
  sigma_x | The The initial width in the x direction.
  sigma_y | The The initial width in the y direction.
  p_x | The wave packet momentum in the x direction.
  p_y | The wave packet momentum in the y direction.

## initialize_V()

void WaveSimulation::initialize_V | ( | double | thickness,
|  | double | pos_x,
|  | double | aperture_separation,
|  | double | aperture,
|  | uint32_t | slits
| ) |  |

private

Initialize the V matrix.

Parameters

  thickness | The thickness of the wall in the x direction.
  pos_x | The center of the wall in the x direction.
  ap_sep | The separation between each aperture.
  ap | The aperture width.
  slits | The number of slits.

## probability_deviation()

void WaveSimulation::probability_deviation | ( | std::string | outfile,
|  | bool | write_each_step = `false`
| ) |  |

Write the deviation of the sum of the probability of U from 1.

Parameters

  outfile | The name of the file to write to to file

## simulate() [1/2]

void WaveSimulation::simulate | ( | std::string | outfile,
|  | bool | write_each_step = `false`
| ) |  |

Evolve the wave packet until the time T has been reached and write U to file.

Parameters

  outfile | The name of the file to write to
  write_each_step | Boolean for deciding to write each step to file or just the last step

## simulate() [2/2]

void WaveSimulation::simulate | ( | std::string | outfile,
|  | std::vector< double > & | steps
| ) |  |

Evolve the wave packet and write U to fileto file at each time step in the vector given.

Parameters

  outfile | The name of the file to write to
  steps | What time steps to write U to file.

## write_U()

void WaveSimulation::write_U | ( | std::ofstream & | ofile | ) |

private

Write the U matrix in a single line to the file buffer given.

Parameters

  ofile | The file buffer to write to

## Member Data Documentation

## A

arma::sp_cx_mat WaveSimulation::A

private

The A matrix.

Definition at line 29 of file WaveSimulation.hpp.

## B

arma::sp_cx_mat WaveSimulation::B

private

The B matrix.

Definition at line 28 of file WaveSimulation.hpp.

## dt

double WaveSimulation::dt

private

The step size int the time direction.

Definition at line 31 of file WaveSimulation.hpp.

## h

double WaveSimulation::h

private

The step size in both x and y direction.

Definition at line 30 of file WaveSimulation.hpp.

## M

int32_t WaveSimulation::M

private

The size.

Definition at line 24 of file WaveSimulation.hpp.

## N

int32_t WaveSimulation::N

private

The size of the inner part.

Definition at line 25 of file WaveSimulation.hpp.

## T

double WaveSimulation::T

private

The end time.

Definition at line 32 of file WaveSimulation.hpp.

## U

arma::cx_mat WaveSimulation::U

private

The particle wave matrix.

Definition at line 27 of file WaveSimulation.hpp.

## V

arma::cx_mat WaveSimulation::V

private

The potential matrix.

Definition at line 26 of file WaveSimulation.hpp.

The documentation for this class was generated from the following file:

- include/WaveSimulation.hpp