# Updated Voce-Chaboche Model Fitting Example 1

An example of fitting the updated Voce-Chaboche (UVC) model to a set of test data is provided.

Documentation for all the functions used in this example can be found by either looking at docstrings for any of the functions.



In [1]:

import RESSPyLab as rpl
import numpy as np



## Run optimization with single test data set

This is a simple example for fitting the UVC model to a set of test data. We only use one backstresses in this model, additional backstresses can be specified by adding pairs of 0.1's to the list of x_0. E.g., three backstresses would be

x_0 = [200000., 355., 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]

Likewise, two backstresses can be specified by removing two pairs of 0.1's from the list below.

The overall steps to calibrate the model parameters are as follows:

1. Load the set of test data
2. Choose a starting point
3. Set the location to save the analysis history
4. Run the analysis

Step 4. from above is slightly more complicated for the updated model than it is for the original model. This step is divided into two parts: a) Run the original model with the same number of backstresses to obtain an initial set of parameters (without the updated parameters) b) Run the updated model from the point found in 4a.

If you already have an initial set of parameters you can skip substep 4a by setting find_initial_point=False.



In [2]:

# Specify the true stress-strain to be used in the calibration
# Only one test used, see the VC_Calibration_Example_1 example for multiple tests
data_files = ['example_1.csv']

# Set initial parameters for the UVC model with one backstresses
# [E, \sigma_{y0}, Q_\infty, b, D_\infty, a, C_1, \gamma_1]
x_0 = np.array([200000., 355., 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])

# Log files for the parameters at each step, and values of the objective function at each step
# The logs are only kept for step 4b, the result of 4a will be the first entry of the log file
x_log = './output/x_log_upd.txt'
fxn_log = './output/fxn_log_upd.txt'

# (Optional) Set the number of iterations to run in step 4b
# The recommended number of iterations is its = [300, 1000, 3000]
# For the purpose of this example less iterations are run
its = [30, 30, 40]

# Run the calibration
# Set filter_data=True if you have NOT already filtered/reduced the data
# We recommend that you filter/reduce the data beforehand
x_sol = rpl.uvc_param_opt(x_0, data_files, x_log, fxn_log, find_initial_point=True, filter_data=False,
step_iterations=its)




##########      New Lagrangian Step      ###########

It. = 1:	f(x) = 9.933485e+03 ; ||grad[L]|| = 3.618753e+03
x =  [194212.949    361.141      0.103      0.103      0.103      0.103]

It. = 2:	f(x) = 8.985734e+03 ; ||grad[L]|| = 2.915328e+03
x =  [183600.543    373.347      0.111      0.111      0.111      0.111]

It. = 3:	f(x) = 7.300635e+03 ; ||grad[L]|| = 1.784776e+03
x =  [164806.315    397.191      0.131      0.131      0.131      0.131]

It. = 4:	f(x) = 4.769137e+03 ; ||grad[L]|| = 7.523199e+02
x =  [154551.292    417.931      0.175      0.175      0.175      0.175]

It. = 5:	f(x) = 3.841227e+03 ; ||grad[L]|| = 3.177946e+02
x =  [149256.362    419.442      0.233      0.233      0.233      0.233]

It. = 6:	f(x) = 3.710453e+03 ; ||grad[L]|| = 1.345758e+02
x =  [146499.258    419.934      0.312      0.311      0.311      0.31 ]

It. = 7:	f(x) = 3.661428e+03 ; ||grad[L]|| = 5.732478e+01
x =  [145182.654    420.115      0.418      0.418      0.416      0.414]

It. = 8:	f(x) = 3.640068e+03 ; ||grad[L]|| = 2.497998e+01
x =  [145182.924    420.071      0.568      0.566      0.558      0.552]

It. = 9:	f(x) = 3.629086e+03 ; ||grad[L]|| = 1.161780e+01
x =  [145183.14     419.982      0.805      0.793      0.757      0.736]

It. = 10:	f(x) = 3.621931e+03 ; ||grad[L]|| = 6.718436e+00
x =  [145182.729    419.737      1.348      1.256      1.051      0.981]

It. = 11:	f(x) = 3.615186e+03 ; ||grad[L]|| = 5.224532e+00
x =  [145161.395    415.895      8.46       5.704      1.556      1.308]

It. = 12:	f(x) = 3.565220e+03 ; ||grad[L]|| = 7.292718e+00
x =  [143856.346    375.261     57.932      6.515      2.804      1.746]

It. = 13:	f(x) = 3.392247e+03 ; ||grad[L]|| = 7.292718e+00
x =  [143856.346    375.261     57.932      6.515      2.804      1.746]

