Changeset 25598
- Timestamp:
- 09/27/20 20:53:38 (5 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r25576 r25598 1320 1320 bool mainlyfloating = true; 1321 1321 const IssmPDouble epsilon= 1.e-15; 1322 IssmDouble phi,s1,s2 ,area_init,area_grounded;1322 IssmDouble phi,s1,s2; 1323 1323 IssmDouble gl[NUMVERTICES]; 1324 IssmDouble xyz_bis[NUMVERTICES2D][3];1325 1324 1326 1325 /*Recover parameters and values*/ … … 1344 1343 1345 1344 if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2 1346 /*Coordinates of point 2: same as initial point 2*/1347 xyz_bis[2][0]=xyz_list[3*2+0];1348 xyz_bis[2][1]=xyz_list[3*2+1];1349 xyz_bis[2][2]=xyz_list[3*2+2];1350 1351 /*Portion of the segments*/1352 1345 s1=gl[2]/(gl[2]-gl[1]); 1353 1346 s2=gl[2]/(gl[2]-gl[0]); 1354 1355 /*New point 1*/1356 xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);1357 xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);1358 xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);1359 1360 /*New point 0*/1361 xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);1362 xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);1363 xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);1364 1347 } 1365 1348 else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2 1366 /*Coordinates of point 0: same as initial point 2*/1367 xyz_bis[0][0]=*(xyz_list+3*0+0);1368 xyz_bis[0][1]=*(xyz_list+3*0+1);1369 xyz_bis[0][2]=*(xyz_list+3*0+2);1370 1371 /*Portion of the segments*/1372 1349 s1=gl[0]/(gl[0]-gl[1]); 1373 1350 s2=gl[0]/(gl[0]-gl[2]); 1374 1375 /*New point 1*/1376 xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));1377 xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));1378 xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));1379 1380 /*New point 2*/1381 xyz_bis[2][0]=*(xyz_list+3*0+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));1382 xyz_bis[2][1]=*(xyz_list+3*0+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));1383 xyz_bis[2][2]=*(xyz_list+3*0+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));1384 1351 } 1385 1352 else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2 1386 /*Coordinates of point 1: same as initial point 2*/1387 xyz_bis[1][0]=*(xyz_list+3*1+0);1388 xyz_bis[1][1]=*(xyz_list+3*1+1);1389 xyz_bis[1][2]=*(xyz_list+3*1+2);1390 1391 /*Portion of the segments*/1392 1353 s1=gl[1]/(gl[1]-gl[0]); 1393 1354 s2=gl[1]/(gl[1]-gl[2]); 1394 1395 /*New point 0*/1396 xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));1397 xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));1398 xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));1399 1400 /*New point 2*/1401 xyz_bis[2][0]=*(xyz_list+3*1+0)+s2*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));1402 xyz_bis[2][1]=*(xyz_list+3*1+1)+s2*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));1403 xyz_bis[2][2]=*(xyz_list+3*1+2)+s2*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));1404 1355 } 1405 1356 else _error_("case not possible"); 1406 1407 /*Compute fraction of grounded element*/ 1408 GetTriaJacobianDeterminant(&area_init, xyz_list,NULL); 1409 GetTriaJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL); 1410 if(mainlyfloating==true) area_grounded=area_init-area_grounded; 1411 phi=area_grounded/area_init; 1412 } 1413 1414 if(phi>1. || phi<0.) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1"); 1415 1357 if(mainlyfloating){ 1358 phi = (1-s1*s2); 1359 } 1360 else{ 1361 phi = s1*s2; 1362 } 1363 } 1364 1365 _assert_(phi<=1. && phi>=0.); 1416 1366 return phi; 1417 1367 } -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r25597 r25598 1672 1672 IssmDouble phi,s1,s2; 1673 1673 IssmDouble gl[NUMVERTICES]; 1674 IssmDouble xyz_bis[3][3];1675 1674 1676 1675 /*Recover parameters and values*/ … … 1719 1718 s2=gl[1]/(gl[1]-gl[2]); 1720 1719 } 1721 else _error_(" Tria::GetGroundedPortion: levelset case not allowed for element #" << this->Sid()+1 << ":" << gl[0] << "|" << gl[1] << "|" << gl[2]);1720 else _error_("case not possible"); 1722 1721 if(mainlyfloating){ 1723 1722 phi = (1-s1*s2);
Note:
See TracChangeset
for help on using the changeset viewer.