Numerical Simulation of a Damped, Driven Nonlinear Wave System with Spatially Extended Initial Conditions
8 views (last 30 days)
Show older comments
Athanasios Paraskevopoulos
on 20 May 2024
Answered: Athanasios Paraskevopoulos
on 23 May 2024
The study of the dynamics of the discrete Klein - Gordon equation (DKG) with friction is given by the equation :
In the above equation, W describes the potential function:
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.
For the DKG chain (1), we will consider the problem of initial-boundary values, with initial conditions
and Dirichlet boundary conditions at the boundary points and , that is,
.
Therefore, when necessary, we will use the short notation for the one-dimensional discrete Laplacian
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
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 .
We consider spatially extended initial conditions of the form:
where is the distance of the grid and is the amplitude of the initial condition
We also assume zero initial velocity:
I am trying to create the following plots but as you can see my code doesn;t give these results. Any sugestions?
- 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 .
% 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 Comments
William Rose
on 23 May 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.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!