  Reynolds-averaged Navier--Stokes (RANS) closure must be sensitive to the flow
physics, including nonlocality and anisotropy of the effective eddy viscosity.
Recent approaches used forced direct numerical simulations to probe these
effects, including the macroscopic forcing method (MFM) of Mani and Park
($\textit{Phys. Rev. Fluids}$ $\textbf{6}$, 054607 (2021)) and the Green's
function approach of Hamba ($\textit{Phys. Fluids}$ $\textbf{17}$, 115102
(2005)). The resulting nonlocal and anisotropic eddy viscosities are exact and
relate Reynolds stresses to mean velocity gradients at all locations. They can
be used to inform RANS models of the sensitivity to the mean velocity gradient
and the suitability of local and isotropic approximations. However, these
brute-force approaches are expensive. They force the mean velocity gradient at
each point in the averaged space and measure the Reynolds stress response,
requiring a separate simulation for each mean velocity gradient location. Thus,
computing the eddy viscosity requires as many simulations as degrees of freedom
in the averaged space, which can be cost-prohibitive for problems with many
degrees of freedom. In this work, we develop an adjoint-based MFM to obtain the
eddy viscosity at a given Reynolds stress location using a single simulation.
This approach recovers the Reynolds stress dependence at a location of
interest, such as a separation point or near a wall, on the mean velocity
gradient at all locations. We demonstrate using adjoint MFM to compute the eddy
viscosity for a specified wall-normal location in an incompressible turbulent
channel flow using one simulation. In contrast, a brute-force approach for the
same problem requires $N=144$ simulations (the number of grid points in the
non-averaged coordinate direction). We show that a local approximation for the
eddy viscosity would have been inappropriate.
