#define VERN "sphmode4.cpp" // sphmode4.cpp Jul 8 Corrected TA normalization // Take old values of TA and multiply by (0.53301)^2 to get new. // sphmode2 Jul 8 fixed error in determ. ratio // Jul 8 minor change // sphmode.cpp Jul 7 // spheroi.cpp Jul 7 look for non-initialization error // ( I didn't find any ) // 4 // 3 Jul 6 - add spheroidal modes // 2 Jul 6 - generalized to include toroidal modes // - (Big puzzle that XZ component of stress does not vanish!) // hollsph1.cpp Jul 5 start to work on modes of hollow sphere // - SphBess() now 1st kind or 2nd kind // July 4 - generalize to order n // wetdog2.cpp July 3, 2002 Find beta for wet dog mode exactly, // find finding zeroes in the strain matrix. #include #include #include #include #include #include #include #include #include void makescr(void); double LegenP(int n,double x); double SphBess(int kind,int n,double x); double SeriesSphBess(int kind,int n,double x); double rPix(int n,double x,double y,double z); double rPiy(int n,double x,double y,double z); double rPiz(int n,double x,double y,double z); double CrPix(int n,double x,double y,double z); double CrPiy(int n,double x,double y,double z); double CrPiz(int n,double x,double y,double z); double C2rPix(int n,double x,double y,double z); double C2rPiy(int n,double x,double y,double z); double C2rPiz(int n,double x,double y,double z); double THETAx(int n,double x,double y,double z); double THETAy(int n,double x,double y,double z); double THETAz(int n,double x,double y,double z); double factorial(double arg); void Eval_u(double x1,double y1,double z1); double angle_delta,uX,uY,uZ; double divm[3][3]; double toremat[3][3]; double sphemat[3][3]; double emat[3][3]; int modetype,besselkind=-1,nn; double Pi; // Properties of material: //double lambdaLame1=0.58385; double lambdaLame1; double ShearModG=0.38415; //double nuPoisson=0.301575; double nuPoisson=0.301575; double Cs,Cl,ks,kl; double dx=0.0001; double alpha,beta,ObjRad=1.0; // ObjRad=radius of sphere void main(void) { // main clrscr(); gotoxy(1,1);cout<<"Find spheroidal modes:"; gotoxy(2,4);cout<<"(0 = 0.301575 fcc value) "; gotoxy(2,2);cout<<"nu? ";cin>>nuPoisson; // Poisson ratio="<>rinbyR; //if (rinbyR<=0) return; //gotoxy(40,2);cout<<" "; //gotoxy(1,5);cout<<"(1=toroidal 2=spheroidal 3=wet dog)"; //gotoxy(1,3);cout<<"Mode type? ";cin>>modetype; //if (modetype<=0) return; //gotoxy(1,5);cout<<" "; gotoxy(10,3);cout<<"What is the order n? ";cin>>nn; if (nn<0) return; double x1,y1,z1; double ax2,ax1,ay2,ay1,az2,az1; double bx2,bx1,by2,by1,bz2,bz1; double cx2,cx1,cy2,cy1,cz2,cz1; double vala1,vala2,valb1,valb2; double valXZa1,valXZa2,valXZb1,valXZb2; double valXXa1,valXXa2,valXXb1,valXXb2; int i1,i2,countroots; double sphstressxx; double torstressxx; double divu,deter15,deter150,deter,TAfactor15,dbeta; LB1: deter150=0; countroots=0; gotoxy(1,4);cout<<"beta? (enter x=-1 to quit) "; gotoxy(1,4);cout<<"beta? ";cin>>beta; gotoxy(1,4);cout<<"beta = "<>dbeta; if (dbeta<0) return; gotoxy(5,5);cout<<"( was "<2)) {cout<<"** kind="<14) {cout<<"* x ="<>scrfilename; scrfout=fopen(scrfilename,"wb"); unsigned char ch1b,ch2b,ch3b,ch4b,ch5,ch6; int scrwid=640; int ipybot=400; int ipytop=300; int scrhgt=ipybot-ipytop; int scrx0=0; int scry0=ipytop; setcolor(15); line(scrx0,scry0-1,scrwid+scrwid-1,scry0-1); line(scrx0,scry0+scrhgt,scrwid+scrwid-1,scry0+scrhgt); ch3b=scrwid/256; ch1b=scrwid%256; ch4b=scrhgt/256; ch2b=scrhgt%256; fprintf(scrfout,"%c%c%c%c%c%c%c%c%c%c%c%c%c",'s','c','r',ch3b,ch1b,ch4b,ch2b,'0','0','0','0',13,10); int ipixcol,ix,iy; gotoxy(65,10);cout<<"saving "; for (iy=scry0;iy0) theta2=atan(sqrt(x2*x2+y2*y2)/z2); else theta2=Pi-atan(sqrt(x2*x2+y2*y2)/fabs(z2)); } // phi2=0; if (x2!=0) { // if (x2>0) phi2=atan(y2/x2); else phi2=Pi+atan(y2/x2); } // else { //. if (y2>0) phi2 = Pi*0.5; else phi2 = -Pi*0.5; }//. LP2=LegenP(nn,cos(theta2+0.5*dx)); LP1=LegenP(nn,cos(theta2-0.5*dx)); wdphi2=SphBess(besselkind,nn,r2)*(LP2-LP1)/dx; wdtheta2=0; wdr2=0; wdx2=wdr2*sin(theta2)*cos(phi2)+(-wdphi2*sin(phi2))+cos(theta2)*cos(phi2)*wdtheta2; wdy2=wdr2*sin(theta2)*sin(phi2)+( wdphi2*cos(phi2))+cos(theta2)*sin(phi2)*wdtheta2; wdz2=wdr2*cos(theta2)-sin(theta2)*wdtheta2; } // 3 wet dog mode //gotoxy(1,7);cout<<"u phi = "<