yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02338
[Branch ~yade-dev/yade/trunk] Rev 1811: Adaptation NewtonDampedLaw to material/state classes
------------------------------------------------------------
revno: 1811
committer: Sergei D. <sega@think>
branch nick: clumps
timestamp: Mon 2009-11-23 18:36:10 +0300
message:
Adaptation NewtonDampedLaw to material/state classes
modified:
pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp
pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.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/StandAloneEngine/NewtonsDampedLaw.cpp'
--- pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp 2009-11-21 16:46:58 +0000
+++ pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp 2009-11-23 15:36:10 +0000
@@ -10,8 +10,8 @@
#include<yade/core/MetaBody.hpp>
#ifdef YADE_PHYSPAR
#include<yade/pkg-common/RigidBodyParameters.hpp>
- #include<yade/pkg-dem/Clump.hpp>
#endif
+#include<yade/pkg-dem/Clump.hpp>
#include<yade/pkg-common/VelocityBins.hpp>
#include<yade/lib-base/yadeWm3Extra.hpp>
@@ -22,28 +22,26 @@
acceleration [i]*= 1 - damping*Mathr::Sign ( f[i]*(velocity [i] + (Real) 0.5 *dt*acceleration [i]) );
}
}
-#ifdef YADE_PHYSPAR
-void NewtonsDampedLaw::handleClumpMember(MetaBody* ncb, const body_id_t memberId, RigidBodyParameters* clumpRBP){
+void NewtonsDampedLaw::handleClumpMember(MetaBody* ncb, const body_id_t memberId, State* clumpRBP){
const shared_ptr<Body>& b=Body::byId(memberId,ncb);
assert(b->isClumpMember());
- RigidBodyParameters* rb=YADE_CAST<RigidBodyParameters*>(b->physicalParameters.get());
+ State* rb=b->state.get();
const Vector3r& m=ncb->bex.getTorque(memberId); const Vector3r& f=ncb->bex.getForce(memberId);
Vector3r diffClumpAccel=f/clumpRBP->mass;
// angular acceleration from: normal torque + torque generated by the force WRT particle centroid on the clump centroid
- Vector3r diffClumpAngularAccel=diagDiv(m,clumpRBP->inertia)+diagDiv((rb->se3.position-clumpRBP->se3.position).Cross(f),clumpRBP->inertia);
+ Vector3r diffClumpAngularAccel=diagDiv(m,clumpRBP->inertia)+diagDiv((rb->pos-clumpRBP->pos).Cross(f),clumpRBP->inertia);
// damp increment of accels on the clump, using velocities of the clump MEMBER
- cundallDamp(ncb->dt,f,rb->velocity,diffClumpAccel,m,rb->angularVelocity,diffClumpAngularAccel);
+ cundallDamp(ncb->dt,f,rb->vel,diffClumpAccel,m,rb->angVel,diffClumpAngularAccel);
// clumpRBP->{acceleration,angularAcceleration} are reset byt Clump::moveMembers, it is ok to just increment here
- clumpRBP->acceleration+=diffClumpAccel;
- clumpRBP->angularAcceleration+=diffClumpAngularAccel;
+ clumpRBP->accel+=diffClumpAccel;
+ clumpRBP->angAccel+=diffClumpAngularAccel;
if(haveBins) velocityBins->binVelSqUse(memberId,VelocityBins::getBodyVelSq(rb));
#ifdef YADE_OPENMP
- Real& thrMaxVSq=threadMaxVelocitySq[omp_get_thread_num()]; thrMaxVSq=max(thrMaxVSq,rb->velocity.SquaredLength());
+ Real& thrMaxVSq=threadMaxVelocitySq[omp_get_thread_num()]; thrMaxVSq=max(thrMaxVSq,rb->vel.SquaredLength());
#else
- maxVelocitySq=max(maxVelocitySq,rb->velocity.SquaredLength());
+ maxVelocitySq=max(maxVelocitySq,rb->vel.SquaredLength());
#endif
}
-#endif
void NewtonsDampedLaw::action(MetaBody * ncb)
{
@@ -85,7 +83,6 @@
cundallDamp(dt,f,state->vel,state->accel,m,state->angVel,state->angAccel);
}
else if (b->isClump()){
- #ifdef YADE_PHYSPAR
state->accel=state->angAccel=Vector3r::ZERO; // to make sure; should be reset in Clump::moveMembers
// sum force on clump memebrs, add them to the clump itself
FOREACH(Clump::memberMap::value_type mm, static_cast<Clump*>(b.get())->members){
@@ -96,7 +93,6 @@
cundallDamp(dt,f,state->vel,dLinAccel,m,state->angVel,dAngAccel);
state->accel+=dLinAccel;
state->angAccel+=dAngAccel;
- #endif
}
// blocking DOFs
@@ -133,9 +129,7 @@
state->pos += state->vel*dt + ncb->bex.getMove(id);
- #ifdef YADE_PHYSPAR
- if(b->isClump()) static_cast<Clump*>(b.get())->moveMembers();
- #endif
+ if(b->isClump()) static_cast<Clump*>(b.get())->moveMembers();
}
#ifdef YADE_OPENMP
FOREACH(const Real& thrMaxVSq, threadMaxVelocitySq) { maxVelocitySq=max(maxVelocitySq,thrMaxVSq); }
=== modified file 'pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.hpp'
--- pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.hpp 2009-07-14 20:03:51 +0000
+++ pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.hpp 2009-11-23 15:36:10 +0000
@@ -34,12 +34,12 @@
NOTE: Cundall damping affected dynamic simulation! See examples/dynamic_simulation_tests
*/
-class RigidBodyParameters;
+class State;
class VelocityBins;
class NewtonsDampedLaw : public StandAloneEngine{
inline void cundallDamp(const Real& dt, const Vector3r& f, const Vector3r& velocity, Vector3r& acceleration, const Vector3r& m, const Vector3r& angularVelocity, Vector3r& angularAcceleration);
- void handleClumpMember(MetaBody* ncb, const body_id_t memberId, RigidBodyParameters* clumpRBP);
+ void handleClumpMember(MetaBody* ncb, const body_id_t memberId, State* clumpRBP);
bool haveBins;
public:
///damping coefficient for Cundall's non viscous damping