In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
import RESSPyLab
Make a list of pandas dataframes with (clean) experimental data from a csv file. This is done with the pandas package from data in csv files. Two columns should be included in the csv file with true strain ("e_true") and true stress ("Sigma_true").
In [2]:
testFileNames=['example_1.csv']
listCleanTests=[]
for testFileName in testFileNames:
test=pd.read_csv(testFileName)
listCleanTests.append(test)
There are two arguments to VCopt: an initial starting point for the parameters ("x_0") and the list of tests previously assembled.
The parameters are gathered in list in the following order:
[E, sy0, Qinf, b, C_1, gamma_1, C_2, gamma_2, ..., ..., C_k, gamma_k]
A recommended initial point is an elastic perfectly plastic model with the nominal values of the elastic modulus and the yield stress. All other values are, therefore, set to zero. For numerical purposes a minimum 1e-1 is used.
The examples herein are from an S355J2 steel. Nominal values are therefore: E=200e3MPa sy0=355MPa
In [3]:
x_0=[200e3,355,1e-1,1e-1,1e-1,1e-1]
sol=RESSPyLab.VCopt_SVD(x_0,listCleanTests)
print(sol)
In [4]:
x_0=[200e3,355,1e-1,1e-1,1e-1,1e-1]
sol=RESSPyLab.VCopt_J(x_0,listCleanTests)
print(sol)
In [5]:
simCurve=RESSPyLab.VCsimCurve(sol,test)
In [6]:
plt.plot(test['e_true'],test['Sigma_true'],c='r',label='Test')
plt.plot(simCurve['e_true'],simCurve['Sigma_true'],c='k',label='RESSPyLab')
plt.legend(loc='best')
plt.xlabel('True strain')
plt.ylabel('True stress')
Out[6]:
Out[6]:
Out[6]:
Out[6]:
Out[6]:
In [7]:
testFileNames=['example_1.csv','example_2.csv']
listCleanTests=[]
for testFileName in testFileNames:
test=pd.read_csv(testFileName)
listCleanTests.append(test)
In [8]:
x_0=[200e3,355,1e-1,1e-1,1e-1,1e-1]
sol=RESSPyLab.VCopt_SVD(x_0,listCleanTests)
print(sol)
In [9]:
x_0=[200e3,355,1e-1,1e-1,1e-1,1e-1]
sol=RESSPyLab.VCopt_J(x_0,listCleanTests)
print(sol)
In [10]:
test=pd.read_csv('example_1.csv')
simCurve=RESSPyLab.VCsimCurve(sol,test)
plt.plot(test['e_true'],test['Sigma_true'],c='r',label='Test')
plt.plot(simCurve['e_true'],simCurve['Sigma_true'],c='k',label='RESSPyLab')
plt.legend(loc='best')
plt.xlabel('True strain')
plt.ylabel('True stress')
Out[10]:
Out[10]:
Out[10]:
Out[10]:
Out[10]:
In [11]:
test=pd.read_csv('example_2.csv')
simCurve=RESSPyLab.VCsimCurve(sol,test)
plt.plot(test['e_true'],test['Sigma_true'],c='r',label='Test')
plt.plot(simCurve['e_true'],simCurve['Sigma_true'],c='k',label='RESSPyLab')
plt.legend(loc='best')
plt.xlabel('True strain')
plt.ylabel('True stress')
Out[11]:
Out[11]:
Out[11]:
Out[11]:
Out[11]:
In [ ]: