← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3850: added and modified examples for MortarMat

 

------------------------------------------------------------
revno: 3850
committer: Jan Stransky <jan.stransky@xxxxxxxxxxx>
timestamp: Wed 2016-04-20 10:56:13 +0200
message:
  added and modified examples for MortarMat
removed:
  examples/mortar/matModel.py
  examples/mortar/matModel2.py
added:
  examples/mortar/modelTests/
  examples/mortar/modelTests/compression.py
  examples/mortar/modelTests/failureEnvelope.py
  examples/mortar/modelTests/shear.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== removed file 'examples/mortar/matModel.py'
--- examples/mortar/matModel.py	2016-04-13 16:45:33 +0000
+++ examples/mortar/matModel.py	1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-from yade import plot
-
-dt = 1e-5
-
-mortar = MortarMat()
-polyMat = PolyhedraMat()
-for mat in (mortar,polyMat):
-	O.materials.append(mat)
-
-def sim(angle):
-	O.reset()
-	O.dt = dt
-	bs = b1,b2 = [polyhedron(((-1,-1,-1),(+1,-1,-1),(-1,+1,-1),(+1,+1,-1),(-1,-1,+1),(+1,-1,+1),(-1,+1,+1),(+1,+1,+1)),material=mortar) for i in (0,1)]
-	b2.state.pos = (0,0,2)
-	for b in bs:
-		b.state.blockedDOFs = 'xyzXYZ'
-	O.bodies.append(bs)
-	#
-	factor=1.1
-	O.engines=[
-		ForceResetter(),
-		InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]),
-		InteractionLoop(
-			[Ig2_Polyhedra_Polyhedra_PolyhedraGeomOrScGeom(label='ig2')], 
-			[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_MortarMat_MortarMat_MortarPhys()],
-			[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric(),Law2_ScGeom_MortarPhys_Lourenco()]
-		),
-		NewtonIntegrator(),
-	]
-	ig2.ig2scGeom.interactionDetectionFactor = factor
-	O.step()
-	ig2.ig2scGeom.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1
-	b2.state.vel = (sin(angle),0,cos(angle))
-	while len([i for i in O.interactions]):
-		sn,st = i.phys.sigmaN, i.phys.sigmaT.norm()
-		O.step()
-		if O.iter > 1e6:
-			raise RuntimeError, "TODO"
-	plot.addData(sn=sn,st=st)
-
-n = 50
-for i in xrange(n):
-	sim(i*pi/(n-1))
-
-plot.plots = {'sn':'st'}
-plot.matplotlib.pyplot.axes().set_aspect(1)
-p = plot.plot()

=== removed file 'examples/mortar/matModel2.py'
--- examples/mortar/matModel2.py	2016-04-19 01:32:36 +0000
+++ examples/mortar/matModel2.py	1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-from yade import plot
-
-dt = 1
-young=1e9
-
-x,y,z = .2,.5,.7
-
-mortar = MortarMat(young=young)
-polyMat = PolyhedraMat(young=young/z)
-for mat in (mortar,polyMat):
-	O.materials.append(mat)
-
-O.dt = dt
-bs = b1,b2 = [polyhedron(((-x,-y,-z),(+x,-y,-z),(-x,+y,-z),(+x,+y,-z),(-x,-y,+z),(+x,-y,+z),(-x,+y,+z),(+x,+y,+z)),material=mortar) for i in (0,1)]
-b2.state.pos = b2.state.refPos = (0,0,2*z)
-for b in bs:
-	b.state.blockedDOFs = 'xyzXYZ'
-O.bodies.append(bs)
-
-def plotAddData():
-	i = O.interactions[0,1]
-	if i.phys:
-		plot.addData(
-			fn = i.phys.normalForce.norm(),
-			dspl = O.bodies[1].state.displ().norm(),
-		)
-
-#
-factor=1.1
-O.engines=[
-	ForceResetter(),
-	InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]),
-	InteractionLoop(
-		[Ig2_Polyhedra_Polyhedra_PolyhedraGeomOrScGeom(label='ig2')], 
-		[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_MortarMat_MortarMat_MortarPhys()],
-		[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric(),Law2_ScGeom_MortarPhys_Lourenco()],
-	),
-	NewtonIntegrator(),
-	PyRunner(iterPeriod=1,command='plotAddData()'),
-	PyRunner(iterPeriod=1,command='print O.interactions[0,1].phys'),
-]
-ig2.ig2scGeom.interactionDetectionFactor = factor
-O.step()
-phys = O.interactions[0,1].phys
-phys.kn = young*2*x*2*y/(2*z)
-ig2.ig2scGeom.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1
-ig2.createScGeom=False
-b2.state.vel = (0,0,-z*.002)
-for b in O.bodies:
-	b.mat = polyMat
-
-plot.plots = {'dspl':'fn'}
-plot.plot()
-O.run(30)

