# HS-1506: Material Calibration with a Curve Difference Integral

In this tutorial, you will learn how to register a Compose, Python, or Templex function in HyperStudy.

Before you begin, copy the model files used in this tutorial from <hst.zip>/HS-1506/ to your working directory.

The .py and .oml file contain a function that calculates the area between two curves.

The objective of this tutorial is to find the Radioss material parameter values so that the stress-strain curve of the tensile test simulation matches the tensile test experimental curve.

HS-1507: Material Calibration with Area Tool in Data Source provides an alternative method to set up this problem using the Area tool.

HS-4200: Material Calibration Using System Identification provides an alternative method to set up this problem using system identification.

By the end of this tutorial, you will know how to:
• Create an input template from a Radioss file using the HyperStudy - Editor
• Register a Compose, Python, or Templex function
• Set up a study
• Run a system identification optimization study

## Model Definition

A quarter of a standard tensile test specimen is modeled using symmetry conditions. A traction is applied to a specimen via an imposed velocity at the left-end.

The units are: mm, ms, g, N, MPa.
The material to be characterized is a 6063 T7 Aluminum. It has an isotropic elasto-plastic behavior which can be reproduced by a Johnson-Cook model without damage (RADIOSS Block Law2), defined as:
In this tutorial, the parameters a, b, n, σmax (maximum stress), and the Young modulus are defined as input variables. The stress-strain curve obtained by the experimental test is shown in Figure 3.
For the simulation results, engineering strains will be obtained by dividing the displacement of node 1 by the reference length (75 mm), and engineering stresses will be obtained by dividing the force in section 1 by its initial surface (10.2 mm2).

## Create Base Input Template

In this step, you can create the base input template in HyperStudy or use the base input template in the study Directory.

1. Start HyperStudy.
2. From the menu bar, click Tools > Editor.
The Editor opens.
3. In the File field, open the TENSILE_TEST_0000.rad file.
4. In the Find area, enter /MAT/PLAS_JOHNS/1 and click .
HyperStudy highlights /MAT/PLAS_JOHNS/1.
5. Select variable E by highlighting the first 20 fields in row 51.
Tip: Quickly highlight 20-character fields by pressing Ctrl to activate the Selector (set to 20 characters) and then clicking the value.
6. Right-click on the highlighted fields and select Create Parameter from the context menu.
7. In the Parameter: varname_1 dialog, define the following options and click OK.
1. In the Label field, enter E_Young.
2. Change the Lower Bound to 50000.
3. Change the Nominal value to 60400.
4. Change the Upper Bound to 70000.
5. Change the Format to %20.5f.
8. Define four more variables using the information provided in Table 1.
Table 1.
Variable Label Lower Bound Nominal Upper Bound Format
a a_PlasticityYieldStress 90 110 120 %20.5f
b b_HardeningCoeff 100 125 160 %20.5f
n n_HardeningExpo 0.1 0.2 0.3 %20.5f
sigmax Sigma_Max 250 280 290 %20.5f
9. Click Save.
10. In the Save Template dialog, save the file as TENSILE_TEST_0000.tpl.
11. Close the Editor.

## Register Curve Difference Function

In this step you will register the curve difference function using Compose/OML, Python, or Templex.

The function curve_difference calculates the integral of the absolute value of the difference between two curves over the common domain of the supplied functions. This is a robust function that tends to zero only as the two functions become equal.

• Register the curve_difference function using Compose.
${\int }_{a}^{b}|f\left(x\right)-g\left(x\right)|dx$
1. Start Compose.
2. From the menu bar, click File > Open.
3. In the Open File dialog, open the file Curve_Difference.oml.
4. Highlight the function curve_difference(...).
5. Right-click on the highlighted text and select Register Function from the context menu.
6. In the Register Function dialog, click OK.
7. Close Compose.
• Register the curve_difference function using Python.
1. In your favorite text editor, open the hst_py.mvw file.
2. Replace <path> with the actual location of the Curve_difference.py file.
*Id("HyperStudy v11.0")
*BeginDefaults()
*BeginPlotDefaults()
*RegisterPythonFunction("curve_difference","<path>/curve_difference.py", 1)
*EndPlotDefaults()
*EndDefaults()
3. Save the changes you made to the preference file.
4. Close the text editor.
5. In HyperStudy, from the menu bar, click File > Use Preferences File.
6. In the Altair HyperStudy - Set Preferences File dialog, navigate to your working directory and open the hst_py.mvw file.
• Register the curve_difference function using Templex.
1. From the menu bar, click File > Use Preferences File.
2. In the HyperStudy - Set Preference File dialog, open the curve_difference.mvw file.

