← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2043: Some changes in the TCE behaviour. Save the state before stopping simulation, and start compressi...

 

------------------------------------------------------------
revno: 2043
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Fri 2010-02-19 21:17:31 +0100
message:
  Some changes in the TCE behaviour. Save the state before stopping simulation, and start compression for reloaded files with autoCompression=true.
  Please keep intact the behaviour even when the code looks strange, there are reasons behind. I ran 1 week simulations, expecting 
  saved xml at the end, but got nothing... I've included a fews comments about this.
modified:
  pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.cpp
  pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.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/TriaxialCompressionEngine.cpp'
--- pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.cpp	2010-02-17 10:25:54 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.cpp	2010-02-19 20:17:31 +0000
@@ -77,7 +77,6 @@
 	if ( /* currentState==STATE_UNINITIALIZED && */ nextState==STATE_ISO_COMPACTION){
 		sigma_iso=sigmaIsoCompaction;
 		previousSigmaIso=sigma_iso;
-
 	}
 	else if((currentState==STATE_ISO_COMPACTION || currentState==STATE_ISO_UNLOADING || currentState==STATE_LIMBO) && nextState==STATE_TRIAX_LOADING){
 		sigma_iso=sigmaLateralConfinement;
@@ -108,6 +107,8 @@
 		// stop simulation here, since nothing will happen from now on
 		Phase1End = (currentState==STATE_ISO_COMPACTION ? "compacted" : "unloaded");
 		if(!noFiles) Shop::saveSpheresToFile("/tmp/limbo.spheres");
+		// Please keep this saving process intact, I'm tired of running 3 days simulations and getting nothing at the end!
+		if(!firstRun && !noFiles) saveSimulation=true; // saving snapshot .xml will actually be done in ::applyCondition
 	}
 	else if( nextState==STATE_FIXED_POROSITY_COMPACTION){		
 		internalCompaction = false;
@@ -126,17 +127,10 @@
 {
 	UnbalancedForce=ComputeUnbalancedForce ( ncb );
 
-	if ( currentState==STATE_ISO_COMPACTION || currentState==STATE_ISO_UNLOADING || currentState==STATE_FIXED_POROSITY_COMPACTION )
+	if ( currentState==STATE_ISO_COMPACTION || currentState==STATE_ISO_UNLOADING || currentState==STATE_FIXED_POROSITY_COMPACTION || autoCompressionActivation)
 	{
 		// FIXME: do we need this?? it makes sense to activate compression only during compaction!: || autoCompressionActivation)
 		//ANSWER TO FIXME : yes we need that because we want to start compression from LIMBO most of the time
-
-
-		//if ((Omega::instance().getCurrentIteration() % computeStressStrainInterval) == 0){ //NOTE : We don't need that because computeStressStrain(ncb) is done in StressController
-		// computeStressStrain(ncb);
-		//TRVAR5(UnbalancedForce,StabilityCriterion,meanStress,sigma_iso,abs((meanStress-sigma_iso)/sigma_iso));
-		//}
-
 		if ( UnbalancedForce<=StabilityCriterion && abs ( ( meanStress-sigma_iso ) /sigma_iso ) <0.005 && isotropicCompaction==false )
 		{
 			// only go to UNLOADING if it is needed (hard float comparison... :-| )
@@ -144,13 +138,11 @@
 				doStateTransition (ncb, STATE_ISO_UNLOADING );
 				computeStressStrain ( ncb ); // update stress and strain
 			}
-			else if(currentState==STATE_ISO_COMPACTION && autoCompressionActivation){
+			// Preserve transition from LIMBO to something, I need that! (BC)
+			else if((currentState==STATE_ISO_COMPACTION || currentState==STATE_ISO_UNLOADING || currentState==STATE_LIMBO) && autoCompressionActivation){
 				doStateTransition (ncb, STATE_TRIAX_LOADING );
 				computeStressStrain ( ncb ); // update stress and strain
 			}
-			else if ( currentState==STATE_ISO_UNLOADING && autoCompressionActivation ) {
-				doStateTransition (ncb, STATE_TRIAX_LOADING ); computeStressStrain ( ncb );
-			}
 			// stop simulation if unloaded and compression is not activate automatically
 			else if (currentState==STATE_ISO_UNLOADING && !autoCompressionActivation){
 				Omega::instance().stopSimulationLoop();
@@ -206,7 +198,12 @@
 		previousSigmaIso=sigma_iso;
 		firstRun=false; // change this only _after_ state transitions
 	}
-
+	if ( Omega::instance().getCurrentIteration() % testEquilibriumInterval == 0 )
+	{
+		updateParameters ( ncb );
+		maxStress = max(maxStress,stress[wall_top][1]);
+		LOG_INFO("UnbalancedForce="<< UnbalancedForce<<", rel stress "<< abs ( ( meanStress-sigma_iso ) /sigma_iso ));
+	}	
 	if ( saveSimulation )
 	{
 		if(!noFiles){
@@ -221,13 +218,7 @@
 			Shop::saveSpheresToFile ( fileName );
 		}
 		saveSimulation = false;
-	}	
-	if ( Omega::instance().getCurrentIteration() % testEquilibriumInterval == 0 )
-	{
-		updateParameters ( ncb );
-		maxStress = max(maxStress,stress[wall_top][1]);
-		LOG_INFO("UnbalancedForce="<< UnbalancedForce<<", rel stress "<< abs ( ( meanStress-sigma_iso ) /sigma_iso ));
-	}	
+	}
 	if ( currentState==STATE_LIMBO && autoStopSimulation )
 	{		
 		Omega::instance().stopSimulationLoop();
@@ -245,7 +236,7 @@
 		Real dt = Omega::instance().getTimeStep();
 		 
 		if (abs(epsilonMax) > abs(strain[1])) {
-			if ( currentStrainRate != strainRate ) currentStrainRate += ( strainRate-currentStrainRate ) *0.0003; // !!! if unloading (?)
+			if ( currentStrainRate != strainRate ) currentStrainRate += ( strainRate-currentStrainRate ) *0.0003;
 			//else currentStrainRate = strainRate;
 			/* Move top and bottom wall according to strain rate */
 			State* p_bottom=Body::byId(wall_bottom_id,ncb)->state.get();

=== modified file 'pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.hpp'
--- pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.hpp	2010-02-17 10:25:54 +0000
+++ pkg/dem/Engine/PartialEngine/TriaxialCompressionEngine.hpp	2010-02-19 20:17:31 +0000
@@ -43,6 +43,8 @@
  * Transition from (UNLOADING to LOADING) or from (COMPACTION to LOADING: if UNLOADING is skipped) is
  *   done automatically if autoCompressionActivation=true;
  * Both autoUnload and autoCompressionActivation are true by default.
+ * 
+ * NOTE: This engine handles many different manipulations, including some save/reload with attributes modified manually in between. Please don't modify the algorithms, even if they look strange (especially test sequences) without notifying me and getting explicit approval. A typical situation is somebody generates a sample with !autoCompressionActivation and run : he wants a saved simulation at the end. He then reload the saved state, modify some parameters, set autoCompressionActivation=true, and run. He should get the compression test 
  *
  */