Changeset 128
- Timestamp:
- 04/29/09 14:23:19 (16 years ago)
- Location:
- issm/trunk
- Files:
-
- 5 added
- 1 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/EnumDefinitions/AnalysisTypeAsEnum.cpp
r102 r128 24 24 return DiagnosticVertAnalysisEnum(); 25 25 } 26 else if (strcmp(analysis_type,"diagnostic_basevert")==0){27 return DiagnosticBaseVertAnalysisEnum();28 }29 26 else if (strcmp(analysis_type,"prognostic")==0){ 30 27 return PrognosticAnalysisEnum(); -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.cpp
r8 r128 20 20 int DiagnosticHorizAnalysisEnum(void){ return 23; } 21 21 int DiagnosticVertAnalysisEnum(void){ return 24; } 22 int DiagnosticBaseVertAnalysisEnum(void){ return 25; }23 22 int PrognosticAnalysisEnum(void){ return 26; } 24 23 int ThermalSteadyAnalysisEnum(void) { return 27; } -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r1 r128 33 33 int DiagnosticHorizAnalysisEnum(void); 34 34 int DiagnosticVertAnalysisEnum(void); 35 int DiagnosticBaseVertAnalysisEnum(void);36 35 int PrognosticAnalysisEnum(void); 37 36 int ThermalSteadyAnalysisEnum(void); -
issm/trunk/src/c/Makefile.am
r118 r128 163 163 ./ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp \ 164 164 ./ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp\ 165 ./ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp\ 166 ./ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp \ 167 ./ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp\ 165 168 ./ModelProcessorx/Control/CreateParametersControl.cpp\ 166 169 ./Dofx/Dofx.h\ … … 378 381 ./ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp \ 379 382 ./ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp\ 383 ./ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp\ 384 ./ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp \ 385 ./ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp\ 380 386 ./ModelProcessorx/Control/CreateParametersControl.cpp\ 381 387 ./Dofx/Dofx.h\ -
issm/trunk/src/c/ModelProcessorx/CreateConstraints.cpp
r117 r128 21 21 CreateConstraintsDiagnosticHoriz(pconstraints,model,model_handle); 22 22 } 23 /*else if (strcmp(model->analysis_type,"diagnostic_basevert")==0){24 CreateConstraintsDiagnosticBaseVert(pconstraints,model,model_handle);25 }26 23 else if (strcmp(model->analysis_type,"diagnostic_vert")==0){ 27 24 CreateConstraintsDiagnosticVert(pconstraints,model,model_handle); 28 } 25 }/* 29 26 else if (strcmp(model->analysis_type,"melting")==0){ 30 27 CreateConstraintsMelting(pconstraints,model,model_handle); -
issm/trunk/src/c/ModelProcessorx/CreateElementsNodesAndMaterials.cpp
r117 r128 24 24 25 25 } 26 /*else if (strcmp(model->analysis_type,"diagnostic_basevert")==0){26 else if ((strcmp(model->analysis_type,"diagnostic_vert")==0)){ 27 27 28 CreateElementsNodesAndMaterialsD ataSetsDiagnosticBaseVert(pelements,pnodes,pmaterials, model,model->analysis_type);29 28 CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes,pmaterials, model,model_handle); 29 30 30 } 31 else if (strcmp(model->analysis_type,"diagnostic_vert")==0){ 32 33 CreateElementsNodesAndMaterialsDataSetsDiagnosticVert(pelements,pnodes,pmaterials, model,model->analysis_type); 34 } 31 /* 35 32 else if (strcmp(model->analysis_type,"melting")==0){ 36 33 … … 46 43 }*/ 47 44 else{ 48 throw ErrorException(__FUNCT__, " analysis_type not supported yet!");45 throw ErrorException(__FUNCT__,exprintf("%s%s%s"," analysis_type: ",model->analysis_type," not supported yet!")); 49 46 } 50 47 } -
issm/trunk/src/c/ModelProcessorx/CreateLoads.cpp
r117 r128 22 22 CreateLoadsDiagnosticHoriz(ploads,model,model_handle); 23 23 } 24 /*else if (strcmp(model->analysis_type,"diagnostic_basevert")==0){25 26 CreateLoadsDiagnosticBaseVert(ploads,model,model_handle);27 }28 24 else if (strcmp(model->analysis_type,"diagnostic_vert")==0){ 29 25 30 26 CreateLoadsDiagnosticVert(ploads,model,model_handle); 31 } 27 }/* 32 28 else if (strcmp(model->analysis_type,"melting")==0){ 33 29 -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp
r117 r128 59 59 double tria_b[3]; 60 60 double tria_k[3]; 61 double tria_melting[3]; 62 double tria_accumulation[3]; 61 63 int tria_friction_type; 62 64 double tria_p; … … 278 280 279 281 /*Create tria element using its constructor:*/ 280 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_g, tria_h, tria_s, tria_b, tria_k, tria_ friction_type, tria_p, tria_q, tria_shelf, tria_meanvel, tria_epsvel, tria_viscosity_overshoot);282 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_friction_type, tria_p, tria_q, tria_shelf, tria_meanvel, tria_epsvel, tria_viscosity_overshoot); 281 283 282 284 /*Add tria element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/Model.h
r117 r128 170 170 /*Create of fem datasets: specialised drivers: */ 171 171 172 /*diagnostic :*/172 /*diagnostic horizontal*/ 173 173 void CreateElementsNodesAndMaterialsDiagnosticHoriz(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandle model_handle); 174 174 void CreateConstraintsDiagnosticHoriz(DataSet** pconstraints,Model* model,ConstDataHandle model_handle); 175 175 void CreateLoadsDiagnosticHoriz(DataSet** ploads, Model* model, ConstDataHandle model_handle); 176 177 /*diagnostic vertical*/ 178 void CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandle model_handle); 179 void CreateConstraintsDiagnosticVert(DataSet** pconstraints,Model* model,ConstDataHandle model_handle); 180 void CreateLoadsDiagnosticVert(DataSet** ploads, Model* model, ConstDataHandle model_handle); 176 181 177 182 /*control:*/ -
issm/trunk/src/c/SystemMatricesx/SystemMatricesx.cpp
r1 r128 32 32 loads->Configure(elements, loads, nodes, materials); 33 33 34 35 34 /*Get size of matrix: */ 36 35 gsize=nodes->NumberOfDofs(); … … 39 38 if(kflag)Kgg=NewMat(gsize,gsize,NULL,&connectivity,&numberofdofspernode); 40 39 if(pflag)pg=NewVec(gsize); 41 40 42 41 /*Fill stiffness matrix and right hand side vector, from elements: */ 43 42 if(kflag)elements->CreateKMatrix(Kgg,inputs,analysis_type); … … 59 58 } 60 59 61 62 60 /*Assign output pointers: */ 63 61 *pKgg=Kgg; -
issm/trunk/src/c/objects/Penta.cpp
r111 r128 287 287 288 288 } 289 else if ((analysis_type==DiagnosticVertAnalysisEnum())){ 290 291 CreateKMatrixDiagnosticVert( Kgg,inputs,analysis_type); 292 293 } 289 294 else{ 290 295 throw ErrorException(__FUNCT__,exprintf("%s%i%s\n","analysis: ",analysis_type," not supported yet")); … … 546 551 547 552 #undef __FUNCT__ 553 #define __FUNCT__ "Penta:CreateKMatrixDiagnosticVert" 554 void Penta::CreateKMatrixDiagnosticVert( Mat Kgg, ParameterInputs* inputs, int analysis_type){ 555 556 /* local declarations */ 557 int i,j; 558 559 /* node data: */ 560 const int numgrids=6; 561 const int NDOF1=1; 562 const int numdofs=NDOF1*numgrids; 563 double xyz_list[numgrids][3]; 564 int doflist[numdofs]; 565 int numberofdofspernode; 566 567 /* 3d gaussian points: */ 568 int num_gauss,ig; 569 double* first_gauss_area_coord = NULL; 570 double* second_gauss_area_coord = NULL; 571 double* third_gauss_area_coord = NULL; 572 double* fourth_gauss_vert_coord = NULL; 573 double* area_gauss_weights = NULL; 574 double* vert_gauss_weights = NULL; 575 int ig1,ig2; 576 double gauss_weight1,gauss_weight2; 577 double gauss_l1l2l3l4[4]; 578 int order_area_gauss; 579 int num_vert_gauss; 580 int num_area_gauss; 581 double gauss_weight; 582 583 /* matrices: */ 584 double Ke_gg[numdofs][numdofs]; 585 double Ke_gg_gaussian[numdofs][numdofs]; 586 double Jdet; 587 double B[NDOF1][numgrids]; 588 double Bprime[NDOF1][numgrids]; 589 double DL_scalar; 590 591 /*Collapsed formulation: */ 592 Tria* tria=NULL; 593 594 /*If this element is on the bed rock, spawn a Tria element out of the bed triangle, and use it 595 * to create the stifness matrix for the base velocity: */ 596 if(onbed){ 597 tria=SpawnTria(0,1,2); //nodes 0, 1 and 2 for the base 598 tria->CreateKMatrixDiagnosticBaseVert(Kgg,inputs, analysis_type); 599 delete tria; 600 } 601 602 /*If this element is on the surface, we have a dynamic boundary condition that applies, as a stiffness 603 * matrix: */ 604 if(onsurface){ 605 tria=SpawnTria(3,4,5); //nodes 3,4 and 5 are on the surface 606 tria->CreateKMatrixDiagnosticSurfaceVert(Kgg,inputs, analysis_type); 607 delete tria; 608 } 609 610 /*Now, onto the formulation for the vertical velocity: */ 611 612 /* Get node coordinates and dof list: */ 613 GetElementNodeData( &xyz_list[0][0], nodes, numgrids); 614 GetDofList(&doflist[0],&numberofdofspernode); 615 616 /* Set Ke_gg to 0: */ 617 for(i=0;i<numdofs;i++){ 618 for(j=0;j<numdofs;j++){ 619 Ke_gg[i][j]=0.0; 620 } 621 } 622 623 /*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 624 get tria gaussian points as well as segment gaussian points. For tria gaussian 625 points, order of integration is 2, because we need to integrate the product tB*D*B' 626 which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 627 points, same deal, which yields 3 gaussian points.*/ 628 629 order_area_gauss=2; 630 num_vert_gauss=2; 631 632 GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss); 633 #ifdef _DEBUG_ 634 for (i=0;i<num_area_gauss;i++){ 635 _printf_("Area Gauss coord %i: %lf %lf %lf Weight: %lf\n",i,*(first_gauss_area_coord+i),*(second_gauss_area_coord+i),*(third_gauss_area_coord+i),*(area_gauss_weights+i)); 636 } 637 for (i=0;i<num_vert_gauss;i++){ 638 _printf_("Vert Gauss coord %i: %lf Weight: %lf\n",i,*(fourth_gauss_vert_coord+i),*(vert_gauss_weights+i)); 639 } 640 #endif 641 642 /* Start looping on the number of gaussian points: */ 643 for (ig1=0; ig1<num_area_gauss; ig1++){ 644 for (ig2=0; ig2<num_vert_gauss; ig2++){ 645 646 /*Pick up the gaussian point: */ 647 gauss_weight1=*(area_gauss_weights+ig1); 648 gauss_weight2=*(vert_gauss_weights+ig2); 649 gauss_weight=gauss_weight1*gauss_weight2; 650 651 gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 652 gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1); 653 gauss_l1l2l3l4[2]=*(third_gauss_area_coord+ig1); 654 gauss_l1l2l3l4[3]=*(fourth_gauss_vert_coord+ig2); 655 656 /*Get B and Bprime matrices: */ 657 GetB_vert(&B[0][0], &xyz_list[0][0], gauss_l1l2l3l4); 658 GetBPrime_vert(&Bprime[0][0], &xyz_list[0][0], gauss_l1l2l3l4); 659 660 /* Get Jacobian determinant: */ 661 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3l4); 662 663 DL_scalar=gauss_weight*Jdet; 664 665 /* Do the triple product tB*D*Bprime: */ 666 TripleMultiply( &B[0][0],1,numgrids,1, 667 &DL_scalar,1,1,0, 668 &Bprime[0][0],1,numgrids,0, 669 &Ke_gg_gaussian[0][0],0); 670 671 /* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */ 672 for( i=0; i<numdofs; i++){ 673 for(j=0;j<numdofs;j++){ 674 Ke_gg[i][j]+=Ke_gg_gaussian[i][j]; 675 } 676 } 677 } //for (ig2=0; ig2<num_vert_gauss; ig2++) 678 } //for (ig1=0; ig1<num_area_gauss; ig1++) 679 680 /*Add Ke_gg to global matrix Kgg: */ 681 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 682 683 cleanup_and_return: 684 xfree((void**)&first_gauss_area_coord); 685 xfree((void**)&second_gauss_area_coord); 686 xfree((void**)&third_gauss_area_coord); 687 xfree((void**)&fourth_gauss_vert_coord); 688 xfree((void**)&area_gauss_weights); 689 xfree((void**)&vert_gauss_weights); 690 } 691 692 #undef __FUNCT__ 548 693 #define __FUNCT__ "Penta::CreatePVector" 549 694 void Penta::CreatePVector(Vec pg, ParameterInputs* inputs, int analysis_type){ … … 553 698 554 699 CreatePVectorDiagnosticHoriz( pg,inputs,analysis_type); 555 700 } 701 else if ((analysis_type==DiagnosticVertAnalysisEnum())){ 702 703 CreatePVectorDiagnosticVert( pg,inputs,analysis_type); 556 704 } 557 705 else{ … … 741 889 double tria_c[3]; 742 890 double tria_k[3]; 891 double tria_melting[3]; 892 double tria_accumulation[3]; 743 893 744 894 /*configuration: */ … … 763 913 tria_k[2]=k[g2]; 764 914 915 tria_melting[0]=melting[g0]; 916 tria_melting[1]=melting[g1]; 917 tria_melting[2]=melting[g2]; 918 919 tria_accumulation[0]=accumulation[g0]; 920 tria_accumulation[1]=accumulation[g1]; 921 tria_accumulation[2]=accumulation[g2]; 922 765 923 tria_node_ids[0]=node_ids[g0]; 766 924 tria_node_ids[1]=node_ids[g1]; … … 775 933 tria_node_offsets[2]=node_offsets[g2]; 776 934 777 tria= new Tria(id,mid,mparid,tria_node_ids,tria_h,tria_s,tria_b,tria_k, friction_type,p,q,shelf,meanvel,epsvel,viscosity_overshoot);935 tria= new Tria(id,mid,mparid,tria_node_ids,tria_h,tria_s,tria_b,tria_k, tria_melting, tria_accumulation, friction_type,p,q,shelf,meanvel,epsvel,viscosity_overshoot); 778 936 779 937 tria->NodeConfiguration(tria_node_ids,tria_nodes,tria_node_offsets); … … 1418 1576 1419 1577 } 1578 1579 #undef __FUNCT__ 1580 #define __FUNCT__ "Penta:GetB_vert" 1581 void Penta::GetB_vert(double* B, double* xyz_list, double* gauss_l1l2l3l4){ 1582 1583 1584 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz]; 1585 where hi is the interpolation function for grid i.*/ 1586 1587 int i; 1588 const int NDOF3=3; 1589 const int numgrids=6; 1590 double dh1dh2dh3dh4dh5dh6_basic[NDOF3][numgrids]; 1591 1592 /*Get dh1dh2dh3dh4dh5dh6_basic in basic coordinate system: */ 1593 GetNodalFunctionsDerivativesBasic(&dh1dh2dh3dh4dh5dh6_basic[0][0],xyz_list, gauss_l1l2l3l4); 1594 1595 #ifdef _DEBUG_ 1596 for (i=0;i<numgrids;i++){ 1597 _printf_("Node %i dh/dx=%lf dh/dy=%lf dh/dz=%lf\n",i,dh1dh2dh3dh4dh5dh6_basic[0][i],dh1dh2dh3dh4dh5dh6_basic[1][i],dh1dh2dh3dh4dh5dh6_basic[2][i]); 1598 } 1599 #endif 1600 1601 /*Build B: */ 1602 for (i=0;i<numgrids;i++){ 1603 B[i]=dh1dh2dh3dh4dh5dh6_basic[2][i]; 1604 } 1605 1606 } 1607 1608 1609 #undef __FUNCT__ 1610 #define __FUNCT__ "Penta:GetBPrime_vert" 1611 void Penta::GetBPrime_vert(double* B, double* xyz_list, double* gauss_l1l2l3l4){ 1612 1613 // Compute Bprime matrix. Bprime=[L1 L2 L3 L4 L5 L6] where Li is the nodal function for grid i 1614 1615 int i; 1616 1617 GetNodalFunctions(B, gauss_l1l2l3l4); 1618 1619 } 1620 1621 #undef __FUNCT__ 1622 #define __FUNCT__ "Penta:CreatePVectorDiagnosticVert" 1623 void Penta::CreatePVectorDiagnosticVert( Vec pg, ParameterInputs* inputs,int analysis_type){ 1624 1625 int i; 1626 1627 1628 /* node data: */ 1629 const int numgrids=6; 1630 const int NDOF1=1; 1631 const int numdofs=NDOF1*numgrids; 1632 double xyz_list[numgrids][3]; 1633 int doflist[numdofs]; 1634 int numberofdofspernode; 1635 1636 /* gaussian points: */ 1637 int num_gauss,ig; 1638 double* first_gauss_area_coord = NULL; 1639 double* second_gauss_area_coord = NULL; 1640 double* third_gauss_area_coord = NULL; 1641 double* fourth_gauss_vert_coord = NULL; 1642 double* area_gauss_weights = NULL; 1643 double* vert_gauss_weights = NULL; 1644 double gauss_l1l2l3l4[4]; 1645 int order_area_gauss; 1646 int num_vert_gauss; 1647 int num_area_gauss; 1648 int ig1,ig2; 1649 double gauss_weight1,gauss_weight2; 1650 double gauss_weight; 1651 1652 /* Jacobian: */ 1653 double Jdet; 1654 1655 /*element vector at the gaussian points: */ 1656 double pe_g[numdofs]; 1657 double pe_g_gaussian[numdofs]; 1658 double l1l2l3l4l5l6[6]; 1659 1660 /*Spawning: */ 1661 Tria* tria=NULL; 1662 1663 /*input parameters for structural analysis (diagnostic): */ 1664 double* velocity_param=NULL; 1665 double vx_list[numgrids]; 1666 double vy_list[numgrids]; 1667 double du[3]; 1668 double dv[3]; 1669 double dudx,dvdy; 1670 1671 /*If we are on the bedrock, spawn a tria on the bedrock, and use it to build the 1672 *diagnostic base vertical stifness: */ 1673 tria=SpawnTria(0,1,2); //nodes 0, 1 and 2 are on the bedrock 1674 tria->CreatePVectorDiagnosticBaseVert(pg,inputs, analysis_type); 1675 delete tria; 1676 1677 /*Now, handle the standard penta element: */ 1678 /* Get node coordinates and dof list: */ 1679 GetElementNodeData( &xyz_list[0][0], nodes, numgrids); 1680 GetDofList(&doflist[0],&numberofdofspernode); 1681 1682 /* Set pe_g to 0: */ 1683 for(i=0;i<numdofs;i++) pe_g[i]=0.0; 1684 1685 /* recover input parameters: */ 1686 velocity_param=ParameterInputsRecover(inputs,"velocity"); 1687 1688 if(!velocity_param)throw ErrorException(__FUNCT__," cannot compute vertical velocity without horizontal velocity!"); 1689 1690 /*Initialize vx_list and vy_list: */ 1691 for(i=0;i<numgrids;i++){ 1692 /*doflist is a list of dofs for the node. We have 1 dof per node for the vertical analysis. But the horizontal velocity 1693 *runs with 2 dofs per node! Therefore, we multiply by 2 the dof count, to extract the velocity from the inputs: */ 1694 vx_list[i]=velocity_param[2*doflist[i*numberofdofspernode+0]+0]; 1695 vy_list[i]=velocity_param[2*doflist[i*numberofdofspernode+0]+1]; 1696 } 1697 1698 /*Get gaussian points and weights :*/ 1699 order_area_gauss=2; 1700 num_vert_gauss=2; 1701 1702 GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss); 1703 #ifdef _DEBUG_ 1704 for (i=0;i<num_area_gauss;i++){ 1705 _printf_("Area Gauss coord %i: %lf %lf %lf Weight: %lf\n",i,*(first_gauss_area_coord+i),*(second_gauss_area_coord+i),*(third_gauss_area_coord+i),*(area_gauss_weights+i)); 1706 } 1707 for (i=0;i<num_vert_gauss;i++){ 1708 _printf_("Vert Gauss coord %i: %lf Weight: %lf\n",i,*(fourth_gauss_vert_coord+i),*(vert_gauss_weights+i)); 1709 } 1710 #endif 1711 1712 /* Start looping on the number of gaussian points: */ 1713 for (ig1=0; ig1<num_area_gauss; ig1++){ 1714 for (ig2=0; ig2<num_vert_gauss; ig2++){ 1715 1716 /*Pick up the gaussian point: */ 1717 gauss_weight1=*(area_gauss_weights+ig1); 1718 gauss_weight2=*(vert_gauss_weights+ig2); 1719 gauss_weight=gauss_weight1*gauss_weight2; 1720 1721 gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 1722 gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1); 1723 gauss_l1l2l3l4[2]=*(third_gauss_area_coord+ig1); 1724 gauss_l1l2l3l4[3]=*(fourth_gauss_vert_coord+ig2); 1725 1726 /*Get velocity derivative, with respect to x and y: */ 1727 GetParameterDerivativeValue(&du[0], &vx_list[0],&xyz_list[0][0], gauss_l1l2l3l4); 1728 GetParameterDerivativeValue(&dv[0], &vy_list[0],&xyz_list[0][0], gauss_l1l2l3l4); 1729 dudx=du[0]; 1730 dvdy=dv[1]; 1731 1732 1733 /* Get Jacobian determinant: */ 1734 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3l4); 1735 #ifdef _DEBUG_ 1736 _printf_("Element id %i Jacobian determinant: %lf\n",PentaElementGetID(this),Jdet); 1737 #endif 1738 1739 /*Get nodal functions: */ 1740 GetNodalFunctions(l1l2l3l4l5l6, gauss_l1l2l3l4); 1741 1742 /*Build pe_g_gaussian vector: */ 1743 for (i=0;i<numgrids;i++){ 1744 pe_g_gaussian[i]=(dudx+dvdy)*Jdet*gauss_weight*l1l2l3l4l5l6[i]; 1745 } 1746 1747 /*Add pe_g_gaussian vector to pe_g: */ 1748 for( i=0; i<numdofs; i++)pe_g[i]+=pe_g_gaussian[i]; 1749 1750 } //for (ig2=0; ig2<num_vert_gauss; ig2++) 1751 } //for (ig1=0; ig1<num_area_gauss; ig1++) 1752 1753 /*Add pe_g to global vector pg: */ 1754 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 1755 1756 cleanup_and_return: 1757 xfree((void**)&first_gauss_area_coord); 1758 xfree((void**)&second_gauss_area_coord); 1759 xfree((void**)&third_gauss_area_coord); 1760 xfree((void**)&fourth_gauss_vert_coord); 1761 xfree((void**)&area_gauss_weights); 1762 xfree((void**)&vert_gauss_weights); 1763 1764 1765 } -
issm/trunk/src/c/objects/Penta.h
r111 r128 37 37 double b[6]; 38 38 double k[6]; 39 double melting[6]; 40 double accumulation[6]; 39 41 int friction_type; 40 42 double p; … … 46 48 double epsvel; /*!minimum velocity to avoid infinite velocity ratios*/ 47 49 int collapse; 48 double melting[6];49 double accumulation[6];50 50 double geothermalflux[6]; 51 51 int artdiff; … … 73 73 void CreateKMatrix(Mat Kgg,ParameterInputs* inputs,int analysis_type); 74 74 void CreateKMatrixDiagnosticHoriz( Mat Kgg, ParameterInputs* inputs, int analysis_type); 75 void CreateKMatrixDiagnosticVert( Mat Kgg, ParameterInputs* inputs, int analysis_type); 75 76 void CreatePVector(Vec pg, ParameterInputs* inputs, int analysis_type); 76 77 void UpdateFromInputs(ParameterInputs* inputs); … … 94 95 void GetB(double* pB, double* xyz_list, double* gauss_l1l2l3l4); 95 96 void GetBPrime(double* B, double* xyz_list, double* gauss_l1l2l3l4); 97 void GetB_vert(double* B, double* xyz_list, double* gauss_l1l2l3l4); 98 void GetBPrime_vert(double* B, double* xyz_list, double* gauss_l1l2l3l4); 96 99 void GetJacobianDeterminant(double* Jdet, double* xyz_list,double* gauss_l1l2l3l4); 97 100 void GetNodalFunctionsDerivativesBasic(double* dh1dh2dh3dh4dh5dh6_basic,double* xyz_list, double* gauss_l1l2l3l4); … … 100 103 void GetJacobianInvert(double* Jinv, double* xyz_list,double* gauss_l1l2l3l4); 101 104 void CreatePVectorDiagnosticHoriz( Vec pg, ParameterInputs* inputs,int analysis_type); 105 void CreatePVectorDiagnosticVert( Vec pg, ParameterInputs* inputs,int analysis_type); 102 106 void GetParameterValue(double* pvalue, double* v_list,double* gauss_l1l2l3l4); 103 107 void GetParameterDerivativeValue(double* p, double* p_list,double* xyz_list, double* gauss_l1l2l3l4); -
issm/trunk/src/c/objects/Tria.cpp
r98 r128 32 32 } 33 33 34 Tria::Tria(int tria_id,int tria_mid,int tria_mparid,int tria_node_ids[3],double tria_h[3],double tria_s[3],double tria_b[3],double tria_k[3], 35 int tria_friction_type,double tria_p,double tria_q,int tria_shelf,double tria_meanvel,double tria_epsvel,double tria_viscosity_overshoot){ 34 Tria::Tria(int tria_id,int tria_mid,int tria_mparid,int tria_node_ids[3],double tria_h[3],double tria_s[3],double tria_b[3],double tria_k[3],double tria_melting[3], 35 double tria_accumulation[3],int tria_friction_type,double tria_p,double tria_q,int tria_shelf,double tria_meanvel,double tria_epsvel, 36 double tria_viscosity_overshoot){ 36 37 37 38 int i; … … 48 49 b[i]=tria_b[i]; 49 50 k[i]=tria_k[i]; 51 melting[i]=tria_melting[i]; 52 accumulation[i]=tria_accumulation[i]; 50 53 } 51 54 matice=NULL; … … 82 85 printf(" b=[%g,%g,%g]\n",b[0],b[1],b[2]); 83 86 printf(" k=[%g,%g,%g]\n",k[0],k[1],k[2]); 87 printf(" melting=[%g,%g,%g]\n",melting[0],melting[1],melting[2]); 88 printf(" accumulation=[%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2]); 84 89 printf(" friction_type: %i\n",friction_type); 85 90 printf(" p: %g\n",p); … … 129 134 memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b); 130 135 memcpy(marshalled_dataset,&k,sizeof(k));marshalled_dataset+=sizeof(k); 136 memcpy(marshalled_dataset,&melting,sizeof(melting));marshalled_dataset+=sizeof(melting); 137 memcpy(marshalled_dataset,&accumulation,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 131 138 memcpy(marshalled_dataset,&friction_type,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 132 139 memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed); … … 157 164 +sizeof(b) 158 165 +sizeof(k) 166 +sizeof(melting) 167 +sizeof(accumulation) 159 168 +sizeof(friction_type) 160 169 +sizeof(onbed) … … 197 206 memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b); 198 207 memcpy(&k,marshalled_dataset,sizeof(k));marshalled_dataset+=sizeof(k); 208 memcpy(&melting,marshalled_dataset,sizeof(melting));marshalled_dataset+=sizeof(melting); 209 memcpy(&accumulation,marshalled_dataset,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 199 210 memcpy(&friction_type,marshalled_dataset,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 200 211 memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed); … … 2042 2053 } 2043 2054 2055 2056 2057 #undef __FUNCT__ 2058 #define __FUNCT__ "Tria::CreateKMatrixDiagnosticBaseVert" 2059 void Tria::CreateKMatrixDiagnosticBaseVert(Mat Kgg,ParameterInputs* inputs,int analysis_type){ 2060 2061 int i,j; 2062 2063 /* node data: */ 2064 const int numgrids=3; 2065 const int NDOF1=1; 2066 const int numdofs=NDOF1*numgrids; 2067 double xyz_list[numgrids][3]; 2068 int doflist[numdofs]; 2069 int numberofdofspernode; 2070 2071 /* gaussian points: */ 2072 int num_gauss,ig; 2073 double* first_gauss_area_coord = NULL; 2074 double* second_gauss_area_coord = NULL; 2075 double* third_gauss_area_coord = NULL; 2076 double* gauss_weights = NULL; 2077 double gauss_weight; 2078 double gauss_l1l2l3[3]; 2079 2080 2081 /* matrices: */ 2082 double L[1][3]; 2083 double DL_scalar; 2084 2085 double Ke_gg[3][3]; //stiffness matrix 2086 double Ke_gg_gaussian[3][3]; //stiffness matrix evaluated at the gaussian point. 2087 double Jdet; 2088 2089 /* Get node coordinates and dof list: */ 2090 GetElementNodeData( &xyz_list[0][0], nodes, numgrids); 2091 GetDofList(&doflist[0],&numberofdofspernode); 2092 2093 /* Set Ke_gg to 0: */ 2094 for(i=0;i<numdofs;i++) for(j=0;j<numdofs;j++) Ke_gg[i][j]=0.0; 2095 2096 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ 2097 GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2); 2098 2099 /* Start looping on the number of gaussian points: */ 2100 for (ig=0; ig<num_gauss; ig++){ 2101 /*Pick up the gaussian point: */ 2102 gauss_weight=*(gauss_weights+ig); 2103 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2104 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2105 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2106 2107 /* Get Jacobian determinant: */ 2108 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2109 2110 //Get L matrix if viscous basal drag present: 2111 GetL(&L[0][0], &xyz_list[0][0], gauss_l1l2l3,NDOF1); 2112 2113 DL_scalar=gauss_weight*Jdet; 2114 2115 /* Do the triple producte tL*D*L: */ 2116 TripleMultiply( &L[0][0],1,3,1, 2117 &DL_scalar,1,1,0, 2118 &L[0][0],1,3,0, 2119 &Ke_gg_gaussian[0][0],0); 2120 2121 /* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */ 2122 for( i=0; i<numdofs; i++) for(j=0;j<numdofs;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j]; 2123 } //for (ig=0; ig<num_gauss; ig++ 2124 2125 /*Add Ke_gg to global matrix Kgg: */ 2126 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 2127 2128 cleanup_and_return: 2129 xfree((void**)&first_gauss_area_coord); 2130 xfree((void**)&second_gauss_area_coord); 2131 xfree((void**)&third_gauss_area_coord); 2132 xfree((void**)&gauss_weights); 2133 } 2134 2135 #undef __FUNCT__ 2136 #define __FUNCT__ "Tria::CreateKMatrixDiagnosticSurfaceVert" 2137 void Tria::CreateKMatrixDiagnosticSurfaceVert(Mat Kgg,ParameterInputs* inputs,int analysis_type){ 2138 2139 int i,j; 2140 2141 /* node data: */ 2142 const int numgrids=3; 2143 const int NDOF1=1; 2144 const int numdofs=NDOF1*numgrids; 2145 double xyz_list[numgrids][3]; 2146 int doflist[numdofs]; 2147 int numberofdofspernode; 2148 2149 /* gaussian points: */ 2150 int num_gauss,ig; 2151 double* first_gauss_area_coord = NULL; 2152 double* second_gauss_area_coord = NULL; 2153 double* third_gauss_area_coord = NULL; 2154 double* gauss_weights = NULL; 2155 double gauss_weight; 2156 double gauss_l1l2l3[3]; 2157 2158 2159 /* surface normal: */ 2160 double x4,y4,z4; 2161 double x5,y5,z5; 2162 double x6,y6,z6; 2163 double v46[3]; 2164 double v56[3]; 2165 double normal[3]; 2166 double norm_normal; 2167 double nz; 2168 2169 /*Matrices: */ 2170 double DL_scalar; 2171 double L[3]; 2172 double Jdet; 2173 2174 /* local element matrices: */ 2175 double Ke_gg[numdofs][numdofs]; //local element stiffness matrix 2176 double Ke_gg_gaussian[numdofs][numdofs]; //stiffness matrix evaluated at the gaussian point. 2177 2178 /* Get node coordinates and dof list: */ 2179 GetElementNodeData( &xyz_list[0][0], nodes, numgrids); 2180 GetDofList(&doflist[0],&numberofdofspernode); 2181 2182 /* Set Ke_gg to 0: */ 2183 for(i=0;i<numdofs;i++) for(j=0;j<numdofs;j++) Ke_gg[i][j]=0.0; 2184 2185 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ 2186 GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2); 2187 2188 /*Build normal vector to the surface:*/ 2189 2190 x4=xyz_list[0][0]; 2191 y4=xyz_list[0][1]; 2192 z4=xyz_list[0][2]; 2193 2194 x5=xyz_list[1][0]; 2195 y5=xyz_list[1][1]; 2196 z5=xyz_list[1][2]; 2197 2198 x6=xyz_list[2][0]; 2199 y6=xyz_list[2][1]; 2200 z6=xyz_list[2][2]; 2201 2202 v46[0]=x4-x6; 2203 v46[1]=y4-y6; 2204 v46[2]=z4-z6; 2205 2206 v56[0]=x5-x6; 2207 v56[1]=y5-y6; 2208 v56[2]=z5-z6; 2209 2210 normal[0]=(y4-y6)*(z5-z6)-(z4-z6)*(y5-y6); 2211 normal[1]=(z4-z6)*(x5-x6)-(x4-x6)*(z5-z6); 2212 normal[2]=(x4-x6)*(y5-y6)-(y4-y6)*(x5-x6); 2213 2214 norm_normal=sqrt(pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2)); 2215 nz=1.0/norm_normal*normal[2]; 2216 2217 /* Start looping on the number of gaussian points: */ 2218 for (ig=0; ig<num_gauss; ig++){ 2219 /*Pick up the gaussian point: */ 2220 gauss_weight=*(gauss_weights+ig); 2221 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2222 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2223 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2224 2225 /* Get Jacobian determinant: */ 2226 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2227 2228 //Get L matrix if viscous basal drag present: 2229 GetL(&L[0], &xyz_list[0][0], gauss_l1l2l3,NDOF1); 2230 2231 /**********************Do not forget the sign**********************************/ 2232 DL_scalar=- gauss_weight*Jdet*nz; 2233 /******************************************************************************/ 2234 2235 /* Do the triple producte tL*D*L: */ 2236 TripleMultiply( L,1,3,1, 2237 &DL_scalar,1,1,0, 2238 L,1,3,0, 2239 &Ke_gg_gaussian[0][0],0); 2240 2241 /* Add the Ke_gg_gaussian, onto Ke_gg: */ 2242 for( i=0; i<numdofs; i++) for(j=0;j<numdofs;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j]; 2243 2244 2245 } //for (ig=0; ig<num_gauss; ig++) 2246 2247 /*Add Ke_gg to global matrix Kgg: */ 2248 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 2249 2250 cleanup_and_return: 2251 xfree((void**)&first_gauss_area_coord); 2252 xfree((void**)&second_gauss_area_coord); 2253 xfree((void**)&third_gauss_area_coord); 2254 xfree((void**)&gauss_weights); 2255 } 2256 2257 2258 #undef __FUNCT__ 2259 #define __FUNCT__ "Tria::CreatePVectorDiagnosticBaseVert" 2260 void Tria::CreatePVectorDiagnosticBaseVert(Vec pg,ParameterInputs* inputs,int analysis_type){ 2261 2262 int i,j; 2263 2264 /* node data: */ 2265 const int numgrids=3; 2266 const int NDOF1=1; 2267 const int numdofs=NDOF1*numgrids; 2268 double xyz_list[numgrids][3]; 2269 int doflist[numdofs]; 2270 int numberofdofspernode; 2271 2272 /* gaussian points: */ 2273 int num_gauss,ig; 2274 double* first_gauss_area_coord = NULL; 2275 double* second_gauss_area_coord = NULL; 2276 double* third_gauss_area_coord = NULL; 2277 double* gauss_weights = NULL; 2278 double gauss_weight; 2279 double gauss_l1l2l3[3]; 2280 2281 /* Jacobian: */ 2282 double Jdet; 2283 2284 /*nodal functions: */ 2285 double l1l2l3[3]; 2286 2287 /*element vector at the gaussian points: */ 2288 double pe_g[numdofs]; 2289 double pe_g_gaussian[numdofs]; 2290 2291 /* matrices: */ 2292 double L[numgrids]; 2293 2294 /*input parameters for structural analysis (diagnostic): */ 2295 double* velocity_param=NULL; 2296 double vx_list[numgrids]; 2297 double vy_list[numgrids]; 2298 double vx,vy; 2299 double meltingvalue; 2300 double slope[2]; 2301 double dbdx,dbdy; 2302 2303 /* recover input parameters: */ 2304 velocity_param=ParameterInputsRecover(inputs,"velocity"); 2305 if(!velocity_param)throw ErrorException(__FUNCT__," cannot compute vertical velocity without horizontal velocity"); 2306 2307 /* Get node coordinates and dof list: */ 2308 GetElementNodeData( &xyz_list[0][0], nodes, numgrids); 2309 GetDofList(&doflist[0],&numberofdofspernode); 2310 2311 /* Set pe_g to 0: */ 2312 for(i=0;i<numdofs;i++) pe_g[i]=0.0; 2313 2314 /*Initialize vx_list and vy_list: */ 2315 for(i=0;i<numgrids;i++){ 2316 if(velocity_param){ 2317 /*doflist is a list of dofs for the node. We have 1 dof per node for the vertical analysis. But the horizontal velocity 2318 *runs with 2 dofs per node! Therefore, we multiply by 2 the dof count, to extract the velocity from the inputs: */ 2319 vx_list[i]=velocity_param[2*doflist[i*numberofdofspernode+0]+0]; 2320 vy_list[i]=velocity_param[2*doflist[i*numberofdofspernode+0]+1]; 2321 } 2322 else{ 2323 vx_list[i]=0; 2324 vy_list[i]=0; 2325 } 2326 } 2327 2328 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ 2329 GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2); 2330 2331 /*For icesheets: */ 2332 /* Start looping on the number of gaussian points: */ 2333 for (ig=0; ig<num_gauss; ig++){ 2334 2335 /*Pick up the gaussian point: */ 2336 gauss_weight=*(gauss_weights+ig); 2337 gauss_l1l2l3[0]=*(first_gauss_area_coord+ig); 2338 gauss_l1l2l3[1]=*(second_gauss_area_coord+ig); 2339 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 2340 2341 /*Get melting at gaussian point: */ 2342 GetParameterValue(&meltingvalue, &melting[0],gauss_l1l2l3); 2343 2344 /*Get velocity at gaussian point: */ 2345 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3); 2346 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3); 2347 2348 /*Get bed slope: */ 2349 GetParameterDerivativeValue(&slope[0], &b[0],&xyz_list[0][0], gauss_l1l2l3); 2350 dbdx=slope[0]; 2351 dbdy=slope[1]; 2352 2353 /* Get Jacobian determinant: */ 2354 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3); 2355 2356 //Get L matrix if viscous basal drag present: 2357 GetL(&L[0], &xyz_list[0][0], gauss_l1l2l3,NDOF1); 2358 2359 2360 /*Build gaussian vector: */ 2361 for(i=0;i<numgrids;i++){ 2362 pe_g_gaussian[i]=Jdet*gauss_weight*(vx*dbdx+vy*dbdy-meltingvalue)*L[i]; 2363 } 2364 2365 /*Add pe_g_gaussian vector to pe_g: */ 2366 for( i=0; i<numdofs; i++)pe_g[i]+=pe_g_gaussian[i]; 2367 2368 } 2369 2370 /*Add pe_g to global vector pg: */ 2371 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 2372 2373 cleanup_and_return: 2374 xfree((void**)&first_gauss_area_coord); 2375 xfree((void**)&second_gauss_area_coord); 2376 xfree((void**)&third_gauss_area_coord); 2377 xfree((void**)&gauss_weights); 2378 2379 } -
issm/trunk/src/c/objects/Tria.h
r91 r128 36 36 double b[3]; 37 37 double k[3]; 38 double melting[3]; 39 double accumulation[3]; 38 40 int friction_type; 39 41 double p; … … 48 50 49 51 Tria(); 50 Tria(int id,int mid,int mparid,int node_ids[3],double h[3],double s[3],double b[3],double k[3], 52 Tria(int id,int mid,int mparid,int node_ids[3],double h[3],double s[3],double b[3],double k[3],double melting[3],double accumulation[3], 51 53 int friction_type,double p,double q,int shelf,double meanvel,double epsvel,double viscosity_overshoot); 52 54 ~Tria(); … … 68 70 void CreateKMatrixDiagnosticHoriz(Mat Kgg,ParameterInputs* inputs,int analysis_type); 69 71 void CreateKMatrixDiagnosticHorizFriction(Mat Kgg,ParameterInputs* inputs,int analysis_type); 72 void CreateKMatrixDiagnosticBaseVert(Mat Kgg,ParameterInputs* inputs,int analysis_type); 73 void CreateKMatrixDiagnosticSurfaceVert(Mat Kgg,ParameterInputs* inputs,int analysis_type); 70 74 void GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3); 71 75 void GetParameterDerivativeValue(double* p, double* plist,double* xyz_list, double* gauss_l1l2l3); … … 87 91 88 92 void CreatePVectorDiagnosticHoriz(Vec pg,ParameterInputs* inputs,int analysis_type); 93 void CreatePVectorDiagnosticBaseVert(Vec pg,ParameterInputs* inputs,int analysis_type); 89 94 Matpar* GetMatPar(); 90 95 int GetShelf(); -
issm/trunk/src/c/shared/Numerics/DistributeNumDofs.cpp
r117 r128 19 19 numdofs=2; 20 20 } 21 else if (analysis_type==DiagnosticVertAnalysisEnum()){ 22 numdofs=1; 23 } 21 24 else if (analysis_type==ControlAnalysisEnum()){ 22 25 numdofs=2; -
issm/trunk/src/m/solutions/cielo/diagnostic.m
r104 r128 4 4 t1=clock; 5 5 6 analysis_dh='diagnostic_horiz';7 analysis_dbv='diagnostic_basevert';8 analysis_dv='diagnostic_vert';9 10 6 %Build all models requested for diagnostic simulation 11 7 %remark, partitions are all identical. 12 md.analysis_type=analysis_dh; 13 m_dh=CreateFemModel(md); 8 md.analysis_type='diagnostic_horiz'; m_dh=CreateFemModel(md); 14 9 15 10 if strcmpi(md.type,'3d'), 16 md.analysis_type=analysis_dbv; 17 m_dbv=CreateFemModel(md); 18 md.analysis_type=analysis_dv; 19 m_dv=CreateFemModel(md); 11 md.analysis_type='diagnostic_vert'; m_dv=CreateFemModel(md); 20 12 end 21 13 … … 31 23 32 24 %extrude velocities for collapsed penta elements 33 u_g=VelocityExtrude(md,u_g); 25 disp(sprintf('\n%s',['extruding horizontal velocities...'])); 26 u_g=VelocityExtrude(m_dh.elements,m_dh.nodes,m_dh.loads,m_dh.materials,u_g); 34 27 35 %Compute depth averaged velocity and add it to inputs36 velocity_average=CieloHorizontalVelocityDepthAverage(md,u_g);28 disp(sprintf('\n%s',['computing vertical velocities...'])); 29 u_g_vert=diagnostic_core_linear(m_dv,struct('velocity',u_g)); 37 30 38 %swith u_g and velocity_average to cluster partitioning 39 u_g=SwitchPartitioning(u_g,'cluster',part,tpart,[1 2]); 40 velocity_average=SwitchPartitioning(velocity_average,'cluster',part,tpart,[1 2]); 41 42 disp(sprintf('\n%s',['computing basal vertical velocities...'])); 43 SetUset(m_dbv); 44 u_g_basevert=diagnostic_core_linear(m_dbv,m_dbv.parameters,struct('velocity',u_g,'velocity_average',velocity_average),analysis_dbv); 45 46 %use u_g_basevert to constrain vertical velocity 47 SetUset(m_dv); 48 m_dv.y_g=u_g_basevert; 49 50 %reduce constraining vector to s-set (the one we solve on) 51 m_dv.y_s = Reducevectorg( m_dv.y_g); 52 53 %run core linear to solve for vertical velocity 54 disp(sprintf('\n%s',['computing vertical velocities...'])); 55 u_g_vert=diagnostic_core_linear(m_dv,m_dv.parameters,struct('velocity',u_g),analysis_dv); 56 57 %load results onto model: carefull, u_g and u_g_vert are in cluster partitioning 58 md.vx=u_g(indx)*md.yts; 59 md.vy=u_g(indy)*md.yts; 60 md.vz=u_g_vert(indz)*md.yts; 31 %load results onto model: 32 md.vx=u_g(1:2:end)*md.yts; 33 md.vy=u_g(2:2:end)*md.yts; 34 md.vz=u_g_vert*md.yts; 61 35 md.vel=sqrt(md.vx.^2+md.vy.^2+md.vz.^2); 62 36 … … 65 39 else 66 40 67 %Build partitioning vectors to recover solution68 indx=m_dh.part(1:2:end);69 indy=m_dh.part(2:2:end);70 71 41 %load results onto model 72 md.vx=u_g( indx)*md.yts;73 md.vy=u_g( indy)*md.yts;74 md.vz=zeros(m d.numberofgrids,1);42 md.vx=u_g(1:2:end)*md.yts; 43 md.vy=u_g(2:2:end)*md.yts; 44 md.vz=zeros(m_dv.nodesets.gsize,1); 75 45 md.vel=sqrt(md.vx.^2+md.vy.^2+md.vz.^2); 76 46 -
issm/trunk/src/mex/Makefile.am
r9 r128 38 38 TriMeshProcessRifts\ 39 39 TriMeshRefine\ 40 UpdateFromInputs 40 UpdateFromInputs\ 41 VelocityExtrude 41 42 42 43 endif … … 166 167 UpdateFromInputs/UpdateFromInputs.h 167 168 169 VelocityExtrude_SOURCES = VelocityExtrude/VelocityExtrude.cpp\ 170 VelocityExtrude/VelocityExtrude.h 171 -
issm/trunk/src/mex/VelocityExtrude/VelocityExtrude.cpp
r82 r128 35 35 /*write output : */ 36 36 WriteData(UGOUT,ug,0,0,"Vector",NULL); 37 38 37 /*Free ressources: */ 39 38 delete elements; … … 42 41 delete materials; 43 42 VecFree(&ug); 44 43 45 44 /*end module: */ 46 45 MODULEEND(); 46 47 47 } 48 48 -
issm/trunk/src/mex/VelocityExtrude/VelocityExtrude.h
r82 r128 18 18 /* serial input macros: */ 19 19 #define ELEMENTS (mxArray*)prhs[0] 20 #define LOADS (mxArray*)prhs[1]21 #define NODES (mxArray*)prhs[2]20 #define NODES (mxArray*)prhs[1] 21 #define LOADS (mxArray*)prhs[2] 22 22 #define MATERIALS (mxArray*)prhs[3] 23 23 #define UG (mxArray*)prhs[4] -
issm/trunk/todo
r53 r128 1 1 Create sorting routine for ids. 2 Update all inputs. Look at that in more details, ie with respect to control methods. When do we do update of inputs? 3 Handle input update for Nodes and Materials. 2 Update all inputs. Look at that in more details, ie with respect to control methods. When do we do update of inputs? Handle input update for Nodes and Materials. 4 3 Define default cluster in /etc/cielo.rc 4 VelocityExtrude: debug 5 Add vx and vy as input parameters to diagnostic.
Note:
See TracChangeset
for help on using the changeset viewer.