← Back to team overview

yade-users team mailing list archive

[Question #402988]: terminate called after throwin an instance

 

New question #402988 on Yade:
https://answers.launchpad.net/yade/+question/402988

I creat a new law to simulate the processing of particles sintering.but when I simulated it turned out:
terminate called after throwing an instance of 'std::runtime_error'
  what():  Multimethods: bad virtual call (probably go/goReverse was not overridden with the same argument types; only fundamental types and pure pointers are passed by value, all other types (including shared_ptr<>) are passed by reference); types in the call were:
1. N5boost10shared_ptrI5IGeomEE
2. N5boost10shared_ptrI5IPhysEE
3. P11Interaction
4. N4Loki9EmptyTypeE
5. N4Loki9EmptyTypeE
6. N4Loki9EmptyTypeE
7. N4Loki9EmptyTypeE

this is my law:
class Law2_ScGeom_SinterPhys2_Sinter2: public LawFunctor{
	public:
		bool go(shared_ptr<IGeom>& _geom, shared_ptr<IPhys>& _phys, Interaction* I,Real t,Real d,Real q,Real omega,Real gamma,Real psi);
		FUNCTOR2D(GenericSpheresContact,SinterPhys2);
		YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Law2_ScGeom_SinterPhys2_Sinter2,LawFunctor,"Constitutive law for Sinter model.for another constitutive model",
		,
		/*ctor*/,
	);
		DECLARE_LOGGER;
};
REGISTER_SERIALIZABLE(Law2_ScGeom_SinterPhys2_Sinter2);

CREATE_LOGGER(Law2_ScGeom_SinterPhys2_Sinter2)

bool Law2_ScGeom_SinterPhys2_Sinter2::go(shared_ptr<IGeom>& _geom, 
					shared_ptr<IPhys>& _phys, 
					Interaction* I,Real t,Real d,Real q,Real omega,Real gamma,Real psi)
{
	const Real& dt = scene->dt; 
	int id1 = I->getId1(), id2 = I->getId2(); // get id body 1, get id body 2
	ScGeom* geom = static_cast<ScGeom*>(_geom.get());
	SinterPhys2* phys=static_cast<SinterPhys2*>(_phys.get());	
	Real R1=geom->radius1;
	Real R2=geom->radius2;
	Real uN=geom->penetrationDepth;
	Real k=R1+R2-uN;/*distance between sphere1 and sphere2*/
	Real p=1-5.4414*pow(R1,3)/pow(k,3);/*porosity*/
	Real c=(0.5998+0.0533*psi+(-1.271+0.004144*psi)*p)*R1;
	Real sigmaS=((-4.069+6.557*psi+0.0253*pow(psi,2))+(26.75-42.58*psi+5.986*pow(psi,2))*p+(-51.01+82.12*psi-18.56*pow(psi,2))*pow(p,2))*gamma/R1;
	
	if(geom->penetrationDepth <= 0.0) {
		return false;
	}
	//normal velocity//
	State* de1 = Body::byId(id1,scene)->state.get();
	State* de2 = Body::byId(id2,scene)->state.get();
	const Vector3r shift2 = scene->isPeriodic ? scene->cell->intrShiftPos(I->cellDist): Vector3r::Zero(); 
	const Vector3r shiftVel = scene->isPeriodic ? scene->cell->intrShiftVel(I->cellDist): Vector3r::Zero(); 
	Vector3r incidentV = geom->getIncidentVel(de1, de2, dt, shift2, shiftVel, 1);	
	Vector3r incidentVn = geom->normal.dot(incidentV)*geom->normal;

	//normal force//
	Vector3r normalForce=Vector3r::Zero();
	if (uN<0) {
	normalForce=Vector3r::Zero();
	} else {
		if (p<0) {
				normalForce=3.1415926*pow(c,4)*1.3806488e-23*t*incidentVn/(8*omega*d*exp(-q/(R1*t)));
		} else {	
			normalForce=3.1415926*pow(c,4)*1.3806488e-23*t*incidentVn/(8*omega*d*exp(-q/(R1*t)))-geom->normal*1.7861*pow(R1,2)*sigmaS/pow((1-p),0.6666666666667);
			}
		}
	//add force//
	if (!scene->isPeriodic) {
		applyForceAtContactPoint(normalForce, geom->contactPoint , id1, de1->se3.position, id2, de2->se3.position);
	} else {
		scene->forces.addForce(id1,-normalForce);
		scene->forces.addForce(id2,normalForce);
		scene->forces.addTorque(id1,(geom->radius1-0.5*geom->penetrationDepth)* geom->normal.cross(normalForce));
		scene->forces.addTorque(id2,(geom->radius2-0.5*geom->penetrationDepth)* geom->normal.cross(normalForce));
	}
	return true;
}
	
and this is my script:
 Mat=O.materials.append(SinterMat2())
O.bodies.append([
   # fixed: particle's position in space will not change (support)
   sphere(center=(0,0,0),radius=.5),
   # this particles is free, subject to dynamics
   sphere((0,0,2),.5,dynamic=False,material=Mat)
])
O.bodies[1].state.vel=(0,0,-10)
	
###############add move#####################

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb()]),
   InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],				  
[Ip2_SinterMat2_SinterMat2_SinterPhys2()],
[Law2_ScGeom_SinterPhys2_Sinter2()]),
NewtonIntegrator(damping=0.0, gravity=(0,0,0))
]


can anyone help me?Thanks.:)




-- 
You received this question notification because your team yade-users is
an answer contact for Yade.