Make some changes
This commit is contained in:
69
src/main.cpp
69
src/main.cpp
@@ -11,19 +11,14 @@
|
||||
* */
|
||||
#include "WaveSimulation.hpp"
|
||||
#include "utils.hpp"
|
||||
#include <fstream>
|
||||
|
||||
void probability_deviation()
|
||||
{
|
||||
WaveSimulation sim_narrow(.005, 2.5e-5, .008);
|
||||
sim_narrow.initialize_U(.25, .5, .05, .05, 200., 0.);
|
||||
sim_narrow.build_A();
|
||||
sim_narrow.build_B();
|
||||
WaveSimulation sim_narrow(.005, 2.5e-5, .008, .25, .5, .05, .05, 200., 0.);
|
||||
|
||||
WaveSimulation sim_wide(.005, 2.5e-5, .008);
|
||||
sim_wide.build_V(.02, .5, .05, .05, 2);
|
||||
sim_wide.initialize_U(.25, .5, .05, .10, 200., 0.);
|
||||
sim_wide.build_A();
|
||||
sim_wide.build_B();
|
||||
WaveSimulation sim_wide(.005, 2.5e-5, .008, .25, .5, .05, .10, 200., 0.,
|
||||
0.02, .5, .05, .05, 2);
|
||||
|
||||
std::ofstream ofile;
|
||||
utils::mkpath("data");
|
||||
@@ -41,7 +36,8 @@ void probability_deviation()
|
||||
|
||||
sim_narrow.step();
|
||||
sim_wide.step();
|
||||
ofile << i << ',' << sum_narrow << ',' << sum_wide << '\n';
|
||||
ofile << i << ',' << utils::scientific_format(sum_narrow) << ','
|
||||
<< utils::scientific_format(sum_wide) << '\n';
|
||||
}
|
||||
|
||||
ofile.close();
|
||||
@@ -49,11 +45,8 @@ void probability_deviation()
|
||||
|
||||
void color_map()
|
||||
{
|
||||
WaveSimulation sim(.005, 2.5e-5, .008);
|
||||
sim.build_V(.02, .5, .05, .05, 2);
|
||||
sim.initialize_U(.25, .5, .05, .10, 200., 0.);
|
||||
sim.build_A();
|
||||
sim.build_B();
|
||||
WaveSimulation sim(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0., 0.02,
|
||||
.5, .05, .05, 2);
|
||||
|
||||
std::ofstream ofile;
|
||||
ofile.open("data/color_map.txt");
|
||||
@@ -72,50 +65,56 @@ void color_map()
|
||||
|
||||
void detector_screen()
|
||||
{
|
||||
WaveSimulation sim(.005, 2.5e-5, .008);
|
||||
sim.build_V(.02, .5, .05, .05, 1);
|
||||
sim.initialize_U(.25, .5, .05, .10, 200., 0.);
|
||||
sim.build_A();
|
||||
sim.build_B();
|
||||
WaveSimulation *sim = new WaveSimulation(
|
||||
.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0., 0.02, .5, .05, .05, 1);
|
||||
|
||||
std::ofstream ofile;
|
||||
utils::mkpath("data/screen");
|
||||
ofile.open("data/screen/single_slit.txt");
|
||||
ofile << sim.N << '\n';
|
||||
ofile << sim->N << '\n';
|
||||
for (size_t i = 0; i < 80; i++) {
|
||||
sim.step();
|
||||
sim->step();
|
||||
}
|
||||
sim.write_U(ofile);
|
||||
sim->write_U(ofile);
|
||||
ofile.close();
|
||||
|
||||
sim.build_V(.02, .5, .05, .05, 2);
|
||||
sim.initialize_U(.25, .5, .05, .10, 200., 0.);
|
||||
delete sim;
|
||||
sim = new WaveSimulation(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0.,
|
||||
0.02, .5, .05, .05, 2);
|
||||
|
||||
ofile.open("data/screen/double_slit.txt");
|
||||
ofile << sim.N << '\n';
|
||||
ofile << sim->N << '\n';
|
||||
for (size_t i = 0; i < 80; i++) {
|
||||
sim.step();
|
||||
sim->step();
|
||||
}
|
||||
sim.write_U(ofile);
|
||||
sim->write_U(ofile);
|
||||
ofile.close();
|
||||
|
||||
sim.build_V(.02, .5, .05, .05, 3);
|
||||
sim.initialize_U(.25, .5, .05, .10, 200., 0.);
|
||||
delete sim;
|
||||
sim = new WaveSimulation(.005, 2.5e-5, .002, .25, .5, .05, .20, 200., 0.,
|
||||
0.02, .5, .05, .05, 3);
|
||||
|
||||
ofile.open("data/screen/triple_slit.txt");
|
||||
ofile << sim.N << '\n';
|
||||
ofile << sim->N << '\n';
|
||||
for (size_t i = 0; i < 80; i++) {
|
||||
sim.step();
|
||||
sim->step();
|
||||
}
|
||||
sim.write_U(ofile);
|
||||
sim->write_U(ofile);
|
||||
ofile.close();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
probability_deviation();
|
||||
color_map();
|
||||
//probability_deviation();
|
||||
//color_map();
|
||||
detector_screen();
|
||||
|
||||
//std::ofstream ofile;
|
||||
//ofile.open("test.txt");
|
||||
//WaveSimulation sim(.005, 2.5e-5, .008, .25, .5, .05, .10, 200., 0.,
|
||||
//0.02, .5, .05, .05, 2);
|
||||
//sim.solve(ofile);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user