It. = 14:	f(x) = 3.392247e+03 ; ||grad[L]|| = 1.819549e+01
x =  [141413.473    347.665     71.757     14.678     12.722      1.845]

It. = 15:	f(x) = 3.384397e+03 ; ||grad[L]|| = 7.988328e+00
x =  [151943.217    342.329     83.874     14.899   1834.462     10.617]

It. = 16:	f(x) = 2.236396e+03 ; ||grad[L]|| = 1.644730e+01
x =  [163232.553    306.666    108.436     21.58    4444.855     25.641]

It. = 17:	f(x) = 1.385519e+03 ; ||grad[L]|| = 1.644730e+01
x =  [163232.553    306.666    108.436     21.58    4444.855     25.641]

It. = 18:	f(x) = 1.385519e+03 ; ||grad[L]|| = 1.644730e+01
x =  [163232.553    306.666    108.436     21.58    4444.855     25.641]

It. = 19:	f(x) = 1.385519e+03 ; ||grad[L]|| = 5.024127e+00
x =  [165834.079    304.923    106.77      15.04    4508.756     27.143]

It. = 20:	f(x) = 1.295831e+03 ; ||grad[L]|| = 6.516179e+00
x =  [172128.759    304.286    106.073     16.041   4964.67      33.901]

It. = 21:	f(x) = 1.167400e+03 ; ||grad[L]|| = 5.142462e+00
x =  [178552.224    299.44     100.859     16.094   6345.44      42.377]

It. = 22:	f(x) = 1.009812e+03 ; ||grad[L]|| = 5.212983e+00
x =  [175554.249    290.45      91.909     15.892   8539.552     82.03 ]

It. = 23:	f(x) = 8.701579e+02 ; ||grad[L]|| = 2.966108e+00
x =  [177750.897    278.071     92.866     14.961  10918.063     92.338]

It. = 24:	f(x) = 7.461073e+02 ; ||grad[L]|| = 2.809310e+00
x =  [181328.011    272.08      83.474     12.497  14159.677    114.153]

It. = 25:	f(x) = 6.631720e+02 ; ||grad[L]|| = 1.499751e+00
x =  [186113.153    264.84      82.228     12.493  16178.719    120.756]

It. = 26:	f(x) = 6.215544e+02 ; ||grad[L]|| = 1.164085e+00
x =  [189131.868    258.459     79.622     11.794  18285.679    129.94 ]

It. = 27:	f(x) = 5.983195e+02 ; ||grad[L]|| = 3.631035e-01
x =  [194272.586    254.571     77.188     11.734  19548.716    132.635]

It. = 28:	f(x) = 5.853220e+02 ; ||grad[L]|| = 4.392694e-02
x =  [195580.668    252.661     76.748     11.872  20038.055    134.058]
##########      New Lagrangian Step      ###########

It. = 29:	f(x) = 5.844514e+02 ; ||grad[L]|| = 4.775514e-05
x =  [195576.431    252.599     76.743     11.872  20057.394    134.122]
##########      New Lagrangian Step      ###########

