TPMplt package introduction
ZHANG Chen
2018-12-05
Main functions
TPMplt is a tool-kit for building and visualizing the dynmaic materials model (DMM), suggested by Prasad and Gegel. It provides an easy approach to calculate constructive functions and other related material constants based on a given strain condiiton. 2D and 3D processing-maps with temperature as its x axis, while logarithm strain rate as its y axis are also available.
Conceptual knowledge about VBTree data frame
It is necessary to build the conceptions for layers and levels in layer for variables, defined by VBTree package. For example, run the following codes to check all column names in the demo dataset in TPMplt pacakge:
colnames(TPMdata)
#> [1] "Strain-900-0.001-60%" "Stress-900-0.001-60%"
#> [3] "Strain-900-0.01-60%" "Stress-900-0.01-60%"
#> [5] "Strain-900-0.1-60%" "Stress-900-0.1-60%"
#> [7] "Strain-900-1-60%" "Stress-900-1-60%"
#> [9] "Strain-950-0.001-60%" "Stress-950-0.001-60%"
#> [11] "Strain-950-0.01-60%" "Stress-950-0.01-60%"
#> [13] "Strain-950-0.1-60%" "Stress-950-0.1-60%"
#> [15] "Strain-950-1-60%" "Stress-950-1-60%"
#> [17] "Strain-1000-0.001-60%" "Stress-1000-0.001-60%"
#> [19] "Strain-1000-0.01-60%" "Stress-1000-0.01-60%"
#> [21] "Strain-1000-0.1-60%" "Stress-1000-0.1-60%"
#> [23] "Strain-1000-1-60%" "Stress-1000-1-60%"
#> [25] "Strain-1050-0.001-60%" "Stress-1050-0.001-60%"
#> [27] "Strain-1050-0.01-60%" "Stress-1050-0.01-60%"
#> [29] "Strain-1050-0.1-60%" "Stress-1050-0.1-60%"
#> [31] "Strain-1050-1-60%" "Stress-1050-1-60%"
#> [33] "Strain-1100-0.001-60%" "Stress-1100-0.001-60%"
#> [35] "Strain-1100-0.01-60%" "Stress-1100-0.01-60%"
#> [37] "Strain-1100-0.1-60%" "Stress-1100-0.1-60%"
#> [39] "Strain-1100-1-60%" "Stress-1100-1-60%"
#> [41] "Strain-1150-0.001-60%" "Stress-1150-0.001-60%"
#> [43] "Strain-1150-0.01-60%" "Stress-1150-0.01-60%"
#> [45] "Strain-1150-0.1-60%" "Stress-1150-0.1-60%"
#> [47] "Strain-1150-1-60%" "Stress-1150-1-60%"
#> [49] "Strain-1200-0.001-60%" "Stress-1200-0.001-60%"
#> [51] "Strain-1200-0.01-60%" "Stress-1200-0.01-60%"
#> [53] "Strain-1200-0.1-60%" "Stress-1200-0.1-60%"
#> [55] "Strain-1200-1-60%" "Stress-1200-1-60%"
As we seen, all column names are arranged by the style of “(Strain&Stress)-(Temperature)-(Strain Rate)-(Other)”. Under this circumstance, we call the layer for temperature is 2, while the layer for strain rate is 3.
The function epsExtract
is capable to export a strain rate-temperature table by specifying eps
as the strain condition. However, lyT
and lySR
, the two necessary arguments corresponding to layers for temperature and strain rate respectively, require correct declaration as well.
Executinge the following codes:
require(VBTree)
#> Loading required package: VBTree
dl2vbt(chrvec2dl(colnames(TPMdata)))
#> $tree
#> $tree[[1]]
#> [1] "Strain" "Stress"
#>
#> $tree[[2]]
#> $tree[[2]][[1]]
#> [1] "900" "950" "1000" "1050" "1100" "1150" "1200"
#>
#> $tree[[2]][[2]]
#> $tree[[2]][[2]][[1]]
#> [1] "0.001" "0.01" "0.1" "1"
#>
#> $tree[[2]][[2]][[2]]
#> $tree[[2]][[2]][[2]][[1]]
#> [1] "60%"
#>
#> $tree[[2]][[2]][[2]][[2]]
#> list()
#>
#>
#>
#>
#>
#> $dims
#> [1] 2 7 4 1
#>
#> attr(,"class")
#> [1] "Vector.Binary.Tree"
The complete structure for all variables is showed. As the result showed above, there’re 7 temperatures and 4 strain rates in our summary table, therefore the numbers of level for temperature and strain rate are 7 and 4 respectively. Based on all introduced knowledge, we can easily find that all factors will be corresponded with a unique identity with the format as (layer, level). For example, we can define the factor “950” is located in layer 2, level 2.
Auto plots for stress-strain curves
SSplots
is automatic completion for stress-strain curve plots, using VBTree package group strategy. The argument grpby
determines the group methods for plots. As an instance, stress-strain curves grouped by strain rates, separated by temperature condition in each individual plot is very common. Since the layer for strain rate is 3, we can simply set the argument grpby
as 3 then run the code SSplots(TPMdata, 3, mfrow=c(3, 3))
to obtain the following plots (7 figures, therefore it is reasonable to use a 3*3 division to display):

