Skip to content
Snippets Groups Projects
Commit 5e588ea9 authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

Add a center_of_mass method for the BeamLoadingVlasov class

parent 07cab053
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,13 @@ class BeamLoadingVlasov():
delta += cavity.Vb(self.I0) * self.F[i] * np.cos(cavity.psi - self.PHI[i])
delta -= cavity.Vg * np.cos(cavity.theta_g)
return delta
def center_of_mass(self):
"""Return center of mass position in [s]"""
z0 = np.linspace(self.B1, self.B2, 1000)
rho = self.rho(z0)
CM = np.average(z0, weights=rho)
return CM/c
def u(self, z):
"""Scaled potential u(z)"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment