Efficient Training of Physics-Informed Neural Networks with Direct Grid Refinement Algorithm