Problem with Proper Orthogonal Decomposition of CFD data

4 views (last 30 days)
Hi,
I am trying to apply POD (Proper Orthogonal Decomposition) using data from a Detached Eddy Simulation. I have the following pressure data at a point in the fluid domain:
when I run the following code that I have written I get a similar signal for the first mode but its values are too big when compared with original signal.
close; clear; clc; tic
X = load('X.dat');
P = [1 5 10 25 50 75 100 150 200];
F = 1;
f = 1107;
XMean = mean(X,2);
[M,N] = size(X);
XTilda = zeros(M,N);
for i = 1:N
XTilda(:,i) = X(:,i)-XMean;
end
C = XTilda'*XTilda;
[U,S,V] = svd(C);
phi = XTilda*V;
A = C*V;
XHat = cell(length(P),1);
Q = zeros(length(P),2);
Q(:,1) = P;
n = 0;
for p = P
n = n+1;
XHat{n} = zeros(M,N);
for i = 1:N
sigma = 0;
for k = 1:P(n)
sigma = sigma+A(i,k)*phi(:,k);
end
XHat{n}(:,i) = XMean+sigma;
end
Q(n,2) = 100*(sum(sum(S(:,1:P(n))))/sum(sum(S)));
end
if isempty(F) == 0
F1 = figure(1);
set(F1,'numbertitle','off')
subplot(2,1,1)
hold on
plot(X(f,:),'.-k')
n = 0;
for p = F
n = n+1;
plot(XHat{n}(f,:),'.-')
end
ylabel('X')
hold off
subplot(2,1,2)
plot(Q(:,1),Q(:,2),'.-')
xlabel('P')
ylabel('Q')
end
toc
I tried to find where I made a mistake and so far, I think I did good until the creation of the A matrix, and my Q graph shows the right trend for a POD analysis.
I'm thinking maybe I'm doing a mistake in the final loop.
I would appreciate any kind of help, thanks in advance.
Reference paper for the calculations: paper
Osman Mirza Demircan
  3 Comments
Osman Mirza Demircan
Osman Mirza Demircan on 29 Dec 2017
The pressure data are in pascals, I didn't check any units but I sticked to the procedure described in the reference paper that I shared at the end of the post.
Thibault Clar
Thibault Clar on 25 Jun 2018
Hi Osman, I am solving a similar problem, just wondering if you found out where your error was in the end?

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!