How do you make a realistic physics engine?

In summary, the individual wants to create a car engine in Blender and add a physics engine to make it run. They do not want to animate it, but instead use a Python script to simulate the engine running realistically. They are seeking advice on where to start and what knowledge is necessary for this project. Suggestions include using finite element method and other derivatives for simulating forces, understanding macroscopic and microscopic physics, and starting with a simple kinematic simulation before adding complexity. The purpose of this simulation is to serve as a proof-of-concept for the engine design.
  • #1
ageattack
9
0
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?
 
Technology news on Phys.org
  • #3
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?
 
  • #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.
 
  • #5
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 modeled.

What experience do you have with the various kinds of physical dynamics?
 
  • Like
Likes 1 person
  • #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.
 
  • #7
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?
 
  • #8
ageattack said:
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.

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!
 
  • #9
chiro said:
Are you doing physics or have you done a physics or engineering degree?

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.
 
  • #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.
 
  • #11
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...
 
  • Like
Likes 1 person
  • #12
Good point. I guess the simulation would only be useful for the visual aspect of all this.
 
  • #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.
 

Related to How do you make a realistic physics engine?

1. How does a physics engine simulate real-life physics?

A physics engine uses mathematical equations and algorithms to simulate real-life physical behaviors such as gravity, friction, and collisions. These equations are based on principles from classical mechanics and other branches of physics.

2. What factors are considered in creating a realistic physics engine?

Creating a realistic physics engine involves considering various factors such as the type of objects being simulated (rigid bodies, soft bodies, fluids), the environment (2D or 3D), the level of accuracy required, and the computational resources available.

3. How are collisions between objects handled in a physics engine?

Collisions between objects are handled by detecting when two objects come into contact and then applying appropriate forces to simulate the resulting interaction. This can involve calculating the direction and magnitude of the forces based on the objects' properties and the laws of physics.

4. Can a physics engine account for complex interactions such as fluid dynamics?

Some physics engines have the capability to simulate complex interactions such as fluid dynamics by using advanced algorithms and techniques. However, this requires a significant amount of computational resources and may not be feasible for all applications.

5. How do you test and validate a physics engine?

A physics engine can be tested and validated by comparing its results to real-life observations and known physical principles. This can involve running simulations of simple scenarios and comparing the outcomes, as well as conducting more complex experiments to verify the accuracy of the engine's calculations.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
833
  • Programming and Computer Science
Replies
10
Views
3K
  • Programming and Computer Science
Replies
7
Views
796
  • Programming and Computer Science
Replies
22
Views
2K
Replies
6
Views
303
  • STEM Career Guidance
Replies
21
Views
1K
  • STEM Academic Advising
Replies
11
Views
2K
  • STEM Career Guidance
Replies
3
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
Back
Top