How can I plot the waves produced from a piston type wave-maker?

5 Ansichten (letzte 30 Tage)
Marili Sotiriou
Marili Sotiriou am 4 Dez. 2020
Beantwortet: Anurag Ojha am 13 Aug. 2024
Hello everyone!
I have the task of programming a piston type wavemaker, that calculates the velocity potential Φ
and calculates the coefficients A
and displays the velocity potential on the water surface, as well as the rise of the free surface area of the water.
Any help would be really appreciated.
Thank you!
M.

Antworten (1)

Anurag Ojha
Anurag Ojha am 13 Aug. 2024
Hey Marilli
You can approach this problem using the linear wave theory. I have taken certain assumptions for programming a piston type wavemaker, that calculates the velocity potential Φ. Kindly make changes according to your use case. The assumptions that I have taken are as follows
  • Linear Wave Theory: We assume small amplitude waves.
  • 2D Wave Propagation: The wavemaker moves in one direction, generating waves in a two-dimensional (2D) domain.
  • Inviscid and Incompressible Flow: The fluid is assumed to be inviscid and incompressible.
  • Potential Flow: The flow is irrotational, allowing us to use the velocity potential Φ\PhiΦ.
% Parameters
L = 10; % Length of the domain (m)
H = 1; % Depth of the water (m)
A = 0.1; % Amplitude of the wavemaker motion (m)
omega = 2 * pi; % Angular frequency (rad/s)
k = 2 * pi / L; % Wave number (1/m)
g = 9.81; % Gravitational acceleration (m/s^2)
t = 0:0.1:10; % Time vector (s)
x = linspace(0, L, 100); % Spatial domain (m)
z = linspace(-H, 0, 100); % Vertical domain (m)
% Calculate velocity potential Phi
[Z, X] = meshgrid(z, x);
Phi = zeros(length(x), length(z), length(t)); % Initialize Phi
for i = 1:length(t)
Phi(:, :, i) = A * cosh(k * (Z' + H)) ./ cosh(k * H) .* cos(k * X' - omega * t(i));
end
% Calculate the free surface elevation (eta)
eta = A * cos(k * x - omega * t'); % Corrected to match dimensions
% Visualization
for i = 1:length(t)
figure(1);
subplot(2, 1, 1);
imagesc(x, z, Phi(:, :, i)');
title('Velocity Potential \Phi(x,z,t)');
xlabel('x (m)');
ylabel('z (m)');
colorbar;
subplot(2, 1, 2);
plot(x, eta(i, :));
title('Free Surface Elevation \eta(x,t)');
xlabel('x (m)');
ylabel('\eta (m)');
axis([0 L -A A]);
pause(0.1); % Pause to visualize the wave propagation
end

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by