  Many existing models assume that magnetic flux ropes play a key role in solar
flares and coronal mass ejections (CMEs). It is therefore important to develop
efficient methods for constructing flux-rope configurations constrained by
observed magnetic data and the morphology of the pre-eruptive source region.
For this purpose, we have derived and implemented a compact analytical form
that represents the magnetic field of a thin flux rope with an axis of
arbitrary shape and circular cross-sections. This form implies that the flux
rope carries axial current $I$ and axial flux $F$, so that the respective
magnetic field is the curl of the sum of axial and azimuthal vector potentials
proportional to $I$ and $F$, respectively. We expressed the vector potentials
in terms of modified Biot-Savart laws whose kernels are regularized at the axis
in such a way that, when the axis is straight, these laws define a cylindrical
force-free flux rope with a parabolic profile for the axial current density.
For the cases we have studied so far, we determined the shape of the rope axis
by following the polarity inversion line of the eruptions' source region, using
observed magnetograms. The height variation along the axis and other flux-rope
parameters are estimated by means of potential field extrapolations. Using this
heuristic approach, we were able to construct pre-eruption configurations for
the 2009 February 13 and 2011 October 1 CME events. These applications
demonstrate the flexibility and efficiency of our new method for energizing
pre-eruptive configurations in simulations of CMEs.