=== added directory 'examples/mortar/modelTests'
=== added file 'examples/mortar/modelTests/compression.py'
--- examples/mortar/modelTests/compression.py	1970-01-01 00:00:00 +0000
+++ examples/mortar/modelTests/compression.py	2016-04-20 08:56:13 +0000
@@ -0,0 +1,62 @@
+from yade import plot
+######################################################################
+# Script to test brick material in compression. The material is
+# initially BrickMat. After failure and deletion of cohesive mortar
+# interaction, the simulation continues with PolyhedraMat.
+######################################################################
+
+O.dt = 1
+young=1e9
+
+x,y,z = .2,.5,.7 # dimension of the bricks
+
+mortar = MortarMat(young=young)
+polyMat = PolyhedraMat(young=young/z) # stiffness of polyhedra law relates force and interactiong volume, to have the same stiffness, young has to be divided by z
+for mat in (mortar,polyMat):
+	O.materials.append(mat)
+
+# two bricks with blockedDOFs, initially with MortarMat
+bs = b1,b2 = [polyhedron(((-x,-y,-z),(+x,-y,-z),(-x,+y,-z),(+x,+y,-z),(-x,-y,+z),(+x,-y,+z),(-x,+y,+z),(+x,+y,+z)),material=mortar) for i in (0,1)]
+b2.state.pos = b2.state.refPos = (0,0,2*z)
+for b in bs:
+	b.state.blockedDOFs = 'xyzXYZ'
+O.bodies.append(bs)
+
+# function to plot the results
+def plotAddData():
+	i = O.interactions[0,1]
+	if i.phys:
+		plot.addData(
+			fn = i.phys.normalForce.norm(),
+			dspl = O.bodies[1].state.displ().norm(),
+		)
+
+#
+# factor to safely create interaction of just touching bricks
+factor=1.1
+O.engines=[
+	ForceResetter(),
+	InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]),
+	InteractionLoop(
+		# both ScGeom and PolyhedraGeom, MortarMat and PolyhedraMat
+		[Ig2_Polyhedra_Polyhedra_PolyhedraGeomOrScGeom(label='ig2')], 
+		[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_MortarMat_MortarMat_MortarPhys()],
+		[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric(),Law2_ScGeom_MortarPhys_Lourenco()],
+	),
+	NewtonIntegrator(),
+	PyRunner(iterPeriod=1,command='plotAddData()'),
+	PyRunner(iterPeriod=1,command='print O.interactions[0,1].phys'),
+]
+ig2.ig2scGeom.interactionDetectionFactor = factor
+O.step()
+# after O.step, a cohesive interaction is created and we can change material of the bodies. It has no effect on existing interactions, but newly created interactions will be created form the new material
+for b in O.bodies:
+	b.mat = polyMat
+ig2.createScGeom = False # also for new interactions, create PolyhedraGeom rather than ScGeom
+ig2.ig2scGeom.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1 # deactivate interaction detection enlargement
+O.interactions[0,1].phys.kn = young*2*x*2*y/(2*z) # sets correct kn of interaction
+
+plot.plots = {'dspl':'fn'}
+plot.plot()
+b2.state.vel = (0,0,-z*.002)
+O.run(30)

=== added file 'examples/mortar/modelTests/failureEnvelope.py'
--- examples/mortar/modelTests/failureEnvelope.py	1970-01-01 00:00:00 +0000
+++ examples/mortar/modelTests/failureEnvelope.py	2016-04-20 08:56:13 +0000
@@ -0,0 +1,61 @@
+from yade import plot
+######################################################################
+# a script to test failure envelope of mortar material. Several
+# simulations with one interaction are run until the stresses reach
+# failure condition. The interaction is then deleted.
+######################################################################
+
+######################################################################
+young = 3e9
+GOverE = .2
+tensileStrength = .2e6
+cohesion = .3e6
+frictionAngle = atan(.5)
+compressiveStrength = 10e6
+ellAspect = 3
+######################################################################
+
+# function to run monothonically increasing dformation in given angle. 0=tension, pi=compression, pi/2=shear, (0;pi/2)=tension+shear, (pi/2;pi)=compression+shear
+def sim(angle):
+	O.reset()
+	O.dt = 1e-5
+	# create two bricks with all blockedDOFs
+	mortar = O.materials.append(MortarMat(young=young,poisson=GOverE,tensileStrength=tensileStrength,cohesion=cohesion,frictionAngle=frictionAngle,compressiveStrength=compressiveStrength,ellAspect=ellAspect))
+	bs = b1,b2 = [polyhedron(((-1,-1,-1),(+1,-1,-1),(-1,+1,-1),(+1,+1,-1),(-1,-1,+1),(+1,-1,+1),(-1,+1,+1),(+1,+1,+1)),material=mortar) for i in (0,1)]
+	b2.state.pos = (0,0,2)
+	for b in bs:
+		b.state.blockedDOFs = 'xyzXYZ'
+	O.bodies.append(bs)
+	#
+	# factor to safely create interaction of just touching bricks
+	factor=1.1
+	O.engines=[
+		ForceResetter(),
+		InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]),
+		InteractionLoop(
+			[Ig2_Polyhedra_Polyhedra_ScGeom(interactionDetectionFactor=factor,label='ig2')], 
+			[Ip2_MortarMat_MortarMat_MortarPhys()],
+			[Law2_ScGeom_MortarPhys_Lourenco()]
+		),
+		NewtonIntegrator(),
+	]
+	O.step()
+	ig2.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1 # reset the interaction detection enlargement
+	b2.state.vel = (sin(angle),0,cos(angle)) # sets velocity to produce desired 
+	while len([i for i in O.interactions]) > 0: # run simulatinon until the interaction is broken
+		sn,st = i.phys.sigmaN, i.phys.sigmaT.norm() # store last values
+		O.step()
+		if O.iter > 1e6:
+			raise RuntimeError, "TODO" # not to run forever
+	plot.addData(sn=sn,st=st) # after the interaction is broken, save stress to plot.data and return
+	return
+
+# run n simulations from tension to compression
+n = 50
+for i in xrange(n):
+	sim(i*pi/(n-1))
+
+# plot the results
+plot.plots = {'sn':'st'}
+plot.matplotlib.pyplot.axes().set_aspect(1)
+plot.plot()

