← Back to team overview

yade-users team mailing list archive

Re: [Question #255780]: A New Constitutive Law: Viscoelastic Burger's model

 

Question #255780 on Yade changed:
https://answers.launchpad.net/yade/+question/255780

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Behzad,

you can also ask compiler to correct you :-) it would warn you about syntax
errors (ending function } in Implementation), name errors (it would
complain about CohesiveBurgersContactLaw) etc.

Law2::normElastEnergy, Law2::normalDisplacement() etc. are not defined..

Nothing is done in void Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys::go,
you just declare some Reals, and do not use it anywhere (the compiler would
warn you about unused variables)

void Ip2_FrictMat_CohBurgersMat_CohFrictPhys::go calls itself (again
compiler would complain I would guess). See [1] how it is done for
FrictMat_CpmMat.

Law2 is called only once and only values valid globally for the law should
be declared there. Local values (different for each interaction) should go
to IPhys. I feel it is the case of all BurgXX variables, if they depends on
particle size for example. What is the meaning of them in your Law2? aren't
they the same as IPhys:BurXX, which should be computed from material?

IPhys should also store internal variables of the physics if you need some
(I fell like you should use some for the dampers, but maybe it is not
necessary).

So, give the compiler chance to teach you first :-) of course, if you have
a problem, you can ask, but to check everything manually, it is a bit
complex..

cheers
Jan

[1]
http://bazaar.launchpad.net/~yade-pkg/yade/git-trunk/view/head:/pkg/dem/ConcretePM.cpp#L26


2014-10-15 22:46 GMT+02:00 behzad
<question255780@xxxxxxxxxxxxxxxxxxxxx>:

> New question #255780 on Yade:
> https://answers.launchpad.net/yade/+question/255780
>
> Hi there,
>
> It's a while I'm working to derive a new constitutive law which gives the
> properties of viscoelastic Burger's model.
> I share here the first drafts of the model which is integrated in one
> header and one implementation file.
> It's a draft and I have not yet tested it. It's shared here to find the
> possible errors.
> Any comments and helps are highly appreciated.
>
> Thanks
>
>
> HEADER:
>
>
>
>
>
> #pragma once
>
> #include<yade/core/GlobalEngine.hpp>
> #include<yade/pkg/common/Dispatching.hpp>
> #include<yade/pkg/dem/ScGeom.hpp>
> #include<boost/tuple/tuple.hpp>
> #include<yade/pkg/dem/CohesiveFrictionalContactLaw.hpp>
> #include<yade/pkg/dem/FrictPhys.hpp>
>
>
>
> //********************** CohBurgersMat ****************************/
>
> class CohBurgersMat : public CohFrictMat
> {
>         public :
>                 virtual ~CohBurgersMat ();
>
> /// Serialization
>         YADE_CLASS_BASE_DOC_ATTRS_CTOR(CohBurgersMat,FrictMat,"",
>                 ((Real,Em,1e3,,"Stiffness of Maxwell's spring"))
>                 ((Real,Ek,1e3,,"Stiffness of Kelvin's spring"))
>                 ((Real,Cm,10,,"Viscosity of Maxwell's dashpot"))
>                 ((Real,Ck,10,,"Viscosity of Kelvin's dashpot"))
>                 ((Real,poissonRatio,0.5,,""))
>                 createIndex();
>                 );
> /// Indexable
>         REGISTER_CLASS_INDEX(CohBurgersMat,CohFrictMat);
> };
>
> REGISTER_SERIALIZABLE(CohBurgersMat);
>
>
>
> //********************** CohBurgersPhys ****************************/
>
> class CohBurgersPhys : public CohFrictPhys
> {
>         public :
>                 virtual ~CohBurgerPhys() {};
>                 void SetBreakingState() {cohesionBroken = true;
> normalAdhesion = 0; shearAdhesion = 0;};
>
>         YADE_CLASS_BASE_DOC_ATTRS_CTOR(CohBurgerPhys,CohFrictPhys,"",
>                 ((bool,cohesionDisablesFriction,false,,"is shear strength
> the sum of friction and adhesion or only adhesion?"))
>                 ((bool,cohesionBroken,true,,"is cohesion active? Set to
> false at the creation of a cohesive contact, and set to true when a fragile
> contact is broken"))
>                 ((bool,fragile,true,,"do cohesion disapear when contact
> strength is exceeded?"))
>                 ((Real,BurEmn,NaN,,"Stiffness of Maxwell's
> spring(normal)"))
>                 ((Real,BurEkn,NaN,,"Stiffness of Kelvin's spring(normal)"))
>                 ((Real,BurCmn,NaN,,"Viscosity of Maxwell's
> dashpot(normal)"))
>                 ((Real,BurCkn,NaN,,"Viscosity of Kelvin's
> dashpot(normal)"))
>                 ((Real,BurEms,NaN,,"Stiffness of Maxwell's spring(shear)"))
>                 ((Real,BurEks,NaN,,"Stiffness of Kelvin's spring(shear)"))
>                 ((Real,BurCms,NaN,,"Viscosity of Maxwell's
> dashpot(shear)"))
>                 ((Real,BurCks,NaN,,"Viscosity of Kelvin's dashpot(shear)"))
>                 ((Real,poissonRatio,NaN,,""))
>                 ((Real,normalAdhesion,0,,"tensile strength"))
>                 ((Real,shearAdhesion,0,,"cohesive part of the shear
> strength (a frictional term might be added depending on
> :yref:`CohFrictPhys::cohesionDisablesFriction`)"))
>                 ,
>                 createIndex();
>         );
> /// Indexable
>         REGISTER_CLASS_INDEX(CohBurgerPhys,CohFrictPhys);
> };
>
> REGISTER_SERIALIZABLE(CohBurgerPhys);
>
>
>
>
> //********************** Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys
> ****************************/
>
> class Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys : public IPhysFunctor
> {
>         public :
>                 virtual void go(        const shared_ptr<Material>& b1,
>                                         const shared_ptr<Material>& b2,
>                                         const shared_ptr<Interaction>&
> interaction);
>                 int cohesionDefinitionIteration;
>
>
> YADE_CLASS_BASE_DOC_ATTRS_CTOR(Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys,IPhysFunctor,
>
>                 ((bool,setCohesionNow,false,,"If true, assign cohesion to
> all existing contacts in current time-step. The flag is turned false
> automatically, so that assignment is done in the current timestep only."))
>                 ((bool,setCohesionOnNewContacts,false,,"If true, assign
> cohesion at all new contacts. If false, only existing contacts can be
> cohesive (also see
> :yref:`Ip2_CohFrictMat_CohFrictMat_CohFrictPhys::setCohesionNow`), and new
> contacts are only frictional."))
>                 ,
>                 cohesionDefinitionIteration = -1;
>                 );
>         FUNCTOR2D(CohBurgersMat,CohBurgersMat);
> };
>
> REGISTER_SERIALIZABLE(Ip2_CohBurgersMat_CohBurgersMat_CohBurgersPhys);
>
>
>
> //********************** Ip2_FrictMat_CohBurgersMat_CohFrictPhys
> ****************************/
>
>
> class Ip2_FrictMat_CohBurgersMat_CohFrictPhys : public IPhysFunctor
> {
>         public :
>                 virtual void go(        const shared_ptr<Material>& b1,
>                                         const shared_ptr<Material>& b2,
>                                         const shared_ptr<Interaction>&
> interaction);
>                 int cohesionDefinitionIteration;
>
>
> YADE_CLASS_BASE_DOC_ATTRS_CTOR(Ip2_FrictMat_CohBurgersMat_CohFrictPhys,IPhysFunctor,
>
>                 ((bool,setCohesionNow,false,,"If true, assign cohesion to
> all existing contacts in current time-step. The flag is turned false
> automatically, so that assignment is done in the current timestep only."))
>                 ((bool,setCohesionOnNewContacts,false,,"If true, assign
> cohesion at all new contacts. If false, only existing contacts can be
> cohesive (also see
> :yref:`Ip2_CohFrictMat_CohFrictMat_CohFrictPhys::setCohesionNow`), and new
> contacts are only frictional."))
>                 ,
>                 cohesionDefinitionIteration = -1;
>                 );
>         FUNCTOR2D(FrictMat,CohBurgersMat);
> };
>
> REGISTER_SERIALIZABLE(Ip2_FrictMat_CohBurgersMat_CohFrictPhys);
>
>
>
>
> //******************** Law2_ScGeom_CohBurgersPhys_CohesiveBurgers
> *************************/
>
>
> class Law2_ScGeom_CohBurgersPhys_CohesiveBurgers: public LawFunctor{
>         public:
>                 OpenMPAccumulator<Real> plasticDissipation;
>                 Real normElastEnergy();
>                 Real shearElastEnergy();
>                 Real normalDisplacement();
>                 Real shearDisplacement();
>                 Real totalElastEnergy();
>                 Real ((BurgEmn, 0.0, "Em in normal direction"))
>                 Real ((BurgEkn, 0.0, "Ek in normal direction"))
>                 Real ((BurgEms, 0.0, "Em in shear direction"))
>                 Real ((BurgEks, 0.0, "Ek in shear direction"))
>                 Real ((BurgCmn, 0.0, "Cm in normal direction"))
>                 Real ((BurgCkn, 0.0, "Ck in normal direction"))
>                 Real ((BurgCms, 0.0, "Cm in shear direction"))
>                 Real ((BurgCks, 0.0, "Ck in shear direction"))
>                 Real ((BurgPoi,0.0,"Poisson ratio"))
>
>                 void initPlasticDissipation(Real initVal=0);
>         virtual bool go(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>&
> _phys, Interaction* I);
>
> YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Law2_ScGeom6D_CohBurgerPhys_CohesiveBurger,
>                 ((bool,neverErase,false,,))
>                 ,,
>
> .def("normElastEnergy",&Law2_ScGeom6D_CohFrictPhys_CohesionMoment::normElastEnergy,"Compute
> normal elastic energy.")
>
> .def("shearElastEnergy",&Law2_ScGeom6D_CohFrictPhys_CohesionMoment::shearElastEnergy,"Compute
> shear elastic energy.")
>
> .def("normalDisplacement",&Law2_ScGeom6D_CohFrictPhys_CohesionMoment::normalDisplacement,"Compute
> normal displacement.")
>
> .def("shearDisplacement",&Law2_ScGeom6D_CohFrictPhys_CohesionMoment::shearDisplacement,"Compute
> shear displacement.")
>
> .def("elasticEnergy",&Law2_ScGeom6D_CohFrictPhys_CohesionMoment::totalElastEnergy,"Compute
> total elastic energy.")
>         );
>         FUNCTOR2D(ScGeom,CohBurgersPhys);
>         DECLARE_LOGGER;
> };
> REGISTER_SERIALIZABLE(Law2_ScGeom_CohBurgersPhys_CohesiveBurgers);
>
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.