When I generate the mesh in my DEVICE simulation, how can I see how many elements or vertices there are in the generated mesh? Is there a log file?

# How can I see the total number of vertices and elements in my DEVICE mesh?

**aalam**#2

Hi @tecklee. When you run a simulation in DEVICE (or calculate the mesh), the solver does generate a log file. The name of the file will be “name_of_the_DEVICE_file_p0.log” and it is saved in the same folder as the .ldev file. You can open the log file in a text file editor (e.g. notepad) and it will contain information about the mesh (i.e. number of elements, vertices etc.).

**ajs11_eee138**#3

Dear aalam,

Thank you for your answers. I have a related question. Is there any way to get the number of elements or vertices using the script commands? I believe there is no direct command, however, is there any indirect way?

Thanks in advance.

**aalam**#4

Hi. Yes you can in fact get the number of elements and vertices in your simulation area/volume. You can get this from the spatial results. For example, when you calculate the mesh, you get a result named “grid” in the solver region. “grid” holds the doping profile and optical generation rate data if any. Besides these values, the dataset also holds the x,y,z coordinates of the vertices and the elements matrix that records how the elements are created by connecting the vertices. The dimension of the x,y,z matrices will be equal to Vx1 where V is the number of vertices. The dimension of the elements matrix will be Ex3 (or Ex4 in 3D) where E is the number of elements. So, you can use the following script commands to read these values,

`mesh('CHARGE'); grid = getresult('CHARGE','grid'); x = grid.x; elements = grid.elements; S_x = size(x); Nvertices = S_x(1); S_e = size(elements); Nelements = S_e(1);`