Yade simulation freezes

Asked by Daria

I'm running YADE-OpenFOAM coupling examples. And the simulation freezes at some time (in the middle of calculations) during the yade iteration. How can I view log of yade (better log to screen) of current iteration to understand why the calculation breaks down. There is also more general question: how to make simulation run stable?
Also the calculation never finishes by itself: it always freezes at "Finalising parallel run". So I need to kill it.

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Deepak (deepak-kn1990) said :
#1

Hello,

Can you provide the following information :

 - the scripts you are runing.
 - version of yade you are using.
 - the openfoam solver you are using, (note the pimpleFoamYade solver requires some fixes)

Have you made sure that the simulation end time is the same in Yade and Openfoam ? ( if not one of them will be hanging).

Thanks,

Revision history for this message
Daria (romanovadi) said :
#2

- Yade version: 2020-02-02.git-472f4cb
- I'm running icoFoamYade
- Is there way to attach files or archive with my case to this question or it is better to copy files content here?

I have got problem to set the same simulation end time in Yade and OpenFOAM:
in OpenFOAM I set stopAt endTime (it is virtual time in YADE termins) and set a writeInterval (writeControl adjustableRunTime);
in YADE I set in VTKRecorder virtPeriod at the same as writeInterval and set run(100000) with dynamical time step (I think it is dynamical because otherwise I tried to set O.dt and O.dynDt=False and my calculation stopped unexpectedly)

Revision history for this message
Daria (romanovadi) said :
#3

I want to note that one calculation falls down at different times every run, but these times are similar.

Revision history for this message
Deepak (deepak-kn1990) said :
#4

Okay, this seems because of the mismatch in the simulation endtimes, you can post (copy paste) your yade script and the openfoam controlDict file and I can suggest how to fix it.

Can you be precise about the stability issue you are facing ?

Revision history for this message
Daria (romanovadi) said :
#5

scriptYade.py:

from __future__ import print_function
import sys
from yadeimport import *
from yade.utils import *

initMPI() #Initialize the mpi environment, always required.
fluidCoupling = yade.FoamCoupling(); #Initialize the engine
fluidCoupling.getRank(); #part of Initialization.

#example of spheres in shear flow : two-way point force coupling
class simulation():

 def __init__(self):
  epsilon = 1e-08
  minval = epsilon
  maxval = 1-epsilon
  length = maxval - minval
  halflength = length / 2
  radius = 0.01
  radiusEpsilon = 0.001

# O.periodic = True
# O.cell.setBox(maxval, maxval, maxval)

  numspheres=1000
  young = 1e6#ice#5e6#1
  poisson = 0.2#0.4
  density = 1000

  O.materials.append(FrictMat(young=young,poisson=poisson,frictionAngle=radians(15),density=density,label='spheremat'))
  O.materials.append(FrictMat(young=200e9,poisson=0.001,frictionAngle=0,density=0,label='wallmat'))

  #wall coords, use facets for wall BC:
  v0 = Vector3(minval,minval,minval)
  v1 = Vector3(minval,minval,maxval)
  v2 = Vector3(maxval,minval,minval)
  v3 = Vector3(maxval,minval,maxval)

  v4 = Vector3(minval,maxval,minval)
  v5 = Vector3(minval,maxval,maxval)
  v6 = Vector3(maxval,maxval,minval)
  v7 = Vector3(maxval,maxval,maxval)

  df0 = facet([v0,v1,v2],material='wallmat')
  O.bodies.append(df0)
  df1 = facet([v1,v3,v2],material='wallmat')
  O.bodies.append(df1)

  uf0 = facet([v4,v5,v6],material='wallmat')
  O.bodies.append(uf0)
  uf1 = facet([v5,v7,v6],material='wallmat')
  O.bodies.append(uf1)

  lf0 = facet([v0,v1,v5],material='wallmat')
  O.bodies.append(lf0)
  lf1 = facet([v1,v5,v4],material='wallmat')
  O.bodies.append(lf1)

  rf0 = facet([v2,v3,v7],material='wallmat')
  O.bodies.append(rf0)
  rf1 = facet([v2,v7,v6],material='wallmat')
  O.bodies.append(rf1)

  ff0 = facet([v1,v5,v4],material='wallmat')
  O.bodies.append(ff0)
  ff1 = facet([v5,v7,v4],material='wallmat')
  O.bodies.append(ff1)

  bf0 = facet([v0,v4,v2],material='wallmat')
  O.bodies.append(bf0)
  bf1 = facet([v4,v6,v2],material='wallmat')
  O.bodies.append(bf1)

  #spheres
  mn, mx= Vector3(minval+2*radius, minval+2*radius, minval+2*radius), Vector3(maxval-2*radius, maxval-2*radius, maxval-2*radius)

  sp = pack.SpherePack()
  sp.makeCloud(mn,mx,rMean=radius,rRelFuzz=radiusEpsilon, num=numspheres)
  O.bodies.append([sphere(center,rad,material='spheremat') for center,rad in sp])

  sphereIDs = [b.id for b in O.bodies if type(b.shape)==Sphere]

  #coupling engine settings

  fluidCoupling.setNumParticles(len(sphereIDs))
  fluidCoupling.setIdList(sphereIDs)
  fluidCoupling.isGaussianInterp=False #use pimpleFoamYade for gaussianInterp

  # Integrator
  newton=NewtonIntegrator(damping=0.0, gravity = (0.0 ,-1.81, 0.0))
  # add small damping in case of stability issues.. ~ 0.1 max, also note : If gravity is needed, set it in constant/g dir.

