In this paper, concepts of network thermodynamics are applied to a riv
er water quality model, which is based on Streeter-Phelps equations, t
o identify the corresponding physical components and their topology. T
hen, the randomness in the parameters, input coefficients and initial
conditions are modeled by Gaussian white noises. From the stochastic c
omponents of the physical system description of problem and concepts o
f physical system theory, a set of stochastic differential equations c
an be automatically generated in a computer and the recent development
s on the automatic formulation of the moment equations based on Ito ca
lculus can be used. This procedure is illustrated through the solution
of an example of stochastic river water quality problem and it is als
o shown how other related problems with different configurations can b
e automatically solved in a computer using just one software.