We build up a model to reproduce the experimentally measured RAA of J/ψ near midrapidty in Au+Au collision at √ sNN = 200 GeV. The model takes into account the J/ψ suppression from the quark-gluon plasma and hadron gas as well as the nuclear absorption of primordial charmonia and the regeneration effects at the hadronization stage, and hence is a generalization of the two component model introduced by Grandchamp and Rapp. The improvements in this work are twofold; the addition of the initial local temperature profile and a consistent use of QCD NLO formula for both the dissociation cross section in the hadron gas and the thermal decay widths in the quarkgluon plasma for the charmonium states. The initial local temperature profile is determined from the assumption that the local entropy density is proportional to a formula involving the number densities of the number of participants and of the binary collisions that reproduces the multiplicities of charged particles at chemical freeze-out. The initial local temperature profile brings about a kink in the RAA curve due to the initial melting of J/ψ. The initially formed fireball, composed of weakly interacting quarks and gluons with thermal masses that are extracted from lattice QCD, follows an isentropic expansion with cylindrical symmetry. The fit reproduces well the Au+Au as well as the Cu+Cu data. The same method is applied to predict the RAA expected from the Pb+Pb collision at LHC energy.