# How to correct the strain

I use the TriaxialStressController to simulate the triaxial test. The spheres are initially compressed isotropic by move walls, and then the deviatoric loading begins. I want to calculate the strain starting with deviatoric loading, but since the wall moved during the initial isotropic compression stage, the strain isn't equal to zero at the beginning of the deviatoric stress loading. How do I set the function TriaxialStressController so that the strain will be zero at the beginning of the deviatoric loading?
Thank you!

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:

## This question was reopened

 Revision history for this message Robert Caulk (rcaulk) said on 2021-08-14: #1

Hello,

Thanks for helping us build a useful knowledge base. Next time, can you please provide which command you are using? Here are some tips for how to help us and how to receive fast and efficient assistance [1].

I assume you mean you are using triax.strain [2]? Have you tried setting the depth0 [3], width0, and height0?

Cheers,

Robert

 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-08-15: #2

Thanks, Robert. I use the triax.strain, I will try setting the depth0, width0, and height0 equal to the current size.

 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-08-24: #3

I have tried setting the depth0, width0, and height0 equal to the current size, but it takes ten steps for it to take effect. And after reloading the previously saved state file, you must run a step to view the strain and stress.
The code is as follows:
#run 2 steps to check strain, Otherwise, you cannot display strain and stress
O.run(2,1)
print(triax.strain)
triax.width0=aabbDim()[0]
triax.height0=aabbDim()[1]
triax.depth0=aabbDim()[2]

#Check whether the strain is reset
print(triax.strain)
O.run(2,1)
print(triax.strain)

After reloading the state file or resetting, it needs to run for a certain time step to see the effect, am I right？

O.run(2,1)
print(triax.strain)

O.run(2,1)
print(triax.strain)

O.run(2,1)
print(triax.strain)

#Reset the strain finally took effect
O.run(2,1)
print(triax.strain)

 Revision history for this message Jan Stránský (honzik) said on 2021-08-24: #4

> but it takes ten steps for it to take effect

see (and adjust eventually) computeStressStrainInterval [1]

> And after reloading the previously saved state file, you must run a step to view the strain and stress.

Definitely you can "view the strain and stress" without the need to "run a step". Is the problem that the values are zero?
Stress is "computed" value, which is not saved.
If a time difference after the first step is a problem, you can run one step with O.dt=0

Cheers
Jan

 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-08-24: #5

Thanks Jan Stránský, that solved my question.

 Revision history for this message Jan Stránský (honzik) said on 2021-08-24: #6

Please try to mark "the best answers" according to the relation to the original problem, not necessarily the last one.