Вы находитесь на странице: 1из 82

Equation-Based Modeling

COMSOL Conference 2017 Singapore


Pratyush Sharma

© Copyright 2017 COMSOL. COMSOL, the COMSOL logo, COMSOL Multiphysics, Capture the Concept, COMSOL Desktop, COMSOL Server, and LiveLink are either registered trademarks or
trademarks of COMSOL AB. All other trademarks are the property of their respective owners, and COMSOL AB and its subsidiaries and products are not affiliated with, endorsed by, sponsored
by, or supported by those trademark owners. For a list of such trademark owners, see www.comsol.com/trademarks.
2u
 2    S  Fv
t

T
C   C  u  T    (T )  Q
t
A Look Under the Hood
A Look Under the Hood
Modeling Approaches
•• Insert
Insertpredefined
Insert predefinedphysics
predefined physics
physics
••• Coupling
Coupling physics
Couplingphysics (manual
(manualor
physics(manual orautomatic)
or automatic)
automatic)  2u u
ea 2  d a
•• Enter
Enteruser
userdefined
expressions
definedfunctions.
expressionscan
functions.All
can depend
dependon onall
All
all the
the t t
variables
variablesintroduced
introduced(analytical,
interpolation
interpolationfrom
fromfile
(analytical,
file...)
...)
   (cu  u   )
•• Add
Addoror change
changeterms
termsof
ofthe
theequations
equations    u  au  f
set
setin
in the
thephysics
physics(and
(andmultiphysics)
multiphysics)
nodes
nodes

• Insert your own equations with equation du


forms (and make it automatic with  F ( u, t )
Physics Builder) dt
The Mathematics Interface
Equation-Based Modeling
• What?
– ODE & DAE interfaces, PDE interfaces, boundary conditions
• Why?
– Lumped parameter systems, continuous systems
• How?
– Demo: population dynamics, thermal curing
• Could I get myself in trouble?
– Verification & validation
• Hands on : Coupling PDE with global and distributed ODE
What PDE, ODE, and DAE stand for?
u
   cu   f
• Partial differential equations (PDE)
– da
t
Three main interfaces (form)
– Need boundary conditions Mechanics, CFD,
EM…. .
• Ordinary differential equations (ODEs)
– Global (space indipendent)
du
– Distributed (space dependent)  F ( u, t )
– Distributed, but not continuous dt Electrical
circuits,
– (Always) time dependent
cinematism... ,
• Algebraic equations


As for ODE, global or distributed
Do not contain time (and often not even the space)
u2  1  0
Part I: Lumped Parameter Systems
• Global ODEs
• Global Algebraic Equation
Lumped Parameter Systems

Contaminant concentration Contaminant amount


𝑐(𝑥, 𝑦, 𝑧, 𝑡) 𝐶(𝑡)

Population dynamics Population dynamics


Lumped Parameter Systems
• Balance laws
Rate of change of some quantity = amount entering - leaving + production - consumption

Example 1 : Dynamics Example 2 : Prey-predator system


𝑑2𝑢 𝑑𝑢 𝑑𝑢
𝑚 = −𝑘𝑢 − 𝑐 = 𝑎1 𝑢 1 − 𝑢ൗ𝑘 − 𝑏1 𝑢𝑣
𝑑𝑡 2 𝑑𝑡 𝑑𝑡
𝑑𝑣
= −𝑎2 𝑣 + 𝑏2 𝑢𝑣
𝑑𝑡
𝑑2𝑢 𝑑𝑢 𝑑𝑢 𝑑𝑣
𝑚 2 + 𝑘𝑢 + 𝑐 =0 − 𝑎1 𝑢 1 − 𝑢ൗ𝑘 + 𝑏1 𝑢𝑣 = 0 + 𝑎2 𝑣 − 𝑏2 𝑢𝑣 = 0
𝑑𝑡 𝑑𝑡 𝑑𝑡 𝑑𝑡
Global ODEs
• Example: Lotka-Volterra equations

𝑑𝑢
= 𝑎1 𝑢(1 − 𝑢Τ𝑘) − 𝑏1 𝑢𝑣
𝑑𝑡

𝑑𝑣
= −𝑎2 𝑣 + 𝑏2 𝑢𝑣
𝑑𝑡

𝑢 0 = 𝑢𝑖𝑛𝑖 , 𝑣 0 = 𝑣𝑖𝑛𝑖
Global Algebraic Equations
• Same template as Global ODEs
• What are the initial values for?
– Stationary solvers

https://www.comsol.com/blogs/modeling-hydrostatic-pressure-fluid-deformable-container/
Physics + Global Algebraic Equations
• You can add extra degrees of freedom to a physics interface

https://www.comsol.com/blogs/modeling-hydrostatic-pressure-fluid-deformable-container/
Part II: Continuous Systems
Without Spatial Interaction
• Domain ODEs and DAEs
• Boundary ODEs and DAEs
• Edge ODEs and DAEs
• Point ODEs and DAEs
Domain ODEs
Domain ODEs
• Problem parameters are spatially variable
– Initial conditions 𝑢 𝑥, 0 = 𝑢𝑖𝑛𝑖 (𝑥),…
– Carrying capacity is spatially variable 𝑘 = 𝑘(𝑥)
– Prey-predator interactions have different outcomes based on location
• 𝑏1 = 𝑏1 𝑥 , 𝑏2 = 𝑏2 (𝑥)
– Climate effect? 𝑎1 = 𝑎1 (𝑥, 𝑇)
• Every point evolves independent of neighbors
– No spatial derivatives in the equation!
– No boundary conditions needed
Domain ODEs in Physics
• Material evolution
𝜕𝛼 𝐸
(− 𝑎ൗ𝑅𝑇)
= 𝐴𝑒 (1 − 𝛼)𝑛
𝜕𝑡
𝜕𝛼 𝐸
(− 𝑎ൗ𝑅𝑇(𝑥))
= 𝐴𝑒 (1 − 𝛼)𝑛
𝜕𝑡
• Reaction kinetics
– Built-in if you use the Chemical Reaction Engineering Module
ODE or 1D PDE?
𝑑2 𝑢
2
− 𝑎𝑢 + 𝑔 𝑡 = 0 IVP = ODE
𝑑𝑡
𝑑2𝑢 BVP = PDE
− 𝑎𝑢 + 𝑔 𝑥 = 0
𝑑𝑥2

Spatial derivative use PDE interfaces


Domain Algebraic Equations
• Solve 𝑢3 = 𝑝(𝑥, 𝑡, . . ) for 𝑢
• Interface is the same as Domain ODE

https://www.comsol.com/blogs/solving-algebraic-field-equations/
Example: Ideal/Non-ideal gas law
• Assume u=(u,v,w) and p given by Navier-Stokes
• Want to solve Convection-Conduction in gas:
   (kT )  C u T  0
• Ideal gas: 𝜌 given by • non-ideal gas law (needed for
pM high molecular weight at very

RT high pressures): 𝜌 solution of
• Easy - analytical A( p  B 2 )(1  C )  D  0
• Difficult – implicit equation
• How to proceed?
Example: Non-ideal gas law
• How to solve: A( p  B 2 )(1  C )  D  0
• Third order equation in
• Pressure p is function of space
• So: this is an algebraic equation at each point in space. Solution

ea  d a  0, f  A( p  B 2 )(1  C )  D
http://www.comsol.com/blogs/solving-algebraic-field-equations/
Distributed Algebraic Equation
• What about non-linear equations with multiple solutions?
• Which solution do you get?
• For simplicity, consider the equation (u-2)^2-p=0, where p is a constant
• The solution you get will depend on the Initial Guess given by the PDE
Physics Interface

• 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.
Distributed Algebraic Equation
u=3

u=2

u=2

u=1
Distributed Algebraic Equation
u=3

u=2

u=2

