← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2318: - Add stress getter and python wrapper (replacing reverted r2314).

 

------------------------------------------------------------
revno: 2318
committer: bchareyre <bchareyre@dt-rv020>
branch nick: trunk
timestamp: Mon 2010-07-05 10:50:05 +0200
message:
  - Add stress getter and python wrapper (replacing reverted r2314).
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-07-04 22:49:13 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStressController.cpp	2010-07-05 08:50:05 +0000
@@ -12,15 +12,15 @@
 #include<yade/pkg-dem/ScGeom.hpp>
 #include<yade/pkg-dem/FrictPhys.hpp>
 #include<yade/core/State.hpp>
-
+#include<assert.h>
 #include<yade/core/Scene.hpp>
 
 CREATE_LOGGER(TriaxialStressController);
 YADE_PLUGIN((TriaxialStressController));
 
-TriaxialStressController::~TriaxialStressController()
-{	
-}
+TriaxialStressController::~TriaxialStressController(){}
+
+Vector3r TriaxialStressController::getStress(int boundId) {assert (boundId>=0 && boundId<=5); return stress[boundId];}
 
 void TriaxialStressController::updateStiffness ()
 {

=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp'
--- pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp	2010-07-04 22:49:13 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialStressController.hpp	2010-07-05 08:50:05 +0000
@@ -70,7 +70,9 @@
 		void computeStressStrain();
 		//! Compute the mean/max unbalanced force in the assembly (normalized by mean contact force)
     		Real ComputeUnbalancedForce(bool maxUnbalanced=false);
-		
+		///! Getter for stress in python
+		Vector3r getStress(int boundId);
+				
 		YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY(
 		TriaxialStressController,BoundaryController,"An engine maintaining constant stresses on some boundaries of a parallepipedic packing."
 		,
@@ -98,10 +100,10 @@
 		((Real,width0,0,""))
 		((Real,depth0,0,""))		
 		((Real,sigma_iso,0,"applied confining stress (see :yref:`TriaxialStressController::isAxisymetric`)"))
-		((Real,sigma1,0,"applied stress on axis 1 (see :yref:`TriaxialStressController::isAxisymetric`)"))
-		((Real,sigma2,0,"applied stress on axis 2 (see :yref:`TriaxialStressController::isAxisymetric`)"))
-		((Real,sigma3,0,"applied stress on axis 3 (see :yref:`TriaxialStressController::isAxisymetric`)"))
-		((bool,isAxisymetric,true,"if true, sigma_iso is assigned to sigma1, 2 and 3"))
+		((Real,sigma1,0,"applied stress on axis 1 (overriden if :yref:`TriaxialStressController::isAxisymetric`)"))
+		((Real,sigma2,0,"applied stress on axis 2 (overriden if :yref:`TriaxialStressController::isAxisymetric`)"))
+		((Real,sigma3,0,"applied stress on axis 3 (overriden if :yref:`TriaxialStressController::isAxisymetric`)"))
+		((bool,isAxisymetric,true,"if true, sigma_iso is assigned to sigma1, 2 and 3 (applies at each iteration and overrides user-set values of s1,2,3)"))
 		((Real,maxMultiplier,1.001,"max multiplier of diameters during internal compaction (initial fast increase - :yref:`TriaxialStressController::finalMaxMultiplier` is used in a second stage)"))
 		((Real,finalMaxMultiplier,1.00001,"max multiplier of diameters during internal compaction (secondary precise adjustment - :yref:`TriaxialStressController::maxMultiplier` is used in the initial stage)"))	
 		((Real,max_vel,0.001,"Maximum allowed walls velocity [m/s]. This value superseeds the one assigned by the stress controller if the later is higher. max_vel can be set to infinity in many cases, but sometimes helps stabilizing packings. Based on this value, different maxima are computed for each axis based on the dimensions of the sample, so that if each boundary moves at its maximum velocity, the strain rate will be isotropic (see e.g. :yref:`TriaxialStressController::max_vel1`)."))
@@ -132,7 +134,8 @@
 		.def_readonly("max_vel1",&TriaxialStressController::max_vel1,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
 		.def_readonly("max_vel2",&TriaxialStressController::max_vel2,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
 		.def_readonly("max_vel3",&TriaxialStressController::max_vel3,"see :yref:`TriaxialStressController::max_vel` |ycomp|")
-		 )
+		.def("stress",&TriaxialStressController::getStress,(python::arg("id")),"Return the mean stress vector acting on boundary 'id', with 'id' between 0 and 5.")
+		)
 		DECLARE_LOGGER;	
 };
 REGISTER_SERIALIZABLE(TriaxialStressController);


Follow ups