yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #25991
[Question #698253]: Access to body material properties
New question #698253 on Yade:
https://answers.launchpad.net/yade/+question/698253
Hi,
I have a problem with the access to some properties which are assigned to a particle (sphere). Could you help me to solve the problem? Here are segments of code.
>From .hpp file:
class CpmMat : public FrictMat {
public:
shared_ptr<State> newAssocState() const override { return shared_ptr<State>(new CpmState); }
bool stateTypeOk(State* s) const override { return (bool)dynamic_cast<CpmState*>(s); }
// clang-format off
YADE_CLASS_BASE_DOC_ATTRS_CTOR(CpmMat,FrictMat,"Concrete material, for use with other Cpm classes. \n\n.. note::\n\n\t:yref:`Density<Material::density>` is initialized to 4800 kgm⁻³automatically, which gives approximate 2800 kgm⁻³ on 0.5 density packing.\n\nConcrete Particle Model (CPM)\n\n\n:yref:`CpmMat` is particle material, :yref:`Ip2_CpmMat_CpmMat_CpmPhys` averages two particles' materials, creating :yref:`CpmPhys`, which is then used in interaction resultion by :yref:`Law2_ScGeom_CpmPhys_Cpm`. :yref:`CpmState` is associated to :yref:`CpmMat` and keeps state defined on particles rather than interactions (such as number of completely damaged interactions).\n\nThe model is contained in externally defined macro CPM_MATERIAL_MODEL, which features damage in tension, plasticity in shear and compression and rate-dependence. For commercial reasons, rate-dependence and compression-plasticity is not present in reduced version of the model, used when CPM_MATERIAL_MODEL is not defined. The full model will be described in detail in my (Václav Šmilauer) thesis along with calibration procedures (rigidity, poisson's ratio, compressive/tensile strength ratio, fracture energy, behavior under confinement, rate-dependent behavior).\n\nEven the public model is useful enough to run simulation on concrete samples, such as :ysrc:`uniaxial tension-compression test<examples/concrete/uniax.py>`.",
((Real,sigOld,0.,,"normal stress from previous iteration [Pa]"))
((Real,tauOld,0.,,"shear stress from previous iteration [Pa]"))
((Real,Sy_0,NaN,,"initial yield strength [Pa]"))
((Real,oldSy,0.,,"yield point form previous iteration [Pa]"))
((Real,cumStr,0.,,"cummulative plastic strain [-]"))
((Real,H,0.,,"hardening parameter [Pa]"))
((Real,density,2700.,,"density [kg/m3]"))
((Real,CP1,0.,,"heat capacity constant"))
((Real,CP2,0.,,"heat capacity constant"))
((Real,CP3,0.,,"heat capacity constant"))
((Real,K1,0.,,"thermal conductivity constant"))
((Real,K2,0.,,"thermal conductivity constant"))
((Real,K3,0.,,"thermal conductivity constant"))
((Real,K4,0.,,"thermal conductivity constant")),
createIndex();
And from .cpp file:
FOREACH(shared_ptr<Body> B, *scene2->bodies)
{
CpmPhys* mat = dynamic_cast<CpmPhys*>(B->material.get());
const Real& CP1(mat->CP1);
const Real& CP2(B->material.CP2);
const Real& CP3(B->material.CP3);
const Real& K1(B->material.K1);
const Real& K2(B->material.K2);
const Real& K3(B->material.K3);
const Real& K4(B->material.K4);
if (!B) continue;
const Body::id_t& id = B->getId();
// add damaged contacts that have already been deleted
CpmState* state = dynamic_cast<CpmState*>(B->state.get());
if (!state) continue;
state->stress = bodyStats[id].stress;
Sphere* sphere = dynamic_cast<Sphere*>(B->shape.get()); // from that ok???
if (!sphere) continue;
Real& r = sphere->radius;
state->stress = bodyStats[id].stress / (4 / 3. * Mathr::PI * r * r * r / .62) * .5;
//state->oldTemp = state->temp; // przypisanie wartosci temperatury
state->Cp = CP1 + CP2 * state->temp + CP3 * pow(state->temp,2);
state->k = K1 + K2 * state->temp + K3 * pow(state->temp, 2) + K4 * pow(state->temp, 3);
}
And here is the example message form terminal:
/home/przemek/DEMlab/trunk/pkg/dem/ConcretePM.cpp:492:33: error: ‘class boost::shared_ptr<yade::Material>’ has no member named ‘K2’
492 | const Real& K2(B->material.K2);
Have you any suggestions?
BR
Przemek
--
You received this question notification because your team yade-users is
an answer contact for Yade.