The mean curvature flow describes the evolution of a surface (a curve) with
normal velocity proportional to the local mean curvature. It has many applications in
mathematics, science and engineering. In this paper, we develop a numerical method
for mean curvature flows by using the Onsager principle as an approximation tool.
We first show that the mean curvature flow can be derived naturally from the Onsager
variational principle. Then we consider a piecewise linear approximation of the curve
and derive a discrete geometric flow. The discrete flow is described by a system of
ordinary differential equations for the nodes of the discrete curve. We prove that the
discrete system preserve the energy dissipation structure in the framework of the Onsager principle and this implies the energy decreasing property. The ODE system can
be solved by the improved Euler scheme and this leads to an efficient fully discrete
scheme. We first consider the method for a simple mean curvature flow and then extend it to the volume preserving mean curvature flow and also a wetting problem on
substrates. Numerical examples show that the method has optimal convergence rate
and works well for all the three problems.