Let ρ be the pile’s constant density.
Let m be the mass of the pile which will increase as the pile accretes.
When a new mass element, dm, falls in from infinity the attraction is f = G m dm/r2 while the element is still at distance r.
The volume of the pile is (4/3)πr03 = m/ρ where r0 is the pile’s radius.
It will reach the surface at radius r0 = ((4/3)πρ/m)−1/3 having released energy = de =
∫r0∞f dr = ∫r0∞G m dm r−2 dr = G m dm/r0 = ((4/3)πρ/m)1/3 G m dm = G dm ((4/3)πρ)1/3 m2/3.
As the mass increases the total energy is
∫0Mde = ∫0MG dm ((4/3)πρ)1/3 m2/3 = G ((4/3)πρ)1/3∫0M m2/3 dm
= G ((4/3)πρ)1/3 (3/5)M5/3 = 22/332/35−1 (πρ)1/3G M5/3 = 62/3/5 (πρ)1/3G M5/3
where M is the total mass of the pile.
This agrees almost with this.
Expressing the answer in M and the radius r using M = (4π/3)r3ρ
ρ = M(3/(4π))r−3
E = 62/3/5 (πρ)1/3G M5/3
= 62/3/5 (πM(3/(4π))r−3)1/3G M5/3
= 22/3−2/332/3+1/3/5π0M6/3G r−1
= 0.6 M2G/r
= (4.0044 10−11 M2/r) m3 kg−1 s−2
Holding the density constant, the energy varies as the 5th power of the radius.
Accretion Energy of Earth:
Mass = 5.98 × 1024 kg.
Radius of Earth = 6.37 × 106 m.
G = 6.6734∙10−10 m3kg−1sec−2
E = 2.248 × 1032 Joules
And on 2008 Nov 10 I found and fixed another bug. Very embarrassing!
By the above formula the accretion energy is
(4.004 10−11 27.5 1064 g2 /
(5 103 m)) m3 kg−1 s−2
= 22 1051 kg (m/s)2 = 2.2 1052 Joules.
This does not include the substantial energy that is required to overcome degeneracy pressure.