Download - © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL
© 2011 COMSOL Inc. All rights reserved
Curve Fitting using the Optimization Module in COMSOL
© 2011 COMSOL Inc. All rights reserved
It is often desirable to fit a material model curve to a set of experimental data
www.instron.com
Strain, ε Stress, P0 0
0.075 4.90E+050.103 8.67E+050.15 1.36E+06
0.174 1.55E+060.2004 1.71E+06
0.25 1.95E+060.305 2.10E+060.351 2.17E+060.37 2.21E+06
?
?
1
112
01
10
01102
C
C
CCP
For example: The hyperelastic Mooney-Rivlin material model implemented in COMSOL requires, as input, C01 and C10, which must be determined from experimental data
© 2011 COMSOL Inc. All rights reserved
Start with the Model Wizard
Select Space Dimension as 1D
Click Next
© 2011 COMSOL Inc. All rights reserved
Add Physics
Select Mathematics > Optimization and Sensitivity > Optimization (opt) and click on the Next icon
Next icon
© 2011 COMSOL Inc. All rights reserved
Select Study Type
Select Stationary
Click the Finish flag after selecting the study type
The next slide shows how the COMSOL Desktop should look like after clicking the Finish icon
© 2011 COMSOL Inc. All rights reserved
COMSOL 1D Graphical User Interface
© 2011 COMSOL Inc. All rights reserved
Define the data setModel 1 > Definitions > Functions > Interpolation
We can either type in these values in the table or upload from a text file
© 2011 COMSOL Inc. All rights reserved
Create a geometric interval
Model 1 > Geometry 1 > Interval
The coordinates specified for the endpoints should be the numbers corresponding to the first and last values in the left column of the data set. Go back to the previous slide and verify that the first value was 0 and the last value was 0.37.
© 2011 COMSOL Inc. All rights reserved
Define an integration coupling operator on Domain 1 (the specified interval)
Model 1 > Definitions > Model Couplings > Integration
© 2011 COMSOL Inc. All rights reserved
Create these variables
• C01 and C10 are not yet defined, these are the variables to be optimized for later.
• For now, we just need to define the expression, P, across the entire domain.
Name Expression
L 1+x[1/m]
P 2*(L-1/L^2)*(C10+C01/L)
SquaredDiff intop1((RawData(x[1/m])-P)^2)
The tabular data “RawData” is a function of position, xThe subdomain expression “P” is an explicit function of x
37.0
0
2)()(fSquaredDifx
x
dxxPxRawData
© 2011 COMSOL Inc. All rights reserved
Create these variables
Model 1 > Definitions > Variables
© 2011 COMSOL Inc. All rights reserved
Set the Objective Function
Model 1 > Optimization (opt) > Global Objective
37.0
0
2)()(Objectivex
x
dxxPxRawData
© 2011 COMSOL Inc. All rights reserved
Specify the variables to be optimized
Model 1 > Optimization (opt) > Global Control Variables
© 2011 COMSOL Inc. All rights reserved
Mesh
Model 1 > Mesh 1 > Edge
Select Mesh 1 > Size and choose Extremely Fine
© 2011 COMSOL Inc. All rights reserved
Study steps
• Right-click on Study 1 and select Show Default Solver
• Expand the Solver Configurations branch as shown below
© 2011 COMSOL Inc. All rights reserved
Introduce the optimization solver
• Right-click on Study 1 > Solver Configurations > Solver 1 and select Solver Settings > Optimization Solver
• Right-click on Study 1 > Solver Configurations > Solver 1 > Stationary Solver 1 and select Disable
• The study step should now look as shown below
© 2011 COMSOL Inc. All rights reserved
Setup the optimization solver
• Right-click on Study 1 > Solver Configurations > Solver 1 > Optimization Solver and select Stationary
• Right-click on Study 1 and select Compute
© 2011 COMSOL Inc. All rights reserved
Results – Optimized Variables• Expand Results > Derived Values• Click on the Global control variable C01 branch and click on the Evaluate
icon in the Settings window. Repeat the same steps to evaluate the other global control variable C10
© 2011 COMSOL Inc. All rights reserved
Results – Line Graph 1
• Right-click on Results and select 1D Plot Group • Right-click on Results > 1D Plot Group 1 and select Line
Graph• Assign the line interval (Domain 1) to the Selection section
in the Line Graph settings• In the corresponding Settings Window, use the expression
RawData(x) for y-Axis Data
© 2011 COMSOL Inc. All rights reserved
Results – Line Graph 2
• Right-click on Results > 1D Plot Group 1 > Line Graph 1 and select Duplicate
• In the Settings Window, type P for y-Axis Data expression
© 2011 COMSOL Inc. All rights reserved
Results – Raw Data vs. Fit
© 2011 COMSOL Inc. All rights reserved
Summary
• This tutorial showed how to use the Optimization Module of COMSOL to obtain curve fitting parameters.
• The specific example shown here could be useful for Structural Mechanics modeling using hyperelastic materials.
• The concept demonstrated here can always be extended to multivariate optimization as long as a suitable objective function is available.