# Validating MATLAB Code Analytically

## Creating struct field

Also PFA all the files I used for analytical validation.

Step1 - I used a uniform and doublet flow fields to create a source-sink pair to generate the velocity matrix and saved everything in a structured form. Similarly, imm and image (edge) matrices were generated by taking a rectangle in the flow field. After running the usual steps I had used for flame images, all the matrices were generated (normals, curvature, strain rate, etc.).

Step2 - The analytical values for the tangential strain rate were taken to be $$\frac{du}{dx}$$ and $$\frac{dv}{dy}$$ along the horizontal and vertical line respectively.

When plotting the strain rate matrix obtained in step 1, I get two rectangles - outer and inner ones. I don't know why it is happening. While running the code for flame edges, it never happened. I will look into the reason. Anyway, I took both the outer and inner rectangles for comparison.

For comparing the values, I excluded the corner values because it will generally be erratic because of differences in du/dx and dv/dy values in those cells. Then I calculated the absolute differences between the corresponding cells and averaged them to find the average percentage error which comes out to be 2.75% and 4.24% for outer and inner rectangle respectively.

All the matrices are there in the vmatrix.xlsx excel sheet. Everything has been color-coded in the final 'Difference' tab whose meanings have been explained at the bottom like this -

## Color Coding Explanation

Background color Meaning Outer line Inner line ratio of difference to analytical value Absolute values of the above ratio Max and min values of difference Average difference Separator for row and column values Excluded values (corner ones) are marked in red text color

The average difference of ~2-3% shows that our code gives almost correct values.