← Back to team overview

yade-users team mailing list archive

Re: [Question #657790]: Electrostatic material

 

Question #657790 on Yade changed:
https://answers.launchpad.net/yade/+question/657790

    Status: Open => Answered

Chevremont William proposed the following answer:
Hi,

This material has been created to create a potential between two spheres
(only work on spheres for instance). It's already usable as is, but to
enable long range interaction between particles, you have to increase
aabbEnlargeFactor and interactionDetectionFactor.

It implements the DLVO potential.

Here is a test file that plot the potential between the two spheres:

#!/usr/local/bin/yade-trunk -x
# -*- coding: utf-8 -*-
# encoding: utf-8


from yade import plot
import math

# ElectrostaticMat
mat = O.materials.append(ElectrostaticMat(density=1000,young=1e7,poisson=0.3))

# add two spheres
O.bodies.append([
        sphere(center=(0,0,0),radius=6e-6,material=mat,fixed=True),
        sphere(center=(1.3e-5,0,0),radius=6e-6,material=mat, fixed=True)]);

electro_interaction = Law2_ScGeom_ElectrostaticPhys();
#[Bo1_Box_Aabb(),Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]
# Set engines
O.engines=[ForceResetter(),
           InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=10)]),
           InteractionLoop([Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=10)],
                           [Ip2_ElectrostaticMat_ElectrostaticMat_ElectrostaticPhys(DebyeLength=1e-7,Z=5e-12,A=1e-19)],
                           [electro_interaction]),
           NewtonIntegrator(damping=0.2, gravity=(0,0,0)),
           PyRunner(command='upGraph()',iterPeriod=1000)]


O.dt=1e-5;

O.saveTmp();

O.bodies[1].state.vel = (-1e-7,0,0);

#plot.plots={'d':('F0','F1','F2'), 't': ('d')}
plot.plots={'d':('F0')}
plot.plot();

def upGraph():
        p1 = O.bodies[0].state.pos
        p2 = O.bodies[1].state.pos
        
        dist = math.sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2 + (p1[2]-p2[2])**2) - O.bodies[0].shape.radius - O.bodies[1].shape.radius
        
        plot.addData(
                d=dist/6e-6,
                F0=O.forces.f(1)[0],
                F1=O.forces.f(1)[1],
                F2=O.forces.f(1)[2],
                t=O.time);
        
        if O.forces.f(1)[0] < -1.e-10:
                O.bodies[1].state.pos = (1.2e-5,0,0);
                
        if O.forces.f(1)[0] > 0.:
                O.dt = 5e-7;
        
        if dist/6e-6 < -0.01:
               O.stopAtIter = O.iter +1

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.