  We study the statistical behavior of multimoded optical systems under
equilibrium conditions. We investigate the role of variations of the system
parameters in the thermodynamic description and derive, an optical analogue of
the first law of thermodynamics, a generic expression for the work done to the
system, and an optical Gibbs-Duhem equation. To demonstrate these effects, we
focus in the case of two-dimensional photonic lattices. We study the conditions
under which the entropy in such waveguide arrays can be considered as
extensive. In this respect, small deviations from the extensive character of
the entropy give rise to stress and strain terms. We examine how the
conservation laws in such array configurations are affected by variations in
the system parameters, and furthermore, we analyze the respective thermodynamic
processes (isentropic and Joule-type expansions).
