/* */ /* 5/10/95 10/10/96 09/10/97 */ /*dt=.001 itmax=300 ittmax=100 omega0=.0 domegasdt=3 A0=1; echy=1; omega=1; lbd=.150; k=(2*Pi)*(2*Pi); u=.001; up=.0; */ #include #include #include "math.h" #include "rgraph.h" #include "param.c" #ifdef powerc #include #endif /*#include "unix.h"*/ double dt,t; double* theta=NULL; double A0,omega0,domegasdt,lbd,k,omega; double Pi; FILE *f,*g,*fe; int nx,NL; void axes(float *xbas,float *x0,int *nx,float *dx, float *ybas,float *xhaut,float *yhaut,int *npix,int *npiy); double FF1(double x,double y,double z); double FF2(double x,double y,double z); void main(void) { int i,it,itt,itmax,ittmax; int npix,npiy; int nbt; float fdt; float x,x0,xbas,ybas,xhaut,yhaut,tmax; float xp1,yp1,xp2,yp2,echy; float xu1,yup1,xu2,yup2; float us; int icoul; double u,up; double du1,dup1,du2,dup2,du3,dup3,du4,dup4; int itom,itomax; /* Place the window¹s top left corner at (5,40). */ #ifdef powerc SIOUXSettings.toppixel =80; SIOUXSettings.leftpixel =20; SIOUXSettings.rows = 10; //SIOUXSettings.columns = 40; #endif /* ouverture des fichiers de sauvegarde */ g = fopen("F.IN", "r"); printf("Bench E24 L14 Stokes .12 Lapl.17 \n"); printf(" \n"); printf(" Resolution du pendule force \n"); printf(" 2 \n"); printf(" d u du \n"); printf(" --- + lbd -- + k sin(u) - omega sin(u) cos(u) \n"); printf(" 2 dt \n"); printf(" dt \n"); printf(" \n"); printf(" f(u)= u lineaire ! \n"); /* lecture du fichier donnees */ fscanf(g,"dt=%f \n",&fdt); dt=fdt; printf("pas de temps dt=%f\n",dt); fscanf(g,"itmax=%i \n",&itmax); fscanf(g,"ittmax=%i \n",&ittmax); printf("affichage toutes les %i iter, soit dt=%f \n",ittmax,dt*ittmax); tmax=itmax*ittmax*dt; printf("itmax=%d t max=itmax*ittmax*dt= %7f \n",itmax,tmax); fscanf(g,"omega0=%f \n",&xp1); omega0=xp1; fscanf(g,"domegasdt=%f \n",&xp1); domegasdt=xp1; printf("omega(t)=%g+%g *t \n",omega0,domegasdt); /* ajustement de quelques constantes */ Pi=atan(1)*4; A0=1; echy=.75; omega=1; lbd=.1; k=(2*Pi)*(2*Pi); //u=.0000002; fscanf(g,"u(0)=%f \n",&xp1); u=xp1; //u=.02; up=.0; /* fin des lectures */ /* declaration */ nbt=nx+15; theta=(double*)calloc(nbt,sizeof(double)); /* fin declaration */ /* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ /* init graphique/ trace des axes */ initgraphique(); x0=0;nx=itmax*ittmax; fdt=(float)dt; axes(&xbas,&x0,&nx,&fdt,&ybas,&xhaut,&yhaut,&npix,&npiy); /* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ printf(".............................................\n"); itomax=2; for (itom=1;itom