[Wave Modeling 1] Theoretical Analysis and Matlab Simulation of Ocean Wave Modeling

1. Software version

matlab2017b

2. System principle

       The design of wave modeling mainly involves the determination of the wave model, the calculation of various parameters of the wave, etc. This system,

The wave model is as follows:

       In reality, there are many types of wave models. This model is used here mainly because the effect of this model is the closest to the effect on the website you gave.

 G is the acceleration of gravity, take the constant 9.8

3. Core source code

global Winds;   %风速
global g; %重力加速度
global kk; %仿真模型沙盘和实际区域的大小比例
global Xmax;
global Ymax;
global Dxy;
global flag;
global VX;
global VY;
global VZ;


flag = 0;

g    = 9.8; %重力加速度
kk   = 1/40; %仿真模型沙盘和实际区域的大小比例
%仿真的间隔
Dxy  = 4;


%仿真覆盖的海域范围
Xmax = 1000;
Ymax = 1000;

Start  = 200;
x      = [Start:Dxy:Xmax];
Ymax2  = round(Ymax/2);
y      = [Start:Dxy:Ymax2];
[xo,yo]= meshgrid(x,y);
z2     = zeros(size(x));

%海浪自身运动的波高
r = (3.5325*Winds^2.5)/1000;

%海浪自身运动的波长
k = 2*g/(3*Winds^2);
L = 2*pi/k;

%周期T
T = sqrt(2*pi*L/g);

%波频率
w = sqrt(2/3)*g/T;
t = 0;

while(flag == 0)
    disp('the wind speed is');Winds
    t = t + 1;
    for i = 1:(Ymax2-Start)/Dxy+1
        for j = 1:(Xmax-Start)/Dxy+1
            %衰减系数
            d             = sqrt((xo(1,j)-0)^2 + (yo(1,j)-0)^2);
            alphas        = exp(-0.07*d) - 0.18; 
            z2(i,j)       = alphas*r*cos(k*sqrt((xo(1,j)-0)^2 + (yo(1,j)-0)^2) - w*t);
        end
    end
    %显示局部效果
    axes(handles.axes1);
    surfl(xo,yo,z2);
    axis([Start-50 Xmax+50 Start-50 Ymax2+50 -8 10]);
    shading interp;
    colormap([143/255,157/255,203/255]);
    alpha(0.75);
    lightangle(-30,90);
    
    view([VX,VY,VZ]);
    
    
    pause(0.1);    
    
    
    %海浪自身运动的波长
    k = 2*g/(3*Winds^2);
    Ls = 2*pi/k;
    set(handles.edit1,'String',num2str(Ls));
    
    
    %计算得到海浪的参数指标
    %海浪自身运动的波高
    rs = (3.5325*Winds^2.5)/1000;
    set(handles.edit3,'String',num2str(rs));
    

    %周期T
    T = sqrt(2*pi*L/g);
    %速度
    c = g*T/(2*pi); 
    set(handles.edit4,'String',num2str(c)); 
    
    %波频率
    w = sqrt(2/3)*g/T;    
    set(handles.edit5,'String',num2str(w/2/pi));
    
end

4. Test results

The simulation operation is shown in the above figure,

First click START to start simulating the effect of waves, and then click stop to pause.

The label in Figure 3 above is the corresponding button on the website to adjust the wind speed.

4 shows the parameters of the waves. For the calculation of specific parameters, see the theoretical introduction on the previous page.

5 Here is the display of the 3D effect, you can observe the waves from different angles (the AXIS of the GUI in MATLAB cannot directly use the mouse to rotate the 3D display, so it needs to be displayed through this function)

A19-06

Guess you like

Origin blog.csdn.net/ccsss22/article/details/125610685