Changeset 4015
- Timestamp:
- 06/03/10 13:15:38 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r4013 r4015 963 963 bin_PROGRAMS = 964 964 else 965 bin_PROGRAMS = DiagnosticAnalysis.exe ThermalAnalysis.exe PrognosticAnalysis.exe Prognostic2Analysis.exe BalancedthicknessAnalysis.exe Balancedthickness2Analysis.exe BalancedvelocitiesAnalysis.exe TransientAnalysis.exe SteadystateAnalysis.exe SlopecomputeAnalysis.exe 965 bin_PROGRAMS = DiagnosticAnalysis.exe 966 dnl bin_PROGRAMS = DiagnosticAnalysis.exe ThermalAnalysis.exe PrognosticAnalysis.exe Prognostic2Analysis.exe BalancedthicknessAnalysis.exe Balancedthickness2Analysis.exe BalancedvelocitiesAnalysis.exe TransientAnalysis.exe SteadystateAnalysis.exe SlopecomputeAnalysis.exe 966 967 endif 967 968 -
issm/trunk/src/c/objects/Elements/Penta.cpp
r4013 r4015 574 574 UpdateInputsFromSolutionDiagnosticHoriz( solution,analysis_type,sub_analysis_type); 575 575 } 576 else if (sub_analysis_type==StokesAnalysisEnum){ 577 578 UpdateInputsFromSolutionDiagnosticStokes( solution,analysis_type,sub_analysis_type); 579 } 576 580 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); 577 581 … … 621 625 double vx[numvertices]; 622 626 double vy[numvertices]; 623 624 627 int dummy; 628 double pressure[numvertices]; 629 double surface[numvertices]; 630 double rho_ice,g; 631 double xyz_list[numvertices][3]; 632 double gauss[numvertices][numvertices]={{1,0,0,0},{0,1,0,0},{0,0,1,0},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 633 625 634 626 635 /*Get dof list: */ 627 636 GetDofList(&doflist[0],&dummy); 637 638 /*Get node data: */ 639 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices); 628 640 629 641 /*Use the dof list to index into the solution vector: */ … … 638 650 } 639 651 652 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 3D, 653 *so the pressure is just the pressure at the z elevation: */ 654 rho_ice=matpar->GetRhoIce(); 655 g=matpar->GetG(); 656 inputs->GetParameterValues(&surface[0],&gauss[0][0],6,SurfaceEnum); 657 658 for(i=0;i<numvertices;i++){ 659 pressure[i]=rho_ice*g*(surface[i]-xyz_list[i][2]); 660 } 640 661 /*Now, we have to move the previous Vx and Vy inputs to old 641 662 * status, otherwise, we'll wipe them off: */ 642 663 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 643 664 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 665 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 644 666 645 667 /*Add vx and vy as inputs to the tria element: */ 646 668 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 647 669 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 670 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 671 } 672 673 /*}}}*/ 674 /*FUNCTION Penta::UpdateInputsFromSolutionDiagnosticStokes {{{1*/ 675 void Penta::UpdateInputsFromSolutionDiagnosticStokes(double* solution, int analysis_type, int sub_analysis_type){ 676 677 678 int i; 679 680 const int numvertices=6; 681 const int numdofpervertex=4; 682 const int numdof=numdofpervertex*numvertices; 683 684 int doflist[numdof]; 685 double values[numdof]; 686 double vx[numvertices]; 687 double vy[numvertices]; 688 double vz[numvertices]; 689 double pressure[numvertices]; 690 int dummy; 691 double stokesreconditioning; 692 693 /*Get dof list: */ 694 GetDofList(&doflist[0],&dummy); 695 696 /*Use the dof list to index into the solution vector: */ 697 for(i=0;i<numdof;i++){ 698 values[i]=solution[doflist[i]]; 699 } 700 701 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 702 for(i=0;i<numvertices;i++){ 703 vx[i]=values[i*numdofpervertex+0]; 704 vy[i]=values[i*numdofpervertex+1]; 705 vz[i]=values[i*numdofpervertex+2]; 706 pressure[i]=values[i*numdofpervertex+3]; 707 } 708 709 /*Recondition pressure: */ 710 this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum); 711 for(i=0;i<numvertices;i++){ 712 pressure[i]=pressure[i]*stokesreconditioning; 713 } 714 715 716 /*Now, we have to move the previous inputs to old 717 * status, otherwise, we'll wipe them off: */ 718 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 719 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 720 this->inputs->ChangeEnum(VzEnum,VzOldEnum); 721 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 722 723 /*Add vx and vy as inputs to the tria element: */ 724 this->inputs->AddInput(new PentaVertexInput(VxEnum,vx)); 725 this->inputs->AddInput(new PentaVertexInput(VyEnum,vy)); 726 this->inputs->AddInput(new PentaVertexInput(VzEnum,vz)); 727 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 648 728 } 649 729 -
issm/trunk/src/c/objects/Elements/Penta.h
r4001 r4015 155 155 void UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type); 156 156 void UpdateInputsFromSolutionDiagnosticHoriz( double* solution,int analysis_type,int sub_analysis_type); 157 void UpdateInputsFromSolutionDiagnosticStokes( double* solution,int analysis_type,int sub_analysis_type); 157 158 void UpdateInputsFromSolutionSlopeCompute( double* solution,int analysis_type,int sub_analysis_type); 158 159 void UpdateInputsFromSolutionPrognostic( double* solution,int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4013 r4015 537 537 double vx[numvertices]; 538 538 double vy[numvertices]; 539 double pressure[numvertices]; 540 double thickness[numvertices]; 541 double rho_ice,g; 542 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 543 539 544 540 545 int dummy; … … 554 559 } 555 560 561 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 562 *so the pressure is just the pressure at the bedrock: */ 563 rho_ice=matpar->GetRhoIce(); 564 g=matpar->GetG(); 565 inputs->GetParameterValues(&thickness[0],&gauss[0][0],3,ThicknessEnum); 566 567 for(i=0;i<numvertices;i++){ 568 pressure[i]=rho_ice*g*thickness[i]; 569 } 570 556 571 /*Now, we have to move the previous Vx and Vy inputs to old 557 572 * status, otherwise, we'll wipe them off: */ 558 573 this->inputs->ChangeEnum(VxEnum,VxOldEnum); 559 574 this->inputs->ChangeEnum(VyEnum,VyOldEnum); 575 this->inputs->ChangeEnum(PressureEnum,PressureOldEnum); 560 576 561 577 /*Add vx and vy as inputs to the tria element: */ 562 578 this->inputs->AddInput(new TriaVertexInput(VxEnum,vx)); 563 579 this->inputs->AddInput(new TriaVertexInput(VyEnum,vy)); 580 this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure)); 581 582 564 583 } 565 584 -
issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
r3956 r4015 44 44 void UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");} 45 45 void UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");} 46 47 46 void UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");} 48 47 -
issm/trunk/src/c/solutions/ResetBoundaryConditions.cpp
r4013 r4015 7 7 #include "../EnumDefinitions/EnumDefinitions.h" 8 8 9 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type, Vec ug){9 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type, int sub_analysis_type){ 10 10 11 11 int verbose=0; 12 Vec ug=NULL; 12 13 13 14 femmodel->parameters->FindParam(&verbose,VerboseEnum); 14 15 if(verbose)_printf_("%s\n"," updating boundary conditions..."); 16 17 GetSolutionFromInputsx( &ug, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters, analysis_type,sub_analysis_type); 15 18 19 /*set current analysis: */ 16 20 femmodel->SetCurrentAnalysis(analysis_type); 17 21 18 /*F irst, for this analysis_type, free existing boundary condition vectors: */22 /*For this analysis_type, free existing boundary condition vectors: */ 19 23 20 24 //global dof set … … 29 33 Reducevectorgtosx(&femmodel->ys[analysis_counter],femmodel->yg[analysis_counter]->vector,femmodel->nodesets[analysis_counter]); 30 34 35 /*Free ressources:*/ 36 VecFree(&ug); 37 31 38 } -
issm/trunk/src/c/solutions/diagnostic.cpp
r4014 r4015 66 66 67 67 _printf_("create finite element model, using analyses types statically defined above:\n"); 68 femmodel=new FemModel( iomodel,analyses,5);68 femmodel=new FemModel(fid,analyses,5); 69 69 70 70 /*get parameters: */ -
issm/trunk/src/c/solutions/diagnostic_core.cpp
r4013 r4015 12 12 13 13 void* diagnostic_core(FemModel* femmodel){ 14 15 /*solutions: */16 Vec ug=NULL;17 14 18 15 /*parameters: */ … … 39 36 ReinitializeInputx(femmodel,VyEnum,QmuVyEnum); 40 37 ReinitializeInputx(femmodel,VzEnum,QmuVzEnum); 38 ReinitializeInputx(femmodel,PressureEnum,QmuPressureEnum); 41 39 } 42 40 … … 51 49 } 52 50 53 54 51 if(ishutter){ 55 52 56 53 if(verbose)_printf_("%s\n"," computing hutter velocities..."); 57 solve_linear( &ug,femmodel,DiagnosticAnalysisEnum,HutterAnalysisEnum);54 solve_linear(NULL,femmodel,DiagnosticAnalysisEnum,HutterAnalysisEnum); 58 55 59 if (ismacayealpattyn) ResetBoundaryConditions(femmodel,DiagnosticHorizAnalysisEnum,ug); 60 VecFree(&ug); 56 if (ismacayealpattyn) ResetBoundaryConditions(femmodel,DiagnosticAnalysisEnum,HorizAnalysisEnum); 61 57 } 62 58 … … 80 76 if(verbose)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed..."); 81 77 GetSolutionFromInputsx( &ug, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters, DiagnosticAnalysisEnum,StokesAnalysisEnum); 82 ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum,ug); 83 VecFree(&ug); 78 ResetBoundaryConditions(femmodel,DiagnosticAnalysisEnum,StokesAnalysisEnum); 84 79 85 80 if(verbose)_printf_("%s\n"," computing stokes velocities and pressure ..."); … … 87 82 } 88 83 } 89 90 /*Free ressources: */91 VecFree(&ug);92 84 } -
issm/trunk/src/c/solutions/slope_core.cpp
r4013 r4015 16 16 bool isstokes; 17 17 bool ishutter; 18 19 /*output: */20 Vec slope=NULL;21 18 22 19 /*Recover some parameters: */ -
issm/trunk/src/c/solutions/solutions.h
r4013 r4015 33 33 void diagnostic_core_nonlinear(Vec* pug,Mat* pK_ff0,Mat* pK_fs0, FemModel* fem,bool conserve_loads,int analysis_type,int sub_analysis_type); 34 34 void diagnostic_core_linear(Vec* ppg,FemModel* fem,int analysis_type,int sub_analysis_type); 35 void solver_linear(Vec* p pg,FemModel* fem,int analysis_type,int sub_analysis_type);35 void solver_linear(Vec* pug, FemModel* femmodel,int analysis_type,int sub_analysis_type); 36 36 37 37 … … 56 56 void CreateFemModel(FemModel* femmodel,ConstDataHandle MODEL,int analysis_type,int sub_analysis_type); 57 57 //int BatchDebug(Mat* Kgg,Vec* pg,FemModel* femmodel,char* filename); 58 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type, Vec ug);58 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type, int sub_analysis_type); 59 59 60 60 #endif -
issm/trunk/src/c/solutions/solver_linear.cpp
r4013 r4015 8 8 #include "../modules/modules.h" 9 9 10 void solver_linear(Vec* pug, FemModel* fem,int analysis_type,int sub_analysis_type){10 void solver_linear(Vec* pug, FemModel* fem,int analysis_type,int sub_analysis_type){ 11 11 12 12 /*parameters:*/ … … 61 61 xfree((void**)&solver_string); 62 62 63 /*Assign output pointers if requested:*/64 if (pug)*pug=ug;63 /*Assign output pointers:*/ 64 if(pug)*pug=ug; 65 65 }
Note:
See TracChangeset
for help on using the changeset viewer.