← Back to team overview

yade-users team mailing list archive

Re: [Question #683336]: Yade-OpenFoam-coupling delete the particles outside the fluid cells

 

Question #683336 on Yade changed:
https://answers.launchpad.net/yade/+question/683336

Deepak proposed the following answer:
Hello,

The simulation hangs because Yade  runs for 5000 timesteps and it exits
:

if __name__=="__main__":
    sim = simulation()
    sim.steprun()
    sim.irun(5000) #run 5000 iteration and wait ---> this line.
    fluidCoupling.killMPI()

You need to set the same end time for the yade part as well (0.05), you can
do it like this in the irun function :
  def irun(self,time):
      while (O.time <= time):
            O.step()

sim.irun(0.05)

or you can set the O.dt and the corresponding number of iterations.

We do not have the interactivity of Yade in the coupling, i,e. to run for
few timesteps, pause and inspect and change stuff..

Note : even after the simulation has finished running , there is a chance
of hanging, if you see the message "Finalising parallel run" it means
everything is okay.



On Sat, Sep 14, 2019 at 7:17 AM Anqi H <question683336@xxxxxxxxxxxxxxxxxxxxx>
wrote:

> Question #683336 on Yade changed:
> https://answers.launchpad.net/yade/+question/683336
>
> Anqi H posted a new comment:
> Hi Deepak,
>
> I have attached the script and the txt file that has the particle
> positions and radius. The original txt file has about 3900 particles,
> I've tried running with 20 particles and the program hangs at around the
> same timestep. I also added the code to reset the interaction radius,
> now the program hangs at 0.027s still with small courant number. Can you
> please help me have a look? Thank you.
>
> from __future__ import print_function
> import sys
> from yadeimport import *
> from yade.utils import *
> from yade import ymport
>
> 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):
>
>     O.periodic = True;
>
>     #proppant properties
>     FrictAng_p = 0.9
>     Density_p = 2650
>     Young_p = 100e6
>     TensileStr_p=3000
>     Cohesion_p=3000
>
>     proppant =
> JCFpmMat(type=2,young=Young_p,frictionAngle=FrictAng_p,density=Density_p,tensileStrength=TensileStr_p,cohesion=Cohesion_p,label='proppant')
>
>     O.materials.append(proppant)
>
>     proppant_assembly =
> O.bodies.append(ymport.textExt('prop.txt','x_y_z_r',shift=Vector3(0,0,0),scale=1,material=proppant,color=(1.00,0.67,0.50)))
>     print ('length of bodies proppant '+str(len(O.bodies)))
>
>     for b in proppant_assembly:
>       O.bodies[b].groupMask=2
>       O.bodies[b].dynamic = False
>       O.bodies[b].state.vel=(0, 0, 0)
>       if O.bodies[b].state.pos[0] < 0:
>         print("found it ")
>         O.bodies.erase(b)
>
>     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 ,0.0, 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.engines=[
>   ForceResetter(),
>   InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.2,
> label="bols"),Bo1_Facet_Aabb()], allowBiggerThanPeriod=True),
>   InteractionLoop(
>     [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.2,
> label="ig2s"),Ig2_Facet_Sphere_ScGeom()],
>     [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1)],
>
> [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,label='lawFunctor')]
>   ),
>   GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.7, label = "ts"),
>         fluidCoupling, #to be called after timestepper
>         PyRunner(command='sim.printMessage()', iterPeriod= 1000,
> label='outputMessage'),
>   newton,
>         VTKRecorder(fileName='yadep/3d-vtk-',mask =
> 2,recorders=['spheres','colors'],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 steprun(self):
>     O.step()
>     bols.aabbEnlargeFactor = 1
>     ig2s.interactionDetectionFactor = 1
>     print('-------------------reset aabbEnlargeFactor------------------')
>
>   def irun(self,num):
>       O.run(num,1)
>
>
> if __name__=="__main__":
>     sim = simulation()
>     sim.steprun()
>     sim.irun(5000) #run 5000 iteration and wait
>     fluidCoupling.killMPI()
>
> import builtins
> builtins.sim=sim
>
> prop.txt:
> 0.00852590934236 0.0153639385798 0.00176255575986 0.000217761439712
> 0.00764955868029 0.0152116159226 0.00436816482926 0.000217732009598
> 0.00560124234128 0.0151519211654 0.00842422207547 0.000217290557888
> 0.0063453810585 0.0151831422756 0.00480549526363 0.000216584235153
> 0.00960891441177 0.0149854671521 0.00879075377879 0.000216554805039
> 0.00483649588532 0.0153771873566 0.00930391144151 0.000216525374925
> 0.00842596919234 0.0153067625031 0.00235637778066 0.000216407654469
> 0.0040183447717 0.0152218324011 0.00854134696363 0.000216319364127
> 0.00730305871618 0.0150765919403 0.00722600431368 0.000216113353329
> 0.00601879303512 0.0150916069316 0.00798938563763 0.000215730761848
> 0.00963465709772 0.0149722137776 0.00959788700642 0.000215642471506
> 0.00678080489014 0.015448409339 0.00425480343164 0.000215407030594
> 0.00245574035206 0.015231337524 0.0095993867908 0.000215201019796
> 0.00647161027674 0.0151548077837 0.00635258123028 0.000215142159568
> 0.00809997911319 0.0149366515564 0.00924837631883 0.000214406406719
> 0.00225750713248 0.0153179180278 0.00995450815658 0.000214347546491
> 0.0082797736993 0.0151490590369 0.00890198988867 0.000213788374325
> 0.00776231509244 0.0151470998716 0.00874378437775 0.000213758944211
> 0.00905245969947 0.0151690471826 0.00509795120937 0.000213435212957
> 0.00240727047207 0.0152602638837 0.00837260770547 0.000213170341932
> 0.00397163696595 0.0152952188157 0.00621218690826 0.00021293490102
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

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