- Timestamp:
- 11/22/13 16:15:01 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
r16864 r16899 138 138 /*Finite Element Analysis*/ 139 139 ElementMatrix* HydrologyDCInefficientAnalysis::CreateKMatrix(Element* element){/*{{{*/ 140 _error_("not implemented yet");141 }/*}}}*/142 ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/143 140 144 141 /*Intermediaries*/ … … 160 157 161 158 /*Intermediaries */ 159 IssmDouble D_scalar,Jdet,dt; 160 IssmDouble *xyz_list = NULL; 161 162 /*Fetch number of nodes and dof for this finite element*/ 163 int numnodes = basalelement->GetNumberOfNodes(); 164 165 /*Initialize Element vector*/ 166 ElementMatrix* Ke = basalelement->NewElementMatrix(); 167 IssmDouble* B = xNew<IssmDouble>(2*numnodes); 168 IssmDouble* basis = xNew<IssmDouble>(numnodes); 169 IssmDouble D[2][2]={0.}; 170 171 /*Retrieve all inputs and parameters*/ 172 basalelement->GetVerticesCoordinates(&xyz_list); 173 IssmDouble sediment_storing = SedimentStoring(basalelement); 174 IssmDouble sediment_transmitivity = basalelement->GetMaterialParameter(HydrologydcSedimentTransmitivityEnum); 175 basalelement->FindParam(&dt,TimesteppingTimeStepEnum); 176 177 /* Start looping on the number of gaussian points: */ 178 Gauss* gauss=basalelement->NewGauss(2); 179 for(int ig=gauss->begin();ig<gauss->end();ig++){ 180 gauss->GaussPoint(ig); 181 182 basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss); 183 184 /*Diffusivity*/ 185 D_scalar=sediment_transmitivity*gauss->weight*Jdet; 186 if(dt!=0.) D_scalar=D_scalar*dt; 187 D[0][0]=D_scalar; 188 D[1][1]=D_scalar; 189 GetB(B,element,xyz_list,gauss); 190 TripleMultiply(B,2,numnodes,1, 191 &D[0][0],2,2,0, 192 B,2,numnodes,0, 193 &Ke->values[0],1); 194 195 /*Transient*/ 196 if(dt!=0.){ 197 basalelement->NodalFunctions(&basis[0],gauss); 198 D_scalar=sediment_storing*gauss->weight*Jdet; 199 TripleMultiply(basis,numnodes,1,0, 200 &D_scalar,1,1,0, 201 basis,1,numnodes,0, 202 &Ke->values[0],1); 203 } 204 } 205 206 /*Clean up and return*/ 207 xDelete<IssmDouble>(xyz_list); 208 xDelete<IssmDouble>(B); 209 xDelete<IssmDouble>(basis); 210 delete gauss; 211 if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;}; 212 return Ke; 213 }/*}}}*/ 214 ElementVector* HydrologyDCInefficientAnalysis::CreatePVector(Element* element){/*{{{*/ 215 216 /*Intermediaries*/ 217 int meshtype; 218 Element* basalelement; 219 220 /*Get basal element*/ 221 element->FindParam(&meshtype,MeshTypeEnum); 222 switch(meshtype){ 223 case Mesh2DhorizontalEnum: 224 basalelement = element; 225 break; 226 case Mesh3DEnum: 227 if(!element->IsOnBed()) return NULL; 228 basalelement = element->SpawnBasalElement(); 229 break; 230 default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet"); 231 } 232 233 /*Intermediaries */ 162 234 IssmDouble dt,scalar,water_head; 163 235 IssmDouble water_load,transfer; … … 210 282 if(meshtype!=Mesh2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;}; 211 283 return pe; 284 }/*}}}*/ 285 void HydrologyDCInefficientAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/ 286 /*Compute B matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2. 287 * For node i, Bi can be expressed in the actual coordinate system 288 * by: 289 * Bi=[ dN/dx ] 290 * [ dN/dy ] 291 * where N is the finiteelement function for node i. 292 * 293 * We assume B has been allocated already, of size: 3x(NDOF2*numnodes) 294 */ 295 296 /*Fetch number of nodes for this finite element*/ 297 int numnodes = element->GetNumberOfNodes(); 298 299 /*Get nodal functions derivatives*/ 300 IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes); 301 element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss); 302 303 /*Build B: */ 304 for(int i=0;i<numnodes;i++){ 305 B[numnodes*0+i] = dbasis[0*numnodes+i]; 306 B[numnodes*1+i] = dbasis[1*numnodes+i]; 307 } 308 309 /*Clean-up*/ 310 xDelete<IssmDouble>(dbasis); 212 311 }/*}}}*/ 213 312 void HydrologyDCInefficientAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
Note:
See TracChangeset
for help on using the changeset viewer.