Euler-Lagrange approach for modeling water pipelines with leaks