Presentation is loading. Please wait.

Presentation is loading. Please wait.

AC274: Finite Differences for Classical Fields

Similar presentations


Presentation on theme: "AC274: Finite Differences for Classical Fields"— Presentation transcript:

1 AC274: Finite Differences for Classical Fields
Sauro Succi We shall cover three broad classes of PDE’s: Transport: Advection-Diffusion-Reaction equations Porous media, environment, you_name_it Conservation: Continuity equation Ubiquituos! Gas-dynamics: Burgers equation Shock waves, Cosmological fluids, Growth phenomena …

2 The Four Levels MACRO Continuum Fields Probability distributions MESO
Particles (atoms/molecules MICRO Complex Fields QUANTUM Wash out Irrelevant details (tube/baby problem)

3 Finite Differences for Transport PDE’s

4 Finite Differences for Classical Fields Transport PDE’s: Outline
We introduce the basic criteria of space-time finite-difference Discretization of PDE’s. For the sake of simplicity, we explicitly refer to simple Diffusion –Advection-Reaction equations in d=1 spatial dimensions. In the process of discussing actual examples, we shall also introduce the general (and very important) notion of stability analysis through inspection of the Discrete Dispersion Relation. Generalizations to the broader class of ADR (Advection-Diffusion-Reaction) equations in d>1 are left as an exercise. They are conceptually straightforward but require some extra-coding, hence it is an excellent exercise.

5 PDE’s for transport phenomena
Diffusion Equation Advection-Diffusion Equation Advection-Diffusion-Reaction Equation

6 Transport: analytic solutions
Linear homogeneous: similarity group Translation Dilatation Growth/Decay Inhomogenous, non-linear: broken syms This is where numerics takes over analytics!

7 Spacetime crystal Uniform (for simplicity)

8 Finite-Difference Schemes
The Discrete Derivative is by no means unique! Higher accuracy is obtained by using larger sets of discrete points = STENCIL

9 Consistency Continuum limit:
The discrete operators must reduce to their continuum form: smoothly. The rate of error decay defines the order of accuracy (first, second ….)

10 Computational molecules (stencils)
Differential operators become SPARSE MATRICES

11 Discrete Time: Forward Euler

12 Discrete derivatives = Sparse matrices
1 0=N N N+1=1

13 2D stencils

14 Non uniform lattices The coefficients a,b,c, pick-up a dependence on the position {a_j,c_j,b_j}, but the The matrix structure stays the same because LOCALITY is what matters. Accuracy is affected though, usually one order less and sometimes even stability. Let us see why:

15 Non uniform lattices Uniform limit
a+b+c =0 still, but the diagonal is non-zero. What does this mean?

16 Accuracy Taylor-expand to second order: Zeroth order accuracy: OK OK
First order accuracy: OK Second order accuracy : No, unless UNIFORM! BOTTOMLINE: Even the centered derivative is only first order accurate Serious problem? No, if you don’t insist on point-like convergence…

17 PDE’s in 1d: Transfer matrix
Using local (nearest-neighbor) stencils and fwd Euler in time: Computational Molecule: Compact matrix form: (Tridiagonal) T_ij is appropriately called Transfer Matrix, as it transfers state at time n (Present) to time n+1 (Future).

18 Now to actual equations
Diffusion Equation

19 Diffusion Equation d=1 Analytical solution: Dispersion Relation:
Frequency vs Wavenumber (see later)

20 Discrete Time: Forward Euler

21 Discrete space: centered
Handier notation In general tridiagonal form:

22 DE: Centered-Euler This is known as diffusive
Courant-Friedrich-Levy (CFL) number. Key to stability. Transfer matrix: Note that a+b+c=1 by mass conservation.

23 Dispersion Relation The Dispersion Relation tells how different wavelengths propagate in space. It says ALL about linear systems. The solution is expressed as a superposition of plane-waves (exponential). Since the problem is linear we can focus on a single plane wave: The real part tells the propagation speed of the signal: The imaginary part tells the growth/decay rate Stable Unstable

24 Discrete Fourier space
Low k High k

25 Discrete range and continuum limit
In the limit kd ->0 thewave does not “see” discreteness anymore

26 DE: continuum DR For plane waves the following handy replacement rules hold: One-line algebra delivers: Namely: No propagation All wavelengths decay (absolute stability) the shortest decay quadratically fast Any consistent discretization must reproduce the above relations in the continuum limit:

27 Discrete vs Continuum DR
The Discrete DR necessarily deviates from this, esp at high-k, since short wavelengths see the lattice. We are mostly interested in long wavelengths

28 Discrete vs Continuum DR
Two main sources of discretization error: Real(omega), Phase Errors: Dispersion Imag(omega), Amplitude Errors: Numerical Diffusion Dispersion means that the plane wave propagates at a different speed Than continuum one, thus leading to distorsions in the profile and eventually Unphysical oscillations (Gibbs oscillations) Positive numerical diffusion leads to excessive damping. Negative numerical diffusion leads to artificial growth: Numerical instability

29 General DDR Useful manipulations: Divide second by first: with
By squaring both sides and summing up:

30 General DDR We can draw some general conclusions:
If a=b there cannot be any propagation (this is the case for pure Diffusion) 2) If b-a>0 the scheme cannot be stable for any h (this is the case for pure Advection with centered differences)

