Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Klaus Thoeni
Hi Anton,

I just had a look at py/tests/clump.py, that's the test which fails. I added 
this after line 60 (before NewtonIntegrator is called):

for b in O.bodies: print b.material

and that's what I get:


None

So the second body has no material. I think it's more a problem in the test. 
In a, lets say, real simulation the material always exists (or not?), so I am 
not sure if checking for the material makes sense and it would be quit 
inefficient.

However, I am not familiar with the testing stuff. Is there anyone who knows 
why the second body gives 'None' for the material?

Klaus

On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
>  > Real getDampCoeff() { return material->damping; };
> 
> Can you check here a material existence?
> 
> Anton
> 
> On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni  
wrote:
> > Hi guys,
> > 
> > can anyone help me on this?
> > 
> > Klaus
> > 
> > On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
> >> Hi guys,
> >> 
> >> as discussed with Bruno in Barcelona I need different non-viscous
> >> damping coefficients for different materials. I introduced this
> >> capability by adding a variable damping to the base class material
> >> which is initialised with NaN. The body class has a function
> >> getDampCoeff() and in
> >> NewtonIntegrator I use this function in order to change the damping
> >> coefficients. When running some examples it seems that everything works
> >> fine. However, I just run 'yade --test' and it gives me a seg fault:
> >> 
> >> testVelocity (yade.TestSimpleClump)
> >> Clump: velocities of member assigned by NewtonIntegrator ...
> >> Segmentation fault
> >> 
> >> I think I now where the problem is. In NewtonIntegrator I call something
> >> like:
> >> 
> >> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
> >> 
> >> where getDampCoeff() is defined in body.hpp as:
> >> 
> >> Real getDampCoeff() { return material->damping; };
> >> 
> >> I think the test doesn't have a material and therefore I get the seg
> >> fault. Right? How can we fix this so that I can commit the code?
> >> 
> >> Klaus
> > 
> > ___
> > Mailing list: https://launchpad.net/~yade-dev
> > Post to : yade-dev@lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~yade-dev
> > More help   : https://help.launchpad.net/ListHelp
> 
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Klaus Thoeni
Hi Anton,

actually it is the third body and it's a clump (isClump=True). Clumps should 
have a material too, shouldn't they?

Klaus

On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
>  > Real getDampCoeff() { return material->damping; };
> 
> Can you check here a material existence?
> 
> Anton
> 
> On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni  
wrote:
> > Hi guys,
> > 
> > can anyone help me on this?
> > 
> > Klaus
> > 
> > On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
> >> Hi guys,
> >> 
> >> as discussed with Bruno in Barcelona I need different non-viscous
> >> damping coefficients for different materials. I introduced this
> >> capability by adding a variable damping to the base class material
> >> which is initialised with NaN. The body class has a function
> >> getDampCoeff() and in
> >> NewtonIntegrator I use this function in order to change the damping
> >> coefficients. When running some examples it seems that everything works
> >> fine. However, I just run 'yade --test' and it gives me a seg fault:
> >> 
> >> testVelocity (yade.TestSimpleClump)
> >> Clump: velocities of member assigned by NewtonIntegrator ...
> >> Segmentation fault
> >> 
> >> I think I now where the problem is. In NewtonIntegrator I call something
> >> like:
> >> 
> >> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
> >> 
> >> where getDampCoeff() is defined in body.hpp as:
> >> 
> >> Real getDampCoeff() { return material->damping; };
> >> 
> >> I think the test doesn't have a material and therefore I get the seg
> >> fault. Right? How can we fix this so that I can commit the code?
> >> 
> >> Klaus
> > 
> > ___
> > Mailing list: https://launchpad.net/~yade-dev
> > Post to : yade-dev@lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~yade-dev
> > More help   : https://help.launchpad.net/ListHelp
> 
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Anton Gladky
Hmm, good question.
Maybe not. They consist of "real" spheres and those spheres should
have a material, I think.

