Answer to Question #144566 in C++ for Ankit

Question #144566
Use Archimedes’ principle to develop a steady-state
force balance for a spherical ball of ice floating in seawater.
The force balance should be expressed as a third-order poly-
nomial (cubic) in terms of height of the cap above the water
line (h), and the seawater’s density (ρf
), the ball’s density
(ρs) and radius (r).
1
Expert's answer
2020-11-16T00:10:38-0500
/*********************************************************
 * Calculate forces balance for ice ball in water
 * INPUT:
 * r - the ball radius (m)
 * h - the height of the cap above the water (m)
 * ps - the ball dencity (kg/m^3)
 * pf - the seawater's dencity
 * RETURN:
 * A total force applied to the ball, positive direction is down
 *********************************************************/
double ForceBalance(double r, double h, double ps, double pf)
{
    const double PI=3.14159265359;
    const double G= 9.80665;
    
    double v_ball = 4.0/3.0 * PI * r*r*r;   // The volume of the ball
    double v_seg = PI*(r*h*h - h*h*h/3);    // The volume of the segment above the water
    
    double f = G * (v_ball * (ps-pf) + v_seg*pf);

    return f;
}

#ifdef TEST
#include <iostream>
using namespace std;

int main()
{
    double r = 1.0;
    double h = 0.397;
    double ps = 920.0;
    double pf = 1025.0;
   
    cout << "The total force applied to the ice ball with radius " << r
         << "m with cape " << h << "m above the water is" << endl;
    double force = ForceBalance(r, h, ps, pf);     
    cout << abs(force) << "N and directed " << (force>0 ? "down" : "up") << endl;
    
    return 0;
}
#endif

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog