We consider optimal estimation of state-dependent constitutive relations in complex multiphysics systems governed by Partial Differential Equations (PDEs). We will demonstrate that such inverse problems can be formulated in terms of PDE-constrained optimization where solutions can be obtained using suitable gradient-based techniques. Since the control variable is defined as a function of the state, the cost functional gradients have a rather unusual structure and their computation leads to a number of interesting questions at the level of numerical analysis. As an illustration of this approach, we will discuss the problem of estimating the transport properties of electrolytes used in actual Li-ion batteries based on experimental measurements. Another emerging application is related to the construction of invariant manifolds in dynamical systems obtained as optimal reduced-order models of complex phenomena. The presentation will combine elements of rigorous mathematical analysis with results of large-scale numerical computations.