  For a harmonic map $u:M^3\to S^1$ on a closed, oriented $3$--manifold, we
establish the identity $$2\pi \int_{\theta\in S^1}\chi(\Sigma_{\theta})\geq
\frac{1}{2}\int_{\theta\in
S^1}\int_{\Sigma_{\theta}}(|du|^{-2}|Hess(u)|^2+R_M)$$ relating the scalar
curvature $R_M$ of $M$ to the average Euler characteristic of the level sets
$\Sigma_{\theta}=u^{-1}\{\theta\}$. As our primary application, we extend the
Kronheimer--Mrowka characterization of the Thurston norm on $H_2(M;\mathbb{Z})$
in terms of $\|R_M^-\|_{L^2}$ and the harmonic norm to any closed $3$--manifold
containing no nonseparating spheres. Additional corollaries include the
Bray--Brendle--Neves rigidity theorem for the systolic inequality $(\min
R_M)sys_2(M)\leq 8\pi$, and the well--known result of Schoen and Yau that $T^3$
admits no metric of positive scalar curvature.
