void AttackParticlePolicy::emitt() { BaseParticle Particle = *this->emitter; Vec3 origPos = Particle.getPosition(); float posX = origPos.x; float posY = origPos.y; float posZ = origPos.z; float dirX; float dirY; float dirZ; for(int i = 0; i < intensity; i++) { dirX = (float)rand() / (float)RAND_MAX -0.5f; dirY = (float)rand() / (float)RAND_MAX -0.5f; dirZ = (float)rand() / (float)RAND_MAX -0.5f; if(direction.x > 0) { direction.x += ((float)rand() / (float)RAND_MAX -0.1f); } else { direction.x -= ((float)rand() / (float)RAND_MAX -0.1f); } if(direction.z > 0) { direction.z += ((float)rand() / (float)RAND_MAX -0.1f); } else { direction.z -= ((float)rand() / (float)RAND_MAX -0.1f); } D3DXVec3Normalize(&direction, &direction); Particle.setDirection(direction); Particle.setPosition(Vec3(posX, posY, posZ)); particles.insertLast(Particle); } recreateVertices = true; }
void setupInitialConditions() { relVelocity_ = 1e-1; setName("AdhesiveForceUnitTest_ParticleWallInteractionWithPlasticForces"); setSystemDimensions(3); setParticleDimensions(3); setGravity(Vec3D(0,0,0)); species->setDensity(2000.0); species->setStiffness(1e2); species->setAdhesionStiffness(1e2); species->setAdhesionForceMax(1e-5*species->getAdhesionStiffness()); Mdouble R = 1e-3; species->setSlidingStiffness(1.2e1); species->setSlidingFrictionCoefficient(0.01); setTimeStep(5e-6 / 2.0); setXMax( 2*R); setYMax( R); setZMax( R); setXMin(0); setYMin(-R); setZMin(-R); particleHandler.clear(); BaseParticle P; P.setRadius(R); P.setPosition(Vec3D(R+species->getInteractionDistance()*1/3,0,0)); P.setVelocity(Vec3D(-relVelocity_/2,0,0)); particleHandler.copyAndAddObject(P); wallHandler.clear(); InfiniteWall w; w.set(Vec3D(-1, 0, 0), Vec3D(getXMin(), 0, 0)); wallHandler.copyAndAddObject(w); setTimeMax(getTimeStep()*250*4); setFileType(FileType::ONE_FILE); setSaveCount(1); }
//sets initial particle positions void setupInitialConditions() { //centrifugal acc. a=v^2/R; Mdouble R = 4.0; BaseParticle p; p.setSpecies(speciesHandler.getObject(0)); p.setRadius(0.5); p.setPosition({R,0.5,0}); particleHandler.copyAndAddObject(p); p.setRadius(0.5); p.setPosition({R,-0.5,0}); //p.setVelocity({-sqrt(R)*s,sqrt(R)*c,0}); p.setAngularVelocity({0,0,1}); particleHandler.copyAndAddObject(p); }