""" class nbody_unit(core.base_unit): def __init__(self, unit_in_si, system): core.base_unit.__init__(self, unit_in_si.quantity, unit_in_si.name, unit_in_si.symbol, system) self.unit_in_si = unit_in_si def __str__(self): return 'nbody '+self.unit_in_si.quantity def is_generic(self): return True nbody_system = core.system('nbody') length = generic_unit_system.length time = generic_unit_system.time mass = generic_unit_system.mass acceleration = length / (time ** 2) potential = (length ** 2) / (time ** 2) energy = mass * potential specific_energy = potential speed = length / time volume = (length ** 3) density = mass / volume pressure = mass / length / (time ** 2) momentum_density = density * speed energy_density = density * specific_energy
from amuse.units import core system = core.system('S.I.') m = core.base_unit('length', 'meter', 'm', system) kg = core.base_unit('mass', 'kilogram', 'kg', system) s = core.base_unit('time', 'second', 's', system) A = core.base_unit('electric current', 'ampere', 'A', system) K = core.base_unit('thermodynamic temperature', 'kelvin', 'K', system) mol = core.base_unit('amount of substance', 'mole', 'mol', system) cd = core.base_unit('luminous intensity', 'candela', 'cd', system) no_system = core.no_system none = core.none_unit('none','none') no_unit = none named = core.named_unit # SI prefixes def deca(unit): return named('deca'+unit.name,'da'+unit.symbol,10.*unit) def hecto(unit): return named('hecto'+unit.name,'h'+unit.symbol,100.*unit) def kilo(unit): return named('kilo'+unit.name,'k'+unit.symbol,1000.*unit) def mega(unit): return named('mega'+unit.name,'M'+unit.symbol,1.e6*unit) def giga(unit): return named('giga'+unit.name,'G'+unit.symbol,1.e9*unit) def tera(unit): return named('tera'+unit.name,'T'+unit.symbol,1.e12*unit)
class nbody_unit(core.base_unit): def __init__(self, unit_in_si, system): core.base_unit.__init__(self, unit_in_si.quantity, unit_in_si.name, unit_in_si.symbol, system) self.unit_in_si = unit_in_si def __str__(self): return 'nbody ' + self.unit_in_si.quantity def is_generic(self): return True nbody_system = core.system('nbody') length = generic_unit_system.length time = generic_unit_system.time mass = generic_unit_system.mass acceleration = length / (time**2) potential = (length**2) / (time**2) energy = mass * potential specific_energy = potential speed = length / time volume = (length**3) density = mass / volume pressure = mass / length / (time**2) momentum_density = density * speed energy_density = density * specific_energy
from amuse.units import core class generic_unit(core.base_unit): def __init__(self, unit_in_si, system): core.base_unit.__init__(self, unit_in_si.quantity, unit_in_si.name, unit_in_si.symbol, system) self.unit_in_si = unit_in_si def __str__(self): return self.unit_in_si.quantity def is_generic(self): return True generic_system = core.system("generic") length = generic_unit(units.m, generic_system) time = generic_unit(units.s, generic_system) mass = generic_unit(units.kg, generic_system) current = generic_unit(units.A, generic_system) temperature = generic_unit(units.K, generic_system) luminous_intensity = generic_unit(units.cd, generic_system) acceleration = length / (time ** 2) force = mass * acceleration potential = (length ** 2) / (time ** 2) energy = mass * potential specific_energy = potential speed = length / time volume = length ** 3
class generic_unit(core.base_unit): def __init__(self, unit_in_si, system): core.base_unit.__init__(self, unit_in_si.quantity, unit_in_si.name, unit_in_si.symbol, system) self.unit_in_si = unit_in_si def __str__(self): return self.unit_in_si.quantity def is_generic(self): return True generic_system = core.system('generic') length = generic_unit(units.m, generic_system) time = generic_unit(units.s, generic_system) mass = generic_unit(units.kg, generic_system) current = generic_unit(units.A, generic_system) temperature = generic_unit(units.K, generic_system) luminous_intensity = generic_unit(units.cd, generic_system) acceleration = length / (time**2) force = mass * acceleration potential = (length**2) / (time**2) energy = mass * potential specific_energy = potential speed = length / time volume = (length**3)
""" class nbody_unit(core.base_unit): def __init__(self, unit_in_si, system): core.base_unit.__init__(self, unit_in_si.quantity, unit_in_si.name, unit_in_si.symbol, system) self.unit_in_si = unit_in_si def __str__(self): return "nbody " + self.unit_in_si.quantity def is_generic(self): return True nbody_system = core.system("nbody") length = generic_unit_system.length time = generic_unit_system.time mass = generic_unit_system.mass acceleration = length / (time ** 2) potential = (length ** 2) / (time ** 2) energy = mass * potential specific_energy = potential speed = length / time volume = length ** 3 density = mass / volume pressure = mass / length / (time ** 2) momentum_density = density * speed energy_density = density * specific_energy