Changeset 16807
- Timestamp:
- 11/16/13 20:14:26 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r16805 r16807 431 431 iomodel->FetchData(&z,NULL,NULL,MeshZEnum); 432 432 switch(finiteelement){ 433 case P1Enum: 434 for(i=0;i<iomodel->numberofvertices;i++){ 435 if(iomodel->my_vertices[i]){ 436 if(reCast<int,IssmDouble>(vertices_type[i])==NoneApproximationEnum){ 437 constraints->AddObject(new SpcStatic(count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofelements+i+1,1,g*rho_ice*(surface[i]-z[i])/FSreconditioning,StressbalanceAnalysisEnum)); 438 count++; 439 } 440 } 441 } 442 break; 433 443 case P1bubbleEnum: 434 444 for(i=0;i<iomodel->numberofvertices;i++){ … … 909 919 ElementVector* StressbalanceAnalysis::CreatePVectorFSShelf(Element* element){/*{{{*/ 910 920 911 return NULL; 921 int i,meshtype,dim; 922 IssmDouble Jdet,water_pressure,bed; 923 IssmDouble normal[3]; 924 IssmDouble *xyz_list_base = NULL; 925 926 /*Get basal element*/ 927 if(!element->IsOnBed() || !element->IsFloating()) return NULL; 928 929 /*Get problem dimension*/ 930 element->FindParam(&meshtype,MeshTypeEnum); 931 switch(meshtype){ 932 case Mesh2DverticalEnum: dim = 2; break; 933 case Mesh3DEnum: dim = 3; break; 934 default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet"); 935 } 936 937 /*Fetch number of nodes and dof for this finite element*/ 938 int vnumnodes = element->GetNumberOfNodesVelocity(); 939 int pnumnodes = element->GetNumberOfNodesPressure(); 940 941 /*Prepare coordinate system list*/ 942 int* cs_list = xNew<int>(vnumnodes+pnumnodes); 943 if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum; 944 else for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum; 945 for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum; 946 947 /*Initialize vectors*/ 948 ElementVector* pe = element->NewElementVector(FSvelocityEnum); 949 IssmDouble* vbasis = xNew<IssmDouble>(vnumnodes); 950 951 /*Retrieve all inputs and parameters*/ 952 element->GetVerticesCoordinatesBase(&xyz_list_base); 953 Input* bed_input=element->GetInput(BedEnum); _assert_(bed_input); 954 IssmDouble rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum); 955 IssmDouble gravity =element->GetMaterialParameter(ConstantsGEnum); 956 957 /* Start looping on the number of gaussian points: */ 958 Gauss* gauss=element->NewGaussBase(5); 959 for(int ig=gauss->begin();ig<gauss->end();ig++){ 960 gauss->GaussPoint(ig); 961 962 element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss); 963 element->NodalFunctionsVelocity(vbasis,gauss); 964 965 element->NormalBase(&normal[0],xyz_list_base); 966 _assert_(normal[dim-1]<0.); 967 bed_input->GetInputValue(&bed, gauss); 968 water_pressure=gravity*rho_water*bed; 969 970 for(i=0;i<vnumnodes;i++){ 971 pe->values[i*dim+0] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[0]; 972 pe->values[i*dim+1] += water_pressure*gauss->weight*Jdet*vbasis[i]*normal[1]; 973 if(dim==3){ 974 pe->values[i*dim+2]+=water_pressure*gauss->weight*Jdet*vbasis[i]*normal[2]; 975 } 976 } 977 } 978 979 /*Transform coordinate system*/ 980 element->TransformLoadVectorCoord(pe,cs_list); 981 982 /*Clean up and return*/ 983 delete gauss; 984 xDelete<int>(cs_list); 985 xDelete<IssmDouble>(vbasis); 986 xDelete<IssmDouble>(xyz_list_base); 987 return pe; 912 988 }/*}}}*/ 913 989 ElementVector* StressbalanceAnalysis::CreatePVectorFSFront(Element* element){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16805 r16807 56 56 virtual void NodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss)=0; 57 57 virtual void NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss)=0; 58 virtual void NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0; 58 59 virtual void TransformLoadVectorCoord(ElementVector* pe,int transformenum)=0; 59 60 virtual void TransformLoadVectorCoord(ElementVector* pe,int* transformenum_list)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16805 r16807 162 162 /*}}}*/ 163 163 164 /*FUNCTION Penta:: BedNormal{{{*/165 void Penta:: BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]){164 /*FUNCTION Penta::NormalBase {{{*/ 165 void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){ 166 166 167 167 int i; … … 171 171 172 172 for (i=0;i<3;i++){ 173 v13[i]=xyz_list[0 ][i]-xyz_list[2][i];174 v23[i]=xyz_list[1 ][i]-xyz_list[2][i];173 v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i]; 174 v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i]; 175 175 } 176 176 … … 181 181 182 182 /*Bed normal is opposite to surface normal*/ 183 *(bed_normal)=-normal[0]/normal_norm;184 *(bed_normal+1)=-normal[1]/normal_norm;185 *(bed_normal+2)=-normal[2]/normal_norm;183 bed_normal[0]=-normal[0]/normal_norm; 184 bed_normal[1]=-normal[1]/normal_norm; 185 bed_normal[2]=-normal[2]/normal_norm; 186 186 } 187 187 /*}}}*/ … … 304 304 305 305 /*Get normal vector to the bed */ 306 BedNormal(&bed_normal[0],xyz_list_tria);306 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]); 307 307 308 308 /*basalforce*/ … … 4788 4788 4789 4789 /*geothermal heatflux*/ 4790 BedNormal(&normal_base[0],xyz_list_tria);4790 NormalBase(&normal_base[0],&xyz_list_tria[0][0]); 4791 4791 heatflux=0.; 4792 4792 for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i]; … … 6888 6888 material->GetViscosity3dFS(&viscosity,&epsilon[0]); 6889 6889 6890 BedNormal(&bed_normal[0],xyz_list_tria);6890 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]); 6891 6891 friction->GetAlpha2(&alpha2_gauss, gauss,VxEnum,VyEnum,VzEnum); 6892 6892 … … 8070 8070 vzSSA_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss); 8071 8071 8072 BedNormal(&bed_normal[0],xyz_list_tria);8072 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]); 8073 8073 this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input); 8074 8074 material->GetViscosity3dFS(&viscosity,&epsilon[0]); … … 8235 8235 vzHO_input->GetInputDerivativeValue(&dw[0],&xyz_list[0][0],gauss); 8236 8236 8237 BedNormal(&bed_normal[0],xyz_list_tria);8237 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]); 8238 8238 this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input); 8239 8239 material->GetViscosity3dFS(&viscosity,&epsilon[0]); … … 8934 8934 GetNodalFunctionsVelocity(vbasis, gauss); 8935 8935 8936 BedNormal(&bed_normal[0],xyz_list_tria);8936 NormalBase(&bed_normal[0],&xyz_list_tria[0][0]); 8937 8937 bed_input->GetInputValue(&bed, gauss); 8938 8938 if(shelf_dampening){ //add dampening to avoid too high vertical velocities when not in hydrostatic equilibrium -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16805 r16807 192 192 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 193 193 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum); 194 void BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]);194 void NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list); 195 195 ElementMatrix* CreateBasalMassMatrix(void); 196 196 ElementMatrix* CreateKMatrix(void); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16805 r16807 114 114 void NodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){_error_("not implemented yet");}; 115 115 bool NoIceInElement(){_error_("not implemented yet");}; 116 void NormalBase(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");}; 116 117 int NumberofNodesVelocity(void){_error_("not implemented yet");}; 117 118 int NumberofNodesPressure(void){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16805 r16807 1162 1162 1163 1163 }/*}}}*/ 1164 /*FUNCTION Tria:: GetSegmentNormal{{{*/1165 void Tria:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]){1164 /*FUNCTION Tria::NormalBase {{{*/ 1165 void Tria::NormalBase(IssmDouble* normal,IssmDouble* xyz_list){ 1166 1166 1167 1167 /*Build unit outward pointing vector*/ … … 1169 1169 IssmDouble norm; 1170 1170 1171 vector[0]=xyz_list[1 ][0] - xyz_list[0][0];1172 vector[1]=xyz_list[1 ][1] - xyz_list[0][1];1171 vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0]; 1172 vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1]; 1173 1173 1174 1174 norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]); … … 1976 1976 1977 1977 bool onbed; 1978 inputs->GetInputValue(&onbed,MeshElementonbedEnum); 1978 int meshtype; 1979 this->parameters->FindParam(&meshtype,MeshTypeEnum); 1980 switch(meshtype){ 1981 case Mesh2DverticalEnum: 1982 return HasEdgeOnBed(); 1983 break; 1984 case Mesh2DhorizontalEnum: 1985 inputs->GetInputValue(&onbed,MeshElementonbedEnum); 1986 break; 1987 default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet"); 1988 } 1979 1989 return onbed; 1980 1990 } … … 3876 3886 GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum); 3877 3887 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2); 3878 GetSegmentNormal(&normal[0],xyz_list_front);3888 NormalBase(&normal[0],&xyz_list_front[0][0]); 3879 3889 3880 3890 /*Start looping on Gaussian points*/ … … 4022 4032 GetNodalFunctionsVelocity(vbasis, gauss); 4023 4033 4024 GetSegmentNormal(&normal[0],xyz_list_seg);4034 NormalBase(&normal[0],&xyz_list_seg[0][0]); 4025 4035 _assert_(normal[1]<0.); 4026 4036 bed_input->GetInputValue(&bed, gauss); … … 4157 4167 GetZeroLevelsetCoordinates(&xyz_list_front[0][0],xyz_list,MaskIceLevelsetEnum); 4158 4168 GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2); 4159 GetSegmentNormal(&normal[0],xyz_list_front);4169 NormalBase(&normal[0],&xyz_list_front[0][0]); 4160 4170 4161 4171 /*Start looping on Gaussian points*/ … … 7125 7135 this->EdgeOnSurfaceIndices(&indices[0],&indices[1]); 7126 7136 for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j]; 7127 GetSegmentNormal(&normal[0],xyz_list_seg);7137 NormalBase(&normal[0],&xyz_list_seg[0][0]); 7128 7138 7129 7139 /* Start looping on the number of gaussian points: */ … … 7175 7185 this->EdgeOnBedIndices(&indices[0],&indices[1]); 7176 7186 for(int i=0;i<NUMVERTICES1D;i++) for(int j=0;j<2;j++) xyz_list_seg[i][j]=xyz_list[indices[i]][j]; 7177 GetSegmentNormal(&normal[0],xyz_list_seg);7187 NormalBase(&normal[0],&xyz_list_seg[0][0]); 7178 7188 7179 7189 /* Start looping on the number of gaussian points: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16805 r16807 248 248 void GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating); 249 249 IssmDouble GetGroundedPortion(IssmDouble* xyz_list); 250 void GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]);250 void NormalBase(IssmDouble* normal,IssmDouble* xyz_list); 251 251 IssmDouble GetMaterialParameter(int enum_in); 252 252 void GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum);
Note:
See TracChangeset
for help on using the changeset viewer.