def test_default_constructor(): dm = density_model.DensityModel() assert_equal(dm.a, 0*u_dens) assert_equal(dm.b, 0*u_dens/units.kelvin) assert_equal(dm.model, 'linear') assert_equal(dm.rho(), dm.a)
from nose.tools import assert_equal, assert_almost_equal, assert_true, \ assert_false, assert_raises, assert_is_instance, with_setup import th_component as th from db import database from utilities.ur import units from timer import Timer from materials.material import Material import density_model name = "testname" vol = 20*units.meter**3 k = 10*units.watt/units.meter/units.kelvin cp = 10*units.joule/units.kg/units.kelvin dm = density_model.DensityModel(a=0*units.kg/units.meter**3, b=100*units.kg/units.meter**3, model='constant') mat = Material(k=k, cp=cp, dm=dm) kappa = 0 T0 = 700*units.kelvin t0 = 0*units.seconds tf = 10*units.seconds tfeedback = 5*units.seconds dt = 0.1*units.seconds ti = Timer(t0=t0, tf=tf, dt=dt, t_feedback=tfeedback) tester = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti) tester_sph = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti, sph=True, ri=0*units.meter, ro=1*units.meter)
from nose.tools import assert_equal, assert_almost_equal, assert_true, \ assert_false, assert_raises, assert_is_instance, with_setup from utilities.ur import units import density_model u_dens = units.kg/pow(units.meter, 3) alpha = 2.0*u_dens beta = 3.0*u_dens/units.kelvin dm_constant = density_model.DensityModel(a=alpha, b=beta, model="constant") dm_linear = density_model.DensityModel(a=alpha, b=beta, model="linear") dm_flibe = density_model.DensityModel(a=2415.6*units.kg/(units.meter**3), b=0.49072*units.kg/(units.meter**3)/units.kelvin, model="linear") def test_default_constructor(): dm = density_model.DensityModel() assert_equal(dm.a, 0*u_dens) assert_equal(dm.b, 0*u_dens/units.kelvin) assert_equal(dm.model, 'linear') assert_equal(dm.rho(), dm.a) def test_linear(): assert_equal(dm_linear.model, 'linear') assert_equal(dm_linear.rho(0*units.kelvin), alpha) assert_equal(dm_linear.rho(), alpha) assert_equal(dm_linear.rho(1*units.kelvin), alpha + beta*1.0*units.kelvin)
from nose.tools import assert_equal, assert_almost_equal, assert_true, \ assert_false, assert_raises, assert_is_instance, with_setup import th_component as th from db import database from utilities.ur import units from timer import Timer from materials.material import Material import density_model name = "testname" vol = 20*units.meter**3 k = 10*units.watt/units.meter/units.kelvin cp = 10*units.joule/units.kg/units.kelvin dm = density_model.DensityModel(a=0*units.kg/units.meter**3, b=100*units.kg/units.kelvin/pow(units.meter, 3), model='constant') mat = Material(k=k, cp=cp, dm=dm) kappa = 0 T0 = 700*units.kelvin t0 = 0*units.seconds tf = 10*units.seconds tfeedback = 5*units.seconds dt = 0.1*units.seconds ti = Timer(t0=t0, tf=tf, dt=dt, t_feedback=tfeedback) tester = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti) tester_sph = th.THComponent(name=name, mat=mat, vol=vol, T0=T0, timer=ti, sph=True, ri=0*units.meter, ro=1*units.meter)