void dnsbsd_tmmt( double phi[nvar], double dep[ndep], double F_i[nvar][nvar]) { int ivar, idir, iidir; // density jacobian ---------------- F_i[Pvar][Pvar] = drdp( phi); F_i[Pvar][Tvar] = drdt( phi); //printf(" %f %f\n", F_i[Pvar][Pvar], F_i[Pvar][Tvar]); for (idir=0;idir<ndir;idir++) { // momentum jacobian --------------- F_i[Uvar+idir][Pvar] = drdp( phi) * phi[Uvar+idir]; F_i[Uvar+idir][Uvar+idir] = dep[Rdep]; F_i[Uvar+idir][Tvar] = drdt( phi) * phi[Uvar+idir]; // enthalpy jacobian/1 ------------- F_i[Tvar][Uvar+idir] = dep[Rdep] * phi[Uvar+idir]; } // enthalpy jacobian/2 ------------- F_i[Tvar][Pvar] = drdp( phi) - ( 1.0 * dep[Rdep] * dhdp( phi)); F_i[Tvar][Tvar] = drdt( phi) * enthalpy( phi) + dep[Rdep] * dhdt( phi); for (ivar=Tvar+1;ivar<nvar;ivar++) F_i[ivar][ivar] = dep[Rdep]; }
// Function which calculates A double Alpha(char *process, char *gas, double p1, double p2, double t1, double t2, double rho1, double rho2, double h1, double h2, struct data *pdat){ double w, Cpu, Cpb; w=Cpu=Cpb=0.; if(strcmp(process,"COMPRESSION")==0){ Cpu=.08*2220. + .92*1000.; w=(drdt(process,t1,t2,rho1,rho2,pdat)\ /drdp(process,t1,p1,p2,rho1,rho2,pdat))*(1./rho1)+Cpu; } else if(strcmp(process,"COMBUSTION")==0){ if(strcmp(gas,"u")==0){ Cpu=.08*2220. + .92*1000.; w=(drdt(process,t1,t2,rho1,rho2,pdat)\ /drdp(process,t1,p1,p2,rho1,rho2,pdat))*(1./rho1)+Cpu; } else if(strcmp(gas,"b")==0){ Cpb=.18*850.+.1*4180.+.72*1042.; w=(drdt(process,t1,t2,rho1,rho2,pdat)\ /drdp(process,t1,p1,p2,rho1,rho2,pdat)); w*=((1./rho1)-(1.e-5)*dhdp(gas,p1,p2,h1,h2,pdat))+Cpb; } } else if(strcmp(process,"EXPANSION")==0){ Cpb=.18*850.+.1*4180.+.72*1042.; w=(drdt(process,t1,t2,rho1,rho2,pdat)\ /drdp(process,t1,p1,p2,rho1,rho2,pdat)); w*=((1./rho1)-(1.e-5)*dhdp(gas,p1,p2,h1,h2,pdat))+Cpb; } return(w); }
// Function which calculates Bhta double Bhta(char *process, char *gas, double p1, double p2, double t1, double t2, double rho1, \ double rho2, double h1, double h2, struct data *pdat){ double w=0.; if(strcmp(process,"COMPRESSION")==0){ w=(1./drdp(process,t1,p1,p2,rho1,rho2,pdat)); } else if(strcmp(process,"COMBUSTION")==0){ if(strcmp(gas,"u")==0){ w=(1./drdp(process,t1,p1,p2,rho1,rho2,pdat)); } else if(strcmp(gas,"b")==0){ w=(1./drdp(process,t1,p1,p2,rho1,rho2,pdat))\ *(1.-(1.e-5)*rho1*dhdp(gas,p1,p2,h1,h2,pdat)); } } else if(strcmp(process,"EXPANSION")==0){ w=(1./drdp(process,t1,p1,p2,rho1,rho2,pdat))\ *(1.-(1.e-5)*rho1*dhdp(gas,p1,p2,h1,h2,pdat)); } return(w); }
// Function which calculates the derivative of pressure double funcf2(char *process, char *gas, int cycl, double angle,double t1, double t2, double t3, double p1, double p2, double v1, double v2, double v1p, double v2p, double dv1, double dv2, double m1, double m2, double m1p, double m2p, double dm1, double dm2, struct data *pdat){ double w,rho1,rho2,h1,h2; w=rho1=rho2=h1=h2=0.; if(strcmp(process,"COMPRESSION")==0){ if(v1<=(*pdat).Vc){ rho1=m1/(*pdat).Vc; check(&rho1); }else{ rho1=m1/v1; check(&rho1); } w=1.e-5*rho1*(1./drdp(process,t1,p1,p2,rho1,rho2,pdat)); w*=(-((sin(angle)+.5*sin(2.*angle)\ *(*pdat).R)/(1.-cos(angle)+.5*(*pdat).R*pow(sin(angle),2.)))-\ (1./rho1)*drdt(process,t1,t2,rho1,0.,pdat)*funcf1(process,gas,cycl,angle, \ t1,t2,t3,p1,p2,v1,v2,v1p,v2p,dv1,dv2,m1,m2,m1p,m2p,dm1,dm2,pdat)); } else if(strcmp(process,"COMBUSTION")==0){ if(strcmp(gas,"u")==0){ h1=enthalpy(t1,MBr); if((m1<=1.e-10)&&(v1<=1.e-10)){ rho1=1.e-10;} else{ if(m1<=1.e-10){ rho1=1.e-10;} else{ rho1=m1/v1; check(&rho1);} } h2=enthalpy(t2,MBr); if((m1p<=1.e-10)&&(v1p<=1.e-10)){ rho1=1.e-10;} else{ if(m1p<=1.e-10){ rho2=1.e-10;} else{ rho2=m1p/v1p; check(&rho2);} } w=rho1*(1./drdp(process,t1,p1,p2,rho1,rho2,pdat))*(-(dv1/v1)-(1./rho1)* \ drdt(process,t1,t2,rho1,rho2,pdat)* \ funcf1(process,gas,cycl,angle, \ t1,t2,t3,p1,p2,v1,v2,v1p,v2p,dv1,dv2, \ m1,m2,m1p,m2p,dm1,dm2,pdat)+(dm1/m1)); } else if(strcmp(gas,"b")==0){ h1=enthalpy(t1,MBp); if((m2<=1.e-10)&&(v2<=1.e-10)){ rho1=1.e-10;} else{ if(m2<=1.e-10){ rho1=1.e-10;} else{ rho1=m2/v2; check(&rho1);} } h2=enthalpy(t2,MBp); if((m2p<=1.e-10)&&(v2p<=1.e-10)){ rho1=1.e-10;} else{ if(m2p<=1.e-10){ rho2=1.e-10;} else{ rho2=m2p/v2p; check(&rho2);} } w=rho1*(1./drdp(process,t1,p1,p2,rho1,rho2,pdat))*(-(dv2/v2)-(1./rho2)*\ drdt(process,t1,t2,rho1,rho2,pdat)*\ funcf1(process,gas,cycl,angle,\ t1,t2,t3,p1,p2,v1,v2,v1p,v2p,dv1,dv2,\ m1,m2,m1p,m2p,dm1,dm2,pdat)+(dm2/m2)); } } else if(strcmp(process,"EXPANSION")==0){ if(v1<=(*pdat).Vc){ rho1=m1/(*pdat).Vc; check(&rho1); }else{ rho1=m1/v1; check(&rho1); } w=1.e-5*rho1*(1./drdp(process,t1,p1,p2,rho1,0.,pdat)); w*=(-((sin(angle)+.5*sin(2.*angle)*(*pdat).R)/(1.-cos(angle)+.5*(*pdat).R*\ pow(cos(angle),2.)))-(1./rho1)*drdt(process,t1,t2,rho1,0.,pdat)*\ funcf1(process,gas,cycl,angle,\ t1,t2,t3,p1,p2,v1,v2,v1p,v2p,dv1,dv2,\ m1,m2,m1p,m2p,dm1,dm2,pdat)); } return(w); }