PCL Reference Manual > Property Assignment Functions > Experimental Data Fitting
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Experimental Data Fitting
This section explains the functions that pertain to the experimental data fitting application available under the Tools pulldown menu.
  
medr_create_field
( field_name, area_name, variable, skip_lines, switch, file_name )
Description:
 
 
Function to read raw experimental data points from a data file and load the points into a Patran field (of type material). The data typically represents stress vs. strain, stress vs. time, etc. (stress vs. independent variable).
Input:
 
 
STRING
field_name
Name of the field to be created.
STRING
area_name
Name of the field to be created containing area/volume vs independent variable. See remarks below.
STRING
variable
The independent variable name. “e”=Strain, “t”=Time, “T”=Temperature, “f”=Frequency, “er”=Strain Rate
INTEGER
skip_lines
Number of header lines to skip in the raw data file (number greater than or equal to zero).
INTEGER
switch
Switch the independent variable column (default should be 0; or set to 1 to switch columns).
STRING
file_name
The file name containing the raw data.
Output:
 
 
None
 
 
Remarks:
The raw data files must be two or three columns of data. If three columns, the third column is area or volume reduction data. If no area_name is given and a third column exists, it will be read and given the same name as field_name, however each will have a _C1 or _C2 appended to it where _C2 is the area/volume data and _C1 is the stress/strain or stress/time data. No blank lines or more than three columns are acceptable in the raw data file. The data file can be space, tab, or comma delimited.
Example:
Please see exp_data_fitting.calculate.
  
medr_init
( )
Description:
 
 
Initializes the experimental data fitting tool. The functions should be called before each data fitting is done.
Input:
 
 
None
 
 
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_exit
( )
Description:
 
 
This routine deteles the XY Window and associated curves and cleans up the memory and should be called when done with the Experimental Data Fitting tool.
Input:
 
 
None
 
 
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_disconnect
( )
Description:
 
 
This routine diconnects from the Expimental Data Fitting’s dynamically shared library.
Input:
 
 
None
 
 
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_deleteplot
( )
Description:
 
 
This routine deletes the XY Window and curves in the Experimental Data Fitting XY Window.
Input:
 
 
None
 
 
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_setfields
( model_type, test_data, field_names, num_terms )
Description:
 
 
Function to set the curve fitting model (e.g.,Neohookean), which test data to use in the curve fit, the name of the fields containing the test data, and the number of terms to use for series expression fits (e.g., Ogden). This data must be set prior to performing the curve fit.
Input:
 
 
INTEGER
model_type
0=Neohookean, 1=Mooney(2), 2=Mooney(3), 3=Signorini, 4=2nd Order Invariant, 5=3rd Order Deformation, 6=Yeoh, 7=Ogden, 8=Foam, 9=Arruda-Boyce, 11=Gent, 15=Visco Shear Relax, 16=Visco Bulk Relax, 17=Visco Energy Relax
INTEGER
test_data
0=All, 1=Uniaxial, 2=Biaxial, 3=Planar Shear, 4=Simple Shear, 5=Volumetric. (Ignored for Viscoelastic.)
STRING(8)
field_names
An array of 8 field names. Field1=Uniaxial, Field2=Biaxial, Field3=Planar Shear, Field4=Simple Shear, Field5=Volumetric, Field6=Viscoelastic, Field7/Field8=Not used. If area/volume reduction field exist, they are included by separating them by commas, e.g., “uniaxial_C1,uniaxial_C2” Only those fields necessary for the calculation are required.
INTEGER
num_terms
The number of terms to calculate. This is only used for Ogden, Foam, and Viscoelastic curve fits. It is ignored for the others.
Output:
 
 
None.
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_setoptions
( uniaxial_type, biaxial_type, shear_type, math_checks, pos_coeff, extrapolate, left_bound, right_bound, error, error_limit, num_iterations, converge_tol, use_fictive, fictive_coeff, idamage )
Description:
 
 
Sets the Experimental Data Fitting calculation options as done on the Optional Parameters button. Must be called before a data fit is performed.
Input:
 
 
INTEGER
uniaxial_type
Uniaxial reduction data is either A/Ao (0) or V/Vo (1). (A/Ao is the default.)
INTEGER
biaxial_type
Biaxial reduction data is either t/to (0) or V/Vo (1). (t/to is the default.)
INTEGER
shear_type
Planar shear reduction data is either t/to (0) or V/Vo (1). (t/to is the default.)
INTEGER
math_checks
Mathimatical checks are ON (1) or OFF (0). Default is OFF.
INTEGER
pos_coeff
Force calculation to produce positive coefficients (1). Default is OFF (0).
INTEGER
extrapolate
Perform extrapolation of the data: OFF (0), ON (1).
REAL
left_bound
Left bounds for extrapolation (default 0.0).
REAL
right_bound
Right bounds for extrapolation (default 0.0).
INTEGER
error
Error type: Relative=0, Absolute=1. Default is Relative.
REAL
error_limit
Error limit: default=0.001.
INTEGER
num_iterations
Number of iterations: default=20.
REAL
converge_tol
Convergence tolerance: default=1.0e-6.
INTEGER
use_fictive
Use fictive coefficients: OFF (0), ON(1). Default is OFF.
REAL
fictive_coeff
Fictive coefficient: default=0.0. Used in Foam fit only.
INTEGER
idamage
Not used.
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_plotfit
( append, num_vals, c1, c2, c3, def_modes )
Description:
 
 
This routine plots the raw Experimental Data Fitting data and its calculated coefficients and all other deformation modes requested. Must be called after exp_data_fitting.get_coeffs().
Input:
 
 
INTEGER
append
Flag to continue to append new plots to existing XY Window. Default=1 (append). Do not append=0.
INTEGER(3)
num_vals
Array of three values corresponding to the number of valid values in arrays c1, c2, and c2. These values are displayed in the Coefficients spreadsheet in the GUI.
REAL(10)
c1
Calculated Mooney-Rivilin coefficients for model_types 0-6. Calculated shear moduli for Ogden and Foam. n k theta & N for Arruda-Boyce. E & I-m for Gent. Linear terms for Viscoelastic.
REAL(10)
c2
Calculated exponents for Ogden. Deviatoric exponents for Foam. Relaxation times for Viscoelastic.
REAL(10)
c3
Volmetric exponents for Foam, long & short term values for Viscoelastic.
INTEGER
def_modes
Number to indicate deformation modes to plot. 1=uniaxial, 2=biaxial, 4=planar shear, 8=simple shear, 16=volumetric, 32=viscoelastic. Combination can be plotted by adding the respective values together.
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_postcurves
( def_modes )
Description:
 
 
This routine modifies a Experimental Data Fitting plot after a medr_plotfit() is called.
Input:
 
 
INTEGER
def_modes
Number to indicate deformation modes to plot. 1=uniaxial, 2=biaxial, 4=planar shear, 8=simple shear, 16=volumetric, 32=viscoelastic. Combination can be plotted by adding the respective values together.
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
medr_get_magic
( num_magic, num_props, mat_model, model_type, cm_id, lid, prop_ids, prop_names, magic_ids, magic_names )
Description:
 
 
This routine sets the material information for the desired material constitutive model.
Input:
 
 
INTEGER
num_magic
The maximum number of material magics (settings on the Material Input Properties form) for Hyperelastic or Viscoelastic materials. (num_magic=5)
INTEGER
num_props
The maximum number of property IDs (num_props=20).
Output:
 
 
STRING
mat_model
The material model name.
INTEGER
model_type
Experimental curve fitting model.
INTEGER
cm_id
Material constitutive model ID.
INTEGER
lid
Material linearity ID.
INTEGER(20)
prop_ids
Array of property IDs.
STRING(20)
prop_names
Array of property names.
INTEGER
(num_magic)
magic_ids
Array of material magic IDs.
STRING
(num_magic)
magic_names
Array of material magic names.
Example:
Please see exp_data_fitting.calculate.
  
