if (nprocs_realm != NProcs): print("ERROR: ", "Number of processes is not coherent.", file=sys.stderr) MPI.Abort() # Create cartesian communicator and initialize cart_comm = realm_comm.Create_cart([NPx, NPy, NPz]) lib.cfd_init2(nsteps, dt, cart_comm, xyzL, xyz_orig, ncxyz, 1.0) my_coords = cart_comm.Get_coords(cart_comm.Get_rank()) my_coords = np.array(my_coords, order='F', dtype=np.int32) olap_limits = lib.get_olap_limits() # Constrained region cell limits and number of cells cnstFRegion = lib.get_cnst_limits() cnstFPortion = lib.my_proc_portion(cnstFRegion) [cnstncx, cnstncy, cnstncz] = lib.get_no_cells(cnstFPortion) # Velocity averaging region cell limits and number of cells velBCRegion = np.copy(olap_limits) velBCRegion[3] = velBCRegion[2] velBCPortion = lib.my_proc_portion(velBCRegion) [velBCncx, velBCncy, velBCncz] = lib.get_no_cells(velBCPortion) # Send dummy stress distribution (constant value of stress = 0) to MD scatter_array = np.zeros((9, cnstncx, cnstncy, cnstncz), order='F', dtype=np.float64) recv_array = np.zeros((9, 0, 0, 0), order='F', dtype=np.float64) lib.scatter(scatter_array, cnstFRegion, recv_array) # Receive averaged velocities from LAMMPS socket recv_array = np.zeros((4, velBCncx, velBCncy, velBCncz), order='F', dtype=np.float64)