u=1
Part III: Continuous Systems
with Spatial Interaction
Partial Differential Equations
Prey-Predator System with Migration
• PDEs!
• What if the second species does not migrate?
– Domain ODE or PDE with 𝑐2 = 0?
• Can we have a convective term?
• What happens for negative 𝑐1 or 𝑐2 ?

u
   (c1u )  a1u (1  u k )  b1uv
t
v
   (c2v)  a2 v  b2uv
t
Balance Laws: Integral Formulation
• Balance laws for a continuous system 𝑛
Γ
S

Rate of change of some quantity = amount entering or leaving through the boundary + production or
consumption inside
𝑑
Ԧ
න ϕ𝑑𝑉 = − න Γ·𝑛𝑑𝑆 + න 𝑓𝑑𝑉
𝑑𝑡 𝑉 𝑆 𝑉
Balance Laws: Differential Equations
𝑛 𝑑
Γ 𝑑𝑡 𝑉 𝑆
Ԧ
න ϕ𝑑𝑉 = − න Γ·𝑛𝑑𝑆 + න 𝑓𝑑𝑉
𝑉
S
𝜕ϕ
න Ԧ
𝑑𝑉 = − න Γ·𝑛𝑑𝑆 + න 𝑓𝑑𝑉
𝑉 𝜕𝑡 𝑆 𝑉

V
Divergence theorem
𝜕ϕ
න Ԧ 𝑑𝑉 + න 𝑓𝑑𝑉
𝑑𝑉 = − න 𝑑𝑖𝑣(Γ)
𝑉 𝜕𝑡 𝑉 𝑉
𝜕ϕ
න [ + 𝑑𝑖𝑣 ΓԦ − 𝑓]𝑑𝑉 = 0
𝑉 𝜕𝑡
Balance Laws: Differential Equations
𝑛
Γ න [
𝜕ϕ
+ 𝑑𝑖𝑣 ΓԦ − 𝑓]𝑑𝑉 = 0
S 𝑉 𝜕𝑡

Localization argument 𝜕ϕ
+ 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡
General Form PDE
𝜕ϕ
+ 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡
𝜕𝑢
Usually 𝜙 = 𝑒 + 𝑑𝑢
𝜕𝑡
2
𝜕 𝑢 𝜕𝑢
Template
𝑒 2 +𝑑 + 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡 𝜕𝑡
𝜕𝑇
HT 𝜙 = 𝜌𝑐𝑝 𝑇 𝜌𝑐𝑝 + 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡
Constitutive Assumptions
𝜕2𝑢 𝜕𝑢
𝑒 2 +𝑑 + 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡 𝜕𝑡

• Take the usual form for the flux


ΓԦ = −𝑐𝛻𝑢 − 𝛼𝑢 + 𝛾
You specify 𝑐, 𝛼, 𝛾
Coefficient Form PDE Template
• Specify units for independent variable and source

Mass Damping or Conservative flux Convection Source


mass convection

Diffusion Conservative Absorption


flux source

 2u u
ea 2  d a    (cu  u   )    u  au  f
t t
Coefficient Form PDE
Acoustics Chemistry Black-Scholes Fischer’s Ecologic
Model
𝒖 Pressure Concentration Cost of option Population

𝐞𝐚 1/𝜌𝑐 2
𝒅𝐚 1 1 1

𝒄 1/𝜌 Diffusion coef. 1 Dispersal rate


− 𝜎 2𝑥 2
2
𝜸 𝑞𝑑 /𝜌

𝜷 Velocity 𝑟𝑥 − 𝜎 2 𝑥

𝒂 −𝑟 𝑟(𝑢ൗ𝐾 − 1)
𝒇 𝑄𝑚 Reaction rate
Helmholtz Equation, Coefficient Form PDE
   (cu )  k 2u  g

 2u u
ea 2  d a    (cu  u   )    u  au  f
t t

Coefficient matching
𝑎 = −𝜅 2 𝑎=0
𝑓=𝑔 𝑓 = 𝑔 + 𝜅2𝑢
Option 1 Option 2
Helmholtz Equation, General Form PDE
   (cu )  k 2u  g

