I'm having trouble understanding how to simulate a situation like this: http://phet.colorado.edu/sims/density-and-buoyancy/buoyancy_en.html
The point of the program is to make a simulator - like the one indicated in the link. I want to keep it realistic and use Python. I want to draw a simulation in Pygame .
In my program, I ask for a couple of variables; mass and radius. The radius will be used to calculate the volume of the sphere, and the mass will be used to calculate buoyancy, gravity and acceleration.
But the fact is that to keep everything in SI units, I ask for a radius in a meter. Doing this, keeping my radius less than 10 cm, is a very small amount. And when I use the Pygame module to draw a 0.1 m sphere, it fails. So instead, I needed to use a larger scale.
So here is my main problem. How much should I scale the scope? Say I would like to define 100 pixels per 1 meter. Then I would have to multiply my radius by 100, since it will be a scale, but now that the sphere is larger, if the speed is also multiplied by 100?
I was very embarrassed! Thank you for your time.
I don’t know if it needs to be seen, one way or another. Calculations.py
import math
class Formulas():
def __init__(self):
self.pi = 3.1415926535
self.gravity = 9.82
self.density_water = 1000.0
self.density_air = 1.29
self.drag_sphere = 0.47
def object_buoyancy(self, volume, medium_density):
buoyancy = volume * medium_density * self.gravity
return buoyancy
def object_gravity(self, mass):
gravity_force = mass * self.gravity
return gravity_force
def object_volume_sphere(self, radius):
volume = 1.3333333 * self.pi * math.pow(radius, 3)
return volume
def object_mass(self, density, volume):
mass = volume * density
return mass
def object_acceleration(self, gravity_force, buoyancy, mass):
total_force = gravity_force - buoyancy
acceleration = total_force / mass
return acceleration
def object_speed(self, acceleration, time, scale):
speed = acceleration * (float(time)/1000.0)
return speed
def surface_area(self, radius):
area = 4 * self.pi * math.pow(radius, 2)
return area