# Have control on the test: O.run , time step , increments, iterations

Asked by ehsan benabbas on 2020-01-27

Hello,

This question is kind of general but my serious problem now in my code. Mostly about it's understanding in Yade.

Imagine we want to run the Triaxial code [1], to get the micro properties and calculate the stress-strain curves based on micromechanical formulations with respect to micro forces and displacements.

Since it's a triaxial test, we need to have control over the test. It means that, if we want to use strain rate for the deviatoric part to reach a target strain as the finishing criterion of the test, we need to know the increments of the time or load and the total number of increments to reach the target strain.

Eventually, I want to draw the stress-strain graph by connecting some points. What are these points? the result of convergence in the simulations which gives me stress and strain at that certain point. So, let's imagine I am talking about the first point I get for the stress-strain curve (after the origin). between the origin and the first point, many iterations can happen but it is not the data I want to store as they did not converge. So, I only need to collect the data on those specific points which give me the stress-strain curve. That is why I want to define the maximum number of increments (the maximum number of points on the stress-strain curve) and reach to the target strain whit this number of increments.

In the code, we have O.run(A, True). Is the A the total number of increments? because when we run the code, the O.iter will go beyond A in O.run(A, True). Is [1] based on time increments? because the time increments have not been defined in the code. In this regard, the following questions are considerable:

1- In the code we have O.run(1000,true). Doesn't it mean that we only want to have 1000 increment to reach our target strain?
2- how we can control our simulation and increments?
3- the code is working based on time increments or load increments?
4- what is the final number of time/load increments we defined for our code to reach the target strain?
5- I want to define the total number of increments (time or load) and the target strain. I want to reach this target strain with the defined number of increments. And also, want to know in what increment I am now during the simulation. How is that possible?

Thank you,
Ehsan

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
ehsan benabbas
Solved:
2020-01-27
Last query:
2020-01-27
2020-01-27
 Jérôme Duriez (jduriez) said on 2020-01-27: #1

Hi,

I have the personal feeling your mindset is kind of "polluted" (with respect to an optimal use of DEM and YADE) with Finite Element mindset, so maybe the following small comment/reminder could help

DEM describes the time evolution of a discrete set of entities ("bodies" in YADE) in mechanical interaction.

Numerical time just passes the same way real time does, with e.g. position changes divided by time changes tending to velocity.

Time is also discretised with a Finite Difference scheme => each DEM iteration lasts one "time step".

This being said, all the rest is up to you : how many DEM iterations you want to do, with which workflow, .. And thinking in terms of "convergence" does not help understanding in my opinion.

PS : with just O.run(A,True) I doubt O.iter will move forward more than A

 ehsan benabbas (ehsanben) said on 2020-01-27: #2

Hi Jerome and thank s for your explanations.

Ok. So, the step is actually the time step which is O.iter. Am I right? If that's the case, so "A" should be the maximum number of increments(of time). In this case, is it possible to set the time increment (time step) to a specific value we want?

In my code which is similar to [1], I have O.(A.True) in 3 different lines/parts of the code. Let's say I set A=1000.
First of all, O.iter is shown in the order of 1000. Like, 1000, 2000, 3000 instead of 1,2,3 ...
Second of all, in the code and for the first part, it goes like 1000, 2000, 3000, ... up to 30000. In the second use of O.run, it goes like 31000, 32000, 33000, ... up to, 900000. And in the third part(use of O.run) it goes far beyond 1000,000.

( I just avoid to copy my code here to make this question general and not messy, but if you think it's better to copy the code, let me know please.)

Thanks again for your help!

 Jan Stránský (honzik) said on 2020-01-27: #3

> the step is actually the time step which is O.iter. Am I right?

what is "the step"?

> If that's the case, so "A" should be the maximum number of increments(of time).

"A" should be the number of time steps you want to run.. it is rarely related to "maximum". E.g. in the compaction phase, it just runs 1000 iterations ("a few", does not matter how many exactly) and checks if the unbalanced force condition is met. If not, run 1000 steps over and over until it meets the stop condition.

> In this case, is it possible to set the time increment (time step) to a specific value we want?

O.dt = whatever
But the range of reasonable O.dt is very narrow. It must be below critical time step of the system (given by particles' sizes, masses and stiffnesses, independent of any targets) and should not be too much below not to make the simulation unnecessarily slow.

> First of all, O.iter is shown in the order of 1000. Like, 1000, 2000, 3000 instead of 1,2,3 ...

depends on "is shown". If you print it after O.run(1000,True), then it is expected to print 1000 more than before, not 1,2,3

cheers
Jan

 Jérôme Duriez (jduriez) said on 2020-01-27: #4

> So, the step is actually the time step which is O.iter. Am I right?

Yes

> is it possible to set the time increment (time step) to a specific value we want?

Indeed:
O.dt = someValue

But we generally use TimeStepper such as GlobalStiffnessTimeStepper to automatically choose an appropriate value. By the way, if you have it in your O.engines, it will soon supersede a possible "manual" O.dt command

As for the rest, I will not try to dive into long scripts but my guess is that O.run(1000,True) is embedded within a loop and, then, repeated several times.

 Robert Caulk (rcaulk) said on 2020-01-27: #5

To add to Jérôme:

I think you are right - you've posted 5 separate questions on the same example Triaxial script ;-) I will go ahead and recommend the freely available Yade tutorial:

>> So, I only need to collect the data on those specific points which give me the stress-strain curve

Collect data at whatever interval you like by controlling iterPeriod of your PyRunner [1]. It may come as a surprise that this is highlighted in the tutorial :-)

>>because the time increments have not been defined in the code

Assuming you are referencing the example script ;-) you are using GlobalStiffnessTimeStepper to automagically select the largest safe step for you. If you want to have more control over time step, don't use it. Instead define it [2].

 Robert Caulk (rcaulk) said on 2020-01-27: #6

>>it will soon supersede a possible "manual" O.dt command

which can be overcome with

O.dynDt = False

 ehsan benabbas (ehsanben) said on 2020-01-27: #7

Thank you all. you solved my problem.

To post a message you must log in.