10.34, Numerical Methods Applied to Chemical Engineering Professor William H. Green Lecture #18: Optimization. Sensitivity Analysis. Introduction: Boundary Value Problems (BVPs). Summary: Optimization with Constraints minx f(x) such that cm(x) - sm = 0 sm ≥ 0 m = 1 … Ninequalities 2 minx f(x) + ξ(c-s) sm = 0 m > Ninequalities penalty method, second term ξ(c-s)2 is optional KKT conditions: at constrained (local) minimum: Augmented Vxf – Σm(λm Vxcm) = 0 Æ Lagrangian cm – sm = 0 (LA) λmcm = 0 {see book} sm ≥ 0 m = 1 … Ninequalities sm = 0 equalities ⎛ ∇f − ∑ λ m ∇ c m ⎞ ⎜ ⎟ cm − sm ⎜ ⎟ F ( x) = 0 = ⎜ ⎟ λm cm ⎜ ⎟ ⎜ ⎟ s m ⎝ ⎠ ⎛c⎞ ⎜ ⎟ x = ⎜λ ⎟ ⎜s⎟ ⎝ ⎠ Newton Æ SQP If everything is linear: Æ SIMPLEX (i.e. many business problems) g(x) = 0 Æ xN = G(x1, …, xN-1) Unconstrained Æ trust region Newton-type BFGS gigantic Æ conjugate gradient In Chemical Engineering, the problems often involve models with differential equations: cost f(x) = ∑ w (Y (t i i o return ; x) − Yi (t f ; x) ) i knobs what we need what we produce (can adjust) feed composition Need Jacobian of G with respect to Y; need in stiff solver to solve. dY = G (Y ; x) dt Y (t 0 ) = Y 0 ( x) Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month YYYY]. Need gradient and f. To use all of our methods, we need to be able to compute: ⎛ ∂Yσ ,i ∂Yi (t f ) ⎞ ∂f ⎟ = ∑ wi ⎜ − ⎜ ∂x ⎟ ∂x j ∂ x i j j ⎝ ⎠ how do you compute this? ∂ ⎛ ∂Yi ⎞ ⎛⎜ ∂G ∂Yn ⎞⎟ ∂Gi + ⎜ ⎟ = ⎜∑ ∂x j ⎝ ∂t ⎠ ⎝ n ∂Yn ∂x j ⎟⎠ ∂x j {“sensitivity of Yi(tf) to xj”} chain rule ∂ ⎛⎜ ∂Yi ∂t ⎜⎝ ∂x j ⎞ ⎟ ⎟ ⎠ sij ⎛ ∂G ⎞ ∂G d sij = ⎜⎜ ∑ i s nj ⎟⎟ + i dt ⎝ n ∂Yn ⎠ ∂x j Î Vf (for every x we get an Vf that can be used for optimization) solve this with initial conditions {Jacobian of G} J Have n2 differential equations; stiff; linear in s. Sensitivity Analysis Programs to do this: DASPK SOLVE for s and f simultaneously DAEPACK DSL485 DASAC ⎛ ∂G ⎞ ∂G d sij = ⎜⎜ ∑ i s nj ⎟⎟ + i dt ⎝ n ∂Yn ⎠ ∂x j Initial Conditions What is sji(t0)? sji(t0) = 0 {most knobs} sji(t0) = 1 {for adjustment of Y0} Professor Barton teaches an advanced course in optimization. 10.34, Numerical Methods Applied to Chemical Engineering Prof. William Green Lecture 18 Page 2 of 4 Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month YYYY]. Boundary Value Problems (BVPs) Conservation Laws: ∂φ /∂t = -V·(φv) - V·JD + S(φ) convection diffusion reaction JD = Γ+Vφ isotropic: JD = -cVφ for steady-state, isotropic: 0 = -V·(φv) - cV2φ + S(φ) ∀x Laplacian Boundary conditions: Dirichlet φ(boundary) = number von Neumann Vφ(boundary) = number or 0 Symmetry ∂φ =0 ∂x j φ(x) infinite {rare to find exact} adjust: large finite number (104) φapprox(x) = f(x; c) N basis Basis function expansions φapprox = ∑ c Ψ ( x) n =1 n n ( ∫ m =1, N basis ) Ψm ( x) − ∇ ⋅ (φ approx v) + c∇ 2φ approx + s (φ approx ) = 0 ℜ ( x ,φapprox ,c ) B .C . ( x) = f ( x;{φi }) φ approx φ approx ( xi ) called “Residual” {xi } = mesh grid some interpolation Finite difference approximation to differential equation Dirichlet φ(boundary) ∂φ ∂x = x1 φ2 − φ0 x2 − x0 ∂φ ∂x ≈ xi φi +1 − φi −1 xi +1 − xi −1 State how you did approximation because there are many ways to do it {φ} i = 1,N φ B .C . von Neumann 10.34, Numerical Methods Applied to Chemical Engineering Prof. William Green Lecture 18 Page 3 of 4 Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month YYYY]. ∂φ ∂x Usual Æ 2nd order polynomials given φ0? x0 ∂φ φ ( x) = φ ( x 0 ) + ∂x unknown ∂φ ∂x φ 0 = f (φ1 , φ 2 ) φ ( x1 ) = φ 0 + φ ( x2 ) = φ0 + ∂φ ∂x ∂φ ∂x known = x0 unknown φ 2 − f (φ1 , φ 2 ) x 2 − x0 x1 ( x1 − x 0 ) + x0 ( x 2 − x0 ) + x0 φ0 = ( x − x0 ) 2 9 9 ( x 2 − x0 ) 2 − φ2 φ1 ( x1 − x0 ) 2 φ0 = ( x2 − x0 ) 2 −1 ( x1 − x0 ) 2 If Δx uniform, 1 ∂ 2φ ( x − x0 ) + 2 ∂x 2 x0 1 ∂ 2φ 2 ∂x 2 1 ∂ 2φ 2 ∂x 2 for ( x1 − x0 ) 2 ... x0 ( x 2 − x 0 ) 2 ... x0 ∂φ ∂x =0 x0 4φ1 − φ 2 3 This is how you find out B.C. with second order polynomial schemes and a finite difference approximation. 10.34, Numerical Methods Applied to Chemical Engineering Prof. William Green Lecture 18 Page 4 of 4 Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu), Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].