Equation-Based Modeling

120 downloads 327 Views 3MB Size Report
Assume u=(u,v,w) and p given by Navier-Stokes. • Want to solve Convection-Conduction in gas: 0 u. ) (. = ∇∙. +. ∇. ∙∇. -
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 Insert predefined physics Insertpredefined predefinedphysics physics Coupling physics (manual Coupling or automatic) Couplingphysics physics(manual (manualor orautomatic) automatic)

•• Enter Enteruser userdefined definedfunctions. functions.All All expressions expressionscan can depend dependon onall all the the variables variablesintroduced introduced(analytical, (analytical, interpolation interpolationfrom fromfile file...) ...) •• Add Addor or change changeterms termsof ofthe theequations equations set setin in the thephysics physics(and (andmultiphysics) multiphysics) nodes nodes • Insert your own equations with equation forms (and make it automatic with Physics Builder)

 2u u ea 2  d a t t    (cu  u   )    u  au  f du  F ( u, t ) 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? •

Partial differential equations (PDE) – –



u    cu   f t Mechanics, CFD, EM…. .

Ordinary differential equations (ODEs) – – – –



Three main interfaces (form) Need boundary conditions

da

Global (space indipendent) Distributed (space dependent) Distributed, but not continuous (Always) time dependent

du  F ( u, t ) Electrical dt

circuits, 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 𝑐(𝑥, 𝑦, 𝑧, 𝑡)

Population dynamics

Contaminant amount 𝐶(𝑡)

Population dynamics

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

Example 1 : Dynamics 𝑚

𝑑2𝑢 𝑑𝑢 = −𝑘𝑢 − 𝑐 𝑑𝑡 2 𝑑𝑡

Example 2 : Prey-predator system 𝑑𝑢 = 𝑎1 𝑢 1 − 𝑢ൗ𝑘 − 𝑏1 𝑢𝑣 𝑑𝑡 𝑑𝑣 = −𝑎2 𝑣 + 𝑏2 𝑢𝑣 𝑑𝑡

𝑑𝑣 𝑑𝑢 𝑑2𝑢 𝑑𝑢 + 𝑎2 𝑣 − 𝑏2 𝑢𝑣 = 0 − 𝑎1 𝑢 1 − 𝑢ൗ𝑘 + 𝑏1 𝑢𝑣 = 0 𝑚 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 𝑢 − 𝑎𝑢 + 𝑔 𝑡 = 0 2 𝑑𝑡 𝑑2𝑢 𝑑𝑥2

− 𝑎𝑢 + 𝑔 𝑥 = 0 Spatial derivative

IVP = ODE BVP = PDE

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 pM  RT • Easy - analytical

• non-ideal gas law (needed for high molecular weight at very high pressures): 𝜌 solution of 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

V 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 Γ

𝑛 S

න [

V Localization argument

𝜕ϕ + 𝑑𝑖𝑣 ΓԦ = 𝑓 𝜕𝑡

𝑉

𝜕ϕ + 𝑑𝑖𝑣 ΓԦ − 𝑓]𝑑𝑉 = 0 𝜕𝑡

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 mass

Conservative flux convection Diffusion

Convection

Conservative flux source

Source

Absorption

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

Coefficient Form PDE Acoustics

𝒖 Pressure 𝐞𝐚 1/𝜌𝑐 2 𝒅𝐚 1/𝜌 𝒄 𝜸 𝜷 𝒂

𝑞𝑑 /𝜌

𝒇

𝑄𝑚

Chemistry

Black-Scholes

Fischer’s Ecologic Model

Concentration

Cost of option

Population

1

1

1

Diffusion coef.

1 − 𝜎 2𝑥 2 2

Dispersal rate

Velocity

𝑟𝑥 − 𝜎 2 𝑥 −𝑟

Reaction rate

𝑟(𝑢ൗ𝐾 − 1)

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 𝑓=𝑔 Option 1

𝑎=0 𝑓 = 𝑔 + 𝜅2𝑢 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 1 d a  1, c    2 x 2 2   rx   2 x, a   r https://www.comsol.com/model/the-black-scholes-equation-82

Alternative

1 d a  1, c    2 x 2 2   0, a   r f  (  rx   2 x)

u x

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:



Remember: –

– –

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

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/implementingthe-weak-form-in-comsol-multiphysics/

https://www.comsol.co.in/blogs/briefintroduction-weak-form/

https://www.comsol.com/blogs/strength-weak-form/ https://www.comsol.co.in/blogs/discretizing-theweak-form-equations/

Derivatives Solution field: Spatial 1st derivatives: Spatial 2nd derivatives: Time derivatives: Mixed derivatives: Derivatives tangent to surfaces: Derivatives of quantities other than the primary dependent variable:

u ux, uy, uz uxx, uxy, …, uyz, uzz ut, utt uxt, uytt uTx, uTy, uTz d(q,t),d(q,x)

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

Integrated Demo: Thermal Curing Physics T, α

x

Image by Joe Haupt — Own work. Licensed under CC BY-SA 2.0, via Wikimedia Commons.

Thermoset in the cavity Heated mold

Thermal Curing: Mathematical Model C p

T     (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 C p

T     (T )   H r t t

PDE

 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 t 2 ea

   d  f a t 2 t

d a 1, f  Ae (  Ea / RT ) (1   ) n

Domain ODE

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

𝑛1 → 𝑛, 𝑛2 → −𝑛

ΓԦ ∙ 𝑛=0

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 – Pipe Flow (pfl) – Water Hammer (whtd) – Thin-Film Flow, Shell (tffs) Heat Transfer – Heat Transfer in Pipes (htp) – Heat Transfer in Thin Shell (htsh) – Heat Transfer in Thin Films (htsh) – Heat Transfer in Fractures (htsh) Structural Mechanics – Shell (shell) – Membrane (mbrn) – Beam (beam) – Truss (truss)

• • • •

AC/DC – Electric Currents, Shell (ecs) RF – Transmission Line (tl) Chemical and Reaction Engineering – Surface Reactions (sr) Electrochemistry – Electrode, Shell (els)

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-forequation-based-modeling-in-axisymmetriccomponents/

Integrodifferential Equations 𝐿

𝐼 = න 𝑐𝐴 𝑑𝑥 0

Integration Coupling Operator

𝑠

𝐼(𝑠) = න 𝑐𝐴 𝑑𝑥 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 • Convection dominated transport problems are numerically unstable • Sophisticated techniques implemented in physics interfaces

u t  b  u  f ut  b  u    ( cu )  f

• A simple stabilization technique for convective transport problems

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



On domain boundary

 2u u ea 2  d a    F t t  R   n  G     u    0R  T

“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 t

time integral of volume integral

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

w

 U dt 

t [ t 0 ,t1 ]

wt  U  0

dw U dt => 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

integral of solution

local time

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?

Suggest Documents