This makes the equation non-linear and more difficult to solve;
the differential equation is approximated in the following way:
After separating the unknown
This is implemented in Python; similar IC as in the step 1 apply.
The code is written as follows:
Python code for solving the 1D Nonlinear Convection |
Wave profile after 400 iterations |
Wave profile - all 400 iterations on the same plot |
- the wave has moved to the right, with a change in shape;
- in the same time, the height is decreased (similar to linear);
- increasing the total time will make the scheme unstable if there are not enough time-steps;
- that is if the time step is increased the problem loose resolution;
- as a good practice, the time step dt must be correlated with the element size, dx;
- if the size of element, dx is decreased, so should be the time-step;
- the time step should be smaller than the time needed for the wave to pass one grid cell;
- for this case, the max velocity is 2, therefore the time step should be less than half of the grid cell size;
- dt<dx/vmax.
The code for 1D Nonlinear Convection can be downloaded from GitHub, here.
In the next step I will be solving the 1D Diffusion component from the Navier Stokes equation.
If you have and questions, feel free to leave a comment below.
0 comments:
Post a Comment