← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2314: making TriaxialStressController more python friendly.

 

------------------------------------------------------------
revno: 2314
committer: Janek Kozicki <cosurgi@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-07-04 20:18:21 +0200
message:
  making TriaxialStressController more python friendly.
  
  Following is the example of what was my intention::
  
  
  #!/usr/local/bin/yade-trunk -x
  
  TriaxialTest(numberOfGrains=200).load()
  O.engines += [PeriodicPythonRunner(iterPeriod=10,command='plot1()')]
  
  
  triaxialStressController=O.engines[5]
  
  def sigma_1():
  	return triaxialStressController.wall_stress[1]
  
  def epsilon_1():
  	return triaxialStressController.strain[1]
  
  
  from yade import qt
  qt.View()
  qt.Controller()
  
  
  # plot some results
  from math import *
  from yade import plot
  plot.plots={'epsilon_1':'sigma_1'}
  def plot1():
  	plot.addData(sigma_1=sigma_1(),
  		     epsilon_1=epsilon_1())
  O.run(10000,True)
  plot.plot()
modified:
  pkg/dem/Engine/PartialEngine/TriaxialStressController.cpp
  pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStressController.cpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStressController.cpp	2010-06-08 21:22:07 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStressController.cpp	2010-07-04 18:18:21 +0000
@@ -202,6 +202,10 @@
 
 	for (int i=0; i<6; i++) meanStress-=stress[i].dot(normal[i]);
 	meanStress/=6.;
+
+	wall_stress[0]=stress[wall_right][0];
+	wall_stress[1]=stress[wall_top][1];
+	wall_stress[2]=stress[wall_front][2];
 }
 
 void TriaxialStressController::controlInternalStress ( Real multiplier )

=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp	2010-05-03 12:17:44 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp	2010-07-04 18:18:21 +0000
@@ -35,10 +35,11 @@
 		boost::array<Vector3r,6> previousTranslation;
 		//! The value of stiffness (updated according to stiffnessUpdateInterval) 
 		vector<Real>	stiffness;
-		Real 		strain [3];
+		Vector3r	strain;
 		Vector3r	normal [6];
 		//! The values of stresses 
 		Vector3r	stress [6];
+		Vector3r	wall_stress;
 		Vector3r	force [6];
 		//! Value of spheres volume (solid volume)
 		Real spheresVolume;
@@ -66,7 +67,7 @@
 		void controlInternalStress(Real multiplier);
 		//! update the stiffness of boundary-packing interaction (sum of contacts stiffness on the boundary)
 		void updateStiffness();
-		//! Compute stresses on walls as "Vector3r stress[6]", compute meanStress, strain[3] and mean strain
+		//! Compute stresses on walls as "Vector3r stress[6]", compute meanStress, strain[3] and mean strain. Update wall_stress
 		void computeStressStrain();
 		//! Compute the mean/max unbalanced force in the assembly (normalized by mean contact force)
     		Real ComputeUnbalancedForce(bool maxUnbalanced=false);
@@ -126,6 +127,7 @@
 		normal[wall_back].z()=1;	
 		porosity=1;
 		,
+		.def_readonly("wall_stress",&TriaxialStressController::wall_stress,"Current stress on walls.")
 		.def_readonly("strain",&TriaxialStressController::strain,"Current strain (logarithmic).")
  		.def_readonly("porosity",&TriaxialStressController::porosity,"Pososity of the packing.")
 		.def_readonly("boxVolume",&TriaxialStressController::boxVolume,"Total packing volume.")


Follow ups