𝜕2𝑢 𝜕𝑢
𝑒 2 +𝑑 + 𝑑𝑖𝑣 ΓԦ = 𝑓
𝜕𝑡 𝜕𝑡
Match terms
ΓԦ = −𝑐𝛻𝑢
𝑓 = 𝑔 + 𝑘2𝑢
Black-Scholes Equation Coefficient Form PDE
u 1 2 2  2u u
  x  rx  ru  0
t 2 x 2 x
 2u u
ea 2  d a    (cu  u   )    u  au  f
t t
u  1 2 2 u u
 (  x )  [rx   2 x]  ru  0
t x 2 x x
Coefficient matching Alternative
1
1 d a  1, c    2 x 2
d a  1, c    2 x 2 2
2   0, a   r
  rx   2 x, a   r
u
f  (  rx   2 x)
x
https://www.comsol.com/model/the-black-scholes-equation-82
Weak Form PDE
• NO TEMPLATE!
• Extreme flexibility!
𝜕𝑢
𝐶 + 𝛻 ∙ −𝜅𝛻𝑢 − 𝑄 = 0
𝜕𝑡
𝜕𝑢
න 𝐶 𝑤 + 𝜅𝛻𝑤 ∙ 𝛻𝑢 𝑑Ω = න 𝑄𝑤𝑑Ω + න 𝑤𝑞𝑛 𝑑𝑆 ∀𝑤
𝜕𝑡

https://www.comsol.com/blogs/implementing-the-weak-form-in-comsol-multiphysics/
PDE in Weak formulation
• Weak = Integral ; based on variational formulation (conservation law)
• Most of COMSOL (and other tools’) physics use such a formulation since most
versatile
• It is the base of finite element (but also used within other schemes)
• Understanding how it works is the way to master what COMSOL does under the hood

Γ  F
   Γ dV   F dV
 
Weak Form, Stationary
𝜕Ω
• General form: 𝛻∙Γ=𝐹
• Multiply by test function v 𝛻∙Γ=𝐹

and integrate: ‫׬‬Ω 𝑣𝛻 ∙ Γ𝑑𝐴 = ‫׬‬Ω 𝑣𝐹𝑑𝐴 Ω

• Perform integration by parts

on left-hand side: ‫𝜕׬‬Ω 𝑣Γ ∙ 𝑛 𝑑𝑠 − ‫׬‬Ω 𝛻𝑣 ∙ Γ 𝑑𝐴 = ‫׬‬Ω 𝑣𝐹 𝑑𝐴

• Rearrange: 0 = ‫׬‬Ω 𝛻𝑣 ∙ Γ + 𝑣𝐹 𝑑𝐴 + ‫𝜕׬‬Ω −𝑣Γ ∙ 𝑛 𝑑𝑠


• Remember:
– For Poisson’s eq: Γ = [𝑢𝑥 𝑢𝑦 ], F = 1, R = u - 0
(u constrained to 0 on boundaries)
– Subdomain integral above is entered in the “weak” field: -test(ux)*ux - test(uy)*uy + test(u)*F
– On the boundary, set constraint expression: u
Weak Form, Time Dependent
• Same development as stationary but start from:
𝜕𝑢 𝜕Ω
𝑑𝑎 +𝛻∙Γ= 𝐹 𝜕𝑢
𝜕𝑡 𝑑𝑎
𝜕𝑡
+𝛻∙Γ= 𝐹

• And arrive at Ω

𝜕𝑢
0 = ‫׬‬Ω 𝛻𝑣 ∙ Γ + 𝑣𝐹 − 𝑑𝑎 𝑣 𝑑𝐴 + ‫𝜕׬‬Ω −𝑣Γ ∙ 𝑛 𝑑𝑠
𝜕𝑡

• Subdomain integral in the weak field:


-test(ux)*ux - test(uy)*uy + test(u)*F – da*test(u)* ut
Using the Weak Form PDE Interface

https://www.comsol.com/blogs/implementing-
the-weak-form-in-comsol-multiphysics/ https://www.comsol.co.in/blogs/brief-
introduction-weak-form/

