How to set periodic boundary?

Asked by Rahul R

Hi,
I want to simulate triaxial test on a cubical sample using the code given in the examples in Yade documentation (it uses PeriTriaxController). In the code, loose sample is generated and triaxial test is conducted without gravity deposition and densification. But I have already prepared a sample with certain dimensions and porosity through gravity deposition and compression-extension cycles. When I tried to import the particle cordinates (using ymport.txt() function) and run the code, error was shown stating that triaxial simulation works only on periodic boundaries. I tried to set periodic boundary in the code but showed the same error and sometimes crashes (I set 'periodic= True' in the ymport.txt() function and also added 'O.periodic= True' like in the code). I read the documentation but still don't understand how to set periodic boundaries if particle coordinates are imported into the code. From what I understood, periodic boundaries can be set only when packing is generated in the code. Is it possible to set periodic boundaries if the particle coordinates are imported? If not, is it possible to conduct triaxial test without periodic boundaries?

I also have noticed that triaxial simulations can also be conducted directly through GUI controller using the 'Generate' tab. There I didn't face any such issues I stated above. Is it possible to get the code they use in the GUI for the test?

Cheers, Rahul.

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Rahul R (rr-1998) said :
#1

Hi, please help me in this regard. This is urgent.

Also another information. I tried to set periodic boundaries in the GUI controller in 'Inspect' tab but then all the particles are found to club together to form a clump.

Revision history for this message
Jan Stránský (honzik) said :
#2

Hello,

> This is urgent.

do not ask urgent questions on Saturday..

If the problem is urgent (no matter what the day is), it is your responsibility to state the problem and question such that it is easy and quick to solve, i.e. read and follow [1].
- Provide the complete error message (point 2)
- Provide a MWE (point 3)
- Be specific wherever it makes sense

> using the code given in the examples in Yade documentation (it uses PeriTriaxController)

Please be more specific
Which examples?

> error ... stating ... triaxial simulation works only on periodic boundaries

Triaxial simulation does work for non-periodic boundaries [2].
Please provide full error message.

> I tried to set periodic boundary in the code

Please provide the code

> and sometimes crashes (I set 'periodic= True' in the ymport.txt() function

Yes, this should crash, as there is no ymport.txt function
If you meant ymport.text, there is no parameter "periodic".

> and also added 'O.periodic= True' like in the code.

What is "the code"?

> I read the documentation

What is "the documentation"?
Please be more specific.

Read also [1].

> but still don't understand how to set periodic boundaries if particle coordinates are imported into the code.

Exactly the same way as with no particles or generated particles or...

> From what I understood, periodic boundaries can be set only when packing is generated in the code.

Where / how did you get this understanding?
Periodic boundaries can be set independent of any packing.

> Is it possible to set periodic boundaries if the particle coordinates are imported?

Yes

> is it possible to conduct triaxial test without periodic boundaries?

Yes [2]

> I tried to set periodic boundaries in the GUI controller

It does not (should) not matter where you set the periodicity

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/examples/triax-tutorial/script-session1.py

Revision history for this message
Rahul R (rr-1998) said :
#3
Revision history for this message
Rahul R (rr-1998) said :
#4

>do not ask urgent questions on Saturday
I'm sorry

>Which examples?
https://gitlab.com/yade-dev/trunk/blob/master/doc/sphinx/tutorial/06-periodic-triaxial-test.py

>What is "the documentation"?
Yade documentation 3rd edition

>Please provide full error message.
This is the message: 'PeriTriaxController run on aperiodic simulation'

>Where / how did you get this understanding?
From examples with tutorials in Yade documentation. I checked in the section in the documentation for periodic boundaries but I'm not quite sure how it is used. In most of the examples, it was seen that 'periodic= True' is used inside makeCloud class. This made me think that periodic boundaries can be set only when particles are generated. I'm new to Yade and programming, so it is a bit difficult for me to understand how all function work even if I read Yade documentation but now I understood how to do it.

>Please provide the code

# encoding: utf-8

# periodic triaxial test simulation
#
# The initial packing is either
#
# 1. random cloud with uniform distribution, or
# 2. cloud with specified granulometry (radii and percentages), or
# 3. cloud of clumps, i.e. rigid aggregates of several particles
#
# The triaxial consists of 2 stages:
#
# 1. isotropic compaction, until sigmaIso is reached in all directions;
# this stage is ended by calling compactionFinished()
# 2. constant-strain deformation along the z-axis, while maintaining
# constant stress (sigmaIso) laterally; this stage is ended by calling
# triaxFinished()
#
# Controlling of strain and stresses is performed via PeriTriaxController,
# of which parameters determine type of control and also stability
# condition (maxUnbalanced) so that the packing is considered stabilized
# and the stage is done.
#

from __future__ import print_function
sigmaIso = -1e5

#import matplotlib
#matplotlib.use('Agg')

# generate loose packing
from yade import pack, qt, plot, ymport

O.periodic = True
sp= ymport.textExt('spheres',format='x_y_z_r',shift= Vector3(0,0,0), scale=1.0, color=(0,1,1))
spheres = O.bodies.append(sp)
# setup periodic boundary, insert the packing
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]),
        PeriTriaxController(
                label='triax',
                # specify target values and whether they are strains or stresses
                goal=(sigmaIso, sigmaIso, sigmaIso),
                stressMask=7,
                # type of servo-control
                dynCell=True,
                maxStrainRate=(10, 10, 10),
                # wait until the unbalanced force goes below this value
                maxUnbalanced=.1,
                relStressTol=1e-3,
                # call this function when goal is reached and the packing is stable
                doneHook='compactionFinished()'
        ),
        NewtonIntegrator(damping=.2),
        PyRunner(command='addPlotData()', iterPeriod=100),
]
O.dt = .5 * PWaveTimeStep()