It. = 30:	f(x) = 5.844505e+02 ; ||grad[L]|| = 5.039828e-10
x =  [195576.433    252.599     76.743     11.872  20057.449    134.122]
####################################################
### SUCCESSFUL AUGMENTED LAGRANGIAN OPTIMIZATION ###
####################################################
########## TERMINATING AUGMENTED LAGRANGIAN ########
####################################################
('x = ', array([195576.433,    252.599,     76.743,     11.872,  20057.449,
134.122]))
Starting constrained parameter search with 30 iterations at tol = 1.e-8
| niter |f evals|CG iter|  obj func   |tr radius |   opt    |  c viol  |
|-------|-------|-------|-------------|----------|----------|----------|
|   1   |   1   |   0   | +6.0005e+02 | 1.00e+00 | 5.36e+00 | 2.66e+06 |
|   2   |   2   |   1   | +5.9955e+02 | 7.00e+00 | 4.81e+00 | 2.63e+06 |
|   3   |   3   |   3   | +6.0587e+02 | 4.90e+01 | 4.40e+00 | 2.37e+06 |
|   4   |   4   |   5   | +6.6555e+02 | 3.43e+02 | 1.03e+01 | 5.34e+05 |
|   5   |   5   |   9   | +5.6879e+02 | 3.43e+02 | 1.52e+00 | 0.00e+00 |
|   6   |   7   |  14   | +5.6879e+02 | 3.43e+01 | 1.52e+00 | 0.00e+00 |
|   7   |   8   |  19   | +5.6436e+02 | 6.86e+01 | 1.23e-01 | 4.73e+04 |
|   8   |  10   |  25   | +5.6436e+02 | 6.86e+00 | 1.23e-01 | 4.73e+04 |
|   9   |  11   |  29   | +5.6328e+02 | 4.80e+01 | 4.83e-01 | 2.38e+03 |
|  10   |  13   |  34   | +5.6328e+02 | 4.80e+00 | 4.83e-01 | 2.38e+03 |
|  11   |  14   |  38   | +5.6264e+02 | 9.60e+00 | 9.68e-02 | 2.99e+02 |
|  12   |  16   |  43   | +5.6157e+02 | 1.92e+01 | 2.92e-01 | 0.00e+00 |
|  13   |  18   |  47   | +5.6157e+02 | 1.92e+00 | 2.92e-01 | 0.00e+00 |
|  14   |  19   |  50   | +5.6142e+02 | 3.84e+00 | 1.89e-01 | 0.00e+00 |
|  15   |  21   |  54   | +5.6093e+02 | 2.69e+01 | 1.59e-01 | 0.00e+00 |
|  16   |  23   |  59   | +5.6093e+02 | 2.69e+00 | 1.59e-01 | 0.00e+00 |
|  17   |  25   |  62   | +5.6062e+02 | 1.88e+01 | 2.26e-01 | 0.00e+00 |
|  18   |  27   |  66   | +5.6062e+02 | 1.88e+00 | 2.26e-01 | 0.00e+00 |
|  19   |  29   |  69   | +5.6027e+02 | 3.76e+00 | 1.95e-01 | 0.00e+00 |
|  20   |  31   |  72   | +5.6027e+02 | 3.76e-01 | 1.95e-01 | 0.00e+00 |
|  21   |  33   |  73   | +5.6022e+02 | 2.64e+00 | 2.91e-01 | 0.00e+00 |
|  22   |  35   |  75   | +5.5977e+02 | 5.27e+00 | 2.00e-01 | 0.00e+00 |
|  23   |  37   |  78   | +5.5977e+02 | 5.27e-01 | 2.00e-01 | 0.00e+00 |
|  24   |  39   |  80   | +5.5970e+02 | 3.69e+00 | 2.67e-01 | 0.00e+00 |
|  25   |  41   |  83   | +5.5934e+02 | 7.38e+00 | 5.14e-01 | 0.00e+00 |
|  26   |  43   |  87   | +5.5807e+02 | 7.38e+00 | 2.77e-01 | 0.00e+00 |
|  27   |  45   |  91   | +5.5732e+02 | 1.48e+01 | 5.84e-01 | 0.00e+00 |
|  28   |  47   |  95   | +5.5732e+02 | 1.48e+00 | 5.84e-01 | 0.00e+00 |
|  29   |  49   |  99   | +5.5688e+02 | 1.03e+01 | 1.64e-01 | 0.00e+00 |
|  30   |  51   |  103  | +5.5688e+02 | 1.03e+00 | 1.64e-01 | 0.00e+00 |
|  31   |  53   |  106  | +5.5674e+02 | 7.23e+00 | 1.02e-01 | 0.00e+00 |
()
The maximum number of function evaluations is exceeded.
Number of iterations: 31, function evaluations: 53, CG iterations: 106, optimality: 1.02e-01, constraint violation: 0.00e+00, execution time: 7.4e+01 s.
Continuing with tol = 1.e-2 for 30 iterations.
| niter |f evals|CG iter|  obj func   |tr radius |   opt    |  c viol  |
|-------|-------|-------|-------------|----------|----------|----------|
|   1   |   1   |   0   | +5.5674e+02 | 7.23e+00 | 1.01e-01 | 0.00e+00 |
|   2   |   2   |   3   | +5.5590e+02 | 5.06e+01 | 1.91e-01 | 0.00e+00 |
|   3   |   3   |   7   | +5.5590e+02 | 5.35e+00 | 1.91e-01 | 0.00e+00 |
|   4   |   4   |  10   | +5.5533e+02 | 1.07e+01 | 2.10e-01 | 0.00e+00 |
|   5   |   5   |  14   | +5.5492e+02 | 1.07e+01 | 2.05e-01 | 0.00e+00 |
|   6   |   6   |  17   | +5.5516e+02 | 1.07e+01 | 5.77e-01 | 0.00e+00 |
|   7   |   7   |  19   | +5.5476e+02 | 1.07e+01 | 4.26e-02 | 0.00e+00 |
|   8   |   9   |  24   | +5.5476e+02 | 1.07e+00 | 4.26e-02 | 0.00e+00 |
|   9   |  10   |  27   | +5.5478e+02 | 7.49e+00 | 1.16e-01 | 0.00e+00 |
|  10   |  12   |  32   | +5.5478e+02 | 7.49e-01 | 1.16e-01 | 0.00e+00 |
|  11   |  14   |  35   | +5.5477e+02 | 5.24e+00 | 2.41e-02 | 0.00e+00 |
|  12   |  14   |  35   | +5.5477e+02 | 2.62e+01 | 3.01e-02 | 0.00e+00 |
|  13   |  16   |  40   | +5.5477e+02 | 2.62e+00 | 3.01e-02 | 0.00e+00 |
|  14   |  17   |  44   | +5.5477e+02 | 2.62e-01 | 3.01e-02 | 0.00e+00 |
|  15   |  19   |  45   | +5.5476e+02 | 1.83e+00 | 3.30e-02 | 0.00e+00 |
|  16   |  21   |  48   | +5.5476e+02 | 1.83e-01 | 3.30e-02 | 0.00e+00 |
|  17   |  23   |  50   | +5.5475e+02 | 1.28e+00 | 3.41e-02 | 0.00e+00 |
|  18   |  25   |  53   | +5.5475e+02 | 1.28e-01 | 3.41e-02 | 0.00e+00 |
|  19   |  27   |  55   | +5.5474e+02 | 8.99e-01 | 2.88e-02 | 0.00e+00 |
|  20   |  29   |  57   | +5.5474e+02 | 8.99e-02 | 2.88e-02 | 0.00e+00 |
|  21   |  31   |  59   | +5.5474e+02 | 6.29e-01 | 3.01e-02 | 0.00e+00 |
|  22   |  33   |  61   | +5.5474e+02 | 6.29e-02 | 3.01e-02 | 0.00e+00 |
|  23   |  35   |  63   | +5.5473e+02 | 4.40e-01 | 2.80e-02 | 0.00e+00 |
|  24   |  37   |  65   | +5.5471e+02 | 8.81e-01 | 3.23e-02 | 0.00e+00 |
|  25   |  39   |  67   | +5.5471e+02 | 8.81e-02 | 3.23e-02 | 0.00e+00 |
|  26   |  41   |  69   | +5.5471e+02 | 6.17e-01 | 2.49e-02 | 0.00e+00 |
|  27   |  43   |  71   | +5.5471e+02 | 6.17e-02 | 2.49e-02 | 0.00e+00 |
|  28   |  45   |  73   | +5.5471e+02 | 4.32e-01 | 3.23e-02 | 0.00e+00 |
|  29   |  47   |  75   | +5.5471e+02 | 4.32e-02 | 3.23e-02 | 0.00e+00 |
|  30   |  49   |  77   | +5.5471e+02 | 3.02e-01 | 2.46e-02 | 0.00e+00 |
|  31   |  51   |  79   | +5.5470e+02 | 6.04e-01 | 3.23e-02 | 0.00e+00 |
()
The maximum number of function evaluations is exceeded.
Number of iterations: 31, function evaluations: 51, CG iterations: 79, optimality: 3.23e-02, constraint violation: 0.00e+00, execution time: 6.3e+01 s.
Continuing with tol = 5.e-2 for 40 iterations.
x = [195576.58     335.306    107.196     17.196    110.775    197.203
20060.192    138.005]
dual_x = [array([0.001]), array([0.]), array([-0.   , -0.   , -0.   , -0.001, -0.   , -0.   , -0.   , -0.   ])]



The minimization problem in 4b above is solved in multiple steps because it is typically difficult to find a minimum to the UVC problem with a strict tolerance. Each step successively relaxes the tolerance on the norm of the gradient of the Lagrangian. The first step is 30 iterations at 1e-8, then 30 iterations at 1e-2, then a maximum of 50 iterations at 5e-2. Confidence in the solution point can be gained using the visualization tools shown in the Visualization_Example_1 Notebook.

In the case shown above, the analysis exits during the third step.

## Plot results

After the analysis is finished we can plot the test data versus the fitted model.

If we set output_dir='./output/' instead of output_dir='' the uvc_data_plotter function will save pdf's of all the plots instead of displaying them below.



In [4]:

rpl.uvc_data_plotter(x_sol[0], data, output_dir='', file_name='uvc_example_plots', plot_label='Fitted-UVC')




Out[4]:

[<Figure size 432x288 with 1 Axes>]




In [ ]: