To make progress on this problem, we need first to develop a mathematical model of what's going on, and then apply a numerical method to approximate the solution to that mathematical model.

- We assume the brats are perfect cylinders, and that the shape doesn't change as they're cooked.
- We assume the meat is a homogeneous material; i.e., all its important physical properties are the same throughout the meat, and don't vary with time or temperature.
- We assume the brat is done if the minimum temperature throughout
the meat is greater than some given value
`T`._{done} - We assume that the brats are rolled continuously at a constant
speed over the grill;
the speed of revolution is
`T`for one revolution of the brat._{roll}

Basic heat-flow modeling tells us that the following PDE must be true at each point in time and space:

`
u _{t} = alpha^{2} * u_{xx},
`

where the subscripts indicate partial derivatives,
and alpha is the *diffusion coefficient*.

In order to find a unique solution `u(x,t)` to this problem we need to
specify *initial* and *boundary* conditions. In this
case, the initial condition is simply `u(x,0) = T _{init}`.
The boundary condition on the left endpoint
is

`
u _{x}(R,t) = C * (T_{ext}(t) - u(R,t)),
`

`
T _{ext}(t) = T_{ave} + T_{diff} *
cos(2*pi*t/T_{roll})
`

where

`
T _{ave} = (T_{grill} + T_{room}) / 2`

T_{diff} = (T_{grill} - T_{room}) / 2

This leaves us with several more constants that need values.
Below are some reasonable choices. These are scaled so that time is in
**minutes**,
distance is in centimeters,
and temperature is in degrees C.

`
alpha = 1.236
T _{init} = -4.0
T_{grill} = 220.
T_{room} = 40.
T_{done} = 90.
T_{roll} = .2
C = 0.105 / 0.452 = (heat exchange coefficient) / (thermal conductivity)
`

So what we need to do is modify the *parabolic2* code
to reflect our boundary conditions.
This means to add two equations and two unknowns: the equations
corresponding to our boundary conditions, and the unknowns
corresponding to the temperature at the left and right endpoints.
It also means that the equations corresponding to points 1
and n-1 need to be modified to include terms involving unknown
values at point 0 (the left end) and point n (the right end),
respectively.

We need some discrete equations to approximate the boundary conditions:

- The boundary condition on the left is
`u`. A simple discrete approximation to this is_{x}(0,t)=0

`(u(h,t) - u(0,t))/h = 0`or equivalently,`u(0,t) - u(h,t) = 0`. - The boundary condition on the right is
`u`, where_{x}(R,t) = C * (T_{ext}(t) - u(R,t))`C`and`T`are defined above. A discrete approximation to this equation is_{ext}(t)

`(u(R,t)-u(R-h,t)/h + C * u(R,t) = C * T`,_{ext}(t)

or equivalently,

`(1 + h*C) * u(R,t) - u(R-h,t) = h*C*T`._{ext}(t)