Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ perf.*
tmp/

.vscode/

*.s
*.ii
*.yaml
*.i
2 changes: 1 addition & 1 deletion Few_body_using_ERK/ERK.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace mp = boost::multiprecision; // for sqrt

using float_mp = mp::number<mp::cpp_dec_float<50>>;
using float_mp = double; // mp::number<mp::cpp_dec_float<50>>;

namespace mino2357{

Expand Down
11 changes: 7 additions & 4 deletions Few_body_using_ERK/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,25 @@ int main() {
auto intv = float_mp("1.0e-5");
auto write_time = float_mp("0.1") * mino2357::min_dt<float_mp>();
auto time = float_mp("0.0");
auto end_time = float_mp("1.0e2");
auto end_time = float_mp("1.0e-3");
mino2357::RKF78<float_mp> rkf78(tol, tol);

for(;;){
rkf78.Integrate(time, dt, x);
if(time > write_time){
//if(time > write_time){
/*
std::cerr << time << " " << angular_momentum(x) << std::endl;

for(size_t i=0; i<num/2; i++){
std::cout << x.vec[i] << " ";
}
std::cout << std::endl;
write_time = time + intv;
}
*/
//write_time = time + intv;
//}
if(time > end_time) {
break;
}
}
std::cout << "finished" << std::endl;
}
4 changes: 2 additions & 2 deletions Few_body_using_ERK/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CXX = /usr/bin/g++
TARGET = main
CXXFLAGS = -Wall -Wextra -O2 -march=native -mtune=native -std=c++2b
CXXFLAGS = -S -save-temps -Wall -Wextra -O2 -march=native -mtune=native -std=c++2b
LDLFLAGS = -lstdc++
SRCS = main.cpp
OBJS = $(SRCS:.cpp=.o)
Expand All @@ -11,4 +11,4 @@ run: all
./$(TARGET)

clean:
rm $(TARGET)
rm $(TARGET)
Binary file removed Simple_Solar_System_double_precision/main2
Binary file not shown.
25 changes: 15 additions & 10 deletions Simple_Solar_System_double_precision/main2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Sun | 1.0 | 0.0
// Mercury | 1.660e-7 | 0.387
// Venus | 2.447e-6 | 0.723
// Eeath | 3.003e-6 | 1.000
// Earth | 3.003e-6 | 1.000
// Mars | 3.226e-7 | 1.524
// Jupiter | 9.543e-4 | 5.204
// Saturn | 2.857e-4 | 9.582
Expand Down Expand Up @@ -46,7 +46,7 @@ namespace mino2357 {
ret.vec[i+1] = float_mp(0.0);
for(size_t j=num/2; j<num; j+=2){
if(j!=i){
auto m_j = m[(j-num/2)/2];
auto m_j = m[(j-num/2)/2];
auto x = u.vec[i-num/2] - u.vec[j-num/2];
auto y = u.vec[i+1-num/2] - u.vec[j+1-num/2];;
auto r = sqrt(x*x + y*y);
Expand All @@ -62,7 +62,7 @@ namespace mino2357 {

template <typename T>
inline std::tuple<T, T> eccentricity_vector(const T& pos_x, const T& pos_y, const T& vel_x, const T& vel_y) noexcept {
T r = sqrt(pos_x * pos_x + pos_y * pos_y);
T r = sqrt(pos_x * pos_x + pos_y * pos_y);
T v = sqrt(vel_x * vel_x + vel_y * vel_y);
T mu = T(1.0);
T rv = pos_x * vel_x + pos_y * vel_y;
Expand Down Expand Up @@ -140,6 +140,7 @@ int main() {

for(size_t i=0;;i++){
rkf78.Integrate(mino2357::time, mino2357::dt, x);
/*
if(i%mino2357::intv == 0){
// position
std::cout << mino2357::time / (float_mp(2.0) * float_mp(3.141592653));
Expand All @@ -148,13 +149,13 @@ int main() {
}
std::cout << std::endl;
// velocity
/*
std::cout << mino2357::time / (float_mp(2.0) * float_mp(3.141592653));
for(size_t i=mino2357::num/2; i<mino2357::num; i+=2){
std::cout << " " << x.vec[i] - x.vec[0] << " " << x.vec[i+1] - x.vec[1];
}
std::cout << std::endl;
*/

//std::cout << mino2357::time / (float_mp(2.0) * float_mp(3.141592653));
//for(size_t i=mino2357::num/2; i<mino2357::num; i+=2){
// std::cout << " " << x.vec[i] - x.vec[0] << " " << x.vec[i+1] - x.vec[1];
//}
//std::cout << std::endl;

// eccentricity_vector
std::cerr << mino2357::time / (float_mp(2.0) * float_mp(3.141592653));
for(size_t i=2; i<mino2357::num/2; i+=2){
Expand All @@ -169,5 +170,9 @@ int main() {

mino2357::write_time = mino2357::time + mino2357::intv;
}
*/
if(mino2357::time > 1.0){
break;
}
}
}
Binary file not shown.
5 changes: 5 additions & 0 deletions Tsuchinshan-ATLAS-2024-10-20/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.log
*.out
main2
log_data/
exp/
Loading