Changeset 13064 for issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp
- Timestamp:
- 08/16/12 10:27:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp
r13051 r13064 8182 8182 * A X^3 + A |rho g (s-z) grad(s)|^2 X - |eps_b|_// = 0 */ 8183 8183 8184 _error_("Not supported yet");8185 8184 int i; 8186 8185 IssmDouble a,c,d,z,s,viscosity; … … 8200 8199 surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss); 8201 8200 PentaRef::GetInputValue(&z,&z_list[0],gauss); 8202 tau_perp = matpar->GetRhoIce() * matpar->GetG() * (s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);8201 tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]); 8203 8202 8204 8203 /* Get eps_b*/ … … 8208 8207 eps_b = sqrt(epsilon[0]*epsilon[0] + epsilon[1]*epsilon[1] + epsilon[0]*epsilon[1] + epsilon[2]*epsilon[2]); 8209 8208 if(eps_b==0.){ 8210 *pviscosity =2.5*pow(10.,17.);8209 *pviscosity = 2.5e+17; 8211 8210 return; 8212 8211 } … … 8216 8215 A=matice->GetA(); 8217 8216 8218 /*Solve for tau_par (http://en.wikipedia.org/wiki/Cubic_function)*/ 8219 a=A; 8220 c=A*tau_perp*tau_perp; 8221 d=-eps_b; 8222 tau_par = -1./(3.*a) * pow(0.5*(27.*a*a*d + sqrt(27.*a*a*d*27.*a*a*d -4.*pow(-3.*a*c,3.))),1./3.); 8223 8224 //printf("=======================================\n"); 8225 //printf("tau_par = %g (%g=0?)\n",tau_par,a*tau_par*tau_par*tau_par+c*tau_par+d); 8226 //printf("a=%g c=%g d=%g\n",a,c,d); 8227 //IssmDouble coeff[4]; 8228 //coeff[0]=d; 8229 //coeff[1]=c; 8230 //coeff[2]=0.; 8231 //coeff[3]=a; 8232 //int numroots; 8233 //IssmDouble roots[3]; 8234 //cubic(coeff,roots,&numroots); 8235 //tau_par=roots[0]; 8236 //for(i=0;i<numroots;i++) printf(" %g ",roots[i]); 8217 /*Solve for tau_perp*/ 8218 int numroots; 8219 IssmDouble roots[3]; 8220 a = A; 8221 c = A *tau_perp*tau_perp; 8222 d = - eps_b; 8223 cubic(a,0.,c,d,roots,&numroots); 8224 tau_par=roots[0]; 8237 8225 //printf(" (%g =0?)\n",a*roots[0]*roots[0]*roots[0]+c*roots[0]+d); 8238 8239 8226 8240 8227 /*Viscosity*/ 8241 viscosity = 1./(2.*A)*pow(tau_par*tau_par + tau_perp*tau_perp ,-2.); 8228 viscosity = 1./(2.*A*(tau_par*tau_par + tau_perp*tau_perp)); 8229 //printf("denom = %g (%g,%g)\n",tau_par*tau_par + tau_perp*tau_perp,tau_par,tau_perp); 8242 8230 _assert_(!isnan(viscosity)); 8243 8231
Note:
See TracChangeset
for help on using the changeset viewer.