Changeset 16774
- Timestamp:
- 11/14/13 21:14:19 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/analyses
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r16773 r16774 950 950 return; 951 951 case HOFSApproximationEnum: 952 _error_("not implemented yet"); 952 InputUpdateFromSolutionHOFS(solution,element); 953 return; 953 954 case SSAFSApproximationEnum: 954 955 _error_("not implemented yet"); … … 1006 1007 1007 1008 /*Transform solution in Cartesian Space*/ 1008 element->TransformSolutionCoord( &values[0],&cs_list[0]);1009 element->TransformSolutionCoord(values,cs_list); 1009 1010 1010 1011 /*Ok, we have vx and vy in values, fill in all arrays: */ … … 1127 1128 xDelete<IssmDouble>(xyz_list); 1128 1129 xDelete<int>(doflist); 1130 }/*}}}*/ 1131 void StressbalanceAnalysis::InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element){/*{{{*/ 1132 1133 int i; 1134 IssmDouble rho_ice,g,FSreconditioning; 1135 int* doflistHO = NULL; 1136 int* doflistFSv = NULL; 1137 int* doflistFSp = NULL; 1138 1139 /*Only works with Penta for now*/ 1140 if(element->ObjectEnum()!=PentaEnum) _error_("Coupling not supported for "<<EnumToStringx(element->ObjectEnum())); 1141 1142 /*Fetch number of nodes and dof for this finite element*/ 1143 int numnodes = 6; 1144 int numdofHO = 6*2; 1145 int numdofFSv = 6*3; 1146 int numdofFSp = 6; 1147 1148 /*Fetch dof list and allocate solution vectors*/ 1149 element->GetDofList(&doflistFSv,FSvelocityEnum,GsetEnum); 1150 element->GetDofList(&doflistHO, HOApproximationEnum, GsetEnum); 1151 element->GetDofListPressure(&doflistFSp,GsetEnum); 1152 IssmDouble* HOvalues = xNew<IssmDouble>(numdofHO); 1153 IssmDouble* FSvalues = xNew<IssmDouble>(numdofFSv+numdofFSp); 1154 IssmDouble* vx = xNew<IssmDouble>(numnodes); 1155 IssmDouble* vy = xNew<IssmDouble>(numnodes); 1156 IssmDouble* vz = xNew<IssmDouble>(numnodes); 1157 IssmDouble* vzHO = xNew<IssmDouble>(numnodes); 1158 IssmDouble* vzFS = xNew<IssmDouble>(numnodes); 1159 IssmDouble* vel = xNew<IssmDouble>(numnodes); 1160 IssmDouble* pressure = xNew<IssmDouble>(numnodes); 1161 1162 /*Prepare coordinate system list*/ 1163 int* cs_list = xNew<int>(2*numnodes); 1164 for(i=0;i<numnodes;i++) cs_list[i] = XYZEnum; 1165 for(i=0;i<numnodes;i++) cs_list[numnodes+i] = PressureEnum; 1166 1167 /*Use the dof list to index into the solution vector: */ 1168 element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum); 1169 for(i=0;i<numdofHO ;i++) HOvalues[i]=solution[doflistHO[i]]; 1170 for(i=0;i<numdofFSv;i++) FSvalues[i]=solution[doflistFSv[i]]; 1171 for(i=0;i<numdofFSp;i++) FSvalues[numdofFSv+i]=solution[doflistFSp[i]]; 1172 1173 /*Transform solution in Cartesian Space*/ 1174 element->TransformSolutionCoord(FSvalues,cs_list); 1175 element->TransformSolutionCoord(HOvalues,XYEnum); 1176 1177 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 1178 for(i=0;i<numnodes;i++){ 1179 vx[i] = FSvalues[i*3+0]+HOvalues[i*2+0]; 1180 vy[i] = FSvalues[i*3+1]+HOvalues[i*2+1]; 1181 vzFS[i] = FSvalues[i*3+2]; 1182 pressure[i] = FSvalues[numnodes*3+i]*FSreconditioning; 1183 1184 /*Check solution*/ 1185 if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector"); 1186 if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector"); 1187 if(xIsNan<IssmDouble>(vzFS[i])) _error_("NaN found in solution vector"); 1188 if(xIsNan<IssmDouble>(pressure[i])) _error_("NaN found in solution vector"); 1189 } 1190 1191 /*Get Vz and compute vel*/ 1192 element->GetInputListOnVertices(vzHO,VzHOEnum); 1193 for(i=0;i<numnodes;i++){ 1194 vz[i] = vzHO[i]+vzFS[i]; 1195 vel[i]= sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]); 1196 } 1197 1198 /*Now, we have to move the previous Vx and Vy inputs to old 1199 * status, otherwise, we'll wipe them off: */ 1200 element->InputChangeName(VxEnum,VxPicardEnum); 1201 element->InputChangeName(VyEnum,VyPicardEnum); 1202 element->InputChangeName(VzEnum,VzPicardEnum); 1203 element->InputChangeName(PressureEnum,PressurePicardEnum); 1204 1205 /*Add vx and vy as inputs to element: */ 1206 element->AddInput(VxEnum,vx,P1Enum); 1207 element->AddInput(VyEnum,vy,P1Enum); 1208 element->AddInput(VzEnum,vz,P1Enum); 1209 element->AddInput(VzFSEnum,vzFS,P1Enum); 1210 element->AddInput(VelEnum,vel,P1Enum); 1211 element->AddInput(PressureEnum,pressure,P1Enum); 1212 1213 /*Free ressources:*/ 1214 xDelete<IssmDouble>(pressure); 1215 xDelete<IssmDouble>(vel); 1216 xDelete<IssmDouble>(vz); 1217 xDelete<IssmDouble>(vzHO); 1218 xDelete<IssmDouble>(vzFS); 1219 xDelete<IssmDouble>(vy); 1220 xDelete<IssmDouble>(vx); 1221 xDelete<IssmDouble>(FSvalues); 1222 xDelete<IssmDouble>(HOvalues); 1223 xDelete<int>(doflistFSp); 1224 xDelete<int>(doflistFSv); 1225 xDelete<int>(doflistHO); 1226 xDelete<int>(cs_list); 1129 1227 }/*}}}*/ 1130 1228 void StressbalanceAnalysis::InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element){/*{{{*/ -
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h
r16773 r16774 24 24 void InputUpdateFromSolutionFS(IssmDouble* solution,Element* element); 25 25 void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element); 26 void InputUpdateFromSolutionHOFS(IssmDouble* solution,Element* element); 26 27 void InputUpdateFromSolutionL1L2(IssmDouble* solution,Element* element); 27 28 void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element);
Note:
See TracChangeset
for help on using the changeset viewer.