Changeset 16364
- Timestamp:
- 10/10/13 10:00:54 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16361 r16364 3456 3456 if(!isfront) return NULL; 3457 3457 3458 _error_("STOP"); 3458 /*Intermediaries*/ 3459 IssmDouble rho_ice,rho_water,gravity,y_g; 3460 IssmDouble Jdet,water_pressure,air_pressure,pressure; 3461 IssmDouble xyz_list_front[2][3]; 3462 IssmDouble area_coordinates[2][3]; 3463 IssmDouble normal[2]; 3464 GaussTria* gauss = NULL; 3465 3466 /*Fetch number of nodes and dof for this finite element*/ 3467 int vnumnodes = this->NumberofNodesVelocity(); 3468 int pnumnodes = this->NumberofNodesPressure(); 3469 3470 /*Prepare coordinate system list*/ 3471 int* cs_list = xNew<int>(vnumnodes+pnumnodes); 3472 for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum; 3473 for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum; 3474 3475 /*Initialize Element matrix and vectors*/ 3476 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 3477 ElementVector* pe = new ElementVector(nodes,vnumnodes+pnumnodes,this->parameters,FSvelocityEnum); 3478 IssmDouble* vbasis = xNew<IssmDouble>(vnumnodes); 3479 3480 /*Retrieve all inputs and parameters*/ 3481 rho_water = matpar->GetRhoWater(); 3482 gravity = matpar->GetG(); 3483 GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum); 3484 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2); 3485 GetSegmentNormal(&normal[0],xyz_list_front); 3486 3487 /*Start looping on Gaussian points*/ 3488 IssmDouble ymax=max(xyz_list_front[0][1],xyz_list_front[1][1]); 3489 IssmDouble ymin=min(xyz_list_front[0][1],xyz_list_front[1][1]); 3490 if(ymax>0. && ymin<0.) gauss=new GaussTria(area_coordinates,30); //refined in vertical because of the sea level discontinuity 3491 else gauss=new GaussTria(area_coordinates,3); 3492 3493 for(int ig=gauss->begin();ig<gauss->end();ig++){ 3494 3495 gauss->GaussPoint(ig); 3496 y_g=GetYcoord(gauss); 3497 GetNodalFunctionsVelocity(vbasis,gauss); 3498 GetSegmentJacobianDeterminant(&Jdet,&xyz_list_front[0][0],gauss); 3499 3500 water_pressure = rho_water*gravity*min(0.,y_g); //0 if the gaussian point is above water level 3501 air_pressure = 0.; 3502 pressure = water_pressure + air_pressure; 3503 3504 for(i=0;i<vnumnodes;i++){ 3505 pe->values[2*i+0]+= pressure*Jdet*gauss->weight*normal[0]*vbasis[i]; 3506 pe->values[2*i+1]+= pressure*Jdet*gauss->weight*normal[1]*vbasis[i]; 3507 } 3508 } 3509 3510 3511 /*Transform coordinate system*/ 3512 TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list); 3513 3514 /*Clean up and return*/ 3515 xDelete<int>(cs_list); 3516 xDelete<IssmDouble>(vbasis); 3517 delete gauss; 3518 return pe; 3519 3459 3520 } 3460 3521 /*}}}*/ … … 3579 3640 } 3580 3641 3642 pe->CheckConsistency(); 3581 3643 /*Transform coordinate system*/ 3582 3644 TransformLoadVectorCoord(pe,nodes,(vnumnodes+pnumnodes),cs_list); 3645 pe->CheckConsistency(); 3583 3646 3584 3647 /*Clean up and return*/ … … 3985 4048 delete gauss; 3986 4049 xDelete<int>(doflist); 4050 } 4051 /*}}}*/ 4052 /*FUNCTION Tria::GetYcoord {{{*/ 4053 IssmDouble Tria::GetYcoord(GaussTria* gauss){ 4054 4055 IssmDouble y; 4056 IssmDouble xyz_list[NUMVERTICES][3]; 4057 IssmDouble y_list[NUMVERTICES]; 4058 4059 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 4060 for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1]; 4061 TriaRef::GetInputValue(&y,&y_list[0],gauss,P1Enum); 4062 4063 return y; 3987 4064 } 3988 4065 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16350 r16364 248 248 ElementVector* CreatePVectorStressbalanceFSShelf(void); 249 249 ElementMatrix* CreateJacobianStressbalanceSSA(void); 250 void GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution); 251 void GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution); 252 void GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution); 253 void InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution); 254 void InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution); 255 void InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution); 250 void GetSolutionFromInputsStressbalanceFS(Vector<IssmDouble>* solution); 251 void GetSolutionFromInputsStressbalanceHoriz(Vector<IssmDouble>* solution); 252 void GetSolutionFromInputsStressbalanceSIA(Vector<IssmDouble>* solution); 253 IssmDouble GetYcoord(GaussTria* gauss); 254 void InputUpdateFromSolutionStressbalanceHoriz( IssmDouble* solution); 255 void InputUpdateFromSolutionStressbalanceFS( IssmDouble* solution); 256 void InputUpdateFromSolutionStressbalanceSIA( IssmDouble* solution); 256 257 #endif 257 258 -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp
r16350 r16364 533 533 } 534 534 /*}}}*/ 535 /*FUNCTION TriaRef::GetNodalFunctions {{{*/535 /*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){{{*/ 536 536 void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss){ 537 537 /*This routine returns the values of the nodal functions at the gaussian point.*/ 538 538 539 539 _assert_(basis); 540 541 switch(this->element_type){ 540 GetNodalFunctions(basis,gauss,this->element_type); 541 542 } 543 /*}}}*/ 544 /*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation){{{*/ 545 void TriaRef::GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation){ 546 /*This routine returns the values of the nodal functions at the gaussian point.*/ 547 548 _assert_(basis); 549 550 switch(interpolation){ 542 551 case P1Enum: case P1DGEnum: 543 552 basis[0]=gauss->coord1; … … 867 876 } 868 877 /*}}}*/ 869 /*FUNCTION TriaRef::GetInputValue {{{*/878 /*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){{{*/ 870 879 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss){ 880 881 GetInputValue(p,plist,gauss,this->element_type); 882 } 883 /*}}}*/ 884 /*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int interpolation){{{*/ 885 void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTria* gauss,int interpolation){ 871 886 872 887 /*Output*/ … … 874 889 875 890 /*Fetch number of nodes for this finite element*/ 876 int numnodes = this->NumberofNodes( );891 int numnodes = this->NumberofNodes(interpolation); 877 892 878 893 /*Get nodal functions*/ 879 894 IssmDouble* basis=xNew<IssmDouble>(numnodes); 880 GetNodalFunctions(basis, gauss );895 GetNodalFunctions(basis, gauss,interpolation); 881 896 882 897 /*Calculate parameter for this Gauss point*/ … … 888 903 } 889 904 /*}}}*/ 890 /*FUNCTION TriaRef::NumberofNodes {{{*/905 /*FUNCTION TriaRef::NumberofNodes(){{{*/ 891 906 int TriaRef::NumberofNodes(void){ 892 907 893 switch(this->element_type){ 908 return this->NumberofNodes(this->element_type); 909 } 910 /*}}}*/ 911 /*FUNCTION TriaRef::NumberofNodes(int interpolation){{{*/ 912 int TriaRef::NumberofNodes(int interpolation){ 913 914 switch(interpolation){ 894 915 case P1Enum: return NUMNODESP1; 895 916 case P1DGEnum: return NUMNODESP1; -
issm/trunk-jpl/src/c/classes/Elements/TriaRef.h
r16350 r16364 38 38 void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTria* gauss); 39 39 void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss); 40 void GetNodalFunctions(IssmDouble* basis,GaussTria* gauss,int interpolation); 40 41 void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTria* gauss); 41 42 void GetNodalFunctionsPressure(IssmDouble* basis, GaussTria* gauss); … … 48 49 void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTria* gauss); 49 50 void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss); 51 void GetInputValue(IssmDouble* pp, IssmDouble* plist, GaussTria* gauss,int interpolation); 50 52 void GetInputDerivativeValue(IssmDouble* pp, IssmDouble* plist,IssmDouble* xyz_list, GaussTria* gauss); 51 53 52 54 int NumberofNodes(void); 55 int NumberofNodes(int interpolation); 53 56 int NumberofNodesVelocity(void); 54 57 int NumberofNodesPressure(void);
Note:
See TracChangeset
for help on using the changeset viewer.