def test_remove_nameless_component_by_uid(self): c = CUDS() c.add([self.nameless_cuds_1]) c.remove([self.nameless_cuds_1.uid]) self.assertRaises(KeyError, c.get, self.nameless_cuds_1.uid)
def test_remove_named_component_by_uid(self): c = CUDS() c.add([self.named_cuds_1]) c.remove([self.named_cuds_1.uid]) self.assertRaises(KeyError, c.get_by_name, self.named_cuds_1.name)
def test_remove_dataset(self): ps = Particles('my particles') ps.add([Particle(), Particle()]) c = CUDS() c.add([ps]) c.remove([ps.uid]) self.assertRaises(KeyError, c.get, ps.uid)
# time setting sim_time = api.IntegrationTime(name='simulation_time', current=0.0, final=67, size=1) cuds.add([sim_time]) sim.run() mesh_in_engine = cuds.get_by_name(mesh_name) sm = api.MesoscopicStressModel(name='meso_stress_model') cuds.add([sm]) cuds.remove('simulation_time') sim_time = api.IntegrationTime(name='simulation_time', current=0.0, final=1, size=1) cuds.add([sim_time]) start = time.time() number_of_outer_timesteps = 20 for time_i in range(number_of_outer_timesteps): updated_cells = [] for cell in mesh_in_engine._iter_cells(): strain = cell.data[CUBA.STRAIN_TENSOR] strain_rate = np.linalg.norm(strain)
# time setting sim_time = api.IntegrationTime(name='simulation_time', current=0.0, final=20, size=1) cuds.add([sim_time]) sim.run() mesh_in_engine = cuds.get_by_name(mesh_name) sm = api.MesoscopicStressModel(name='meso_stress_model') cuds.add([sm]) cuds.remove('simulation_time') sim_time = api.IntegrationTime(name='simulation_time', current=0.0, final=1, size=1) cuds.add([sim_time]) start = time.time() number_of_outer_timesteps = 500 print "Working directory: ", mesh_in_engine.path for time_i in range(number_of_outer_timesteps): # solve macroscopic scale print "Solve cfd" sim.run() print "Time: ", mesh_in_engine._time