31 From General to DE DDR DE: Exact at any k
By squaring both sides and summing up: with

32 Diffusion DDR: Stability
(-2<X<0) The discrete stability condition reads: (Since X<0) (Since |X|<2) This is the diffusive CFL condition

33 DDR: continuum limit Exact at any k Continuum limit:
The continuum limit is recovered: accurate to 2° order. The stability analysis shows that discretization errors canNOT trigger instability at any wavenumber

34 Stability/Realizability
Probabilistic interpretation (a+b+c=1) Probability of moving up in time from left Probability of moving up in time from right Probability of moving up in time from center Much swifter: Realizability (all coeffs must be non-negative):

35 Let’s add some “wind” Advection-Diffusion Equation

36 AD Equation For the simple case U=const, the analytical solution reads: The AD dispersion relation: Propagation

37 Numerical dispersion:
Gibbs phenomena

38 positive = overdamping
Numerical Diffusion: positive = overdamping

39 Centered FD+Euler

40 ADE: Centered-Euler Two CFL’s

41 Stability vs Realizability
Note that the limit D=0 (pure advection) is always UNSTABLE! Adv/Dif is measured by the cell-Peclet number:

42 Time-step constraints
DIFFUSION is much more constraining than ADVECTION ! Upon refining the grid by a factor 2, advection requires dt/2, diffusion requires dt/4. Other time-discretizations are used for diffusion, So-called implicit methods. See the quantum mechanics lectures

43 Advection-Diffusion-Reaction
A lot of applications in science and engineering (combustion, crystal growth, population bacteria dynamics

44 Important dim-less groups
Peclet = Advection/Diffusion Pe>>1 for macroflows, and Pe<<1 for nanoflows Air: D=10^-6 m2/s. L=1m, U=1 m/s gives Pe=10^5… Water: D=10^-5 m2/s, L=10^-6, U=10^-3, gives Pe=10^-4 Damkohler = Chemistry/Diffusion Da>>1 for flames, and Da<<1 for well-stirred reactors With L=1m, D=10^-6, r<10^-6 react/s is well stirred, but at small scales lower reactivity can still yield high Da.

45 ADR Equation For the ideal case U=const and linear chemistry:
The analytical solution is: In general, chemistry “wants” homogeneous states such that: This may have multiple solutions (fixed points): how do they manage to coexist?

46 The conflict (frustration) is resolved through INTERFACES
Interface width: Infinitely fast chemistry (Da to infinity)

47 Logistic equation: population growth
Capacity:

48 ADR Equation: analytics
For the ideal case U=const and Chemical reactions Select the unstable modes (morphogenesis) Large scales grow: k<sqrt(r/D) Small scale decay: k>sqrt(r/D)

49 ADR: Centered-Euler Three CFL’s:

50 Cell dim-less groups Peclet=Advection/Diffusion
Large Peclet stand for strong diffusion vs weak advection (microscopic transport) Damkohler=Reaction/Diffusion CFL: At the mesh-size scales the dimensionless number should not exceed O(1)

51 A nice research project
Can yield quite complex behavior: Show movie of bacterial growth Growth up to a/b Decay to zero, extinction Random a(x) with <a> <0 but fluctuations with a(x)>o; Islands of growth (oasis) surrounded by an ocean of decay (desert). Q: Probability of survival? Show movies!

52 Boundary Conditions They strongly affect the solutions: BC select
the bulk solutions compatible with the environmental constraints

53 Boundary Conditions: Dirichlet
With explicit methods (present depends on past only) easy: Dirichlet: Bulk: j=2,N-1 Boundaries: j=1, j=N are taken by the BC specification: The bulk gives a (N-2)x(N-2) matrix:

54 Boundary Conditions: periodic
1 N

55 Full stability analysis (incl. Boundary)
Find the numerical eigenvalues of the Transfer matrix For tridiagonal systems the eigenvalues are known analytically. For instance Diffusion Matrix {1,-2,1} gives In general, however, they must be found via numerical Eigenvalue solvers.

56 Assignements 1. Write a computer program to solve the 1d ADR with
constant coefficients (periodic boundaries) 2. Same in 2D 3. Same in 3D (for the brave) 4. Include heterogenoeus reactions

57 End of the lecture


Download ppt "AC274: Finite Differences for Classical Fields"

Similar presentations


Ads by Google