https://www.comsol.com/blogs/strength-weak-form/
https://www.comsol.co.in/blogs/discretizing-the-
weak-form-equations/
Derivatives
Solution field: u
Spatial 1st derivatives: ux, uy, uz
Spatial 2nd derivatives: uxx, uxy, …, uyz, uzz
Time derivatives: ut, utt
Mixed derivatives: uxt, uytt
Derivatives tangent to surfaces: uTx, uTy, uTz
Derivatives of quantities other than the
d(q,t),d(q,x)
primary dependent variable:

More: “Differentiation Operators” in the COMSOL Multiphysics Reference Manual


Integrated Demo: Thermal Curing Physics
T, α

Thermoset in
the cavity
Image by Joe Haupt — Own work. Licensed
under CC BY-SA 2.0, via Wikimedia Commons.
Heated
mold
Thermal Curing: Mathematical Model
T 
C p    (T )   H r
t t

 Ae (  Ea / RT ) (1   ) n
t
• Initial conditions: room temperature, zero curing
• Boundary conditions: heat flux of 10 kWΤm2
• Step 1: Pick appropriate Mathematics interfaces
– PDE + Domain ODE
• Step 2: Fit the equations into the templates
Thermal Curing: Choosing the Interface
T 
C p    (T )   H r PDE
t t
 2u u
ea 2  d a    (cu  u   )    u  au  f
t t

d a  C p , c   , f   H r
t

 Ae (  Ea / RT ) (1   ) n Domain ODE
t 2
 
ea  d  f
t 2 t
a

d a 1, f  Ae (  Ea / RT ) (1   ) n
Thermal Curing: Heat Transfer Interface

https://www.comsol.com/blogs/modeling-the-thermal-curing-process/
Part IV: Boundaries and Interfaces
The World Versus Your World!

Image by Strebe — Own work. Licensed under CC BY-SA 3.0, via Wikimedia Commons.
Jump and Boundary Conditions
𝜕𝜙
න Ԧ
𝑑𝑉 = − න Γ·𝑛𝑑𝑆 + න 𝑓𝑑𝑉
𝑉 𝜕𝑡 𝑆 𝑉

Can’t do this!
𝜕ϕ
න Ԧ 𝑑𝑉 + න 𝑓𝑑𝑉
𝑑𝑉 = − න 𝑑𝑖𝑣(Γ)
𝑉 𝜕𝑡 𝑉 𝑉

1. Stay with the integral equation


2. Focus
Jump and Boundary Conditions
𝜕𝜙
න Ԧ
𝑑𝑉 = − න Γ·𝑛𝑑𝑆 + න 𝑓𝑑𝑉
𝑉 𝜕𝑡 𝑆 𝑉

𝑉 → 0, 𝑆 ≠ 0
S Ԧ
න Γ·𝑛𝑑𝑆 =0
𝑆
𝑛 𝑛1
න (ΓԦ1 −ΓԦ2 )·𝑛𝑑𝑆 = 0
𝑆

𝑛2 S ΓԦ ∙ 𝑛=0
𝑛1 → 𝑛, 𝑛2 → −𝑛
Jump and Boundary Conditions
𝑛 −ΓԦ𝑖 ∙ 𝑛=−ΓԦ𝑜 ∙ 𝑛
𝑖 𝑜 Inward flux
S

• Think about what is outside


• We have NOT considered surface production
here
Boundary Conditions 1: Flux
𝜓 𝑛
−ΓԦ𝑖 ∙ 𝑛 = 𝜓
Inward flux

• Example: Heat Transfer in Solids


−(−𝜅𝛻𝑇) ∙ 𝑛 = 𝑞0
• Natural (Neumann) boundary conditions
Boundary Conditions: Mixed
• A constitutive assumption about the outside

𝜓 𝑛
𝑢𝑒𝑥𝑡 −ΓԦ𝑖 ∙ 𝑛 = 𝜓

𝑢 𝜅𝑜
𝜓= (𝑢 − 𝑢)
𝐿𝑒𝑥𝑡 𝑒𝑥𝑡

• Example: Heat Transfer in Solids


−(−𝜅𝛻𝑇) ∙ 𝑛 = ℎ(𝑇𝑒𝑥𝑡 − 𝑇)
• Mixed (Robin) boundary conditions
Boundary Conditions: Extremes?
−ΓԦ𝑖 ∙ 𝑛 = 𝜓
𝜓 𝑛
𝑢𝑒𝑥𝑡
𝜅𝑜
−(−𝜅𝛻𝑢) ∙ 𝑛 = (𝑢 − 𝑢)
𝐿𝑒𝑥𝑡 𝑒𝑥𝑡
𝑢 𝜅
( 𝐿𝑒𝑥𝑡 𝛻𝑢) ∙ 𝑛 = (𝑢𝑒𝑥𝑡 − 𝑢)
𝜅𝑜

𝜅𝑜 ≫ 𝜅 ⇒ 𝑢 = 𝑢𝑒𝑥𝑡
• Temperature, voltage, displacement
• Dirichlet boundary conditions
More on Boundary Conditions

• Built-in spring foundation • DIY boundary condition


𝑓 = 𝑓(𝑢, 𝑢)ሶ

https://www.comsol.com/blogs/how-to-make-boundary-conditions-conditional-in-your-simulation/
https://www.comsol.com/blogs/modeling-natural-and-forced-convection-in-comsol-multiphysics/
Part V: Surface Phenomena
• Boundary PDEs
• Edge PDEs
Lower Dimension PDE Interfaces
Built-In Interfaces for Lower Dimensional Physics
• Fluid Flow • AC/DC
– Pipe Flow (pfl) – Electric Currents, Shell (ecs)
– Water Hammer (whtd) • RF
– Thin-Film Flow, Shell (tffs) – Transmission Line (tl)
• Heat Transfer • Chemical and Reaction Engineering
– Heat Transfer in Pipes (htp) – Surface Reactions (sr)
– Heat Transfer in Thin Shell (htsh) • Electrochemistry
– Heat Transfer in Thin Films (htsh) – Electrode, Shell (els)
– Heat Transfer in Fractures (htsh)
• Structural Mechanics
– Shell (shell)
– Membrane (mbrn)
– Beam (beam)
– Truss (truss)
Part VI: Miscellaneous
• PDEs in axisymmetric components
• Integrodifferential equations
• Nonlocal interactions
• Verification and validation
• Stabilization
PDEs in Axisymmetric Components
• In the PDE interfaces, differential operators do not have tensorial meanings
𝛻∙Γ=𝑄 Axisymmetry
1 𝜕(𝑟Γ𝑟 ) 𝜕Γ𝜙 𝜕Γ𝑧
+ + =𝑄
𝑟 𝜕𝑟 𝜕𝜙 𝜕𝑧
𝜕Γ𝑟 𝜕Γ𝑧 Γ𝑟
+ + =𝑄 𝜕Γ𝑟 𝜕Γ𝑧
𝜕𝑟 𝜕𝑧 𝑟 + =𝑓
• The source term is your friend! 𝜕𝑟 𝜕𝑧
COMSOL Blog Post
• Guidelines for Equation-Based Modeling in
Axisymmetric Components
– https://www.comsol.com/blogs/guidelines-for-
equation-based-modeling-in-axisymmetric-
components/
Integrodifferential Equations

𝐼 = න 𝑐𝐴 𝑑𝑥 Integration Coupling Operator


0
𝑠

𝐼(𝑠) = න 𝑐𝐴 𝑑𝑥 ?
0
Variable Limits of Integration

