I have a fenics based python code. I created a bash script which generates random numbers with a gaussian distribution, and assigns them to my code as an input value for Youngs Modulus - 'E'. For eg. the mean of my 'E' is 100MPa, and the coefficient of variation is 40%. So if I generate 100 random numbers, my code will run for 100 different values of 'E', and store 100 different folders with vtk solutions in them. This is exactly like Monte Carlo method.
- I generated 100 samples for 'E' value and that gave me 100 vtk files.
- I converted these 100 vtk files to 100 csv (comma separated value) files.
- I imported all of these csv files in matlab.
Here is the link to some of these csv files:
https://github.com/ChaitanyaGoyal/CSV-files
You can observe that the first 3 columns contain the solution vectors in x,y, and z direction, while the last 3 columns contain the node coordinates. Column 3 and 6 are zero because this is a 2D simulation. Hence only 'x' and 'y' exist. The total no. of rows should be equal to the no. of nodes on the mesh. So I was interested in extracting column 1 and 2 for some further processing for each of the 100 outputs.
Now, the matlab script that I created for processing the solution vectors in 1st and 2nd column and was based on the assumption that the 4th and 5th columns of csv file which contain the x and y coordinate will remain in same order for all these csv files. That will enable me to compare solution vectors 'x' and 'y' (column 1 and 2), for all 100 samples in my script. I thought this was obvious because its the same mesh being used every time. However, I just observed that column 4 and 5 are not the same for different csv files. Not only are the node coordinates in column '4' and '5', in different order for different csv files, but even the total no. of coordinates (i.e, the no. of rows in csv) is different for some cases. This observation has messed up everything now. I needed consistent matrices with common '4th and 5th' columns, and with same no. of rows. How was I to expect that I will get different no. of rows (i.e. nodes) for running a problem 100 times on the exact same mesh, with a different parameter value.
Is there a way to fix this? Any suggestions will be highly appreciated.