Beispiel #1
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Insert 800 particles in a cylindrical region
    insert = sim.insert(
        species=1,
        value=800,
        region=("cylinder", "y", 0, 0, 0.7, -0.4, 0.4),
        args={"orientation": "random"},
    )

    # Add viscous force
    air_resistance = sim.addViscous(species=1, gamma=0.1)

    # Run insertion stage
    sim.run(params["stages"]["insertion"], params["dt"])

    # Delete insertion fix
    sim.remove(insert)

    # Rotate mesh along the xoz plane
    sim.moveMesh(name="tumbler",
                 rotate=("origin", 0, 0, 0),
                 axis=(0, 1, 0),
                 period=5e-1)

    # Run rotation stage
    sim.run(params["stages"]["rotation"], params["dt"])
Beispiel #2
0
def run(**params):

	# Create an instance of the DEM class
	sim = simulation.DEM(**params)

	# Setup a stopper wall along the xoy plane
	stopper = sim.setupWall(species=1, wtype='primitive', plane = 'zplane', peq = 0.0)

	# Monitor the time average ensemble kinetic energy
	ke = sim.monitor(var='ke', species='all', name='ensemble_ke', file='ke.dat', nevery=100, nfreq=1000, nrepeat=10)

	# Insert particles in a cubic region
	insert = sim.insert(species=1, region=('block', -5e-4, 5e-4, -5e-4, 5e-4, 2e-3, 3e-3), mech='volumefraction_region', value=1, freq=1e4)
	sim.run(params['stages']['insertion'], params['dt'])
	sim.remove(insert)

	# Rotate the impeller
	rotImp = sim.moveMesh(name='impeller', rotate=('origin', 0, 0, 0), axis=(0, 0, 1), period=5e-2)

	# Blend the system
	sim.run(params['stages']['run'], params['dt'])
	sim.remove(rotImp)

	# Remove stopper and monitor flow
	sim.remove(stopper)
	sim.run(params['stages']['run'], params['dt'])
Beispiel #3
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Insert 800 particles in a cylindrical region
    insert = sim.insert(species=1,
                        value=800,
                        region=('cylinder', 'y', 0, 0, 0.7, -0.4, 0.4),
                        args={'orientation': 'random'})

    # Add viscous force
    air_resistance = sim.addViscous(species=1, gamma=0.1)

    # Run insertion stage
    sim.run(params['stages']['insertion'], params['dt'])

    # Delete insertion fix
    sim.remove(insert)

    # Rotate mesh along the xoz plane
    sim.moveMesh(name='tumbler',
                 rotate=('origin', 0, 0, 0),
                 axis=(0, 1, 0),
                 period=5e-1)

    # Run rotation stage
    sim.run(params['stages']['rotation'], params['dt'])
Beispiel #4
0
def run(**params):
	# Create an instance of the DEM class
	sim = simulation.DEM(**params)

	# Setup a primitive wall along the xoy plane at z=0
	sim.setupWall(species=1, wtype='primitive', plane = 'zplane', peq = 0.0)

	# Insert particles by volume fraction
	sim.insert(species=1, value=1.0, mech='volumefraction_region', region=('block', -xdim, xdim, -xdim, xdim, 0, xdim*8))

	# Run the simulation
	sim.run(params['run'], params['dt'])
Beispiel #5
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a primitive wall along the xoy plane at z=0
    sim.setupWall(species=1, wtype='primitive', plane='zplane', peq=0.0)

    # Insert the particles
    insert = sim.insert(species=1,
                        value=100,
                        region=('block', -1e-3, 1e-3, -1e-3, 1e-3, 0, 3e-3))
    sim.run(params['nsteps'], params['dt'])
    sim.remove(insert)

    # Relax the system
    sim.run(params['nsteps'], params['dt'])
Beispiel #6
0
def run(**params):
    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a primitive wall along the xoy plane at z=0
    sim.setupWall(species=1, wtype="primitive", plane="zplane", peq=0.0)

    # Insert particles by volume fraction
    sim.insert(
        species=1,
        value=1.0,
        mech="volumefraction_region",
        region=("block", -xdim, xdim, -xdim, xdim, 0, xdim * 8),
    )

    # Run the simulation
    sim.run(params["run"], params["dt"])
Beispiel #7
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a stopper wall along the xoy plane
    stopper = sim.setupWall(species=1, wtype="primitive", plane="zplane", peq=0.0)

    # Monitor the time average ensemble kinetic energy
    ke = sim.monitor(
        var="ke",
        species="all",
        name="ensemble_ke",
        file="ke.dat",
        nevery=100,
        nfreq=1000,
        nrepeat=10,
    )

    # Insert particles in a cubic region
    insert = sim.insert(
        species=1,
        region=("block", -5e-4, 5e-4, -5e-4, 5e-4, 2e-3, 3e-3),
        mech="volumefraction_region",
        value=1,
        freq=1e4,
    )
    sim.run(params["stages"]["insertion"], params["dt"])
    sim.remove(insert)

    # Rotate the impeller
    rotImp = sim.moveMesh(
        name="impeller", rotate=("origin", 0, 0, 0), axis=(0, 0, 1), period=5e-2
    )

    # Blend the system
    sim.run(params["stages"]["run"], params["dt"])
    sim.remove(rotImp)

    # Remove stopper and monitor flow
    sim.remove(stopper)
    sim.run(params["stages"]["run"], params["dt"])
Beispiel #8
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a primitive wall along the xoy plane at z=0
    sim.setupWall(species=1, wtype="primitive", plane="zplane", peq=0.0)

    # Insert 200 particles periodically every 8333 steps
    insert = sim.insert(species=1, value=200, freq=params["nsteps"] / 3)
    sim.run(params["nsteps"], params["dt"])
    sim.remove(insert)

    # Move wall at constant speed (0.03 m/s) in the negative z direction
    moveZ = sim.moveMesh(name="wallZ", linear=(0, 0, -0.03))
    sim.run(params["nsteps"] * 2, params["dt"])
    sim.remove(moveZ)

    # Relax the system by moving mesh upwards at 0.01 m/s speed in the positive z direction
    moveZ = sim.moveMesh(name="wallZ", linear=(0, 0, 0.01))
    sim.run(params["nsteps"] * 2, params["dt"])
def run(**params):

	# Create an instance of the DEM class
	sim = simulation.DEM(**params)

	# Setup a primitive wall along the xoy plane at z=0
	sim.setupWall(species=1, wtype='primitive', plane='zplane', peq = 0.0)

	# Insert 200 particles
	insert = sim.insert(species=1, value=200, freq=params['nsteps']/3)
	sim.run(params['nsteps'], params['dt'])
	sim.remove(insert)

	# Move wall at constant speed
	moveZ = sim.moveMesh(name='wallZ', linear=(0, 0, -0.03))
	sim.run(params['nsteps'] * 2, params['dt'])
	sim.remove(moveZ)

	# Relax the system
	moveZ = sim.moveMesh(name='wallZ', linear=(0, 0, 0.01))
	sim.run(params['nsteps'] * 2, params['dt'])
Beispiel #10
0
def run(**params):

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Insert all particles throughout the sim box
    for species in [1, 2]:
        insert = sim.insert(species=species, value=100)

        # Run for a single step to make the insertion
        sim.run(1, params["dt"])

        # Remove insertion
        sim.remove(insert)

    # Run the simulation
    sim.run(params["stages"]["insertion"], params["dt"])

    # Setup params for vibrating mesh
    freq = 40 * 2 * np.pi
    nTaps, period = 100, 1.0 / freq
    nSteps = period / (pDict["dt"])

    for i in range(nTaps):
        moveMesh = sim.moveMesh(
            name="wall",
            viblin=("axis", 0, 0, 1),
            order=1,
            amplitude=12.5e-6,
            phase=0,
            period=period,
        )
        sim.run(nSteps, params["dt"])

        sim.remove(moveMesh)
        # Relax the system if requested by the user

    if params["relax"]:
        sim.run(nSteps, params["dt"])
Beispiel #11
0
def test_run(mpath):

    params = {

        # Define the system
        'boundary': ('f', 'f', 'f'),
        'box': (-1e-3, 1e-3, -1e-3, 1e-3, 0, 4e-3),

        # Define component(s)
        'species': ({
            'material': organic,
            'radius': ('constant', 5e-5)
        }, ),

        # Setup I/O params
        'traj': {
            'freq': 1000,
            'pfile': 'particles*.dump',
            'mfile': 'mesh*.vtk'
        },

        # Output dir name
        'output': 'DEM_flow',

        # Define computational parameters
        'dt': 1e-6,

        # Apply a gravitional force in the negative direction along the z-axis
        'gravity': (9.81, 0, 0, -1),

        # Import hopper mesh
        'mesh': {
            'hopper': {
                'file': os.path.join(mpath, 'mesh', 'silo.stl'),
                'mtype': 'mesh/surface',
                'material': glass,
                'args': {
                    'scale': 1e-3
                }
            },
            'impeller': {
                'file': os.path.join(mpath, 'mesh', 'valve.stl'),
                'mtype': 'mesh/surface',
                'material': glass,
                'args': {
                    'move': (0, 0, 1),
                    'scale': 1e-3
                }
            }
        },

        # Stage runs
        'stages': {
            'insertion': 1e4,
            'run': 1e4
        },
    }

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a stopper wall along the xoy plane
    stopper = sim.setupWall(species=1,
                            wtype='primitive',
                            plane='zplane',
                            peq=0.0)

    # Monitor the time average ensemble kinetic energy
    ke = sim.monitor(var='ke',
                     species='all',
                     name='ensemble_ke',
                     file='ke.dat',
                     nevery=100,
                     nfreq=1000,
                     nrepeat=10)

    # Insert particles in a cubic region
    insert = sim.insert(species=1,
                        region=('block', -5e-4, 5e-4, -5e-4, 5e-4, 2e-3, 3e-3),
                        mech='volumefraction_region',
                        value=1,
                        freq=1e4)
    sim.run(params['stages']['insertion'], params['dt'])
    sim.remove(insert)

    # Rotate the impeller
    rotImp = sim.moveMesh(name='impeller',
                          rotate=('origin', 0, 0, 0),
                          axis=(0, 0, 1),
                          period=5e-2)

    # Blend the system
    sim.run(params['stages']['run'], params['dt'])
    sim.remove(rotImp)

    # Remove stopper and monitor flow
    sim.remove(stopper)
    sim.run(params['stages']['run'], params['dt'])
	# Apply gravitional force in the negative direction along the z-axis
	'gravity': (9.81, 0, 0, -1),

	# Stage runs
	'stages': {'insertion': 1e8, 'run': 1e7, 'relax': 0e5},

	# Meshes
	#'mesh': {
	#	'wall': {'file': 'square.stl', 'mtype': 'mesh/surface/stress', 'material': stearicAcid, \
	#		 'args': {'scale': 2.5e-4, 'move': (0, 0, -8e-4)}
	#	},
	#},
}