Anton



On Thu, Jan 19, 2012 at 11:35 AM, Klaus Thoeni  wrote:
> Hi Anton,
>
> actually it is the third body and it's a clump (isClump=True). Clumps should
> have a material too, shouldn't they?
>
> Klaus
>
> On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
>>  > Real getDampCoeff() { return material->damping; };
>>
>> Can you check here a material existence?
>>
>> Anton
>>
>> On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni 
> wrote:
>> > Hi guys,
>> >
>> > can anyone help me on this?
>> >
>> > Klaus
>> >
>> > On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
>> >> Hi guys,
>> >>
>> >> as discussed with Bruno in Barcelona I need different non-viscous
>> >> damping coefficients for different materials. I introduced this
>> >> capability by adding a variable damping to the base class material
>> >> which is initialised with NaN. The body class has a function
>> >> getDampCoeff() and in
>> >> NewtonIntegrator I use this function in order to change the damping
>> >> coefficients. When running some examples it seems that everything works
>> >> fine. However, I just run 'yade --test' and it gives me a seg fault:
>> >>
>> >> testVelocity (yade.TestSimpleClump)
>> >> Clump: velocities of member assigned by NewtonIntegrator ...
>> >> Segmentation fault
>> >>
>> >> I think I now where the problem is. In NewtonIntegrator I call something
>> >> like:
>> >>
>> >> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
>> >>
>> >> where getDampCoeff() is defined in body.hpp as:
>> >>
>> >> Real getDampCoeff() { return material->damping; };
>> >>
>> >> I think the test doesn't have a material and therefore I get the seg
>> >> fault. Right? How can we fix this so that I can commit the code?
>> >>
>> >> Klaus
>> >
>> > ___
>> > Mailing list: https://launchpad.net/~yade-dev
>> > Post to     : yade-dev@lists.launchpad.net
>> > Unsubscribe : https://launchpad.net/~yade-dev
>> > More help   : https://help.launchpad.net/ListHelp
>>
>> ___
>> Mailing list: https://launchpad.net/~yade-dev
>> Post to     : yade-dev@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~yade-dev
>> More help   : https://help.launchpad.net/ListHelp
>
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Klaus Thoeni
I just creeated a clump in a "real" simulation , and indeed, material gives 
'None'. So clumps have no material. Anyone knows why? Makes no sense to me.

Klaus

On Thu, 19 Jan 2012 09:51:38 PM Anton Gladky wrote:
> Hmm, good question.
> Maybe not. They consist of "real" spheres and those spheres should
> have a material, I think.
> 
> Anton
> 
> On Thu, Jan 19, 2012 at 11:35 AM, Klaus Thoeni  
wrote:
> > Hi Anton,
> > 
> > actually it is the third body and it's a clump (isClump=True). Clumps
> > should have a material too, shouldn't they?
> > 
> > Klaus
> > 
> > On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
> >>  > Real getDampCoeff() { return material->damping; };
> >> 
> >> Can you check here a material existence?
> >> 
> >> Anton
> >> 
> >> On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni 
> > 
> > wrote:
> >> > Hi guys,
> >> > 
> >> > can anyone help me on this?
> >> > 
> >> > Klaus
> >> > 
> >> > On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
> >> >> Hi guys,
> >> >> 
> >> >> as discussed with Bruno in Barcelona I need different non-viscous
> >> >> damping coefficients for different materials. I introduced this
> >> >> capability by adding a variable damping to the base class material
> >> >> which is initialised with NaN. The body class has a function
> >> >> getDampCoeff() and in
> >> >> NewtonIntegrator I use this function in order to change the damping
> >> >> coefficients. When running some examples it seems that everything
> >> >> works fine. However, I just run 'yade --test' and it gives me a seg
> >> >> fault:
> >> >> 
> >> >> testVelocity (yade.TestSimpleClump)
> >> >> Clump: velocities of member assigned by NewtonIntegrator ...
> >> >> Segmentation fault
> >> >> 
> >> >> I think I now where the problem is. In NewtonIntegrator I call
> >> >> something like:
> >> >> 
> >> >> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
> >> >> 
> >> >> where getDampCoeff() is defined in body.hpp as:
> >> >> 
> >> >> Real getDampCoeff() { return material->damping; };
> >> >> 
> >> >> I think the test doesn't have a material and therefore I get the seg
> >> >> fault. Right? How can we fix this so that I can commit the code?
> >> >> 
> >> >> Klaus
> >> > 
> >> > ___
> >> > Mailing list: https://launchpad.net/~yade-dev
> >> > Post to : yade-dev@lists.launchpad.net
> >> > Unsubscribe : https://launchpad.net/~yade-dev
> >> > More help   : https://help.launchpad.net/ListHelp
> >> 
> >> ___
> >> Mailing list: https://launchpad.net/~yade-dev
> >> Post to : yade-dev@lists.launchpad.net
> >> Unsubscribe : https://launchpad.net/~yade-dev
> >> More help   : https://help.launchpad.net/ListHelp
> > 
> > ___
> > Mailing list: https://launchpad.net/~yade-dev
> > Post to : yade-dev@lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~yade-dev
> > More help   : https://help.launchpad.net/ListHelp
> 
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Klaus Thoeni
Solved the problem by checking if it is a clump:

Real getDampCoeff() { return (!&Body::isClump) ? material->damping : NaN; };

However, I think we still have to sort out why clumps don't have a material!

I will commit the code, it might be useful to have different non-viscous 
damping coefficients, or what do you think?

Klaus

On Thu, 19 Jan 2012 09:51:38 PM Anton Gladky wrote:
> Hmm, good question.
> Maybe not. They consist of "real" spheres and those spheres should
> have a material, I think.
> 
> Anton
> 
> On Thu, Jan 19, 2012 at 11:35 AM, Klaus Thoeni  
wrote:
> > Hi Anton,
> > 
> > actually it is the third body and it's a clump (isClump=True). Clumps
> > should have a material too, shouldn't they?
> > 
> > Klaus
> > 
> > On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
> >>  > Real getDampCoeff() { return material->damping; };
> >> 
> >> Can you check here a material existence?
> >> 
> >> Anton
> >> 
> >> On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni 
> > 
> > wrote:
> >> > Hi guys,
> >> > 
> >> > can anyone help me on this?
> >> > 
> >> > Klaus
> >> > 
> >> > On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
> >> >> Hi guys,
> >> >> 
> >> >> as discussed with Bruno in Barcelona I need different non-viscous
> >> >> damping coefficients for different materials. I introduced this
> >> >> capability by adding a variable damping to the base class material
> >> >> which is initialised with NaN. The body class has a function
> >> >> getDampCoeff() and in
> >> >> NewtonIntegrator I use this function in order to change the damping
> >> >> coefficients. When running some examples it seems that everything
> >> >> works fine. However, I just run 'yade --test' and it gives me a seg
> >> >> fault:
> >> >> 
> >> >> testVelocity (yade.TestSimpleClump)
> >> >> Clump: velocities of member assigned by NewtonIntegrator ...
> >> >> Segmentation fault
> >> >> 
> >> >> I think I now where the problem is. In NewtonIntegrator I call
> >> >> something like:
> >> >> 
> >> >> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
> >> >> 
> >> >> where getDampCoeff() is defined in body.hpp as:
> >> >> 
> >> >> Real getDampCoeff() { return material->damping; };
> >> >> 
> >> >> I think the test doesn't have a material and therefore I get the seg
> >> >> fault. Right? How can we fix this so that I can commit the code?
> >> >> 
> >> >> Klaus
> >> > 
> >> > ___
> >> > Mailing list: https://launchpad.net/~yade-dev
> >> > Post to : yade-dev@lists.launchpad.net
> >> > Unsubscribe : https://launchpad.net/~yade-dev
> >> > More help   : https://help.launchpad.net/ListHelp
> >> 
> >> ___
> >> Mailing list: https://launchpad.net/~yade-dev
> >> Post to : yade-dev@lists.launchpad.net
> >> Unsubscribe : https://launchpad.net/~yade-dev
> >> More help   : https://help.launchpad.net/ListHelp
> > 
> > ___
> > Mailing list: https://launchpad.net/~yade-dev
> > Post to : yade-dev@lists.launchpad.net
> > Unsubscribe : https://launchpad.net/~yade-dev
> > More help   : https://help.launchpad.net/ListHelp
> 
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Anton Gladky
Could you, please, attach a diff first?
Thanks

