VC_Calibration_Example_1-checkpoint


Original Voce-Chaboche Model Fitting Example 1

An example of fitting the original Voce-Chaboche 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 multiple test data set

This is a simple example for fitting the Voce-Chaboche model to a set of test data. We only use two 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]

Likewise, one backstress can be specified by removing a pair 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

In [2]:
# Specify the true stress-strain to be used in the calibration
data_files = ['example_1.csv', 'example_2.csv']

# Set initial parameters for the Voce-Chaboche model with two backstresses
# [E, \sigma_{y0}, Q_\infty, b, C_1, \gamma_1, C_2, \gamma_2]
x_0 = [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
x_log = './output/x_log.txt'
fxn_log = './output/fxn_log.txt'

# 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 (i.e., filter_data=False is recommended)
x_sol = rpl.vc_param_opt(x_0, data_files, x_log, fxn_log, filter_data=False)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-3f7c2f721d31> in <module>()
     13 # Set filter_data=True if you have NOT already filtered/reduced the data
     14 # We recommend that you filter/reduce the data beforehand (i.e., filter_data=False is recommended)
---> 15 x_sol = rpl.vc_param_opt(x_0, data_files, x_log, fxn_log, filter_data=False)

AttributeError: 'module' object has no attribute 'vc_param_opt'

Plot results

After the analysis is finished we can plot the test data versus the fitted model. Note that we add two dummy parameters to the list of final parameters because the plotting function was written for the updated Voce-Chaboche model that has two additional parameters. Setting the first of these two additional parameters equal to zero neglects the effects of the updated model.

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

The function uvc_data_multi_plotter is also provided to give more fine-grained control over the plotting process, and can compare multiple analyses.


In [3]:
data = rpl.load_data_set(data_files)
# Added parameters are necessary for plotting the Voce-Chaboche model
x_sol_2 = np.insert(x_sol, 4, [0., 1.])
rpl.uvc_data_plotter(x_sol_2, data, output_dir='', file_name='vc_example_plots', plot_label='Fitted')


Out[3]:
[<Figure size 432x288 with 1 Axes>, <Figure size 432x288 with 1 Axes>]

In [ ]: