def analytical_displacement(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density Uf = mObj.fluid_velocity epsf = mObj.porosity dp = mObj.diameter rhop = mObj.density kn = mObj.kn ylo = mObj.ylo yhi = mObj.yhi s = mObj.lattice_scale g = -mObj.gravity # Obtain the pressure gradient across sample, and the inlet pressure # (assuming that the outlet pressure is zero) if dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf/epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf/epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') fdi = fObj.calculate_drag_force(Uf=Uf/epsf, Vp=0.) volume = (np.pi/6)*dp**3 fi = volume*rhop*g - volume*rhof*g + fdi H = yhi-ylo N = H/s disp = 0.5*N*(N+1)*fi/kn xySol = (yhi - 0.5*dp) + disp return xySol
def analytical_displacement(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density Uf = mObj.fluid_velocity epsf = mObj.epsf dp = mObj.diameter rhop = mObj.density kn = mObj.kn y0 = mObj.y0 g = -mObj.gravity if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') fdi = fObj.calculate_drag_force(Uf=Uf / epsf, Vp=0.) volume = (np.pi / 6) * dp**3 fi = volume * rhop * g - volume * rhof * g + fdi disp = fi / kn xySol = y0 + disp return xySol
def analytical_pressure(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density Uf = mObj.Uf dp = mObj.diameter epsf = mObj.epsf xyzL = mObj.xyzL xyz_orig = mObj.xyz_orig # Obtain the pressure gradient across sample, and the inlet pressure # (assuming that the outlet pressure is zero) if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ('Unknown drag force model specified') gradP = fObj.calculate_pressure_gradient(Uf=Uf / epsf, Vp=0.) pSol = gradP * (xyzL[1] - xyz_orig[1]) return pSol
def analytical_pressure(mObj): dragModel = mObj.dragModel muf = mObj.muf rhof = mObj.rhof Uf = mObj.Uf dp = mObj.dp epsf = mObj.epsf xyzL = mObj.xyzL xyz_orig = mObj.xyz_orig if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') gradP = fObj.calculate_pressure_gradient(Uf=Uf / epsf, Vp=0.) pSol = gradP * (xyzL[1] - xyz_orig[1]) return pSol
def analytical_pressure_displacement(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density Uf = mObj.Uf epsf = mObj.epsf dp = mObj.diameter rhop = mObj.density kn = mObj.kn ylo = mObj.ylo yhi = mObj.yhi s = mObj.lattice_scale g = -mObj.gravity # Obtain the pressure gradient across sample, and the inlet pressure # (assuming that the outlet pressure is zero). Note that pSol is the # pressure at the outlet due to the drag force only and does not include # any contribution of the pressure gradient due to the presence of # gravity. This is added on when we get to the settlement calculation # below. if dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') gradP = fObj.calculate_pressure_gradient(Uf=Uf / epsf, Vp=0.) H = yhi - ylo pSol = gradP * H fdi = fObj.calculate_drag_force(Uf=Uf / epsf, Vp=0.) volume = (np.pi / 6) * dp**3 fi = volume * rhop * g - volume * rhof * g + fdi / epsf N = H / s disp = 0.5 * N * (N + 1) * fi / kn xySol = (yhi - 0.5 * dp) + disp return pSol, xySol
def analytical_force(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density dp = mObj.diameter vy0 = mObj.vy0 epsf = mObj.epsf if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) else: raise ValueError('Unknown drag force model specified') fySol = fObj.calculate_drag_force(Uf=0., Vp=vy0) return fySol
def analytical_displacement(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density Uf = mObj.Uf epsf = mObj.epsf dp = mObj.diameter rhop = mObj.density kn = mObj.kn y0 = mObj.y0 g = -mObj.gravity if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ('Unknown drag force model specified') if y0 < 1.0: CORRECTION_FACTOR = 0.5 else: CORRECTION_FACTOR = 1.0 fdi = fObj.calculate_drag_force(Uf=Uf / epsf, Vp=0.) print(fdi) volume = (np.pi / 6) * dp**3 fi = volume * rhop * g - CORRECTION_FACTOR * volume * rhof * g + CORRECTION_FACTOR * fdi disp = fi / kn xySol = y0 + disp return xySol
def analytical_force(mObj): dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density dp = mObj.diameter vy0 = mObj.vy0 # Note cell volume hard-wired (for ease) CELL_VOLUME = 0.1**3 epsf = (CELL_VOLUME - (np.pi / 6) * dp**3) / CELL_VOLUME if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) else: raise ValueError('Unknown drag force model specified') fySol = fObj.calculate_drag_force(Uf=0., Vp=vy0) return fySol
# Extract relevant parameters from the LAMMPS input script. mObj = LAMMPS_Input('./lammps/constant.in') dragModel = mObj.dragModel muf = mObj.dynamic_viscosity rhof = mObj.fluid_density dp = mObj.diameter vy0 = mObj.vy0 CELL_VOLUME = ((xyzL[0] - xyz_orig[0]) / ncxyz[0]) * ( (xyzL[1] - xyz_orig[1]) / ncxyz[1]) * ((xyzL[2] - xyz_orig[2]) / ncxyz[2]) epsf = (CELL_VOLUME - (np.pi / 6) * (dp**3)) / CELL_VOLUME if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=0., Vp=vy0) else: raise ValueError('Unknown drag force model specified') # initialise MPI comm = MPI.COMM_WORLD # Initialise CPL CPL = CPL() CFD_COMM = CPL.init(CPL.CFD_REALM) cart_comm = CFD_COMM.Create_cart([npxyz[0], npxyz[1], npxyz[2]]) CPL.setup_cfd(cart_comm, xyzL, xyz_orig, ncxyz) # Setup send and recv buffers
comm = MPI.COMM_WORLD # Initialise CPL CPL = CPL() MD_COMM = CPL.init(CPL.MD_REALM) CPL.setup_md(MD_COMM.Create_cart([npxyz[0], npxyz[1], npxyz[2]]), xyzL, xyz_orig) # Setup send and recv buffers recvbuf, sendbuf = CPL.get_arrays(recv_size=9, send_size=8) # Setup drag force object if dragModel == 'Drag' or dragModel == 'Stokes': fObj = Stokes(muf=muf, epsf=epsf, dp=dp) elif dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf / epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') # Main time loop for time in range(200): print(time) # Recv data: # [Ux, Uy, Uz, gradPx, gradPy, gradPz, divTaux, divTauy, divTauz] recvbuf, ierr = CPL.recv(recvbuf) # Zero send buffer. Set the sum of drag coeff and particle volumes only # (noting that CPLSocketFOAM divides by sample volume). Assumes entire
# initialise MPI comm = MPI.COMM_WORLD # Initialise CPL CPL = CPL() CFD_COMM = CPL.init(CPL.CFD_REALM) cart_comm = CFD_COMM.Create_cart([npxyz[0], npxyz[1], npxyz[2]]) CPL.setup_cfd(cart_comm, xyzL, xyz_orig, ncxyz) # Setup send and recv buffers recvbuf, sendbuf = CPL.get_arrays(recv_size=8, send_size=9) # Setup drag force object if dragModel == 'DiFelice': fObj = DiFelice(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf/epsf, Vp=0.) elif dragModel == 'Ergun': fObj = Ergun(muf=muf, rhof=rhof, epsf=epsf, dp=dp, Uf=Uf/epsf, Vp=0.) else: raise ValueError('Unknown drag force model specified') # Main time loop for time in range(400): # print(time) if time == 0: Vp = np.array([0.0]) # Update drag coefficients for new particle velocities and calculate gradient # due to drag forces.