Computational Physics (Lecture 13)

Slides:



Advertisements
Similar presentations
TNPL JoongJin-Cho Runge-kutta’s method of order 4.
Advertisements

Differential Equations
Quantum One: Lecture 5a. Normalization Conditions for Free Particle Eigenstates.
Quantum One: Lecture 4. Schrödinger's Wave Mechanics for a Free Quantum Particle.
Lecture 13 2 nd order partial differential equations Remember Phils Problems and your notes = everything Only.
Ordinary Differential Equations
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
PART 7 Ordinary Differential Equations ODEs
Presented by Andrey Kuzmin Mathematical aspects of mechanical systems eigentones Department of Applied Mathematics.
Lecture 7 Exact solutions
Differential Equations and Boundary Value Problems
III Solution of pde’s using variational principles
CHAPTER 8 APPROXIMATE SOLUTIONS THE INTEGRAL METHOD
Lecture 2 Differential equations
Boyce/DiPrima 10th ed, Ch 10.5: Separation of Variables; Heat Conduction in a Rod Elementary Differential Equations and Boundary Value Problems, 10th.
Ch 9 pages ; Lecture 21 – Schrodinger’s equation.
COMPUTATIONAL MODELING FOR ENGINEERING MECN 6040 Professor: Dr. Omar E. Meza Castillo Department.
9.6 Other Heat Conduction Problems
Partial Differential Equations Introduction –Adam Zornes, Deng Li Discretization Methods –Chunfang Chen, Danny Thorne, Adam Zornes.
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
Ch 9 pages Lecture 23 – The Hydrogen Atom.
Math 231: Differential Equations Set 1: Basic Ideas Notes abridged from the Power Point Notes of Dr. Richard Rubin.
PSOD Lecture 2. Matrices and vectors in Chemical & Process Engineering Appear in calculations when process is described by the system of equations:
Numerical Methods for Solving ODEs Euler Method. Ordinary Differential Equations  A differential equation is an equation in which includes derivatives.
Separation of Variables Method of separation of variables is one of the most widely used techniques to solve PDE. It is based on the assumption that the.
Lecture 15 Solving the time dependent Schrödinger equation
The Quantum Theory of Atoms and Molecules The Schrödinger equation and how to use wavefunctions Dr Grant Ritchie.
Time-dependent Schrodinger Equation Numerical solution of the time-independent equation is straightforward constant energy solutions do not require us.
Engineering Analysis – Computational Fluid Dynamics –
Jump to first page Chapter 3 Splines Definition (3.1) : Given a function f defined on [a, b] and a set of numbers, a = x 0 < x 1 < x 2 < ……. < x n = b,
Ch 10.6: Other Heat Conduction Problems
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 27.
Boundary-Value Problems in Rectangular Coordinates
Differential Equations
Computational Physics (Lecture 4) PHY4370. Random Variable, density function and distribution function.
An equation for matter waves Seem to need an equation that involves the first derivative in time, but the second derivative in space As before try solution.
Computational Physics (Lecture 13) PHY4061. Recap of last lecture: Boundary-value and eigenvalue problems A typical boundary-value problem in physics.
Computational Physics (Lecture 11) PHY4061. Variation quantum Monte Carlo the approximate solution of the Hamiltonian Time Independent many-body Schrodinger’s.
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
Ch. 12 Partial Differential Equations
Differential Equations
Computational Physics (Lecture 12) PHY4370. The Euler and Picard methods Numerically, we can rewrite the velocity as: Here, i is the ith time step. Let.
Computational Physics (Lecture 14) PHY4061. What happens if the string is not light, and/or carries a mass density ρ(x) that is not a constant? This is.
Computational Physics (Lecture 15) PHY4370. The essence : – discretization of the continuous variables, – the spatial coordinates and time. Rectangular.
The Quantum Theory of Atoms and Molecules
Chapter 7. Classification and Prediction
Boundary-Value Problems in Rectangular Coordinates
Lecture 13 Contents Partial Differential Equations
Ch 10.1: Two-Point Boundary Value Problems
Computational Physics (Lecture 15)
Computational Physics (Lecture 12)
Computational Physics (Lecture 14)
Nodal Methods for Core Neutron Diffusion Calculations
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2, 27-1 CISE301_Topic8L4&5.
Quantum One.
Quantum One.
Quantum One.
Chapter 27.
Objective Numerical methods Finite volume.
Brief introduction to Partial Differential Equations (PDEs)
Numerical Analysis Lecture 37.
topic13_grid_generation
Numerical Analysis Lecture 38.
Simple introduction to quantum mechanics
All the way from Unit 1 to Unit 4
Boundary value problems:
Numerical Computation and Optimization
Lecture 13 Contents Partial Differential Equations
Boundary value problems workshop
Quantum One.
Presentation transcript:

Computational Physics (Lecture 13)

The shooting method A simple method for boundary and eigen value problems. First convert the second-order differential equation into two first-order differential equations by defining y1= u and y2= u’, assume that the boundary conditions are u(0) = u00 and u(1) = u11

The key is to make the problem look like an initial-value problem By introducing an adjustable parameter; the solution is then obtained by varying the parameter. u(0) is given already, we can make a guess for the first order derivative at x = 0, for example, u’(0) = α. α is the parameter to be adjusted

For a specific α, we can integrate the equation to x = 1 with any of the algorithms discussed earlier for initial-value problems. Because the initial choice of α can hardly be the actual derivative at x = 0, the value of the function uα(1), resulting from the integration with u’(0) = α to x = 1, would not be the same as u1.

The idea of the shooting method is to use one of the root search algorithms to find the appropriate α that ensures f (α) = uα(1) − u1 = 0 within a given tolerance δ.

An actual numerical example to illustrate the scheme. Assume that we want to solve the differential equation u’’ = − π2 (u+1)/4 boundary conditions u(0) = 0 and u(1) = 1. Define the new variables: y1= u and y2= u’ dy1/dx = y2, dy2/dx= − π2(y1+ 1) / 4.

Now assume that this equation set has the initial values y1(0) = 0 and y2(0) = α. Here α is a parameter to be adjusted in order to have f (α) = uα(1) − 1 = 0. We can combine the secant method for the root search and the fourth-order Runge–Kutta method for initial-value problems to solve the above equation set.

// An example of solving a boundary-value problem via // the shooting method. The Runge-Kutta and secant // methods are used for integration and root search. import java.lang.*; public class Shooting { static final int n = 100, ni=10, m = 5; static final double h = 1.0/n; public static void main(String argv[]) { double del = 1e-6, alpha0 = 1, dalpha = 0.01; double y1[] = new double [n+1]; double y2[] = new double [n+1]; double y[] = new double [2]; // Search for the proper solution of the equation y1[0] = y[0] = 0; y2[0] = y[1] = secant(ni, del, alpha0, dalpha); for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y1[i+1] = y[0]; y2[i+1] = y[1]; } // Output the result in every m points for (int i=0; i<=n; i+=m) System.out.println(y1[i]); public static double secant(int n, double del, double x, double dx) {...} // Method to provide the function for the root search. public static double f(double x) {

double y[] = new double[2]; y[1] = x; for (int i=0; i<n-1; ++i) { double xi = h*i; y = rungeKutta(y, xi, h); } return y[0]-1; public static double[] rungeKutta(double y[], double t, double dt) {...} // Method to provide the generalized velocity vector. public static double[] g(double y[], double t) { int k = y.length; double v[] = new double[k]; v[0] = y[1]; v[1] = -Math.PI*Math.PI*(y[0]+1)/4; return v;

The boundary value problem solved in the above program can also be solved exactly with an analytical solution u(x) = cos(πx/2)+ 2 sin(πx/2)− 1. Note that the shooting method provides a very accurate solution of the boundary-value problem. It is also a very general method for both the boundary-value and eigenvalue problems.

Boundary-value problems with other types of boundary conditions can be solved in a similar manner. For example, if u’(0) = v0 and u(1) = u1 are given, we can make a guess of u(0) = α and then integrate the equation set of y1 and y2 to x = 1. The root to be sought is from f (α) = uα(1) − u1 = 0. Here uα (1) is the numerical result of the equation with u(0) = α. If u(1) = v1 is given, the equation f (α) = uα’(1) − v1 = 0 is solved.

To apply the shooting method to an eigenvalue problem, the parameter to be adjusted is no longer a parameter introduced but the eigenvalue of the problem. For example, if u(0) = u0 and u(1) = u1, we can integrate the equation with u’(0) = α, a small quantity. Then we search for the root of f (λ) = uλ(1) − u1 = 0 by varying λ. When f (λ) = 0 is satisfied, we obtain an approximate eigenvalue λ and the corresponding eigenstate from the normalized solution of uλ(x). The introduced parameter α is not relevant here, because it will be automatically modified to be the first-order derivative when the solution is normalized. In other words, we can choose the first-order derivative at the boundary arbitrarily and it will be adjusted to an appropriate value when the solutions are made orthonormal.

Linear equations Many eigenvalue or boundary-value problems are in the form of linear equations u’’ + d(x)u’ + q(x)u = s(x), where d(x), q(x), and s(x) are functions of x. Assume that the boundary conditions are u(0) = u0 and u(1) = u1. If all d(x), q(x), and s(x) are smooth, we can solve the equation with the shooting method. How?

We need only two trial solutions uα0 (x) and uα1 (x), an extensive search for the parameter α from f (α) = uα(1) − u1 = 0 is unnecessary in this case because of the principle of superposition of linear equations any linear combination of the solutions is also a solution of the equation We need only two trial solutions uα0 (x) and uα1 (x), where α0 and α1 are two different parameters. The correct solution of the equation is given by u(x) = auα0 (x) + buα1 (x), where a and b are determined from u(0) = u0 and u(1) = u1. Note that uα0 (0) =uα1 (0) = u(0) = u0. a + b = 1, uα0 (1)a + uα1 (1)b = u1,

We have:

// An example of solving the boundary-value problem of // a linear equation via the Runge-Kutta method. import java.lang.*; public class LinearDEq { static final int n = 100, m = 5; public static void main(String argv[]) { double y1[] = new double [n+1]; double y2[] = new double [n+1]; double y[] = new double [2]; double h = 1.0/n; // Find the 1st solution via the Runge-Kutta method y[1] = 1; for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y1[i+1] = y[0]; } // Find the 2nd solution via the Runge-Kutta method y[0] = 0; y[1] = 2; for (int i=0; i<n; ++i) { double x = h*i; y = rungeKutta(y, x, h); y2[i+1] = y[0]; } // Superpose the two solutions found double a = (y2[n]-1)/(y2[n]-y1[n]); double b = (1-y1[n])/(y2[n]-y1[n]); for (int i=0; i<=n; ++i) y1[i] = a*y1[i]+b*y2[i]; // Output the result in every m points for (int i=0; i<=n; i+=m) System.out.println(y1[i]); public static double[] rungeKutta(double y[], double t, double dt) {...} public static double[] g(double y[], double t) {...}

Partial differential equations Partial differential equations in physics In this chapter, we discuss numerical schemes for solving partial differential equations. Several types of partial differential equations in physics. The Poisson equation:∇2 Φ(r) = −ρ(r)/ε for the electrostatic potential Φ (r) at the position r under the given charge distribution ρ(r) is a typical elliptic equation.

The diffusion equation ∂n(r, t)/∂t−∇· [D(r)∇n(r, t)] = S(r, t) for the concentration n(r, t) at the position r and time t under the given source S(r, t) is a typical parabolic equation. Here D(r) is the diffusion coefficient at the position r.

The Wave equation: for the generalized displacement u(r, t) at the position r and time t under the given source R(r, t) is a typical hyperbolic equation.

The time-dependent Schrodinger equation: for the wavefunction Ψ(r, t) of a quantum system defined by the Hamiltonian H, can be viewed as a diffusion equation under imaginary time.

All the equations are linear if the sources and other quantities in the equations are not related to the solutions. There are also nonlinear equations in physics that rely heavily on numerical solutions. For example, the equations for fluid dynamics.

Separation of variables In many cases, using a combination of the separation of variables and a numerical scheme increases the speed of computing and the accuracy of the solution. The combination of analytic and numerical methods becomes critical in cases where the memory and speed of the available computing resources are limited.

Each variable (time or one of the spatial coordinates) is isolated from the rest, and the solutions of the resulting ordinary differential equations for all the variables are obtained before they are combined into the general solution of the original partial differential equation. Boundary and initial conditions are then used to determine the unknown parameters left in the solution, which usually appear as the coefficients or eigenvalues.

Consider first the standing waves on a light, uniform string that has both ends (x = 0 and x = L) fixed. The wave equation is where u(x, t) is the displacement of the string at the location x and time t, and c =√(T/ρ) is the phase speed of the wave, with T being the tension on the string and ρ the linear mass density of the string.

The boundary condition for fixed ends is u(0, t) = u(L, t) = 0 in this case. If we assume that the solution is given by u(x, t) = X(x)Θ(t),

Note that the introduced parameter (eigenvalue) ω must be independent of the position from the first ratio and independent of the time from the second ratio. we must have where k = ω/c is determined from the boundary condition X(0) = 0 and X(L) = 0.

The two independent, analytical solutions are sin kx and cos kx. We can view either ω or k as being the eigenvalue sought for the eigenvalue problem under the given boundary condition. The two independent, analytical solutions are sin kx and cos kx. Then we have X(x) = A sin kx + B cos kx. From the boundary condition X(0) = 0, we must have B = 0; from X(L) = 0, we must have kn = nπ/L with n = 1, 2, . . . ,∞. Using this kn in the equation for Θ(t), we obtain Θ(t) = C sin ωn x + D cos ωn x, With ωn = ckn = nπc/L Combining the solutions for X(x) and Θ(t), we obtain the general solution where an and bn are two sets of parameters that are determined by the initial displacement u(x, 0) = u0(x) and the initial velocity ∂u(x, t)/∂t = v0(x) when t=0.

Using t = 0 for u(x, t) and its partial derivative of time, we have: