  Magnetic fields are ubiquitous in the universe and are thought to play an
important role in various astrophysical processes. Polarization of thermal dust
emission from dust grains aligned with the magnetic field is widely used to
measure the two-dimensional magnetic field projected onto the plane of the sky
(POS), but the component along the line of sight (LOS) is not yet reliably
constrained with dust polarization. Here, we introduce a new method to infer
three-dimensional (3D) magnetic fields using thermal dust polarization and
grain alignment physics. We first develop a physical model of thermal dust
polarization using the modern grain alignment theory based on the magnetically
enhanced radiative torque (MRAT) alignment theory. We then test this model with
synthetic observations of magnetohydrodynamic (MHD) simulations of a
filamentary cloud with our updated POLARIS code. Combining the tested physical
polarization model with synthetic polarization, we show that the B-field
inclination angle can be accurately constrained by the polarization degree from
synthetic observations. Compared to the true 3D magnetic fields, our method
with grain alignment is more accurate than the previous methods that assume
uniform grain alignment. This new technique paves the way for tracing 3D
B-fields using thermal dust polarization and grain alignment theory and for
constraining dust properties and grain alignment physics.
