7/30/2019 Comsol Cookbook
1/18
Sakari's Quick
Cookbook for
Multiphysics
Modeling
Version 2007-01-15 Comsol Oy, 2007
Sakari's Quick Cookbook for Multiphysics Modeling Page 1
7/30/2019 Comsol Cookbook
2/18
Table of Contents
1 Selecting Application Modes........................................................................................................... 3
1.1 Heat Transfer, 2D..................................................................................................................... 3
1.2 Heat Transfer, 3D..................................................................................................................... 31.3 Standard Package, Application modes......................................................................................3
1.4 Heat Transfer Module, Application modes...............................................................................4
2 Geometry Modeling and CAD Tools............................................................................................... 5
2.1 Importing CAD Drawing..........................................................................................................5
2.2 CAD Import Options................................................................................................................ 5
2.3 Exporting Geometry (DXF)......................................................................................................5
2.4 Adding Geometric Objects....................................................................................................... 5
2.5 Modifying Objects....................................................................................................................6
2.6 Object Composition.................................................................................................................. 6
2.7 Specifying Grid and Axes.........................................................................................................6
2.8 Using Work Planes................................................................................................................... 62.9 Using Assemblies..................................................................................................................... 6
2.10 Visualization Tools................................................................................................................. 7
3 Modeling Physics and Equations......................................................................................................7
3.1 Entering Material Properties.....................................................................................................7
3.2 Specifying Boundary Conditions..............................................................................................8
3.3 Specifying Application Mode Properties..................................................................................9
4 Meshing.......................................................................................................................................... 10
4.1 Triangular (free) meshing.......................................................................................................10
4.2 Quadrilateral (brick, mapped) meshing................................................................................. 10
4.3 Other Meshing options............................................................................................................10
5 Solving the Model.......................................................................................................................... 11
5.1 Solver settings.........................................................................................................................11
5.1.1 Stationary solver settings................................................................................................ 11
5.1.2 Time-dependent solver settings...................................................................................... 12
5.1.3 Parametric solver settings............................................................................................... 13
5.2 Solver Manager.......................................................................................................................13
5.3 Quick and Easy Solutions.......................................................................................................14
6 Postprocessing and Visualization...................................................................................................15
6.1 Plot Parameters....................................................................................................................... 15
6.2 Creating Animations...............................................................................................................17
7 Documentation and Model Management....................................................................................... 187.1 Creating HTML Summary......................................................................................................18
7.2 Adding Model Description..................................................................................................... 18
7.3 Adding Model Image..............................................................................................................18
7.4 Maintaining User Model Library............................................................................................18
Sakari's Quick Cookbook for Multiphysics Modeling Page 2
7/30/2019 Comsol Cookbook
3/18
1 Selecting Application Modes
For heat transfer problems you usually need one of the heat transfer application modes to model the
temperature fields and a fluid dynamics application mode to model the air (or liquid) flow.
If you have Heat Transfer Module, use it's application modes, otherwise use standard package's
modes. Application modes from Heat Transfer Module have more features than the ones from the
standard package.
1.1 Heat Transfer, 2D
Open Model Navigator (File->New).
Select Space Dimensions: 2D.
1.2 Heat Transfer, 3D
Open Model Navigator (File>New).
Select Space Dimensions: 3D.
1.3 Standard Package, Application modes
Comsol Multiphysics->Heat Transfer->Conduction
For heat conduction problems
Contains basic boundary (BC) conditions
heat flux, (convective flux for convection), temperature, insulation, and continuity
Comsol Multiphysics->Heat Transfer->Convection and Conduction
For convective heat problems
Sakari's Quick Cookbook for Multiphysics Modeling Page 3
7/30/2019 Comsol Cookbook
4/18
Contains basic boundary conditions
Standard package's Heat Transfer application modes can also model simple radiation term (see heat
flux boundary condition's equation).
Comsol Multiphysics->Fluid Dynamics->Incompressible Navier-Stokes
Laminar, constant temperature flows
Basic boundary conditions:
inflow/outflow velocity, pressure, slip/symmetry, no slip, normal flow/pressure,
neutral
1.4 Heat Transfer Module, Application modes
Heat Transfer>General Heat Transfer
Heat transfer by conduction, convection, and radiation
Convection and conduction terms can be switched on and off in subdomain settings.
More options in boundary conditions including: radiation type and highly conductive layers
Heat Transfer>Non-isothermal Flow
Temperature dependent laminar flow
Laminar inflow/outflow boundary condition
Heat Transfer>k-e Turbulence Model
Turbulent flow
Heat Transfer>Fluid-Thermal Interaction
Ready made multiphysics application modes for combined flow and heat problems
If laminar flow, use non-isothermal flow
If turbulent flow, use turbulence coupling
You can also turn turbulence on/off from Physics>Properties.
Sakari's Quick Cookbook for Multiphysics Modeling Page 4
7/30/2019 Comsol Cookbook
5/18
2 Geometry Modeling and CAD Tools
Once CAD file is imported you can edit and modify your geometry as it would been drawn with
Comsol Multiphysics.
2.1 Importing CAD Drawing
Select from menu: File>Import>CAD Data From File.
Supported formats 2D
DXF, GDS, Comsol Multiphysics (*.mphtxt, *.mphbin)
Supported 3D formats
STL, VRML, Comsol Multiphysics
Additional in CAD Import Module IGES (*.igs, *iges)
Parasolid (*.x_b, *x_t, *.xmt_txt, *xmt_bin)
SAT (*.sat, *sab, *.xml)
STEP (*.step, *.stp)
2.2 CAD Import Options
You can import both solid and curve objects and choose how to try convert edges to solids.
Repair tolerance is relative to the dimensions of the CAD drawing (1e-2 == 1%, 1e-3 == 0.1%, 1e-4
= 0.01%).
2.3 Exporting Geometry (DXF)
For exporting 2D geometry objects to a DXF file, select Export>Geometry To File in the File menu.
Then, choose DXF file in the Files of type list and click Save.
In 3D only Comsol Multiphysics formats (*.mphtxt, *.mphbin) are supported.
2.4 Adding Geometric Objects
Drawing tools are found from Draw menu or toolbars.
Click one of the draw buttons to draw by mouse, shift click to specify by coordinates.
Drawing objects (2D):
Rectange/Square or Rectangle/Square (Centered)
Ellipse/Circle or Ellipse/Circle (Centered)
Point and Line
2nd or 3rd Degree Bezier Curve
Drawing objects (3D):
Block, Cone, Cylinder, Ellipsoid, and Sphere
Sakari's Quick Cookbook for Multiphysics Modeling Page 5
7/30/2019 Comsol Cookbook
6/18
Point and Line
In addition you can use 2D work planes and embed, extrude or revolve 2D objects into 3D
2.5 Modifying Objects
To modify object
Draw>Object properties
To copy object
Copy - CTRL+C (or Edit>Copy)
Paste - CTRL+V (or Edit>Paste)
Toolbar buttons common for 2D and 3D
Array - create and (copied) array of the selected object(s)
Mirror - copy and flip the selected object(s) around the reflection line
Move - displace the selected object(s) by the specified distance
Rotate - rotate around specified rotation point
Scale - scale the object(s) by the scale factor
2D tools only
Fillet/Chamfer - round the sharp corners
Tangent - create tangent lines between edges and points
2.6 Object Composition
Union, Intersection, Difference - create a composite of selected objects
Create Composite Object - arbitrary composition by using dialog
Coerce to Solid, Coerce to Face (3D only), Coerce to Curve
convert objects to solid, face or curves
Split object
Delete Interior boundaries
2.7 Specifying Grid and Axes
Options>Axes/Grid Settings
2.8 Using Work Planes
Draw>Work Plane Settings
2.9 Using Assemblies
Draw>Use Assembly
Draw>Create Pairs
Sakari's Quick Cookbook for Multiphysics Modeling Page 6
7/30/2019 Comsol Cookbook
7/18
2.10 Visualization Tools
Options>Visualization/Selection Settings
Options>View Geometries
Options>Zoom (also in toolbar)
Options>Suppress Options>Labels
3 Modeling Physics and Equations
This chapter explains a range of methods you can use when building models in COMSOL
Multiphysics.
3.1 Entering Material Properties
Select Physics>Subdomain Settings. Material properties can be constants, expressions, or functions.
Subdomains
The model is splitted into subdomain volumes according to geometric boundaries
Groups
You can group and name similar subdomains
Select by group
Select similar subdomains
Active in this domain
Select which subdomains are involved in calculations
Library material
Material properties are taken from material library
Sakari's Quick Cookbook for Multiphysics Modeling Page 7
7/30/2019 Comsol Cookbook
8/18
Use Load button to explore the material libraries
Modify material libraries from Options>Material Library
Init
Initial values for modeling
3.2 Specifying Boundary Conditions
Select Physics>Boundary Settings.
Select Boundaries from the list and change the boundary condition from drop down list.
Additional tabs are used for special boundary conditions.
Sakari's Quick Cookbook for Multiphysics Modeling Page 8
7/30/2019 Comsol Cookbook
9/18
3.3 Specifying Application Mode Properties
Application Mode specific properties are found from Physics>Properties and unit dependent scalar
variables from Physics>Scalar Variables.
Sakari's Quick Cookbook for Multiphysics Modeling Page 9
7/30/2019 Comsol Cookbook
10/18
4 Meshing
4.1 Triangular (free) meshing
Select Mesh>Free Mesh Parameters.
4.2 Quadrilateral (brick, mapped) meshing
Select Mesh>Mapped Mesh Parameters.
4.3 Other Meshing options
The On-line Users Guide illustrates the use of meshing tools with several examples.
Sakari's Quick Cookbook for Multiphysics Modeling Page 10
7/30/2019 Comsol Cookbook
11/18
5 Solving the Model
5.1 Solver settings
If you have selected the right analysis type from the Model Navigator, you can just press the Solve
button. To change the analysis type and the solver settings select Solve>Solver Parameters.
5.1.1 Stationary solver settings
Analysis
Sets up equations in the application mode (see also Physics>Properties)
Auto select solver
Analysis type sets up also automatically the solver
Solver
For Heat Transfer problems: Stationary, Time dependent or Parametric
Linear system solver
Try first the default settings, they have been automatically selected according your
application mode selections If you know good settings for your problem, use those
Otherwise see Users Guide>Linear System Solver Selection Guidelines
Sakari's Quick Cookbook for Multiphysics Modeling Page 11
7/30/2019 Comsol Cookbook
12/18
5.1.2 Time-dependent solver settings
General page
Times
Syntax: start:step:stop
the default example 0:0.1:1, from 0 to 1 sec with step of 0.1
Relative and Absolute tolerances
Affect on accuracy of the solution in time
Time stepping page
Time steps taken by solver
Use (always) Intermediate, solver is forced to calculate the values at the times you have
specified on the general page, but between those values it can step freely
Advanced pageStore solution on file
Use this if you have problems with out-of-memory
Sakari's Quick Cookbook for Multiphysics Modeling Page 12
7/30/2019 Comsol Cookbook
13/18
5.1.3 Parametric solver settings
Give the name of parameter and list of parameter values and you are done.
5.2 Solver Manager
Select Solve>Solver Manager.
By changing Initial values and Solve For Variables you can iteratively and sequentially find a
solution for complex problems.
Initial value
These values affect on the variables you are solving for now
Sakari's Quick Cookbook for Multiphysics Modeling Page 13
7/30/2019 Comsol Cookbook
14/18
Initial value expression evaluate the expression in init page (Subdomain and boundary
settings)
Current solution continue from the values you have solved so far
Stored solution used together with the Store Solution button, you can store one previous
solution, which is different from current solution
Values of variables not solved and linearization point
If you are solving your model sequentially, used combination with Solve for Variables page
Use settings from Initial value frame use same setting as for initial value
5.3 Quick and Easy Solutions
Changing element type
Select Physics>Subdomain settings and change the element type to linear
Static problem
Use nonlinear solver (GMRES, Conjugate Gradients, Geometric Multigrid)
Increase Relative Tolerance in Solver Parameters>Stationary page
Drop maximum number of iteration value, try for example, 1 (!)
Time-dependent problem
Increase relative and absolute tolerance in Solver Parameters
Sakari's Quick Cookbook for Multiphysics Modeling Page 14
7/30/2019 Comsol Cookbook
15/18
6 Postprocessing and Visualization
6.1 Plot Parameters
To change the default postprocessing plot select Postprocessing>Plot Parameters.
Predefined quantities
Lists predefined quantities
Expression
Enter custom expression
Example: sqrt(T)+3
Unit
For predefined expressions you can select unit from the list
Color scale
Adds a scale to right of the postprocessing graphics
Sakari's Quick Cookbook for Multiphysics Modeling Page 15
7/30/2019 Comsol Cookbook
16/18
General settings
Plot type
Check those plots you want to display simultaneouslySolution to use
For time-dependent and parametric models you can select the solution (time or parameter
value)
Element selection
In 3D cases can be used for select part of the geometry
Example: x > 0.05 (select the elements having x-coordinate greater than 0.05)
Plot in
Either to main GUI or separate figures
Sakari's Quick Cookbook for Multiphysics Modeling Page 16
7/30/2019 Comsol Cookbook
17/18
6.2 Creating Animations
You can create animations for time-dependent and parameteric studies by selecting Animatepage
from Postprocessing>Plot Parameters.
Solutions to use
Select the solutions to animation
Use camera settings from main window
Use the axis settings from GUI
Start Animation
Create the movie
Movie Settings
Select the movie type, resolution
Press Advancedbutton to change encoder and compression level.
Sakari's Quick Cookbook for Multiphysics Modeling Page 17
7/30/2019 Comsol Cookbook
18/18
7 Documentation and Model Management
7.1 Creating HTML Summary
Select File>Generate Report.
7.2 Adding Model Description
Select File>Model Properties, and Description settings.
This with the the model image are shown in Model Navigator's User Models page.
7.3 Adding Model Image
Click File>Save Model Image.
7.4 Maintaining User Model Library
Select File>Open Model Library.
Select User Models page.
ClickLibrary root button
Select the root of your own model
Keep all your models in one structured folder, for example C:\models. Use that as the Library rootof User models. Create subfolders for each new project and keep all project related model in same
folder. Use numbering for versions and remember enter Model Description and update the model
image before saving new version.
Sakari's Quick Cookbook for Multiphysics Modeling Page 18
http://c/modelshttp://c/modelsTop Related