Sie sind auf Seite 1von 109

Results

Results = Postprocessing section


Working with Data Sets
Getting Derived Values
Cross section plots
Revolving solution
Report = Exporting results

Menubar options

Point evaluation

Cut lines

Cut planes

Slice
Isosurface
Volume
Surface
Line (edge)
Arrow (in volume)
Streamline
Animate (transient
and parametric only)

Data Sets Solution and Selection


2
Choose desired
geometric level
1

3
Select the desired
geometric entities

Results can be
visualized only on
the desired
geometric entities

Derived Values

Results > Derived Values


Allows you to evaluate and visualize numerical data
Automatically creates table under Results > Table
Integrate any spatially
dependent variable on
appropriate geometric
entity level
Evaluates a variable at a point
or geometric vertices
Evaluates global variables,
lumped parameters and built-in
physical constants

Cross sections Cut line


2

Create a cut line


by selecting any
two points

See the
coordinates under
Results > Data
Sets > Cut Line

3
Check the plot
along that cut line
in an automatically
created new 1D
Plot Group

Cross sections Cut plane


2

See the
coordinates
under
Results >
Data Sets >
Cut Plane

Create a cut plane

3
Check the plot along
that cut plane in an
automatically created
new 2D Plot Group

Revolving solution
See model file:
Example_results_revolve

2D solution

3D solution

Exporting results

Exported data can


be read into a
spreadsheet

Hands-on #6: Tuning Fork

Structural model
Eigenfrequency analysis
Mode shapes

Equation-based Modeling in COMSOL

PDEs, ODEs, and Algebraic Equations

Use COMSOLs GUI no need for subroutines

Why solve equations?


Purely mathematical problems
Combining predefined physics interface with additional equations
Represent physics which is not available in the predefined options

What does it mean to solve a PDE?


Well-posed problems; existence, uniqueness, and smoothness
Garbage in -> garbage out

COMSOL uses the finite element method (FEM) to numerically


approximate solutions

Equations interface: Classical PDEs


(u) u
u 0

u f
utt (u) 0

Built-in options for more common PDE forms


Easy to use if you can fit your problem into any of these forms
Available for 1D, 2D and 3D geometries

Equations interface: More options

Open-ended options for solving almost any PDE


Options to enter in either differential or integral (weak) form
Available for 1D, 2D and 3D geometries
ODEs and DAEs can be solved on 0D

Coefficient Form
In the domain

diffusion

source

absorption

2u
u
ea 2 d a
(cu u ) u au f
t
t

mass

damped
mass

convection

n ( cu u ) g

ur

convection

source

on boundary

Example: Poissons equation


u 1
u0

inside subdomain
on subdomain boundary

Implies c = f = 1 and all other coefficients are 0.

Coefficient Form: Structural Analysis


elastic stress

initial/thermal
stress

2u
u
ea 2 d a
(cu u ) u au f
t
t
mass

damped
mass

This is how
COMSOL solves
other physics

body force
(gravitation)

ea

density

da

damping coefficient

cu

stress

Stiffness, spring constant

Information on equation interface

PDEs can have as many variables (u1, u2, u3,)


Variables can be real or complex (u1 = a+j*b)
Coefficients can be almost anything
-

Scalar (numerical values)


Vector or tensors (for multiple variables)
Parameters and Variables (user-defined expressions)
Functions of spatial coordinates and time (non-linear in space and/or
time)
Functions of other physics variables (when PDE is coupled to another
predefined physics in a multiphysics model)
Functions of variables being solved for (nonlinear in solution space)
Derivatives of variables (highly nonlinear PDEs, also a way to
implement higher order equations)

Modeling using weak Form

The weak form is a variational statement of the problem in


which we integrate against a test function.
This has the effect of relaxing the problem; instead of finding
an exact solution everywhere, we are finding a solution that
satisfies the strong form on average over the domain.

Modeling using weak Form

Example1: Modeling using weak form Squeeze


film damping
Velocity v

pambient
h

lubricant
p < pambient

1 d h3 dp
r
v
r dr 12 dr
Boundary Conditions:

dp
0 at r = 0 and
dr

p = 0 at r = r0

Example2: Damped harmonic oscillator


m

Forces mu cu ku p(t ) 0
p(t)

u0 u0 , u0 u0

u u ku 0
u 0 1, u 0 0

