Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten mesh to single Object due to access errors #120

Open
luchete80 opened this issue Nov 27, 2024 · 4 comments
Open

Flatten mesh to single Object due to access errors #120

luchete80 opened this issue Nov 27, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@luchete80
Copy link
Owner

luchete80 commented Nov 27, 2024

There are not neighbors

@luchete80 luchete80 added the bug Something isn't working label Nov 27, 2024
@luchete80
Copy link
Owner Author

All IDs are zero

@luchete80
Copy link
Owner Author

Problem iis in CalculateSurface

@luchete80 luchete80 changed the title Contact not working for several cont surfaces. Flatten mesh to single ONE Nov 27, 2024
luchete80 added a commit that referenced this issue Nov 27, 2024
@luchete80
Copy link
Owner Author

luchete80 commented Nov 28, 2024

  • It will be ommited SetMeshVelKernel (which sets Mesh_d::m_v)

  • now will be used node_v (which sets the above function)

  • For setting node_v will be used SetNodesVelKernel<<>> which calls to

global inline void SetNodesVelKernel(TriMesh_d mesh_d,const double3 &v){
//int i = threadIdx.x + blockDim.x
blockIdx.x;
for (int i=0;mesh_d->nodecount;i++)
//if (i<mesh_d->nodecount)
mesh_d->node_v[i] = v;
}

         cudaDeviceSynchronize();  
            cout << "Mesh ID " << id << ", "<< "Velocity set to : "
                                        <<dom_d->bConds[bc].value.x 
                                        <<", " <<dom_d->bConds[bc].value.y 
                                        <<", " << dom_d->bConds[bc].value.z<<endl;

AND Mesh::Move is changed by ommitting node_v calculation from m_v
'''

inline device void TriMesh_d::Move(double dt){
//printf("node count %d\n", nodecount);
int n = threadIdx.x + blockDim.x*blockIdx.x; //Parallelize by node
if ( n < nodecount ){

double3 vr 	= cross(m_w, node[n]);
//// FOR THE NEW FLATTENED MESH IS NT ANYMORE AN SCALAR M_V
///node_v[n] = m_v + vr; //MUST BE DELETED, SET PREVIOUSLY

//printf("NODE V: %f %f %f \n",node_v[n].x, node_v[n].y, node_v[n].z);

'''

@luchete80 luchete80 changed the title Flatten mesh to single ONE Flatten mesh to single Object due to access errors Nov 28, 2024
@luchete80
Copy link
Owner Author

Inside Solver are Functions:

MeshUpdateKernel (which calls Move() )

UpdateContactParticlesKernel() which calls mesh_id

//TODO: CHANGE TO SEVERAL CONTACT SURFACES 
inline void __device__ Domain_d::UpdateContactParticles(int mesh_id){
  
  int e = threadIdx.x + blockDim.x*blockIdx.x;	
  //printf("elemn %d\n", e);
  
  if (e < trimesh[mesh_id]->elemcount) {
    //printf("UPDATING e %d\n",e);
    //int e = element[i];
    double3 vv = make_double3(0.);
    for (int en = 0; en<3; en++){
      //printf("particle %d \n",i);
      //printf ("node %d \n",trimesh->elnode[3*e+en]);
      // if (trimesh->elnode[3*e+en] < trimesh->nodecount )
      vv += trimesh[mesh_id] -> node_v[trimesh[mesh_id]->elnode[3*e+en]];
      // else 
        // printf("error \n");
    }
    

    v [first_fem_particle_idx[mesh_id] + e] = vv/3.;
    a [first_fem_particle_idx[mesh_id] + e] = make_double3(0.);
    //printf(" particle %d , v %f %f %f \n", e, vv.x, vv.y, vv.z);
    // if (length(normal[e])<1.0e-3)
      // printf("UPDATING ERROR ZERO mesh normal, %f %f %f\n", trimesh -> normal[e].x , trimesh -> normal[e].y, trimesh -> normal[e].z);
    normal[first_fem_particle_idx[mesh_id] + e] = trimesh[mesh_id] -> normal[e];
    //printf("mesh normal, %f %f %f\n", trimesh -> normal[e].x , trimesh -> normal[e].y, trimesh -> normal[e].z);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant