  We perform simulations of an impulsively-started, axisymmetric viscoelastic
jet exiting a nozzle and entering a stagnant gas phase using the open-source
code Basilisk. This code allows for efficient computations through an
adaptively-refined volume-of-fluid technique that can accurately capture the
deformation of the liquid-gas interface. We use the FENE-P constitutive
equation to describe the viscoelasticity of the liquid and employ the
log-conformation transformation, which provides stable solutions for the
evolution of the conformation tensor as the jet thins down under the action of
interfacial tension. For the first time, the entire jetting and breakup process
of a viscoelastic fluid is simulated, including the pre-shearing flow through
the nozzle, which results in an inhomogeneous initial radial stress
distribution in the fluid thread that affects the subsequent breakup dynamics.
The evolution of the velocity field and the elastic stresses in the nozzle are
validated against analytical solutions where possible, and the early-stage
dynamics of the jet evolution are compared favourably to the predictions of
linear stability theory. We study the effect of the flow inside the nozzle on
the thinning dynamics of the viscoelastic jet (which develops distinctive
"beads-on-a-string" structures) and on the spatio-temporal evolution of the
polymeric stresses in order to systematically explore the dependence of the
filament thinning and breakup characteristics on the initial axial momentum of
the jet and the extensibility of the dissolved polymer chains.
