Professional Documents
Culture Documents
Subdomain boundaries
COMSOL Multiphysics: F
MEK4550 Elementmetoden i faststomekanikk I
(24. september 2007)
Contents
Foreleser:
Geir Skeie
Page 1 of 40
(E-post:ges@math.uio.no)
Go Back Close
Quit
Universitetet i Oslo
Innhold
F COMSOL Multiphysics F.1 What is COMSOL Multiphysics ? . . . . . . . . . . F.2 What documentation exists? . . . . . . . . . . . . F.3 Start-up . . . . . . . . . . . . . . . . . . . . . . . . F.4 Modeling in The Graphical User Interface . . . . . F.5 Using the Structural Mechanics Module . . . . . . F.6 Can you run COMSOL Multiphysics on Windows? G References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 4 5 8 20 39 40
Contents
Subdomain boundary nodes Subdomain interior nodes Subdomain boundaries
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 structural analysis based on the nite element method (FEM) ANSYS, and COMSOL Multiphysics . The present document is intended to help the students to get acquainted with the two codes in a way so that they may nd 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 rst version of the document we focus on COMSOL Multiphysics since we will use this in MEK4550.
Page 3 of 40
Subdomain boundary nodes Subdomain interior nodes Subdomain boundaries
Contents
Go Back
Close
Quit
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 lled tool box for solving PDEs in an approximate way using the FEM. Currently, the mechanics department has access to two of the COMSOL Multiphysics modules: COMSOL Multiphysics and Structural Mechanics Module.
Contents
Subdomain boundary nodes Subdomain interior nodes Subdomain boundaries
The rst is the generic tool for solving general PDEs, while the second module is a specialized version intended to solve general structural mechanics problems.
Relevant documentation may be found in dierent sections of the basic COMSOL Multiphysics module: Quick Start and Quick Reference provides a quick overview of COMSOL Multiphysics s capabilities and how to access them and a reference section containing lists of predened variable names, mathematical functions, COMSOL Multiphysics operators, equation forms, and application modes.
Go Back
Close
Quit
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 softwares application modes and how to use them to model dierent types of physics and to perform equation-based modeling using PDEs. 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. 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 multi-physics environment.
Contents
Page 5 of 40
Go Back
F.3. Start-up
The COMSOL Multiphysics graphical interface shown in this document is generated on Windows.
Close
Quit
Universitetet i Oslo
Subdomain boundaries
COMSOL Multiphysics may be started from the local machines by typing %femlab on the command-line. (The % is the command-line propt.) The window that now appears is shown below, Figure F.1, and termed the Model Navigator.
Contents
Page 6 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Avdeling for Mekanikk Geir Skeie You can access the COMSOL Multiphysics documentation through the Help button in the Graphical User Interface. Pressing F1 is also an option and produces the following screen, Figure F.2. We recognize the sections mentioned in section F.2.
Contents
Page 7 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Page 8 of 40
with appropriate boundary conditions. E is Youngs modulus and A is the truss section area. We use the Coecient Form in this case. The model navigator for this problem set-up is shown Figure F.3.
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
In the Model Navigator we select the space dimension and application modes to begin working on a new model, open an existing model we have already created, or open an entry in the Model Library. We note that we select LagrangeLinear elements.
Contents
Figure F.3: Model Navigator for a 1D example using the coecient form. In our problem the coecients in the equation are given by c = EA, a = 0, = 0, =0 and f = q
Page 9 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
If we press OK a new window appears, namely the Graphical User Interface, specialized to our current problem settings. In the Graphical User Interface we use commands, toolbars and dialog boxes to perform tasks.
Contents
Page 10 of 40
Figure F.4: The Graphical User Interface for our 1D model problem.
Go Back
Close
Quit
Universitetet i Oslo The menus in the Graphical User Interface contains three dierent menu sets: The top row is the Menu bar. The second row contains 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. At the bottom of the COMSOL Multiphysics user interface a status bar shows information and provides buttons for changing some user interface properties. The contents depend on the space dimensions of the current geometry in your model. Double-clicking a status bar button toggles Figure F.6: Status bar in the Graphical User Interface its features on and o. More for our 1D model problem. information may be found in the Users Manual, Geometry Modeling and CAD Tools .
Contents
Subdomain boundary nodes Subdomain interior nodes Subdomain boundaries
Page 11 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
The rst thing we may do is to set the geometry window to t our problem domain. We do this from the menu bar Options Axes/Grid Settings
Contents
Page 12 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
We may dene constants that may be used later in the modeling process Options Constants
Figure F.8: Constant expressions that may be used in our model problem.
Contents
Next we dene the geometry of our model problem We can do this in several ways. One option is to use the Draw Specify Objects Line
Page 13 of 40
Go Back
Close
Quit
Subdomain boundaries
The coecients of our truss example are specied in Physics Subdomain Settings Note that we are selecting a subdomain, with the label 1.
Contents
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Avdeling for Mekanikk Geir Skeie The essential boundary conditions are specied in the Physics Boundary Settings Note that we are selecting a boundary, with the label 1. The natural boundary conditions are applied to the boundary with the label 2. Figure F.11: Boundary settings for our model problem.
Contents
Page 15 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
The next item of our list of operations is to specify mesh control parameters Mesh Mesh Parameters In the current analysis we select 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 boundaries
Contents
Figure F.14: The axial deformation along the truss axis, two elements. The model problem may be re-generated form the .m-le.
% COMSOL Multiphysics Model M-file % Generated by COMSOL 3.2 (COMSOL 3.2.0.222, $Date: 2005/09/01 18:02:30 $)
Page 17 of 40
Go Back
Close
Quit
Universitetet i Oslo
clear vrsn vrsn.name = COMSOL 3.2; vrsn.ext = ; vrsn.major = 0; vrsn.build = 222; vrsn.rcs = $Name: $; vrsn.date = $Date: 2005/09/01 18:02:30 $; fem.version = vrsn; % Constants fem.const = {EA,1, ... q,1}; % Geometry g1=solid1([0,2]); clear s s.objs={g1}; s.name={I1}; s.tags={g1}; fem.draw=struct(s,s); fem.geom=geomcsg(fem); % Initialize mesh fem.mesh=meshinit(fem, ... hmax,[1]); % (Default values are not included) % Application mode 1 clear appl appl.mode.class = FlPDEC; appl.assignsuffix = _c; clear prop prop.elemdefault=Lag1; appl.prop = prop; clear bnd
Subdomain boundaries
Contents
Page 18 of 40
Go Back
Close
Quit
Universitetet i Oslo
bnd.type = {dir,neu}; bnd.ind = [1,2]; appl.bnd = bnd; clear equ equ.c = EA; equ.da = 0; equ.f = q; equ.ind = [1]; appl.equ = equ; fem.appl{1} = appl; fem.border = 1; fem.units = SI; % Multiphysics fem=multiphysics(fem); % Extend mesh fem.xmesh=meshextend(fem); % Solve problem fem.sol=femlin(fem, ... solcomp,{u}, ... outcomp,{u}); % Save current fem structure for restart purposes fem0=fem; % Plot solution postplot(fem, ... liny,{u,cont,internal}, ... lincolor,[0.0,0.0,0.0], ... title,Line: u, ... refine,5, ... axis,[-0.1,2.1,-0.025,0.525,-1,1]);
Page 19 of 40 Contents
Subdomain boundaries
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
y
Contents
P = 40
12
48
Page 20 of 40
Go Back
Close
Figure F.15: Shear loaded cantilever beam. The geometry and loading is shown. The isotropic material is specied by, E = 30000, = 0.25 and t = 1.
Quit
Universitetet i Oslo The problem input data is given in Figure F.15. Model the problem in COMSOL Multiphysics using the Structural Mechanics Module. Find the vertical displacement at (48, 0) using a 4 1 rectangular element mesh and linear Lagrange shape functions. Model the problem in COMSOL Multiphysics using the Structural Mechanics Module. 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.
Subdomain boundaries
Contents
Page 21 of 40
Go Back
Close
Quit
Universitetet i Oslo
We start COMSOL Multiphysics and selects the right settings from the Structural Mechanics Module. The problem is 2D, plane stress and static with linear Lagrange elements. We select this under Application Modes:
Subdomain boundaries
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 boundaries
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 for our 2D model problem.
Page 23 of 40
Go Back
Close
Quit
Universitetet i Oslo
The rst thing we may do is to set the geometry window to t our problem domain. We do this from the menu bar Options Axes/Grid Settings
Subdomain boundaries
Contents
We may dene constants that may be used later in the modeling process Options Constants
Page 24 of 40
Go Back
Close
Quit
Figure F.19: Constant expressions that may be used in our model problem.
Universitetet i Oslo
Subdomain boundaries
Next we dene the geometry of our model problem. We can do this in several ways. One option is to use the 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 boundaries
Contents
Page 26 of 40
Go Back
Close
Quit
Universitetet i Oslo
Next we specify the Physics of our model problem. This consist of material data, essential and natural boundary conditions. Physics Subdomain Settings Note that we are selecting a subdomain, with the label 1. We are also using the constants that we dened at startup.
Subdomain boundaries
Contents
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 conditions are specied in the Physics Boundary Settings 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 conditions are applied to the boundary with the label 4, the right edge. The loading is expressed as a parabolic load in the local edge parameter s [0, 1].
Subdomain boundaries
Contents
Page 28 of 40
Go Back
Close
Quit
Universitetet i Oslo
Triangulation, generating triangular elements, and mapped meshing, resulting in quadrilateral elements. Figure F.25: The mesh menu.
Contents
The exercise asks for quadrilateral elements However let us rst generate a triangular mesh. The mesh density is set using the command Mesh Mesh Parameters Figure F.26: Mesh settings for the triangular mesh algorithms. the mesh setting above results in the mesh shown in the Figure below.
Page 29 of 40
Using
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Contents
Page 30 of 40
Go Back
Close
Quit
Universitetet i Oslo COMSOL Multiphysics generate quadrilateral elements using mapped meshing. In order to do this we or the program needs to identify a quadrilateral. This is specied using the dialog box Mesh Map Mesh The dialog denes the edge group dening the quadrilat- Figure F.28: Selecting the quadrilateral used in mapped eral. meshing. Next we specify the number of elements along the edges
Subdomain boundaries
Contents
Page 31 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Contents
Page 32 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Contents
Page 33 of 40
Go Back
Close
Quit
Universitetet i Oslo
Solve Solve Problem The symbol = denes the short cut command found in the Main toolbar. Figure F.30: Solving the cantilever problem. We are now in the position to look at the results. Avdeling for Mekanikk Geir Skeie
Contents
First, let us check if our parabolic load distribution produces the right resultant force: Post processing Boundary Integration
Page 34 of 40
The re-
Go Back
Close
Quit
Universitetet i Oslo sults are shown in the Message log portion of the GUI.
Subdomain boundaries
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 deformed shape over-layed a contour plot of the axial stresses, xx . Post processing Plot Parameters
Page 35 of 40
Go Back
Close
Quit
Figure F.33: Activate the deformed shape and setting the contour values.
Subdomain boundaries
Contents
Page 36 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Page 37 of 40
Go Back
Close
Figure F.35: Cross section plot parameters. The stress variation is shown in the gure below.
Quit
Universitetet i Oslo
Subdomain boundaries
Contents
Page 38 of 40
Go Back
Close
Quit
Universitetet i Oslo
Subdomain boundaries
Contents
Page 39 of 40
Go Back
Close
Quit
Universitetet i Oslo
G. References
Subdomain boundary nodes Subdomain interior nodes Subdomain boundaries
Contents
Page 40 of 40
Go Back
Close
Quit