Grouped by temperature is also available, by running SSplots(TPMdata, 2, mfrow=c(2, 2))
, four figures will be exported as:

But pay attention, multiple plots export using graphics
is very sensitive to the Plots pane’s area. Before plotting, please zoom in this pane large enough to obtain correct export.
Applying multi-function linear fitting
Generally, curves of flow stress as function of flow strain will be of high vibration, therefore the fitting process for all data is necessary. However, in most circumstances, raw stress-strain curves always present too complicated appreance to be fitted by a single linear model. The function AllPF()
in this package is designed to solve this problem. From the aforementioned raw stress-strain curves generated by SSplots(TPMdata, 2, mfrow=c(2, 2))
, it is not difficult to find for most curves, from start to where the strain is 0.015, elastic deformation occur; for the strain ranged from 0.015 to 0.2, the linear relationship collapses, tested samples are in yield region; in the region for the strain is above 0.2, there is mainly plastic deformation. Empirically, it is reasonable to set 3 subsections and utilizing polynomial fitting one by one, by setting the argument subsec
as c(0.015, 0.2)
:
Fitted_data <- AllPF(TPMdata, subsec = c(0.015, 0.2))
SSplots(Fitted_data, 2, mfrow=c(2, 2))

Compared to the raw curves, we can find the fitted curves keep the most appearance with no vibrations or noises. You can see the documents for basicPF()
and AllPF()
, try out an most optimized combination of arguments (specially for the argument subsec
) for your own experimental data.
Temperature correction
After the receivable arguments for fitting are obtained, we can use the function TCorrect()
to output the temperature-corrected data by adding some necessary material contants. Take the conventional steel as the example, the heat capacity constant and material density are 510.7896 and 8050 in SI base. Set the argument subsec()
as c(0.015, 0.2)
and the power efficiency CorrCons
as 0.9:
The 2nd and 3rd argument in TCorrect()
are integers to specify the layer for strain rates and temperatures.
TCorrect_data <- TCorrect(TPMdata, 3, 2, 510.7896, 8050, CorrCons = 0.9, subsec=c(0.015, 0.2))
#> Constitutive equation in 0.1615461 strain:
#> Epsilon=A{[sinh(Alpha*Sigma)]^n}*exp[-Q/(RT)]
#> Where A = 2.783376e+15 s^-1
#> Alpha = 0.01098455 MPa^-1 = 1.098455e-02 Pa^-1
#> Q = 444224.7 J/mol = 444.2247 kJ/mol
#> R = 8.314 J/(mol*K)
#> Epsilon is strain rate
#> Sigma is flow stress
#> T is Temperature (K)
SSplots(TCorrect_data, 2, mfrow=c(2, 2))

After temperature correction, it is noted that flow stress increase significantly in low temperature, high strain rate. This result is experientially corresponding to our common sense that working hardening effect will be even obvious, in the condition of low temperature or high strain rate.
Automatic calculation
On the basis of dynamic materials modeling (DMM), constructive function and all material constants can be calculated from a certain strain rate-temperature table. The function DMMprocess
includes all steps for DMM processing. Applying it on our previous result (strain rate-temperature table by specific value of strain), the complete output can be observed as following:
DMM <- DMMprocess(epstable)
DMM
#> $MaterialCoefficients
#> $MaterialCoefficients$base
#> [1] 2.718282
#>
#> $MaterialCoefficients$epsilon.strain
#> [1] 0.7
#>
#>
#> $tablelist
#> $tablelist$SRTtable
#> 900 950 1000 1050 1100 1150 1200
#> 0.001 124.5088 65.80278 56.04781 34.12535 31.63668 22.47848 8.697162
#> 0.01 219.1537 149.62017 117.56519 99.58458 45.68972 47.19172 16.006299
#> 0.1 362.4149 249.03308 181.01400 63.08493 98.83963 76.70697 58.357283
#> 1 454.1907 273.67238 251.13413 176.03397 130.09074 89.47805 85.808117
#>
#> $tablelist$etatable
#> 900 950 1000 1050 1100 1150
#> 0.001 0.37131307 0.5811048 0.5901054 1.1041749 0.1106095 0.53659731
#> 0.01 0.39686885 0.4573560 0.3867528 0.1557679 0.4762878 0.42770615
#> 0.1 0.29613270 0.2434405 0.2608278 0.1721543 0.4525246 0.25238727
#> 1 0.01332736 0.1204960 0.2597435 1.0923170 0.2127072 0.03178241
#> 1200
#> 0.001 0.2045914
#> 0.01 0.6915867
#> 0.1 0.6484925
#> 1 0.4129159
#>
#> $tablelist$xitable
#> 900 950 1000 1050 1100 1150
#> 0.001 0.236037147 0.3868170 0.3609587 -1.12261315 0.07379586 0.34966457
#> 0.01 0.243924820 0.2738597 0.2224024 0.05807311 0.34385310 0.25532661
#> 0.1 0.163130779 0.1262339 0.1465839 0.12300446 0.25700713 0.13407601
#> 1 0.006081437 0.0574411 0.1525193 3.45044246 0.08389923 0.01488617
#> 1200
#> 0.001 0.1684278
#> 0.01 0.6327450
#> 0.1 0.3582140
#> 1 0.1055907
#>
#>
#> attr(,"class")
#> [1] "DMMresult"
If the constructive function is the only thing we concerned about, set the argument ConsFunc
in DMMprocess
as TRUE:
DMM <- DMMprocess(epstable, ConsFunc = TRUE)
#> Constitutive equation in 0.7 strain:
#> Epsilon=A{[sinh(Alpha*Sigma)]^n}*exp[-Q/(RT)]
#> Where A = 8.31632e+16 s^-1
#> Alpha = 0.01229788 MPa^-1 = 1.229788e-02 Pa^-1
#> Q = 506858.5 J/mol = 506.8585 kJ/mol
#> R = 8.314 J/(mol*K)
#> Epsilon is strain rate
#> Sigma is flow stress
#> T is Temperature (K)
Additionally, if we set the argument InteractMode
as TRUE, all computation process and corresponding fitting figures can be output step by step. There shows some results in following figures:







All workflow control will be prompted in the console, something like:

Preparation for visualization
As we can see, the “etatable” and “xitable” in tablelist are two key parts for building processing-map. The former is for power dissipation efficiency factor eta, and the later is for rheological stability coefficient xi. However, since the values in both are discrete, regression process for these tables is necessary.
Support vector regression (SVR) is recommanded. The function SVRModel
will return a regression result which can be utilized by ploting functions.
The following demonstration save the returned result into the vairable “PLTbd”, for the meaning of “Plots builder”.
2D processing map visualization
Function TPM2dplt
can generate a thermal processing map from regression result easily. Following codes demonstrates the processing map from “PLTbd” with default settings:

From the plot we can find that power dissipation efficiency factor eta is denoted by contour with gradient blue, while the rheological stability coefficient xi is represented by a gradient colours from green (high) to red (low). Annotation in top-left show the strain condition for current processing map.
Locations for annotation, gradient colors for rheological stability coefficient xi is customizable in TPM2dplt
function. But since the color for eta is fixed, please try not to use blue or such like, to avoid obtaining an ambiguous result.
3D processing map visualization
Function TPM3dplt
can build a thermal processing results as similar as TPM2dplt
did. The difference is, eta and xi will be separately plotted.
By running the following code, we can easily obtain the results as shown in the next figure.

These two 3d surfaces are generated through the rgl package, therefore it will be very convenient to utilize 3d rotation on our plots for further analysis in details.
Especially, the xi plots is coupled with a specific plane, z=0, in order to make divisions for the stable and unstable regions (doesn’t included in demo fig). If the prediction for xi contained certain negative values, this plan will be visible in 3d surface plot.