Solve a fluid mechanics problem using your c++ programming skills.


Program Description:

Don't use plagiarized sources. Get Your Custom Essay on
Solve a fluid mechanics problem using your c++ programming skills.
Just from $13/Page
Order Essay




Pipe friction factor, f, the fluid velocity in the pipe, V, and the “head” difference, h, which is indicative of pressure difference or drop between upstream and downstream sections in the pipe can be calculated. (See the figure below.) Using C++ write a program to solve these fluid mechanic problems.
























A. Pipe friction factor, valid for Re>2000                  









B. Velocity       (For this project, we assume the fluid is H20.)









C. Head difference (drop)                  









            f           pipe friction factor


E          pipe surface roughness


D          diameter of the pipe


Re        Reynolds number


V          velocity of the fluid


h          head (pressure) drop


L          length of the pipe


g          gravitation constant= 9.81






  • The data file is on Angel called fluid.txt. It is an EOF data type.

  • Each formula will be its own function.

  • All variables will be meaningful and related to the data variable names.

  • Do not worry about unit measurements; this has been taken care of for you.

  • All of your results will be sent to an output file called fluidout.txt. See the example below on how to format the output.

  • Both input and output files need to be located in P:\Private directory. If not, the program will be marked as not running.

  • When calculating the pipe friction factor (f), start f at .02. Continue to calculate until the |fnew-fstart| <= .001.

  • I recommend you start this project early and not the day before it is due.

  • “Your lack of planning does not constitute an emergency for me.” ~ Anonymous    


    Data file:

                EOF Data file with the data in the following order:


                            Re        D          L          E


    Output Example:


                = = = = = = = = = = = = = = = = = = = == = = = = = = = = = = = = = = = = = = =

    For record 1:


    Pipe surface roughness:                      .12 x 10e-3

    Diameter of the pipe:                         0.01

    Reynolds number:                               2000

    Length of pipe:                                    .1


    Pipe friction factor:                             0.054947

    Velocity of the fluid:                           0.26

    Head drop:                                          0.018932

    = = = = = = = = = = = = = = = = = = = == = = = = = = = = = = = = = = = = = = =



  • Once again, do not worry about units.

  • Do format decimal values to a reasonable amount.

  • Do output which record you are on.

  • The above data is only a sample, it may not be accurate.



    What are you turning in?


  1. A printout of your original source code




  1. A printout of your output file. Remember: I will be testing your program with different data. Make sure it works for all situations!




  1. Log into Angel and locate the Project drop box.  Upload your project’s .cpp file that you created. Make sure this file is named correctly.  Points will be deducted if your Penn State ID is not part of the name.




  1. If you neglect to either upload your file or turn in your hard copy, your project will not be graded and you will get a zero for the assignment. I assume you are all adults and I do not have to track you down for both parts of this assignment.


    Graded on:

    ~~This project is worth 15% of the 25% allotted for projects this semester.



  • Good programming
  • Neat & readable code
  • Comments
  • Data file manipulation
  • Functions
  • Function Header comments
  • Calculations
  • Meaningful variables & constants
  • Input – prompting & use
  • Output – both results & format
  • -10 points if you fail to name the cpp file correctly
  • 0 on the project if you fail to upload the file or turn in the hard copy



10e4 .020 7.5 .24e-4
9e5 .016 6 .37e-3
12e4 .015 5.5 .68e-3
8.2e5 .017 3 .51e-3
2.4e4 .005 2.4 .82e-4





Calculate the price of your paper

Total price:$26
Our features

We've got everything to become your favourite writing service

Need a better grade?
We've got you covered.

Order your paper