简体   繁体   中英

How to analyze and visualize a 3D velocity field?

I am trying to use the best practice techniques in the Computational fluid dynamics area to analyze and visualize a velocity field .

Given 6 arrays of moving particles' positions and velocities: x,y,z and vx,vy,vz respectively.

I want to visualize and calculate the induced velocity field and its properties such as: curl , divergence , isosurfaces etc.

Here is a modest script of the volume visualization functions I was able to use without calling meshgrid (to avoid interpolation and more noise).

Ultimately, one of the things that I am not sure about is how to wisely create a mesh grid from my 50 points in space, the second is how to use CFD approaches to visualize the velocity field regardless the small amount of data points.

close all
rng default
t=0.1:0.1:10;
x = sin(t)'; 
y = cos(t)'; 
z = t.^0.2';
vx=y;vy=x;vz=z;

figure
subplot(2,3,1);
quiver3(x,y,z,vx,vy,vz);
hold on
streamribbon({ [x y z] }, {vx},{vy},{vz});

subplot(2,3,2);
[curl_val, cav] = curl([x,y,z],[vx,vy,vz]);  
surfc([x,y,z],cav);
subplot(2,3,3);
surfc([x,y,z],curl_val);

w = sqrt( vx.^2 + vy.^2 + vz.^2 );
subplot(2,3,4);
quiver3(x,y,z,vx,vy,vz);
streamtube({ [x y z] }, {w});

subplot(2,3,5);
quiver3(x,y,z,vx,vy,vz);

subplot(2,3,6);
surfc([x,y,z],[vx,vy,vz]);

在此处输入图片说明

When I run the above script (excluding the data generation) on a real data , I get the following plots which aren't very informative:

在此处输入图片说明

I strongly suspect that the problem here is with the data, not the visualization technique. But in general, the problem is one or more of the following:

1) You do not have enough data to capture the underlying dynamics (the dynamics in space operate at a higher spatial frequency than you sampled)

2) The data is too noisy for the number of datapoints your collected.

3) The flow is fundamentally turbulent, and hence hoping for a nice laminar-like plot is not going to happen.

When you have problems visualizing data, the first rule of thumb is always to throw away any visualization that attempts to approximate a derivative (or gradient) in any way. The reason is that when you try to approximate a derivative with real data, noise almost always makes that estimate nonsense. For example, let's suppose we have a cosine that gets corrupted by some noise, and we try to numerically estimate the derivative from the data

figure
% Create a signal 
dt  = .1;
t = 0:.1:10;
x = cos(t);

% Add some noise 
y = x + .5 * randn(size(x));

% Compute the first order approximation of the derivatives of the signals 
dx = diff(x)/dt;
dy = diff(y)/dt;

% Plot everything
subplot(2,1,1)
plot(t,x,t,y)
axis tight
subplot(2,1,2)
plot(t(2:end),dx,t(2:end),dy)
axis tight

在此处输入图片说明

In the first plot, which shows the raw data, the noise doesn't look to bad, but when we look at the derivative estimate! Ouch... The noise is really amplified. So forget about higher order properties of a flow, such as the curl and vorticity, which require gradients of the data.

So what can we do in cases like these? Well essentially, just look at the raw data. If there is a pattern, it will reveal itself. For instance, let's look at your raw velocity vectors from 3 different perspectives:

data = dlmread('data.csv','\s')
x = data(:,1);
y = data(:,2);
z = data(:,3);
vx = data(:,4);
vy = data(:,5);
vz = data(:,6);

close all
figure
subplot(1,3,1);
quiver3(x,y,z,vx,vy,vz);
view([1,0,0])
subplot(1,3,2);
quiver3(x,y,z,vx,vy,vz);
view([0,1,0])
subplot(1,3,3);
quiver3(x,y,z,vx,vy,vz);
view([0,0,1])

在此处输入图片说明

The only thing that looks even slightly structured is that last plot. However, that plot tells us that we probably also have turbulence (in addition to noise) to contend with.

Specifically, from view 3, it definitely seems like you are taking velocity measurements in a flow that is tightly hugging an object. In this case, your measurements are probably too tight though... and probably in the boundary layer. If that is the case (that the measurements are in the boundary layer), then you can get time-varying effects in the flow, meaning that it doesn't make sense to look at anything without also having a time component. The "nice" plots that you have in your answer are only really helpful when the flow is laminar, where we get to see these nice, consistent stream lines. If it is turbulent, then there is no discernable pattern in the flow, no matter how hard you look.

So in conclusion, I don't think you will be able to find a nice visualization for your data because either the sensors you used were too noisy, or the flow was too turbulent.

As an aside... consider what happens when we look at the raw velocity vectors from your "nice" dataset:

在此处输入图片说明

That, my friend, is a well-trained house pet. You have a wild mountain lion on your hands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM