Changeset 17650
- Timestamp:
- 04/04/14 15:40:43 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r17647 r17650 7 7 #include "../cores/cores.h" 8 8 9 //#define FSANALYTICAL 109 //#define FSANALYTICAL 2 10 10 11 11 /*Model processing*/ … … 3209 3209 ElementVector* StressbalanceAnalysis::CreatePVectorFS(Element* element){/*{{{*/ 3210 3210 3211 int i,meshtype,dim ;3211 int i,meshtype,dim,fe_FS; 3212 3212 IssmDouble x_coord,y_coord,z_coord; 3213 3213 IssmDouble Jdet,forcex,forcey,forcez; 3214 3214 IssmDouble *xyz_list = NULL; 3215 3215 3216 element->FindParam(&fe_FS,FlowequationFeFSEnum); 3216 3217 element->FindParam(&meshtype,MeshTypeEnum); 3217 3218 switch(meshtype){ … … 3271 3272 xDelete<IssmDouble>(vbasis); 3272 3273 xDelete<IssmDouble>(xyz_list); 3274 if(fe_FS==XTaylorHoodEnum){ 3275 ElementVector* pe2=CreatePVectorFSViscousXTH(element); 3276 ElementVector* pe3 = new ElementVector(pe,pe2); 3277 delete pe; 3278 delete pe2; 3279 return pe3; 3280 } 3273 3281 return pe; 3274 3282 }/*}}}*/ … … 3552 3560 xDelete<IssmDouble>(xyz_list); 3553 3561 xDelete<IssmDouble>(Dstar); 3554 xDelete<IssmDouble>(d);3562 xDelete<IssmDouble>(d); 3555 3563 xDelete<IssmDouble>(D); 3556 3564 xDelete<IssmDouble>(tau); … … 4382 4390 +2.*(epsxy_old*epsxy_old + epsxz_old*epsxz_old + epsyz_old*epsyz_old)); 4383 4391 } 4392 /*Initial guess cannot be 0 otherwise log(0) - inf*/ 4393 if(dnorm==0.) dnorm=1.; 4384 4394 NewtonSolveDnorm(&dnorm,coef1,coef2,coef3,n,dnorm); 4395 _assert_(dnorm>=0.); 4396 _assert_(!xIsNan<IssmDouble>(dnorm)); 4385 4397 4386 4398 /*Create Ke*/ … … 4414 4426 Matrix3x3Solve(&d_yy[0],Ke,pe_yy); 4415 4427 Matrix3x3Solve(&d_xy[0],Ke,pe_xy); 4428 for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_xx[i])); 4429 for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_yy[i])); 4430 for(int i=0;i<3;i++) _assert_(!xIsNan<IssmDouble>(d_xx[i])); 4416 4431 element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum); 4417 4432 element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum); … … 4420 4435 else{ 4421 4436 _assert_(tnumnodes==4); 4422 Matrix 3x3Solve(&d_xx[0],Ke,pe_xx);4423 Matrix 3x3Solve(&d_yy[0],Ke,pe_yy);4424 Matrix 3x3Solve(&d_xy[0],Ke,pe_xy);4425 Matrix 3x3Solve(&d_zz[0],Ke,pe_zz);4426 Matrix 3x3Solve(&d_xz[0],Ke,pe_xz);4427 Matrix 3x3Solve(&d_yz[0],Ke,pe_yz);4437 Matrix4x4Solve(&d_xx[0],Ke,pe_xx); 4438 Matrix4x4Solve(&d_yy[0],Ke,pe_yy); 4439 Matrix4x4Solve(&d_xy[0],Ke,pe_xy); 4440 Matrix4x4Solve(&d_zz[0],Ke,pe_zz); 4441 Matrix4x4Solve(&d_xz[0],Ke,pe_xz); 4442 Matrix4x4Solve(&d_yz[0],Ke,pe_yz); 4428 4443 element->AddInput(StrainRatexxEnum,d_xx,P1DGEnum); 4429 4444 element->AddInput(StrainRateyyEnum,d_yy,P1DGEnum); -
issm/trunk-jpl/src/c/shared/Numerics/NewtonSolveDnorm.cpp
r17629 r17650 15 15 /*trivial solution*/ 16 16 if(c3==0.){ 17 *pdnorm = 0.;17 *pdnorm = 0.; 18 18 return 0; 19 19 } … … 26 26 27 27 /*Initial guess*/ 28 _assert_(dnorm>0.); 28 29 IssmDouble y1 = log10(dnorm); 29 30 … … 41 42 } 42 43 43 if(counter>50) _error_("Could not converge");44 if(counter>50) break; 44 45 } 46 47 /*Avoid extremely large values that indicate non convergence*/ 48 if(y2>50.) y2 = 50; 45 49 46 50 /*Assign output pointer*/ -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_la_theta.cpp
r17619 r17650 19 19 Vector<IssmDouble>* df = NULL; 20 20 Vector<IssmDouble>* ys = NULL; 21 IssmDouble eps_rel; 21 22 int configuration_type,max_nonlinear_iterations; 22 23 … … 26 27 /*Recover parameters: */ 27 28 femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 29 femmodel->parameters->FindParam(&eps_rel,StressbalanceReltolEnum); 28 30 femmodel->parameters->FindParam(&max_nonlinear_iterations,StressbalanceMaxiterEnum); 31 femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum); 29 32 30 33 /*Update constraints and initialize d and tau if necessary*/ … … 33 36 34 37 /*Convergence criterion*/ 35 int count = 0; 36 IssmDouble eps_rel = .001; 37 femmodel->parameters->SetParam(.6,AugmentedLagrangianREnum); 38 int count = 0; 38 39 GetSolutionFromInputsx(&ug,femmodel); 39 40 40 41 while(true){ 42 count++; 41 43 42 44 /*save pointer to old velocity*/ … … 47 49 CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type); 48 50 Reduceloadx(pf, Kfs, ys); delete Kfs; 49 50 // pf->Echo();51 // IssmDouble* temp=Kff->ToSerial();52 // int m,n;53 // Kff->GetSize(&m,&n);54 // printarray(temp,m,n);55 // xDelete<IssmDouble>(temp);56 57 51 Solverx(&uf, Kff, pf, NULL, df, femmodel->parameters); 58 //uf->Echo();59 52 delete Kff; delete pf; delete df; 60 61 53 Mergesolutionfromftogx(&ug, uf,ys,femmodel->nodes,femmodel->parameters);delete uf; delete ys; 62 54 63 55 /*Update solution*/ 64 _printf_("ug norm = " << ug->Norm(NORM_TWO) << "\n");65 56 InputUpdateFromSolutionx(femmodel,ug); 66 57 … … 81 72 } 82 73 83 count++; 84 if(count>=max_nonlinear_iterations) break; 74 if(count>=max_nonlinear_iterations){ 75 _printf0_(" maximum number of nonlinear iterations (" << max_nonlinear_iterations << ") exceeded\n"); 76 break; 77 } 85 78 } 79 80 if(VerboseConvergence()) _printf0_("\n total number of iterations: " << count-1 << "\n"); 86 81 87 82 delete ug;
Note:
See TracChangeset
for help on using the changeset viewer.