Changeset 16693
- Timestamp:
- 11/08/13 16:32:04 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r16684 r16693 930 930 }/*}}}*/ 931 931 void StressbalanceAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 932 _error_("not implemented yet"); 932 933 int approximation; 934 element->GetInputValue(&approximation,ApproximationEnum); 935 switch(approximation){ 936 case FSApproximationEnum: case NoneApproximationEnum: 937 //InputUpdateFromSolutionFS(solution,element); 938 return; 939 case SSAApproximationEnum: case HOApproximationEnum: case SIAApproximationEnum: 940 InputUpdateFromSolutionHoriz(solution,element); 941 return; 942 case L1L2ApproximationEnum: 943 //InputUpdateFromSolutionHoriz(solution,element); 944 return; 945 case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum: 946 /*the elements around will create the solution*/ 947 return; 948 default: 949 _error_("Approximation "<<EnumToStringx(approximation)<<" not supported"); 950 } 933 951 }/*}}}*/ 952 void StressbalanceAnalysis::InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element){/*{{{*/ 953 954 int i; 955 IssmDouble rho_ice,g; 956 int* doflist=NULL; 957 958 /*Fetch number of nodes and dof for this finite element*/ 959 int numnodes = element->GetNumberOfNodes(); 960 int numdof = numnodes*2; 961 962 /*Fetch dof list and allocate solution vectors*/ 963 element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum); 964 IssmDouble* values = xNew<IssmDouble>(numdof); 965 IssmDouble* vx = xNew<IssmDouble>(numnodes); 966 IssmDouble* vy = xNew<IssmDouble>(numnodes); 967 IssmDouble* vz = xNew<IssmDouble>(numnodes); 968 IssmDouble* vel = xNew<IssmDouble>(numnodes); 969 IssmDouble* pressure = xNew<IssmDouble>(numnodes); 970 IssmDouble* thickness = xNew<IssmDouble>(numnodes); 971 972 /*Use the dof list to index into the solution vector: */ 973 for(i=0;i<numdof;i++) values[i]=solution[doflist[i]]; 974 975 /*Transform solution in Cartesian Space*/ 976 element->TransformSolutionCoord(&values[0],XYEnum); 977 978 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 979 for(i=0;i<numnodes;i++){ 980 vx[i]=values[i*NDOF2+0]; 981 vy[i]=values[i*NDOF2+1]; 982 983 /*Check solution*/ 984 if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector"); 985 if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector"); 986 } 987 988 /*Get Vz and compute vel*/ 989 element->GetInputListOnNodes(&vz[0],VzEnum,0.); 990 for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]); 991 992 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 993 *so the pressure is just the pressure at the bedrock: */ 994 Matpar* matpar=element->GetMatparPointer(); 995 rho_ice=matpar->GetRhoIce(); 996 g=matpar->GetG(); 997 element->GetInputListOnNodes(&thickness[0],ThicknessEnum); 998 for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i]; 999 1000 /*Now, we have to move the previous Vx and Vy inputs to old 1001 * status, otherwise, we'll wipe them off: */ 1002 element->InputChangeName(VxEnum,VxPicardEnum); 1003 element->InputChangeName(VyEnum,VyPicardEnum); 1004 element->InputChangeName(PressureEnum,PressurePicardEnum); 1005 1006 /*Add vx and vy as inputs to the tria element: */ 1007 element->AddInput(VxEnum,vx,P1Enum); 1008 element->AddInput(VyEnum,vy,P1Enum); 1009 element->AddInput(VelEnum,vel,P1Enum); 1010 element->AddInput(PressureEnum,pressure,P1Enum); 1011 1012 /*Free ressources:*/ 1013 xDelete<IssmDouble>(thickness); 1014 xDelete<IssmDouble>(pressure); 1015 xDelete<IssmDouble>(vel); 1016 xDelete<IssmDouble>(vz); 1017 xDelete<IssmDouble>(vy); 1018 xDelete<IssmDouble>(vx); 1019 xDelete<IssmDouble>(values); 1020 xDelete<int>(doflist); 1021 1022 }/*}}}*/ -
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
r16684 r16693 19 19 void CreateLoads(Loads* loads, IoModel* iomodel); 20 20 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 21 void InputUpdateFromSolution(IssmDouble* solution,Element* element);22 21 void GetSolutionFromInputsFS(Vector<IssmDouble>* solution,Element* element); 23 22 void GetSolutionFromInputsHoriz(Vector<IssmDouble>* solution,Element* element); 23 void InputUpdateFromSolutionHoriz(IssmDouble* solution,Element* element); 24 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 24 25 }; 25 26 #endif -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r16685 r16693 21 21 class Vertices; 22 22 class Materials; 23 class Matpar; 23 24 class Input; 24 25 class Gauss; … … 38 39 virtual void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters)=0; 39 40 virtual void SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum)=0; 41 virtual void AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0; 40 42 virtual void CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs)=0; 41 43 virtual void CreateDVector(Vector<IssmDouble>* df)=0; … … 45 47 virtual void FindParam(IssmDouble* pvalue,int paramenum)=0; 46 48 virtual int FiniteElement(void)=0; 49 virtual Matpar* GetMatparPointer(void)=0; 50 virtual void TransformSolutionCoord(IssmDouble* values,int transformenum)=0; 47 51 virtual void GetDofList(int** pdoflist,int approximation_enum,int setenum)=0; 48 52 virtual void GetDofListVelocity(int** pdoflist,int setenum)=0; … … 58 62 virtual bool IsNodeOnShelfFromFlags(IssmDouble* flags)=0; 59 63 virtual bool IsOnBed()=0; 64 virtual void GetInputListOnNodes(IssmDouble* pvalue,int enumtype)=0; 65 virtual void GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0; 60 66 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0; 61 67 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0; … … 69 75 virtual IssmDouble SurfaceArea(void)=0; 70 76 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0; 77 virtual void InputChangeName(int enum_type,int enum_type_old)=0; 71 78 virtual void ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0; 72 79 virtual void ComputeStrainRate(Vector<IssmDouble>* eps)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r16690 r16693 1815 1815 } 1816 1816 /*}}}*/ 1817 /*FUNCTION Penta::InputChangeName{{{*/ 1818 void Penta::InputChangeName(int new_enum,int original_enum){ 1819 1820 /*Call inputs method*/ 1821 this->inputs->ChangeEnum(original_enum,new_enum); 1822 } 1823 /*}}}*/ 1817 1824 /*FUNCTION Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/ 1818 1825 void Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){ … … 3227 3234 return dt; 3228 3235 }/*}}}*/ 3236 /*FUNCTION Penta::TransformSolutionCoord{{{*/ 3237 void Penta::TransformSolutionCoord(IssmDouble* values,int transformenum){ 3238 3239 ::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum); 3240 3241 } 3242 /*}}}*/ 3229 3243 /*FUNCTION Penta::Update {{{*/ 3230 3244 void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ … … 6286 6300 6287 6301 /*Transform solution in Cartesian Space*/ 6288 TransformSolutionCoord(&vvalues[0],nodes,vnumnodes,XYZEnum);6302 ::TransformSolutionCoord(&vvalues[0],nodes,vnumnodes,XYZEnum); 6289 6303 6290 6304 /*fill in all arrays: */ … … 9799 9813 9800 9814 /*Transform solution in Cartesian Space*/ 9801 TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/9815 ::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/ 9802 9816 9803 9817 /*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */ … … 9898 9912 9899 9913 /*Transform solution in Cartesian Space*/ 9900 TransformSolutionCoord(&SSA_values[0],penta->nodes,NUMVERTICES,XYEnum);9901 TransformSolutionCoord(&HO_values[0], this->nodes,NUMVERTICES,XYEnum);9914 ::TransformSolutionCoord(&SSA_values[0],penta->nodes,NUMVERTICES,XYEnum); 9915 ::TransformSolutionCoord(&HO_values[0], this->nodes,NUMVERTICES,XYEnum); 9902 9916 9903 9917 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 9991 10005 9992 10006 /*Transform solution in Cartesian Space*/ 9993 TransformSolutionCoord(&SSA_values[0],this->nodes,NUMVERTICES,XYEnum);9994 TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);10007 ::TransformSolutionCoord(&SSA_values[0],this->nodes,NUMVERTICES,XYEnum); 10008 ::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list); 9995 10009 9996 10010 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 10073 10087 10074 10088 /*Transform solution in Cartesian Space*/ 10075 TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/10089 ::TransformSolutionCoord(&values[0],nodes,NUMVERTICES2D,XYEnum); /*2D: only the first 3 nodes are taken*/ 10076 10090 10077 10091 /*Ok, we have vx and vy in values, fill in vx and vy arrays and extrude */ … … 10155 10169 10156 10170 /*Transform solution in Cartesian Space*/ 10157 TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum);10171 ::TransformSolutionCoord(&values[0],nodes,NUMVERTICES,XYEnum); 10158 10172 GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 10159 10173 … … 10245 10259 10246 10260 /*Transform solution in Cartesian Space*/ 10247 TransformSolutionCoord(&HO_values[0],this->nodes,NUMVERTICES,XYEnum);10248 TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list);10261 ::TransformSolutionCoord(&HO_values[0],this->nodes,NUMVERTICES,XYEnum); 10262 ::TransformSolutionCoord(&FS_values[0],this->nodes,2*NUMVERTICES,cs_list); 10249 10263 10250 10264 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 10506 10520 10507 10521 /*Transform solution in Cartesian Space*/ 10508 TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);10522 ::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list); 10509 10523 10510 10524 /*Ok, we have vx and vy in values, fill in all arrays: */ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r16685 r16693 91 91 void GetNodesLidList(int* lidlist); 92 92 int GetNumberOfNodes(void); 93 Matpar* GetMatparPointer(void){_error_("not implemented yet");}; 93 94 void GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type); 94 95 IssmDouble GetZcoord(GaussPenta* gauss); … … 179 180 /*}}}*/ 180 181 /*Penta specific routines:{{{*/ 182 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 181 183 void BedNormal(IssmDouble* bed_normal, IssmDouble xyz_list[3][3]); 182 184 ElementMatrix* CreateBasalMassMatrix(void); … … 218 220 Penta* GetLowerElement(void); 219 221 Penta* GetBasalElement(void); 222 void InputChangeName(int input_enum, int enum_type_old); 220 223 void InputExtrude(int enum_type,int object_type); 221 224 void InputUpdateFromSolutionMasstransport(IssmDouble* solutiong); … … 235 238 Tria* SpawnTria(int location); 236 239 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]); 240 void TransformSolutionCoord(IssmDouble* values,int transformenum); 237 241 238 242 #ifdef _HAVE_STRESSBALANCE_ -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r16685 r16693 66 66 /*}}}*/ 67 67 /*Element virtual functions definitions: {{{*/ 68 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 68 69 void ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");}; 69 70 void ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");}; … … 84 85 void GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");}; 85 86 void GetDofListPressure(int** pdoflist,int setenum){_error_("not implemented yet");}; 87 void GetInputListOnNodes(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");}; 88 void GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");}; 89 Matpar* GetMatparPointer(void){_error_("not implemented yet");}; 86 90 int GetNodeIndex(Node* node){_error_("not implemented yet");}; 87 91 void GetNodesSidList(int* sidlist){_error_("not implemented yet");}; … … 89 93 int GetNumberOfNodes(void){_error_("not implemented yet");}; 90 94 int Sid(){_error_("not implemented yet");}; 95 void InputChangeName(int input_enum, int enum_type_old){_error_("not implemented yet");}; 91 96 bool IsOnBed(){_error_("not implemented yet");}; 92 97 bool IsFloating(){_error_("not implemented yet");}; … … 117 122 void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask){_error_("not implemented yet");}; 118 123 void ComputeEPLThickness(void){_error_("not implemented yet");}; 119 void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");};120 124 #endif 121 125 void GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");}; … … 135 139 void Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement){_error_("not implemented yet");}; 136 140 IssmDouble TimeAdapt(){_error_("not implemented yet");}; 141 void TransformSolutionCoord(IssmDouble* values,int transformenum){_error_("not implemented yet");}; 137 142 void UpdateConstraintsExtrudeFromBase(){_error_("not implemented");}; 138 143 void UpdateConstraintsExtrudeFromTop(){_error_("not implemented");}; 144 void UpdateConstraintsL2ProjectionEPL(){_error_("not implemented");}; 139 145 140 146 #ifdef _HAVE_RESPONSES_ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r16691 r16693 164 164 *pd_nz=d_nz; 165 165 *po_nz=o_nz; 166 } 167 /*}}}*/ 168 /*FUNCTION Tria::AddInput{{{*/ 169 void Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){ 170 171 /*Call inputs method*/ 172 this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum)); 166 173 } 167 174 /*}}}*/ … … 1490 1497 } 1491 1498 /*}}}*/ 1499 /*FUNCTION Tria::GetMatparPointer(void) {{{*/ 1500 Matpar* Tria::GetMatparPointer(void){ 1501 return this->matpar; 1502 } 1503 /*}}}*/ 1492 1504 /*FUNCTION Tria::GetVertexPidList {{{*/ 1493 1505 void Tria::GetVertexPidList(int* doflist){ … … 1598 1610 inputs->DuplicateInput(original_enum,new_enum); 1599 1611 } 1612 } 1613 /*}}}*/ 1614 /*FUNCTION Tria::InputChangeName{{{*/ 1615 void Tria::InputChangeName(int new_enum,int original_enum){ 1616 1617 /*Call inputs method*/ 1618 this->inputs->ChangeEnum(original_enum,new_enum); 1600 1619 } 1601 1620 /*}}}*/ … … 2765 2784 } 2766 2785 /*}}}*/ 2786 /*FUNCTION Tria::TransformSolutionCoord{{{*/ 2787 void Tria::TransformSolutionCoord(IssmDouble* values,int transformenum){ 2788 2789 ::TransformSolutionCoord(values,this->nodes,this->NumberofNodes(),transformenum); 2790 2791 } 2792 /*}}}*/ 2767 2793 /*FUNCTION Tria::Update{{{*/ 2768 2794 void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ … … 4339 4365 4340 4366 /*Transform solution in Cartesian Space*/ 4341 TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);4367 ::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum); 4342 4368 4343 4369 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4421 4447 4422 4448 /*Transform solution in Cartesian Space*/ 4423 TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list);4449 ::TransformSolutionCoord(&values[0],nodes,vnumnodes+pnumdof,cs_list); 4424 4450 4425 4451 /*Ok, we have vx and vy in values, fill in all arrays: */ … … 4488 4514 4489 4515 /*Transform solution in Cartesian Space*/ 4490 TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);4516 ::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum); 4491 4517 4492 4518 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 6258 6284 6259 6285 /*Transform solution in Cartesian Space*/ 6260 TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum);6286 ::TransformSolutionCoord(&values[0],nodes,numnodes,XYEnum); 6261 6287 6262 6288 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r16685 r16693 191 191 /*}}}*/ 192 192 /*Tria specific routines:{{{*/ 193 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 193 194 ElementMatrix* CreateKMatrix(void); 194 195 ElementMatrix* CreateKMatrixBalancethickness(void); … … 237 238 IssmDouble GetGroundedPortion(IssmDouble* xyz_list); 238 239 void GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]); 240 Matpar* GetMatparPointer(void); 239 241 void GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[3][3],int levelsetenum); 240 242 Input* GetInput(int inputenum); … … 250 252 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype); 251 253 void GetStrainRate2d(IssmDouble* epsilon,IssmDouble* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input); 254 void InputChangeName(int enum_type,int enum_type_old); 252 255 void InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type); 253 256 void InputUpdateFromSolutionMasstransport(IssmDouble* solution); … … 257 260 Seg* SpawnSeg(int index1,int index2); 258 261 void SurfaceNormal(IssmDouble* surface_normal, IssmDouble xyz_list[3][3]); 262 void TransformSolutionCoord(IssmDouble* values,int transformenum); 259 263 #ifdef _HAVE_STRESSBALANCE_ 260 264 ElementMatrix* CreateKMatrixStressbalanceSSA(void);
Note:
See TracChangeset
for help on using the changeset viewer.