exp_data_fitting.calculate
( )
Description:
 
 
Does the actual Experimental Data Fitting calculations to determine the coefficients, bulk modulus and corresponding error.
Input:
 
 
None
 
 
Output:
 
 
None
 
 
Remarks:
You must call medr_setfield() and medr_setoptions() routines before calling this routine.
Example:
In this example, a raw data field is imported with area reduction data in the third column, the fields associated to test data type, and the Neohookean curve fit applied and the resulting coefficients are plotted and saved as a material constitutive model for the MSC.Marc Preference. The uniaxial and biaxial fit are plotted.
$#
$# Import the raw data from file uniaxial.dat
$#
medr_create_field( "ogden_uniaxial", "", "e", 0, 0, uniaxial.dat" )
$#
$# Calculate the coefficients
$#
medr_init(  )
medr_setfields( 0,0,["uniaxial_C1,uniaxial_C2","","","","","","",""],0 )
medr_setoptions( 0,0,0,0,0,0,0.,0.,0,1E-006,20,0.001,0,0.,0 )
exp_data_fitting.calculate(  )
$#
$# Plot the data fit (uniaxial and biaxial fits only)
$#
INTEGER model_type, num_vals(3), ntrm
REAL c1(10), c2(10), c3(10)
exp_data_fitting.get_coeffs( model_type,num_vals,c1,c2,c3,ntrm )
medr_plotfit( 1,num_vals,c1,c2,c3,63 ) /* 63=plots all modes */
xy_axis_title_set( "X1", "Strain", 12, 7 )
xy_axis_display_title_set( "X1", TRUE )
xy_axis_title_set( "Y1", "Stress", 12, 7 )
xy_axis_display_title_set( "Y1", TRUE )
medr_postcurves( 3 ) /* 3=plots only uniaxail/biaxial modes */
$#
$# Get the material magics corresponding to the curve fit
$#
STRING mat_model[32], prop_names[32](20), magic_names[32](5)
INTEGER model_type, cm_id, lid, prop_ids(20), magic_ids(5)
medr_get_magic( 5, 20, mat_model, model_type, cm_id, lid, prop_ids, @
                       prop_names, magic_ids, magic_names )
$#
$# Set properties for material  obtained from the curve fit
$#
INTEGER nvprops
STRING props[32](20)
exp_data_fitting.set_props( model_type,num_vals,c1,c2,c3,nvprops,props )
exp_data_fitting.set_extra_props( model_type, nvprops, prop_ids, @
                                  prop_names, props )
$#
$# Determine if material exists
$#
INTEGER mat_exists, mid
exp_data_fitting.material_exists( "mooney", mat_exists, mid )
$#
$# Create a material constitutive model
$#
material.create( "Analysis code ID", 20, "Analysis type ID", 1,     @
                 "mooney",  mid, "Date: 14-Jan-02 Time : 14:59:03", @
                 "Isotropic", 1, "Directionality", 1, "Linearity",  @
                  lid, "Homogeneous", 0, mat_model, cm_id,          @
                 "Model Options & IDs", magic_names, magic_ids,     @
                 "Active Flag", 1,"Create", mat_exists,             @
                 "External Flag", FALSE, "Property IDs", prop_names,@
                  prop_ids, "Property Values", props )
$#
$# Clean up
$#
medr_deleteplot(  )
medr_exit(  )
medr_disconnect(  )
  
exp_data_fitting.get_coeffs
( model_type, num_vals, c1, c2, c3, ntrm )
Description:
 
 
This function gets the coefficients of an Experimental Data Fitting calculation. Must be called after exp_data_fitting.calculate() and before a plot can be done with medr_plotfit().
Input:
 
 
None
 
 
Output:
 
 
INTEGER
model_type
0=Neohookean, 1=Mooney(2), 2=Mooney(3), 3=Signorini, 4=2nd Order Invariant, 5=3rd Order Deformation, 6=Yeoh, 7=Ogden, 8=Foam, 9=Arruda-Boyce, 11=Gent, 15=Visco Shear Relax, 16=Visco Bulk Relax, 17=Visco Energy Relax
INTEGER(3)
num_vals
Array of three values corresponding to the number of valid values in arrays c1, c2, and c2. These values are displayed in the Coefficients spreadsheet in the GUI.
REAL(10)
c1
Calculated Mooney-Rivilin coefficients for model_types 0-6. Calculated shear moduli for Ogden and Foam. n k theta & N for Arruda-Boyce. E & I-m for Gent. Linear terms for Viscoelastic.
REAL(10)
c2
Calculated exponents for Ogden. Deviatoric exponents for Foam. Relaxation times for Viscoelastic.
REAL(10)
c3
Volmetric exponents for Foam, long & short term values for Viscoelastic.
INTEGER
ntrm
Number of terms for an Ogden or Foam fit.
Example:
Please see exp_data_fitting.calculate.
  
exp_data_fitting.set_props
( model_type, num_vals, c1, c2, c3, nvprops, props )
Description:
 
 
This routine sets the property values obtained from the curve fit for subsequently saving as a constitutive material model.
Input:
 
 
INTEGER
model_type
0=Neohookean, 1=Mooney(2), 2=Mooney(3), 3=Signorini, 4=2nd Order Invariant, 5=3rd Order Deformation, 6=Yeoh, 7=Ogden, 8=Foam, 9=Arruda-Boyce, 11=Gent, 15=Visco Shear Relax, 16=Visco Bulk Relax, 17=Visco Energy Relax
INTEGER(3)
num_vals
Array of three values corresponding to the number of valid values in arrays c1, c2, and c2. These values are displayed in the Coefficients spreadsheet in the GUI.
REAL(10)
c1
Calculated Mooney-Rivilin coefficients for model_types 0-6. Calculated shear moduli for Ogden and Foam. n k theta & N for Arruda-Boyce. E & I-m for Gent. Linear terms for Viscoelastic.
REAL(10)
c2
Calculated exponents for Ogden. Deviatoric exponents for Foam. Relaxation times for Viscoelastic.
REAL(10)
c3
Volmetric exponents for Foam, long & short term values for Viscoelastic.
INTEGER
nvprops
Number of valid properties.
STRING(20)
props
32 character property names.
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
exp_data_fitting.set_extra_props
( model_type, nvprops, prop_ids, prop_names, props )
Description:
 
 
This routine sets additional property values required for Viscoelastic material models for subsequently saving as a constitutive material model. It is called for all material data fitting modules for consistency.
Input:
 
 
INTEGER
model_type
0=Neohookean, 1=Mooney(2), 2=Mooney(3), 3=Signorini, 4=2nd Order Invariant, 5=3rd Order Deformation, 6=Yeoh, 7=Ogden, 8=Foam, 9=Arruda-Boyce, 11=Gent, 15=Visco Shear Relax, 16=Visco Bulk Relax, 17=Visco Energy Relax
INTEGER
nvprops
Number of valid properties.
INTEGER(20)
prop_ids
Array of property IDs.
STRING(20)
prop_names
Array of property names.
STRING(20)
props
32 character property names.
Output:
 
 
None
 
 
Example:
Please see exp_data_fitting.calculate.
  
exp_data_fitting.material_exists
( material_name, mat_exisits, mid )
Description:
 
 
This function checks for the existence of the given material name and returns the material ID if it exists.
Input:
 
 
STRING
material_name
Name of the material to check for existence.
Output:
 
 
INTEGER
mat_exisits
Material exists if returns zero.
INTEGER
mid
Returned material ID.
Example:
Please see exp_data_fitting.calculate.