Changeset 16839
- Timestamp:
- 11/20/13 19:08:46 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r16838 r16839 1136 1136 element->GetVerticesCoordinates(&xyz_list); 1137 1137 element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum); 1138 element->Normal Base(&normal[0],xyz_list_front);1138 element->NormalSection(&normal[0],xyz_list_front); 1139 1139 1140 1140 /*Start looping on Gaussian points*/ … … 1570 1570 ElementVector* StressbalanceAnalysis::CreatePVectorHOFront(Element* element){/*{{{*/ 1571 1571 1572 return NULL; 1572 /*If no front, return NULL*/ 1573 if(!element->IsZeroLevelset(MaskIceLevelsetEnum)) return NULL; 1574 1575 /*Intermediaries*/ 1576 IssmDouble rho_ice,rho_water,gravity; 1577 IssmDouble Jdet,surface,z_g,water_pressure,ice_pressure; 1578 IssmDouble surface_under_water,base_under_water,pressure; 1579 IssmDouble* xyz_list = NULL; 1580 IssmDouble* xyz_list_front = NULL; 1581 IssmDouble normal[3]; 1582 Gauss* gauss = NULL; 1583 1584 /*Fetch number of nodes and dof for this finite element*/ 1585 int numnodes = element->GetNumberOfNodes(); 1586 1587 /*Initialize Element vector and other vectors*/ 1588 ElementVector* pe = element->NewElementVector(HOApproximationEnum); 1589 IssmDouble* basis = xNew<IssmDouble>(numnodes); 1590 1591 /*Retrieve all inputs and parameters*/ 1592 Input* surface_input=element->GetInput(SurfaceEnum); _assert_(surface_input); 1593 rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum); 1594 rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 1595 gravity = element->GetMaterialParameter(ConstantsGEnum); 1596 element->GetVerticesCoordinates(&xyz_list); 1597 element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum); 1598 element->NormalSection(&normal[0],xyz_list_front); 1599 1600 /*Initialize gauss points*/ 1601 IssmDouble zmax=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]>zmax) zmax=xyz_list[i*3+2]; 1602 IssmDouble zmin=xyz_list[0*3+2]; for(int i=1;i<6;i++) if(xyz_list[i*3+2]<zmin) zmin=xyz_list[i*3+2]; 1603 if(zmax>0 && zmin<0) gauss=element->NewGauss(xyz_list,xyz_list_front,3,10);//refined in vertical because of the sea level discontinuity 1604 else gauss=element->NewGauss(xyz_list,xyz_list_front,3,3); 1605 1606 /* Start looping on the number of gaussian points: */ 1607 for(int ig=gauss->begin();ig<gauss->end();ig++){ 1608 1609 gauss->GaussPoint(ig); 1610 surface_input->GetInputValue(&surface,gauss); 1611 z_g=element->GetZcoord(gauss); 1612 element->NodalFunctions(basis,gauss); 1613 element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss); 1614 1615 water_pressure = rho_water*gravity*min(0.,z_g);//0 if the gaussian point is above water level 1616 ice_pressure = rho_ice*gravity*(surface-z_g); 1617 pressure = ice_pressure + water_pressure; 1618 1619 for (int i=0;i<numnodes;i++){ 1620 pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*basis[i]; 1621 pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*basis[i]; 1622 } 1623 } 1624 1625 /*Transform coordinate system*/ 1626 element->TransformLoadVectorCoord(pe,XYEnum); 1627 1628 /*Clean up and return*/ 1629 xDelete<IssmDouble>(basis); 1630 xDelete<IssmDouble>(xyz_list); 1631 xDelete<IssmDouble>(xyz_list_front); 1632 delete gauss; 1633 return pe; 1573 1634 }/*}}}*/ 1574 1635 void StressbalanceAnalysis::GetBHO(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ … … 1937 1998 element->NodalFunctionsVelocity(vbasis,gauss); 1938 1999 1939 element->Normal Base(&normal[0],xyz_list_base);2000 element->NormalSection(&normal[0],xyz_list_base); 1940 2001 _assert_(normal[dim-1]<0.); 1941 2002 bed_input->GetInputValue(&bed, gauss); -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16838 r16839 62 62 virtual void NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0; 63 63 virtual void NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss)=0; 64 virtual void Normal Base(IssmDouble* normal,IssmDouble* xyz_list)=0;64 virtual void NormalSection(IssmDouble* normal,IssmDouble* xyz_list)=0; 65 65 virtual void NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0; 66 66 virtual IssmDouble PureIceEnthalpy(IssmDouble pressure)=0; … … 111 111 virtual void GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0; 112 112 virtual void GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0; 113 virtual IssmDouble GetZcoord(Gauss* gauss)=0; 113 114 virtual void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0; 114 115 … … 132 133 virtual Gauss* NewGauss(int order)=0; 133 134 virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order)=0; 135 virtual Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert)=0; 134 136 virtual Gauss* NewGaussBase(int order)=0; 135 137 virtual Gauss* NewGaussTop(int order)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16838 r16839 1511 1511 } 1512 1512 /*}}}*/ 1513 /*FUNCTION Penta:: GetQuadNormal{{{*/1514 void Penta:: GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list){1513 /*FUNCTION Penta::NormalSection{{{*/ 1514 void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){ 1515 1515 1516 1516 /*Build unit outward pointing vector*/ … … 1634 1634 /*}}}*/ 1635 1635 /*FUNCTION Penta::GetZcoord {{{*/ 1636 IssmDouble Penta::GetZcoord(Gauss Penta* gauss){1636 IssmDouble Penta::GetZcoord(Gauss* gauss){ 1637 1637 1638 1638 int i; … … 2466 2466 } 2467 2467 /*}}}*/ 2468 /*FUNCTION Penta::JacobianDeterminantSurface{{{*/ 2469 void Penta::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list_quad,Gauss* gauss){ 2470 2471 _assert_(gauss->Enum()==GaussPentaEnum); 2472 this->GetQuadJacobianDeterminant(pJdet,xyz_list_quad,(GaussPenta*)gauss); 2473 2474 } 2475 /*}}}*/ 2468 2476 /*FUNCTION Penta::NoIceInElement {{{*/ 2469 2477 bool Penta::NoIceInElement(){ … … 2542 2550 Gauss* Penta::NewGauss(int order){ 2543 2551 return new GaussPenta(order,order); 2552 } 2553 /*}}}*/ 2554 /*FUNCTION Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/ 2555 Gauss* Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){ 2556 2557 IssmDouble area_coordinates[4][3]; 2558 2559 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,4); 2560 2561 return new GaussPenta(area_coordinates,order_horiz,order_vert); 2544 2562 } 2545 2563 /*}}}*/ … … 3123 3141 return S; 3124 3142 } 3125 }3126 /*}}}*/3127 /*FUNCTION Penta::SurfaceNormal {{{*/3128 void Penta::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){3129 3130 int i;3131 IssmDouble v13[3],v23[3];3132 IssmDouble normal[3];3133 IssmDouble normal_norm;3134 3135 for (i=0;i<3;i++){3136 v13[i]=xyz_list[0][i]-xyz_list[2][i];3137 v23[i]=xyz_list[1][i]-xyz_list[2][i];3138 }3139 3140 normal[0]=v13[1]*v23[2]-v13[2]*v23[1];3141 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];3142 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];3143 3144 normal_norm=sqrt( pow(normal[0],2)+pow(normal[1],2)+pow(normal[2],2) );3145 3146 *(surface_normal)=normal[0]/normal_norm;3147 *(surface_normal+1)=normal[1]/normal_norm;3148 *(surface_normal+2)=normal[2]/normal_norm;3149 3143 } 3150 3144 /*}}}*/ … … 6072 6066 6073 6067 /*Get normal vector to the bed */ 6074 SurfaceNormal(&surface_normal[0],xyz_list_tria);6068 NormalTop(&surface_normal[0],&xyz_list_tria[0][0]); 6075 6069 6076 6070 bed_normal[0]=-surface_normal[0]; //Function is for upper surface, so the normal to the bed is the opposite of the result … … 8123 8117 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 8124 8118 for(i=0;i<NUMVERTICES2D;i++) for(j=0;j<3;j++) xyz_list_tria[i][j]=xyz_list[i+3][j]; 8125 SurfaceNormal(&surface_normal[0],xyz_list_tria);8119 NormalTop(&surface_normal[0],&xyz_list_tria[0][0]); 8126 8120 8127 8121 /* Start looping on the number of gaussian points: */ … … 8788 8782 ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum); 8789 8783 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4); 8790 GetQuadNormal(&normal[0],xyz_list_front);8784 NormalSection(&normal[0],xyz_list_front); 8791 8785 8792 8786 /*Initialize gauss points*/ … … 8821 8815 /*Clean up and return*/ 8822 8816 xDelete<IssmDouble>(basis); 8817 xDelete<IssmDouble>(xyz_list_front); 8823 8818 delete gauss; 8824 8819 return pe; … … 8883 8878 ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum); 8884 8879 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],4); 8885 GetQuadNormal(&normal[0],xyz_list_front);8880 NormalSection(&normal[0],xyz_list_front); 8886 8881 8887 8882 /*Start looping on Gaussian points*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16838 r16839 97 97 IssmDouble GetMaterialParameter(int enum_in); 98 98 void GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type); 99 IssmDouble GetZcoord(Gauss Penta* gauss);99 IssmDouble GetZcoord(Gauss* gauss); 100 100 void GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum); 101 101 void GetVerticesCoordinates(IssmDouble** pxyz_list); … … 199 199 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum); 200 200 void NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list); 201 void NormalSection(IssmDouble* normal,IssmDouble* xyz_list); 201 202 void NormalTop(IssmDouble* bed_normal, IssmDouble* xyz_list); 202 203 ElementMatrix* CreateBasalMassMatrix(void); … … 232 233 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype); 233 234 void GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity); 234 void GetQuadNormal(IssmDouble* normal,IssmDouble* xyz_list);235 235 void GetStrainRate3dHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss, Input* vx_input, Input* vy_input); 236 236 void GetStrainRate3d(IssmDouble* epsilon,IssmDouble* xyz_list, Gauss* gauss, Input* vx_input, Input* vy_input, Input* vz_input); … … 247 247 bool IsNodeOnShelfFromFlags(IssmDouble* flags); 248 248 void JacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss); 249 void JacobianDeterminantSurface(IssmDouble* pJdet, IssmDouble* xyz_list,Gauss* gauss) {_error_("not implemented yet");};249 void JacobianDeterminantSurface(IssmDouble* pJdet, IssmDouble* xyz_list,Gauss* gauss); 250 250 void JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss); 251 251 void JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss); … … 254 254 Gauss* NewGauss(int order); 255 255 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");}; 256 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert); 256 257 Gauss* NewGaussBase(int order); 257 258 Gauss* NewGaussTop(int order); … … 266 267 void SetClone(int* minranks); 267 268 Tria* SpawnTria(int location); 268 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);269 269 IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa); 270 270 void TransformLoadVectorCoord(ElementVector* pe,int transformenum); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16838 r16839 124 124 void NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");}; 125 125 bool NoIceInElement(){_error_("not implemented yet");}; 126 void Normal Base(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};126 void NormalSection(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");}; 127 127 void NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");}; 128 128 int NumberofNodesVelocity(void){_error_("not implemented yet");}; … … 141 141 void GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");}; 142 142 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");}; 143 IssmDouble GetZcoord(Gauss* gauss){_error_("not implemented yet");}; 143 144 Gauss* NewGauss(void){_error_("not implemented yet");}; 144 145 Gauss* NewGauss(int order){_error_("not implemented yet");}; 145 146 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){_error_("not implemented yet");}; 147 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");}; 146 148 Gauss* NewGaussBase(int order){_error_("not implemented yet");}; 147 149 Gauss* NewGaussTop(int order){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16838 r16839 1168 1168 1169 1169 }/*}}}*/ 1170 /*FUNCTION Tria::Normal Base{{{*/1171 void Tria::Normal Base(IssmDouble* normal,IssmDouble* xyz_list){1170 /*FUNCTION Tria::NormalSection{{{*/ 1171 void Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){ 1172 1172 1173 1173 /*Build unit outward pointing vector*/ … … 2697 2697 } 2698 2698 /*}}}*/ 2699 /*FUNCTION Tria::SurfaceNormal{{{*/2700 void Tria::SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]){2701 2702 IssmDouble v13[3],v23[3];2703 IssmDouble normal[3];2704 IssmDouble normal_norm;2705 2706 for(int i=0;i<3;i++){2707 v13[i]=xyz_list[0][i]-xyz_list[2][i];2708 v23[i]=xyz_list[1][i]-xyz_list[2][i];2709 }2710 2711 normal[0]=v13[1]*v23[2]-v13[2]*v23[1];2712 normal[1]=v13[2]*v23[0]-v13[0]*v23[2];2713 normal[2]=v13[0]*v23[1]-v13[1]*v23[0];2714 2715 normal_norm=sqrt( normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);2716 2717 *(surface_normal+0) = normal[0]/normal_norm;2718 *(surface_normal+1) = normal[1]/normal_norm;2719 *(surface_normal+2) = normal[2]/normal_norm;2720 }2721 /*}}}*/2722 2699 /*FUNCTION Tria::TimeAdapt{{{*/ 2723 2700 IssmDouble Tria::TimeAdapt(void){ … … 3976 3953 ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum); 3977 3954 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2); 3978 Normal Base(&normal[0],xyz_list_front);3955 NormalSection(&normal[0],xyz_list_front); 3979 3956 3980 3957 /*Start looping on Gaussian points*/ … … 4122 4099 GetNodalFunctionsVelocity(vbasis, gauss); 4123 4100 4124 Normal Base(&normal[0],&xyz_list_seg[0][0]);4101 NormalSection(&normal[0],&xyz_list_seg[0][0]); 4125 4102 _assert_(normal[1]<0.); 4126 4103 bed_input->GetInputValue(&bed, gauss); … … 4242 4219 ZeroLevelsetCoordinates(&xyz_list_front,&xyz_list[0][0],MaskIceLevelsetEnum); 4243 4220 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,&xyz_list[0][0],2); 4244 Normal Base(&normal[0],xyz_list_front);4221 NormalSection(&normal[0],xyz_list_front); 4245 4222 4246 4223 /*Start looping on Gaussian points*/ … … 7220 7197 this->EdgeOnSurfaceIndices(&indices[0],&indices[1]); 7221 7198 for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j]; 7222 Normal Base(&normal[0],&xyz_list_seg[0][0]);7199 NormalSection(&normal[0],&xyz_list_seg[0][0]); 7223 7200 7224 7201 /* Start looping on the number of gaussian points: */ … … 7270 7247 this->EdgeOnBedIndices(&indices[0],&indices[1]); 7271 7248 for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j]; 7272 Normal Base(&normal[0],&xyz_list_seg[0][0]);7249 NormalSection(&normal[0],&xyz_list_seg[0][0]); 7273 7250 7274 7251 /* Start looping on the number of gaussian points: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16838 r16839 257 257 void GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating); 258 258 IssmDouble GetGroundedPortion(IssmDouble* xyz_list); 259 void NormalBase(IssmDouble* normal,IssmDouble* xyz_list); 259 IssmDouble GetZcoord(Gauss* gauss){_error_("not implemented");}; 260 void NormalSection(IssmDouble* normal,IssmDouble* xyz_list); 260 261 void NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");}; 261 262 IssmDouble GetMaterialParameter(int enum_in); … … 284 285 Gauss* NewGauss(int order); 285 286 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order); 287 Gauss* NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){_error_("not implemented yet");}; 286 288 Gauss* NewGaussBase(int order){_error_("not implemented yet");}; 287 289 Gauss* NewGaussTop(int order){_error_("not implemented yet");}; … … 296 298 Seg* SpawnSeg(int index1,int index2); 297 299 IssmDouble StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){_error_("not implemented yet");}; 298 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]);299 300 void TransformLoadVectorCoord(ElementVector* pe,int transformenum); 300 301 void TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list);
Note:
See TracChangeset
for help on using the changeset viewer.