sedimentation.jl (1325B)
1 #/usr/bin/env julia 2 import Granular 3 4 #### Create a loose granular assemblage and let it settle at towards -y 5 sim = Granular.createSimulation(id="sedimentation") 6 7 # Generate 10 grains along x and 25 grains along y, with radii between 0.2 and 8 # 1.0 m. 9 Granular.regularPacking!(sim, [7, 25], 0.02, 0.2, 10 tiling="triangular", 11 padding_factor=0.1) 12 13 # Visualize the grain-size distribution 14 #Granular.plotGrainSizeDistribution(sim) 15 16 # Create a grid for contact searching spanning the extent of the grains in the 17 # simulation 18 Granular.fitGridToGrains!(sim, sim.ocean) 19 20 # Make the grid boundaries impermeable for the grains, which 21 Granular.setGridBoundaryConditions!(sim.ocean, "impermeable") 22 23 # Add gravitational acceleration to all grains 24 g = [0., -9.8] 25 for grain in sim.grains 26 Granular.addBodyForce!(grain, grain.mass*g) 27 end 28 29 # Automatically set the computational time step based on grain sizes and 30 # properties 31 Granular.setTimeStep!(sim) 32 33 # Set the total simulation time for this step [s] 34 Granular.setTotalTime!(sim, 10.0) 35 36 # Set the interval in model time between simulation files [s] 37 Granular.setOutputFileInterval!(sim, 0.2) 38 39 # Start the simulation 40 Granular.run!(sim) 41 42 # Try to render the simulation if `pvpython` is installed on the system 43 Granular.render(sim, trim=false)