Convex Relaxation of Dynamic Optimal Power and Gas Flow