The challenge of calculating nonequilibrium entropy in polymeric liquids undergoing flow was addressed from the perspective of extending equilibrium thermodynamics to include internal variables that quantify the internal microstructure of chain-like macromolecules and then applying these principles to nonequilibrium conditions under the presumption of an evolution of quasie equilibrium states in which the requisite internal variables relax on different time scales. The nonequilibrium entropy can be determined at various levels of coarse-graining of the polymer chains by statistical expressions involving nonequilibrium distribution functions that depend on the type of flow and the flow strength. Using nonequilibrium molecular dynamics simulations of a linear, monodisperse, entangled C1000H2002 polyethylene melt, nonequilibrium entropy was calculated directly from the nonequilibrium distribution functions, as well as from their second moments, and also using the radial distribution function at various levels of coarse-graining of the constituent macromolecular chains. Surprisingly, all these different methods of calculating the nonequilibrium entropy provide consistent values under both planar Couette and planar elongational flows. Combining the nonequilibrium entropy with the internal energy allows determination of the Helmholtz free energy, which is used as a generating function of flow dynamics in nonequilibrium thermodynamic theory.