惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

Daniel Duque Campayo

Cursos de música online Latex, Beamer, Python, Beauty Boring stuff Better with stock pictures Prueba Tired of that “TeX” look? Plotting 2D column-shaped results with python Grabaciones al aire libre A markdown test
Quick von Neumann stability analysis
2017-09-12 · via Daniel Duque Campayo

von Neumann stability analysis is a great tool to assess the stabilty of discretizing schemes for PDEs. But too often, imho, the discussion is too convoluted. Here, I try to provide a shortcut.

In a nutshell:

  • The standard approach involves Fourier techniques, involving (of course) complex numbers
  • The real part of these numbers is analysed, with some trigonometric expression resulting, identifying the troublesome modes
  • I claim this mode can be identified in advance, which makes the whole Fourier procedure unnecessary

BTW: it’s pronounced “fon no ee man”

parts_bw_values_250

Standard procedure

Starting from the diffusion equation (aka heat equation):

\frac{\partial \phi}{\partial t} = D \frac{\partial^2 \phi}{\partial x^2}

A centered space and forward time discretization throws a explicit scheme:

\quad (1) \qquad \phi_j^{n + 1} = \phi_j^{n} + \alpha \left(\phi_{j + 1}^n - 2\phi_j^n +\phi_{j - 1}^n \right) ,

where

\alpha = \frac{D \, \Delta t}{\Delta x^2}  

is a diffusion Courant number. The question is what value of this number is acceptable for the simulation to remain stable. In more practical terms, for a given spacial resolution we are asking what time step is acceptable. The shorter, the more accurate (in principle, but for stuff such as roundoff errors), but of course we’d rather have our results in minutes rather than hours or days.

Now, the usual discussion centers around the growth of the error in the solution. Let’s just suppose that the solution has a sine wave shape:

\quad (2) \qquad \phi(x,t) = A(t) e^{i k x} ,

i.e.

\phi_j^n = A^n e^{i k \Delta x j}

Then the discretized equation (1) becomes

\quad (3) \qquad A^{n + 1} = A^n \left( 1 + \alpha  [  e^{i k \Delta x} +e^{- i k \Delta x} -2 ]  \right) .

Now, the usual discussion relates the part with the complex exponentials to trigonometrical functions:

e^{i k \Delta x} +e^{- i k \Delta x} -2 = 2 [\cos(k \Delta x) -1 ] =    -4 \sin^2(k \Delta x/2)

Now this means

\quad (4) \qquad A^{n + 1} = \left( 1 -4 \alpha \sin^2(k \Delta x/2)  \right)  A^n

Any law of the form

\quad (5) \qquad A^{n + 1} = C  A^n

means that:

  • the mode will decay monotonically if real( C ) < 1 ( C is a complex number!) (well, not in this case, but it might be, in general)
  • the mode will decay in an oscillatory manner if real( C ) > – 1. In other words, the scheme is stable if | C | < 1
  • If | C | > 1 the scheme will fail, because that mode will grow and grow, which it must not in principle (see below for Cahn Hilliard)
  • A possible imaginary part is not so important, it being a change of phase of the mode

This applies to every mode (i.e. value of k ), but our main offender is seen to be the one whose real( C ) is the lowest: the one for which the argument of the squared sin is π/2 (for the time being, we’ll pretend this does not mean anything special). For this mode, C = 1- 4 α, and:

\quad (6) \qquad A^{n + 1} = (1-4 \alpha)  A^n

Hence, we finally arrive at our result:

  • α must be below 1/4 for a monotonic decrease of the worst modes, it suffices it be below 1/2 for stability

Our approach

Now, seriously, the worst mode is the one for which

k \Delta x = \pi

The wavelength of this mode is λ = 2 Δx. This is precisely the shortest wavelength mode that is allowed by our spacial resolution (that’s about everything we need to know of Fourier analysis).

This may look like a cosine function centered at j and with this wavelength takes vales +1 at j, -1 at j+1, 1 at j+2, et caetera.  It turns out, then, we did not need such a detour. Back to Eq. (1),

\quad (1) \qquad \phi_j^{n + 1} = \phi_j^{n} + \alpha \left(\phi_{j + 1}^n - 2\phi_j^n +\phi_{j - 1}^n \right) ,

It seems clear all along that we would get the worst possible case if the values of the field Φ are staggered, producing a -1 -2 -1= -4 in the parenthesis. Then:

- \phi_{j + 1}^n =  - \phi_{j - 1}^n =  \phi_j^n  =: A^n 

