File: sphere-sphere-ViscElBasic-peri.py

package info (click to toggle)
yade 2025.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,308 kB
  • sloc: cpp: 93,298; python: 50,409; sh: 577; makefile: 162
file content (36 lines) | stat: -rw-r--r-- 1,094 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- encoding=utf-8 -*-

# Testing sphere-sphere interaction in periodic case.
# Pass, if the spheres moves along the X axis, interacting through the period.

sphereRadius = 0.1
tc = 0.001  # collision time
en = 1  # normal restitution coefficient
es = 1  # tangential restitution coefficient
density = 2700
frictionAngle = radians(35)  #
sphereMat = O.materials.append(ViscElMat(density=density, frictionAngle=frictionAngle, tc=tc, en=en, et=es))

# Spheres
sphId = O.bodies.append([sphere((0.4, 0.5, 0.5), 0.1, material=sphereMat), sphere((0.6, 0.5, 0.5), 0.1, material=sphereMat)])
O.bodies[sphId[-1]].state.vel = (0.5, 0, 0)
O.bodies[sphId[0]].state.vel = (-0.5, 0, 0)

## Engines
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom()],
                [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
                [Law2_ScGeom_ViscElPhys_Basic()],
        ),
        NewtonIntegrator(damping=0),
]

O.periodic = True
O.cell.setBox(1, 1, 1)

O.dt = .01 * tc

O.saveTmp()