source: issm/oecreview/Archive/15392-16133/ISSM-15813-15814.diff@ 16134

Last change on this file since 16134 was 16134, checked in by Mathieu Morlighem, 12 years ago

Added Archive/15392-16133

File size: 5.7 KB
  • TabularUnified ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    817817        bool               floating=true;
    818818        int                point;
    819819        const IssmPDouble  epsilon= 1.e-15;
    820         IssmDouble         gl[3];
     820        IssmDouble         gl[NUMVERTICES];
    821821        IssmDouble         f1,f2;
    822822
    823823        /*Recover parameters and values*/
    824824        GetInputListOnVertices(&gl[0],GLlevelsetEnum);
    825825
    826826        /*Be sure that values are not zero*/
    827         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    828         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    829         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     827        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     828        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     829        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    830830
    831831        /*Check that not all nodes are grounded or floating*/
    832832        if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
     
    868868IssmDouble Tria::GetGroundedPortion(IssmDouble* xyz_list){
    869869        /*Computeportion of the element that is grounded*/
    870870
    871         bool               mainlyfloating = true;
    872         const IssmPDouble  epsilon= 1.e-15;
     871        bool              mainlyfloating = true;
     872        const IssmPDouble epsilon        = 1.e-15;
    873873        IssmDouble         phi,s1,s2,area_init,area_grounded;
    874         IssmDouble         gl[3];
     874        IssmDouble         gl[NUMVERTICES];
    875875        IssmDouble         xyz_bis[3][3];
    876876
    877877        /*Recover parameters and values*/
    878878        GetInputListOnVertices(&gl[0],GLlevelsetEnum);
    879879
    880880        /*Be sure that values are not zero*/
    881         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    882         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    883         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     881        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     882        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     883        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    884884
    885885        /*Check that not all nodes are grounded or floating*/
    886886        if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
  • TabularUnified ../trunk-jpl/src/c/classes/Elements/Penta.cpp

     
    10231023        bool               mainlyfloating = true;
    10241024        const IssmPDouble  epsilon= 1.e-15;
    10251025        IssmDouble         phi,s1,s2,area_init,area_grounded;
    1026         IssmDouble         gl[3];
    1027         IssmDouble         xyz_bis[3][3];
     1026        IssmDouble         gl[NUMVERTICES];
     1027        IssmDouble         xyz_bis[NUMVERTICES2D][3];
    10281028
    10291029        /*Recover parameters and values*/
    10301030        GetInputListOnVertices(&gl[0],GLlevelsetEnum);
    10311031
    10321032        /*Be sure that values are not zero*/
    1033         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    1034         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    1035         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     1033        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     1034        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     1035        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    10361036
    10371037        /*Check that not all nodes are grounded or floating*/
    10381038        if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All grounded
     
    10471047
    10481048                if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
    10491049                        /*Coordinates of point 2: same as initial point 2*/
    1050                         xyz_bis[2][0]=*(xyz_list+3*2+0);
    1051                         xyz_bis[2][1]=*(xyz_list+3*2+1);
    1052                         xyz_bis[2][2]=*(xyz_list+3*2+2);
     1050                        xyz_bis[2][0]=xyz_list[3*2+0];
     1051                        xyz_bis[2][1]=xyz_list[3*2+1];
     1052                        xyz_bis[2][2]=xyz_list[3*2+2];
    10531053
    10541054                        /*Portion of the segments*/
    10551055                        s1=gl[2]/(gl[2]-gl[1]);
    10561056                        s2=gl[2]/(gl[2]-gl[0]);
    10571057
    10581058                        /*New point 1*/
    1059                         xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
    1060                         xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
    1061                         xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
     1059                        xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
     1060                        xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
     1061                        xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
    10621062
    10631063                        /*New point 0*/
    1064                         xyz_bis[0][0]=*(xyz_list+3*2+0)+s2*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
    1065                         xyz_bis[0][1]=*(xyz_list+3*2+1)+s2*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
    1066                         xyz_bis[0][2]=*(xyz_list+3*2+2)+s2*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
     1064                        xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
     1065                        xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
     1066                        xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
    10671067                }
    10681068                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
    10691069                        /*Coordinates of point 0: same as initial point 2*/
     
    11071107                }
    11081108
    11091109                /*Compute fraction of grounded element*/
    1110                 GetJacobianDeterminant(&area_init, xyz_list,NULL);
    1111                 GetJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
     1110                GetTriaJacobianDeterminant(&area_init, xyz_list,NULL);
     1111                GetTriaJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
    11121112                if(mainlyfloating==true) area_grounded=area_init-area_grounded;
    11131113                phi=area_grounded/area_init;
    11141114        }
    11151115
    1116         if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
     1116        if(phi>1. || phi<0.) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
    11171117
    11181118        return phi;
    11191119}
     
    76597659        int         i,j;
    76607660        int         analysis_type,migration_style;
    76617661        IssmDouble  xyz_list[NUMVERTICES][3];
    7662         IssmDouble  xyz_list_tria[NUMVERTICES2D][3]={0.};
     7662        IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
    76637663        IssmDouble  alpha2,Jdet;
    76647664        IssmDouble  phi=1.0;
    76657665        IssmDouble  DL_scalar;
     
    76927692        friction=new Friction("2d",inputs,matpar,analysis_type);
    76937693
    76947694        /*Recover portion of element that is grounded*/
    7695         if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list[0][0]);
     7695        if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list_tria[0][0]);
    76967696
    76977697        /* Start  looping on the number of gaussian points: */
    76987698        gauss=new GaussPenta(0,1,2,2);
Note: See TracBrowser for help on using the repository browser.