All Questions
Tagged with finite-difference python
61
questions
1
vote
1
answer
130
views
Coupled Partial Differential Equations
I'm trying to solve the following system of coupled differential equations, the two-temperature model for $e$ = electrons and $l$ = lattice.
$$
\rho_{e}C_{p,e}\frac{\partial T_{e}}{\partial t} = k_{e}\...
1
vote
1
answer
201
views
Numerically solving the Advection-diffusion equation with no-flux boundary condition leads to violation of mass conservation
I am trying to solve numerically the advection-diffusion equation of the following form
$$\frac{\partial C}{\partial t}=\alpha\frac{\partial^2 C}{\partial x^2}+\beta \frac{\partial C}{\partial x}$$
...
2
votes
0
answers
102
views
Numerical solution for inviscid Burgers' equation seems to have no breaking time?
So I'm trying to use the Lax-Friedrichs method to solve the inviscid burgers' equation with initial condition $$u(x,0) = \sin(x)$$, using
$$u_m^{n+1} = \frac{1}{2}(u_{m+1}^n + u_{m-1}^n) - \frac{\...
1
vote
1
answer
81
views
Does anyone know how to add a forcing term at the center of a cicular membrane?
I am here once again searching for wisdom, as some of you might notice I asked a related question a few days ago. And now I am struggling to add a forcing term at the center of the membrane, in order ...
0
votes
1
answer
211
views
Solving the wave equation for a circular membrane in polar cordinates
As you see this mode is not right, unless for what i understand
And the initial conditions were
...
3
votes
0
answers
207
views
Python code of explicit method of a nonlinear a BVP
I am trying to have a Python code for the following nonlinear BVP:
$$\frac{\partial N}{\partial t}=\frac{\partial^2 N}{\partial x^2}+N(1-N)-\sigma N$$ $$N(0,x)=\sin(2\pi x)$$
$$N(t,0)=0 \hspace{3mm}N(...
0
votes
0
answers
95
views
Encountering blow-up when solving the one-way heat equation using Lax-Wendroff
This is my first time attempting to implement a finite difference method for a PDE in Python, and I am having a bit of trouble. The PDE I am trying to solve is as follows:
$$
\begin{cases}
...
2
votes
0
answers
149
views
Scipy.root not converging even when provided with initial guesses very close to solution
I've made a previous question here and also in SO wondering why only the fsolve solver converges for the simple one dimensional unsteady conduction problem
$$ \frac{\partial T}{\partial t} = \alpha \...
1
vote
0
answers
101
views
How to include zero flux boundary conditions?
I am trying to solve the following differential equation in the domain of $\theta \in [0, 2 \pi]$ using finite differences scheme:
For $0< \theta \leq \pi$
\begin{align}
\rho_i^{n+1}=\rho_i^{n}+D\...
1
vote
1
answer
102
views
Simulating First Order Hyperbolic PDE with Finite Difference Scheme
I am trying to simulate a hyperbolic PDE with some control given by the following:
$$u_t(x, t) = u_x(x, t) + \theta(x) u(0, t)$$
with boundary conditions:
$$u(1, t) = U(t) = \int_0^1 k(1-y) u(y, t)dy$$...
0
votes
1
answer
222
views
How to correctly plot Order of accuracy for different finite difference schemes
I have implemented Upwind, Lax, Lax-Wendroff, Leapfrog and macCormak method for the linear advection equation with Dirichlet boundary conditions. I am trying to create the order of accuracy plots for ...
1
vote
0
answers
280
views
Open boundary condition for 1d wave equation with variable wave speed using finite differences
I have implemented a finite difference solver for the 1d wave equation with variable wave speed:
$$ u_{tt} = c(x)u_{xx}, \hspace{10mm}c(x) = \dfrac{6 -x^2}{2} \hspace{5mm} $$
on $-2 \leq x \leq 2, t &...
3
votes
0
answers
241
views
solve Ax=b for outrigger A matrix python
I implement Crank-Nicolson 2D finite-difference method.
I get a matrix A which is banded with 1 band above and below the main diagonal, but also contains 2 additional bands , further apart from the ...
5
votes
0
answers
132
views
How to troubleshoot numerical instability using finite difference for steady-state non-linear heat conduction equation
I have a problem which I believe is numerical instability when trying to solve a heat conduction equation using finite difference. The short version is that when the parameter $I=80.3$ I get the blue ...
1
vote
0
answers
425
views
How to compute the Eigenvalue and Eigenstates of Quantum well with Effective mass using finite difference method in Python?
I want to compute the eigenvalues and eigenstates of a quantum well with different effective masses of electron in the barrier and in the quantum well. As can be seen [1]: https://github.com/mholtrop/...