Skip to content

Instantly share code, notes, and snippets.

View shelvean's full-sized avatar

Shelvean Kapita shelvean

View GitHub Profile
'''
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)
'''
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
'''
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)
'''
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)
'''
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
'''
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
'''
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
'''
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