## Perform the Study Setup

1. Start a new study in the following ways:
• From the menu bar, click File > New.
• On the ribbon, click .
2. In the Add Study dialog, enter a study name, select a location for the study, and click OK.
3. Go to the Define Models step.
4. Add a Parameterized File model.
1. From the Directory, drag-and-drop the TENSILE_TEST_0000.tpl file into the work area.
2. In the Solver input file column, enter TENSILE_TEST_0000.rad.
This is the name of the solver input file HyperStudy writes during any evaluation.
4. Verify that the Solver input arguments field reads \$file.
This solver input argument runs the Starter and the Engine of RADIOSS for the crash analysis, and also prevents the creation of the .h3d result file from animation files.
Note: X is the number of CPUs to use for the simulation.
5. Define a model dependency.
1. Click Model Resources.
2. In the Model Resource dialog, select Model 1 (m_1).
3. Click Resource Assistant > Add File.
4. In the Select File dialog, navigate to your working directory and open the TENSILE_TEST_0001.rad file.
5. Set Operation to Copy.
6. Click Close.
6. Click Import Variables.
Five input variables are imported from the TENSILE_TEST_0000.tpl resource file.
7. Go to the Define Input Variables step.
8. Review the input variable's lower and upper bound ranges.

## Perform Nominal Run

1. Go to the Test Models step.
2. Click Run Definition.
An approaches/setup_1-def/ directory is created inside the study Directory. The approaches/setup_1-def/run__00001/m_1 directory contains the input file, which is the result of the nominal run.

## Create and Evaluate Output Responses

In this step, you will use the curve_difference function to create and evaluate output responses.

In order to fit the RADIOSS stress-strain curve to the experimental data, you must compare the two curves.

1. Create the Area Between Two Curves output response.
2. In the work area, Label field, enter Area Between Two Curves.
2. Create a data source labeled Disp_sim.
1. From the Directory, drag-and-drop the TENSILE_TEST01 file, located in approaches/setup_1-def/run__00001/m_1, into the work area.
2. In the File Assistant dialog, set the Reading technology to Altair® HyperWorks® and click Next.
3. Select Single Item in a Time Series, then click Next.
4. Define the following options, then click Next.
• Set Type to None/Node 1.
• Set Request to 4 Node 1.
• Set Component to DX-X Displacement.
5. Under Creating a new Data Source, enter Disp_sim in the Label field.
6. Clear the Use Data Source in a new Response checkbox.
7. Click Finish.
3. Create a second data source labeled Force_sim by repeating step 2.
Define the following options:
1. Set Type to Section/SECTION_2.
2. Set Request to 2 section 1.
3. Set Component to FT-Resultant Tangent Force.
4. Create a third data source labeled Strain_exp.
1. In the Expression column of the Area Between Two Curves output response, click ....
2. In the Expression Builder, click the Data Sources tab.
A new data source is added to the work area.
4. In the Label field for the new data source, enter Strain_exp.
5. In the File field, click ....
6. In the Data Source Builder, define the data source and click OK.
• In the File field, navigate to your working directory and open the experiment.xy file.
• Set Tool to File Source.
• Set Type to Unknown.
• Set Request to Block1.
• Set Component to Column 1.
5. Create a fourth file source labeled Stress_Exp by repeating step 4.
Select the following options:
1. Set Type to Unknown.
2. Set Request to Block1.
3. Set Component to Column 2.
6. Define the Area Between Two Curves output response.
1. In the Expression Builder, click the Functions tab.
2. From the list of available functions, select curve_difference.
3. Click Insert Varname.
The function curve_difference() appears in the Evaluate Expression field.
4. In the Evaluate Expression field, edit the expression so that it reads curve_difference(m_1_ds_1/75,m_1_ds_2/10.2,ds_3,ds_4).
Note: In the expression, you will notice that the four data sources are entered differently. The varname for the first two data sources created using the File Assistant are labeled as m_1_ds_#, whereas the varname for the last two data sources created in the Expression Builder are labeled as ds_#.
The displacements and forces are read from the simulation, whereas from the experiment you have strains and stresses. In order to convert the displacement and forces to strains and stresses, you need to divide the displacements by the length (75) and forces by the area (10.2).
7. Click OK to close the Expression Builder.
8. Click Evaluate to extract the response values.

## Run Optimization

1. In the Explorer, right-click and select Add from the context menu.
2. In the Add dialog, select Optimization and click OK.
2. Go to the Optimization > Definition > Define Output Responses step.
3. Click the Objectives/Constraints - Goals tab.
4. Apply an objective on the Area Between Two Curves output response.