Changeset 25598


Ignore:
Timestamp:
09/27/20 20:53:38 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: simplifying Penta GL subelement grounded ratio calculation

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  
    13201320        bool               mainlyfloating = true;
    13211321        const IssmPDouble  epsilon= 1.e-15;
    1322         IssmDouble         phi,s1,s2,area_init,area_grounded;
     1322        IssmDouble         phi,s1,s2;
    13231323        IssmDouble         gl[NUMVERTICES];
    1324         IssmDouble         xyz_bis[NUMVERTICES2D][3];
    13251324
    13261325        /*Recover parameters and values*/
     
    13441343
    13451344                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*/
    13521345                        s1=gl[2]/(gl[2]-gl[1]);
    13531346                        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]);
    13641347                }
    13651348                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*/
    13721349                        s1=gl[0]/(gl[0]-gl[1]);
    13731350                        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));
    13841351                }
    13851352                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*/
    13921353                        s1=gl[1]/(gl[1]-gl[0]);
    13931354                        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));
    14041355                }
    14051356                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.);
    14161366        return phi;
    14171367}
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r25597 r25598  
    16721672        IssmDouble        phi,s1,s2;
    16731673        IssmDouble        gl[NUMVERTICES];
    1674         IssmDouble        xyz_bis[3][3];
    16751674
    16761675        /*Recover parameters and values*/
     
    17191718                                s2=gl[1]/(gl[1]-gl[2]);
    17201719                        }
    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");
    17221721                        if(mainlyfloating){
    17231722                                phi = (1-s1*s2);
Note: See TracChangeset for help on using the changeset viewer.