# Meshfree Code.

Hello,

i just started reading Meshfree and will love to see a matlab code for it,may be for a simple Poisson Eqn.

To serve as a guide.

Thank you

Free Tags:

### Meshfree codes

Hi,

You can find the code here !

Cheers,

Canh

Canh V. Le, PhD Student
Computational Mechanics and Design (CMD)
Department of Civil and Structural Engineering
The University of Sheffield
Mappin Street,
Sheffield, S1 3JD, UK.
Phone: GB +44 1142225724

### Thanks Canh

I really appreciate the response.The information was good.

### With the description of the

With the description of the code in the following paper:

Meshless methods: A review and computer implementation aspects

Good luck.

### Paper not accessible

Dear Vinh phu

i am unable to access this paper.Will be glad if you could help me out.

Thank you.

### Re: Meshfree codes

I would rather start from an introductory code and paper: see here .

### tip

One great tip:

I have such a code in matlab (but can't give it away).
You should build a sparse connectivity matrix at the beginning of every timestep.

That will allow you to vecorize your code very simply; i.e, avoiding double for loops and speeding it up significantly.

### I have FDM

i have solved the problem with Finite Difference Method already in 2D.even if i create the sparse connectivity matrix,it still looks like a Meshed problem.

i tried a not so sensible approach by using the FDm but turing the marker off.this will only show the nodes but i think it's far from a meshfree.since there's no

weight function running.Will appreciate it more if you can explain what you mean.

### On the sparse connectivity matrix in meshfree methods

I think he is talking about that in the same way as in finite elements, you can do a double loop to compute the meshfree basis functions (and therefore their derivatives). The first one over the elements and the second one over the Gauss points such that you cover all the Gauss points in the domain. In the double loop, you evaluate the meshfree basis functions (and their derivatives) at current Gauss point and you have to find the connectivity for that evaluation. Once you have the connectivity (usually called the neighbor list), you have to do the assembly of the stiffness matrix for the current Gauss point evaluation using the neighbor list. Finding the neighbor list might be the more expensive part of the meshfree process. To speed up the computation, you may use a kd-Tree algorithm to find the neighbor list.

Instead of computing the basis functions (and their derivatives) inside the double loop, you can construct a matrix at the beginning with the evaluation of the basis function derivatives at Gauss points of the entire domain (using the kd-tree algorithm to find the neighbors, i.e, the non-zero entries, will speed up this procedure). Rows being the basis function derivatives (let's think in 1d so we only have one derivative per basis function) and columns the Gauss points of the entire domain. This way there will be a lot of zero entries in the matrix (that is why I think he mentioned the sparse matrix). For example in the first row, there will be non-zero entries (the neighbor list) only where the basis function of the first row has non-vanishing values. If you construct such a matrix, then you can assembly the global stiffness matrix with tensor products of rows of the basis function derivative matrix, which is clearly faster than the double loop method. You can also construct a matrix for basis functions so that the global force vector can be assembled in a similar fashion (don't need to do the tensor product in this case, though).

### RE: On the sparse connectivity matrix in meshfree methods

I definitely agree with Alejandro and

I tried the approach of the sparse connectivity matrix for my own code and it is a lot faster than the "double loop" approach.

Moreover, it is particularly useful for non-linear problems (Lagrangian formulations, contacts or material nonlinearities) when a"re-assembly" is often needed at a Newton-Rhapson iteration (or even more re-assemblies, for the line-search method).ForEulerian formulations, though, this list has to be updated at every step.

Having already available the connectivity list, the assembly of the tangent stiffness matrix becomes quicker.

K-d trees are nice tools to construct rapidly the connectivity matrix, that come from computer graphics. Another example is the Moving Least Squares approximation. I wonder if there is anything else that we can learn from other disciplines that could help to solve our computational and programming problems! :) 