Debian Codegraph @

packages/rol/example/PDE-OPT/dynamic/navier-stokes/vorticity.m

raw
1 function Cz = vorticity(nodes, Ux, Uy)
2 [nx,nt] = size(Ux);
3
4 x = linspace(-30,30,500).';
5 y = linspace(-15,15,250).';
6 [X,Y] = meshgrid(x,y);
7 Cz = zeros(nx,nt);
8 for i=1:nt
9 Fx = scatteredInterpolant(nodes(:,1), nodes(:,2), Ux(:,i), 'natural');
10 Fy = scatteredInterpolant(nodes(:,1), nodes(:,2), Uy(:,i), 'natural');
11 Vx = Fx(X,Y);
12 Vy = Fy(X,Y);
13 [tmp,~] = curl(X, Y, Vx, Vy);
14 Cz(:,i) = interp2(X, Y, tmp, nodes(:,1), nodes(:,2));
15 end