9 votes
Accepted

Solving Schrodinger Equation with finite element and Crank-Nicolson?

You made an error in the indices for the real and imaginary part. $$ M\frac{\xi_{R,n+1}-\xi_{R,n}}{Δt}=-A\frac{\xi_{I,n+1}+\xi_{I,n}}2 \\ M\frac{\xi_{I,n+1}-\xi_{I,n}}{Δt}=A\frac{\xi_{R,n+1}+\xi_{R,n}}...
Lutz Lehmann's user avatar
  • 5,554
8 votes

What is the origin of the spurious oscillations in the Crank-Nicolson scheme?

There is something very basic that you should know about hyperbolic problems. Consider the most basic example $\partial_tu+a\partial_xu=0$ with a numerical marching scheme of the form $$u_j^{n+1}=\...
Philip Roe's user avatar
  • 1,084
8 votes
Accepted

Why is Crank-Nicolson considered implicit in time?

A simplification - the Crank-Nicolson method uses the average of the forward and backward Euler methods. The backward Euler method is implicit, so Crank-Nicolson, having this as one of its ...
Roland Heath's user avatar
6 votes

Is this system of diffusion equations well-posed?

I think it might be ill-posed, since the time-dependent parts are linearly dependent. If you add your two time-dependent equations together, you get a time-independent equation: $(\alpha(x)u_x)_x + (...
David Ketcheson's user avatar
5 votes
Accepted

Crank-Nicolson method for inhomogeneous advection equation

Your equation can be written in the following fashion (any spatial derivative approximation is valid), once space is discretised: $$\frac{1}{c}\frac{du_i}{dt}=-\left(\frac{\partial u}{\partial x}\...
HBR's user avatar
  • 1,628
5 votes
Accepted

Is the diffusion equation with Neumann and Dirichlet BCs well-posed?

Yes, the problem with mixed boundary conditions is well posed. What's not clear to me is this: Why do you approximate the derivative via the two-sides approximation? Shouldn't it be enough to just ...
Wolfgang Bangerth's user avatar
4 votes

Finite difference methods

This is exactly the case when the lack of information in the question allows to answer it pretty certainly: it is certainly possible. The error would depend on many factors, including the ...
Anton Menshov's user avatar
  • 8,602
4 votes
Accepted

How can I numericaly solve a convection-diffusion equation with a large diffusion term?

The solution you believe to be inaccurate is actually by far the more accurate one; you've simply plotted it in a very deceptive way. For $\nu=2$, the exact solution is actually no bigger than about $...
David Ketcheson's user avatar
4 votes

Applying Neumann boundaries to Crank-Nicolson solution in python

Boundary conditions are often an annoyance, and can frequently take up a surprisingly large percentage of a numerical code. How to implement them depends on your choice of numerical method. Finite ...
origimbo's user avatar
  • 2,229
4 votes

Method to linearize highly nonlinear partial differential equation

Your system is of the form $y'=f(t,y)$, with $y \in \mathbb{R}^m$ your state vector. Applying Crank-Nicolson to that scheme leads to the following equation for the time step from $t_n$ to $t_{n+1}=t_n ...
Laurent90's user avatar
  • 1,793
3 votes
Accepted

Crank-Nicolson algorithm for coupled PDEs

You should reformulate your problem. Let's define the vector $u$ as $u=\left(\begin{array}{c}A\\ B\end{array}\right)$ Then you can write your coupled system as $$\frac{\partial u}{\partial t}=\left(\...
Bort's user avatar
  • 1,275
3 votes

Maintain unitary time evolution for a nonlinear ODE

Crank-Nicholson is usually used for linear ODE but can also be extended to a nonlinear ODE $$\dot z = f(z)$$ like so: $$\frac{z_{n + 1} - z_n}{\delta t} = \frac{f(z_{n + 1}) + f(z_n)}{2}.$$ Another ...
Daniel Shapero's user avatar
3 votes

Why is Crank-Nicolson considered implicit in time?

The Crank-Nicolson method is: $\frac{u^{n+1}_{i}-u^{n}_{i}}{dt} = \frac{1}{2}(F^{n+1}_{i}+F^{n}_{i})$ This method calculates the next state of the system, i.e. $u^{n+1}_{i}$, by solving an equation ...
James's user avatar
  • 1,879
3 votes

How to discretize the advection equation using the Crank-Nicolson method?

User 03161 asserts that the Crank Nicolson method is not appropriate for advection problems, but boyfarrell provides a working code with results visualized in a movie. In fact they are both correct, ...
Philip Roe's user avatar
  • 1,084
3 votes

Crank Nicolson Method with closed boundary conditions

I tried to run your code and I guess there might be a small mistake in your derivation, When you impose $u_{-1}^{j+1} = u_1^{j+1}$ into the equations at the ends, you have to equate $u_{-1}^{j+1} = ...
RandomElasticity's user avatar
2 votes
Accepted

Numerical solution of burgers equation with finite volume method and crank-nicolson

If I understand correctly, you are using a centered finite difference in space and the implicit trapezoidal method in time. That scheme is unconditionally absolutely stable, but will generate ...
David Ketcheson's user avatar
2 votes
Accepted

Derivation of a parabolic PDE using Alternating Direction Implicit method

Yes, this is correct in the sense that it is second order in both time and space. It is not the only way to handle the $f(x, y, t)$ term, however. From the equations you wrote, it appears that the ...
Steven Roberts's user avatar
2 votes
Accepted

Why does scipy Conjugate Gradient solver fail to converge for non-steady heat equation using Crank-Nicolson method

Continuous Formulation If I understood everything correctly you are trying to solve the heat equation on some domain $\Omega\subseteq \mathbb{R}^d$ with space-variant diffusivity $\kappa:\Omega\to [0,\...
lightxbulb's user avatar
  • 1,271
1 vote

Can the Crank-Nicolson Method Be used to Solve The Schrodinger Equation with a Time Varying Potential?

I suspect that section 3.3 of the following thesis may be what you're looking for: Numerical simulation of time-dependent quantum systems. Edit: As noted by "davidhigh" in another answer the ...
John Tiessen's user avatar
1 vote
Accepted

Crank–Nicolson method for nonlinear differential equation

You need at least one initial condition for $\xi$ and two BC for $\rho$. Where are they? Your equation looks like the heat equation in cylindrical coordinates assuming angular and plane symmetry, with ...
HBR's user avatar
  • 1,628
1 vote
Accepted

implicit method (crank-Nicolson) I not understand the procedure

$L_x$ and $L_{xx}$ are shorthands (operators) to denote the more extended notation: $$ L_x u_i=(u_{i+1}-u_{i-1}) $$ and $$ L_{xx}u_i = (u_{i-1}-2u_i+u_{i+1})$$. Therefore $L_x$ can be written in the ...
HBR's user avatar
  • 1,628
1 vote
Accepted

FDM on nonlinear PDEs

It becomes a root finding problem. Find $u^{n+1}$ such that $$ u^{n+1} + \Delta t \theta F(u^{n+1},t^{n+1}) = u^n + \Delta t (\theta - 1) F(u^{n},t^{n}).$$ Now, you can multiply by a test function, ...
Abdullah Ali Sivas's user avatar
1 vote
Accepted

Crank-Nicholson for diffusion-advection vs diffusion equation

Take the first expression and start to reduce the $x$ values to $x_i$, \begin{align} \frac{u_{i+1}^n - u_i^n}{x_{i+\frac{1}{2}}} - \frac{u_i^n - u_{i-1}^n}{x_{i-\frac{1}{2}}} &= \frac{(x_i-\...
Lutz Lehmann's user avatar
  • 5,554
1 vote

Is the diffusion equation with Neumann and Dirichlet BCs well-posed?

Problem well posed Your problem is well posed. On the discretization with Crank-Nicholson I am not familiar with MMS, and I wonder how you got that ungeneralised form of the diffusion equation. ...
mfnx's user avatar
  • 172
1 vote

Stability of Crank-Nicolson for $u_t = iu_{xx}+2iu$

Von Neumann (Fourier modes) stability analysis gives you only a sufficient condition for stability if you compare the amplifying coefficient $r$ with 1. If you have amplifying coefficient bounded by $...
VorKir's user avatar
  • 254
1 vote

Stability of Crank-Nicolson for $u_t = iu_{xx}+2iu$

The scheme is indeed unstable. It explodes - but very very slowly. By printing the maximum eigenvalue of the operator i confirmed the instability. It's greater than 1. Then why does it work? because ...
Rick Joker's user avatar
1 vote

Finite difference - Explicit / Implicit / Crank Nicolson - Does the implicit method require the least memory?

You seem to have given the 1D equations for the discretizations, even though the problem is in 2D. Regardless, the explicit method requires the least memory since you don't even have to form a ...
Savithru's user avatar
  • 343
1 vote
Accepted

Finite Differencing schemes for Convection-Diffusion equation

it is ok for the discretization. CD scheme has some stability problem when Pe>2, but we can decrease the mesh spacing to obtain a low mesh Pe number. QUICK-scheme is more stable and accurate than CD, ...
ztdep's user avatar
  • 176
1 vote

Solving an equation in space and time using the Crank-Nicolson approach

This question is confusing. At first you are speaking of a steady-state equation, and suddenly you speak of a time scale... I will try to clarify the following. From the numerical PDEs standpoint, ...
Eduardo J. Sanchez's user avatar
1 vote

Is this system of diffusion equations well-posed?

I was curious about your problem and it was not difficult for me to test CN method for your two equations. Added - parts beginning with "added" were written afterwards to address the comment. The ...
Peter Frolkovič's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible