Académique Documents
Professionnel Documents
Culture Documents
DAY 1
Course presenter:
Christiaan Hattingh
MTC
COMSOL South Africa
Niklas Rom, Anders Ekerot, Christiaan Hattingh
COMSOL AB
2.
3.
4.
5.
3.
To a folder on the desktop or some other place that is easy to access. We will use these files during the training at
various stages.
Please call me and return the flash drive before proceeding, or pass the flash drive on to other attendants who still
need to copy the files. I will then give you a trial pack with the install disc.
You will be prompted to accept the license agreement and then to enter a passcode or license file.
Windows/Mac users select the passcode option. Browse to the files you have copied (using file explorer!) and
open the trial license txt file. In the file you will find the passcode. Copy and paste the whole code into the relevant
input box (using Ctrl-V).
Users of Linux select the license file option and then browse and select the file via the button (the file is in the
folder of copied files from the flash drive).
Just use the default install options as you proceed through the install wizard, ie click next, next until you reach
the button install then click on it and the install process will start.
In the folder you copied from the flash disc there are some hotfix patch files in a folder (4_2_updatesAndHotfixes)
for windows there are .exe files, for mac dmgs and for linux zip files please install at least the multiphysics
patch from these, the others are not essential for the workshop.
You may use the trial pack for install on another computer/for other colleagues at your
company/institution just use the same passcode that you received today. The license
is valid for about two weeks. The exact date of expiry is listed inside the passcode file.
Agenda Day 1
Equation-based modeling
PDEs
PDEs and ODEs
PDEs and distributed ODEs
DAEs
Complex valued equations
Structure
1. Presentations
1.
2.
Slides
Included in your file pack as PDF for reference after the course.
2. Demonstrations (interactive)
1.
2.
Presenter will demonstrate in COMSOL 4.2a: you can either just follow the
demonstration or you can participate...your choice.
Demonstration models are included in your file pack.
3. Exercises
1.
COMSOL Multiphysics
Single physics
Multiphysics
Adaptable
Predefined Multiphysics
User defined Multiphysics
Non-linear equations
PDE
ODE and DAE
3D mesh of a power
transistor
Visualization of
temperature distribution
Acoustics
Structural analysis
Mass transport
Electromagnetism
Fluid dynamics
Heat transfer
Multiphysics
Induction heating
Acoustic-Structure interaction
Non-isothermal fluids
Fluid-Structure interaction
User defined
CAD Import
STEP, IGES, SAT, Parasolid,
Repair and defeaturing
More flexibility in geometry modeling
Live Links
SolidWorks
Pro/E, CREO Parametric
Autodesk Inventor, AutoCAD
SpaceClaim
C3
C5
C6
C1
C4
C2
Remove C5, C6
Modify C1 or C4
C4
C1
C2
CAD File
Designers
Analysis
Staff
This cannot be
defeatured by
COMSOL
Downloaded from
thomasnet.com
272K DOF
BAD
GOOD
935 elements
12,556 elements
Try interactive
surface meshing
This is a mesh on
the surface only,
but it can visually
guide you to the
problem areas
Remember:
Good CAD data has just enough detail to capture the
physics, but not one detail more.
Meshing Overview
Interactive Meshing
More Features
Extrude and Revolve 2D Meshes
Copy Meshes
Mesh Import (Nastran)
Mesh Statistics
Mesh Visualization
2D
Triangular and quadrilateral
1D
Discretized domains into intervals
Mapped
Free tetrahedral
Mixed
Boundary layer
Swept
Adaptive
3D Geometry Import
Boundary layers
Different features
Combine different
techniques
Free quad
Free triangular
Mesh statistics
Plot different elements
Mesh quality criteria
Cyan Prism
Green Pyramid
Hex - Magenta
32
1.000
0.995
0.990
0
Refinement Iteration
Review
By now, you should know
Different options for drawing a geometry using COMSOLs CAD system.
How to deal with imported CAD geometries, to examine CAD geometries and
repair them. (but alas, the real world awaits...)
Different meshing options and techniques, and analysing and plotting your
mesh.
The impact of geometry quality and features on the discretization of the model
(mesh), and consequently/additionally...
The impact of mesh size and quality on simulation time and the results of the
simulation (relative error).
BREAK?
Involved physics
Electric currents DC
Heat Transfer
Thermal expansion
( eV ) 0
Single physics
Linear
No source terms
Ground
15 A
( eV ) 0
Q = e|V|2
( T (T )T ) Q
Heat transfer
T
One way coupled multiphysics
Coupling through Load
Non-linear problem, T(T)
T = 20 C
T=?
( eV ) 0
e T
Q = e|V|2
( T (T )T ) Q
Heat transfer
T
Two way coupled
Non-linear
Couplings through load (strong) and
material property (weak)
T = 20 C
T=?
Free
( eV ) 0
e T
Q = e|V|2
( T (T )T ) Q
Heat transfer
Fixed
T Tref
Solid Mechanics
u, v, w
Fv
One-way coupled
Two-way coupled
Weakly coupled
The results of one physics affects both that, and other, physics
Fully coupled
The results from one physics affect the material properties of other physics most often
this is temperature.
Non-linear coupled
The results from one physics affect only the loading on the other physics. In an equation
this is the source term (right-hand side).
Material coupled
Load coupled
Strongly coupled
If you are running out of memory, or the solution time is very long:
Try an iterative solver
Use the segregated solver and select the optimal solver (direct or iterative) for
each physics, or group of physics, in the problem. FOR 3D, START HERE!
Upgrade hardware
All solutions are stored in data sets. Several data sets can be stored from a single study or from
multiple studies.
When visualizing data you can plot in 1D, 2D or 3D depending on the data set and application
thereof to the plot group.
You can also create special data sets which refer to other data sets:
On a specified selection of geometric entities in the model or by creating your own
geometry intersecting with the domain/boundaries.
By combining data sets with the join feature.
The Derived Values section allow for scalar evaluations of quantities that either exist in the
default variable list or as created by yourself. Probe evaluations will also be stored here.
The evaluations will also be stored in the tables section and can be plotted or exported. If you
do a manual point and click evaluation on a surface plot, for example, it will also be stored in a
table.
In the export section you can define various ways of exporting data referring to a specific plot
group so once it is set up it is easy to export in a specific format with a single click. Some of
these export options are available directly above the graphics window, in the case where you
just want to quickly export an image, for example.
Finally, there is the automated report generator you can also customize the template to export
exactly the data you want.
Busbar
Power transistor
Boat radar cross section
Plot exercise in the PDF exercise book p.46-62
You can also browse in the Model library for other models
Exercise - Busbar
Electric conductor, typically found in high
power applications
Parameterized Geometry
Joule Heating
Thermal Expansion
Flow and Cooling
All files needed on product DVD in Model
Library
Incident field
End of session 2
BREAK?
Equation-Based Modeling:
PDEs, ODEs, and Algebraic Equations
2u
u
ea 2 d a
(cu u ) u au f
t
t
Content
Partial Differential Equations (PDEs)
PDE Interfaces
Boundary Conditions
Algebraic Equations
Global algebraic equations
Distributed algebraic equations
Custom-Modeling in COMSOL
Customization Approaches
PDEs
u 0
Laplaces equation
Heat equation
ut (ku) 0
Wave equation
utt (u) 0
Helmholtz equation
(u) u
ut bu x 0
Coefficient form
Coefficients correspond to common physical parameters (e.g., diffusion,
advection, etc.)
General form
Very flexible and compact
Weak form
PDE form that is the foundation of the FEM
Integral form that gives even more flexibility
Requires more expert knowledge
Q: Which to use?
A: Whichever is more convenient for you and your simulation.
2u
u
ea 2 d a
(cu u ) u au f
t
t
n (c u u ) qu g hT
hu r
inside
domain
on boundary
u 1
u0
inside subdomain
on subdomain boundary
Demo:
Block: 10x1x1
PDE: default Poissons
equation with unknown u.
Dirichlet boundary
condition everywhere: u=0
Demo:
ux uxz, d(u,x),
ux,
smoothing
file: Poisson_Default.mph
diffusion
source
absorption
2u
u
ea 2 d a
(cu u ) u au f
t
t
mass
damping/
mass
convection
convection
source
initial/thermal
stress
2u
u
ea 2 d a
(cu u ) u au f
t
t
mass
damped
mass
body force
(gravitation)
ea
density
da
damping coefficient
cu
diffusion
source
absorption
2u
u
ea 2 d a
(cu u ) u au f
u
t
accumulation/storage
convection
convection
source
Helmholtz term
2u
u
ea 2 d a
(cu u ) u au f
u
t
Helmholtz equation:
(cu ) k 2u f
a k 2
k
Wave number
Wave length
source
Demo:
lambda=2.5
k=2*pi/lambda
a= - k^2
f=0
u=1 one end
file: Helmholtz.mph
2u
u
ea 2 d a
(cu u ) u au f
u
t
source
accumulation/storage
d a C
ck
f volume heat source
Demo:
c=1
da=1
f=0
Transient 0->100
0
s
file: Transient_Diffusion.mph
u
u
inside domain
ea 2 d a
F
t
t
T
on domain boundary
n G
u
0R
ux uy F 1
R u.
Weak Form
u
da
F
t
General form
Rearranged
u
da v t dA v dA vFdA
u
da v t dA v n ds v dA vFdA
u
0 v vF d a v dA v n ds
t
2u
u
ea 2 d a
(cu u ) u au f
t
t
u 1
Using Weak Form:
-test(ux)*ux - test(uy)*uy + test(u)*f = 0
(f=1)
PDEs+ODEs
w U dt
t
U udV
V
dw
w U dt
U
dt
t [ t 0 ,t1 ]
wt U 0
Time
Time-dependent
0,10,100
Volume integration of u
ODE: wt-U
file: Transient_Diffusion_with_ODE.mph
Demo
3.
4.
P( x, y, z ) u ( x, y, z )dt
P( x, y, z ) u ( x, y, z )dt
dP
dP
u local time integral of solution
dt
But this can be seen as a PDE with no spatial derivatives =
= Distributed ODE
Use coefficient form with unknown field P, f = u, da=1
Let all other coefficients be zero
file: Transient_Diffusion_with_distributed_ODE.mph
2u
u
ea 2 d a
(cu u ) u au f
u
t
P( x, y, z ) u ( x, y, z )dt
2) assume that for the damage locations the diffusion coefficient takes
a different value:
c=1+2.75*(P(x,y,z)>20)
Phase Change
Phase Change
Phase change: c=1+2.75*(P(x,y,z)>20)
Also:
P( x, y, z ) (u ( x, y, z ) 1)dt
t
Irreversible change!
Phase Change
More advanced phase change: c=1+2.75*(P(x,y,z)>20)
Also:
P( x, y, z ) (u ( x, y, z ) 1)dt
t
For convergence:
inequalities may need smoothing:
P>20
u>1
Phase Change
More advanced phase change: c=1+2.75*(P(x,y,z)>20)
Also:
P( x, y, z ) (u ( x, y, z ) 1)dt
t
For convergence:
inequalities may need smoothing:
P>20
u>1
file: Transient_Diffusion_with_distributed_ODE_and_pchange.mph
(kT ) C u T 0
Easy - analytical
pM
RT
(kT ) C u T 0
A * ( p B 2 )(1 C ) D 0
How to solve:
Third order equation in
Pressure p is function of space
So: this is an algebraic equation at each point in space!
(distributed)
How to solve:
A * ( p B 2 )(1 C ) D
Third order equation in
Pressure p is function of space
So: this is an algebraic equation at each point in space
See as PDE with no space or time derivatives!
A*(p+B*rho^2)*(1-C*rho)-D*rho
or if unknown is u:
A*(p+B*u^2)*(1-C*u)-D*u
How: Put the entire equation in the source (f) term and zero out the rest
file: Distributed_Algebraic_State_Law.mph
If we let p=x*y and let our modeling region be the unit square, then at
(x,y)=(0,0) we should get the unique solution u=2 but at (x,y)=(1,1) we get
1 or 3 depending on our starting guess. See next slide.
u=2
u=2
u=1
file: Distributed_Algebraic_Second_Order.mph
z we w
z x iy
w w( z )
we z we ( x i * y )
w
Complex Arithmetics
Can compute:
real(w)
imag(w)
abs(w)
arg(w)
conj(w)
imag(w)
file: Lambert_W.mph
End of session
BREAK?
Computational Challenges
Parallel computing
Shared memory
COMSOL uses all available cores
Mesh, solvers, postprocessing...
Free of charge
Core
Host/Computer
COMSOL process
Clusters
Client Server/Remote
desktop
One or several
clients
Head node
Subnodes
Processor core
A COMSOL job can use many
cores in parallel in a node by
Shared-memory processing
Node
A COMSOL job can use many nodes in
parallel by cluster computing
Start the COMSOL desktop GUI as a normal (non cluster) process on the
headnode. Then add a Cluster Computing feature to the model tree,
which branches off from the GUI a cluster job as a batch job.
head:~>comsol
Same as alternative 2 above, except that the COMSOL desktop is on a work computer,
separated from the cluster.
client/server
Parametric sweeps
Distributed
CPU
Cores
Communication Links
(MPI)
RAM
Definitions
Computational node:
COMSOL process.
Communicates with other
computational nodes through
MPI
nodes
COMSOL
Desktop
Windows HPC
Server 2008
Scheduler (job
manager)
Head
Node
nodes
nodes
Linux: COMSOL uses the Intel MPI library shipped with COMSOL
You can also configure COMSOL to work with most MPI
implementations based on MPICH2
P number of nodes
T1 Sequential execution time
Tp Parallel execution time
10
Speedup
Definition:
12
8
6
4
2
0
4
6
8
10
Number of Nodes
12
Notes on Results
As parallel computation per node increases,
speedup increases.
E.g., 600 frequencies has greater speedup than 60.
Consider the positive impact on optimization.
Theoretically speedup could be linear S p p.
End of Session
4PM?
http://www.comsol.com/products/4.2a/