yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #01547
[svn] r1890 - in trunk: . lib lib/import pkg/dem/PreProcessor pkg/dem/meta py py/yadeWrapper
Author: eudoxos
Date: 2009-07-27 21:13:04 +0200 (Mon, 27 Jul 2009)
New Revision: 1890
Added:
trunk/pkg/dem/PreProcessor/STLImporter.cpp
trunk/pkg/dem/PreProcessor/STLImporter.hpp
Removed:
trunk/lib/import/STLImporter.cpp
trunk/lib/import/STLImporter.hpp
Modified:
trunk/SConscript
trunk/SConstruct
trunk/lib/SConscript
trunk/pkg/dem/PreProcessor/STLImporterTest.cpp
trunk/pkg/dem/meta/RockPM.cpp
trunk/pkg/dem/meta/RockPM.hpp
trunk/py/SConscript
trunk/py/yadeWrapper/yadeWrapper.cpp
Log:
1. Move STILimport to pkg/dem, as it depends on dem
2. update RockPM with the new-old version (probably svn didn't update the moved version? what a deal. We should definitely move to bzr...)
Modified: trunk/SConscript
===================================================================
--- trunk/SConscript 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/SConscript 2009-07-27 19:13:04 UTC (rev 1890)
@@ -1,2 +1,5 @@
Import('*')
+
+import yadeSCons
+yadeSCons.buildPluginLibs(env,env['buildPlugs'])
SConscript(dirs=['core','lib']+[d for d in ('extra','py','gui') if d not in env['exclude']],duplicate=0)
Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/SConstruct 2009-07-27 19:13:04 UTC (rev 1890)
@@ -526,9 +526,8 @@
return list(ret)
env['linkPlugins']=linkPlugins
+env['buildPlugs']=buildPlugs
-yadeSCons.buildPluginLibs(env,buildPlugs)
-
# read top-level SConscript file. It is used only so that build_dir is set. This file reads all necessary SConscripts
env.SConscript(dirs=['.'],build_dir=buildDir,duplicate=0)
Modified: trunk/lib/SConscript
===================================================================
--- trunk/lib/SConscript 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/lib/SConscript 2009-07-27 19:13:04 UTC (rev 1890)
@@ -59,8 +59,7 @@
# for now, keep this is as a shared lib, since it depends on things from pkg (shouldn't be the case, though...)
env.Install('$PREFIX/lib/yade$SUFFIX/lib',[
- env.SharedLibrary('STLImporter',['import/STLReader.cpp', 'import/STLImporter.cpp'],LIBS=linkPlugins(['Facet','InteractingFacet','Shop'])
- ),
+ env.SharedLibrary('STLImporter',['import/STLReader.cpp']),
])
#######################
Deleted: trunk/lib/import/STLImporter.cpp
===================================================================
--- trunk/lib/import/STLImporter.cpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/lib/import/STLImporter.cpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -1,67 +0,0 @@
-/*************************************************************************
-* Copyright (C) 2008 by Sergei Dorofeenko *
-* sega@xxxxxxxxxxxxxxxx *
-* *
-* This program is free software; it is licensed under the terms of the *
-* GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-#include "STLImporter.hpp"
-#include <yade/pkg-dem/Shop.hpp>
-
-CREATE_LOGGER(STLImporter);
-
-STLImporter::STLImporter()
-{
- wire=false;
- number_of_facets=0;
-}
-
-bool STLImporter::open(const char* filename)
-{
- vector<double> vtmp, ntmp;
- vector<int> etmp, ftmp;
- STLReader::tolerance = Math<Real>::ZERO_TOLERANCE;
- STLReader reader;
- if(!reader.open(filename, back_inserter(vtmp), back_inserter(etmp), back_inserter(ftmp), back_inserter(ntmp)))
- {
- LOG_ERROR("Can't open file: " << filename);
- return false;
- }
-
- for(int i=0,e=ftmp.size(); i<e; ++i)
- tr.push_back(Vector3r(vtmp[3*ftmp[i]],vtmp[3*ftmp[i]+1],vtmp[3*ftmp[i]+2]));
- number_of_facets = tr.size()/3;
- LOG_INFO("Open file: " << filename << ": Number of facets: " << number_of_facets);
- return true;
-}
-
-void STLImporter::import(shared_ptr<BodyContainer> bodies, unsigned int begin, bool noInteractingGeometry)
-{
- unsigned int b_id = begin;
- for(int i=0,e=tr.size(); i<e; i+=3)
- {
- Vector3r v[3]={tr[i],tr[i+1],tr[i+2]};
-
- Vector3r icc = Shop::inscribedCircleCenter(v[0],v[1],v[2]);
-
- shared_ptr<InteractingFacet> iFacet(new InteractingFacet);
- iFacet->diffuseColor = Vector3r(0.8,0.3,0.3);
-
- shared_ptr<Facet> gFacet(new Facet);
- gFacet->diffuseColor = Vector3r(0.5,0.5,0.5);
- gFacet->wire = wire;
- gFacet->shadowCaster = true;
-
- for (int j=0; j<3; ++j)
- {
- iFacet->vertices.push_back(v[j]-icc);
- gFacet->vertices.push_back(v[j]-icc);
- }
-
- (*bodies)[b_id]->physicalParameters->se3 = Se3r( icc, Quaternionr( 1,0,0,0 ) );
- (*bodies)[b_id]->geometricalModel = gFacet;
- if (!noInteractingGeometry) (*bodies)[b_id]->interactingGeometry = iFacet;
-
- ++b_id;
- }
-}
Deleted: trunk/lib/import/STLImporter.hpp
===================================================================
--- trunk/lib/import/STLImporter.hpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/lib/import/STLImporter.hpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -1,35 +0,0 @@
-/*************************************************************************
-* Copyright (C) 2008 by Sergei Dorofeenko *
-* sega@xxxxxxxxxxxxxxxx *
-* *
-* This program is free software; it is licensed under the terms of the *
-* GNU General Public License v2 or later. See file LICENSE for details. *
-*************************************************************************/
-#pragma once
-#include <yade/pkg-common/Facet.hpp>
-#include <yade/pkg-common/InteractingFacet.hpp>
-#include "STLReader.hpp"
-#include<yade/core/Body.hpp>
-#include<yade/core/BodyContainer.hpp>
-
-class STLImporter {
- public:
- STLImporter();
-
- /// open file
- bool open(const char* filename);
-
- /// number of facets
- unsigned int number_of_facets;
-
- /// set wire attribute for facets (by default false)
- bool wire;
-
- /// import geometry
- void import(shared_ptr<BodyContainer> bodies, unsigned int begin=0, bool noInteractingGeometry=false);
-
- DECLARE_LOGGER;
-protected:
- vector<Vector3r> tr;
-};
-
Copied: trunk/pkg/dem/PreProcessor/STLImporter.cpp (from rev 1888, trunk/lib/import/STLImporter.cpp)
Property changes on: trunk/pkg/dem/PreProcessor/STLImporter.cpp
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: trunk/pkg/dem/PreProcessor/STLImporter.hpp (from rev 1887, trunk/lib/import/STLImporter.hpp)
===================================================================
--- trunk/lib/import/STLImporter.hpp 2009-07-27 15:00:20 UTC (rev 1887)
+++ trunk/pkg/dem/PreProcessor/STLImporter.hpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -0,0 +1,35 @@
+/*************************************************************************
+* Copyright (C) 2008 by Sergei Dorofeenko *
+* sega@xxxxxxxxxxxxxxxx *
+* *
+* This program is free software; it is licensed under the terms of the *
+* GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+#pragma once
+#include<yade/pkg-common/Facet.hpp>
+#include<yade/pkg-common/InteractingFacet.hpp>
+#include<yade/lib-import/STLReader.hpp>
+#include<yade/core/Body.hpp>
+#include<yade/core/BodyContainer.hpp>
+
+class STLImporter {
+ public:
+ STLImporter();
+
+ /// open file
+ bool open(const char* filename);
+
+ /// number of facets
+ unsigned int number_of_facets;
+
+ /// set wire attribute for facets (by default false)
+ bool wire;
+
+ /// import geometry
+ void import(shared_ptr<BodyContainer> bodies, unsigned int begin=0, bool noInteractingGeometry=false);
+
+ DECLARE_LOGGER;
+protected:
+ vector<Vector3r> tr;
+};
+
Property changes on: trunk/pkg/dem/PreProcessor/STLImporter.hpp
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/pkg/dem/PreProcessor/STLImporterTest.cpp
===================================================================
--- trunk/pkg/dem/PreProcessor/STLImporterTest.cpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/pkg/dem/PreProcessor/STLImporterTest.cpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -8,7 +8,7 @@
#include"STLImporterTest.hpp"
#include<yade/pkg-common/SpatialQuickSortCollider.hpp>
-#include<yade/lib-import/STLImporter.hpp>
+#include<yade/pkg-dem/STLImporter.hpp>
#include<yade/pkg-common/InteractingFacet.hpp>
#include<yade/pkg-common/Facet.hpp>
#include<yade/core/Body.hpp>
Modified: trunk/pkg/dem/meta/RockPM.cpp
===================================================================
--- trunk/pkg/dem/meta/RockPM.cpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/pkg/dem/meta/RockPM.cpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -34,53 +34,82 @@
Dem3DofGeom* geom=static_cast<Dem3DofGeom*>(ig.get());
RpmPhys* phys=static_cast<RpmPhys*>(ip.get());
- Real displN=geom->displacementN();
+ Real displN=geom->displacementN();
+ const Real& crossSection=phys->crossSection;
+
+ Real& epsN=phys->epsN;
+ Vector3r& epsT=phys->epsT;
+
+ Real& sigmaN=phys->sigmaN;
+ Vector3r& sigmaT=phys->sigmaT;
+
+ const Real& E = phys->E;
+ const Real& G = phys->G;
+
+ Real& Fn=phys->Fn;
+ Vector3r& Fs=phys->Fs;
+
+
const shared_ptr<Body>& body1=Body::byId(contact->getId1(),rootBody);
const shared_ptr<Body>& body2=Body::byId(contact->getId2(),rootBody);
assert(body1);
assert(body2);
const shared_ptr<RpmMat>& rbp1=YADE_PTR_CAST<RpmMat>(body1->physicalParameters);
const shared_ptr<RpmMat>& rbp2=YADE_PTR_CAST<RpmMat>(body2->physicalParameters);
-
+
//check, whether one of bodies is damaged
if ((rbp1->isDamaged) || (rbp2->isDamaged)) {
phys->isCohesive = false;
}
-
-
+
if(displN<=0){
/*Normal Interaction*/
- phys->normalForce=phys->kn*displN*geom->normal;
- Real maxFsSq=phys->normalForce.SquaredLength()*pow(phys->tanFrictionAngle,2);
- Vector3r trialFs=phys->ks*geom->displacementT();
- if(trialFs.SquaredLength()>maxFsSq){ geom->slipToDisplacementTMax(sqrt(maxFsSq)); trialFs*=sqrt(maxFsSq/(trialFs.SquaredLength()));}
- applyForceAtContactPoint(phys->normalForce+trialFs,geom->contactPoint,contact->getId1(),geom->se31.position,contact->getId2(),geom->se32.position,rootBody);
+ epsN=geom->strainN();
+ epsT=geom->strainT();
+
+
+ sigmaN=E*epsN;
+ Fn=sigmaN*crossSection; phys->normalForce=Fn*geom->normal;
+
+ sigmaT=G*epsT;
+
+ /*Check, whether the shear stress more, than normal force multiplicated to tanFrictionAngle*/
+
+ Real maxFsSq = phys->normalForce.SquaredLength()*phys->tanFrictionAngle*phys->tanFrictionAngle;
+ if(sigmaT.SquaredLength()>maxFsSq) {
+ sigmaT*=sqrt(maxFsSq/(sigmaT.SquaredLength()));
+ }
+
+ Fs=sigmaT*crossSection;
+ phys->shearForce = Fs;
+
+ applyForceAtContactPoint(phys->normalForce + phys->shearForce, geom->contactPoint, contact->getId1(), geom->se31.position, contact->getId2(), geom->se32.position, rootBody);
/*Normal Interaction_____*/
-
if ((phys->isCohesive)&&(displN<(-phys->lengthMaxCompression))) {
//LOG_WARN(displN<<"__COMRESS!!!__");
phys->isCohesive = false;
rbp1->isDamaged=true;
rbp2->isDamaged=true;
}
+ return;
} else {
if (phys->isCohesive) {
- phys->normalForce=phys->kn*displN*geom->normal;
if (displN>(phys->lengthMaxTension)) {
//LOG_WARN(displN<<"__TENSION!!!__");
phys->isCohesive = false;
rbp1->isDamaged=true;
rbp2->isDamaged=true;
+ return;
} else {
- applyForceAtContactPoint(phys->normalForce,geom->contactPoint,contact->getId1(),geom->se31.position,contact->getId2(),geom->se32.position,rootBody);
+ phys->normalForce=phys->kn*displN*geom->normal;
+ applyForceAtContactPoint(phys->normalForce, geom->contactPoint, contact->getId1(), geom->se31.position, contact->getId2(), geom->se32.position, rootBody);
+ return;
}
- return;
} else {
rootBody->interactions->requestErase(contact->getId1(),contact->getId2());
return;
}
}
-
}
@@ -90,7 +119,7 @@
if(interaction->interactionPhysics) return;
Dem3DofGeom* contGeom=YADE_CAST<Dem3DofGeom*>(interaction->interactionGeometry.get());
-
+ Omega& OO=Omega::instance();
assert(contGeom);
//LOG_WARN(Omega::instance().getCurrentIteration());
const shared_ptr<RpmMat>& rpm1=YADE_PTR_CAST<RpmMat>(pp1);
@@ -98,28 +127,30 @@
const shared_ptr<BodyMacroParameters>& elast1=static_pointer_cast<BodyMacroParameters>(pp1);
const shared_ptr<BodyMacroParameters>& elast2=static_pointer_cast<BodyMacroParameters>(pp2);
-
+ long cohesiveThresholdIter=1000;
+
bool initCohesive = rpm1->initCohesive*rpm2->initCohesive;
Real E12=2*elast1->young*elast2->young/(elast1->young+elast2->young);
Real minRad=(contGeom->refR1<=0?contGeom->refR2:(contGeom->refR2<=0?contGeom->refR1:min(contGeom->refR1,contGeom->refR2)));
Real S12=Mathr::PI*pow(minRad,2);
+ Real G_over_E = (rpm1->G_over_E + rpm2->G_over_E)/2;
shared_ptr<RpmPhys> contPhys(new RpmPhys());
contPhys->E=E12;
- contPhys->G=E12;
+ contPhys->G=E12*G_over_E;
contPhys->tanFrictionAngle=tan(.5*(elast1->frictionAngle+elast2->frictionAngle));
contPhys->crossSection=S12;
contPhys->kn=contPhys->E*contPhys->crossSection;
contPhys->ks=contPhys->G*contPhys->crossSection;
contPhys->lengthMaxCompression=S12*(0.5*(rpm1->stressCompressMax+rpm2->stressCompressMax))/(contPhys->kn);
- contPhys->lengthMaxTension=S12*(0.5*(rpm1->stressTensionMax+rpm2->stressTensionMax))/(contPhys->kn);
+ contPhys->lengthMaxTension=S12*(0.5*(rpm1->stressCompressMax*rpm1->Brittleness+rpm2->stressCompressMax*rpm2->Brittleness))/(contPhys->kn);
initDistance = contGeom->displacementN();
- if ((rpm1->exampleNumber==rpm2->exampleNumber)&&(initDistance<(contPhys->lengthMaxTension))&&(initCohesive)) {
+ if ((rpm1->exampleNumber==rpm2->exampleNumber)&&(initDistance<(contPhys->lengthMaxTension))&&(initCohesive)&&(OO.getCurrentIteration()<=cohesiveThresholdIter)) {
contPhys->isCohesive=true;
- //LOG_WARN("InitDistance="<<initDistance);
+ //LOG_WARN("InitDistance="<<initDistance<<" "<<rpm1->exampleNumber<<" "<<rpm2->exampleNumber<<" "<<OO.getCurrentIteration());
//LOG_WARN("lengthMaxCompression="<<contPhys->lengthMaxCompression);
//LOG_WARN("lengthMaxTension="<<contPhys->lengthMaxTension);
}
Modified: trunk/pkg/dem/meta/RockPM.hpp
===================================================================
--- trunk/pkg/dem/meta/RockPM.hpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/pkg/dem/meta/RockPM.hpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -48,15 +48,16 @@
public:
int exampleNumber; //Number of "stone"
bool initCohesive, isDamaged;
- Real stressCompressMax, stressTensionMax; //Parameters for damaging
-
- RpmMat(): exampleNumber(0.), initCohesive(false), isDamaged(false), stressCompressMax(0), stressTensionMax(0) {createIndex();};
+ Real stressCompressMax, Brittleness, G_over_E; //Parameters for damaging
+
+ RpmMat(): exampleNumber(0.), initCohesive(false), isDamaged(false), stressCompressMax(0), Brittleness(0), G_over_E(1) {createIndex();};
REGISTER_ATTRIBUTES(BodyMacroParameters,
(exampleNumber)
(initCohesive)
(isDamaged)
(stressCompressMax)
- (stressTensionMax));
+ (Brittleness)
+ (G_over_E));
REGISTER_CLASS_AND_BASE(RpmMat,BodyMacroParameters);
};
REGISTER_SERIALIZABLE(RpmMat);
@@ -65,7 +66,7 @@
class Ip2_RpmMat_RpmMat_RpmPhys: public InteractionPhysicsEngineUnit{
private:
public:
- Real sigmaT, initDistance;
+ Real initDistance;
Ip2_RpmMat_RpmMat_RpmPhys(){
initDistance = 0;
@@ -73,7 +74,6 @@
virtual void go(const shared_ptr<PhysicalParameters>& pp1, const shared_ptr<PhysicalParameters>& pp2, const shared_ptr<Interaction>& interaction);
REGISTER_ATTRIBUTES(InteractionPhysicsEngineUnit,
- (sigmaT)
(initDistance)
);
@@ -88,9 +88,13 @@
private:
public:
Real crossSection,E,G,tanFrictionAngle,lengthMaxCompression,lengthMaxTension;
+ Real omega, Fn, sigmaN, epsN;
+ Vector3r epsT, sigmaT, Fs;
+
+
bool isCohesive;
- RpmPhys(): NormalShearInteraction(),crossSection(0),E(0),G(0), tanFrictionAngle(0), lengthMaxCompression(0), lengthMaxTension(0), isCohesive(false) { createIndex();}
+ RpmPhys(): NormalShearInteraction(),crossSection(0),E(0),G(0), tanFrictionAngle(0), lengthMaxCompression(0), lengthMaxTension(0), isCohesive(false) { createIndex(); epsT=Vector3r::ZERO; omega=0; Fn=0; Fs=Vector3r::ZERO;}
virtual ~RpmPhys();
REGISTER_ATTRIBUTES(NormalShearInteraction,
Modified: trunk/py/SConscript
===================================================================
--- trunk/py/SConscript 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/py/SConscript 2009-07-27 19:13:04 UTC (rev 1890)
@@ -27,8 +27,7 @@
env.File('linterpolation.py'),
env.File('timing.py'),
env.File('pack.py'),
- env.SharedLibrary('wrapper',['yadeWrapper/yadeWrapper.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['XMLFormatManager','yade-factory','yade-serialization','STLImporter',
- linkPlugins(['Shop','BoundingVolumeMetaEngine','GeometricalModelMetaEngine','InteractingGeometryMetaEngine','InteractionGeometryMetaEngine','InteractionPhysicsMetaEngine','PhysicalParametersMetaEngine','ConstitutiveLawDispatcher','InteractionDispatchers','ParallelEngine','Clump'])
+ env.SharedLibrary('wrapper',['yadeWrapper/yadeWrapper.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['XMLFormatManager','yade-factory','yade-serialization',linkPlugins(['Shop','BoundingVolumeMetaEngine','GeometricalModelMetaEngine','InteractingGeometryMetaEngine','InteractionGeometryMetaEngine','InteractionPhysicsMetaEngine','PhysicalParametersMetaEngine','ConstitutiveLawDispatcher','InteractionDispatchers','ParallelEngine','Clump','STLImporter',])
],),
env.SharedLibrary('_customConverters',['yadeWrapper/customConverters.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['boost_python_indexing_suite_v2']+linkPlugins(Split("BoundingVolumeEngineUnit GeometricalModelEngineUnit InteractingGeometryEngineUnit InteractionGeometryEngineUnit InteractionPhysicsEngineUnit PhysicalParametersEngineUnit PhysicalActionDamperUnit PhysicalActionApplierUnit ConstitutiveLaw")))
])
Modified: trunk/py/yadeWrapper/yadeWrapper.cpp
===================================================================
--- trunk/py/yadeWrapper/yadeWrapper.cpp 2009-07-27 18:14:30 UTC (rev 1889)
+++ trunk/py/yadeWrapper/yadeWrapper.cpp 2009-07-27 19:13:04 UTC (rev 1890)
@@ -8,7 +8,7 @@
#include<boost/python.hpp>
-#include <boost/python/raw_function.hpp>
+#include<boost/python/raw_function.hpp>
#include<boost/python/suite/indexing/vector_indexing_suite.hpp>
#include<boost/bind.hpp>
#include<boost/lambda/bind.hpp>
@@ -25,7 +25,7 @@
#include<yade/core/Omega.hpp>
#include<yade/core/FileGenerator.hpp>
-#include<yade/lib-import/STLImporter.hpp>
+#include<yade/pkg-dem/STLImporter.hpp>
#include<yade/core/MetaEngine.hpp>
#include<yade/core/MetaEngine1D.hpp>