Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

not time symmetric

  • Loading branch information...
commit 5f4a2cb4c3587a6bf4ce92c7d37d6dea1e36f603 1 parent 9af6e9e
@hannorein authored
Showing with 5 additions and 35 deletions.
  1. +3 −2 problems/rings/Makefile
  2. +2 −33 problems/rings/problem.c
View
5 problems/rings/Makefile
@@ -1,11 +1,12 @@
PROBLEMDIR=$(shell basename `dirname \`pwd\``)"/"$(shell basename `pwd`)
export OPENGL=1
+export OPT+=-O3
all:
# Setup link to different modules
- ln -fs gravity_direct.c ../../src/gravity.c
+ ln -fs gravity_none.c ../../src/gravity.c
ln -fs boundaries_open.c ../../src/boundaries.c
- ln -fs integrator_leapfrog.c ../../src/integrator.c
+ ln -fs ../$(PROBLEMDIR)/integrator_mikkolamerritt.c ../../src/integrator.c
ln -fs collisions_none.c ../../src/collisions.c
# Setup link to problem file
ln -fs ../$(PROBLEMDIR)/problem.c ../../src/problem.c
View
35 problems/rings/problem.c
@@ -44,7 +44,7 @@ struct particle planet;
void problem_init(int argc, char* argv[]){
// Setup constants
- dt = M_PI*1e-3*1.1234125235345;
+ dt = M_PI*1.e-3*1.1234125235345;
boxsize = 2.8;
N_active = 2;
init_box();
@@ -95,7 +95,7 @@ void problem_init(int argc, char* argv[]){
void problem_output(){
- if(output_check(1000.*dt)){
+ if(output_check(10.*dt)){
output_timing();
}
if(output_check(124.)){
@@ -104,37 +104,6 @@ void problem_output(){
}
}
void problem_inloop(){
- // Star
- const double sx = particles[0].x;
- const double sy = particles[0].y;
- const double sz = particles[0].z;
- const double svx = particles[0].vx;
- const double svy = particles[0].vy;
- const double svz = particles[0].vz;
- for (int i=2;i<N;i++){
- const double px = particles[i].x;
- const double py = particles[i].y;
- const double pz = particles[i].z;
- const double pvx = particles[i].vx;
- const double pvy = particles[i].vy;
- const double pvz = particles[i].vz;
- const double prx = px-sx;
- const double pry = py-sy;
- const double prz = pz-sz;
- const double prvx = pvx-svx;
- const double prvy = pvy-svy;
- const double prvz = pvz-svz;
-
- const double beta = 0.12;
- const double pr = sqrt(prx*prx + pry*pry + prz*prz); // distance relative to star
- const double c = 10064.915; // speed of light.
- const double rdot = (prvx*prx + prvy*pry + prvz*prz)/pr; // radial velocity relative to star
- const double F_r = beta*G*star.m/(pr*pr);
-
- particles[i].vx += F_r*((1.-rdot/c)*prx/pr - prvx/c)*dt;
- particles[i].vy += F_r*((1.-rdot/c)*pry/pr - prvy/c)*dt;
- particles[i].vz += F_r*((1.-rdot/c)*prz/pr - prvz/c)*dt;
- }
}
void problem_finish(){
Please sign in to comment.
Something went wrong with that request. Please try again.