a new algorithm coupled with the variational finite element method (FEM) is presented for solving the local flow near the leading or trailing edge of an airfoil or cascade.The solution of the local flow is considered as a combination of two parts.One of them is the approximate analytical solution of the flow near the stagnation point,it absorbs the greatly changing part in the original solution and makes the rest a more smooth distribution with better analytical nature which can be computed more accurately.Taking advantage of the variational principles,it is possible to locate the stagnation point more precisely and automatically.The numerical results show that the method described is effective to solve the subsonic flow accurately,especially in conditions with non-zero angle of attack.The theory can be coupled with the variational difference method as well as the variational FEM.