def get_input_parameters(md_input_file, cfd_input_file):
    mObj = LAMMPS_Input(md_input_file)
    cObj = MOCK_Input(cfd_input_file)

    # Calculate porosity and add to mObj
    Vc = ((cObj.xyzL[0] - cObj.xyz_orig[0]) / cObj.ncxyz[0]) * (
        (cObj.xyzL[1] - cObj.xyz_orig[1]) / cObj.ncxyz[1]) * (
            (cObj.xyzL[2] - cObj.xyz_orig[2]) / cObj.ncxyz[2])
    mObj.epsf = (Vc - (np.pi / 6) * (mObj.diameter**3)) / Vc

    return mObj
Exemple #2
0
def get_input_parameters(md_input_file='./lammps/resting.in',
                         cfd_case_dir='./openfoam'):
    # LAMMPS script
    mObj = LAMMPS_Input(md_input_file)

    # Note cell volume hard-wired (for ease)
    CELL_VOLUME = 0.1**3
    mObj.epsf = (CELL_VOLUME - (np.pi / 6) * mObj.diameter**3) / CELL_VOLUME

    cObj = OpenFOAM_Input(case_dir=cfd_case_dir)
    _, Uf = cObj.read_0_file('./openfoam/0/Ub', 'inlet')
    mObj.Uf = Uf[1]

    return mObj
Exemple #3
0
def get_input_parameters(md_input_file='./lammps/fluidised.in', cfd_case_dir='./openfoam/'):    
    mObj = LAMMPS_Input(md_input_file)

    # OpenFOAM case 
    cObj = OpenFOAM_Input(case_dir=cfd_case_dir)
    _, Uf = cObj.read_0_file('./openfoam/0/Ub', 'inlet')
    mObj.fluid_velocity = Uf[1]
    g = cObj.read_constant_file('./openfoam/constant/environmentalProperties', 'g')[1]
    rhof = cObj.read_constant_file('./openfoam/constant/transportProperties', 'rhob')
    nuf = cObj.read_constant_file('./openfoam/constant/transportProperties', 'nub')
    muf = nuf*rhof
    assert(mObj.gravity == -g)
    assert(mObj.fluid_density == rhof)
    assert(mObj.dynamic_viscosity == muf)

    return mObj
Exemple #4
0
def get_input_parameters(md_input_file='./lammps/column.in',
                         cfd_case_dir='./openfoam/'):
    # LAMMPS script
    mObj = LAMMPS_Input(md_input_file)
    mObj.xyz_orig = np.array([mObj.xlo, mObj.ylo, mObj.zlo],
                             order='F',
                             dtype=np.float64)
    mObj.xyzL = np.array([mObj.xhi, mObj.yhi, mObj.zhi],
                         order='F',
                         dtype=np.float64)

    # The porosity is hardwired to the value of a simple cubic array.
    mObj.epsf = 0.476401224402

    # OpenFOAM case
    cObj = OpenFOAM_Input(cfd_case_dir)
    _, Uf = cObj.read_0_file('./openfoam/0/Ub', 'inlet')
    mObj.Uf = Uf[1]
    rhof = cObj.read_constant_file('./openfoam/constant/transportProperties',
                                   'rhob')
    nuf = cObj.read_constant_file('./openfoam/constant/transportProperties',
                                  'nub')
    muf = nuf * rhof
    assert (mObj.fluid_density == rhof)
    assert (mObj.dynamic_viscosity == muf)

    return mObj
Exemple #5
0
def get_input_parameters(md_input_file='./lammps/suzuki.in',
                         cfd_case_dir='./openfoam/'):
    # LAMMPS input script
    mObj = LAMMPS_Input(md_input_file)

    # The porosity is hardwired to the value of a simple cubic array.
    mObj.epsf = 0.476401224402

    # OpenFOAM case
    cObj = OpenFOAM_Input(case_dir=cfd_case_dir)
    _, Uf = cObj.read_0_file('./openfoam/0/Ub', 'inlet')
    mObj.Uf = Uf[1]
    g = cObj.read_constant_file('./openfoam/constant/environmentalProperties',
                                'g')[1]
    rhof = cObj.read_constant_file('./openfoam/constant/transportProperties',
                                   'rhob')
    nuf = cObj.read_constant_file('./openfoam/constant/transportProperties',
                                  'nub')
    muf = nuf * rhof
    assert (mObj.gravity == -g)
    assert (mObj.fluid_density == rhof)
    assert (mObj.dynamic_viscosity == muf)

    return mObj
Exemple #6
0
def get_input_parameters(md_input_file='./lammps/terminal.in', cfd_case_dir='./openfoam/'):    
    # LAMMPS script
    mObj = LAMMPS_Input(md_input_file)

    # OpenFOAM case 
    cObj = OpenFOAM_Input(case_dir=cfd_case_dir)
    cObj.g = cObj.read_constant_file('./openfoam/constant/environmentalProperties', 'g')[1]
    cObj.rhof = cObj.read_constant_file('./openfoam/constant/transportProperties', 'rhob')
    nuf = cObj.read_constant_file('./openfoam/constant/transportProperties', 'nub')
    cObj.muf = nuf*cObj.rhof
    assert(mObj.gravity == -cObj.g)
    assert(mObj.fluid_density == cObj.rhof)
    assert(mObj.dynamic_viscosity == cObj.muf)

    return mObj
