Miscillaneous functions that are not believed to be generally usable, therefore kept in my “private” module here.
They comprise notably oofem export and various CPM-related functions.
Return spatially weigted gaussian average of arbitrary quantity defined on interactions.
At construction time, all real interactions are put inside spatial grid, permitting fast search for points in neighbourhood defined by distance.
Parameters for the distribution are standard deviation and relative cutoff distance
relThreshold (3 by default) which will discard points farther than relThreshold
.
Given central point , points are weighted by gaussian function
To get the averaged value, simply call the instance, passing central point and callable object which received interaction object and returns the desired quantity:
>>> O.reset() >>> from yade import utils >>> O.bodies.append([utils.sphere((0,0,0),1),utils.sphere((0,0,1.9),1)]) [0, 1] >>> O.engines=[InteractionLoop([Ig2_Sphere_Sphere_Dem3DofGeom(),],[Ip2_FrictMat_FrictMat_FrictPhys()],[])] >>> utils.createInteraction(0,1) <Interaction instance at 0x...>>> is3d=IntrSmooth3d(0.003) >> is3d((0,0,0),lambda i: i.phys.normalForce) Vector3(0,0,0)
Estimate Poisson’s ration given the “principal” axis of straining. For every base direction, homogenized strain is computed (slope in linear regression on discrete function particle coordinate → → particle displacement in the same direction as returned by utils.coordsAndDisplacements) and, (if axis ‘0’ is the strained axis) the poisson’s ratio is given as -½(ε₁+ε₂)/ε₀.
Young’s modulus is computed as σ/ε₀; if stress σ is not given (default 0), the result is 0.
cutoff, if > 0., will take only smaller part (centered) or the specimen into account
Use summed stored energy in contacts to compute macroscopic stress over the same volume, provided known strain.
Export simulation data in text format
The format is line-oriented as follows:
E G # elastic material parameters
epsCrackOnset relDuctility xiShear transStrainCoeff # tensile parameters; epsFr=epsCrackOnset*relDuctility
cohesionT tanPhi # shear parameters
number_of_spheres number_of_links
id x y z r boundary # spheres; boundary: -1 negative, 0 none, 1 positive
…
id1 id2 cp_x cp_y cp_z A # interactions; cp = contact point; A = cross-section
Locate all real interactions in 2d plane (reduced by spiral projection from 3d, using Shop::spiralProject, which is the same as utils.spiralProject) using their contact points.
Note
Do not run simulation while using this object.
Parameters: |
|
---|
See utils.spiralProject.
Return upper corner of the rectangle containing all interactions.
Return list of interaction objects that are not further from pt2d than radius in the projection plane
Return lower corner of the rectangle containing all interactions.
Compute macroscopic stress around given point; the interaction ( and
are rotated to the projection plane by
(as given by utils.spiralProject) first, but no skew is applied). The formula used is
where the sum is taken over volume containing interactions
between spheres
and
;
Additionally, computes average of CpmPhys.omega () and CpmPhys.kappaD (
). N is the number of interactions in the volume given.
Returns: | tuple of (N, ![]() ![]() ![]() |
---|
Locate all (real) interactions in space by their contact point. When constructed, all real interactions are spatially indexed (uses vtkPointLocator internally). Use instance methods to use those data.
Note
Data might become inconsistent with real simulation state if simulation is being run between creation of this object and spatial queries.
Return coordinates of lower and uppoer corner of axis-aligned abounding box of all interactions
Number of interactions held
Return list of real interactions that are not further than maxDist from point.
Return tuple of averaged stress tensor (as Matrix3), average omega and average kappa values. forceVolume can be used (if positive) rather than the sphere (with maxDist radius) volume for the computation. (This is useful if point and maxDist encompass empty space that you want to avoid.)