Changeset 18056
- Timestamp:
- 05/25/14 17:19:28 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r18003 r18056 3176 3176 3177 3177 /*Intermediaries*/ 3178 int vertexpidlist[NUMVERTICES]; 3179 IssmDouble lambda[NUMVERTICES]; 3180 IssmDouble gradient_g[NUMVERTICES]; 3181 3182 /*Compute Gradient*/ 3178 IssmDouble lambda,potential,weight,Jdet; 3179 IssmDouble grade_g[NUMVERTICES]; 3180 IssmDouble basis[NUMVERTICES]; 3181 IssmDouble xyz_list[NUMVERTICES][3]; 3182 int vertexpidlist[NUMVERTICES]; 3183 3184 /*Recover inputs*/ 3185 Input* lambda_input = inputs->GetInput(AdjointEnum); _assert_(lambda_input); 3186 Input* weights_input = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 3187 3188 /* Get node coordinates and dof list: */ 3189 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 3183 3190 GradientIndexing(&vertexpidlist[0],control_index); 3184 GetInputListOnVertices(&lambda[0],AdjointEnum); 3185 for(int i=0;i<NUMVERTICES;i++) gradient_g[i]=lambda[i]; 3186 3187 gradient->SetValues(NUMVERTICES,vertexpidlist,gradient_g,INS_VAL); 3191 3192 /* Start looping on the number of gaussian points: */ 3193 Gauss* gauss=new GaussTria(2); 3194 for(int ig=gauss->begin();ig<gauss->end();ig++){ 3195 3196 gauss->GaussPoint(ig); 3197 3198 GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss); 3199 GetNodalFunctions(&basis[0],gauss); 3200 weights_input->GetInputValue(&weight,gauss,Balancethickness2MisfitEnum); 3201 lambda_input->GetInputValue(&lambda,gauss); 3202 3203 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ 3204 for(int i=0;i<NUMVERTICES;i++){ 3205 grade_g[i]+= - weight*Jdet*gauss->weight*basis[i]*lambda; 3206 } 3207 } 3208 gradient->SetValues(NUMVERTICES,vertexpidlist,grade_g,ADD_VAL); 3209 3210 /*Clean up and return*/ 3211 delete gauss; 3188 3212 } 3189 3213 /*}}}*/ -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r18035 r18056 1208 1208 IssmDouble J_sum; 1209 1209 1210 IssmDouble weight,thicknessobs,thickness ;1210 IssmDouble weight,thicknessobs,thickness,potential; 1211 1211 IssmDouble Jdet; 1212 1212 IssmDouble* xyz_list = NULL; … … 1224 1224 Input* thickness_input =element->GetInput(ThicknessEnum); _assert_(thickness_input); 1225 1225 Input* thicknessobs_input=element->GetInput(InversionThicknessObsEnum); _assert_(thicknessobs_input); 1226 Input* potential_input =element->GetInput(PotentialEnum); _assert_(potential_input); 1226 1227 1227 1228 /* Start looping on the number of gaussian points: */ … … 1238 1239 thickness_input->GetInputValue(&thickness,gauss); 1239 1240 thicknessobs_input->GetInputValue(&thicknessobs,gauss); 1241 potential_input->GetInputValue(&potential,gauss); 1240 1242 gauss->GaussPoint(ig); 1241 1243 1242 J +=0.5*(thickness*thickness - thicknessobs*thicknessobs)*(thickness*thickness - thicknessobs*thicknessobs)*weight*Jdet*gauss->weight; 1244 //J +=0.5*(thickness*thickness - thicknessobs*thicknessobs)*(thickness*thickness - thicknessobs*thicknessobs)*weight*Jdet*gauss->weight; 1245 J +=.5*potential*potential*weight*Jdet*gauss->weight; 1243 1246 } 1244 1247
Note:
See TracChangeset
for help on using the changeset viewer.