insert single bond in gengeo

Asked by Koen Torremans

Hi everyone,

I'm simulating brittle extensional fracturing under changing stress regimes and study the effect of geomechanical properties on vein formation. For my simulation I need to read in a checkpoint-file of a simulation into gengeo, refill the crack that has just opened with new particles and remake the bonds and create new bonds. I do manage to remake the geometry and insert particles but I bumped into a problem in the 2D-case for re-enstating bonds between particles.

There is a routine insertBond(Id1,Id2,tag) in the MNTable3D class that gives me exactly what I want but it is not implemented correctly in the MNTable2D class. Is there a simple workaround for this problem in 2D? I would be great for my research if I could be able to do such a thing.

I think I've found the problem in the source-code of gengeo. The routine is there in the c++ source but it is not present in the Python API wrapper.

MNTable2D.cc in gengeo/src does say:
----------------------------------------------------
/*!
  insert bond between particles with given ID

  \param id1 id of 1st particle
  \param id2 id of 2nd particle
  \param btag bond tag
*/
void MNTable2D::insertBond(int id1,int id2,int btag)
{
  if(id1<id2){
    m_bonds[btag].insert(make_pair(id1,id2));
  } else {
    m_bonds[btag].insert(make_pair(id2,id1));
  }
}

and MNTable2D.h says:
-------------------------------
void insertBond(int,int,int);

But there is no reference to this routine in MNTable2DPy.cc.

But what I presume is the Pyhon API wrapper in MNTable3DPy.cc says:
------------------------------------------------------------------------------------------------
      .def(
        "generateBonds",
        &MNTable3D::generateBonds,
        (boost::python::arg("groupID")=0, boost::python::arg("tolerance"), boost::python::arg("bondID") ),
        "Generates bonds between particle pairs separated by less than the specified tolerance\n"
        "@type groupID: int\n"
        "@kwarg groupID: the group ID of particles to bond together (default: 0)\n"
        "@type tolerance: double\n"
        "@kwarg tolerance: maximum distance separating bonded particles\n"
        "@type bondID: int\n"
        "@kwarg bondID: the bond ID to assign generated bonds\n"
        "@rtype: void\n"
      )

So it works for 3D but not for 2D. So perhaps all it takes is copy/paste/editing this to MNTable2DPy.cc?

Cheers
Koen

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Vince Boros
Solved:
Last query:
Last reply:
Revision history for this message
Koen Torremans (koen-torremans) said :
#1

I'm sorry I must have wrongly copy/paste'd the wrong part of code for MNTable3DPy.cc:

This is the correct code I'm referring to:

.def(
        "insertBond",
        &MNTable3D::insertBond,
        ( boost::python::arg("Id1"), boost::python::arg("Id2"), boost::python::arg("tag") ),
        "Inserts bond between particles with the specified particle IDs\n"
        "@type Id1: int\n"
        "@kwarg Id1: Id of first particle to bond\n"
        "@type Id2: int\n"
        "@kwarg Id2: Id of second particle to bond\n"
        "@type tag: int\n"
        "@kwarg tag: the bond tag to assign to the generated bond\n"
)

Best regards
Koen

Revision history for this message
Best Vince Boros (v-boros) said :
#2

Hi Koen:

Yes, there appears to have been an oversight in providing the Python API for the 2D version of insertBond. The C++ function parameters are identical for 2D and 3D, so I have copied across the 3D wrapper code into MNTable2DPy.cc (changing the class name to MNTable2D), as you outlined. The new code is in the Bazaar repository now (r. 114).

Thank you for finding this.

Vince

Revision history for this message
Koen Torremans (koen-torremans) said :
#3

Thanks Vince Boros, that solved my question.

Revision history for this message
Koen Torremans (koen-torremans) said :
#4

Thanks Vince for the swift adaptations!

Koen