Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do you make a realistic physics engine?

  1. Jan 5, 2014 #1
    Here's what I need, and this might sound far-fetched, but please answer it to the best of your ability. I want to create a car engine in blender, and then add a physics engine to make it run. The thing is, I don't want to animate it, I want to apply python script that can actually make the engine run as if it were real. I want this to be capable of verifying and proving that the engine works. This, I assume, would be a huge job. I guess what I'm asking is whether it's possible to make such code, and if so where should I start?
  2. jcsd
  3. Jan 5, 2014 #2
  4. Jan 5, 2014 #3


    User Avatar
    Science Advisor

    Hey ageattack and welcome to the forums.

    How much detail do you want to have? Are you trying to simulate everything all the way to the thermo-mechanical processes that end up driving the pistons? Are you just interested in generating the appropriate forces so that they can be simulated without any other form of data?
  5. Jan 5, 2014 #4
    Well chiro, what I want this simulation to be is a proof of concept, something that will prove that the engine will work without having to build it in real life. So I need every element implemented that would be present in the real world.
  6. Jan 5, 2014 #5


    User Avatar
    Science Advisor

    In terms of simulating real force in the most accurate way, I'd take a look at the finite element method and other derivatives for modelling lots of forces.

    In terms of the thermodynamics and thermo-mechanics, you will probably have to build statistical simulations that obey these thermodynamic constraints and use the FEM or force simulator unit to add these forces.

    You will also have to take into account any attribute that can vary the forces in any way whether that it includes the material used, the temperature in relation to that material and any material properties that cause variation in the forces that are being modelled.

    What experience do you have with the various kinds of physical dynamics?
  7. Jan 5, 2014 #6
    So essentially, I'd have to code every formula in that would apply to the engine, for instance that of friction, heat equations, pressure constants, everything that applies to the engines working, right? Give everything mass, density, etc and store those values as variable under the array of each element, for instance an array of steel having variables like heat capacity, friction coefficient, etc. then the formulas I mentioned above would fill themselves in based on the available variables.
  8. Jan 6, 2014 #7


    User Avatar
    Science Advisor

    You need to generate the forces and let the force engine deal with the evolution of the system.

    You need to define the resolution that you want for your simulation and the constraints and initial conditions used to make your system evolve.

    If the constraints are statistical then you can use pseudo-random generators to generate the forces which will then evolve with the evolution of your system.

    You have to keep in mind that macroscopic physics is not the same as microscopic physics. In the context of statistical physics, these macroscopic measures may represent some kind of expectation or moment (or function there-of) but they won't represent the microscopic attributes.

    You need to understand mechanics (especially dynamics) in general before you can understand how to do this kind of thing.

    Are you doing physics or have you done a physics or engineering degree?
  9. Jan 6, 2014 #8


    User Avatar
    Science Advisor
    Homework Helper

    That is back to front, compared with the way you would normally turn your concept into a real world design.

    Suppose you wanted to design a conventional car engine "from scratch". First decide what power you want to produce. From that, you know how much fuel you have to burn. So you can decide how many cylinders, the engine RPM, etc.

    Then you need some way to get fuel and air into the cylinders, so you might need to think about a fuel injector system and a turbocharger. You also need to get the work out of the cylinders, so you need to think about the cranks and connecting rods, etc....

    The point is, you if every sub-component does what it is supposed to do, the engine is "guaranteed" to work the way you intended. So you don't need to do the impossible task of trying to simulate "everything" in one computer model.

    Also, a simulation that "works" doesn't prove anything about what would happen in real life, unless you can show there are no significant errors in it. For example you can find plenty of simulations on the web that "prove" perpetual motion machines work!
  10. Jan 6, 2014 #9
    I'm currently doing physics, only in my first year university year though. I haven't learned everything yet, but I know a fair bit.
  11. Jan 6, 2014 #10
    @alephZero so your saying that correctly completing the equations for all the factors of this engine(probably several hundred) should figure out whether the engine would work? I mean I know it is, but I just think there'll be a factor I will forget about.
  12. Jan 6, 2014 #11


    User Avatar
    Science Advisor
    Homework Helper

    But if the simulation runs the engine "as if it was real", won't the simulation include the same equations, one way or another?

    Supposing you correctly simulate an engine design that doesn't work. So when you try to run it, nothing happens. Then what you do? Most likely, you try to solve the equations to figure out why it doesn't work...
  13. Jan 6, 2014 #12
    Good point. I guess the simulation would only be useful for the visual aspect of all this.
  14. Jan 7, 2014 #13
    If that is a proof-of-concept type of thing, then I'd start with something very simple. Like having the crankshaft rotate at a constant angular speed, with the motion of everything else derived from this rotation kinematically.

    You can make things more complex than that afterwards, but this is probably the minimum you have to do.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: How do you make a realistic physics engine?
  1. How do you compile C? (Replies: 5)