def addPlotData():
 plot.addData(
         unbalanced=unbalancedForce(),
         i=O.iter,
         sxx=triax.stress[0],
         syy=triax.stress[1],
         szz=-(triax.stress[2]),
         exx=triax.strain[0],
         eyy=triax.strain[1],
         ezz=-(triax.strain[2]),
         # save all available energy data
         Etot=O.energy.total(),
         **O.energy
 )

# enable energy tracking in the code
O.trackEnergy = True

# define what to plot
plot.plots = {
        'ezz ': ('szz')
}
# show the plot
plot.plot()

def compactionFinished():
 # set the current cell configuration to be the reference one
 O.cell.trsf = Matrix3.Identity
 # change control type: keep constant confinement in x,y, 20% compression in z
 triax.goal = (sigmaIso, sigmaIso, -.2)
 triax.stressMask = 3
 # allow faster deformation along x,y to better maintain stresses
 triax.maxStrainRate = (1., 1., .1)
 # next time, call triaxFinished instead of compactionFinished
 triax.doneHook = 'triaxFinished()'
 # do not wait for stabilization before calling triaxFinished
 triax.maxUnbalanced = 10

def triaxFinished():
 print('Finished')
 O.pause()

As I stated before, when I set periodic boundaries, all the particles are found to club together to form a clump. This is what the pack looks like when viewed in GUI: https://drive.google.com/file/d/1-7sihNlKJvkZ4RKy3KQODS1sxVyyJc69/view?usp=sharing
Here is the link to the sphere coordinates: https://drive.google.com/file/d/1tKnyZn9BcJasU523Jny9os6Gp3EMw1Ms/view?usp=sharing

Cheers,
Rahul

Revision history for this message
Jan Stránský (honzik) said :
#5

> when I set periodic boundaries, all the particles are found to club together

You only set the simulation to be periodic with O.periodic=True
This sets the periodic cell size to its default value, (1,1,1).
You should adjust its size [3,5,6,] according to your needs (e.g. packing bounding box [4]):
###
size = aabbDim()
O.cell.setBox(size)
###

Also note that using periodicity for non-periodic packing may create some artifacts on "seams" or "periodic boundaries" which in fact are not (geometrically) periodic.

>> do not ask urgent questions on Saturday
> I'm sorry

no need to be sorry, just do not expect urgent answers :-)

>> Which examples?
> https://gitlab.com/yade-dev/trunk/blob/master/doc/sphinx/tutorial/06-periodic-triaxial-test.py

so consider also [2] as a tutorial for non-periodic triaxial tests

> Yade documentation 3rd edition

This is too broad, please select relevant sections, we may then point you e.g. to a section you missed or something like this.
Here e.g. [5,6].

>> Please provide full error message.
> This is the message: 'PeriTriaxController run on aperiodic simulation'

Please provide FULL error message, including error stack, which also mention from which command it comes from etc.

>> Where / how did you get this understanding?
> ...

Yes, setting periodic boundaries together with packing creation is a natural process and therefore it is present in examples.
However, it is not limited to this scenario.

> .... to form a clump.

"Clump" has in Yade context a special meaning - rigid compound of several particles. So let's call it maybe "cluster"?

> drive.google.com

please read [1], section "Please, no external links!"

Cheers
Jan

[3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Cell.setBox
[4] https://yade-dem.org/doc/yade.utils.html#yade.utils.aabbDim
[5] https://gitlab.com/yade-dev/trunk/-/blob/master/examples/PeriodicBoundaries/periodic-simple.py
[6] https://gitlab.com/yade-dev/trunk/-/blob/master/examples/PeriodicBoundaries/periodic-compress.py

Revision history for this message
Kelly Hilton (kellyhilton) said (last edit ):
#6

Hey,

To apply the conditional boundary condition, the classical method involves applying the same value to the degrees of freedom of the matching nodes on two opposite RVE sides. https://axolotlsquishmallow.com/products/halloween-squishmallows-2022 Thus, it requires a continuous mesh, with the same mesh splitting into two opposite parts of the RVE boundary.

Cheers

Revision history for this message
Jérôme Duriez (jduriez) said :
#7

Just looking at your first sentences (sorry if there was sthg elsewhere I missed), it seemed to me you wanna apply triaxial loading to an existing sample which was created with classical boundaries. Did you consider thus to use the classical, non-periodic, TriaxialStressController we also have (with other examples at [*]) ?

[*] https://gitlab.com/yade-dev/trunk/-/tree/master/examples/triax-tutorial or on your computer

Can you help with this problem?

Provide an answer of your own, or ask Rahul R for more information if necessary.

To post a message you must log in.