  Inverse problems in computational mechanics consist of inferring physical
fields that are latent in the model describing some observable fields.
  For instance, an inverse problem of interest is inferring the Reynolds stress
field in the Navier--Stokes equations describing mean fluid velocity and
pressure.
  The physical nature of the latent fields means they have their own set of
physical constraints, including boundary conditions.
  The inherent ill-posedness of inverse problems, however, means that there
exist many possible latent fields that do not satisfy their physical
constraints while still resulting in a satisfactory agreement in the
observation space.
  These physical constraints must therefore be enforced through the problem
formulation.
  So far there has been no general approach to enforce boundary conditions on
latent fields in inverse problems in computational mechanics, with these
constraints often simply ignored.
  In this work we demonstrate how to enforce boundary conditions in Bayesian
inversion problems by choice of the statistical model for the latent fields.
  Specifically, this is done by modifying the covariance kernel to guarantee
that all realizations satisfy known values or derivatives at the boundary.
  As a test case the problem of inferring the eddy viscosity in the
Reynolds-averaged Navier--Stokes equations is considered.
  The results show that enforcing these constraints results in similar
improvements in the output fields but with latent fields that behave as
expected at the boundaries.
