Changeset 16762
- Timestamp:
- 11/14/13 12:15:52 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp ¶
r16756 r16762 947 947 return; 948 948 case L1L2ApproximationEnum: 949 InputUpdateFromSolution HO(solution,element);949 InputUpdateFromSolutionSSA(solution,element); 950 950 return; 951 case SSAHOApproximationEnum: case HOFSApproximationEnum: case SSAFSApproximationEnum: 952 /*the elements around will create the solution*/ 951 case SSAHOApproximationEnum: 952 InputUpdateFromSolutionSSAHO(solution,element); 953 return; 954 case HOFSApproximationEnum: 955 _error_("not implemented yet"); 956 case SSAFSApproximationEnum: 957 _error_("not implemented yet"); 953 958 return; 954 959 default: … … 975 980 switch(meshtype){ 976 981 case Mesh2DhorizontalEnum: 977 element->GetInputListOn Nodes(thickness,ThicknessEnum);982 element->GetInputListOnVertices(thickness,ThicknessEnum); 978 983 for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*thickness[i]; 979 984 break; 980 985 case Mesh3DEnum: 981 986 element->GetVerticesCoordinates(&xyz_list); 982 element->GetInputListOn Nodes(surface,SurfaceEnum);987 element->GetInputListOnVertices(surface,SurfaceEnum); 983 988 for(i=0;i<numvertices;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]); 984 989 break; … … 996 1001 break; 997 1002 case Mesh3DEnum: 998 if(!element->IsOnBed()) return;1003 if(!element->IsOnBed()){xDelete<IssmDouble>(xyz_list); return;} 999 1004 basalelement=element->SpawnBasalElement(); 1000 1005 break; … … 1225 1230 xDelete<int>(cs_list); 1226 1231 }/*}}}*/ 1232 void StressbalanceAnalysis::InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element){/*{{{*/ 1233 1234 int i,meshtype; 1235 IssmDouble rho_ice,g; 1236 int* SSAdoflist = NULL; 1237 int* HOdoflist = NULL; 1238 IssmDouble* xyz_list = NULL; 1239 1240 /*we have to add results of this element for HO and results from the element 1241 * at base for SSA, so we need to have the pointer toward the basal element*/ 1242 Element* basalelement=element->GetBasalElement(); 1243 if(basalelement->ObjectEnum()!=PentaEnum){ 1244 _error_("Coupling not supported for "<<EnumToStringx(basalelement->ObjectEnum())); 1245 } 1246 1247 /*Fetch number of nodes and dof for this finite element*/ 1248 int numnodes = element->GetNumberOfNodes(); 1249 int numdof = numnodes*2; 1250 int numdof2d = numnodes;/*FIXME: only works for Penta*/ 1251 1252 /*Fetch dof list and allocate solution vectors*/ 1253 basalelement->GetDofList(&SSAdoflist,SSAApproximationEnum,GsetEnum); 1254 element->GetDofList( &HOdoflist, HOApproximationEnum, GsetEnum); 1255 IssmDouble* HOvalues = xNew<IssmDouble>(numdof); 1256 IssmDouble* SSAvalues = xNew<IssmDouble>(numdof); 1257 IssmDouble* vx = xNew<IssmDouble>(numnodes); 1258 IssmDouble* vy = xNew<IssmDouble>(numnodes); 1259 IssmDouble* vz = xNew<IssmDouble>(numnodes); 1260 IssmDouble* vel = xNew<IssmDouble>(numnodes); 1261 IssmDouble* pressure = xNew<IssmDouble>(numnodes); 1262 IssmDouble* surface = xNew<IssmDouble>(numnodes); 1263 1264 /*Use the dof list to index into the solution vector: */ 1265 for(i=0;i<numdof2d;i++){ 1266 HOvalues[i] = solution[HOdoflist[i]]; 1267 SSAvalues[i] = solution[SSAdoflist[i]]; 1268 } 1269 for(i=numdof2d;i<numdof;i++){ 1270 HOvalues[i] = solution[HOdoflist[i]]; 1271 SSAvalues[i] = SSAvalues[i-numdof2d]; 1272 } 1273 1274 /*Transform solution in Cartesian Space*/ 1275 basalelement->TransformSolutionCoord(SSAvalues,XYEnum); 1276 element->TransformSolutionCoord(HOvalues,XYEnum); 1277 1278 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ 1279 for(i=0;i<numnodes;i++){ 1280 vx[i]=SSAvalues[i*2+0]+HOvalues[i*2+0]; 1281 vy[i]=SSAvalues[i*2+1]+HOvalues[i*2+1]; 1282 1283 /*Check solution*/ 1284 if(xIsNan<IssmDouble>(vx[i])) _error_("NaN found in solution vector"); 1285 if(xIsNan<IssmDouble>(vy[i])) _error_("NaN found in solution vector"); 1286 } 1287 1288 /*Get Vz and compute vel*/ 1289 element->GetInputListOnNodes(&vz[0],VzEnum,0.); 1290 for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]); 1291 1292 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 1293 *so the pressure is just the pressure at the bedrock: */ 1294 rho_ice = element->GetMaterialParameter(MaterialsRhoIceEnum); 1295 g = element->GetMaterialParameter(ConstantsGEnum); 1296 element->GetVerticesCoordinates(&xyz_list); 1297 element->GetInputListOnNodes(&surface[0],SurfaceEnum); 1298 for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*(surface[i]-xyz_list[i*3+2]); 1299 1300 /*Now, we have to move the previous Vx and Vy inputs to old 1301 * status, otherwise, we'll wipe them off: */ 1302 element->InputChangeName(VxEnum,VxPicardEnum); 1303 element->InputChangeName(VyEnum,VyPicardEnum); 1304 element->InputChangeName(PressureEnum,PressurePicardEnum); 1305 1306 /*Add vx and vy as inputs to the tria element: */ 1307 element->AddInput(VxEnum,vx,P1Enum); 1308 element->AddInput(VyEnum,vy,P1Enum); 1309 element->AddBasalInput(VelEnum,vel,P1Enum); 1310 element->AddBasalInput(PressureEnum,pressure,P1Enum); 1311 1312 /*Free ressources:*/ 1313 xDelete<IssmDouble>(surface); 1314 xDelete<IssmDouble>(pressure); 1315 xDelete<IssmDouble>(vel); 1316 xDelete<IssmDouble>(vz); 1317 xDelete<IssmDouble>(vy); 1318 xDelete<IssmDouble>(vx); 1319 xDelete<IssmDouble>(xyz_list); 1320 xDelete<IssmDouble>(SSAvalues); 1321 xDelete<IssmDouble>(HOvalues); 1322 xDelete<int>(SSAdoflist); 1323 xDelete<int>(HOdoflist); 1324 }/*}}}*/ -
TabularUnified issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.h ¶
r16727 r16762 25 25 void InputUpdateFromSolutionHO(IssmDouble* solution,Element* element); 26 26 void InputUpdateFromSolutionSSA(IssmDouble* solution,Element* element); 27 void InputUpdateFromSolutionSSAHO(IssmDouble* solution,Element* element); 27 28 }; 28 29 #endif -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.h ¶
r16761 r16762 53 53 virtual void TransformSolutionCoord(IssmDouble* values,int transformenum)=0; 54 54 virtual void TransformSolutionCoord(IssmDouble* values,int* transformenum_list)=0; 55 virtual Element* GetBasalElement(void)=0; 55 56 virtual void GetDofList(int** pdoflist,int approximation_enum,int setenum)=0; 56 57 virtual void GetDofListVelocity(int** pdoflist,int setenum)=0; -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.cpp ¶
r16754 r16762 1029 1029 /*}}}*/ 1030 1030 /*FUNCTION Penta::GetBasalElement{{{*/ 1031 Penta* Penta::GetBasalElement(void){1031 Element* Penta::GetBasalElement(void){ 1032 1032 1033 1033 /*Output*/ … … 5215 5215 5216 5216 /*get basal element, needed for basal watercolumn*/ 5217 pentabase= this->GetBasalElement();5217 pentabase=(Penta*)this->GetBasalElement(); 5218 5218 5219 5219 this->GetInputListOnVertices(&enthalpy[0],EnthalpyEnum); … … 6988 6988 6989 6989 /*Find penta on bed as HO must be coupled to the dofs on the bed: */ 6990 Penta* pentabase= GetBasalElement();6990 Penta* pentabase=(Penta*)GetBasalElement(); 6991 6991 Tria* tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1. 6992 6992 … … 7183 7183 7184 7184 /*Find penta on bed as FS must be coupled to the dofs on the bed: */ 7185 Penta* pentabase= GetBasalElement();7185 Penta* pentabase=(Penta*)GetBasalElement(); 7186 7186 Tria* tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1. 7187 7187 … … 7618 7618 7619 7619 /*Find penta on bed as this is a SSA elements: */ 7620 pentabase= GetBasalElement();7620 pentabase=(Penta*)GetBasalElement(); 7621 7621 tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1. 7622 7622 … … 7770 7770 7771 7771 /*Find penta on bed as this is a SSA elements: */ 7772 pentabase= GetBasalElement();7772 pentabase=(Penta*)GetBasalElement(); 7773 7773 tria=pentabase->SpawnTria(0); //lower face is 0, upper face is 1. 7774 7774 … … 9982 9982 /*OK, we have to add results of this element for HO 9983 9983 * and results from the penta at base for SSA. Now recover results*/ 9984 penta= GetBasalElement();9984 penta=(Penta*)GetBasalElement(); 9985 9985 9986 9986 /*Get dof listof this element (HO dofs) and of the penta at base (SSA dofs): */ … … 10075 10075 /*OK, we have to add results of this element for SSA 10076 10076 * and results from the penta at base for SSA. Now recover results*/ 10077 penta= GetBasalElement();10077 penta=(Penta*)GetBasalElement(); 10078 10078 10079 10079 /*Get dof listof this element (SSA dofs) and of the penta at base (SSA dofs): */ -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.h ¶
r16761 r16762 85 85 void Delta18oParameterization(void); 86 86 void EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure); 87 Element* GetBasalElement(void); 87 88 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 88 89 void GetDofListVelocity(int** pdoflist,int setenum); … … 228 229 void GetZeroLevelsetCoordinates(IssmDouble* xyz_zero,IssmDouble xyz_list[6][3],int levelsetenum); 229 230 Penta* GetLowerElement(void); 230 Penta* GetBasalElement(void);231 231 void InputChangeName(int input_enum, int enum_type_old); 232 232 void InputExtrude(int enum_type,int object_type); -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Seg.h ¶
r16761 r16762 87 87 void FindParam(IssmDouble* pvalue,int paramenum); 88 88 int FiniteElement(void); 89 Element* GetBasalElement(void){_error_("not implemented yet");}; 89 90 void GetDofList(int** pdoflist,int approximation_enum,int setenum){_error_("not implemented yet");}; 90 91 void GetDofListVelocity(int** pdoflist,int setenum){_error_("not implemented yet");}; -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.h ¶
r16761 r16762 83 83 void FindParam(IssmDouble* pvalue,int paramenum); 84 84 int FiniteElement(void); 85 Element* GetBasalElement(void){_error_("not implemented yet");}; 85 86 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 86 87 void GetDofListVelocity(int** pdoflist,int setenum);
Note:
See TracChangeset
for help on using the changeset viewer.