2k , critically damped
2k , overdamped
2k , underdamped

Damped harmonic oscillator


See model file:
Example_harmonic_oscillator

overdamped, =100

beta is a parameter
critically damped, =10

2nd order ODE


0D model
Transient + Parametric

underdamped, =1

Example 2: CFD + Global equation


Set up and solve this Incompressible Steady State
Navier-Stokes fluid flow problem, (=1e3, =1e-3):
Wall, no slip
Inlet, Pressure,
no viscous stress
P = p_in

mass flux vd A

Outlet, Pressure,
no viscous stress

1 mm
4 mm

P = 0 Pa

Wall, no slip

Integration coupling
operator on inlet:

spf.rho*u*1[m]

Solution, exhibiting
entrance effect
The mass flux integral is taken per unit
length out of the modeling plane

155

CFD + Global equation


See model file:
Example_CFD_massflux

mass_flux_required is a parameter
mass_flux is a variable

Combine CFD + equation


Evaluate required pressure to get
desired mass flux at the inlet
2D model
Stationary + Parametric

Hands-on #7: Spherically Symmetric Transport

Spherical symmetry
represented as 1D
Equation-based model
Time-dependent

Linear and Nonlinear FEA

FEA formulation

Linear problem

Nonlinear problem

Suggestions on convergence

A very simple finite element problem...


k1 = 6 N/m

u1

p= 2 N

k3 = 4 N/m

k2 = 4 N/m

u3

u2

-k1(u3-u1)

We can write a force balance on each node:

Constraint Force

k1(u3-u1)

-k2(u2-u1)

k3(u3-u2)

-k3(u3-u2)
Node 3

c
k2(u2-u1)

Node 1

Node 2

Write the force balance as three equations:


k1(u3-u1) + k2(u2-u1) = c
k2(u2-u1) - k3(u3-u2) = 0
k1(u3-u1) + k3(u3-u2) = p
However, we now have three equations in four unknowns, c, u1, u2, u3

But we also have a constraint, u1=0

k1(u3 - 0 ) + k2(u2 - 0 ) = c
k2(u2 - 0 ) - k3(u3 - u2) = 0
k1(u3 - 0 ) + k3(u3 - u2) = p
Three equations, three
unknowns: c,u2, u3

Constraint Equations
Algebra

(k2)u2 +
(k1)u3 = c
(k2+k3)u2 + (-k3)u3 = 0
(-k3)u2 + (k1+k3)u3 = p
System Equations

Can now solve the problem


(k2)u2 +
(k1)u3 = c
(k2+k3)u2 + (-k3)u3 = 0
(-k3)u2 + (k1+k3)u3 = p

k2
k 2 k3
k
3

u2
k1 c
u3
k3 u2 0

k1 k3 u3 p

Solve the system


equations first

Ku=b
u=K-1b
k1= 6 N/m
k2=k3= 4 N/m
p=2 N

u2 0.125

u
0
.
250

Can also solve the


constraint equations,
if desired
0.125
4 6
2
0.250

Linear and nonlinear problems


A linear problem must have all three of these properties:
1) Applying zero loads results in a zero solution
2) Doubling the magnitude of the load doubles the magnitude of the solution
3) Changing the sign of the load changes only the sign of the solution
solution

solution

load

Linear

load

Non-Linear

What makes a problem non-linear?

Material properties that depend upon the solution, k(u)


Loads that depend upon the solution, b(u)

k, b

u
Linear

k(u), b(u)

k(u), b(u)

u
Weakly Non-linear

k(u), b(u)

u
Strongly Non-linear

There are no clear distinctions


between these three cases

u
Outrageously
Non-linear

Not all non-linear problems have a (unique) solution


solution

solution

load

No solution

load

No unique solution

Two very simple finite element examples


k = 4 N/m

k = exp(u) N/m
p=2N

p=2N

Force balance on node:

Force balance on node:

f (u) = p - ku = 0
f (u) = 2 - 4 u = 0

f (u) = p ku=0
f (u) = 2 - exp(u) u = 0

f (u)

f (u)

usolution 0.853

usolution= 0.5
u

First, solve the linear problem


f (u) = 2 - 4 u = 0

Algorithm:
1) Start at a point, e.g. u0 = 0
2) Find the slope, f(u0)

f (u)
(1)

3) Solve the problem:


(2)
usolution=0.5

(3)

This is a single Newton-Raphson iteration:

f u0
usolution u0
f ' u0
2
usolution 0
0.5
4
f ui
ui 1 ui
f ' ui

For a linear problem, the starting point does not matter

Solving a FE system matrix is equivalent to taking


a single Newton-Raphson iteration
4u=2
f (u) = 2 - 4 u = 0

k 2 k3
k
3

k3 u2 0

k1 k3 u3 p

0 k 2 k3
f u
p k3

k3 u2 0

k1 k3 u3 0

f (u) = b - Ku,

f u0
usolution u0
f ' u0
2
usolution 0
0.5
4

u0 = 0

f u 0
b Ku 0 b
u solution u 0
0

f' u 0
K
K
u solution K 1b

The non-linear problem is solved the same way


f (u) = 2 - exp(u) u

Algorithm:

f (u)

1) Start at a point, e.g. u0 = 0


2) Take repeated NewtonRaphson iterations
u

3) Terminate when:

f i 1 / f i & ui 1 / ui tolerance

Similarly, if we have a non-linear system matrix


k1 = 6 + (u3-u1)2

k2 = exp(u2-u1)

u1

u2

f (u) = b(u) - K(u)u


f(u) = S(u)

u3

S(u) is known as the JACOBIAN

f ui
1
ui 1 ui
ui Sui bui K ui ui
f ' ui
Iterate until:

p= 2

k3 = 4

f i 1 / f i & ui 1 / ui tolerance

The possibility of convergence of a non-linear


problem is dependent upon the starting point, u0
f (u) = 2 - exp(u) u
f (u)
Non-convergent
if starting on this
side of the line

u0= -1

Non-linear problems have a radius of convergence

Finding a good starting point, u0, can


improve convergence
f (u) = 2 - exp(u) u

It is not strictly possible to


define slow or fast
convergence

f (u)

Finding a good starting point is


a matter of experience and luck

slow
convergence
u
fast
convergence

A damping factor, , is used to improve convergence


f (u) = 2 - exp(u) u

while ( |fi+1| > |fi| )

f (u)

choose ( < 1) & (<previous)

|fi|

f ui

ui 1 ui
f ' ui

final |fi+1|

recompute fi+1(ui+1)

intermediate |fi+1|
undamped |fi+1|

end

A better solution is to ramp up the load


Load

Recall that:
Load

k = exp(u) N/m

f (u) = 2 - exp(u) u

p=2N

f (u)
u

u
Almost all problems have a
zero solution at zero load
Ramping up the load is a
physically reasonable approach

f (u) = 1 - exp(u) u = 0

Ramping up the non-linearity can also work


Non-linearity

Identify non-linearity
- kNL = exp(u)

f (u) = 2 - exp(u) u = 2 - ku
f (u)

Linearize around chosen u0


- kLIN = exp(u0=0) = 1
f (u) = 2 - 1u
u

f (u) = 2 - {(1-0.5)+(0.5exp(u)}u

Use an intermediate value


- k = (1-)kLIN+kNL
- starts at 0
Use intermediate solution as new u0
Ramp from 0 to 1

f (u) = 2 - exp(u) u

Example - Heat flow through a square


Build this 2D model in Heat Transfer,
Save this model, we will build upon this
1x1m square
Insulated

q = 100 W/m2
Mesh

T=0K

Tinitial=0K

Insulated
k, Thermal conductivity

Solution

Study the following cases:


k = 1[W/(m*K)]

k = (1+T/200[K])[W/(m*K)]

k = 0.1+exp(-(T/25[K])^2)[W/(m*K)]

k = (0.1+10*(T>25[K]))[W/(m*K)]

Questions:

How many iterations did each case take? Was damping used?

What does the temperature and thermal conductivity solution look like?

Did they all converge? Why not?

Try solving case #3 with an initial temperature of 50[K], how does this
affect the solution? What about the other cases?
Set back to T=0 afterwards

Ramp up the heat load and monitor peak temperature


Use qflux as a parameter and ramp it up
as range(50,5,110)
k =(1-T/200[K])[W/(m*K)]

Tmax

?
T

Why does this happen?

Qin

The stationary adaptive mesher


Go back to the square model, case 3
k = 0.1+exp(-(T/25[K])^2)[W/(m*K)]
Add Study 1 > Solver Sequences > Solver
Sequence 1 > Stationary 1 > Adaptive mesh
refinement

Triangular and tetrahedral


elements ONLY are subdivided
based on the L2 norm error
estimate.

Initial mesh

Final mesh
Meshes > Mesh 2

The Study node

Assign the parameter, mesh


and physics to be used in this
study

This section contains more


information about the solver
settings

Stationary solver settings


Solver Configurations > Stationary Solver 1
Stop condition for
Newton iterations

COMSOL can inspect the


stiffness matrix and decide whether
the problem is linear or nonlinear
We can also explicitly choose
linear or nonlinear

Solver settings more information


Solver Configurations > Stationary Solver 1 > Fully Coupled 1
Linear system of equations is
solved using the specified solver

Can choose different


damping methods

Stop condition for


Newton iterations

Convergence Criteria
Non-linear solver algorithm

f (U ) 0
Linearized about an initial guess point

U0

f ' U 0 U f U 0 U1 U 0 U

is the damping factor 0 1

'
Calculate relative error E: f U 0 E f U1

If

Ecurrent_ iteration Ecurrent_ iteration1 decrease

Stop iterations when weighted relative error < relative tolerance

Revisit: k = (0.1+10*(T>25[K]))
Instead of using a jump in k, use a smoothing function
Now try: k = 0.1+DK*flc2hs(T-25,STEP)[W/(m*K)]
Try: DK, STEP = 0 8 2.5 4 5 2 7.5 0.5 10 0.25

Achieving convergence for non-linear problems


DONE

Assuming that the problem is


well-posed, try solving it

Converging?

Not converging?

1) Check the initial condition


Not converging?
Converging?

2) Use parametric solver to ramp load


Not converging?

Perform a mesh
refinement study.
Try a finer mesh
and check that the
solution is similar.

3) Use parametric solver to ramp non-linearity


Not converging?

4) Refine the mesh


Not converging?

Does the problem have a steady-state solution?


Are there additional effects? Check all assumptions.

Not converging?

Hands on #8: H-Bend Waveguide

Electromagnetic Waves
Frequency domain study

Solving the Linear System Matrix

Linear system matrix

Direct methods

Iterative methods

Suggestions on solver selection

Lets take another look at the system equations


0 k 2 k3
f u
p k3

k3 u2 0
b Ku 0

k1 k3 u3 0

Define a quadratic function: r(u) = bu-Kuu


r(u)

u3

The solution, f(usolution) = 0, is


the point where r(u), is at a
minimum

Solution

u2

Finding the minimum of a quadratic function


r (u) = 2u2 - 3u + 1
Newtons method:

u sol

r (u)

r u 0
u0
r u 0

For a quadratic function, this


converges in one iteration, for any u0
usol
u

r(u) = 4u - 3
r(u) = 4
u0 = 0

usol u0

r u0
4 0 3
0
0.75

r u0
4

Via our choice of r(u), this reduces to the


same equation from the previous section:
r(u) = bu-Kuu
r(u) = b - Ku
r(u) = - K
r u 0
b Ku 0
u sol u 0
u0
r u 0
K
u0 0

u sol 0

b
K 1b
K

Finding the minimum of the quadratic function,


r(u), by the direct method means solving u=K-1b

This is known as Gaussian Elimination, or LU factorization


The numerical algorithms are beyond the scope of this course,
but they have the following important properties:
For 3D, requires O(n2)-O(n3) numeric operations, where n is the length of u
Robustness of the algorithm is only very weakly dependent upon K

The direct solvers in COMSOL are:


MUMPS: fast, required for cluster computation
PARDISO: fast, multi-core capable
SPOOLES: slow, uses the least memory, multi-core capable

Introduction to iterative methods for finding the


minimum of a quadratic function, a naive approach
1) Start here
2) Search along coordinate axis
3) Find the minimum along that axis

4) Repeat until converged

This iterative method requires only


that we can repeatedly evaluate r(u)
as opposed to the direct methods,
which get to the minimum in one
step by evaluating [r(u)]-1

The numerical values in K can affect the algorithm


Quadratic
surface
r(u)

u3

r(u) = bu-Kuu

Condition
number = 1

Condition
number = 2

u2

The higher the condition number the more


numerical error creeps into the solution

Condition
number = 10

Ill-conditioned matrices require more iterations

Numerical error becomes significant

A better iterative method for finding the minimum:


The Conjugate Gradient (CG) method
1) Start here
2) Initially, find the gradient vector
3) Find the minimum along that vector

4) Find the conjugate gradient vector*


5) Repeat 3-4 until converged

The CG method requires that we can


evaluate r(u), r(u) and r(u)

CG does NOT compute K-1


*) See e.g. Wikipedia, or Scientific Computing by Michael Heath

Condition number matters for iterative methods

A matrix with a condition number of 1


will converge in one iteration, (rare!)

Numerical error becomes significant


for ill-conditioned matrices

All iterative methods in COMSOL are some


variation upon the CG method
Conjugate Gradient, GMRES, FGMRES and BiCGStab
The details of these algorithms are beyond the scope of this course

All these methods make use of PRECONDITIONERS


The system equation, Ku = b, is multiplied by a preconditioner matrix, M,
to improve the condition number

Exercise: Show that


the best possible
preconditioner is the
matrix M=K-1

Ku = b

MKu = Mb

What you need to know about iterative solvers

They converge in at most n iterations (good)


Solution time is O(n1-n2) (good)
Solution time depends on condition number

Memory requirements are O(n1-n2) (very good)


They are less robust that the direct solvers (neutral)
Convergence depends upon condition number
An ill-conditioned problem is often set up incorrectly

Different physics require different iterative methods (bad)

This is an ongoing research topic


Often cannot solve two physics with the same solver
Improvements in methods are ongoing
We have tried to find the best combination of iterative solvers and
preconditioners for many physics, to find these settings, read the manuals or
open a new model file, select a space dimension of 3D and the physics you
want to solve

Solver selection for 1D and 2D problems

Begin with the default solver, MUMPS, PARDISO or SPOOLES


If running out of memory:
Use MUMPS or PARDISO out-of-core
Upgrade your computer, 64-bit & more memory
Make sure that your problem is not overly complicated, typical 2D models
should solve easily on a 32-bit computer with 2GB of RAM

If you are seeing differences between the solvers, check the


problem very carefully, this usually indicates a mistake in the model

Solver selection for 3D problems

Set up a linear problem first


Use the default solver settings for the physics you are solving
If you run out of memory, upgrade to 64-bit and more RAM
Monitor the memory requirements as you grow the problem size

Setup a non-linear problem only after you have successfully solved


a linear problem

FEA formulation in Multiphysics problems

Interpreting multiphysics FEA

Fully-coupled and Segregated Solvers

Suggestions on convergence of multiphysics problems

Consider two simple physics, on the same geometry


Electric currents

Heat Transfer
All other surfaces
insulated

T=0K

k = 1 W/mK

All other surfaces


insulated

V=0V

= 1S/m

V=1V

q=100 W/m2

kT 0

in the domain

V 0

in the domain

n kT 100 mW2

right boundary

V 1V

right boundary

T 0K

left boundary

V 0V

left boundary

T 0

other boundaries

V 0

other boundaries

fT = KTuT - bT

fV = KVuV - bV

How to solve this linear problem


Combine the two linear system equations:

fT (uT) = KTuT - bT
fV (uV) = KVuV - bV
fT uT
f u
0

K T
f u
0

uT bT
Su b

fV uV uV bV
0

This part of the matrix is zero because:


This part of the matrix is zero because:
Solve this linear problem with a
single Newton-Raphson iteration:

0 uT bT

K V uV bV

fT / uV = 0
fV / uT = 0

u sol u0 S 1 Ku 0 b

Now, consider a coupled multiphysics problem


Electric currents

Heat Transfer
All other surfaces
insulated

T=0K

k = 1 W/mK

All other surfaces


insulated

V=1V

V=0V
q=100 W/m2
= (1-0.001T) S/m

The temperature solution now affects the


material properties of the electrical problem

fT = KTuT - bT

fV = KV(uT)uV - bV

How to solve this coupled multiphysics problem

fT (uT) = KTuT - bT
fV (uV) = KV(uT)uV - bV

Take the two system equations:

Combine these into a single system equation:

fT uT
f u
fV uT

uT bT
K u u b

fV uV uV bV
0

u i 1 u i Su i K u i u i b
1

This coupled problem is solved via


Newton-Raphson iterations:

u i 1 u i f u i u f u i
1

This coupled multiphysics problem is solved in the exact


same way that a non-linear single physics problem is solved
May no longer use the iterative solvers, since they are tuned
for single physics, and often can not handle the coupled terms

Consider more couplings between the physics


Electric currents

Heat Transfer
Volumetric resistive
heating due to current

T=0K

All other surfaces


insulated

Q(V)
k = 1 W/mK

(T)

V=0V

V=1V

q=100 W/m2

fT = KTuT - bT(uv)

fT uT
f u
fV uT

fV = KV(uT)uV - bV

fT uV uT bT uV

K uu bu

fV uV uV bV

u i 1 u i Su i K u i u i bu i
1

Same equation
as before

u i 1 u i f u i u f u i
1

Consider all possible couplings between the physics


q(T,V)

Qvol (T ,V )

V=V(T,V)

T=T(T,V)

(T,V)

V=V(T,V)

k(T,V)

fT = KT(uV,uT)uT - bT(uV,uT)

fT uT
f u
fV uT
General NewtonRaphson multiphysics iteration:

fV = KV(uV,uT)uV - bV(uV,uT)

fT uV uT bT uV , uT

K u u bu

fV uV uV bV uV , uT
u i 1 u i Su i K u i u i bu i
1

u i 1 u i f u i u f u i
1

Different two-way couplings have different


computational requirements
q(T,V)

Qvol (T ,V )
T=T(T,V)

V=V(T,V)

(T,V)

V=V(T,V)

k(T,V)

fT uT
f u
fV uT

fT uV uT bT uV , uT

K u u bu

fV uV uV bV uV , uT

If one or both of these are zero, then the memory requirements are less

If the couplings are weak then the problem converges faster

Definitions of various types of couplings

One-way coupled
Information passes from one physics to the next, in one direction

Two-way coupled
Information gets passed back and forth between physics

Load coupled
The results from one physics affect only the loading on the other physics

Material coupled
The results from one physics affect the materials properties of other physics

Non-linear coupled
The results of one physics affects both that, and other, physics

Fully coupled
All of the above

Weakly coupled
The physics do not strongly affect the loads/properties in other physics

Strongly coupled
The opposite of weakly coupled

It is possible to solve multiphysics problems in a


segregated sense, solving each physics separately
fT uT
f u
fV uT

fT uV uT bT uV , uT

fV uV uV bV uV , uT

Assume that these are approximately zero and ignore them

initialize uT,i, uV,i


do {
uT,i+1= uT,i+ST(uT,i, uV,i)-1bT(uT,i, uV,i)
uV,i+1= uV,i+SV(uT,i+1, uV,i)-1bV(uT,i+1, uV,i)
i=i+1
}
while ( not_converged )

is damping

Solving in a segregated sense has some advantages


Less memory to store matrices:
f uT
f u T
fV uT

fT uV uT bT

fV uV uV bV

f uT
f u T
0

uT bT

fV uV uV bV
0

Less memory to solve:

ui 1 ui Sui Kui ui bui


1

uT,i+1= uT,i+ST(uT,i, uV,i)-1bT(uT,i, uV,i)


uV,i+1= uV,i+SV(uT,i+1, uV,i)-1bV(uT,i+1, uV,i)

Jacobian is exactly 2 times smaller in degrees of freedom


The optimal iterative solver can be used for each physics
If the problem is strongly coupled, then the segregated approach
will not work, and a direct solver is often necessary since the
iterative solvers are not tuned for a general Jacobian matrix.

Achieving convergence for multiphysics problems

Set up the coupled problem and try solving it with a direct solver
If it is not converging:

Check initial conditions


Ramp the loads up
Ramp up the non-linear effects
Make sure that the problem is well posed (this can be very difficult!)

If you are running out of memory, or the solution time is very long:
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
Try the PARDISO out-of-core solver

Perform a mesh refinement study

An uncoupled problem
Electric currents

Heat Transfer

TL=0

k=1 W/mK

VL=0

=1 S/m

q=100 W/m2

J=10 A/m2

All other surfaces insulated

All other surfaces insulated

Identical to previous problem

Set up an Inward Current Flow


on the right side

Consider the following multi-physics couplings:


Volumetric
Heat Load

Thermal
Conductivity

Electric
Conductivity

Normal
Current

Iterations

Solution
Times (sec)

Linear

10

3.572

Non-linear
uncoupled

1-(T/10000)

1-(V/1000)

10

9.422

One-way load
coupled

Joule
Heating

10

27.846

Two-way load
coupled

Joule
Heating

10+(T/100)

29.703

Fully coupled

Joule
Heating

1-(V/1000)

1-(T/10000)

10+(T/100)

29.469

Thermal problem

Electric problem

Try yourself: heat and current flow through a


unit cube
Electric currents

Heat Transfer

Q(V) W/m3
TL=0

k=1 W/mK

VL=0

=1 S/m

q=100 W/m2

J=10 A/m2

All other surfaces insulated

All other surfaces insulated

Identical to previous problem

Set up an Inward Current Flow


on the right side

Set up and solve this coupled problem

Try yourself: Ramp up the applied current,


and monitor peak temperature
Thermal
Conductivity
Case 1

Case 2

exp(-T/600)

Electric
Conductivity
1

Tmax

exp(-T/600)

Jin

Use the parametric solver


Ramp up inward current density range(0,2,20)
Plot the temperature distribution.
What happens?
Why?

Hands on exercises: Instead of current


density apply a voltage
Thermal
Conductivity
Case 1

Electric
Conductivity

Tmax

Same as before
Case 2

exp(-T/600)

exp(-T/600)

V
Ramp up applied voltage range(0,20,140)
How high can it go?
Why?
Try boundary layer mesh with 50 layers where needed.
Keep mesh size to fine.

Using the segregated solver


Study > Solver Configurations > Solver
1> Stationary Solver1>Segregated

Can add multiple


Segregated steps as
required

Segregated step
Study > Solver Configurations > Solver
1> Stationary Solver1>Segregated

Choose the
variable/s that you
want to solve in this
segregated step
Choose the linear
system solver and
the damping method
for each segregated
step

When in doubt, set each physics to run to


convergence at each iteration

These settings are equivalent


to solving the complete nonlinear problem at each
iteration.

initialize uT,i, uV,i


do {
do {
non-linear solution for uT,i+1
use uT,i and uV,i as initial conditions
}
do {
non-linear solution for uV,i+1
use uT,i+1 and uV,i as initial conditions
}
i = i+1
}
while ( not_converged )

Recap: Working with solvers

A problem could be Linear or Nonlinear

The linear system of equations could be solved using a Direct


Solver or an Iterative Solver

A multiphysics problem could be solved using a Fully-Coupled


Approach or Segregated Approach

You cannot model everything

You can never model the


entire universe

Everything else
BC

Boundary conditions
represent the outside
BC

Model

Two types: physical walls and


artificial boundaries
BC

Use artificial boundaries to


model only the region of
interest

Something else

BC

Infinite Elements

Currently in ACDC and Heat Transfer

Draw Rectangle, 2 Large Circles,

Add Outer Inf Elem Geom

Subdomain > Make Circles Not Active and


infinite elements (aluminum)

Rectangle Boundaries Thermal Insulation

Left Circle: T = 300[K] Right Circle T = 273[K]


See model file:
Compute
Example_Infinite Elements
subdmain make active infinite elements

Subdomain Inf Elem Tab Match Matls

Inf Elems >Cartesian,

compute Hide Inf Element Subdomains

Perfectly Matched Layers


Absorbing Subdomain
Absorbs incident waves without reflection
Artificial boundary for non-enclosed spaces
Used instead of radiation boundary condition
Make thickness at least one wavelength with
atleast 5 elements

PML
See model file: Example_PML

Sound Hard Wall

Circle 1: R= 8 Center: (0,2)


Circle 2: R=10 Center: (0,2)
Circle 3: R= 4 Center: (0,0)
Union C1+C2
Difference all
f =100 Hz c =343 m/sec (air)
L=c/f = 3.4 Mesh Size = 3.4/5
Inner Circle Acceleration BC, a0=1

Radiation - Cylindrical

PML - Cylindrical

Hands-on #9: Piezoacoustic Transducer

3-physics: Piezoelectric
material (structural +
electrical) + Acoustics
Uses symmetry
Perfectly Matched Layer
Custom mesh
Frequency domain
mm scale geometry

Time-dependent problems

Time-dependent formulation

Tolerance and other attributes of time-dependent solver

Suggestions on convergence of time-dependent problems

Introduction to time-dependent solutions


C p

T
kT Q
t

u
f (u) Ku b
t
u ut 1 ut

K t ut bt
t
t

ut 1 t K t ut bt ut
u ut 1 ut

K t 1ut 1 bt 1
t
t

I tK t 1 ut 1 ut tbt 1

Governing Equation

Time-dependent finite element formulation

Explicit time-stepping

Slower

Simple

Faster
Implicit time-stepping

More stable

Backward Difference Formula (BDF) order


I tK t 1 ut 1 ut tbt 1
k(t)

A polynomial is fit through n


previous points to predict
properties at t+1

Here, the BDF order is n = 3

Keep Max order


to 2 for stable
Scheme
Higher order
means more
accuracy but
smaller time steps

t-2

t-1

t+1

COMSOL picks its own optimum timesteps


These are the output
timesteps, the times
you want to see the
solution at.
They do not affect the
internal timesteps.
The internal timesteps
are controlled by the
TOLERANCES.

Absolute and Relative Tolerance


u

True solution
t

Solutions within
Relative tolerance

At solutions near zero,


the relative tolerance
cannot be used, since it
would result in very
small timesteps

Solutions within
Tighten both the
Absolute tolerance absolute and relative
t

u
t

tolerance until you


are satisfied with the
results over time.

The absolute tolerance can be different for


each solution variable
Temperature:
Absolute tolerance: 0.1K

Voltage:
Absolute tolerance: 0.001V

Often need to set this when


solving multi-physics problems

Other timestepping options


Selecting the physics at
startup will usually load
the appropriate settings.
For wave type problems,
Generalized-alpha is
often better.
Free - time stepping method
chooses time steps freely
Intermediate - force the
time stepping method to
take at least one step in
each subinterval of the
times specified

BDF order, set max and


min to 2 and 1 for wave
problems.

Strict - force the time


stepping method to take
steps that end at the times
specified

More timestepping options

Specify for which steps


the solutions should be
stored

Make sure not to impose any ringing loads,


unless they are really there
Load

time
Response

time

A reasonable starting point is necessary

The load applied at t = 0 must agree with the initial condition


It is helpful to a have a load with time derivative zero at t = 0
The Physics > Initial Values node is used to set initial conditions
The Solver Configurations > Dependent Variables > Initial Values
area can be used to overwrite that information
Most common mistake:

Initial conditions for fluid flow: u = 0


Velocity/Pressure inlet condition
that does NOT ramp up from zero
t
u

u(tinitial) = [K]-1b(tinitial)

Solution:

Use flc2hs or a smoothed step


function to ramp load from an initial
condition

Convergence of a transient problem


True solution
(unknown)
u

t
Observe the solution with respect to time and
monitor the magnitude of the changes as the
tolerances are increased.
The problem is converged when you say it is.
Outside envelop is absolute
and relative tolerance

The mesh must be fine enough with respect to


space and time
T

Try yourself:
increasing
time

1) Heat transfer in a unit square model


2) Change the analysis type to Transient
x

3) Set material properties: =1, Cp=1


4) Solve transiently for 1 second (default)
5) Store all timesteps taken by solver

Tinit
Transient 1-D slab

Tfixed

6) Examine results at initial timesteps

There are two ways to minimize this problem


q

Modify the physics

Modify the mesh

Use a smoothed step


function to gradually ramp
up the heat load:

Use boundary layer


meshing to better resolve
the step in the solution

flc1hs(t-0.01,0.01)

Solving transient problems

Begin by assuming the problem is well posed, try solving it by


ramping all loads up from consistent initial conditions
Tighten the tolerances and see if you get a converging answer

If it is not converging:
Refine the mesh
Smooth out abrupt differences in loads and properties as reasonable
Try linearized properties
Some non-linear properties may require a very fine mesh and small time-step

Check the physics carefully

If the solution takes a long time, or runs out of memory


Use the time-dependent segregated solver using all previous guidelines
Upgrade hardware

Hands-on #10: Star Chip

Laminar flow
Multiple pulsating inlets
with phase difference
Swept mesh
Time-dependent boundary
conditions
Setting absolute tolerance

Summary

COMSOL graphical user interface

Variables, functions, model couplings

Geometry creation, sequencing, parametrization, CAD import

Handling built-in and user-defined materials

Meshing techniques

Postprocessing techniques

PDE interface

Linear and nonlinear problems

Direct and iterative solvers

Fully-coupled and segregated approach

Time-dependent study

End of Slides

Das könnte Ihnen auch gefallen