In this paper , we present a simulation method within the two-component spherical collapse model to investigate dark energy perturbations associated with the formation of dark matter halos . The realistic mass accretion history of a dark matter halo taking into account its fast and slow growth is considered by imposing suitable initial conditions and isotropized virializations for the spherical collapse process . The dark energy component is treated as a perfect fluid described by two important parameters , the equation of state parameter w and the sound speed c _ { s } . Quintessence models with w > -1 are analyzed . We adopt the Newtonian gauge to describe the spacetime which is perturbed mainly by the formation of a dark matter halo . It is found that the dark energy density perturbation \delta _ { DE } depends on w and c _ { s } , and its behavior follows closely the gravitational potential \Phi of the dark matter halo with \delta _ { DE } \approx - ( 1 + w ) \Phi / c _ { s } ^ { 2 } . For w > -1 , the dark energy perturbation presents a clustering behavior with \delta _ { DE } > 0 during the entire formation of the dark matter halo , from linear to nonlinear and virialized stages . The value of \delta _ { DE } increases with the increase of the halo mass . For a cluster of mass M \sim 10 ^ { 15 } M _ { \odot } , \delta _ { DE } \sim 10 ^ { -5 } within the virialized region for c _ { s } ^ { 2 } \in [ 0.5 , 1 ] , and it can reach \delta _ { DE } = O ( 1 ) with c _ { s } ^ { 2 } = 0.00001 . For a scalar-field dark energy model , we find that with suitably modeled w and c _ { s } , its perturbation behavior associated with the nonlinear formation of dark matter halos can well be analyzed using the fluid approach , demonstrating the validity of the fluid description for dark energy even considering its perturbation in the stage of nonlinear dark matter structure formation .