HyperStudy

Parameterized File Model

Parameterized File Model

Previous topic Next topic Expand/collapse all hidden text  

Parameterized File Model

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Select a Parameterized File model if you want to use a template file. A HyperStudy template file is an ASCII text file that contains the parameterized version of the solver input file. The template file extension is .tpl. The most basic HyperStudy template file is a data file in which certain data fields are replaced with parameters using a Templex statements. In more advanced applications, mathematical relations such as load curves and dummy positioning can be included in the template file using Templex. All rules for using Templex, such as naming variables, math programming, data extraction and formatting apply here as well. To facilitate the creation of template files, you can either click Edit > Create Template or Tools > Editor from the menu bar.

template_example

HyperMath file

template_example_2

Template file that defines two input variables

 

When defining a Parameterized File model, you need to identify the template file under the Resource column, enter an appropriate Solver input file (such as a .fem file for Radioss or an .hml file for HyperMath), and select the Solver execution script that HyperStudy uses to run the simulations. The HyperWorks solvers are listed in the Solver execution script column by default. To register additional solver scripts, click Edit > Register Solver Script from the menu bar. If you alter the template file, you must re-select it in the Resource column to re-import the input variables.

 

How do I…

hmtoggle_plus1Create a Simple Template File Using Only Templex Statements

In this example, a template file is created using only Templex statements. To do this, we can use the Editor tool as a simple text editor. Data can be entered in the text area as it is shown below:

{parameter(DV1,"X",.5,0.2,5)}

{parameter(DV2,"Y",.5,0.2,5)}

{RES = DV1 + DV2}

{CON =  1/DV1 + 1/DV2 -2}

{RES}

{CON}

 

Two parameters, DV1 and DV2 (labeled X and Y respectively), are defined with initial values of 0.5, upper bounds of 5.0, and lower bounds of 0.2. The first expression after the parameter statements defines the variable RES to be equal to the expression X + Y.  The second expression defines CON to be equal to the expression 1/X + 1/Y = 2. The last two lines of the template output the values of RES and CON. For more information, please refer to the Templex section of this documentation.

 

hmtoggle_plus1Use Mathematical Expressions in a Template File

Mathematical expressions can be included in a template file. The following example demonstrates the parameterization of a load curve in PAM-CRASH format using B-splines.

{parameter(FAC1,"Design variable 1",483.,300.,550.)}

{parameter(FAC2,"Design variable 2", 439.,300.,550.)}

{parameter(FAC3,"Design variable 3", 550.,450.,950.)}

{parameter(FAC4,"Design variable 4", .22,.1,.35)}

{parameter(FAC5,"Design variable 5", .45,.35,.6)}

FUNCT /  9900176      21

{for (g=0; g<=1.05; g +=0.05)}

{b03 = (1 - g)^3}

{b13 = 3 * g * (1 - g)^2}

{b23 = 3 * (1 - g) * g * g}

{b33 = g^3}

{e =        0.0*b03 + FAC4*b13 + FAC5*b23 + .735195*b33}

{s = 142.594285*b03 + FAC1*b13 + FAC2*b23 +    FAC3*b33}

                   {e,%8.6f}      {s,%10.6f}

{endloop}

 

Replace the load curve in the original input deck with the statements above. The input variable FACn can then be used in the study to modify a material load curve. Using the parameterization here, during the nominal run, the following load curve is inserted into the PAM-CRASH input deck:

FUNCT /  9900176      21

                   0.000000      142.594285

                   0.033081      190.839525

                   0.066345      233.723234

                   0.099828      271.649965

                   0.133562      305.024274

                   0.167581      334.250714

                   0.201920      359.733840

                   0.236613      381.878206

                   0.271692      401.088366

                   0.307193      417.768874

                   0.343149      432.324286

                   0.379594      445.159154

                   0.416562      456.678034

                   0.454087      467.285480

                   0.492202      477.386046

                   0.530942      487.384286

                   0.570340      497.684754

                   0.610430      508.692006

                   0.651247      520.810594

                   0.692824      534.445074

                   0.735195      550.000000

 

hmtoggle_plus1Pass Data From One Template File to Another Template

Data can be passed from one template file to another through the use of an external file. The first template writes the data to a file and the second template reads that data. This can be used to link models together or to pass results from one simulation to another.

The following example demonstrates the passage of a set of input variables from one OptiStruct model to another:

First template:

{parameter(TH1,"Property 1",.1,.05,.15)}

{parameter(TH2,"Property 2",.1,.05,.15)}

{parameter(TH3,"Property 3",.1,.05,.15)}

{open "TEMP"}

{TH1}

{TH2}

{TH3}

{close}

…$

$  PSHELL Data

$

$HMNAME COMPS          2shell                          

$HMCOLOR COMPS       2      14

PSHELL         2       2{TH1,%8.5f}       2   1.0         20.8333330.0    

$HMNAME COMPS          3patch1                        

$HMCOLOR COMPS       3      11

PSHELL         3       2{TH2,%8.5f}       2   1.0         20.8333330.0    

$HMNAME COMPS          4patch2                        

$HMCOLOR COMPS       4      12

PSHELL         4       2{TH3,%8.5f}       2   1.0         20.8333330.0

$

 

Export of this template creates the file TEMP that holds the values of the three input variables. The second template now reads these values and applies them to the PSHELL of the second model. To follow the rule of a minimum of one parameter statement, a dummy statement is added to the second template and referenced on a comment line.

{parameter(XXX,"Bogus1",.1,.05,.15)}

{TH1 = read("TEMP",0,0,0)[0]}

{TH2 = read("TEMP",0,0,0)[1]}

{TH3 = read("TEMP",0,0,0)[2]}

$

${XXX}

$

 

 

$

$  PSHELL Data

$

$HMNAME COMPS          2shell                          

$HMCOLOR COMPS       2      14

PSHELL         2       2{TH1,%8.5f}       2   1.0         20.8333330.0    

$HMNAME COMPS          3patch1                        

$HMCOLOR COMPS       3      11

PSHELL         3       2{TH2,%8.5f}       2   1.0         20.8333330.0    

$HMNAME COMPS          4patch2                        

$HMCOLOR COMPS       4      12

PSHELL         4       2{TH3,%8.5f}       2   1.0         20.8333330.0    

$