luchete80 / WeldForm

Weakly-Compressible Smoothed Particle Hydrodynamics Parallel Solver for Elasto Plastic and thermal coupled Solid Mechanics
GNU General Public License v3.0
9 stars 5 forks source link

Wrong normals in 2D contact #325

Closed luchete80 closed 1 year ago

luchete80 commented 1 year ago

image

Normals have Z component in plane problem:;

image

luchete80 commented 1 year ago

Element normals are ok:

Element Normal 3 [ 2.2832e-316 -12.27186e-316 ] Element Normal 3 [ 2.27541e-316 -12.2761e-316 ] Element Normal 3 [ 2.27965e-316 -12.27839e-316 ] Element Normal 3 [ 2.26526e-316 -12.26652e-316 ] Element Normal 3 [ 2.28741e-316 -12.28856e-316 ] Element Normal 3 [ 2.29085e-316 -12.29257e-316 ] Element Normal 3 [ 2.25901e-316 -12.26211e-316 ] Element Normal 3 [ 2.24651e-316 -12.24754e-316 ] Element Normal 3 [ 2.27484e-316 -12.27403e-316 ] Element Normal 3 [ 2.24422e-316 -12.24525e-316 ] Element Normal 3 [ 2.27713e-316 -12.28523e-316 ] Element Normal 3 [ 2.29544e-316 -12.29555e-316 ] Element Normal 3 [ 2.25832e-316 -12.25775e-316 ] Element Normal 3 [ 2.28615e-316 -12.28546e-316 ]

luchete80 commented 1 year ago

Error in centroid calculation:


void TriMesh::CalcCentroids(){

    for (int e=0;e<element.Size();e++)
        element[e]-> centroid = ( *node[element[e]->node[0]] + *node[element[e]->node[1]] + *node[element[e]->node[2]] ) / dimension; 

}

Corrected to this:

void TriMesh::CalcCentroids(){

    for (int e=0;e<element.Size();e++){
        element[e]-> centroid = 0.;
    for (int i=0;i<dimension;i++)
      element[e]-> centroid += *node[element[e]->node[i]];
    element[e]-> centroid/= dimension; 
    }
}