Changeset 14363


Ignore:
Timestamp:
02/21/13 14:51:31 (12 years ago)
Author:
seroussi
Message:

FIX: fixed initialization of GLlevelset

Location:
issm/trunk-jpl/src/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp

    r14360 r14363  
    11291129       
    11301130        /*Check that not all nodes are grounded or floating*/
    1131         if(gl[0]>0 && gl[1]>0 && gl[2]>0) _error_("Error. Three nodes of the element are grounded, should not compute the fraction of grounded element");
    1132         if(gl[0]<0 && gl[1]<0 && gl[2]<0) _error_("Error. Three nodes of the element are floating, should not compute the fraction of grounded element");
    1133 
    1134         /*Figure out if two nodes are floating or grounded*/
    1135         if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=true;
    1136 
    1137         if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
    1138                 /*Coordinates of point 2: same as initial point 2*/
    1139                 xyz_bis[2][0]=*(xyz_list+3*2+0);
    1140                 xyz_bis[2][1]=*(xyz_list+3*2+1);
    1141                 xyz_bis[2][2]=*(xyz_list+3*2+2);
    1142 
    1143                 /*Portion of the segments*/
    1144                 s1=gl[2]/(gl[2]-gl[1]);
    1145                 s2=gl[2]/(gl[2]-gl[0]);
    1146                
    1147                 /*New point 1*/
    1148                 xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
    1149                 xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
    1150                 xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
    1151 
    1152                 /*New point 0*/
    1153                 xyz_bis[0][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
    1154                 xyz_bis[0][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
    1155                 xyz_bis[0][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
    1156         }
    1157         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
    1158                 /*Coordinates of point 0: same as initial point 2*/
    1159                 xyz_bis[0][0]=*(xyz_list+3*0+0);
    1160                 xyz_bis[0][1]=*(xyz_list+3*0+1);
    1161                 xyz_bis[0][2]=*(xyz_list+3*0+2);
    1162 
    1163                 /*Portion of the segments*/
    1164                 s1=gl[0]/(gl[0]-gl[1]);
    1165                 s2=gl[0]/(gl[0]-gl[2]);
    1166                
    1167                 /*New point 1*/
    1168                 xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));
    1169                 xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));
    1170                 xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));
    1171 
    1172                 /*New point 2*/
    1173                 xyz_bis[2][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));
    1174                 xyz_bis[2][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));
    1175                 xyz_bis[2][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));
    1176         }
    1177         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
    1178                 /*Coordinates of point 1: same as initial point 2*/
    1179                 xyz_bis[1][0]=*(xyz_list+3*1+0);
    1180                 xyz_bis[1][1]=*(xyz_list+3*1+1);
    1181                 xyz_bis[1][2]=*(xyz_list+3*1+2);
    1182 
    1183                 /*Portion of the segments*/
    1184                 s1=gl[1]/(gl[1]-gl[0]);
    1185                 s2=gl[1]/(gl[1]-gl[2]);
    1186                
    1187                 /*New point 0*/
    1188                 xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));
    1189                 xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));
    1190                 xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));
    1191 
    1192                 /*New point 2*/
    1193                 xyz_bis[2][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));
    1194                 xyz_bis[2][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));
    1195                 xyz_bis[2][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));
    1196         }
    1197 
    1198         /*Compute fraction of grounded element*/
    1199         GetJacobianDeterminant2d(&area_init, xyz_list,gauss);
    1200         GetJacobianDeterminant2d(&area_grounded, &xyz_bis[0][0],gauss);
    1201         if(mainlyfloating==true) area_grounded=area_init-area_grounded;
    1202         phi=area_grounded/area_init;
     1131        if(gl[0]>0 && gl[1]>0 && gl[2]>0){
     1132                phi=1;
     1133        }
     1134        else if(gl[0]<0 && gl[1]<0 && gl[2]<0){
     1135                _error_("Error. Three nodes of the element are floating, should not compute the fraction of grounded element");
     1136        }
     1137        else{
     1138
     1139                /*Figure out if two nodes are floating or grounded*/
     1140                if(gl[0]*gl[1]*gl[2]>0) mainlyfloating=true;
     1141
     1142                if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
     1143                        /*Coordinates of point 2: same as initial point 2*/
     1144                        xyz_bis[2][0]=*(xyz_list+3*2+0);
     1145                        xyz_bis[2][1]=*(xyz_list+3*2+1);
     1146                        xyz_bis[2][2]=*(xyz_list+3*2+2);
     1147
     1148                        /*Portion of the segments*/
     1149                        s1=gl[2]/(gl[2]-gl[1]);
     1150                        s2=gl[2]/(gl[2]-gl[0]);
     1151
     1152                        /*New point 1*/
     1153                        xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
     1154                        xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
     1155                        xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
     1156
     1157                        /*New point 0*/
     1158                        xyz_bis[0][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
     1159                        xyz_bis[0][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
     1160                        xyz_bis[0][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
     1161                }
     1162                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
     1163                        /*Coordinates of point 0: same as initial point 2*/
     1164                        xyz_bis[0][0]=*(xyz_list+3*0+0);
     1165                        xyz_bis[0][1]=*(xyz_list+3*0+1);
     1166                        xyz_bis[0][2]=*(xyz_list+3*0+2);
     1167
     1168                        /*Portion of the segments*/
     1169                        s1=gl[0]/(gl[0]-gl[1]);
     1170                        s2=gl[0]/(gl[0]-gl[2]);
     1171
     1172                        /*New point 1*/
     1173                        xyz_bis[1][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*0+0));
     1174                        xyz_bis[1][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*0+1));
     1175                        xyz_bis[1][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*0+2));
     1176
     1177                        /*New point 2*/
     1178                        xyz_bis[2][0]=*(xyz_list+3*0+0)+s1*(*(xyz_list+3*2+0)-*(xyz_list+3*0+0));
     1179                        xyz_bis[2][1]=*(xyz_list+3*0+1)+s1*(*(xyz_list+3*2+1)-*(xyz_list+3*0+1));
     1180                        xyz_bis[2][2]=*(xyz_list+3*0+2)+s1*(*(xyz_list+3*2+2)-*(xyz_list+3*0+2));
     1181                }
     1182                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
     1183                        /*Coordinates of point 1: same as initial point 2*/
     1184                        xyz_bis[1][0]=*(xyz_list+3*1+0);
     1185                        xyz_bis[1][1]=*(xyz_list+3*1+1);
     1186                        xyz_bis[1][2]=*(xyz_list+3*1+2);
     1187
     1188                        /*Portion of the segments*/
     1189                        s1=gl[1]/(gl[1]-gl[0]);
     1190                        s2=gl[1]/(gl[1]-gl[2]);
     1191
     1192                        /*New point 0*/
     1193                        xyz_bis[0][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*0+0)-*(xyz_list+3*1+0));
     1194                        xyz_bis[0][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*0+1)-*(xyz_list+3*1+1));
     1195                        xyz_bis[0][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*0+2)-*(xyz_list+3*1+2));
     1196
     1197                        /*New point 2*/
     1198                        xyz_bis[2][0]=*(xyz_list+3*1+0)+s1*(*(xyz_list+3*2+0)-*(xyz_list+3*1+0));
     1199                        xyz_bis[2][1]=*(xyz_list+3*1+1)+s1*(*(xyz_list+3*2+1)-*(xyz_list+3*1+1));
     1200                        xyz_bis[2][2]=*(xyz_list+3*1+2)+s1*(*(xyz_list+3*2+2)-*(xyz_list+3*1+2));
     1201                }
     1202
     1203                /*Compute fraction of grounded element*/
     1204                GetJacobianDeterminant2d(&area_init, xyz_list,gauss);
     1205                GetJacobianDeterminant2d(&area_grounded, &xyz_bis[0][0],gauss);
     1206                if(mainlyfloating==true) area_grounded=area_init-area_grounded;
     1207                phi=area_grounded/area_init;
     1208        }
     1209
    12031210        if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
     1211
    12041212        return phi;
    12051213}
     
    19851993                                name==ThicknessEnum ||
    19861994                                name==SurfaceEnum ||
     1995                                name==BathymetryEnum ||
    19871996                                name==BedEnum ||
     1997                                name==GLlevelsetEnum ||
    19881998                                name==SurfaceSlopeXEnum ||
    19891999                                name==SurfaceSlopeYEnum ||
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp

    r14362 r14363  
    2929
    3030                /*get parameters and constants: */
    31                 parameters->FindParam(&rho_ice,MaterialsRhoIceEnum);
    32                 parameters->FindParam(&rho_water,MaterialsRhoWaterEnum);
     31                iomodel->Constant(&rho_ice,MaterialsRhoIceEnum);
     32                iomodel->Constant(&rho_water,MaterialsRhoWaterEnum);
    3333                iomodel->Constant(&numberofvertices,MeshNumberofverticesEnum);
    34                 iomodel->FetchData(2,ThicknessEnum,BathymetryEnum);
     34                iomodel->FetchData(3,MeshElementsEnum,ThicknessEnum,BathymetryEnum);
    3535
    3636                /*Create phi vector */
     
    4545                for(i=0;i<elements->Size();i++){
    4646                        Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    47                         element->InputUpdateFromVector(phi,GLlevelsetEnum,VertexEnum);
     47                        element->InputCreate(phi,i,iomodel,numberofvertices,1,1,GLlevelsetEnum,1);
    4848                }
    4949
    5050                /*Free ressources:*/
     51                iomodel->DeleteData(3,MeshElementsEnum,ThicknessEnum,BathymetryEnum);
    5152                xDelete<IssmDouble>(phi);
    5253        }
Note: See TracChangeset for help on using the changeset viewer.