A model for ripple formation on liquid surfaces exposed to an external laser or particle beam and a variable ground is developed. Starting from the Navier Stokes equation the coupled equations for the velocity potential and the surface height are derived with special attention to viscosity. The approximate solutions are discussed analogously to shallow-water equations. The resulting coupled equations for the surface height and velocity obey conservation laws for volume and momentum where characteristic potentials for gravitation and surface tension are identified analogously to conservative forces. It is shown that the viscosity contributes to a damping of the momentum transport by a spatial gradient of the velocity. The spatial dependent ground contributes to the momentum balance only due to the coupling with gravitation and surface tension. Linear stability analysis provides the formation of a damped gravitation wave modified by an interplay between the external beam, the viscosity, and the surface tension. The resulting wavelengths are in the order of the ripples occurring in laser welding experiments hinting to their hydrodynamical origin. The stability due to the periodic time-dependence of the external beam is discussed with the help of Floquet multipliers showing that the ripple formation could be triggered by an external excitation with frequencies in the order of the repetition rate of the laser. The weak nonlinear stability analysis provides ranges where hexagonal or stripe structures can appear. The orientation of stripe structures and ripples are shown to be dependent on the incident angle and a minimal angle is reported. Two models are presented to couple the external current to the gradient of the surface. Numerical simulations confirm the findings and allow to describe the influence of variable grounds.