$title Catalyst Mixing COPS 2.0 #14 (CATMIX,SEQ=242) $onText Determine the optimal mixing policy of two catalysts along the length of a tubular plug flow reactor involving several reactions. This model is from the COPS benchmarking suite. See http://www-unix.mcs.anl.gov/~more/cops/. The number of discretization points can be specified using the command line parameter --nh. COPS performance tests have been reported for nh = 100, 200, 400, 800 Dolan, E D, and More, J J, Benchmarking Optimization Software with COPS. Tech. rep., Mathematics and Computer Science Division, 2000. von Stryk, O, User's Guide for DIRCOL (Version 2.1): A Direct Collocation Method for the Numerical Solution of Optimal Control Problems. Tech. rep., Technische Universitt Mnchen, 1999. Keywords: nonlinear programming, chemical engineering, mixing policy $offText $if set n $set nh %n% $if not set nh $set nh 100 Set nh 'number of subintervals' / 0*%nh% /; Alias (nh,i); Scalar tf 'final time' / 1 / x1_0 'initial condition for x1' / 1 / x2_0 'initial condition for x2' / 0 / alpha 'smoothing parameter' / 0 / h; h = tf/%nh%; Variable u(nh) x1(nh) x2(nh) obj; Positive Variable u; u.up(nh) = 1; Equation defobj 'objective function' ode1(nh) ode2(nh); defobj.. obj =e= -1 + x1['%nh%'] + x2['%nh%'] + alpha*h*sum{nh(i+1), sqr(u[i+1] - u[i])}; ode1(nh(i+1)).. x1[i+1] =e= x1[i] + (h/2)*(u[i]*(10*x2[i]-x1[i]) + u[i+1]*(10*x2[i+1]-x1[i+1])); ode2(nh(i+1)).. x2[i+1] =e= x2[i] + (h/2)*(u[i]*(x1[i] - 10*x2[i]) - (1 - u[i])*x2[i] + u[i+1]*(x1[i+1] - 10*x2[i+1]) - (1 - u[i+1])*x2[i+1]); x1.l[nh] = 1; x1.fx['0'] = x1_0; x2.fx['0'] = x2_0; Model catmix / all /; $if set workSpace catmix.workSpace = %workSpace% solve catmix minimizing obj using nlp;