For the three-bar model of the figure, draw the loading and unloading sequence for different levels of strains. The bars have the same geometry and elastic properties but different yield stresses.
Consider the following input file, which reads from the command line the maximum strain (default to five, yielding all three bars):
# read the final (non-dimensional) eps through the command line, default is eps_max = 5
DEFAULT_ARGUMENT_VALUE 1 5
= $1
e_max
# the three (non-dimensinoal) yield stresses
= 3
yield1 = 2
yield2 = 1
yield3
= 1 # non-dimensional Young's modulus (same for all three bars)
E
# set up the DAE solver
dt_0 = 1e-6
rel_error = 1e-4
end_time = 1
PHASE_SPACE e sigma1 sigma2 sigma3 P
# initial conditions
= 0
e_0 = 0
sigma1_0 = 0
sigma2_0 = 0
sigma3_0 = 0
P_0
# controlled strain (two cycles for 0 < t < 1)
= e_max * sin(4*pi*t)
e .
# stresses follow the strain only if the materials do not yield
= E * e_dot * if((e_dot < 0 | sigma1 < yield1) & (e_dot > 0 | sigma1 > (-yield1)))
sigma1_dot .= E * e_dot * if((e_dot < 0 | sigma2 < yield2) & (e_dot > 0 | sigma2 > (-yield2)))
sigma2_dot .= E * e_dot * if((e_dot < 0 | sigma3 < yield3) & (e_dot > 0 | sigma3 > (-yield3)))
sigma3_dot .= sigma1 + sigma2 + sigma3
P .
PRINT FILE_PATH three-bars.dat t e P sigma1 sigma2 sigma3
# plot the results once we are done
IF done
SHELL "pyxplot three-bars.ppl"
SHELL "mv eps-vs-t.pdf eps-vs-t-$1.pdf"
SHELL "mv sigma-vs-eps.pdf sigma-vs-eps-$1.pdf"
ENDIF
wasora three-bars.was 0.5
wasora three-bars.was 1.5
wasora three-bars.was 2.5
wasora three-bars.was 3.5
wasora three-bars.was 4.5