We consider the transient heat transfer problem across a slab of thickness 1 and conductivity `k=1` shown in
Example 1 of pde solver function `PDSOLVE`.
The slab is insulated at the right side, `x=1`, and is initially at 0 degrees. At time equals 0,
the left side of the slab, `x=0`, is brought to 100 degrees. The simulation
below shows that the right side of the slab reaches approximately 89.2 degrees after 1 second.

Our target temperature for the right side of the slab after 1 second is 75 degrees. In this exercise, we will compute the initial condition that will produce the target temperature.

We solve the heat equation for the following configuration

$$\frac{\partial u}{\partial t}=k\frac{{\partial}^{2}u}{\partial {x}^{2}}$$Time period | t ∈ [0,1] |
---|---|

Spatial range | 0 ≤ x ≤ 1 |

Parameter | k = 1 |

Initial condition | $u\left(x,0\right)=\left[\begin{array}{cc}100& x=0\\ 0& else\end{array}\right.$ |

Left boundary condition | $u\left(0,t\right)=100$ |

Right boundary condition | ${u}_{x}(1,t)=0$ |

To be able to control the initial value, we introduce a variable `p` with initial value
of 100 and define a parametrized initial value formula for `u`, and left boundary condition formula as shown in Table 1.
We obtain the initial solution, shown in Table 2, be evaluating the array formula
`=PDSOLVE(B8, B2:B6, C8,D8, {0,1}, {0,1,2})`

in array `G8:J30`.

A | B | C | D | |

1 | Variables with initial values | Parameters | ||
---|---|---|---|---|

2 | t | k | 1 | |

3 | x | p | 100 | |

4 | u | =IF(x=0,p,0) | ||

5 | ux | |||

6 | uxx | |||

7 | Equations | Left Bc | Right Bc | |

8 | du/dt | =k*uxx | =u-p | =ux |

G | H | I | J | |

8 | t | 0 | 0.5 | 1 |

9 | x | u | u | u |

10 | 0 | 100 | 100 | 100 |

11 | 0.05 | 0 | 97.09061 | 99.15264 |

12 | 0.1 | 0 | 94.19917 | 98.31051 |

13 | 0.15 | 0 | 91.34352 | 97.47881 |

14 | 0.2 | 0 | 88.54128 | 96.66268 |

15 | 0.25 | 0 | 85.80973 | 95.86714 |

16 | 0.3 | 0 | 83.16573 | 95.09712 |

17 | 0.35 | 0 | 80.62557 | 94.35736 |

18 | 0.4 | 0 | 78.20491 | 93.65242 |

19 | 0.45 | 0 | 75.91868 | 92.98665 |

20 | 0.5 | 0 | 73.78095 | 92.36414 |

21 | 0.55 | 0 | 71.8049 | 91.78874 |

22 | 0.6 | 0 | 70.00271 | 91.26397 |

23 | 0.65 | 0 | 68.38546 | 90.79306 |

24 | 0.7 | 0 | 66.96312 | 90.37892 |

25 | 0.75 | 0 | 65.74445 | 90.02409 |

26 | 0.8 | 0 | 64.73694 | 89.73074 |

27 | 0.85 | 0 | 63.94682 | 89.50069 |

28 | 0.9 | 0 | 63.37894 | 89.33534 |

29 | 0.95 | 0 | 63.03681 | 89.23573 |

30 | 1 | 0 | 62.92253 | 89.20245 |

Next, we define a simple constraint in `C1` which calculates the difference between the value of `J30` of Table 2 which corresponds to `u(1,1)`
and the target value of 75. To solve for the design variable `p`, we evaluate the formula `=NLSOLVE(C1, p)`

in cell `C2`.
The result shown in Table 3 indicates that the initial left surface temperature should be at approximately 84.0785 in order for the right side temperature to reach 75 in one second.

C | |

1 | =ARRAYVAL(J24)-75 |

2 | =NLSOLVE(C1,p) |

C | |

1 | 14.20224037 |

2 | 84.07859699 |

What is `ARRAYVAL`? `ARRAYVAL` is one of
the criterion functions that allow us to define dynamic constraints on the solution array.
In this case we are simply picking a value from the solution but in general, a criterion function can be used to specify more complex constraint on the solution.