Noimplementederror: run method needs to be implemented in derived class

Asked by guo

Dear all,
when i run example shearcell.py in windows using vs2010,

an error happened as "Notimplementederror:run method needs to be implemented in derived class".
and no results are outputted.

this is what happened in the vs command prompt:

-------------------------------------------------------------------------------------
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>f:

F:\>cd F:\Simluations\Esys-particle\tem

F:\Simluations\Esys-particle\tem>mpiexec -np 2 -machinefile hosts.txt mpipython.
exe shearcell.py
No SPAWN: CSubLatticeControler::initMPI()
No SPAWN: slave started at local/global rank 1639951114 / 1
[inf] circular x-size incompatible with range, adjusting...
[inf] New range=2.5

constructing fieldmaster for field e_kin
constructing fieldmaster for field postion
constructing fieldmaster for field force
Traceback(most recent call last):
file 'shearcell.py',line 198, in (module)
sim.run()
Notimplementederror:run method needs to be implemented in derived class
----------------------------------------------------------------------------------------------------------------------

the following is the input file, shearcell.py

#shearcell.py: An annular shear cell simulation using ESyS-Particle
# Author: D. Weatherley
# Date: 24 April 2011
# Organisation: ESSCC, The University of Queensland, Brisbane, AUSTRALIA
# (C) All rights reserved, 2011.
#
#
#import the appropriate ESyS-Particle modules:
#from esys.lsm import *
#from esys.lsm.util import *
#from esys.lsm.geometry import *
from FoundationPy import Vec3, BoundingBox
from LsmPy import *
from GeometryPy import *

from WallLoader import WallLoaderRunnable
from ServoWallLoader import ServoWallLoaderRunnable
#create a simulation container object:
# N.B. there must be at least two sub-divisions
# in the X-direction for periodic boundaries
sim = LsmMpi (numWorkerProcesses=1, mpiDimList=[1,1,1])
sim.initNeighbourSearch (
 particleType = "NRotSphere",
 gridSpacing = 2.5,
 verletDist = 0.5
 )
#specify the number of timesteps and timestep increment:
sim.setNumTimeSteps(100000)
sim.setTimeStepSize(0.001)
#enforce two-dimensional computations:
sim.force2dComputations (True)
#specify the spatial domain and direction of periodic boundaries:
domain = BoundingBox ( Vec3 (0,0,0), Vec3 (10,10,0) )
sim.setSpatialDomain (
 bBox = domain,
 circDimList = [True, False, False]
 )
#construct a rectangle of unbonded particles:
packer = RandomBoxPacker (
 minRadius = 0.1,
 maxRadius = 0.5,
 cubicPackRadius = 2.2,
 maxInsertFails = 1000,
 bBox = BoundingBox(
  Vec3(0.0, 0.0,0.0),
  Vec3(10.0, 10.0, 0.0)
 ),
 circDimList = [True, False, False],
 tolerance = 1.0e-5
)
packer.generate()
particleList = packer.getSimpleSphereCollection()
#tag particles along base and top of rectangle
#then add the particles to the simulation object:
for pp in particleList:
 centre = pp.getPosn()
 radius = pp.getRadius()
 Y = centre[1]
 if (Y < 1.0): # particle is near the base (tag=2)
  pp.setTag (2)
 elif (Y > 9.0): # particle is near the top (tag=3)
  pp.setTag (3)
 else: # particle is inside the shear cell (tag=1)
  pp.setTag (1)
 sim.createParticle(pp) # add the particle to the simulation object
#set the density of all particles:
sim.setParticleDensity (
 tag = 1,
 mask = -1,
 Density = 100.0
 )
sim.setParticleDensity (
 tag = 2,
 mask = -1,
 Density = 100.0
 )
sim.setParticleDensity (
 tag = 3,
 mask = -1,
 Density = 100.0
 )
#add driving walls above and below the particle assembly:
sim.createWall (
 name = "bottom_wall",
 posn = Vec3 (0,0,0),
 normal = Vec3 (0,1,0)
 )
