  We present a study of the directed flow $v_1$ for $D$ mesons discussing both
the impact of initial vorticity and electromagnetic field. Recent studies
predicted that $v_1$ for $D$ mesons is expected to be surprisingly much larger
than that of light charged hadrons; we clarify that this is due to a different
mechanism leading to the formation of a directed flow with respect to the one
of the bulk matter at both relativistic and non-relativistic energies. We point
out that the very large $v_1$ for $D$ mesons can be generated only if there is
a longitudinal asymmetry between the bulk matter and the charm quarks and if
the latter have a large non-perturbative interaction in the QGP medium. A quite
good agreement with the data of STAR and ALICE is obtained if the diffusion
coefficient able to correctly predict the $R_{AA}(p_T)$, $v_{2}(p_T)$ and
$v_{3}(p_T)$ of $D$ meson is employed. Furthermore, the mechanism for the
build-up of the $v_1(y)$ is associated to a quite small formation time that can
be expected to be more sensitive to the initial high-temperature dependence of
the charm diffusion coefficient. We discuss also the splitting of $v_1$ for
$D^0$ and $\bar D^0$ due to the electromagnetic field that is again much larger
than the one observed for charged particles and in agreement with the data by
STAR that have however still error bars comparable with the splitting itself,
while at LHC standard electromagnetic profile assuming a constant conductivity
is not able to account for the huge splitting observed.
