Created
September 12, 2019 13:16
-
-
Save precise-simulation/82bb9eab939834a45d0a042d1006cde7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Prostprocessing MATLAB m-file script for the fluid_structure1 tutorial model. | |
% | |
% Used to create the visualization: https://youtu.be/UwANmWvC9YM | |
close all | |
miu = 1; | |
i_int = [5:8,11:13]; % Integration boundaries. | |
i_cub = 10; | |
s_tfx = ['nx*p+',num2str(miu),'*(-2*nx*ux-ny*(uy+vx))']; | |
s_tfy = ['ny*p+',num2str(miu),'*(-nx*(vx+uy)-2*ny*vy)']; | |
p_A = [0.6;0.2]; | |
[~,i_A] = min(sum((fea.grid.p'-repmat(p_A',size(fea.grid.p,2),1)).^2,2)); | |
fea.grid.p(:,i_A) = p_A; | |
f = figure(); | |
set( f, 'Position', [ 0 0 1200, 675 ], 'MenuBar', 'none', 'ToolBar', 'none', 'PaperSize', [16,9] ); | |
n = size(fea.sol.u,2); | |
for i=1:n | |
i | |
clf | |
subplot(2,3,1:3) | |
postplot( fea, 'surfexpr','p', 'isoexpr', 'p', 'colorbar', 'off', 'solnum', i, 'axis', 'off', 'bbox', 0 ) | |
pos = get( gca, 'Position' ); | |
pos(2) = pos(2)*0.9; | |
set( gca, 'Position', pos ); | |
text( 2.2, 0.5, sprintf('t = %.2f s',fea.sol.t(i)), 'fontsize', 16 ) | |
text( -0.1, 0.6, 'www.featool.com', 'fontsize', 24 ) | |
% Calculate benchmark quantities (line integration method). | |
p_Ai = fea.sol.grid.p(:,i_A,i); | |
ux_A(i) = evalexpr( 'dx', p_Ai, fea, i ); | |
uy_A(i) = evalexpr( 'dy', p_Ai, fea, i ); | |
F_d(i) = intbdr( s_tfx, fea, i_int, i_cub, i, 1 ); | |
F_l(i) = intbdr( s_tfy, fea, i_int, i_cub, i, 1 ); | |
subplot(2,3,4) | |
plot( fea.sol.t(1:i), uy_A(1:i), 'r-', 'linewidth', 2 ) | |
ylabel('y-displacement') | |
grid on | |
subplot(2,3,5) | |
plot( fea.sol.t(1:i), F_l(1:i), 'g-', 'linewidth', 2 ) | |
ylabel('lift force') | |
grid on | |
subplot(2,3,6) | |
plot( fea.sol.t(1:i), F_d(1:i), 'b-', 'linewidth', 2 ) | |
ylabel('drag force') | |
grid on | |
drawnow() | |
file = sprintf('C:\\temp\\img_fsi2\\img_fsi2_%05i.jpg', i ); | |
print( '-r200', '-djpeg', file ) | |
% pause(1) | |
end | |
% ffmpeg -i img_fsi2_%05d.jpg -c:v libx264 -vf "fps=10, format=yuv420p" output.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment