Sei sulla pagina 1di 40

Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

COMSOL Multiphysics: F Avdeling for Mekanikk


Geir Skeie

MEK4550
Elementmetoden i faststoffmekanikk I Contents

(24. september 2007) // ..

/ .
Foreleser: Geir Skeie
Page 1 of 40

(E-post:ges@math.uio.no)
Go Back

Close

Quit
Universitetet i Oslo

Innhold
F COMSOL Multiphysics 3
F.1 What is COMSOL Multiphysics? . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

F.2 What documentation exists? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4


F.3 Start-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Avdeling for Mekanikk
F.4 Modeling in The Graphical User Interface . . . . . . . . . . . . . . . . . . . . . 8 Geir Skeie
F.5 Using the Structural Mechanics Module . . . . . . . . . . . . . . . . . . . . . . 20
F.6 Can you run COMSOL Multiphysics on Windows? . . . . . . . . . . . . . . . . 39

G References 40
Contents

// ..

/ .

Page 2 of 40

Go Back

Close

Quit
Universitetet i Oslo

F. COMSOL Multiphysics

The mechanics department at UIO has currently access to two commercial codes for doing Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

structural analysis based on the finite element method (FEM)


Avdeling for Mekanikk
ANSYS, and Geir Skeie

COMSOL Multiphysics .

The present document is intended to help the students to get acquainted with the two codes Contents
in a way so that they may find their way around the respective documentation.
// ..
The current introduction is written in English to comply with the written documentation of
both COMSOL Multiphysics and ANSYS. / .

In this first version of the document we focus on COMSOL Multiphysics since we will use this
Page 3 of 40
in MEK4550.
Go Back

F.1. What is COMSOL Multiphysics? Close

COMSOL Multiphysics is an engineering tool that performs equation based modeling in an Quit

interactive environment. The basic idea behind the tool is to make modeling and simulation
Universitetet i Oslo

of physical phenomena as easy as possible. It seems that they have come along way in this
respect. Actually this is for you, the user, to decide.

COMSOL Multiphysics is a well filled tool box for solving PDEs in an approximate way using Subdomain boundary nodes

Subdomain interior nodes


Subdomain boundaries

the FEM.
Avdeling for Mekanikk
Currently, the mechanics department has access to two of the COMSOL Multiphysics modules: Geir Skeie

COMSOL Multiphysics and


Structural Mechanics Module.
Contents

The first is the generic tool for solving general PDEs, while the second module is a specialized
version intended to solve general structural mechanics problems. // ..

/ .
F.2. What documentation exists?
Page 4 of 40

Relevant documentation may be found in different sections of the basic COMSOL Multiphysics Go Back
module:
Close

Quick Start and Quick Reference provides a quick overview of COMSOL Multiphysicss
capabilities and how to access them and a reference section containing lists of prede- Quit

fined variable names, mathematical functions, COMSOL Multiphysics operators, equa-


tion forms, and application modes.
Universitetet i Oslo

COMSOL Multiphysics Users Guide covers the functionality of COMSOL Multiphysics


across its entire range from geometry modeling to post processing. It serves as a tutorial
and a reference guide to using COMSOL Multiphysics.
Subdomain boundary nodes Subdomain boundaries

COMSOL Multiphysics Modeling Guide provides an in-depth examination of the soft- Subdomain interior nodes

wares application modes and how to use them to model different types of physics and to
Avdeling for Mekanikk
perform equation-based modeling using PDEs.
Geir Skeie
COMSOL Multiphysics Model Library consists of a collection of ready-to-run models that
cover many classic problems and equations from science and engineering. These models
have two goals: to show the versatility of COMSOL Multiphysics and the wide range of
applications it covers; and to form an educational basis from which you can learn about
COMSOL Multiphysics and also gain an understanding of the underlying physics. Contents

// ..
In addition the Structural Mechanics Module comes with its own Users Guide and Model
Library. / .

Even if focus is on single physics application we shall see that they may be considered in a Page 5 of 40
multi-physics environment.
Go Back

F.3. Start-up Close

Quit
The COMSOL Multiphysics graphical interface shown in this document is generated on Win-
dows.
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

COMSOL Multiphysics may


be started from the local ma- Avdeling for Mekanikk
chines by typing Geir Skeie
%femlab

on the command-line. (The %


is the command-line propt.)
The window that now appears Contents
is shown below, Figure F.1,
and termed the Model Naviga- // ..
tor.
/ .

Figure F.1: The COMSOL Multiphysics Model Navi- Page 6 of 40


gator.
Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

You can access the COM-


SOL Multiphysics documenta-
tion through the Help but-
ton in the Graphical Us- Contents

er Interface. Pressing F1
is also an option and pro- // ..
duces the following screen,
Figure F.2. We recognize the / .
sections mentioned in sec-
tion F.2. Page 7 of 40

Go Back

Close

Quit

Figure F.2: The COMSOL Multiphysics documentation.


Universitetet i Oslo

F.4. Modeling in The Graphical User Interface

The Quick Start and Quick References document serve as an ideal entry point for a more Subdomain boundary nodes Subdomain boundaries

thorough discussion of the topics discussed below. Subdomain interior nodes

Avdeling for Mekanikk


COMSOL Multiphysics support two modes of specifying the mathematical model expressing
Geir Skeie
our physical phenomena:

a free-form entry of custom partial differential equations, or

use a specialized physics application modes. Contents

// ..
We can illustrate the PDE mode of applications by solving the one-dimensional continuum
problem. The governing equations in this case is an ordinary differential equation given by
/ .
 
d du
EA =q
dx dx Page 8 of 40

with appropriate boundary conditions. E is Youngs modulus and A is the truss section area. Go Back
We use the Coefficient Form in this case. The model navigator for this problem set-up is shown
Figure F.3. Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

In the Model Navigator we se-


lect the space dimension and ap- Avdeling for Mekanikk
plication modes to begin working Geir Skeie
on a new model, open an existing
model we have already created, or
open an entry in the Model Li-
brary.
Contents
We note that we select Lagrange-
Linear elements.
// ..

/ .
Figure F.3: Model Navigator for a 1D example us-
ing the coefficient form. Page 9 of 40

In our problem the coefficients in the equation are given by


Go Back

c = EA, a = 0, = 0, =0 and f = q
Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


If we press OK a new window Geir Skeie
appears, namely the Graphi-
cal User Interface, special-
ized to our current problem
settings.
In the Graphical User Inter- Contents

face we use commands, tool-


bars and dialog boxes to per- // ..
form tasks.
/ .

Page 10 of 40

Go Back
Figure F.4: The Graphical User Interface for our 1D
model problem.
Close

Quit
Universitetet i Oslo

The menus in the Graphi-


cal User Interface contains
three different menu sets:
Subdomain boundary nodes Subdomain boundaries

The top row is the Subdomain interior nodes

Menu bar.
Avdeling for Mekanikk
The second row contains Geir Skeie
the Main toolbar.
Figure F.5: Main tools in the Graphical User Interface
The left column is the
for our 1D model problem.
Draw toolbar.
Contents
At the bottom of the COM-
SOL Multiphysics user inter-
face a status bar shows infor- // ..
mation and provides buttons
for changing some user inter- / .
face properties. The contents
depend on the space dimen- Page 11 of 40

sions of the current geometry


in your model. Double-clicking Go Back

a status bar button toggles Figure F.6: Status bar in the Graphical User Interface
its features on and off. More for our 1D model problem. Close

information may be found in


the Users Manual, Geometry Quit

Modeling and CAD Tools .


Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

The first thing we may do is


to set the geometry window to Avdeling for Mekanikk
fit our problem domain. We do Geir Skeie
this from the menu bar

Options Axes/Grid Settings

Contents

Figure F.7: Axis/Grid Settings for our model problem. // ..

/ .

Page 12 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

We may define constants that Subdomain interior nodes

may be used later in the mod-


Avdeling for Mekanikk
eling process
Geir Skeie
Options Constants

Figure F.8: Constant expressions that may be used in our


model problem. Contents

// ..

/ .

Next we define the geometry


Page 13 of 40
of our model problem We can
do this in several ways. One
Go Back
option is to use the
Close
Draw Specify Objects Line

Quit

Figure F.9: Draw a line for our model problem.


Universitetet i Oslo

Next we specify the Physics of our model problem.

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


The coefficients of our truss
Geir Skeie
example are specified in

Physics Subdomain Settings

Note that we are selecting a


subdomain, with the label 1. Contents

// ..

Figure F.10: Subdomain settings for our model problem. / .

Page 14 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

The essential boundary condi-


tions are specified in the

Physics Boundary Settings Contents


Figure F.11: Boundary settings for our model problem.
Note that we are selecting a // ..
boundary, with the label 1.
The natural boundary condi- / .
tions are applied to the bound-
ary with the label 2. Page 15 of 40

Go Back

Close

Quit

Figure F.12: Boundary settings for our model problem.


Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

The next item of our list of Subdomain interior nodes

operations is to specify mesh


Avdeling for Mekanikk
control parameters
Geir Skeie
Mesh Mesh Parameters

In the current analysis we se-


lect a mesh size of 1.
Contents

// ..
Figure F.13: Boundary settings for our model problem.
/ .
The axial displacement along the truss axis is shown below.

Page 16 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Figure F.14: The axial deformation along the truss axis, two elements. Page 17 of 40

Go Back
The model problem may be re-generated form the .m-file.
Close
% COMSOL Multiphysics Model M-file
% Generated by COMSOL 3.2 (COMSOL 3.2.0.222, $Date: 2005/09/01 18:02:30 $)
Quit
flclear fem

% COMSOL version
Universitetet i Oslo

clear vrsn
vrsn.name = COMSOL 3.2;
vrsn.ext = ;
vrsn.major = 0;
vrsn.build = 222; Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes


vrsn.rcs = $Name: $;
vrsn.date = $Date: 2005/09/01 18:02:30 $;
fem.version = vrsn; Avdeling for Mekanikk
% Constants Geir Skeie
fem.const = {EA,1, ...
q,1};

% Geometry
g1=solid1([0,2]);
clear s
s.objs={g1}; Contents
s.name={I1};
s.tags={g1};
// ..
fem.draw=struct(s,s);
fem.geom=geomcsg(fem);
/ .
% Initialize mesh
fem.mesh=meshinit(fem, ...
Page 18 of 40
hmax,[1]);

% (Default values are not included)


Go Back

% Application mode 1
clear appl Close
appl.mode.class = FlPDEC;
appl.assignsuffix = _c;
clear prop Quit
prop.elemdefault=Lag1;
appl.prop = prop;
clear bnd
Universitetet i Oslo

bnd.type = {dir,neu};
bnd.ind = [1,2];
appl.bnd = bnd;
clear equ
equ.c = EA; Subdomain boundary nodes Subdomain boundaries

equ.da = 0; Subdomain interior nodes

equ.f = q;
equ.ind = [1]; Avdeling for Mekanikk
appl.equ = equ;
fem.appl{1} = appl; Geir Skeie
fem.border = 1;
fem.units = SI;

% Multiphysics
fem=multiphysics(fem);

% Extend mesh Contents


fem.xmesh=meshextend(fem);

% Solve problem // ..
fem.sol=femlin(fem, ...
solcomp,{u}, ...
outcomp,{u}); / .

% Save current fem structure for restart purposes


Page 19 of 40
fem0=fem;

% Plot solution
Go Back
postplot(fem, ...
liny,{u,cont,internal}, ...
lincolor,[0.0,0.0,0.0], ... Close
title,Line: u, ...
refine,5, ...
axis,[-0.1,2.1,-0.025,0.525,-1,1]); Quit
Universitetet i Oslo

F.5. Using the Structural Mechanics Module

The simple plain stress problem shown below is modeled, meshed and solved using the Struc- Subdomain boundary nodes Subdomain boundaries

tural Mechanics Module. Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

P = 40
// ..
x 12

/ .

48 Page 20 of 40

Go Back

Close

Figure F.15: Shear loaded cantilever beam. The geometry and loading is shown. The isotropic Quit
material is specified by, E = 30000, = 0.25 and t = 1.
Universitetet i Oslo

The problem input data is given in Figure F.15.

Model the problem in COMSOL Multiphysics using the Structural Mechanics Module. Subdomain boundary nodes Subdomain boundaries

Find the vertical displacement at (48, 0) using a 4 1 rectangular element mesh and Subdomain interior nodes

linear Lagrange shape functions.


Avdeling for Mekanikk
Model the problem in COMSOL Multiphysics using the Structural Mechanics Module. Geir Skeie
Find the vertical displacement at (48, 0) using a 4 1 rectangular element mesh and
quadratic Lagrange shape functions.

Draw the axial stress, xx , variation across the section at x = 12. Compare with exact
results. Contents

// ..

/ .

Page 21 of 40

Go Back

Close

Quit
Universitetet i Oslo

We start COMSOL Multi-


physics and selects the right Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

settings from the Structural


Mechanics Module. The prob- Avdeling for Mekanikk
lem is 2D, plane stress and Geir Skeie
static with linear Lagrange
elements. We select this under
Application Modes:

Contents
Structural Mechanics Module
Plane Stress Static // ..

Figure F.16: Model Navigator for example 2. / .

Page 22 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie
We note that the Graphical
User Interface has changed for
the 2D application.
Contents

// ..

/ .
Figure F.17: Main tools in the Graphical User Interface
Page 23 of 40
for our 2D model problem.

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

The first thing we may do is Subdomain interior nodes

to set the geometry window to


fit our problem domain. We do Avdeling for Mekanikk
this from the menu bar Geir Skeie

Options Axes/Grid Settings

Contents
Figure F.18: Axis/Grid Settings for our model problem.
// ..

/ .

Page 24 of 40
We may define constants that
may be used later in the mod-
Go Back
eling process

Options Constants Close

Quit
Figure F.19: Constant expressions that may be used in
our model problem.
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Next we define the geometry Subdomain interior nodes

of our model problem. We can


do this in several ways. One Avdeling for Mekanikk
option is to use the Geir Skeie

Draw
Specify Objects Rectangle
Contents

// ..
Figure F.20: Draw a rectangle for our model problem.

The rectangle is shown below. / .

Page 25 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Figure F.21: Rectangular geometry for our model problem. Page 26 of 40

Go Back

Close

Quit
Universitetet i Oslo

Next we specify the Physics of


our model problem. This con-
sist of material data, essential Subdomain boundary nodes

Subdomain interior nodes


Subdomain boundaries

and natural boundary condi-


tions. Avdeling for Mekanikk
Geir Skeie
Physics Subdomain Settings

Note that we are selecting a


subdomain, with the label 1.
We are also using the con- Contents
stants that we defined at start-
up. // ..
Figure F.22: Subdomain settings for our model problem,
material data.
/ .

Page 27 of 40

Go Back

Close

Quit
Universitetet i Oslo

The essential boundary condi- Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

tions are specified in the


Avdeling for Mekanikk
Physics Boundary Settings
Geir Skeie
Note that we are selecting a
boundary, the left edge, with Figure F.23: Boundary settings for our model problem.
the label 1.
The natural boundary condi-
Contents
tions are applied to the bound-
ary with the label 4, the right
edge. // ..
The loading is expressed as
a parabolic load in the local / .
edge parameter s [0, 1].
Page 28 of 40

Go Back
Figure F.24: Boundary settings for our model problem.

Close

Quit
Universitetet i Oslo

There exists two ways to gen-


erate a mesh
Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Triangulation, generat-
ing triangular elements, Avdeling for Mekanikk
and Geir Skeie
mapped meshing, result-
ing in quadrilateral ele-
ments.
Figure F.25: The mesh menu.
Contents

// ..

/ .
The exercise asks for quadri-
lateral elements However let
Page 29 of 40
us first generate a triangular
mesh. The mesh density is set Using
Go Back
using the command

Mesh Mesh Parameters Close

Figure F.26: Mesh settings for the triangular mesh algo- Quit

rithms.
the mesh setting above results in the mesh shown in the Figure below.
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Page 30 of 40
Figure F.27: Using triangles for the cantilever.
Go Back

Close

Quit
Universitetet i Oslo

COMSOL Multiphysics gener-


ate quadrilateral elements us-
ing mapped meshing. In order
to do this we or the program Subdomain boundary nodes

Subdomain interior nodes


Subdomain boundaries

needs to identify a quadrilat-


eral. This is specified using the Avdeling for Mekanikk
dialog box Geir Skeie

Mesh Map Mesh

The dialog defines the edge


group defining the quadrilat- Figure F.28: Selecting the quadrilateral used in mapped
Contents
eral. meshing.
// ..
Next we specify the number of elements along the edges
/ .

Page 31 of 40

Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Page 32 of 40

Go Back

Close
The above settings generate the mesh below
Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Figure F.29: The quadrilateral mesh. Page 33 of 40

Go Back

Close

Quit
Universitetet i Oslo

We can now solve the problem. Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Solve Solve Problem


Avdeling for Mekanikk
The symbol = defines the Geir Skeie
short cut command found in
the Main toolbar.

Figure F.30: Solving the cantilever problem. Contents

We are now in the position to look at the results.


// ..

/ .

Page 34 of 40
First, let us check if our
parabolic load distribution
produces the right resultant Go Back
The re-
force:
Close
Post processing Boundary Integration
Quit

Figure F.31: Checking the applied load.


Universitetet i Oslo

sults are shown in the Message log portion of the GUI.

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Figure F.32: The value of the integral is shown in the Message log window.

Contents

// ..

Also, we may check the de- / .


formed shape over-layed a
contour plot of the axial Page 35 of 40

stresses, xx .
Go Back
Post processing Plot Parameters
Close

Quit

Figure F.33: Activate the deformed shape and setting the


contour values.
Universitetet i Oslo

The result is shown in the figure below.

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Page 36 of 40

Figure F.34: Deformed shape with xx contour plot. Go Back

Close

Quit
Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Finally, we shall look at the


axial stresses, xx , at x = 12.
Contents

Post processing
// ..
Cross-Section Plot Parameters

/ .

Page 37 of 40

Go Back

Close

Figure F.35: Cross section plot parameters. Quit

The stress variation is shown in the figure below.


Universitetet i Oslo

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Page 38 of 40

Go Back

Close

Quit
Figure F.36: xx variation at x = 12.
Universitetet i Oslo

F.6. Can you run COMSOL Multiphysics on Windows?

It is possible to run COMSOL Multiphysics on Windows. However you have to use your Win- Subdomain boundary nodes Subdomain boundaries

dows machine as a terminal towards the machines at UiO. This means that you have to be Subdomain interior nodes

able to run X-Windows on your PC.


Avdeling for Mekanikk
Geir Skeie

Contents

// ..

/ .

Page 39 of 40

Go Back

Close

Quit
Universitetet i Oslo

G. References

Subdomain boundary nodes Subdomain boundaries

Subdomain interior nodes

Avdeling for Mekanikk


Geir Skeie

Contents

// ..

/ .

Page 40 of 40

Go Back

Close

Quit

Potrebbero piacerti anche