Something wrong with loading application of the surface coupling of FEM/DEM

Asked by De zhang on 2019-07-01

I want to add load on the assign nodes in FEM during the coupling of FEM/DEM, but something was wrong by the procedure with the error prompt as following:
------------------------------------------------------------
Error:(/home/.../oofemlib/domain.C:353)
In Domain::giveload, number : 1:
cannot cast boundary condition 1 to Load class
------------------------------------------------------------
Part of my script was as following:
############
import liboofem

def readUnvFile111(fName):
...
## read the mesh file of UNV and get the nodes
global Nodes4unv,Elems4unv111
Nodes4unv,Elems4unv111 = readUnvFile111('/tmp/membrane3Dtr12.unv')
##
class Node:
 def __init__(self,id,coords):
  self.id = id
  self.coords = list(coords)
  self.bcs = [0,0,0]
 def toOofem(self):
  kw = dict(coords=self.coords)
  if any(self.bcs):
   kw["bc"] = self.bcs
  return liboofem.node(self.id,domain,**kw)

def createOofemNodes():
 nodes = [Node(-1,tuple(nodexyz)) for _, (nodexyz) in enumerate(Nodes4unv)]
 for i,n in enumerate(nodes):
  n.id = i+1
  if n.coords[2] == 0.17:
   n.bcs = [1,1,1]
  elif n.coords[2] == 0.72:
   n.bcs = [1,1,1]
 return [n.toOofem() for n in nodes]
##
class Shell4tr:
 def __init__(self,id,nodes):
  self.id = id
  self.nodes = list(nodes)
 def toOofem(self):
  return liboofem.element("LTRSpace",self.id, domain, nodes=self.nodes, mat=1, crossSect=1, nlgeo=1)

def createOofemElems():
 elems = []
 #for _, (NumId41) in enumerate(Elems4unv41):
  #elems.append(Shell3tr(-1,(NumId41)))
 for _, (NumId111) in enumerate(Elems4unv111):
  elems.append(Shell4tr(-1,(NumId111)))
 for i,e in enumerate(elems):
  e.id = i+1
 return [e.toOofem() for e in elems]
### all above was get the mesh information from unv and built the geom of object in fem

def sortNodes():
 fxpNodes = []
 fxnNodes = []
 fypNodes = []
 fynNodes = []
 for i in xrange(domain.giveNumberOfDofManagers()):
  a = domain.giveDofManager(i+1).giveCoordinates()
  c = [a[j] for j in xrange(3)]
  if abs(c[0]-0.04)<0.006:
   fxpNodes.append(i+1)
  if abs(c[0]-0.36)<0.006:
   fxnNodes.append(i+1)
  if abs(c[1]-0.04)<0.006:
   fypNodes.append(i+1)
  if abs(c[1]-0.36)<0.006:
   fynNodes.append(i+1)
 return fxpNodes,fxnNodes,fypNodes,fynNodes

## above I sort the parts of nodes for loading

def loadmembrane():
 loadxp = liboofem.FloatArray()
 loadxp.resize(3)
 loadxp.zero()
 loadxp[0] = 3 #x=0.045 & 0.035
 loadxn = liboofem.FloatArray()
 loadxn.resize(3)
 loadxn.zero()
 loadxn[0] = -3 #x=0.355 & 0.365
 loadyp = liboofem.FloatArray()
 loadyp.resize(3)
 loadyp.zero()
 loadyp[1] = 3 #x=0.045 & 0.035
 loadyn = liboofem.FloatArray()
 loadyn.resize(3)
 loadyn.zero()
 loadyn[1] = -3 #x=0.355 & 0.365
 for ixp in fxpNodes:
  lxp = domain.giveLoad(ixp)
  axp = lxp.giveComponentArray()
  axp.add(loadxp)
  lxp.setComponentArray(axp)
 for ixn in fxnNodes:
  lxn = domain.giveLoad(ixn)
  axn = lxn.giveComponentArray()
  axn.add(loadxn)
  lxn.setComponentArray(axn)
 for iyp in fypNodes:
  lyp = domain.giveLoad(iyp)
  ayp = lyp.giveComponentArray()
  ayp.add(loadyp)
  lyp.setComponentArray(ayp)
 for iyn in fynNodes:
  lyn = domain.giveLoad(iyn)
  ayn = lyn.giveComponentArray()
  ayn.add(loadyn)
  lyn.setComponentArray(ayn)

###and I apply the load on these nodes

############################################################
# engngModel
problem = liboofem.engngModel("nldeidynamic",1,nSteps=5,dumpCoef=.1,deltaT=10000,outFile="/tmp/membrane_oofem.out")

# domain
domain = liboofem.domain(1, 1, problem, liboofem.domainType._3dMode, tstep_step=10000, dofman_all=True, element_all=True)
problem.setDomain(1, domain, True)

# vtkxml
vtkxmlModule = liboofem.vtkxml(1,problem,tstep_step=10000,vars=[1,6],primvars=[1,4])
#vtkxmlModule = liboofem.vtkxml(1,problem,tstep_step=10000)
exportModuleManager = problem.giveExportModuleManager()
exportModuleManager.resizeModules(1)
exportModuleManager.setModule(1,vtkxmlModule)

# boundary condition and time function
ltf = liboofem.loadTimeFunction("constantFunction",1,f_t=0)
bc = liboofem.boundaryCondition(1, domain, loadTimeFunction=1, prescribedValue=0.0)

# nodes
nodes = createOofemNodes()

# material and cross section
mat = liboofem.isoLE(1, domain, d=1200, E=1.2e7, n=0.48, tAlpha=0)
cs = liboofem.simpleCS(1, domain,)

# elements
elems = createOofemElems()

# add eveything to domain (resize container first)
domain.resizeDofManagers(len(nodes))
for n in nodes:
 domain.setDofManager(n.number, n)
domain.resizeElements(len(elems))
for e in elems:
 domain.setElement(e.number, e)
domain.resizeMaterials(1)
domain.setMaterial(1, mat)
domain.resizeCrossSectionModels(1)
domain.setCrossSection(1, cs)
domain.resizeBoundaryConditions(1)
domain.setBoundaryCondition(bc.number, bc)
domain.resizeFunctions(1)
domain.setFunction(ltf.number, ltf)

vtkxmlModule.initialize() # (!)

fxpNodes,fxnNodes,fypNodes,fynNodes = sortNodes()
loadmembrane()

#####
so did something wrong with the boundary or loading ?

Best regards,

Dez

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2019-07-01
Last reply:
2019-07-02

> Error:(/home/.../oofemlib/domain.C:353)

That is an error in oofem while this is a yade forum.
Even if you may be lucky here still it doesn't seem to be the right place, since the oofem coupling is a project on its own until now.
Bruno

Can you help with this problem?

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

To post a message you must log in.