# Create an instance of the DEM class
sim = sim.DEM(**params)

# Insert all particles throughout the sim box
for species in [1,2]:
	insert = sim.insert(species, value=100)
	sim.run(1, params['dt'])

	# Remove insertion
	sim.remove(insert)

# Run the simulation
sim.run(params['stages']['insertion'], params['dt'])


# Setup params for vibrating mesh
freq = 40 * 2 * np.pi
    # Apply gravitional force in the negative direction along the z-axis
    'gravity': (9.81, 0, 0, -1),

    # Number of simulation steps (non-PyGran variable)
    'nsteps':
    1e3,

    # Number of concurrent simulations to run
    'nSim':
    nSim
}

if __name__ == '__main__':

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a primitive wall along the xoy plane at z=0
    sim.setupWall(species=1, wtype='primitive', plane='zplane', peq=0.0)

    # Insert the particles
    insert = sim.insert(species=1,
                        value=100,
                        region=('block', -1e-3, 1e-3, -1e-3, 1e-3, 0, 3e-3))
    sim.run(params['nsteps'], params['dt'])
    sim.remove(insert)

    # Relax the system
    sim.run(params['nsteps'], params['dt'])
Beispiel #14
0
def test_run(mpath="tests/test_sim"):

    params = {
        # Define the system
        "boundary": ("f", "f", "f"),
        "box": (-1e-3, 1e-3, -1e-3, 1e-3, 0, 4e-3),
        # Define component(s)
        "species": ({
            "material": organic,
            "radius": ("constant", 5e-5)
        }, ),
        # Setup I/O params
        "traj": {
            "freq": 1000,
            "pfile": "particles*.dump",
            "mfile": "mesh*.vtk"
        },
        # Output dir name
        "output": "DEM_flow",
        # Define computational parameters
        "dt": 1e-6,
        # Apply a gravitional force in the negative direction along the z-axis
        "gravity": (9.81, 0, 0, -1),
        # Import hopper mesh
        "mesh": {
            "hopper": {
                "file": os.path.join(mpath, "mesh", "silo.stl"),
                "mtype": "mesh/surface",
                "material": glass,
                "args": {
                    "scale": 1e-3
                },
            },
            "impeller": {
                "file": os.path.join(mpath, "mesh", "valve.stl"),
                "mtype": "mesh/surface",
                "material": glass,
                "args": {
                    "move": (0, 0, 1),
                    "scale": 1e-3
                },
            },
        },
        # Stage runs
        "stages": {
            "insertion": 1e4,
            "run": 1e4
        },
    }

    # Create an instance of the DEM class
    sim = simulation.DEM(**params)

    # Setup a stopper wall along the xoy plane
    stopper = sim.setupWall(species=1,
                            wtype="primitive",
                            plane="zplane",
                            peq=0.0)

    # Monitor the time average ensemble kinetic energy
    ke = sim.monitor(
        var="ke",
        species="all",
        name="ensemble_ke",
        file="ke.dat",
        nevery=100,
        nfreq=1000,
        nrepeat=10,
    )

    # Insert particles in a cubic region
    insert = sim.insert(
        species=1,
        region=("block", -5e-4, 5e-4, -5e-4, 5e-4, 2e-3, 3e-3),
        mech="volumefraction_region",
        value=1,
        freq=1e4,
    )
    sim.run(params["stages"]["insertion"], params["dt"])
    sim.remove(insert)

    # Rotate the impeller
    rotImp = sim.moveMesh(name="impeller",
                          rotate=("origin", 0, 0, 0),
                          axis=(0, 0, 1),
                          period=5e-2)

    # Blend the system
    sim.run(params["stages"]["run"], params["dt"])
    sim.remove(rotImp)

    # Remove stopper and monitor flow
    sim.remove(stopper)
    sim.run(params["stages"]["run"], params["dt"])