Numerical Simulation of a Damped, Driven Nonlinear Wave System with Spatially Extended Initial Conditions
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Athanasios Paraskevopoulos
am 20 Mai 2024
Beantwortet: Athanasios Paraskevopoulos
am 23 Mai 2024
The study of the dynamics of the discrete Klein - Gordon equation (DKG) with friction is given by the equation :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700666/image.png)
In the above equation, W describes the potential function: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700241/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700241/image.png)
to which every coupled unit
adheres. In Eq. (1), the variable
is the unknown displacement of the oscillator occupying the n-th position of the lattice, and
is the discretization parameter. We denote by h the distance between the oscillators of the lattice. The chain (DKG) contains linear damping with a damping coefficient
, while β is the coefficient of the nonlinear cubic term.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700246/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700251/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700256/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700261/image.png)
For the DKG chain (1), we will consider the problem of initial-boundary values, with initial conditions
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700266/image.png)
and Dirichlet boundary conditions at the boundary points
and
, that is,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700271/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700276/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700281/image.png)
Therefore, when necessary, we will use the short notation
for the one-dimensional discrete Laplacian
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700286/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700291/image.png)
We investigate numerically the dynamics of the system (1)-(2)-(3). Our first aim is to conduct a numerical study of the property of Dynamic Stability of the system, which directly depends on the existence and linear stability of the branches of equilibrium points.
For the discussion of numerical results, it is also important to emphasize the role of the parameter
. By changing the time variable
, we rewrite Eq. (1) in the form
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700296/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700301/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699111/image.png)
The change in the scaling of the lattice parameter of the problem makes it important to comment here on the nature of the continuous and anti-continuous limit. For the anti-continuous limit, we need to consider the case in Eq. (1) where
. In the case of nonlinearity present in the governing equations, the continuous limit needs to be taken as well. On the other hand, for small values of the parameter, the system becomes significant. However, because of the model we consider, we take the asymptotic linear limit as
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700306/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700311/image.png)
We consider spatially extended initial conditions of the form:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699116/image.png)
where
is the distance of the grid and
is the amplitude of the initial condition
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699121/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699126/image.png)
We also assume zero initial velocity:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699131/image.png)
I am trying to create the following plots but as you can see my code doesn;t give these results. Any sugestions?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699136/image.png)
- for
% Parameters
a = 2; % Amplitude of the initial condition
j = 2; % Mode number
L = 200; % Length of the system
K = 99; % Number of spatial points
% Spatial grid
h = L / (K + 1);
n = -L/2:h:L/2; % Spatial points
% Compute U_n(0) for each n
U_n0 = a * sin((j * pi * h * n) / L);
% Plot the results
figure;
plot(n, U_n0, 'ro'); % 'ro' creates red circles
xlabel('$x_n$', 'Interpreter', 'latex');
ylabel('$U_n$', 'Interpreter', 'latex');
title('$t=0$', 'Interpreter', 'latex');
xlim([-L/2 L/2]);
ylim([-3 3]);
grid on;
UPDATED : I need to replicate the red and the blue graphs of the papers. I am sure that I need to change a parameter but I dont know which one for
and
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700961/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1700676/image.png)
% Parameters
L = 200; % Length of the system
K = 99; % Number of spatial points
j = 2; % Mode number
omega_d = 1; % Characteristic frequency
beta = 1; % Nonlinearity parameter
delta = 0.05; % Damping coefficient
% Spatial grid
h = L / (K + 1);
n = linspace(-L/2, L/2, K+2); % Spatial points
N = length(n);
omegaDScaled = h * omega_d;
deltaScaled = h * delta;
% Time parameters
dt = 0.05; % Time step
tmax = 3000; % Maximum time
tspan = 0:dt:tmax; % Time vector
% Values of amplitude 'a' to iterate over
a_values = [2, 1.95, 1.9, 1.85, 1.82]; % Modify this array as needed
% Differential equation solver function
function dYdt = odefun(~, Y, N, h, omegaDScaled, deltaScaled, beta)
U = Y(1:N);
Udot = Y(N+1:end);
Uddot = zeros(size(U));
% Laplacian (discrete second derivative)
for k = 2:N-1
Uddot(k) = (U(k+1) - 2 * U(k) + U(k-1)) / h^2;
end
% System of equations
dUdt = Udot;
dUdotdt = Uddot - deltaScaled * Udot + omegaDScaled^2 * (U - beta * U.^3);
% Pack derivatives
dYdt = [dUdt; dUdotdt];
end
% Create a figure for subplots
figure;
% Initial plot
a_init = 2; % Example initial amplitude for the initial condition plot
U0_init = a_init * sin((j * pi * h * n) / L); % Initial displacement
U0_init(1) = 0; % Boundary condition at n = 0
U0_init(end) = 0; % Boundary condition at n = K+1
subplot(3, 2, 1);
plot(n, U0_init, 'r.-', 'LineWidth', 1.5, 'MarkerSize', 10); % Line and marker plot
xlabel('$x_n$', 'Interpreter', 'latex');
ylabel('$U_n$', 'Interpreter', 'latex');
title('$t=0$', 'Interpreter', 'latex');
set(gca, 'FontSize', 12, 'FontName', 'Times');
xlim([-L/2 L/2]);
ylim([-3 3]);
grid on;
% Loop through each value of 'a' and generate the plot
for i = 1:length(a_values)
a = a_values(i);
% Initial conditions
U0 = a * sin((j * pi * h * n) / L); % Initial displacement
U0(1) = 0; % Boundary condition at n = 0
U0(end) = 0; % Boundary condition at n = K+1
Udot0 = zeros(size(U0)); % Initial velocity
% Pack initial conditions
Y0 = [U0, Udot0];
% Solve ODE
opts = odeset('RelTol', 1e-5, 'AbsTol', 1e-6);
[t, Y] = ode45(@(t, Y) odefun(t, Y, N, h, omegaDScaled, deltaScaled, beta), tspan, Y0, opts);
% Extract solutions
U = Y(:, 1:N);
Udot = Y(:, N+1:end);
% Plot final displacement profile
subplot(3, 2, i+1);
plot(n, U(end,:), 'b.-', 'LineWidth', 1.5, 'MarkerSize', 10); % Line and marker plot
xlabel('$x_n$', 'Interpreter', 'latex');
ylabel('$U_n$', 'Interpreter', 'latex');
title(['$t=3000$, $a=', num2str(a), '$'], 'Interpreter', 'latex');
set(gca, 'FontSize', 12, 'FontName', 'Times');
xlim([-L/2 L/2]);
ylim([-2 2]);
grid on;
end
% Adjust layout
set(gcf, 'Position', [100, 100, 1200, 900]); % Adjust figure size as needed
15 Kommentare
William Rose
am 23 Mai 2024
@Athanasios Paraskevopoulos, I will get you somehting on this, but I'm busy for the next two days. Sorry for the delay. And I apologize for asking so many questions.
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus 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!