=== added file 'examples/mortar/modelTests/shear.py'
--- examples/mortar/modelTests/shear.py	1970-01-01 00:00:00 +0000
+++ examples/mortar/modelTests/shear.py	2016-04-20 08:56:13 +0000
@@ -0,0 +1,97 @@
+from yade import plot
+######################################################################
+# Script to test brick material in shear. The material is
+# initially BrickMat. After failure and deletion of cohesive mortar
+# interaction, the simulation continues with PolyhedraMat.
+######################################################################
+
+######################################################################
+# I N P U T S
+######################################################################
+x,y,z = .2,.5,.7 # dimension of the bricks
+vDspl = -1e-3 # vertical displacement (+=tension, -=compression)
+hDspl = 1e-3 # horizontal displacement for shear
+nSteps = 1000 # each phase will take nSteps iterations
+######################################################################
+young = 4e9
+poisson = .2
+tensileStrength = .2e3
+cohesion = .3e6
+frictionAngle = atan(.5)
+compressiveStrength = 10e6
+frictionAngle2 = atan(.4) # independent friction angle for PolyhedraMat for residual strength
+######################################################################
+
+O.dt = 1e-3
+
+mortar = MortarMat(young=young,poisson=1/(2*(1+poisson)),tensileStrength=tensileStrength,cohesion=cohesion,frictionAngle=frictionAngle,compressiveStrength=compressiveStrength)
+polyMat = PolyhedraMat(young=young/z,poisson=1e3,frictionAngle=frictionAngle2)
+for mat in (mortar,polyMat):
+	O.materials.append(mat)
+
+# two bricks with blockedDOFs, initially with MortarMat
+bs = b1,b2 = [polyhedron(((-x,-y,-z),(+x,-y,-z),(-x,+y,-z),(+x,+y,-z),(-x,-y,+z),(+x,-y,+z),(-x,+y,+z),(+x,+y,+z)),material=mortar) for i in (0,1)]
+b2.state.pos = b2.state.refPos = (0,0,2*z)
+for b in bs:
+	b.state.blockedDOFs = 'xyzXYZ'
+O.bodies.append(bs)
+
+# function to plot the results
+def plotAddData():
+	dspl = O.bodies[1].state.displ()
+	dn = dspl[2]
+	ds = dspl[0]
+	try:
+		i = O.interactions[0,1]
+		fn = i.phys.normalForce.norm()
+		fs = i.phys.shearForce.norm()
+	except (IndexError,AttributeError):
+		fn = fs = 0.
+	plot.addData(
+		i = O.iter,
+		dn = dn,
+		ds = ds,
+		fn = fn,
+		fs = fs,
+	)
+
+# checkpoints
+def checkpoint():
+	if O.iter==nSteps:
+		O.bodies[1].state.vel = (hDspl/(nSteps*O.dt),0,0)
+	elif O.iter==2*nSteps:
+		O.pause()
+		plot.saveDataTxt('/tmp/shear.dat')
+
+#
+# factor to safely create interaction of just touching bricks
+factor=1.1
+O.engines=[
+	ForceResetter(),
+	InsertionSortCollider([Bo1_Polyhedra_Aabb(aabbEnlargeFactor=factor,label='bo1')]),
+	InteractionLoop(
+		# both ScGeom and PolyhedraGeom, MortarMat and PolyhedraMat
+		[Ig2_Polyhedra_Polyhedra_PolyhedraGeomOrScGeom(label='ig2')], 
+		[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_MortarMat_MortarMat_MortarPhys()],
+		[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric(),Law2_ScGeom_MortarPhys_Lourenco()],
+	),
+	NewtonIntegrator(),
+	PyRunner(iterPeriod=1,command='plotAddData()'),
+	PyRunner(iterPeriod=1,command='checkpoint()'),
+]
+ig2.ig2scGeom.interactionDetectionFactor = factor
+O.step()
+# after O.step, a cohesive interaction is created and we can change material of the bodies. It has no effect on existing interactions, but newly created interactions will be created form the new material
+for b in O.bodies:
+	b.mat = polyMat
+ig2.createScGeom = False # also for new interactions, create PolyhedraGeom rather than ScGeom
+ig2.ig2scGeom.interactionDetectionFactor = bo1.aabbEnlargeFactor = 1 # deactivate interaction detection enlargement
+phys = O.interactions[0,1].phys
+phys.kn = young*2*x*2*y/(2*z) # sets correct kn of interaction
+phys.crossSection = 2*x*2*y
+
+plot.plots = {'dn':'fn','ds':'fs','i':('fn','fs')}
+plot.plot()
+b2.state.vel = (0,0,vDspl/(nSteps*O.dt))
+
+O.run()