TP1

1. Solving the heat equation in a thermal fin

We consider the problem of designing a thermal fin to effectively remove heat from a surface. The two-dimensional fin, shown in Figure #fig:1[1], consists of a vertical central “post” and four horizontal “subfins”; the fin conducts heat from a prescribed uniform flux “source” at the root, \(\Gamma_{\mathrm{root}}\) , through the large-surface-area subfins to surrounding flowing air. The fin is characterized by a five-component parameter vector, or “input,” \(\mu_ = (\mu_1 , \mu_2, \ldots, \mu_5 )\),where \(\mu_i = k^i , i = 1, \ldots , 4\), and \(\mu_5 = \mathrm{Bi}\); \(\mu\) may take on any value in a specified design set \(D \subset \mathbb{R}^5\).

./media/fin
Figure 1. Thermal fin

Here \(k^i\) is the thermal conductivity of the ith subfin (normalized relative to the post conductivity \(k^0 \equiv 1\)); and \(\mathrm{Bi}\) is the Biot number, a nondimensional heat transfer coefficient reflecting convective transport to the air at the fin surfaces (larger \(\mathrm{Bi}\) means better heat transfer). For example, suppose we choose a thermal fin with \(k^1 = 0.4, k^2 = 0.6, k^3 = 0.8, k^4 = 1.2\), and \(\mathrm{Bi} = 0.1\); for this particular configuration \(\mu = \{0.4, 0.6, 0.8, 1.2, 0.1\}\), which corresponds to a single point in the set of all possible configurations D (the parameter or design set). The post is of width unity and height four; the subfins are of fixed thickness \(t = 0.25\) and length \(L = 2.5\).

We are interested in the design of this thermal fin, and we thus need to look at certain outputs or cost-functionals of the temperature as a function of \(\mu\). We choose for our output \(T_{\mathrm{root}}\), the average steady-state temperature of the fin root normalized by the prescribed heat flux into the fin root. The particular output chosen relates directly to the cooling efficiency of the fin — lower values of \(T_{\mathrm{root}}\) imply better thermal performance. The steady–state temperature distribution within the fin, \(u(\mu)\), is governed by the elliptic partial differential equation

\[\label{eq:1} -k^i \Delta u^i = 0 \text{ in } \Omega^i , i = 0, \ldots, 4,\]

where \(\Delta\) is the Laplacian operator, and \(u_i\) refers to the restriction of \(u \text{ to } \Omega^i\) . Here \(\Omega^i\) is the region of the fin with conductivity \(k^i , i = 0,\ldots, 4: \Omega^0\) is thus the central post, and \(\Omega^i , i = 1,\ldots, 4\), corresponds to the four subfins. The entire fin domain is denoted \(\Omega (\bar{\Omega} = \cup_{i=0}^4 \bar{\Omega}^i )\); the boundary \(\Omega\) is denoted \(\Gamma\). We must also ensure continuity of temperature and heat flux at the conductivity– discontinuity interfaces \(\Gamma^i_{int} \equiv \partial\Omega^0 \cap \partial\Omega^i , i = 1,\ldots, 4\), where \(\partial\Omega^i\) denotes the boundary of \(\Omega^i\), we have on \(\Gamma^i_{int} i = 1,\ldots, 4\) :

\[\begin{aligned} u^0 &= u^i \\ -(\nabla u^0 \cdot n^i ) &= -k^i (\nabla u^i \cdot n^i ) \end{aligned}\]

here \(n^i\) is the outward normal on \(\partial\Omega^i\) . Finally, we introduce a Neumann flux boundary condition on the fin root

\[-(\nabla u^0 \cdot n^0 ) = -1 \text{ on } \Gamma_{\mathrm{root}} ,\]

which models the heat source; and a Robin boundary condition

\[-k^i (\nabla u^i \cdot n^i ) = \mathrm{Bi} u^i \text{ on } \Gamma^i_{ext} , i = 0,\ldots, 4,\]

which models the convective heat losses. Here \(\Gamma^i_{ext}\) is that part of the boundary of \(\Omega^i\) exposed to the flowing fluid; note that \(\cup_{i=0}^4 \Gamma^i_{ext} = \Gamma\backslash\Gamma_{\mathrm{root}}\). The average temperature at the root, \(T_{\mathrm{root}} (\mu)\), can then be expressed as \(\ell^O(u(\mu))\), where

\[\ell^O (v) = \int_{\Gamma_{\mathrm{root}}} v\]

(recall \(\Gamma_{\mathrm{root}}\) is of length unity). Note that \(\ell(v) = \ell^O(v)\) for this problem.

1.1. Implement the Finite element discretization

You will find here a set of files allowing you to generate the data for Feel++. The documentation is here

  1. Verify that the generated files solve the problem above.

  2. Solve the problem using the toolbox heat feelpp_toolbox_heat first

  3. Visualize the solution in paraview.

  4. Solve using the equivalent in Python, the following test gives you a starting point

  5. Visualize the solution in paraview.

  6. Modify the Python script in order to be able to modify the Biot number \(Bi\) and make it a parameter, consider \(Bi \in ]0.01,1[\), sample the interval with 10 values and use them to compute the solution, compute the output and plot the output using plotly`.

  7. Do the same for the conductivities \(k_i\)

Now you have a parametrized finite element code with \(\mu = (k_1,k_2,k_3,k_4,Bi)\).

1.2. Create a graphical user interface (gui_)

We are now ready to create an graphical interface that would plot the output with respect to \(\mu\).

Using dash, create a graphical interface that allows you to..:

  1. submit a parameter set \(\mu\) to the finite element solver

  2. display the output of finite element calculations in a text block

  3. Add the possibility to accumulate in a table in your gui a table showing the parameter and corresponding value of the output

  4. add the possibility to vary one parameter over an interval and plot the graph of the output when you vary one of the parameter

1.3. Package your application

We are now ready to package the application with the gui.

Using Docker, package the application

  1. install all relevant Python libraries necessary for the application

  2. generate a docker image feelpp-gui:<your name> where your name is used are the tag to identify your app

  3. start your app by default on port 80

feelpp-gui.py
// your code feelpp-gui.py here
if __name__=='__main__':
    app.run_server(port=80)

and in the Dockerfile

CMD ["python3 feelpp-gui.py"]