Changeset 18929
- Timestamp:
- 12/04/14 09:50:36 (10 years ago)
- Location:
- issm/trunk-jpl/src/c/analyses
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/Analysis.h
r18057 r18929 26 26 27 27 /*Model processing*/ 28 virtual int DofsPerNode(int** doflist,int domaintype,int approximation)=0;29 virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0;30 virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0;31 virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0;32 28 virtual void CreateConstraints(Constraints* constraints,IoModel* iomodel)=0; 33 29 virtual void CreateLoads(Loads* loads, IoModel* iomodel)=0; 30 virtual void CreateNodes(Nodes* nodes,IoModel* iomodel)=0; 31 virtual int DofsPerNode(int** doflist,int domaintype,int approximation)=0; 32 virtual void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type)=0; 33 virtual void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum)=0; 34 34 35 35 /*Finite element Analysis*/ … … 39 39 virtual ElementMatrix* CreateKMatrix(Element* element)=0; 40 40 virtual ElementVector* CreatePVector(Element* element)=0; 41 virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0;42 virtual void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index)=0;43 virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0;44 virtual void UpdateConstraints(FemModel* femmodel)=0;41 virtual void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element)=0; 42 virtual void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index)=0; 43 virtual void InputUpdateFromSolution(IssmDouble* solution,Element* element)=0; 44 virtual void UpdateConstraints(FemModel* femmodel)=0; 45 45 }; 46 46 #endif -
issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.cpp
r18057 r18929 6 6 7 7 /*Model processing*/ 8 void DepthAverageAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 }/*}}}*/ 10 void DepthAverageAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 11 }/*}}}*/ 12 void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 13 14 ::CreateNodes(nodes,iomodel,DepthAverageAnalysisEnum,P1Enum); 15 16 }/*}}}*/ 8 17 int DepthAverageAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 18 return 1; 10 }/*}}}*/11 void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 19 }/*}}}*/ 13 20 void DepthAverageAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 26 33 } 27 34 }/*}}}*/ 28 void DepthAverageAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 29 30 ::CreateNodes(nodes,iomodel,DepthAverageAnalysisEnum,P1Enum); 31 32 }/*}}}*/ 33 void DepthAverageAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 34 }/*}}}*/ 35 void DepthAverageAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 35 void DepthAverageAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 36 36 }/*}}}*/ 37 37 … … 137 137 return pe; 138 138 }/*}}}*/ 139 void DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/139 void DepthAverageAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 140 140 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz]; 141 141 where hi is the interpolation function for node i.*/ … … 157 157 } 158 158 /*}}}*/ 159 void DepthAverageAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/159 void DepthAverageAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 160 160 _error_("not implemented yet"); 161 161 }/*}}}*/ 162 void DepthAverageAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/162 void DepthAverageAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 163 163 _error_("Not implemented yet"); 164 164 }/*}}}*/ 165 void DepthAverageAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/165 void DepthAverageAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 166 166 167 167 int inputenum; … … 169 169 element->InputUpdateFromSolutionOneDof(solution,inputenum); 170 170 }/*}}}*/ 171 void DepthAverageAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/171 void DepthAverageAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 172 172 /*Default, do nothing*/ 173 173 return; -
issm/trunk-jpl/src/c/analyses/DepthAverageAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 27 ElementVector* CreatePVector(Element* element); 28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);29 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);30 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);31 void InputUpdateFromSolution(IssmDouble* solution,Element* element);32 void UpdateConstraints(FemModel* femmodel);28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 29 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 30 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 31 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 32 void UpdateConstraints(FemModel* femmodel); 33 33 }; 34 34 #endif -
issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
r18521 r18929 6 6 #include "../solutionsequences/solutionsequences.h" 7 7 8 int ExtrapolationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 8 void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 // do nothing for now 10 return; 11 } 12 /*}}}*/ 13 void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 14 // do nothing for now 15 return; 16 }/*}}}*/ 17 void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 18 int finiteelement=P1Enum; 19 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 20 ::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement); 21 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 22 } 23 /*}}}*/ 24 int ExtrapolationAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 25 return 1; 10 }11 /*}}}*/12 void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/13 //do nothing for now14 return;15 26 } 16 27 /*}}}*/ … … 36 47 } 37 48 /*}}}*/ 38 void ExtrapolationAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 39 int finiteelement=P1Enum; 40 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 41 ::CreateNodes(nodes,iomodel,ExtrapolationAnalysisEnum,finiteelement); 42 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 43 } 44 /*}}}*/ 45 void ExtrapolationAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 46 // do nothing for now 49 void ExtrapolationAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 50 //do nothing for now 47 51 return; 48 52 } 49 53 /*}}}*/ 50 void ExtrapolationAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/51 // do nothing for now52 return;53 }/*}}}*/54 54 55 55 /*Finite element Analysis*/ 56 void ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/56 void ExtrapolationAnalysis::Core(FemModel* femmodel){/*{{{*/ 57 57 58 58 /* Intermediaries */ … … 237 237 return pe; 238 238 }/*}}}*/ 239 void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 239 void ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 240 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 241 * For node i, Bi can be expressed in the actual coordinate system 242 * by: 243 * Bi=[ N ] 244 * [ N ] 245 * where N is the finiteelement function for node i. 246 * 247 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes) 248 */ 249 250 /*Fetch number of nodes for this finite element*/ 251 int numnodes = element->GetNumberOfNodes(); 252 253 /*Get nodal functions*/ 254 IssmDouble* basis=xNew<IssmDouble>(numnodes); 255 element->NodalFunctions(basis,gauss); 256 257 /*Build B: */ 258 for(int i=0;i<numnodes;i++){ 259 B[numnodes*0+i] = basis[i]; 260 B[numnodes*1+i] = basis[i]; 261 } 262 263 /*Clean-up*/ 264 xDelete<IssmDouble>(basis); 265 }/*}}}*/ 266 void ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 267 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 268 * For node i, Bi' can be expressed in the actual coordinate system 269 * by: 270 * Bi_prime=[ dN/dx ] 271 * [ dN/dy ] 272 * where N is the finiteelement function for node i. 273 * 274 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes) 275 */ 276 277 /*Fetch number of nodes for this finite element*/ 278 int numnodes = element->GetNumberOfNodes(); 279 280 /*Get nodal functions derivatives*/ 281 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 282 element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss); 283 284 /*Build B': */ 285 for(int i=0;i<numnodes;i++){ 286 Bprime[numnodes*0+i] = dbasis[0*numnodes+i]; 287 Bprime[numnodes*1+i] = dbasis[1*numnodes+i]; 288 } 289 290 /*Clean-up*/ 291 xDelete<IssmDouble>(dbasis); 292 293 }/*}}}*/ 294 void ExtrapolationAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 240 295 _error_("not implemented yet"); 241 296 }/*}}}*/ 242 void ExtrapolationAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/297 void ExtrapolationAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 243 298 _error_("Not implemented yet"); 244 299 }/*}}}*/ 245 void ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/300 void ExtrapolationAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 246 301 247 302 int domaintype, extrapolationvariable; … … 258 313 } 259 314 }/*}}}*/ 260 void ExtrapolationAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 261 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 262 * For node i, Bi can be expressed in the actual coordinate system 263 * by: 264 * Bi=[ N ] 265 * [ N ] 266 * where N is the finiteelement function for node i. 267 * 268 * We assume B_prog has been allocated already, of size: 2x(NDOF1*numnodes) 269 */ 270 271 /*Fetch number of nodes for this finite element*/ 272 int numnodes = element->GetNumberOfNodes(); 273 274 /*Get nodal functions*/ 275 IssmDouble* basis=xNew<IssmDouble>(numnodes); 276 element->NodalFunctions(basis,gauss); 277 278 /*Build B: */ 279 for(int i=0;i<numnodes;i++){ 280 B[numnodes*0+i] = basis[i]; 281 B[numnodes*1+i] = basis[i]; 282 } 283 284 /*Clean-up*/ 285 xDelete<IssmDouble>(basis); 286 }/*}}}*/ 287 void ExtrapolationAnalysis::GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 288 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 289 * For node i, Bi' can be expressed in the actual coordinate system 290 * by: 291 * Bi_prime=[ dN/dx ] 292 * [ dN/dy ] 293 * where N is the finiteelement function for node i. 294 * 295 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes) 296 */ 297 298 /*Fetch number of nodes for this finite element*/ 299 int numnodes = element->GetNumberOfNodes(); 300 301 /*Get nodal functions derivatives*/ 302 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 303 element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss); 304 305 /*Build B': */ 306 for(int i=0;i<numnodes;i++){ 307 Bprime[numnodes*0+i] = dbasis[0*numnodes+i]; 308 Bprime[numnodes*1+i] = dbasis[1*numnodes+i]; 309 } 310 311 /*Clean-up*/ 312 xDelete<IssmDouble>(dbasis); 313 314 }/*}}}*/ 315 void ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/ 315 void ExtrapolationAnalysis::SetConstraintsOnIce(Element* element){/*{{{*/ 316 316 317 317 int numnodes=element->GetNumberOfNodes(); … … 347 347 delete gauss; 348 348 }/*}}}*/ 349 void ExtrapolationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/349 void ExtrapolationAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 350 350 351 351 for(int i=0;i<femmodel->elements->Size();i++){ -
issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 27 ElementVector* CreatePVector(Element* element); 28 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);29 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);30 void InputUpdateFromSolution(IssmDouble* solution,Element* element);31 void UpdateConstraints(FemModel* femmodel);32 void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);33 void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss);34 void SetConstraintsOnIce(Element* element);28 void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss); 29 void GetBprime(IssmDouble* Bprime,Element* element,IssmDouble* xyz_list,Gauss* gauss); 30 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 31 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 32 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 33 void SetConstraintsOnIce(Element* element); 34 void UpdateConstraints(FemModel* femmodel); 35 35 }; 36 36 #endif -
issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
r18057 r18929 6 6 7 7 /*Model processing*/ 8 void ExtrudeFromBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 }/*}}}*/ 10 void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 11 }/*}}}*/ 12 void ExtrudeFromBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 13 14 ::CreateNodes(nodes,iomodel,ExtrudeFromBaseAnalysisEnum,P1Enum); 15 16 }/*}}}*/ 8 17 int ExtrudeFromBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 18 return 1; 10 }/*}}}*/11 void ExtrudeFromBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 19 }/*}}}*/ 13 20 void ExtrudeFromBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 26 33 } 27 34 }/*}}}*/ 28 void ExtrudeFromBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 29 30 ::CreateNodes(nodes,iomodel,ExtrudeFromBaseAnalysisEnum,P1Enum); 31 32 }/*}}}*/ 33 void ExtrudeFromBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 34 }/*}}}*/ 35 void ExtrudeFromBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 35 void ExtrudeFromBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 36 36 }/*}}}*/ 37 37 … … 61 61 return Ke; 62 62 }/*}}}*/ 63 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/ 64 65 if(!element->IsOnBase()) return NULL; 66 67 /*Intermediaries */ 68 int dim; 69 IssmDouble Jdet,D,normal[3]; 70 IssmDouble *xyz_list_base = NULL; 71 72 /*Get dimension*/ 73 element->FindParam(&dim,DomainDimensionEnum); 74 75 /*Fetch number of nodes and dof for this finite element*/ 76 int numnodes = element->GetNumberOfNodes(); 77 78 /*Initialize Element vector and other vectors*/ 79 ElementMatrix* Ke = element->NewElementMatrix(); 80 IssmDouble* basis = xNew<IssmDouble>(numnodes); 81 82 /*Retrieve all inputs and parameters*/ 83 element->GetVerticesCoordinatesBase(&xyz_list_base); 84 element->NormalBase(&normal[0],xyz_list_base); 85 86 /* Start looping on the number of gaussian points: */ 87 Gauss* gauss=element->NewGaussBase(2); 88 for(int ig=gauss->begin();ig<gauss->end();ig++){ 89 gauss->GaussPoint(ig); 90 91 element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss); 92 element->NodalFunctions(basis,gauss); 93 D = - gauss->weight*Jdet*normal[dim-1]; 94 95 TripleMultiply(basis,1,numnodes,1, 96 &D,1,1,0, 97 basis,1,numnodes,0, 98 &Ke->values[0],1); 99 } 100 101 /*Clean up and return*/ 102 xDelete<IssmDouble>(xyz_list_base); 103 xDelete<IssmDouble>(basis); 104 delete gauss; 105 return Ke; 106 } 107 /*}}}*/ 108 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/ 109 110 if(!element->IsOnSurface()) return NULL; 111 112 /*Intermediaries */ 113 int dim; 114 IssmDouble Jdet,D,normal[3]; 115 IssmDouble *xyz_list_top = NULL; 116 117 /*Get dimension*/ 118 element->FindParam(&dim,DomainDimensionEnum); 119 120 /*Fetch number of nodes and dof for this finite element*/ 121 int numnodes = element->GetNumberOfNodes(); 122 123 /*Initialize Element vector and other vectors*/ 124 ElementMatrix* Ke = element->NewElementMatrix(); 125 IssmDouble* basis = xNew<IssmDouble>(numnodes); 126 127 /*Retrieve all inputs and parameters*/ 128 element->GetVerticesCoordinatesTop(&xyz_list_top); 129 element->NormalTop(&normal[0],xyz_list_top); 130 131 /* Start looping on the number of gaussian points: */ 132 Gauss* gauss=element->NewGaussTop(2); 133 for(int ig=gauss->begin();ig<gauss->end();ig++){ 134 gauss->GaussPoint(ig); 135 136 element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss); 137 element->NodalFunctions(basis,gauss); 138 D = - gauss->weight*Jdet*normal[dim-1]; 139 140 TripleMultiply(basis,1,numnodes,1, 141 &D,1,1,0, 142 basis,1,numnodes,0, 143 &Ke->values[0],1); 144 } 145 146 /*Clean up and return*/ 147 xDelete<IssmDouble>(xyz_list_top); 148 xDelete<IssmDouble>(basis); 149 delete gauss; 150 return Ke; 151 } 152 /*}}}*/ 63 153 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixVolume(Element* element){/*{{{*/ 64 154 … … 106 196 } 107 197 /*}}}*/ 108 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixSurface(Element* element){/*{{{*/109 110 if(!element->IsOnSurface()) return NULL;111 112 /*Intermediaries */113 int dim;114 IssmDouble Jdet,D,normal[3];115 IssmDouble *xyz_list_top = NULL;116 117 /*Get dimension*/118 element->FindParam(&dim,DomainDimensionEnum);119 120 /*Fetch number of nodes and dof for this finite element*/121 int numnodes = element->GetNumberOfNodes();122 123 /*Initialize Element vector and other vectors*/124 ElementMatrix* Ke = element->NewElementMatrix();125 IssmDouble* basis = xNew<IssmDouble>(numnodes);126 127 /*Retrieve all inputs and parameters*/128 element->GetVerticesCoordinatesTop(&xyz_list_top);129 element->NormalTop(&normal[0],xyz_list_top);130 131 /* Start looping on the number of gaussian points: */132 Gauss* gauss=element->NewGaussTop(2);133 for(int ig=gauss->begin();ig<gauss->end();ig++){134 gauss->GaussPoint(ig);135 136 element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);137 element->NodalFunctions(basis,gauss);138 D = - gauss->weight*Jdet*normal[dim-1];139 140 TripleMultiply(basis,1,numnodes,1,141 &D,1,1,0,142 basis,1,numnodes,0,143 &Ke->values[0],1);144 }145 146 /*Clean up and return*/147 xDelete<IssmDouble>(xyz_list_top);148 xDelete<IssmDouble>(basis);149 delete gauss;150 return Ke;151 }152 /*}}}*/153 ElementMatrix* ExtrudeFromBaseAnalysis::CreateKMatrixBed(Element* element){/*{{{*/154 155 if(!element->IsOnBase()) return NULL;156 157 /*Intermediaries */158 int dim;159 IssmDouble Jdet,D,normal[3];160 IssmDouble *xyz_list_base = NULL;161 162 /*Get dimension*/163 element->FindParam(&dim,DomainDimensionEnum);164 165 /*Fetch number of nodes and dof for this finite element*/166 int numnodes = element->GetNumberOfNodes();167 168 /*Initialize Element vector and other vectors*/169 ElementMatrix* Ke = element->NewElementMatrix();170 IssmDouble* basis = xNew<IssmDouble>(numnodes);171 172 /*Retrieve all inputs and parameters*/173 element->GetVerticesCoordinatesBase(&xyz_list_base);174 element->NormalBase(&normal[0],xyz_list_base);175 176 /* Start looping on the number of gaussian points: */177 Gauss* gauss=element->NewGaussBase(2);178 for(int ig=gauss->begin();ig<gauss->end();ig++){179 gauss->GaussPoint(ig);180 181 element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);182 element->NodalFunctions(basis,gauss);183 D = - gauss->weight*Jdet*normal[dim-1];184 185 TripleMultiply(basis,1,numnodes,1,186 &D,1,1,0,187 basis,1,numnodes,0,188 &Ke->values[0],1);189 }190 191 /*Clean up and return*/192 xDelete<IssmDouble>(xyz_list_base);193 xDelete<IssmDouble>(basis);194 delete gauss;195 return Ke;196 }197 /*}}}*/198 198 ElementVector* ExtrudeFromBaseAnalysis::CreatePVector(Element* element){/*{{{*/ 199 199 return NULL; 200 200 }/*}}}*/ 201 void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/201 void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 202 202 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz]; 203 203 where hi is the interpolation function for node i.*/ … … 219 219 } 220 220 /*}}}*/ 221 void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/221 void ExtrudeFromBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 222 222 _error_("not implemented yet"); 223 223 }/*}}}*/ 224 void ExtrudeFromBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/224 void ExtrudeFromBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 225 225 _error_("Not implemented yet"); 226 226 }/*}}}*/ 227 void ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/227 void ExtrudeFromBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 228 228 229 229 int inputenum; … … 231 231 element->InputUpdateFromSolutionOneDof(solution,inputenum); 232 232 }/*}}}*/ 233 void ExtrudeFromBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/233 void ExtrudeFromBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 234 234 /*Default, do nothing*/ 235 235 return; -
issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 25 25 ElementMatrix* CreateJacobianMatrix(Element* element); 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 ElementMatrix* CreateKMatrixBed(Element* element); 28 ElementMatrix* CreateKMatrixSurface(Element* element); 27 29 ElementMatrix* CreateKMatrixVolume(Element* element); 28 ElementMatrix* CreateKMatrixSurface(Element* element);29 ElementMatrix* CreateKMatrixBed(Element* element);30 30 ElementVector* CreatePVector(Element* element); 31 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);32 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);33 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);34 void InputUpdateFromSolution(IssmDouble* solution,Element* element);35 void UpdateConstraints(FemModel* femmodel);31 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 32 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 33 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 34 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 35 void UpdateConstraints(FemModel* femmodel); 36 36 }; 37 37 #endif -
issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
r18057 r18929 6 6 7 7 /*Model processing*/ 8 void ExtrudeFromTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 }/*}}}*/ 10 void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 11 }/*}}}*/ 12 void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 13 14 ::CreateNodes(nodes,iomodel,ExtrudeFromTopAnalysisEnum,P1Enum); 15 16 }/*}}}*/ 8 17 int ExtrudeFromTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 18 return 1; 10 }/*}}}*/11 void ExtrudeFromTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 19 }/*}}}*/ 13 20 void ExtrudeFromTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 26 33 } 27 34 }/*}}}*/ 28 void ExtrudeFromTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 29 30 ::CreateNodes(nodes,iomodel,ExtrudeFromTopAnalysisEnum,P1Enum); 31 32 }/*}}}*/ 33 void ExtrudeFromTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 34 }/*}}}*/ 35 void ExtrudeFromTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 35 void ExtrudeFromTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 36 36 }/*}}}*/ 37 37 … … 199 199 return NULL; 200 200 }/*}}}*/ 201 void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/201 void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 202 202 /* Compute B matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz]; 203 203 where hi is the interpolation function for node i.*/ … … 219 219 } 220 220 /*}}}*/ 221 void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/221 void ExtrudeFromTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 222 222 _error_("not implemented yet"); 223 223 }/*}}}*/ 224 void ExtrudeFromTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/224 void ExtrudeFromTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 225 225 _error_("Not implemented yet"); 226 226 }/*}}}*/ 227 void ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/227 void ExtrudeFromTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 228 228 229 229 int inputenum; … … 231 231 element->InputUpdateFromSolutionOneDof(solution,inputenum); 232 232 }/*}}}*/ 233 void ExtrudeFromTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/233 void ExtrudeFromTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 234 234 /*Default, do nothing*/ 235 235 return; -
issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 25 25 ElementMatrix* CreateJacobianMatrix(Element* element); 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 ElementMatrix* CreateKMatrixBed(Element* element); 28 ElementMatrix* CreateKMatrixSurface(Element* element); 27 29 ElementMatrix* CreateKMatrixVolume(Element* element); 28 ElementMatrix* CreateKMatrixSurface(Element* element);29 ElementMatrix* CreateKMatrixBed(Element* element);30 30 ElementVector* CreatePVector(Element* element); 31 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);32 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);33 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);34 void InputUpdateFromSolution(IssmDouble* solution,Element* element);35 void UpdateConstraints(FemModel* femmodel);31 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 32 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 33 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 34 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 35 void UpdateConstraints(FemModel* femmodel); 36 36 }; 37 37 #endif -
issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
r18521 r18929 6 6 7 7 /*Model processing*/ 8 void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 }/*}}}*/ 10 void FreeSurfaceBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 11 12 /*Intermediaries*/ 13 int penpair_ids[2]; 14 int count=0; 15 int numvertex_pairing; 16 17 /*Create Penpair for vertex_pairing: */ 18 IssmDouble *vertex_pairing=NULL; 19 IssmDouble *nodeonbase=NULL; 20 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum); 21 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum); 22 for(int i=0;i<numvertex_pairing;i++){ 23 24 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){ 25 26 /*In debugging mode, check that the second node is in the same cpu*/ 27 _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]); 28 29 /*Skip if one of the two is not on the bed*/ 30 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 31 if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue; 32 } 33 34 /*Get node ids*/ 35 penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]); 36 penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]); 37 38 /*Create Load*/ 39 loads->AddObject(new Penpair( 40 iomodel->loadcounter+count+1, 41 &penpair_ids[0], 42 FreeSurfaceBaseAnalysisEnum)); 43 count++; 44 } 45 } 46 47 /*free ressources: */ 48 iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum); 49 iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum); 50 }/*}}}*/ 51 void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 52 53 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 54 ::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum); 55 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 56 }/*}}}*/ 8 57 int FreeSurfaceBaseAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 58 return 1; 10 }/*}}}*/11 void FreeSurfaceBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 59 }/*}}}*/ 13 60 void FreeSurfaceBaseAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 43 90 } 44 91 }/*}}}*/ 45 void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 46 47 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 48 ::CreateNodes(nodes,iomodel,FreeSurfaceBaseAnalysisEnum,P1Enum); 49 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 50 }/*}}}*/ 51 void FreeSurfaceBaseAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 52 }/*}}}*/ 53 void FreeSurfaceBaseAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 54 55 /*Intermediaries*/ 56 int penpair_ids[2]; 57 int count=0; 58 int numvertex_pairing; 59 60 /*Create Penpair for vertex_pairing: */ 61 IssmDouble *vertex_pairing=NULL; 62 IssmDouble *nodeonbase=NULL; 63 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum); 64 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonbase,NULL,NULL,MeshVertexonbaseEnum); 65 for(int i=0;i<numvertex_pairing;i++){ 66 67 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){ 68 69 /*In debugging mode, check that the second node is in the same cpu*/ 70 _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]); 71 72 /*Skip if one of the two is not on the bed*/ 73 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 74 if(!(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonbase[reCast<int>(vertex_pairing[2*i+1])-1]))) continue; 75 } 76 77 /*Get node ids*/ 78 penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]); 79 penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]); 80 81 /*Create Load*/ 82 loads->AddObject(new Penpair( 83 iomodel->loadcounter+count+1, 84 &penpair_ids[0], 85 FreeSurfaceBaseAnalysisEnum)); 86 count++; 87 } 88 } 89 90 /*free ressources: */ 91 iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum); 92 iomodel->DeleteData(nodeonbase,MeshVertexonbaseEnum); 92 void FreeSurfaceBaseAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 93 93 }/*}}}*/ 94 94 … … 304 304 305 305 }/*}}}*/ 306 void FreeSurfaceBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/306 void FreeSurfaceBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 307 307 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 308 308 * For node i, Bi can be expressed in the actual coordinate system … … 332 332 xDelete<IssmDouble>(basis); 333 333 }/*}}}*/ 334 void FreeSurfaceBaseAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/334 void FreeSurfaceBaseAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 335 335 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 336 336 * For node i, Bi' can be expressed in the actual coordinate system … … 361 361 362 362 }/*}}}*/ 363 void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/363 void FreeSurfaceBaseAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 364 364 _error_("not implemented yet"); 365 365 }/*}}}*/ 366 void FreeSurfaceBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/366 void FreeSurfaceBaseAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 367 367 _error_("Not implemented yet"); 368 368 }/*}}}*/ 369 void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/369 void FreeSurfaceBaseAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 370 370 element->InputUpdateFromSolutionOneDof(solution,BaseEnum); 371 371 }/*}}}*/ 372 void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/372 void FreeSurfaceBaseAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 373 373 374 374 /*Intermediary*/ -
issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 27 ElementVector* CreatePVector(Element* element); 28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);29 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);30 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);31 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);32 void InputUpdateFromSolution(IssmDouble* solution,Element* element);33 void UpdateConstraints(FemModel* femmodel);28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 29 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 30 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 31 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 32 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 33 void UpdateConstraints(FemModel* femmodel); 34 34 }; 35 35 #endif -
issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
r18057 r18929 6 6 7 7 /*Model processing*/ 8 void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 }/*}}}*/ 10 void FreeSurfaceTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 11 12 /*Intermediaries*/ 13 int penpair_ids[2]; 14 int count=0; 15 int numvertex_pairing; 16 17 /*Create Penpair for vertex_pairing: */ 18 IssmDouble *vertex_pairing=NULL; 19 IssmDouble *nodeonsurface=NULL; 20 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum); 21 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum); 22 for(int i=0;i<numvertex_pairing;i++){ 23 24 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){ 25 26 /*In debugging mode, check that the second node is in the same cpu*/ 27 _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]); 28 29 /*Skip if one of the two is not on the bed*/ 30 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 31 if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue; 32 } 33 34 /*Get node ids*/ 35 penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]); 36 penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]); 37 38 /*Create Load*/ 39 loads->AddObject(new Penpair( 40 iomodel->loadcounter+count+1, 41 &penpair_ids[0], 42 FreeSurfaceTopAnalysisEnum)); 43 count++; 44 } 45 } 46 47 /*free ressources: */ 48 iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum); 49 iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum); 50 }/*}}}*/ 51 void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 52 53 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 54 ::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum); 55 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 56 }/*}}}*/ 8 57 int FreeSurfaceTopAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 58 return 1; 10 }/*}}}*/11 void FreeSurfaceTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 59 }/*}}}*/ 13 60 void FreeSurfaceTopAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 51 98 } 52 99 }/*}}}*/ 53 void FreeSurfaceTopAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 54 55 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 56 ::CreateNodes(nodes,iomodel,FreeSurfaceTopAnalysisEnum,P1Enum); 57 iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum); 58 }/*}}}*/ 59 void FreeSurfaceTopAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 60 }/*}}}*/ 61 void FreeSurfaceTopAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 62 63 /*Intermediaries*/ 64 int penpair_ids[2]; 65 int count=0; 66 int numvertex_pairing; 67 68 /*Create Penpair for vertex_pairing: */ 69 IssmDouble *vertex_pairing=NULL; 70 IssmDouble *nodeonsurface=NULL; 71 iomodel->FetchData(&vertex_pairing,&numvertex_pairing,NULL,MasstransportVertexPairingEnum); 72 if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchData(&nodeonsurface,NULL,NULL,MeshVertexonsurfaceEnum); 73 for(int i=0;i<numvertex_pairing;i++){ 74 75 if(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+0])-1]){ 76 77 /*In debugging mode, check that the second node is in the same cpu*/ 78 _assert_(iomodel->my_vertices[reCast<int>(vertex_pairing[2*i+1])-1]); 79 80 /*Skip if one of the two is not on the bed*/ 81 if(iomodel->domaintype!=Domain2DhorizontalEnum){ 82 if(!(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+0])-1])) || !(reCast<bool>(nodeonsurface[reCast<int>(vertex_pairing[2*i+1])-1]))) continue; 83 } 84 85 /*Get node ids*/ 86 penpair_ids[0]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+0]); 87 penpair_ids[1]=iomodel->nodecounter+reCast<int>(vertex_pairing[2*i+1]); 88 89 /*Create Load*/ 90 loads->AddObject(new Penpair( 91 iomodel->loadcounter+count+1, 92 &penpair_ids[0], 93 FreeSurfaceTopAnalysisEnum)); 94 count++; 95 } 96 } 97 98 /*free ressources: */ 99 iomodel->DeleteData(vertex_pairing,MasstransportVertexPairingEnum); 100 iomodel->DeleteData(nodeonsurface,MeshVertexonsurfaceEnum); 100 void FreeSurfaceTopAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 101 101 }/*}}}*/ 102 102 … … 307 307 308 308 }/*}}}*/ 309 void FreeSurfaceTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/309 void FreeSurfaceTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 310 310 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 311 311 * For node i, Bi can be expressed in the actual coordinate system … … 335 335 xDelete<IssmDouble>(basis); 336 336 }/*}}}*/ 337 void FreeSurfaceTopAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/337 void FreeSurfaceTopAnalysis::GetBprime(IssmDouble* Bprime,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 338 338 /*Compute B' matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 339 339 * For node i, Bi' can be expressed in the actual coordinate system … … 364 364 365 365 }/*}}}*/ 366 void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/366 void FreeSurfaceTopAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 367 367 _error_("not implemented yet"); 368 368 }/*}}}*/ 369 void FreeSurfaceTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/369 void FreeSurfaceTopAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 370 370 _error_("Not implemented yet"); 371 371 }/*}}}*/ 372 void FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/372 void FreeSurfaceTopAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 373 373 374 374 element->InputUpdateFromSolutionOneDof(solution,SurfaceEnum); 375 375 }/*}}}*/ 376 void FreeSurfaceTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/376 void FreeSurfaceTopAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 377 377 /*Default, do nothing*/ 378 378 return; -
issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 27 ElementVector* CreatePVector(Element* element); 28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);29 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);30 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);31 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);32 void InputUpdateFromSolution(IssmDouble* solution,Element* element);33 void UpdateConstraints(FemModel* femmodel);28 void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 29 void GetBprime(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss); 30 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 31 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 32 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 33 void UpdateConstraints(FemModel* femmodel); 34 34 }; 35 35 #endif -
issm/trunk-jpl/src/c/analyses/GiaAnalysis.cpp
r18057 r18929 6 6 7 7 /*Model processing*/ 8 void GiaAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 9 /*No constraints*/ 10 }/*}}}*/ 11 void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 12 /*No loads*/ 13 }/*}}}*/ 14 void GiaAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 15 ::CreateNodes(nodes,iomodel,GiaAnalysisEnum,P1Enum); 16 }/*}}}*/ 8 17 int GiaAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/ 9 18 return 1; 10 }/*}}}*/11 void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/12 19 }/*}}}*/ 13 20 void GiaAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/ … … 27 34 iomodel->FetchDataToInput(elements,GiaLithosphereThicknessEnum); 28 35 }/*}}}*/ 29 void GiaAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/ 30 ::CreateNodes(nodes,iomodel,GiaAnalysisEnum,P1Enum); 31 }/*}}}*/ 32 void GiaAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 33 /*No constraints*/ 34 }/*}}}*/ 35 void GiaAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/ 36 /*No loads*/ 36 void GiaAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/ 37 37 }/*}}}*/ 38 38 … … 54 54 _error_("not implemented yet"); 55 55 }/*}}}*/ 56 void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/56 void GiaAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/ 57 57 _error_("not implemented yet"); 58 58 }/*}}}*/ 59 void GiaAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/59 void GiaAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/ 60 60 _error_("Not implemented yet"); 61 61 }/*}}}*/ 62 void GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/62 void GiaAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/ 63 63 _error_("not implemented yet"); 64 64 }/*}}}*/ 65 void GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/65 void GiaAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 66 66 /*Default, do nothing*/ 67 67 return; -
issm/trunk-jpl/src/c/analyses/GiaAnalysis.h
r18057 r18929 13 13 public: 14 14 /*Model processing*/ 15 int DofsPerNode(int** doflist,int domaintype,int approximation);16 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);17 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);18 void CreateNodes(Nodes* nodes,IoModel* iomodel);19 15 void CreateConstraints(Constraints* constraints,IoModel* iomodel); 20 16 void CreateLoads(Loads* loads, IoModel* iomodel); 17 void CreateNodes(Nodes* nodes,IoModel* iomodel); 18 int DofsPerNode(int** doflist,int domaintype,int approximation); 19 void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type); 20 void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum); 21 21 22 22 /*Finite element Analysis*/ … … 26 26 ElementMatrix* CreateKMatrix(Element* element); 27 27 ElementVector* CreatePVector(Element* element); 28 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);29 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);30 void InputUpdateFromSolution(IssmDouble* solution,Element* element);31 void UpdateConstraints(FemModel* femmodel);28 void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element); 29 void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index); 30 void InputUpdateFromSolution(IssmDouble* solution,Element* element); 31 void UpdateConstraints(FemModel* femmodel); 32 32 }; 33 33 #endif
Note:
See TracChangeset
for help on using the changeset viewer.