Exemple #7
0
def get_input_parameters(md_input_file='./lammps/suzuki.in'):    
    mObj = LAMMPS_Input(md_input_file)

    return mObj
npxyz = [1, 1, 1]
xyzL = [0.1, 10.0, 0.1]
xyz_orig = [0.0, 0.0, 0.0]
ncxyz = [1, 100, 1]
# --------------------------------------------------------
# USER INPUT - END
# --------------------------------------------------------

# Parameters of the cpu topology (cartesian grid)
npxyz = np.array(npxyz, order='F', dtype=np.int32)
xyzL = np.array(xyzL, order='F', dtype=np.float64)
xyz_orig = np.array(xyz_orig, order='F', dtype=np.float64)
ncxyz = np.array(ncxyz, order='F', dtype=np.int32)

# Extract relevant parameters from the LAMMPS input script.
mObj = LAMMPS_Input(input_file='./lammps/terminal.in')
muf = mObj.dynamic_viscosity
rhof = mObj.fluid_density
dp = mObj.diameter
rhop = mObj.density
g = -mObj.gravity

Vc = ((xyzL[0]-xyz_orig[0])/ncxyz[0])*((xyzL[1]-xyz_orig[1])/ncxyz[1])*((xyzL[2]-xyz_orig[2])/ncxyz[2])
epsf = (Vc - (np.pi/6)*(dp**3))/Vc

# Initialise drag force object
fObj = Stokes(muf=muf, dp=dp, epsf=epsf)

# initialise MPI
comm = MPI.COMM_WORLD
npxyz = [1, 1, 1]
xyzL = [0.1, 10.0, 0.1]
xyz_orig = [0.0, 0.0, 0.0]
ncxyz = [1, 100, 1]
# --------------------------------------------------------
# USER INPUT - END
# --------------------------------------------------------

# Parameters of the cpu topology (cartesian grid)
npxyz = np.array(npxyz, order='F', dtype=np.int32)
xyzL = np.array(xyzL, order='F', dtype=np.float64)
xyz_orig = np.array(xyz_orig, order='F', dtype=np.float64)
ncxyz = np.array(ncxyz, order='F', dtype=np.int32)

# 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':
Exemple #10
0
def get_input_parameters(md_input_file='./lammps/fluidised.in'):    
    mObj = LAMMPS_Input(md_input_file)

    return mObj
import sys
import numpy as np
import matplotlib.pyplot as plt

# Add python scripts to path and import required classes
sys.path.append('../python_scripts/')
from LAMMPS_Input import LAMMPS_Input

# Extract relevant parameters from the LAMMPS input script.
mObj = LAMMPS_Input('./lammps/fluidised.in')
dp = mObj.diameter
epsf = mObj.porosity
rhop = mObj.density
rhof = mObj.fluid_density
muf = mObj.dynamic_viscosity
g = mObj.gravity

# Range of inlet (superficial) velocity
Umf = np.linspace(0.5, 2.0, 100)

# Effective weight term
Ar = np.ones_like(Umf) * (1 - epsf) * (rhop - rhof) * g

# Driving fluid term (Di Felice)
Re = rhof * dp * Umf / muf
chi = 3.7 - 0.65 * np.exp(-0.5 * ((1.5 - np.log10(Re))**2))
Cd = (0.63 + 4.8 / np.sqrt(Re))**2
gradP_DiFelice = (3 * Cd * rhof /
                  (4 * dp)) * (1 - epsf) * (epsf**(-1 - chi)) * (Umf**2)

# Driving fluid term (Ergun)
Exemple #12
0
def get_input_parameters(md_input_file='./lammps/constant.in'):
    mObj = LAMMPS_Input(md_input_file)

    return mObj
# --------------------------------------------------------
npxyz = [1, 1, 1]
xyzL = [0.1, 10.0, 0.1]
xyz_orig = [0.0, 0.0, 0.0]
ncxyz = [1, 100, 1]
# --------------------------------------------------------
# --------------------------------------------------------

# Parameters of the cpu topology (cartesian grid)
npxyz = np.array(npxyz, order='F', dtype=np.int32)
xyzL = np.array(xyzL, order='F', dtype=np.float64)
xyz_orig = np.array(xyz_orig, order='F', dtype=np.float64)
ncxyz = np.array(ncxyz, order='F', dtype=np.int32)

# Extract relevant parameters from the LAMMPS input script.
mObj = LAMMPS_Input('./lammps/suzuki.in')
dragModel = mObj.dragModel
muf = mObj.dynamic_viscosity
rhof = mObj.fluid_density
Uf = mObj.fluid_velocity
epsf = mObj.porosity
dp = mObj.diameter
g = -mObj.gravity

# 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]])