 for $J_2[\mathbf{w}]$
\begin{equation}
    \frac{\partial J_2[\mathbf{w}]}{\partial w_j} = \sum^M_{i=1} (R[\mathbf{w}])_i \frac{\partial (T[\mathbf{w}])_i}{\partial w_j} + p_g (\mathbf{w}^T \pmb{\phi} - \hat{G})(\pmb{\phi})_j = 0,\quad \text{ for } j=1,2,\dots,M.
\end{equation}
Then, introducing the matrix in $\R^{M \times M}$ such that
\begin{equation}
    \Phi_{ij} = (\pmb{\phi})_i (\pmb{\phi})_j,
\end{equation}
we can write the critical point equation as
\begin{equation}
    (\Theta^T \Theta + p_g \Phi) \mathbf{w} = p_g \hat{G} \pmb{\phi} + \Theta^T(\mathbf{T}_{ad} + \hat{\mathbf{T}}).
    \label{eq:inverse_3DhcModelSteady_totalHeatFlux_paramBClinSys}
\end{equation}
By solving the linear system (\ref{eq:inverse_3DhcModelSteady_totalHeatFlux_paramBClinSys}) we obtain the weights $\mathbf{w}$ of the parameterization.
Then, by (\ref{eq:parametrizedHeatFlux}) we compute the estimated heat flux $g$.
Also in this setting, the discussion at the end of Section~\ref{sec:parameterizedBC_method} on the regularization of the linear system and the offline-online decomposition holds.














\section{Analytical Benchmark}\label{sec:analyticalBenchmark}

In this section, we propose an academic benchmark case.
It is a steady-state heat conduction problem in a homogeneous isotropic solid occupying a rectangular parallelepiped domain.
By carefully selecting the BCs on the faces of the parallelepiped, we are able to compute the analytical solution of the heat conduction problem.
Then, we use this academic test to validate the numerical solution of the direct problem.
Moreover, by arbitrarily selecting some temperature measurements points, we test the different inverse problem solution methodologies discussed in Section~\ref{sec:inverseProblem}.


Let the domain be  $\Omega = (0,L) \times (0,W) \times (0,H)$ as in Figure~\ref{fig:analyticalBenchmarkDomainSchematic} with positive real constants $L, W$ and $H$.
Let $\Gamma$ be boundary of $\Omega$.
Then, the different boundaries of the domain to be considered are
\begin{equation}
\begin{aligned}
    &\Gamma_{sf} :=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(x,W,z)\}, \quad && \Gamma_{s_{in}} :=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(x,0,z)\},\\
    &\Gamma_{I}  :=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(x,y,H)\}, \quad && \Gamma_{III}:=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(x,y,0)\},\\
    &\Gamma_{II} :=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(L,y,z)\}, \quad && \Gamma_{IV} :=\{\mathbf{x}\in\Gamma |\ \mathbf{x}=(0,y,z)\}.
\end{aligned}
\end{equation}

\begin{figure}[!htb]
\centering
\includegraphics[width=0.5\textwidth]{images/analyticalBenchmarkDomainSchematic.eps}
    \caption{Schematic of the solid rectangular parallelepiped domain.}
\label{fig:analyticalBenchmarkDomainSchematic}
\end{figure}


To have an analytical solution, $T_{an}$, in $\Omega$, we consider a slight modification of Problem~\ref{prob:3DhcModelSteady} that does not change its essential aspects.
\begin{problem}
  Find $T$ such that
  \begin{equation}
     - k \Delta T = 0, \text{ in }\Omega,
  \end{equation}
  with BCs
  \begin{numcases}{}
      -k \nabla T \cdot \mathbf{n} = g_{an}       &   on $\Gamma_{s_{in}}$,\label{eq:analyticalBenchmark_GammaInBC}\\
      -k \nabla T \cdot \mathbf{n} = q_{L}        &   on $\Gamma_{L}, L \in \{I, II, II,IV\}$,\\
      -k \nabla T \cdot \mathbf{n} = h(T - T_f) &   on $\Gamma_{sf}$.
  \end{numcases}
  \label{prob:analyticalBenchmark}
\end{problem}


Let $a$, $b$, $c$ be real constants.
To have an analytical solution in $\Omega$, we consider the following data as BCs for Problem~\ref{prob:analyticalBenchmark},
\begin{equation}
  \begin{aligned}
      &q_{I}  (\mathbf{x})     = 2 k a H,           \quad && q_{III}(\mathbf{x}) = 0,\\
      &q_{II} (\mathbf{x})     = -k ( 2 a L + b y), \quad && q_{IV} (\mathbf{x}) = k b y, \\
      &T_f    (\mathbf{x})     =\frac{k (b x + c)}{h} + a x^2 + c y - a z^2 + b x W + c, 
  \end{aligned}
\end{equation}
with
\begin{equation}
    g_{an} (\mathbf{x}) = k (b x + c),
    \label{eq:analyticalHeatFlux}
\end{equation}
$k$ being the thermal considered conductivity, that is assumed constant.
Then,
\begin{equation}
    T_{an}(\mathbf{x})= a x^2+ b x y + c y - a z^2 + c,
  \label{eq:analyticalBenchmark_analyticalSolution}
\end{equation}
is the solution to Problem~\ref{prob:analyticalBenchmark}.


\subsection{Direct Problem}

We now discuss the numerical solution of Problem~\ref{prob:analyticalBenchmark}.
Due to its simplicity, the domain $\Omega$ is discretized by uniform, structured, orthogonal, hexahedral  meshes.
To study the convergence of the numerical solution to the analytical one, we consider grids with different degree of refinement.
In all tests, we use the same number of edges for the three axes.

With respect to the used finite volume scheme, since we have a structured orthogonal grid, no correction is needed when computing the gradient normal to the cells faces.
Moreover, we use linear interpolation to interpolate the values from cell centers to face centers. 
The resulting scheme is second order accurate.

From the discretization of Problem~\ref{prob:analyticalBenchmark}, we obtain a linear system.
We solve it by using the preconditioned conjugate gradient solver with diagonal incomplete Cholesky preconditioning.
The tolerance used for the linear system solver is $10^{-12}$.
All the computations are performed in ITHACA-FV\cite{Stabile2017,ithaca} which is a C++ library based on OpenFOAM\cite{Moukalled2015} developed at the SISSA Mathlab.


Finally, Table~\ref{tab:analyticalBenchmark_parameters} summarizes the parameters used for the computations. 

\begin{table}[!htb]
    \centering
    \caption{Parameters used for the simulation of the analytical benchmark.}
    \label{tab:analyticalBenchmark_parameters}
    \begin{tabular}{ ll }
        \hline
        \textbf{Parameter}    &   \textbf{Value}\\
        \hline
        Thermal conductivity, $k$ 	& $3.0~ W/(m K)$ \\
        Heat transfer coefficient, $h$ 	& $5.0~W/(m^2 K)$\\
        $a$	                        & $5 ~ K/m^2$ \\
        $b$	                        & $10~ K/m^2$ \\
        $c$ 	                        & $15~ K/m^2$ \\
        $L$ 	                        & $1~m$\\
        $W$	                        & $1~m$\\
        $H$	                        & $1~m$\\
        \hline
    \end{tabular}
\end{table}

To evaluate the accuracy of the numerical solutions, we show in Figure~\ref{fig:anal