// 2015.08.24 // This code calculates Restcicted-3body problem // with the modified Euler scheme. #include #include #include #define np 1000 //number of test particles #define nfmax 20 //maximum number of orbital files #define dt 0.01 //timestep #define TTOTAL 100 //totaltime //#define Me 3.0e-6 //mass of earth #define Me 1.0e-2 //mass of jupiter #define Ms 1.0 //mass of sun #define Tr 1.0 //orbital period // constant timestep // 2 dimension double forcex(double xtmp,double ytmp,double vxtmp,double vytmp); double forcey(double xtmp,double ytmp,double vxtmp,double vytmp); double m1,m2,mu1,mu2,mubar,rs,re; int main(void) { FILE *fout[nfmax],*foutall,*fout2body,*foutlag; double t,x[np][2],v[np][2]; double xcom[np][2],vcom[np][2];//計算用配列 double f[np][2],xl[5][2],alpha,beta; char name1[100]; int i,n,nf; /***** output *****/ printf("np=%d,nfmax=%d,np/nfmax=%d\n",np,nfmax,np/nfmax); for(nf=0 ; nfnfmax){ printf("nf is larger than nfmax!\n"); printf("nf=%d nfmax=%d\n",nf,nfmax); exit(1); } } } } for(n=0 ; n