and in this case

$latex  A^{n + 1} = \A^{n} [ 1 – 4 \alpha ] .$

Which recovers the result above in two lines!

This may be extended very simply to other schemes. For example, an implicit scheme ends up in something like this (for the worst mode):

(1 + 4 \alpha ) A^{n + 1} =   A^n

So, C=1/(1 + 4α ), which is always between 1 and 0. The method is then unconditionally stable.

A Crank-Nicolson method yields

(1 + 2 \alpha) A^{n + 1} = (1 + 2 \alpha)  A^n

So, for this scheme, α must be above 1.

Cahn-Hilliard equation

Let’s apply this to the more complicated Cahn-Hilliard equation

\frac{\partial \phi }{\partial t} = D \nabla^2\left(  - \phi + \phi^3-    \gamma \nabla^2 \phi\right)

We’ll suppose that γ = 1 / 2 (it can be shown that this happens if the spacial length is set equal to the interfacial length at equilibrium).

Now, a tricky thing about this equation is that it describes segregation, and domain formation. So, the φ = 0 field is actually unstable against fluctuations. The systems should begin to form structures with values of  φ departing from 0, with a well defined wave-length (see Note below). [That’s the featured image, by the way. It started at values of 0.01, and see what it has done in just about 500 reduced time units.]

It makes little sense to use our stability analysis in this case, then.

We have to go close to the equilibrium regime, when φ ~ 1 (there is also φ ~ -1, what follows applies in the same way).

Let us write

- \phi + \phi^3 = \phi ( \phi^2 -1 ) = \phi ( \phi +1 ) ( \phi -1 ) \approx 1 \times 2 \times ( \phi -1 )  

The small field is now

\psi := ( \phi -1 )  ,

and our equation can be approximated by

\quad (8) \qquad \frac{\partial \psi }{\partial t} = D \nabla^2\left(  2 \psi  - \frac12 \nabla^2 \psi \right)

Now, a standard explicit scheme would yield:

\quad (9) \qquad \psi^{n+1}_j = \left[ 1 +  2 \alpha   \left(\phi_{j - 1}^n - 2\phi_j^n +\phi_{j + 1}^n \right)    - \frac\beta2 \left( \phi_{j - 2}^n  -4 \phi_{j - 1}^n + 6 \phi_j^n - 4 \phi_{j + 1}^n + \phi_{j + 2}^n  \right)  \right]

(There’s a handy finite differences calculator for higher order derivatives). In this expression, α is as above, and

\beta= D \frac{\Delta t }{\Delta x^4}.

Now, the worst case is exactly as in diffusion, an in this case,

\quad (10) \qquad  A^{n+1} = \left[ 1 - 8 \alpha   - 8 \beta  \right] A^{n}

Hence, the scheme is stable if 1 – 8 α – 8 β > -1, i.e.  α + β < 1/4.

An implicit scheme leads to

\left[ 1 + 8 \alpha  + 8 \beta  \right]  A^{n+1} =  A^{n} ,

which is unconditionally stable.

A mixed scheme such as the one that I am forced to work with (long story…) produces

\left[ 1  + 8 \beta  \right]  A^{n+1} = \left[ 1 - 8 \alpha  \right]  A^{n} ,

hence the criterium for stability is

4 \alpha   -4 \beta  < 1

This means a typical, easy choice of Δt = Δx , in which α = β = 1, would be stable.

Actually (… but this gets progresively less interesting for the general public), my approach involves an explicit cube term, in which we may write, close to saturation

-\phi^{n+1} + (\phi^n)^3 \approx -\psi^{n+1} +3  \psi^n 

which leads to

\left[ 1 - 4 \alpha   + 8 \beta  \right]  A^{n+1} = \left[ 1 - 12 \alpha  \right]  A^{n} ,

hence the criterium for stability is

8 \alpha   -4 \beta  < 1

This means the choice Δt = Δx , in which α = β = 1, would not be stable!

Note on Cahn-Hilliard coarsening

If φ << 1, the cubed term is negibible. Then

\frac{\partial \phi }{\partial t} = D \nabla^2\left(  - \phi  -  \frac12 \nabla^2 \phi\right)

Which is linear. Going to Fourier space,

\frac{\partial \phi_k }{\partial t} = D \left( k^2  -  \frac12 k^4 )  \right) \phi_k ,

Hence, all modes between k = 0 and √2 will grow, with the one with k=1 growing the most. This is a wavelength of 2 π , in units of the interfacial length.