This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Solution of the advection equation by the upwind scheme | |
by Shelvean Kapita, 2022 | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def u_0(x): | |
# val = np.exp(-(x-4)**2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Solution of the advection equation by the Crank-Nicolson scheme with | |
and without added artificial diffusion (dissipation) | |
by Shelvean Kapita, 2022 | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.sparse import diags | |
from scipy.sparse.linalg import spsolve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Solution of the advection equation by the Lax-Friedrichs scheme | |
by Shelvean Kapita, 2022 | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def u_0(x): | |
# val = np.exp(-(x-4)**2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Solution of the advection equation by the Lax-Wendroff scheme | |
by Shelvean Kapita, 2022 | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def u_0(x): | |
# val = np.exp(-(x-4)**2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Solution of the advection equation by the Leapfrog scheme | |
with and without added artificial diffusion (dissipation) | |
by Shelvean Kapita, 2022. | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Python code for a fully implicit difference scheme for solving the one-dimensional | |
heat equation on a unit interval [0, 1] | |
by Shelvean Kapita, October 2022 | |
''' | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Python code for a fully implicit difference scheme for solving the one-dimensional | |
heat equation on a unit interval [0, 1] | |
by Shelvean Kapita, October 2022 | |
''' | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Python code for solving the one dimensional heat equation on a | |
unit interval [0, 1] using an explicit finite difference scheme. | |
by Shelvean Kapita, October 2022. | |
''' | |
import numpy as np |