  The efficient method for computing the sensitivities is the adjoint method.
The cost of solving an adjoint equation is comparable to the cost of solving
the governing equation. Once the adjoint solution is obtained, the
sensitivities to any number of parameters can be obtained with little effort.
There are two methods to develop the adjoint equations: continuous method and
discrete method. In the continuous method, the control theory is applied to the
forward governing equation and produces an analytical partial differential
equation for solving the adjoint variable; in the discrete method, the control
theory is applied to the discrete form of the forward governing equation and
produces a linear system of equations for solving the adjoint variable. In this
article, an adjoint sensitivity analysis framework is developed using both the
continuous and discrete methods. These two methods are assessed with the faucet
flow for steady-state problem and one transient test case based on the BFBT
benchmark for transient problem. Adjoint sensitivities from both methods are
verified by sensitivities given by the perturbation method. Adjoint
sensitivities from both methods are physically reasonable and match each. The
sensitivities obtained with discrete method is found to be more accurate than
the sensitivities from the continuous method. The continuous method is
computationally more efficient than the discrete method because of the
analytical coefficient matrices and vectors. However, difficulties are observed
in solving the continuous adjoint equation for cases where the adjoint equation
contains sharp discontinuities in the source terms; in such cases, the
continuous method is not as robust as the discrete adjoint method.
