Question #683336 on Yade changed: https://answers.launchpad.net/yade/+question/683336
Anqi H posted a new comment: Hi Deepak, thank you for your message. I'm not too sure how to put the pyrunner before the fluidcoupling engine, I was also wondering how to reset the aabbEnlargeFactor after the first iteration. When I was working with just Yade, I reset this parameter after O.step and then use the gui to run the rest of the simulation. This is my yade script 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('new_prop.txt','x_y_z_r',shift=Vector3(0,0,0),scale=1,material=proppant,color=(1.00,0.67,0.50))) for b in proppant_assembly: if O.bodies[b].state.pos[0] < 0: O.bodies.erase(b) sphereIDs = [b.id for b in O.bodies if type(b.shape)==Sphere and b.material.label=='proppant'] #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, #PyRunner(command='sim.deletePar()',iterPeriod=50, label='checkPar'), VTKRecorder(fileName='yadep/3d-vtk-',recorders=['spheres','colors'],iterPeriod=1000) ] if O.iter>1: bo1s.aabbEnlargeFactor = 1 ig2s.interactionDetectionFactor = 1 print('-------------------reset aabbEnlargeFactor------------------') 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 deletePar(self): print("******YADE-ITER = " + str(O.iter) +" **********") for b in proppant_assembly: if O.bodies[b].state.pos[0]>0.02: print('delete id '+str(b)) O.bodies.erase(b) fluidCoupling.setNumParticles(len(sphereIDs)) fluidCoupling.setIdList(sphereIDs) def irun(self,num): O.run(num,1) if __name__=="__main__": sim = simulation() sim.irun(5000) # print("body id = ", O.bodies[34].id) fluidCoupling.killMPI() import builtins builtins.sim=sim proppant.txt 0.00643783930395 0.0153571235196 0.00996462421737 0.000296398704259 0.0063978094014 0.0151208968385 0.00923970556825 0.000295898392322 0.00806594949045 0.0152558278563 0.00630458365066 0.00029536865027 0.00773116324663 0.0151764265584 0.0076636891438 0.000295015488902 0.00896207660218 0.0153221567143 0.0091664883318 0.000294397456509 -- 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@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp