# Energy decomposition

Hi everybody.

I'm trying to calculate the amount of kinetic energy between two objects so that the first object is in motion and the second object is stationary. The second object consists of two elements. How can i calculate the amount of energy that each of the elements of the second body receive separately?
So how much the contribution of each of the elements of the second object to the energy absorption of the first object?

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-03-04
Last query:
2020-03-04
2020-03-02
 Jan Stránský (honzik) said on 2020-03-02: #1

Hello,

in Python, you have access to all relevant data, then it is easy to compute whatever you want, e.g. kinetic energy of individual bodies, sums them etc....:
###
# enegy of a single body
b1 = O.bodies[someID]
m1 = b1.state.mass
v1 = b1.state.vel.norm()
e1 = 0.5*m1*pow(v1,2)

# or using a function
def computeKineticEnergyOfOneBody(id):
b = O.bodies[id]
m = b.state.mass
v = b.state.vel.norm()
return 0.5*m*pow(v,2)
e1 = computeKineticEnergyOfOneBody(someID)

# sum of 2 bodies
e12 = computeKineticEnergyOfOneBody(id1) + computeKineticEnergyOfOneBody(id2)

# sum of several bodies
ids = [id1,id2,id3,id4]
e1234 = sum(computeKineticEnergyOfOneBody(i) for i in ids)
###

rotational energy can be taken into account, too
You can track the evolution over time or whatever, [1] is a good source of such stuff

cheers
Jan

 malmal (raha101372) said on 2020-03-03: #2

Not all energy is spent on speed change
Each element is made of a number of spheres
Most of the energy is spent on breaking the bonds between the spheres of each element and the other is spent on friction, heat and damping.

 Jan Stránský (honzik) said on 2020-03-03: #3

> Thanks for answering the questions

> ...

If it is not solved, please be more specific (from your statements it is not clear whether it is just some general description or you require further help)

cheers
Jan

 malmal (raha101372) said on 2020-03-04: #4

Thanks Jan Stránský, that solved my question.