# O.dt=1e-5
# O.dynDt=False

  O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()], allowBiggerThanPeriod=True),
   InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
    [Ip2_FrictMat_FrictMat_FrictPhys()],
    [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.5, label = "ts"),
      fluidCoupling, #to be called after timestepper
      PyRunner(command='sim.printMessage()', iterPeriod= 1, label='outputMessage'),
   newton,
      VTKRecorder(fileName='yadep/3d-vtk-',recorders=['spheres'],virtPeriod=0.02)#iterPeriod=1000)
  ]

 def printMessage(self):
  print("********************************YADE-ITER = " + str(O.iter) +" **********************************")
# if O.iter == 4000:
# maxVel = 0.05
# for b in O.bodies:
# if type(b.shape)==Sphere:
# bodyVel = abs(b.state.vel.norm())
# if bodyVel > maxVel:
# raise ValueError("Body velocity exceeds imposed shear velocity by ", abs(bodyVel-maxVel))

 def irun(self,num):
  O.run(num,1)

if __name__=="__main__":
 sim = simulation()
 sim.irun(100000)
 # print("body id = ", O.bodies[34].id)
 fluidCoupling.killMPI()

import builtins
builtins.sim=sim

Revision history for this message
Daria (romanovadi) said :
#6

controlDict:

FoamFile
{
    version 2.0;
    format ascii;
    class dictionary;
    location "system";
    object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application icoFoamYade;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1;

deltaT 1e-3;

writeControl adjustableRunTime;//timeStep;

writeInterval 0.02;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression on;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

Revision history for this message
Deepak (deepak-kn1990) said :
#7

the endTime in controlDict is 1.0; this has tho be the same in your yade script:

what you can modify the function irun(self):

 def irun(self,endTime):
  if (O.time <= endTime):
     O.step()

and calling it as :

sim.irun(1)

Revision history for this message
Daria (romanovadi) said :
#8

The case freezes without taking a single YADE step =(

A have got one more question:
I commented lines
# O.periodic = True
# O.cell.setBox(maxval, maxval, maxval)
to make my boundaries solid (I want particles just to fall down in box) but despite this particles start to appear at top of the box...
Some times they also starts to move randomly in such a way that you can't understand in which direction each of them is moving and why.

Revision history for this message
Deepak (deepak-kn1990) said :
#9

I see,
for the hanging porblem, you can set a constant dt, O.dt = 1e-05, and use sim.irun(100000), (with the original sim.irun) function, also comment on the GlobalStiffnessTimeStepper.

Are the same boundary conditions set in OpenFOAM too, that is you have set walls with no slip boundary condition, (the default case is periodic)?
Can you share the blockMeshDict files, files in 0, system and constant directory?

Revision history for this message
Daria (romanovadi) said :
#10

https://github.com/RomanovaDI/snowModelling/wiki

There is my case of modeling of the snowdrift formation. It is assumed that snow will accumulate in the corner on the right because of wind and gravity. But in fact it just falls down through bottom. There is periodic condition set in YADE script and if I turns it off calculation drops. Can you help me to set up this case in a way I described (snow is accumulating in the angle at right side because of wind and gravity)?

Also I would like to run YADE part of this case in the separate way. I'm doing it using runYade.sh script which is represented in git repository after commenting fluid coupling engine in scriptYade.py; but it shows a lot of errors. How should I modify scriptYade.py to run it using YADE without OpenFOAM coupling?

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

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

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#12

> I'm doing it using runYade.sh script which is represented in git repository after commenting fluid coupling engine in scriptYade.py; but it shows a lot of errors. How should I modify scriptYade.py to run it using YADE without OpenFOAM coupling?

I think this paragraph is sufficient to explain why the discussion was abandoned.
https://www.yade-dem.org/wiki/Howtoask

Bruno

Revision history for this message
Daria (romanovadi) said :
#13

Case was updated on github. It is now working fine also some instructions were added. YADE case without CFD was added.

Revision history for this message
Daria (romanovadi) said :
#14

>I think this paragraph is sufficient to explain why the discussion was abandoned.
>https://www.yade-dem.org/wiki/Howtoask

It's inefficient to copy the contents of all case files here

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#15

> Case was updated on github. It is now working fine also some instructions were added. YADE case without CFD was added.

Any link to those things?

> inefficient to copy the contents of all case files here

Sure, but "it shows a lot of errors", unspecified, usually discourage further response.

Bruno

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#16

Next time if question is answered please mark it answered and provide link to actual solution if it doesn't appear here.
That thread is cryptic.
Cheers
B

Revision history for this message
Daria (romanovadi) said :
#17

There is problems with time settings in example_icoFoamYade again. The same problem is in example_pimpleFoamYade. The last doesn't work at all (I downloaded it from gitlab and started it using instruction, but it freezed after words "Finalising parallel run").
example_icoFoamYade worked till I tried to set more time to calculate, after it calculation freedzes too. Can you explain me how to set end time in example_icoFoam to 1 second for example.

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

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