Most widely used Reynolds-Averaged Navier-Stokes (RANS) models employ the Boussinesq approximation, which assumes a linear relationship between the turbulent Reynolds stresses and the mean-velocity gradient tensor. This assumption, which can be very stringent, is more suited for simple shear-flows and is regarded as an important shortcoming for the improvement of the representation of turbulence in complex geometries. Correction of the local turbulence length scales, as achieved for example by the introduction of a correction term in the eddy-viscosity equation of a Spalart-Allmaras model, then indeed only allows relatively small corrections to the base-line model and may not be sufficiently flexible to adapt to common situations where the Reynolds stresses are not aligned with the velocity gradient tensor. For the variational data-assimilation step, we consider a vectorial source correction term in the momentum equations (output quantity) together with the Spalart-Allmaras model, which allows full flexibility to adapt to any mean-flow topology. We show how the machine-learning framework should be adapted, in particular with respect to the vectorial nature of the correction term and given invariance properties. As for the input quantities, we discuss the impact of considering either local quantities for the non-dimensionalization or global ones that characterize the configuration. We showcase the procedure on the periodic hill configuration, for which a rich DNS database is available in the literature: in particular, availability of the full mean-flow solution for a range of Reynolds numbers and geometries, ensures identification of "physical" correction terms and allows learning of turbulence models that accurately extrapolate to new Reynolds numbers and geometries.