© 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

22
© 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL

Transcript of © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

Page 1: © 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

Page 2: © 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

Page 3: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Start with the Model Wizard

Select Space Dimension as 1D

Click Next

Page 4: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Add Physics

Select Mathematics > Optimization and Sensitivity > Optimization (opt) and click on the Next icon

Next icon

Page 5: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 6: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

COMSOL 1D Graphical User Interface

Page 7: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 8: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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.

Page 9: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Define an integration coupling operator on Domain 1 (the specified interval)

Model 1 > Definitions > Model Couplings > Integration

Page 10: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 11: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Create these variables

Model 1 > Definitions > Variables

Page 12: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Set the Objective Function

Model 1 > Optimization (opt) > Global Objective

37.0

0

2)()(Objectivex

x

dxxPxRawData

Page 13: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Specify the variables to be optimized

Model 1 > Optimization (opt) > Global Control Variables

Page 14: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Mesh

Model 1 > Mesh 1 > Edge

Select Mesh 1 > Size and choose Extremely Fine

Page 15: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 16: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 17: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 18: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 19: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 20: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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

Page 21: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 2011 COMSOL Inc. All rights reserved

Results – Raw Data vs. Fit

Page 22: © 2011 COMSOL Inc. All rights reserved Curve Fitting using the Optimization Module in COMSOL.

© 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.