The dynamic model for large-eddy simulation of turbulence samples info
rmation from the resolved velocity held in order to optimize subgrid-s
cale model coefficients. When the method is used in conjunction with t
he Smagorinsky eddy-viscosity model, and the sampling process is formu
lated in a spatially local fashion, the resulting coefficient held is
highly variable and contains a significant fraction of negative values
. Negative eddy viscosity leads to computational instability and as a
result the model is always augmented with a stabilization mechanism. I
n most applications the model is stabilized by averaging the relevant
equations over directions of statistical homogeneity. While this appro
ach is effective, and is consistent with the statistical basis underly
ing the eddy-viscosity model, it is not applicable to complex-geometry
inhomogeneous hows. Existing local formulations, intended for inhomog
eneous flows, are most commonly stabilized by artificially constrainin
g the coefficient to be positive. In this paper we introduce a new dyn
amic model formulation, that combines advantages of the statistical an
d local approaches. We propose to accumulate the required averages ove
r flow pathlines rather than over directions of statistical homogeneit
y. This procedure allows the application of the dynamic model with ave
raging to inhomogeneous hows in complex geometries. We analyse direct
numerical simulation data to document the effects of such averaging on
the Smagorinsky coefficient. The characteristic Lagrangian time scale
over which the averaging is performed is chosen based on measurements
of the relevant Lagrangian autocorrelation functions, and on the requ
irement that the model be purely dissipative, guaranteeing numerical s
tability when coupled with the Smagorinsky model. The formulation is t
ested in forced and decaying isotropic turbulence and in fully develop
ed and transitional channel flow. In homogeneous hows, the results are
similar to those of the volume-averaged dynamic model, while in chann
el how the predictions are slightly superior to those of the spatially
(planar) averaged dynamic model. The relationship between the model a
nd vortical structures in isotropic turbulence, as well as ejection ev
ents in channel how is investigated. Computational overhead is kept sm
all (about 10% above the CPU requirements of the spatially averaged dy
namic model) by using an approximate scheme to advance the Lagrangian
tracking through first-order Euler time integration and linear interpo
lation in space.