Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Open => Answered Raphaël Maurin proposed the following answer: Hi, Funny script, I like it =) The problem is in the order of the engine. HydroForceEngine should be before NewtonIntegrator, otherwise the buoyancy force is not taken into account in the DEM resolution at the time step considered, and ForceResetter() will erase the force before beginning the resolution of the next time step so that the force added is never taken into account. It should work if you try a loop like that: O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider'), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()], ), #HydroForceEngine(densFluid=rau_wat,ids=spids,lift=True), HydroForceEngine(densFluid = 1024,viscoDyn = 1e-3,zRef = -D_wat,deltaZ = 0.1,nCell = 20,vxFluid=numpy.zeros(20),phiPart = numpy.zeros(20),vFluctX = np.zeros(len(spids)),vFluctZ = np.zeros(len(spids)),ids = spids ), NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(0,0,-9.81)), TranslationEngine(translationAxis=[1,0,0],velocity=5.0,ids=[id.id for id in strut]) ] I don't know what is exactly doing TranslationEngine but it is also maybe better to put it before NewtonIntegrator. It seems that there is also a problem in the way you collect the particles's ID as not all the particles are submitted to buoyancy. Some comments on your script: - The young modulus you impose leads to very high contact stiffness for DEM simulation. This impact directly the computational time. It is usually possible to soften artificially the stiffness (so the young modulus) without modifying the results if you stay in the rigid grain limit. The rigid grain limit corresponds to the limit for which the deformation/overlap of the spheres stay negligible with respect to the particle diameters. For dense granular media, it has been related to the maximum pressure undergone by the particles [1][2], and can be evaluated before computation. For any other situation, the game is to see if a reduction of the stiffness modify the results or not. This will allow you to gain a lot of computational time. - You are using PWaveTimeStep() for the time step determination, consider using GlobalStiffnessTimeStepper(), itcan make you gain computational time. - You are considering a dynamical situation with a contact law more adapted to quasi static ones. If you want a more realistic dynamical behavior with dissipation at contact characterized by a restitution coefficient, have a look at the Law2_ScGeom_ViscElPhys_Basic. - Walls made of facets might have some unwanted behavior if the particles are hitting the joint between two facets, I prefere using "box" to build walls and avoid these problems. - When you define a material, it is safer to label it with a name, e.g. O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=980., label='Mat1')), and specify the material when you are creating the bodies, with e.g. sp.toSimulation(material = 'Mat1'). (I don't know how to do with facet box but this should be similar. ) This allows you to define different materials and make you sure you are using the material you want for this specific body. Regards Raphaël [1] section 4, p.4 of: N Roux and G. Combe. Quasistatic rheology and the origins of strain. Comptes Rendus Physique, 3(2):131 – 140, 2002 [2] section IV, p.4-5 of: F. da Cruz, S. Emam, M. Prochnow, J-N. Roux, and F. Chevoir. Rheophysics of dense granular materials: Discrete simulation of plane shear flows. Phys.Rev. E, 72:021309, 2005. -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Answered => Open huisky is still having a problem: well, ok. i'm trying to simulate a ship colliding with many floating boxes. Here is a simple codes to start with, maybe you can see something strange? # from yade import pack,geom import numpy as np # build the tank walls L_tank = 40. W_tank = 10. H_tank = 5. D_wat = 2. # box data L_box = 30. rau_box= 980. rau_wat= 1024. h_box = 0.20 sub_h =rau_box/rau_wat*h_box rMean = .10 # mean particle radius porosity = 0.85 # porosity #Add material O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=980.)) kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0} kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0} # form the tank wall with the top open O.bodies.append(geom.facetBox((L_box-L_tank*.5,0,H_tank*.5-D_wat),(.5*L_tank,.5*W_tank,.5*H_tank),wallMask=31)) # add structure L_strut = 3.0 W_strut = 1.0 H_strut = 0.5 D_strut = 0.35 oriBody = Quaternion(Vector3(0,0,1),(pi)) strut = geom.facetBox((-L_strut*.5-rMean,0,H_strut*.5-D_strut),(.5*L_strut,.5*W_strut,.5*H_strut),oriBody,**kwBoxes) O.bodies.append(strut) # pack box particles sp = pack.SpherePack() sp.makeCloud((0,-W_tank*.5,-sub_h),(L_box,W_tank*.5,h_box),rMean=rMean,porosity=porosity) # build the box cloud initially and move it to position # all sphere ids spids = sp.getClumps()[0] #afterwards sp.toSimulation() # define engies O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider'), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()], ), NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(0,0,-9.81)), TranslationEngine(translationAxis=[1,0,0],velocity=5.0,ids=[id.id for id in strut]), #HydroForceEngine(densFluid=rau_wat,ids=spids,lift=True), HydroForceEngine(densFluid = 1024,viscoDyn = 1e-3,zRef = -D_wat,deltaZ = 0.1,nCell = 20,vxFluid=numpy.zeros(20),phiPart = numpy.zeros(20),vFluctX = np.zeros(len(spids)),vFluctZ = np.zeros(len(spids)),ids = spids ) ] O.dt =PWaveTimeStep() O.run(1,True) # visulize the model try: from yade import qt qt.Controller() qt.View() except ImportError: pass Regards Liu -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Open => Answered Raphaël Maurin proposed the following answer: Hi, The fact it is negative should not be a problem if zRef is set to its correct value. Can you provide a small example script of what you are simulating ? Raphaël -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Answered => Open huisky is still having a problem: Hi again, Thanks for the reply firstly. 1. say i have following engine, will the mesh from -2.0 to 0.0 since my origin locates at the freesurface? however i still see all spheres drop down to bottom. HydroForceEngine(densFluid = 1024,viscoDyn = 1e-3,zRef = -D_wat,deltaZ = 0.1,nCell = 20,vxFluid=numpy.zeros(20),phiPart = numpy.zeros(20),vFluctX = np.zeros(len(spids)),vFluctZ = np.zeros(len(spids)),ids = spids ) Regards Liu -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Open => Answered Raphaël Maurin proposed the following answer: Hi, 1. When I am talking about fluid mesh, it is a regular wall-normal fluid mesh defined by the number of cell nCell, and the width of the cell deltaZ. A typical definition of HydroForceEngine to apply only buoyancy would be : HydroForceEngine(densFluid = 1000,viscoDyn = 1e-3,zRef = 0.0,deltaZ = 0.1,nCell = 10,vxFluid=numpy.zeros(nCell),phiPart = numpy.zeros(nCell),vFluctX = np.zeros(len(O.bodies)),vFluctZ = np.zeros(len(O.bodies)),ids = idApplyForce ) This will apply buoyancy to the particles contained in the idApplyForce list, and of z component between zRef= 0. and nCell*deltaZ = 1 m. I entered the density and viscosity of water, but it can be modified obviously (viscosity will not influence the buoyancy, it is defined for drag) 2. Yes 3. Ok, I agree with you, and then it is maybe better (faster) to create an engine applying the buoyancy only directly, or to make the drag application optional. 4. No Raphaël -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Answered => Open huisky is still having a problem: thanks for the clarifications. however i'm still not able to achieve it. is it possible for you to provide a simple example file demonstrating the usage of hydroforceengine? here are my doubts: 1. how to define the fluid mesh as you suggested? 2. say if i want to modify the c++ code, do i have to recompile it then? 3. the number of particles are huge, so i've say the best is to use existing engines. 4. are there other engine can simulate buoyancy? Regards Liu -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Open => Answered Raphaël Maurin proposed the following answer: Hi >It obviously is not included in the current release of Yade, is it strange? I am actually not using at all the stable versions so I don't know if it is strange, but I commited that engine months ago. >well, i'm actually want to simulate the buoyancy of the sphere. however, it seems that all the spheres drop to the bottom anyway due to gravity It should be possible to simulate the buoyancy with hydroforce engine by putting the vxFluid to a vector full of zeros, and the mesh properties in order to fill the whole space. If you want the particle to have buoyancy applied only if it is under the water surface, just precise the fluid mesh from the ground to the water free surface wall normal position: h =nCell*dz. This will apply the buoyancy only if the center of the particle is inside the water. However it will not take into be modified if a part of the particle is outside the water. You can modify that in the C++ code if necessary. Depending on the number of particles that you are simulating, it might be easier for you to write a simple function in python using O.forces.addF(O.bodies[0].id,fb) which will apply the force fb (that you can evaluate easily) to the particle O.bodies[0] for example. >. By introducing the hydroforce engine, should the sphere be kind of floating >on the water surface if the density is >lower than the water density? If you have a buoyancy force, this should be the case > say if the sphere is only partly submerged, then the buoyancy should be only calculated from the submerged volume, isn't it? This should be the case but is not evaluated like that inside the HydroForceEngine. Hope it helps Raphael -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 huisky gave more information on the question: and what's more, i'm not sure how does the HydroForceEngine know the elevation of freesurface? say if the sphere is only partly submerged, then the buoyancy should be only calculated from the submerged volume, isn't it? -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Answered => Open huisky is still having a problem: Hei, by issuing help(HydroForceEngine) in Yade, I got following message: Welcome to Yade 1.07.0 TCP python prompt on localhost:9000, auth cookie `dcessy' XMLRPC info provider on http://localhost:21000 /usr/lib/python2.7/dist-packages/IPython/frontend.py:30: UserWarning: The top-level `frontend` package has been deprecated. All its subpackages have been moved to the top `IPython` level. warn("The top-level `frontend` package has been deprecated. " [[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for showing help), F10 both, F9 generator, F8 plot. ]] Yade [1]: help(HydroForceEngine) --- NameError Traceback (most recent call last) /usr/bin/yade in () > 1 help(HydroForceEngine) NameError: name 'HydroForceEngine' is not defined It obviously is not included in the current release of Yade, is it strange? I've tried to use Yadedaily and it works! well, i'm actually want to simulate the buoyancy of the sphere. however, it seems that all the spheres drop to the bottom anyway due to gravity. By introducing the hydroforce engine, should the sphere be kind of floating on the water surface if the density is lower than the water density? maybe there are something i'm still missing? O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider'), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()], ), NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(1e-2,1e-2,-10.)), TranslationEngine(translationAxis=[1,0,0],velocity=5.0,ids=[id.id for id in strut]), HydroForceEngine(densFluid=rau_wat), ] Regards Liu -- You received this question notification because you are a member of yade-users, which 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
Re: [Yade-users] [Question #269831]: HydroForceEngine not defined?
Question #269831 on Yade changed: https://answers.launchpad.net/yade/+question/269831 Status: Open => Answered Raphaël Maurin proposed the following answer: Hi, I think HydroforceEngine should be defined for your Yade version. If you want to be sure it is defined, try to type help(HydroForceEngine) in Yade. If it prints something it is defined. Otherwise use the latest yadedaily and it will be ok. However, I don't know what you want to simulate, but with your formulation it will not work. You need to precise all the different arguments of the engine (see the documentation https://yade- dem.org/doc/yade.wrapper.html?highlight=hydroforceengine#yade.wrapper.HydroForceEngine ). I designed this function to couple Yade with a 1D fluid resolution (v_x^f(z)) so that it mights look a bit particular at some points. It therefore requires to precise the fluid profile (vxFluid) and the position (zref) of the regular fluid mesh described by deltaZ and nCell. There is also a Discrete Random Walk fluctuation model included to account for the fluid velocity fluctuations, which is based on the Reynolds stress tensor (which comes from the fluid resolution). You can get rid of the fluctuation model by writing HydroForceEngine(vFluctX = numpy.zeros(len(O.bodies)), vFluctZ = numpy.zeros(len(O.bodies))) when declaring the engine. Don't hesitate if you have more questions. Raphaël -- You received this question notification because you are a member of yade-users, which 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
[Yade-users] [Question #269831]: HydroForceEngine not defined?
New question #269831 on Yade: https://answers.launchpad.net/yade/+question/269831 I'm using Yade (1.07.0-2-amd64) under Ubuntu system (14.04 LTS), why is keeping saying that the hydroforceengine is not defined? Is it included in the latest release of Yade? or we have to add it manually? Thanks in advance! error message """ HydroForceEngine(denseFluid=rau_wat), NameError: name 'HydroForceEngine' is not defined -- You received this question notification because you are a member of yade-users, which 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