def test(self): import object_in_fluid as oif system = espressomd.System(box_l=(10, 10, 10)) self.assertEqual(system.max_oif_objects, 0) system.time_step = 0.4 system.cell_system.skin = 0.5 system.thermostat.set_langevin(kT=0, gamma=0.7, seed=42) # creating the template for OIF object cell_type = oif.OifCellType( nodes_file=abspath("data/sphere393nodes.dat"), triangles_file=abspath("data/sphere393triangles.dat"), system=system, ks=1.0, kb=1.0, kal=1.0, kag=0.1, kv=0.1, check_orientation=False, resize=(3.0, 3.0, 3.0)) # creating the OIF object cell0 = oif.OifCell(cell_type=cell_type, particle_type=0, origin=[5.0, 5.0, 5.0]) self.assertEqual(system.max_oif_objects, 1) # cell0.output_vtk_pos_folded(file_name="cell0_0.vtk") # fluid diameter_init = cell0.diameter() print("initial diameter = " + str(diameter_init)) # OIF object is being stretched by factor 1.5 maxCycle = 500 system.part[:].pos = (system.part[:].pos - 5) * 1.5 + 5 diameter_stretched = cell0.diameter() print("stretched diameter = " + str(diameter_stretched)) # main integration loop # OIF object is let to relax into relaxed shape of the sphere for i in range(3): system.integrator.run(steps=90) diameter_final = cell0.diameter() print("final diameter = " + str(diameter_final)) self.assertAlmostEqual(diameter_final / diameter_init - 1, 0, delta=0.005)
# sim_info = open(directory + "/sim_info.dat", "a") # sim_info.write("\n") # sim_info.write("\n") # sim_info.write("all cells were created: " + str(datetime.datetime.now()) + "\n") # sim_info.close() # # Pre seeding z nodes.dat for id, pos in enumerate(cell_positions): if id < diffCells: # if (id < diffCells/2) or ((num_cells/2)-1 < id < (num_cells/2)+(diffCells/2)): # pre dlzku kanala 120mu - rovnaky seeding 2x za sebou print("id = " + str(id) + " type_1") sim_info = open(directory + "/sim_info.dat", "a") sim_info.write("cell " + str(id) + " -> type_1 | ") sim_info.close() cell_rbc = oif.OifCell(cell_type=rbc_type_1, particle_type=id, origin=pos, particle_mass=mass_rbc / nnode_rbc) cell_rbc.set_mesh_points("seeding/seeding_hct15_4_cy1190000/nodes" + str(id) + ".dat") rbcs.append(cell_rbc) else: print("id = " + str(id) + " type_2") sim_info = open(directory + "/sim_info.dat", "a") sim_info.write("cell " + str(id) + " -> type_2 | ") sim_info.close() cell_rbc = oif.OifCell(cell_type=rbc_type_2, particle_type=id, origin=pos, particle_mass=mass_rbc / nnode_rbc) cell_rbc.set_mesh_points("seeding/seeding_hct15_4_cy1190000/nodes" + str(id) + ".dat")
# creating the template for cells cellType = oif.OifCellType(nodes_file=fileNodes, triangles_file=fileTriangles, system=system, ks=ks, kb=kb, kal=kal, kag=kag, kv=kv, kvisc=kvisc, resize=[stretch, stretch, stretch]) # creating the RBC cell = oif.OifCell(cell_type=cellType, particle_type=0, origin=[originX, originY, originZ], rotate=[np.pi / 2.0, 0.0, 0.0], particle_mass=partMass) # fluid lbf = lb.LBFluid(agrid=grid, dens=dens, visc=visc, tau=timeStep) system.actors.add(lbf) system.thermostat.set_lb(LB_fluid=lbf, gamma=friction) # consider taking all nodes that have x coordinate approximately <5% or >95% total rightStretchedParticles = list() leftStretchedParticles = list() for i in cell.mesh.points: posI = (i.get_pos()[0] - cell.get_origin()[0]) / stretch if (posI >= xBoundMinR and posI <= xBoundMaxR):
boxX = 22.0 boxY = 14.0 boxZ = 15.0 time_step = 0.1 system = espressomd.System(box_l=(boxX, boxY, boxZ)) system.time_step = time_step system.cell_system.skin = 0.2 # creating the template for RBCs cell_type = oif.OifCellType( nodes_file="input/rbc374nodes.dat", triangles_file="input/rbc374triangles.dat", system=system, ks=0.04, kb=0.016, kal=0.02, kag=0.9, kv=1.0, check_orientation=False, resize=(2.0, 2.0, 2.0)) # creating the RBCs cell0 = oif.OifCell(cell_type=cell_type, particle_type=0, origin=[5.0, 5.0, 3.0]) cell1 = oif.OifCell(cell_type=cell_type, particle_type=1, origin=[5.0, 5.0, 7.0]) # cell-wall interactions system.non_bonded_inter[0, 10].soft_sphere.set_params( a=0.0001, n=1.2, cutoff=0.1, offset=0.0) system.non_bonded_inter[1, 10].soft_sphere.set_params( a=0.0001, n=1.2, cutoff=0.1, offset=0.0) # fluid lbf = espressomd.lb.LBFluid(agrid=1, dens=1.0, visc=1.5, tau=0.1, ext_force_density=[0.002, 0.0, 0.0]) system.actors.add(lbf) system.thermostat.set_lb(LB_fluid=lbf, gamma=1.5)
def test(self): import object_in_fluid as oif system = espressomd.System(box_l=(10, 10, 10)) self.assertEqual(system.max_oif_objects, 0) system.time_step = 0.4 system.cell_system.skin = 0.5 # creating the template for OIF object cell_type = oif.OifCellType( nodes_file=abspath("data/sphere393nodes.dat"), triangles_file=abspath("data/sphere393triangles.dat"), system=system, ks=1.0, kb=1.0, kal=1.0, kag=0.1, kv=0.1, check_orientation=False, resize=(3.0, 3.0, 3.0)) # creating the OIF object cell0 = oif.OifCell(cell_type=cell_type, particle_type=0, origin=[5.0, 5.0, 5.0]) self.assertEqual(system.max_oif_objects, 1) # cell0.output_vtk_pos_folded(file_name="cell0_0.vtk") # fluid diameter_init = cell0.diameter() print("initial diameter = " + str(diameter_init)) # OIF object is being stretched by factor 1.5 system.part[:].pos = (system.part[:].pos - 5) * 1.5 + 5 diameter_stretched = cell0.diameter() print("stretched diameter = " + str(diameter_stretched)) # Apply non-isotropic deformation system.part[:].pos = system.part[:].pos * np.array((0.96, 1.05, 1.02)) # Test that restoring forces net to zero and don't produce a torque system.integrator.run(1) np.testing.assert_allclose(np.sum(system.part[:].f, axis=0), [0., 0., 0.], atol=1E-12) total_torque = np.zeros(3) for p in system.part: total_torque += np.cross(p.pos, p.f) np.testing.assert_allclose(total_torque, [0., 0., 0.], atol=2E-12) # main integration loop system.thermostat.set_langevin(kT=0, gamma=0.7, seed=42) # OIF object is let to relax into relaxed shape of the sphere for _ in range(2): system.integrator.run(steps=240) diameter_final = cell0.diameter() print("final diameter = " + str(diameter_final)) self.assertAlmostEqual(diameter_final / diameter_init - 1, 0, delta=0.005)
triangles_file="input/sphere642triangles.dat", check_orientation=False, system=system, ks=0.02, kb=0.1, kal=0.05, kag=0.7, kv=0.9, normal=True, resize=[cell_radius, cell_radius, cell_radius]) # create cells cells = [] for i in range(4): cells.append(oif.OifCell(cell_type=typeCell_soft, particle_type=i, origin=cell_positions[i], particle_mass=0.5)) # cell-wall interactions for i in range(len(cells)): system.non_bonded_inter[i,boundary_particle_type].soft_sphere.set_params(a=0.002, n=1.5, cutoff=0.8, offset=0.0) # cell-cell interactions # attractive Morse, repulsive soft_sphere (membrane collision can be used here instead of soft-sphere): for i in range(len(cells)): for j in range(i+1, len(cells)): system.non_bonded_inter[i,j].morse.set_params(eps=0.4, alpha=0.2,