𝑠 𝐿
𝐼(𝑠) = ‫׬‬0 𝑐𝐴 𝑑𝑥=‫׬‬0 𝑘(𝑠, 𝑥)𝑐𝐴 𝑑𝑥
Integration Coupling operator!
𝑠 𝐿
𝐼(𝑠) = ‫׬‬0 𝑐𝐴 𝑑𝑥=‫׬‬0 𝑘(𝑑𝑒𝑠𝑡(𝑥), 𝑥)𝑐𝐴 𝑑𝑥
Solving Integrodifferential Equations
𝐿
𝜕𝑇 𝜕 𝜕𝑇
𝜌𝐶𝑝 + −𝜅 = 𝑎𝑇 4 − 𝑏 න 𝐾 𝑥, 𝑠 𝑇(𝑠)4 𝑑𝑠
𝜕𝑥 𝜕𝑥 𝜕𝑥 0
Source 1: a*T^4

Source 2: -b*intop1(K(dest(x),x)*T^4)

https://www.comsol.com/blogs/integrals-with-moving-limits-and-solving-integro-differential-equations/
Nonlocal Interactions: Component Coupling Operators
Purpose:
• Pass data from one part of a component to
another
• Pass data between different components
𝑞𝑑 𝑥𝑑 = 𝑓 𝑞𝑠 𝑥𝑠
𝑇: 𝑥𝑑 → 𝑥𝑠
Usage:
• Define operator in the source
component/entity
• Use in the destination component/entity

https://www.comsol.com/blogs/part-2-mapping-variables-with-general-extrusion-operators/
Verification & Validation
• Exact solutions
• Benchmarks
• Analogous modules in COMSOL Multiphysics®
Verification
Method of manufactured solutions:
1. Assume a solution
2. Plug in PDE to get source term
  (cu  u   )  au  f
3. Find initial & boundary conditions
4. Compute with IC, BC, and source term
5. Compare assumed and computed solution
https://www.comsol.com/blogs/verify-simulations-with-the-method-of-manufactured-solutions/
Stabilization
u t  b  u  f
• Convection dominated
transport problems are ut  b  u    ( cu )  f
numerically unstable
• A simple stabilization
• Sophisticated techniques technique for convective
implemented in physics transport problems
interfaces

https://www.comsol.com/blogs/understanding-stabilization-methods/
Hands-on #1
3D, time dependent
Use General form PDE

Computing integrals over time and space


(Adding ODE, global or distributed)
General Form – A more compact formulation

• Inside domain
 2u u
ea 2  d a    F
t t

• On domain boundary
 R  
T

n  G   
 u  
0R 

“Cooling” (0 at ends)
coefficient from u=0
general form R  u.

“Heat Source”

Coefficient form:
c=1
General form:
   ux uy uz  Transient 0->100 s
Transient Diffusion Equation + ODE
 2u u
ea 2  d a   (cu   u   )   u  au  f
u t
What if we wish to measure the global accumulation of “heat” over time?

U   u dV volume integral of solution


V

w   U dt time integral of volume integral


t
Adding a ODE
Transient Diffusion Equation + ODE
 2u u
ea 2  d a   (cu   u   )   u  au  f
u t
What if we wish to measure the global accumulation of “heat” over time?

U   u dV
V

dw
w  U dt 
t [ t 0 ,t1 ]
dt
U

wt  U  0 => This is a Global ODE in the


global state variable w
Global Equation ODE:
Same time-dependent problem as earlier
Time-dependent 0-100
Volume integration of u
ODE: wt-U
PDEs + Distributed ODEs

(what if the ODE is depending on space)


(comment on continuity of the solution)
Transient Diffusion Equation +
Distributed ODE
What if we get “damage” from local accumulation of “heat”.
Example of real application: bioheating

P ( x, y, z )   u ( x, y, z )dt local time


integral of solution t

We want to visualize the P-field to assess local damage.


Let’s assume damage happens where P>20.
dP
  u at each point in space
dt
Transient Diffusion Equation +
Distributed ODE
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, c = 0, f = u, da=1
Let all other coefficients be zero
Or use new Domain ODEs and DAEs interface
Use of logical operators

Volume where P>20 and we


get damage
Questions?
Let’s compare
• derived values
• with the value obtained using the operator “timeint”
What’s timeint?

Вам также может понравиться