I have multiple 3D snapshots of a tractor trailer exported from CFD. I am doing some other data analysis on them and then I want to visualise contour of this processed data. For start, I am just trying to plot CFD data directly using x,y,z cordinate and velocity values.
The problem I am mainly having is:
a. Contour does not capture the geometry boundaries properly and shape looks distorted. My x,y,z,u,v, and w are column vector. when I make mesh grid of x.y at z=0, I use griddata command to reshape my velocity vector into same n by n vector as mesh grid is.
b. When I am trying to reshape my velocity vector on the meshgrid using GRIDDATA() command, it gives warning of duplicate data points have been detected and averaged. I think this is the problem area. However I tried to use unique() command and it has removed some duplicate points, I dont know how these duplicate points exist in the data. But I am still getting same duplicate data point warning when I use Griddata command.
I have attached some matlab pictures of my results and a picture of CFD result which I am expecting to see.Please find the link below of one snapshot of data if someone wants to give a try.
below is the code I am using. I use for loop as later I will be using multiple files.
clear all; clc; close all;
[~, I, ~] = unique([X Y Z],'first','rows');
U2 = scatteredInterpolant(X1, Y1, Z1, U1);
V2 = scatteredInterpolant(X1, Y1, Z1, V1);
W2 = scatteredInterpolant(X1, Y1, Z1, W1);
[xmesh, ymesh] = meshgrid(x1,y1,0:0);
To summarise, Any suggestion how to avoid duplicate data point warning while solving griddata command. Or any alternate to grid data?
secondly, if the problem is not with the grid data then any way of improving the quality of boundary captured and results. I noticed the velocity in the surrounding area is high but contour is showing small value.
I really appriciate any help as I am stuck here for long time.