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.

Input data

Valid data for TPMplt strictly obey the management logic in VBTree package. Additionally, factors for temperature (celsius) and strain rates should be written in the format of pure numeric. All different variables are desired to be connected using “-” symbol. For example, if there’s a strain data collected in the conditions of 900 celsius, \(10^{-3}\) strain rate, “0.001-Strain-900” is one of available column names for this data, rather than “10e-3_Strain_T900C”, “SR0.001-Strain-1173K” or such like. If your data contains some unnecessary patterns, a certain degree of data cleaning for column names is required.

The following codes partially display a typical valid data for TPMplt:

library(TPMplt)
head(TPMdata[,1:3])
#>   Strain-900-0.001-60% Stress-900-0.001-60% Strain-900-0.01-60%
#> 1              0.00009                 2.81             0.00030
#> 2              0.00026                 2.95             0.00052
#> 3              0.00059                 3.37             0.00068
#> 4              0.00076                 3.37             0.00084
#> 5              0.00093                 3.65             0.00112
#> 6              0.00104                 3.79             0.00122

Users can apply any applicable tools to make the summary table for TPMplt, with the format as above-showed.

Besides, it is common to obtain multiple exported files based on different experiments. TPMplt affords two functions to automatically generate a summary table from multiple exported files. For details, please check the R documents for API4TMZ and TMZdatainput.

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))