Anton



On Thu, Jan 19, 2012 at 1:03 PM, Klaus Thoeni  wrote:
> Solved the problem by checking if it is a clump:
>
> Real getDampCoeff() { return (!&Body::isClump) ? material->damping : NaN; };
>
> However, I think we still have to sort out why clumps don't have a material!
>
> I will commit the code, it might be useful to have different non-viscous
> damping coefficients, or what do you think?
>
> Klaus

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Klaus Thoeni
Here is the diff, effected classes Body, Material, NewtonIntegrator. Let me 
know 
if you are happy!

=== modified file core/Body.hpp
--- core/Body.hpp   2010-12-22 10:55:23 +
+++ core/Body.hpp   2012-01-19 11:40:50 +
@@ -68,6 +68,8 @@
 
int getGroupMask() {return groupMask; };
bool maskOk(int mask){return (mask==0 || (groupMask&mask));}
+   
+   Real getDampCoeff() { return (!&Body::isClump) ? 
material->damping : NaN; 
};
 
// only BodyContainer can set the id of a body
friend class BodyContainer;

=== modified file core/Material.hpp
--- core/Material.hpp   2010-11-07 11:46:20 +
+++ core/Material.hpp   2012-01-12 05:50:12 +
@@ -39,7 +39,8 @@
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Material,Serializable,"Material 
properties of a :yref:`body`.",
((int,id,((void)"not shared",-1),Attr::readonly,"Numeric id of 
this 
material; is non-negative only if this Material is shared (i.e. in 
O.materials), -1 otherwise. This value is set automatically when the material 
is inserted to the simulation via 
:yref:`O.materials.append`. (This id was necessary 
since before boost::serialization was used, shared pointers were not tracked 
properly; it might disappear in the future)"))
((string,label,,,"Textual identifier for this material; can be 
used for 
shared materials lookup in :yref:`MaterialContainer`."))
-   ((Real,density,1000,,"Density of the material [kg/m³]")),
+   ((Real,density,1000,,"Density of the material [kg/m³]"))
+   ((Real,damping,NaN,,"Local damping coefficient associated with 
the 
material [-]. If this value is given :yref:`Newtonintegrator` uses this value 
instead of :yref:`damping` and it allows to use 
different damping coefficients for different materials.")),
/* ctor */,
/*py*/
.def("newAssocState",&Material::newAssocState,"Return new 
:yref:`State` 
instance, which is associated with this :yref:`Material`. Some materials have 
special requirement on :yref:`Body::state` type and calling this function when 
the body is created will ensure that they match. (This is done automatically 
if you use utils.sphere, … functions from python).")

=== modified file pkg/dem/NewtonIntegrator.cpp
--- pkg/dem/NewtonIntegrator.cpp2011-11-30 17:39:33 +
+++ pkg/dem/NewtonIntegrator.cpp2012-01-19 11:56:41 +
@@ -11,17 +11,18 @@
 #include
 #include
 #include
+#include "../../lib/base/Logging.hpp"
 
 YADE_PLUGIN((NewtonIntegrator));
 CREATE_LOGGER(NewtonIntegrator);
 
 // 1st order numerical damping
-void NewtonIntegrator::cundallDamp1st(Vector3r& force, const Vector3r& vel){
-   for(int i=0; i<3; i++) force[i]*=1-damping*Mathr::Sign(force[i]*vel[i]);
+void NewtonIntegrator::cundallDamp1st(Vector3r& force, const Vector3r& vel, 
const Real& dampcoeff){
+   for(int i=0; i<3; i++) 
force[i]*=1-dampcoeff*Mathr::Sign(force[i]*vel[i]);
 }
 // 2nd order numerical damping
-void NewtonIntegrator::cundallDamp2nd(const Real& dt, const Vector3r& force, 
const Vector3r& vel, Vector3r& accel){
-   for(int i=0; i<3; i++) accel[i]*= 1 - damping*Mathr::Sign ( 
force[i]*(vel[i] + 0.5*dt*accel[i]) );
+void NewtonIntegrator::cundallDamp2nd(const Real& dt, const Vector3r& force, 
const Vector3r& vel, Vector3r& accel, const Real& dampcoeff){
+   for(int i=0; i<3; i++) accel[i]*= 1 - dampcoeff*Mathr::Sign ( 
force[i]*(vel[i] + 0.5*dt*accel[i]) );
 }
 
 Vector3r NewtonIntegrator::computeAccel(const Vector3r& force, const Real& 
mass, int blockedDOFs){
@@ -39,11 +40,14 @@
 
 void NewtonIntegrator::updateEnergy(const shared_ptr& b, const State* 
state, const Vector3r& fluctVel, const Vector3r& f, const Vector3r& m){
assert(b->isStandalone() || b->isClump());
-   // always positive dissipation, by-component: |F_i|*|v_i|*damping*dt (|
T_i|*|ω_i|*damping*dt for rotations)
-   if(damping!=0.){
-   scene->energy-
>add(fluctVel.cwise().abs().dot(f.cwise().abs())*damping*scene-
>dt,"nonviscDamp",nonviscDampIx,/*non-incremental*/false);
+   // check which damping coefficient to use
+   Real dampcoeff=damping;
+   if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
+   // always positive dissipation, by-component: |F_i|*|v_i|*dampcoeff*dt 
(|
T_i|*|ω_i|*dampcoeff*dt for rotations)
+   if(dampcoeff!=0.){
+   scene->energy-
>add(fluctVel.cwise().abs().dot(f.cwise().abs())*dampcoeff*scene-
>dt,"nonviscDamp",nonviscDampIx,/*non-incremental*/false);
// when the aspherical integrator is used, torque is damped 
instead of 
ang acceleration; this code is only approximate
-   scene->energy->add(state-
>angVel.cwise().abs().dot(m.cwise().abs())*damping*scene-
>dt,"nonviscDamp",nonviscDampIx,false);
+   scene->energy->add(state-
>angVel.cwise().abs().dot(m.cwise().abs())*dampcoeff*scene-
>dt

Re: [Yade-dev] : yade.qt doc

2012-01-19 Thread Bruno Chareyre
Could you please fill a bug report, we should not forget that.
B

On 18/01/12 23:04, Klaus Thoeni wrote:
> Hi guys,
>
> there is something wrong with the docmuentation of module yade.qt. Nothing is 
> shown on the doc site:
>
> https://yade-dem.org/doc/yade.qt.html
>
> and it's not listed in the index:
>
> https://yade-dem.org/doc/py-modindex.html
>
> Have a look.
>
> Klaus
>
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
>


-- 
___
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
11, rue des Mathématiques
BP 46
38402 St Martin d'Hères, France
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43



___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Bruno Chareyre
Hi Klaus,

1/ I don't really understand what you did and what the problem is. I
know what density scaling is (what we discussed in Barcelona iirc), but
it is not a form of damping and doesn't need anything new in materials.
Instead, it uses the per-body timestep.
2/ In order to be sure where the crash is, you should test in debug mode.

Bruno

On 19/01/12 08:14, Klaus Thoeni wrote:
> Hi guys,
>
> can anyone help me on this?
>
> Klaus
>
> On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
>> Hi guys,
>>
>> as discussed with Bruno in Barcelona I need different non-viscous damping
>> coefficients for different materials. I introduced this capability by
>> adding a variable damping to the base class material which is initialised
>> with NaN. The body class has a function getDampCoeff() and in
>> NewtonIntegrator I use this function in order to change the damping
>> coefficients. When running some examples it seems that everything works
>> fine. However, I just run 'yade --test' and it gives me a seg fault:
>>
>> testVelocity (yade.TestSimpleClump)
>> Clump: velocities of member assigned by NewtonIntegrator ... Segmentation
>> fault
>>
>> I think I now where the problem is. In NewtonIntegrator I call something
>> like:
>>
>> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
>>
>> where getDampCoeff() is defined in body.hpp as:
>>
>> Real getDampCoeff() { return material->damping; };
>>
>> I think the test doesn't have a material and therefore I get the seg fault.
>> Right? How can we fix this so that I can commit the code?
>>
>> Klaus
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
>


-- 
___
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
11, rue des Mathématiques
BP 46
38402 St Martin d'Hères, France
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43



___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Bruno Chareyre
(sorry for previous message, I didnt see the full discussion)
As Anton says, a clump is a collection of bodies (not only spheres), and
each of them have a material. At the clump's scale, material properties
would be useless.

Bruno


On 19/01/12 11:56, Klaus Thoeni wrote:
> I just creeated a clump in a "real" simulation , and indeed, material gives 
> 'None'. So clumps have no material. Anyone knows why? Makes no sense to me.
>
> Klaus
>
> On Thu, 19 Jan 2012 09:51:38 PM Anton Gladky wrote:
>> Hmm, good question.
>> Maybe not. They consist of "real" spheres and those spheres should
>> have a material, I think.
>>
>> Anton
>>
>> On Thu, Jan 19, 2012 at 11:35 AM, Klaus Thoeni  
> wrote:
>>> Hi Anton,
>>>
>>> actually it is the third body and it's a clump (isClump=True). Clumps
>>> should have a material too, shouldn't they?
>>>
>>> Klaus
>>>
>>> On Thu, 19 Jan 2012 06:31:09 PM Anton Gladky wrote:
  > Real getDampCoeff() { return material->damping; };

 Can you check here a material existence?

 Anton

 On Thu, Jan 19, 2012 at 8:14 AM, Klaus Thoeni 
>>> wrote:
> Hi guys,
>
> can anyone help me on this?
>
> Klaus
>
> On Thu, 12 Jan 2012 06:03:16 PM Klaus Thoeni wrote:
>> Hi guys,
>>
>> as discussed with Bruno in Barcelona I need different non-viscous
>> damping coefficients for different materials. I introduced this
>> capability by adding a variable damping to the base class material
>> which is initialised with NaN. The body class has a function
>> getDampCoeff() and in
>> NewtonIntegrator I use this function in order to change the damping
>> coefficients. When running some examples it seems that everything
>> works fine. However, I just run 'yade --test' and it gives me a seg
>> fault:
>>
>> testVelocity (yade.TestSimpleClump)
>> Clump: velocities of member assigned by NewtonIntegrator ...
>> Segmentation fault
>>
>> I think I now where the problem is. In NewtonIntegrator I call
>> something like:
>>
>> if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();
>>
>> where getDampCoeff() is defined in body.hpp as:
>>
>> Real getDampCoeff() { return material->damping; };
>>
>> I think the test doesn't have a material and therefore I get the seg
>> fault. Right? How can we fix this so that I can commit the code?
>>
>> Klaus
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
 ___
 Mailing list: https://launchpad.net/~yade-dev
 Post to : yade-dev@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~yade-dev
 More help   : https://help.launchpad.net/ListHelp
>>> ___
>>> Mailing list: https://launchpad.net/~yade-dev
>>> Post to : yade-dev@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~yade-dev
>>> More help   : https://help.launchpad.net/ListHelp
>> ___
>> Mailing list: https://launchpad.net/~yade-dev
>> Post to : yade-dev@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~yade-dev
>> More help   : https://help.launchpad.net/ListHelp
> ___
> Mailing list: https://launchpad.net/~yade-dev
> Post to : yade-dev@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
>


-- 
___
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
11, rue des Mathématiques
BP 46
38402 St Martin d'Hères, France
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43



___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Bruno Chareyre
Still not good Klaus sorry. Bodies without material are allowed. Your
change should not crash yade in that case.

> Solved the problem by checking if it is a clump:


___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Anton Gladky
One note:

if(!isnan(b->getDampCoeff())) dampcoeff=b->getDampCoeff();

I think it is not optimal to check (if(!isnan(b->getDampCoeff( on
_every_ interaction on _each_ step (performance!!!).
As I understand, you do not use "damping"-variable of Newtonintegrator
at all, so just set it to -1 and use it as flag.
So you will check it 1 time per step.

But it needs to be documented.

I dont see any large problems with this commit. If you really need it,
you can do it after fixing this issue.

Anton



On Thu, Jan 19, 2012 at 1:48 PM, Klaus Thoeni  wrote:
> Here is the diff, effected classes Body, Material, NewtonIntegrator. Let me 
> know
> if you are happy!
>
> === modified file core/Body.hpp
> --- core/Body.hpp       2010-12-22 10:55:23 +
> +++ core/Body.hpp       2012-01-19 11:40:50 +
> @@ -68,6 +68,8 @@
>
>                int getGroupMask() {return groupMask; };
>                bool maskOk(int mask){return (mask==0 || (groupMask&mask));}
> +
> +               Real getDampCoeff() { return (!&Body::isClump) ? 
> material->damping : NaN;
> };
>
>                // only BodyContainer can set the id of a body
>                friend class BodyContainer;
>
> === modified file core/Material.hpp
> --- core/Material.hpp   2010-11-07 11:46:20 +
> +++ core/Material.hpp   2012-01-12 05:50:12 +
> @@ -39,7 +39,8 @@
>        YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Material,Serializable,"Material
> properties of a :yref:`body`.",
>                ((int,id,((void)"not shared",-1),Attr::readonly,"Numeric id of 
> this
> material; is non-negative only if this Material is shared (i.e. in
> O.materials), -1 otherwise. This value is set automatically when the material
> is inserted to the simulation via
> :yref:`O.materials.append`. (This id was necessary
> since before boost::serialization was used, shared pointers were not tracked
> properly; it might disappear in the future)"))
>                ((string,label,,,"Textual identifier for this material; can be 
> used for
> shared materials lookup in :yref:`MaterialContainer`."))
> -               ((Real,density,1000,,"Density of the material [kg/m³]")),
> +               ((Real,density,1000,,"Density of the material [kg/m³]"))
> +               ((Real,damping,NaN,,"Local damping coefficient associated 
> with the
> material [-]. If this value is given :yref:`Newtonintegrator` uses this value
> instead of :yref:`damping` and it allows to use
> different damping coefficients for different materials.")),
>                /* ctor */,
>                /*py*/
>                .def("newAssocState",&Material::newAssocState,"Return new 
> :yref:`State`
> instance, which is associated with this :yref:`Material`. Some materials have
> special requirement on :yref:`Body::state` type and calling this function when
> the body is created will ensure that they match. (This is done automatically
> if you use utils.sphere, … functions from python).")
>
> === modified file pkg/dem/NewtonIntegrator.cpp
> --- pkg/dem/NewtonIntegrator.cpp        2011-11-30 17:39:33 +
> +++ pkg/dem/NewtonIntegrator.cpp        2012-01-19 11:56:41 +
> @@ -11,17 +11,18 @@
>  #include
>  #include
>  #include
> +#include "../../lib/base/Logging.hpp"
>
>  YADE_PLUGIN((NewtonIntegrator));
>  CREATE_LOGGER(NewtonIntegrator);
>
>  // 1st order numerical damping
> -void NewtonIntegrator::cundallDamp1st(Vector3r& force, const Vector3r& vel){
> -       for(int i=0; i<3; i++) 
> force[i]*=1-damping*Mathr::Sign(force[i]*vel[i]);
> +void NewtonIntegrator::cundallDamp1st(Vector3r& force, const Vector3r& vel,
> const Real& dampcoeff){
> +       for(int i=0; i<3; i++) 
> force[i]*=1-dampcoeff*Mathr::Sign(force[i]*vel[i]);
>  }
>  // 2nd order numerical damping
> -void NewtonIntegrator::cundallDamp2nd(const Real& dt, const Vector3r& force,
> const Vector3r& vel, Vector3r& accel){
> -       for(int i=0; i<3; i++) accel[i]*= 1 - damping*Mathr::Sign (
> force[i]*(vel[i] + 0.5*dt*accel[i]) );
> +void NewtonIntegrator::cundallDamp2nd(const Real& dt, const Vector3r& force,
> const Vector3r& vel, Vector3r& accel, const Real& dampcoeff){
> +       for(int i=0; i<3; i++) accel[i]*= 1 - dampcoeff*Mathr::Sign (
> force[i]*(vel[i] + 0.5*dt*accel[i]) );
>  }
>
>  Vector3r NewtonIntegrator::computeAccel(const Vector3r& force, const Real&
> mass, int blockedDOFs){
> @@ -39,11 +40,14 @@
>
>  void NewtonIntegrator::updateEnergy(const shared_ptr& b, const State*
> state, const Vector3r& fluctVel, const Vector3r& f, const Vector3r& m){
>        assert(b->isStandalone() || b->isClump());
> -       // always positive dissipation, by-component: |F_i|*|v_i|*damping*dt 
> (|
> T_i|*|ω_i|*damping*dt for rotations)
> -       if(damping!=0.){
> -               scene->energy-
>>add(fluctVel.cwise().abs().dot(f.cwise().abs())*damping*scene-
>>dt,"nonviscDamp",nonviscDampIx,/*non-incremental*/false);
> +       // check which damping coefficient to use
> +       Real dampcoeff=damping;
> +       if(!isnan(b->getDampCoeff())) dampcoeff=b->getDamp

Re: [Yade-dev] : Add damping coefficient to material

2012-01-19 Thread Bruno Chareyre
Klaus,
If what you want is to increase the timestep (because your steel-net
induces very small dt, right?), this change will not work. You need to
modify density in the good place in Newton, not damping. It can be done
by adding dscale parameter in the material class (hence no need to check
if it exists), which would be 1 by default, hence no need to check if it
is NaN.
isnan is not in C++ standard, by the way. I know it is used in many
places but we should avoid it if possible. I'm also not sure of the cost
of this function, it may be more expensive than comparing two doubles.

Bruno


___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


[Yade-dev] [Bug 918948] [NEW] yade.qt documentation missing

2012-01-19 Thread Klaus Thoeni
Public bug reported:

There is something wrong with the documentation of module yade.qt.
Nothing is shown on the doc site:

https://yade-dem.org/doc/yade.qt.html

and it's not listed in the index:

https://yade-dem.org/doc/py-modindex.html

** Affects: yade
 Importance: Medium
 Status: New

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/918948

Title:
   yade.qt documentation missing

Status in Yet Another Dynamic Engine:
  New

Bug description:
  There is something wrong with the documentation of module yade.qt.
  Nothing is shown on the doc site:

  https://yade-dem.org/doc/yade.qt.html

  and it's not listed in the index:

  https://yade-dem.org/doc/py-modindex.html

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/918948/+subscriptions

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp