Numerical Solution of 1D Advection Model Using Python Code
VerifiedAdded on 2022/08/13
|3
|657
|45
Practical Assignment
AI Summary
This assignment presents a Python implementation of a 1D advection model, a fundamental concept in computational physics and fluid dynamics. The code simulates the advection equation using three different numerical schemes: FTBS (Forward Time, Backward Space), FTFS (Forward Time, Forward Space), and CTCS (Centered Time, Centered Space). The code initializes parameters such as the advection velocity, time step, spatial step, and grid size. It then applies each scheme to solve the advection equation over a specified time period, storing the results in arrays. The code includes calculation loops for each scheme and displays the values of 'u' at each time step. Finally, the solution visualizes the results by plotting the value of 'u' at a specific spatial point (x=48) against time for each of the three schemes, allowing for a comparison of their behavior and stability characteristics. The plots utilize the matplotlib library to generate line graphs, providing a clear representation of the numerical solutions.
1 out of 3







