Git Product home page Git Product logo

projectilemotionquadraticdrag's Introduction

projectileMotionQuadraticDrag

Brief Introduction & Theory

Defines a projectile solver (well-known problem in Newtonian physics) that includes quadratic drag in C++. The 2nd order differential equations (ODEs) defined through the free body diagram are solved using the RK4 (Runge-Kutta 4th Order) numerical scheme. Step sizes are kept constant (no adaptive step-size routine). Simulation parameters together with global contants are defined in the constants.h header file. Please refer to that header file if you want to increase your number of steps or run the simulation in another medium (water for example)

Assumptions in Physics

It is assumed that the drag acting on the body is fully defined through the quadratic drag formula. It is also assumed that the drag coefficient equals with 0.5. Projectile motions are limited in the XY plane, with +y being orthogonal to the ground and aiming away from it. The only 2 forces considered on the body are its weight and the drag. Any other forces (magneric, etc.) are ingored in the ODEs definition.

How to Run

The source code can be compiled using Microsoft's Visual Studio application. As far as complementary libraries go, the program uses the cmath, string, iostream, fstream and oimanip libraries. The upcoming release will have a compiled binary with all required DLLs for the user to run straigh away from their Windows machine. Please note that this is a command-line appplication, it does not have any user interface at this point.

Output Results

The results from the simulation run are printed out on the command prompt, but are also saved in a file called projectileCoordinates.txt that can be found in the same folder as the executable. In this output file, the first column is time, the second column is x-coordinates and the third column is y-coordinates. All units are SI (or metric). These data can be used to plot the object's trajectory in either LibreOffice Calc, Python or any other scripting language or spreadsheet program. A trajectory graph is included below from a sample run. The graph was created in LibreOffice Calc.

sampleTrajectoryGraph

Figure 1: Trajectory Graph of a Sample Run using the Solver

Closing Remarks

This is the first version of this projectile solver with drag. In the coming weeks I will publish a release with pre-compiled binaries that anyone can run with a Windows machine. A user interface will be included in following releases, as this will make it easier for STEM students to run this solver and compare their analytical solutions of projectile motions with the numerical equivalent that includes drag. This solver is mostly meant for STEM students that are interested to observe the effects of realistic drag in projectile motions!

projectilemotionquadraticdrag's People

Contributors

ispchr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.