Fixed a bug in the scattering experiment code and added calculation of gravity along an orbit (for referee report)
This commit is contained in:
parent
582f1f4d8b
commit
4839f130fa
2 changed files with 633 additions and 5 deletions
621
gravity_along_orbit.ipynb
Normal file
621
gravity_along_orbit.ipynb
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -123,6 +123,12 @@ public:
|
||||||
n(data[0].size()),
|
n(data[0].size()),
|
||||||
tolerance(0.1)
|
tolerance(0.1)
|
||||||
{
|
{
|
||||||
|
constexpr double pc_to_kpc = 0.001;
|
||||||
|
for (unsigned i = 0; i < n; i++) {
|
||||||
|
data[0][i] *= pc_to_kpc;
|
||||||
|
data[1][i] *= pc_to_kpc;
|
||||||
|
data[2][i] *= pc_to_kpc;
|
||||||
|
}
|
||||||
constexpr double kms_to_kpcGyr = 1.0226911647958985;
|
constexpr double kms_to_kpcGyr = 1.0226911647958985;
|
||||||
for (unsigned i = 0; i < n; i++) {
|
for (unsigned i = 0; i < n; i++) {
|
||||||
data[3][i] *= kms_to_kpcGyr;
|
data[3][i] *= kms_to_kpcGyr;
|
||||||
|
|
@ -133,10 +139,11 @@ public:
|
||||||
bool operator()(const double w[6]) const override
|
bool operator()(const double w[6]) const override
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < n; i++) {
|
for (unsigned i = 0; i < n; i++) {
|
||||||
for (unsigned k = 0; k < 6; k++) {
|
unsigned k;
|
||||||
if (abs((w[k] - data[k][i])/w[k]) > 0.1) break;
|
for (k = 0; k < 6; k++) {
|
||||||
return true;
|
if (abs((w[k] - data[k][i])/w[k]) > tolerance) break;
|
||||||
}
|
}
|
||||||
|
if (k==6) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +348,7 @@ int main()
|
||||||
|
|
||||||
auto zzzzz = Match_data();
|
auto zzzzz = Match_data();
|
||||||
|
|
||||||
Scattering_experiment scattering_experiment("results.dat", t_max, 1024*1024, uniform_sphere_escape_velocity_cutoff, std::ref(zzzzz));
|
Scattering_experiment scattering_experiment("results.dat", t_max, 1024*1024*16, uniform_sphere_escape_velocity_cutoff, std::ref(zzzzz));
|
||||||
scattering_experiment.set_concurrency(80);
|
scattering_experiment.set_concurrency(80);
|
||||||
scattering_experiment.write_header();
|
scattering_experiment.write_header();
|
||||||
scattering_experiment.launch();
|
scattering_experiment.launch();
|
||||||
|
|
@ -349,4 +356,4 @@ int main()
|
||||||
std::cout << "Bye\n";
|
std::cout << "Bye\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue