In this paper, a nonhomogeneous system of pressureless flow
\[
ρ
t
+
(
ρ
u
)
x
=
0
,
(
ρ
u
)
t
+
(
ρ
u
2
)
x
=
ρ
x
{\rho _t} + {\left ( \rho u \right )_x} = 0, \qquad {\left ( \rho u \right )_t} + {\left ( \rho {u^2} \right )_x} = \rho x
\]
is investigated. It is found that there exists a generalized variational principle from which the weak solution is explicitly constructed by using the initial data; i.e.,
\[
ρ
(
x
,
t
)
=
−
∂
∂
x
2
min
y
F
(
y
;
x
,
t
)
,
ρ
(
x
,
t
)
u
(
x
,
t
)
=
∂
2
∂
x
∂
t
min
y
F
(
y
;
x
,
t
)
\rho \left ( x, t \right ) = - \frac {\partial }{{\partial {x^2}}}\min \limits _y F\left ( y; x, t \right ), \qquad \rho \left ( x, t \right )u\left ( x, t \right ) = \frac {{{\partial ^2}}}{{\partial x\partial t}}\min \limits _y F\left ( y; x, t \right )
\]
hold in the sense of distributions, where
F
(
y
;
x
,
t
)
F\left ( {y; x, t} \right )
is a functional depending on the initial data. The weak solution is unique under an Oleinik-type entropy condition when the initial data is of measurable function. It is further shown that the solution
u
(
x
,
t
)
u\left ( x, t \right )
converges to
x
x
as
t
t
tends to infinity. The proofs are based on the generalized variational principle and careful studies on the generalized characteristics introduced by Dafermos [5].