← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3560: Switch a private argument to public in HydroforceEngine.

 

------------------------------------------------------------
revno: 3560
committer: Raphael Maurin <raph_maurin@xxxxxxxxxxx>
timestamp: Fri 2014-12-12 18:01:09 +0100
message:
  Switch a private argument to public in HydroforceEngine.
  
  This concern the fluid velocity fluctuations associated to particles, in order to access it from python during the simulation.
modified:
  pkg/common/ForceEngine.cpp
  pkg/common/ForceEngine.hpp


--
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
=== modified file 'pkg/common/ForceEngine.cpp'
--- pkg/common/ForceEngine.cpp	2014-10-15 06:44:01 +0000
+++ pkg/common/ForceEngine.cpp	2014-12-12 17:01:09 +0000
@@ -86,14 +86,16 @@
 	/* Velocity fluctuation determination (not usually done at each dt, that is why it not placed in the other loop) */
 	if (velFluct == true){
 		/* check size */
-		size_t size=vFluct.size();
+		size_t size=vFluctX.size();
 		if(size<scene->bodies->size()){
 			size=scene->bodies->size();
-			vFluct.resize(size);
+			vFluctX.resize(size);
+			vFluctZ.resize(size);
 		}
 		/* reset stored values to zero */
-		memset(& vFluct[0],0,sizeof(Vector2r)*size);
-	
+		memset(& vFluctX[0],0,size);
+		memset(& vFluctZ[0],0,size);
+
 		/* Create a random number generator rnd() with a gaussian distribution of mean 0 and stdev 1.0 */
 		/* see http://www.boost.org/doc/libs/1_55_0/doc/html/boost_random/reference.html and the chapter 7 of Numerical Recipes in C, second edition (1992) for more details */
 		static boost::minstd_rand0 randGen((int)TimingInfo::getNow(true));
@@ -118,7 +120,8 @@
 						Real uStar = sqrt(uStar2);
 						rand1 = rnd();
 						rand2 = -rand1 + rnd();
-						vFluct[id] = Vector2r(rand1*uStar,rand2*uStar);
+						vFluctZ[id] = rand1*uStar;
+						vFluctX[id] = rand2*uStar;
 					}
 				}
 			}
@@ -139,8 +142,7 @@
 			if ((p<nCell)&&(p>0)) {
 				Vector3r liftForce = Vector3r::Zero();
 				Vector3r dragForce = Vector3r::Zero();
-				Vector2r fluctVelBody = vFluct[id];//fluid velocity fluctuation associated to the particle's position considered.
-				Vector3r vFluid(vxFluid[p]+fluctVelBody.x(),0.0,fluctVelBody.y()); //fluid velocity at the particle's position
+				Vector3r vFluid(vxFluid[p]+vFluctX[id],0.0,vFluctZ[id]); //fluid velocity at the particle's position
 				Vector3r vPart = b->state->vel;//particle velocity
 				Vector3r vRel = vFluid - vPart;//fluid-particle relative velocity
 

=== modified file 'pkg/common/ForceEngine.hpp'
--- pkg/common/ForceEngine.hpp	2014-10-15 06:44:01 +0000
+++ pkg/common/ForceEngine.hpp	2014-12-12 17:01:09 +0000
@@ -71,8 +71,6 @@
 
 
 class HydroForceEngine: public PartialEngine{
-	private:
-		vector<Vector2r> vFluct;
 	public:
 		virtual void action();
 	YADE_CLASS_BASE_DOC_ATTRS(HydroForceEngine,PartialEngine,"Apply drag and lift due to a fluid flow vector (1D) to each sphere + the buoyant weight.\n The applied drag force reads\n\n.. math:: F_{d}=\\frac{1}{2} C_d A\\rho^f|\\vec{v_f - v}| vec{v_f - v} \n\n where $\\rho$ is the medium density (:yref:`density<HydroForceEngine.rhoFluid>`), $v$ is particle's velocity,  $v_f$ is the velocity of the fluid at the particle center,  $A$ is particle projected area (disc), $C_d$ is the drag coefficient. The formulation of the drag coefficient depends on the local particle reynolds number and the solid volume fraction. The formulation of the drag is [Dallavalle1948]_ [RevilBaudard2013]_ with a correction of Richardson-Zaki [Richardson1954]_ to take into account the hindrance effect. This law is classical in sediment transport. It is possible to activate a fluctuation of the drag force for each particle which account for the turbulent fluctuation of the fluid velocity (:yref:`velFluct`). The model implemented for the turbulent velocity fluctuation is a simple discrete random walk which takes as input the reynolds stress tensor Re_{xz} in function of the depth and allows to recover the main property of the fluctuations by imposing <u_x'u_z'> (z) = <Re>(z)/rho^f. It requires as input <Re>(z)/rho^f called :yref:`simplifiedReynoldStresses` in the code. \n The formulation of the lift is taken from [Wiberg1985]_ and is such that : \n\n.. math:: F_{L}=\\frac{1}{2} C_L A\\rho^f((v_f - v)^2{top} - (v_f - v)^2{bottom}) \n\n Where the subscript top and bottom means evaluated at the top (respectively the bottom) of the sphere considered. This formulation of the lift account for the difference of pressure at the top and the bottom of the particle inside a turbulent shear flow. As this formulation is controversial when approaching the threshold of motion [Schmeeckle2007]_ it is possible to desactivate it with the variable :yref:`lift`.\n The buoyancy is taken into account through the buoyant weight : \n\n.. math:: F_{buoyancy}= - rho^f V^p g \n\n, where g is the gravity vector along the vertical, and V^p is the volume of the particle.",
@@ -87,7 +85,9 @@
                 ((Vector3r,gravity,,,"Gravity vector (may depend on the slope)."))
 		((vector<Real>,vxFluid,,,"Discretized streamwise fluid velocity profile in function of the depth"))
 		((vector<Real>,phiPart,,,"Discretized solid volume fraction profile in function of the depth"))
-		((bool,velFluct,false,,"If true, activate the determination of turbulent fluid velocity fluctuation at the position of each particle, using a simple discrete random walk model based on the Reynolds stresses :yref:`turbStress<HydroForceEngine.squaredAverageTurbfluct>`"))
+		((bool,velFluct,false,,"If true, activate the determination of turbulent fluid velocity fluctuation for the next time step only at the position of each particle, using a simple discrete random walk model based on the Reynolds stresses :yref:`turbStress<HydroForceEngine.squaredAverageTurbfluct>`"))
+		((vector<Real>,vFluctX,,,"Vector associating a x fluid velocity fluctuation to each particle. Fluctuation calculated in the C++ code"))
+		((vector<Real>,vFluctZ,,,"Vector associating a Z fluid velocity fluctuation to each particle. Fluctuation calculated in the C++ code"))
 		((vector<Real>,simplifiedReynoldStresses,,,"Vector of size equal to :yref:`turbStress<HydroForceEngine.nCell>` containing the Reynolds stresses divided by the fluid density in function of the depth. simplifiedReynoldStresses(z) =  <u_x'u_z'>(z)^2 "))
 		((Real,bedElevation,,,"Elevation of the bed above which the fluid flow is turbulent and the particles undergo turbulent velocity fluctuation."))
 	);