Presentation is loading. Please wait.

Presentation is loading. Please wait.

Courant and all that Consistency, Convergence Stability Numerical Dispersion Computational grids and numerical anisotropy The goal of this lecture is to.

Similar presentations


Presentation on theme: "Courant and all that Consistency, Convergence Stability Numerical Dispersion Computational grids and numerical anisotropy The goal of this lecture is to."— Presentation transcript:

1 Courant and all that Consistency, Convergence Stability Numerical Dispersion Computational grids and numerical anisotropy The goal of this lecture is to understand how to find suitable parameters (i.e., grid spacing dx and time increment dt) for a numerical simulation and knowing what can go wrong. 1

2 Courant and all that A simple example: Newtonian Cooling Numerical solution to first order ordinary differential equation We can not simply integrate this equation. We have to solve it numerically! First we need to discretise time: and for Temperature T

3 Courant and all that A finite-difference approximation Let us try a forward difference:... which leads to the following explicit scheme : This allows us to calculate the Temperature T as a function of time and the forcing inhomogeneity f(T,t). Note that there will be an error O(dt) which will accumulate over time.

4 Courant and all that Coffee? Lets try to apply this to the Newtonian cooling problem: T Air T Cappucino How does the temperature of the liquid evolve as a function of time and temperature difference to the air?

5 Courant and all that Newtonian Cooling The rate of cooling (dT/dt) will depend on the temperature difference (T cap -T air ) and some constant (thermal conductivity). This is called Newtonian Cooling. With T= T cap -T air being the temperature difference and the time scale of cooling then f(T,t)=-T/ and the differential equation describing the system is with initial condition T=T i at t=0 and >0.

6 Courant and all that Analytical solution This equation has a simple analytical solution: How good is our finite-difference appoximation? For what choices of dt will we obtain a stable solution? Our FD approximation is:

7 Courant and all that FD Algorithm 1. Does this equation approximation converge for dt -> 0? 2. Does it behave like the analytical solution? With the initial condition T=T 0 at t=0: leading to :

8 Courant and all that Understanding the numerical approximation Let us use dt=t j /j where t j is the total time up to time step j: This can be expanded using the binomial theorem

9 Courant and all that... where we are interested in the case that dt-> 0 which is equivalent to j-> as a result

10 Courant and all that substituted into the series for T j we obtain: which leads to... which is the Taylor expansion for

11 Courant and all that So we conclude: For the Newtonian Cooling problem, the numerical solution converges to the exact solution when the time step dt gets smaller. How does the numerical solution behave? The analytical solution decays monotonically! What are the conditions so that T j+1 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/1/648699/slides/slide_11.jpg", "name": "Courant and all that So we conclude: For the Newtonian Cooling problem, the numerical solution converges to the exact solution when the time step dt gets smaller.", "description": "How does the numerical solution behave. The analytical solution decays monotonically. What are the conditions so that T j+1

12 Courant and all that Convergence Convergence means that if we decrease time and/or space increment in our numerical algorithm we get closer to the true solution.

13 Courant and all that Stability T j+1 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/1/648699/slides/slide_13.jpg", "name": "Courant and all that Stability T j+1

14 Courant and all that if then the solution oscillates but converges as |1-dt/ |<1 if then 1-dt/ <-1 and the solution oscillates and diverges... now let us see how the solution looks like....

15 Courant and all that Matlab solution % Matlab Program - Newtonian Cooling % initialise values nt=10; t0=1. tau=.7; dt=1. % initial condition T=t0; % time extrapolation for i=1:nt, T(i+1)=T(i)-dt/tau*T(i); end % plotting plot(T)

16 Courant and all that Example 1 Blue – numerical Red - analytical

17 Courant and all that Example 2 Blue – numerical Red - analytical

18 Courant and all that Example 3 Blue – numerical Red - analytical

19 Courant and all that Example 4 Blue – numerical Red - analytical

20 Courant and all that Stability Stability of a numerical algorithm means that the numerical solution does not tend to infinite (or zero) while the true solution is finite. In many case we obtain algoriths with conditional stability. That means that the solution is stable for values in well-defined intervals.

21 Courant and all that Grid anisotropy In which direction is the solution most accurate and why?

22 Courant and all that Grid anisotropy with ac2d.m

23 Courant and all that … and more … a Greens function …

24 Courant and all that Grids Cubed sphere Hexahedral grid Spectral element implementation Tetrahedral grid Discontinuous Galerkin method

25 Courant and all that Grid anisotropy

26 Courant and all that Grid anisotropy Grid anisotropy is the directional dependence of the accuracy of your numerical solution if you do not use enough points per wavelength. Grid anisotropy depends on the actual grid you are using. Cubic grids display anisotropy, hexagonal grids in 2D do not. In 3D there are no grid with isotropic properties! Numerical solutions on unstructured grids usually do not have this problem because of averaging effects, but they need more points per wavelength!

27 Courant and all that Real problems 36 km 30 km Alluvial Basin V S = 300m/s f max = 3Hz min = V S /f max = 100m Bedrock V S = 3200m/s f max = 3Hz min = V S /f max = 1066.7m

28 Courant and all that Hexahedral Grid Generation

29 Courant and all that Courant … Largest velocity Smallest grid size Time step

30 Courant and all that Courant and all that … - Summary Any numerical solution has to be checked if it converges to the correct solution (as we have seen there are different options when using FD and not all do converge!) The number of grid points per wavelength is a central concept to all numerical solutions to wave like problems. This desired frequency for a simulation imposes the necessary space increment. The Courant criterion, the smallest grid increment and the largest velocity determine the (global or local) time step of the simulation Examples on the exercise sheet.


Download ppt "Courant and all that Consistency, Convergence Stability Numerical Dispersion Computational grids and numerical anisotropy The goal of this lecture is to."

Similar presentations


Ads by Google