Menu

Subroutine Sphere Calculates Three Components Gravitational Attraction Single Point Due Un Q43825092

Subroutine SPHERE calculates the three components ofgravitational attraction at a single point due to a uniformsphere,

Inputparameters:
Observation point is (xp,yp,zp), and center of sphere is at

(xq,yq,zq). Radius of sphere is a and density is rho. Density inunits of kg/(m**3). All distance parameters in units of km.

Output parameters:
Gravitational components (gx,gy,gz) in units of mGal.

real km2m
data gamma/6.67e-l1/,si2mg/l.e5/,pi/3.14159265/,km2m/l.e3/ierror=0
rx=xp-xq

ry=yp-yq
rz=zp-zq
r=sqrt(rx**2+ry**2+rz**2)
if(r.eq.O.)pause ‘SPHERE: Bad argument detected.’ r3=r**3
tmass=4.*pi*rho*(a**3)/3.
gx=-gamma*tmass*rx/r3
gy=-gamma*tmass*ry/r3
gz=-gamma*tmass*rz/r3
gx=gx*si2mg*km2m
gy=gy*si2mg*km2m
gz=gz*si2mg*km2m
return
end

Subroutine B.I. Subroutine to calculate the three components ofgravitational attraction due to a sphere of homogeneousdensity.

i need the answer of this question. (not only gfortran code butalso matlab code)

Expert Answer


Answer to Subroutine SPHERE calculates the three components of gravitational attraction at a single point due to a uniform sphere,…

OR