sim.createWall (
 name = "top_wall",
 posn = Vec3 (0,10,0),
 normal = Vec3 (0,-1,0)
)
#unbonded particle-pairs undergo frictional interactions:
sim.createInteractionGroup (
 NRotFrictionPrms (
  name = "pp_friction",
  normalK = 1000.0,
  dynamicMu = 0.6,
  shearK = 100.0
 )
)
#particles near the base (tag=2) are bonded to the bottom wall:
sim.createInteractionGroup (
 NRotBondedWallPrms (
  name = "bwall_bonds",
  wallName = "bottom_wall",
  normalK = 1000.0,
  particleTag = 2
 )
)
#particles near the base (tag=3) are bonded to the top wall:
sim.createInteractionGroup (
 NRotBondedWallPrms (
  name = "twall_bonds",
  wallName = "top_wall",
  normalK = 1000.0,
  particleTag = 3
 )
)
#add local damping to avoid accumulating kinetic energy:
sim.createInteractionGroup (
 LinDampingPrms (
  name = "damping",
  viscosity = 1.0,
  maxIterations = 100
 )
)
#add ServoWallLoaderRunnables to apply constant normal stress:
servo_loader1 = ServoWallLoaderRunnable(
 LsmMpi = sim,
 interactionName = "twall_bonds",
 force = Vec3 (0.0, -1000.0, 0.0),
 startTime = 0,
 rampTime = 5000
 )
sim.addPreTimeStepRunnable (servo_loader1)
wall_loader1 = WallLoaderRunnable(
 LsmMpi = sim,
 wallName = "bottom_wall",
 vPlate = Vec3 (0.125, 0.0, 0.0),
 startTime = 30000,
 rampTime = 10000
 )
sim.addPreTimeStepRunnable (wall_loader1)
#add a FieldSaver to store total kinetic energy:
sim.createFieldSaver (
 ParticleScalarFieldSaverPrms(
  fieldName="e_kin",
  fileName="ekin.dat",
  fileFormat="SUM",
  beginTimeStep=0,
  endTimeStep=100000,
  timeStepIncr=1
 )
)
#add FieldSavers to store wall forces and positions:
posn_saver = WallVectorFieldSaverPrms(
 wallName=["bottom_wall", "top_wall"],
 fieldName="Position",
 fileName="out_Position.dat",
 fileFormat="RAW_SERIES",
 beginTimeStep=0,
 endTimeStep=100000,
 timeStepIncr=1
)
sim.createFieldSaver(posn_saver)
force_saver = WallVectorFieldSaverPrms(
 wallName=["bottom_wall", "top_wall"],
 fieldName="Force",
 fileName="out_Force.dat",
 fileFormat="RAW_SERIES",
 beginTimeStep=0,
 endTimeStep=100000,
 timeStepIncr=1
)
sim.createFieldSaver(force_saver)
#add a CheckPointer to store simulation data:
sim.createCheckPointer (
 CheckPointPrms (
  fileNamePrefix = "snapshot",
  beginTimeStep = 0,
  endTimeStep = 100000,
  timeStepIncr = 5000
 )
)

#sim.createCheckPointer (
# CheckPointPrms (
# fileNamePrefix = "bingle_data",
# beginTimeStep = 0,shearcell
# endTimeStep = 10000,
# timeStepIncr = 100
# )
#)

#execute the simulation:
sim.run()
#sim.exit()

can anyone help me fix this, many thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Feng Chen (fchen3-gmail) said :
#1

Hi, Guo:

I searched the string, the error happens in this line:

Python\esys\lsm\RunnablePy.cpp(38):

    void RunnablePy::defaultRun()
    {
      PyErr_SetString(
        PyExc_NotImplementedError,
        "run method needs to be implemented in derived class"
      );
      boost::python::throw_error_already_set();
    }

However I currently not sure what caused this problem, can anybody give some suggestions?

Feng

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

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

Hello Guo:

The only way on Linux that I could get RunnablePy::defaultRun() to execute (which generates the error message you have received) is to force RunnablePy::run() to call it. It seems to me, then, that in your case the overriding run method (ServoWallLoaderRunnable, WallLoaderRunnable) cannot be found. That is, the line "boost::python::override overrideMethod = this->get_override("run");" in RunnablePy::run() is unsuccessful, and this is what results in RunnablePy::defaultRun() being called:

    void RunnablePy::run()
    {
      boost::python::override overrideMethod = this->get_override("run");
      if (overrideMethod)
      {
        overrideMethod();
      }
      else
      {
        defaultRun();
      }
    }

    void RunnablePy::defaultRun()
    {
      PyErr_SetString(
        PyExc_NotImplementedError,
        "run method needs to be implemented in derived class"
      );
      boost::python::throw_error_already_set();
    }

Perhaps the Boost Community can shed some light on the problem as it appears on Windows. At this point I have no other suggestions.

Regards,

Vince

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

Wrong status previously selected

Can you help with this problem?

Provide an answer of your own, or ask guo for more information if necessary.

To post a message you must log in.