I've done this, but the results don't make sense. I want to run it for high Reynolds numbers, like 10000, and eventually calculate the energy spectrum, but the results are not reasonable. Could you help me with this?"
Thank you very much. But first, I need to non-dimensionalize the equation. I have defined the code as follows, but the results don't seem logical. Can you tell me the reason?
clc
clear
close all
%% Parameter Problem
N_space = 16384; % 32768
x = linspace(0, 1, N_space);
Deltax = x(2) - x(1);
% CFL = 0.5; % convergence condition by Courant–Friedrichs–Lewy
% Deltat = Deltax * CFL;
Deltat = 0.04 * 1e-6;
Tmax = 2;
M_time = Tmax / Deltat; % Cte
t = linspace(0, Tmax, M_time);
Re = 10000;
% k (i)
%% Frist create a zero matrix for the velocity so that the new velocity is calculated and then replaced
It is possible that there are several reasons why the results are not logical:
Ensure that the boundary conditions are appropriate for the problem you are trying to solve. In the current code, the boundary conditions are zero, which might not be suitable for all cases.
The time step you chose is very small (0.04 * 1e-6). It might be better to increase the time step slightly while ensuring it meets the CFL condition for stability.
The number of spatial points is very large (16384). You can try reducing the number of spatial points to see if that improves the results.
Ensure that the initial conditions are appropriate. In the current code, the initial conditions are a sine function. You can try different initial conditions to see if that improves the results.
Ensure that the function `burgers_rhs` calculates the derivatives correctly. You can add some corrections to improve accuracy.
I've sent the results of this code. The energy spectrum plot is correct, but in the velocity plot, the sinusoidal lines should not go above the plot; they should be exactly on the plot, not outside of it.
Another point is that the velocity peak at a certain second should be around 0.8 and should not dissipate too quickly.