1 / 47

Support for Dymola in the Modeling and Simulation of Physical Systems with Distributed Parameters

Support for Dymola in the Modeling and Simulation of Physical Systems with Distributed Parameters. Student: Dshabarow Farid Professor: Prof. Fran ç ois Cellier Verantwortlich: Prof. Walter Gander. Outline. Objectives of the Master Thesis Building Blocks Dymola and Modelica

calhoun
Download Presentation

Support for Dymola in the Modeling and Simulation of Physical Systems with Distributed Parameters

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Support for Dymola in the Modeling and Simulation of Physical Systems with Distributed Parameters Student: Dshabarow Farid Professor: Prof. François Cellier Verantwortlich: Prof. Walter Gander

  2. Outline • Objectives of the Master Thesis • Building Blocks • Dymola and Modelica • Partial Differential Equations • Method of Lines • Finite Volume Method • General Block • Conclusion • Literature

  3. Objectives of the Master Thesis • Create blocks in Dymola that can be used to „construct“ partial differential equations (PDEs) and implement numerical methods to solve them • Numerical Methods: • Method of Lines • Finite Volume Method • Adaptive Method of Lines

  4. Building Blocks: PDE • PDE Blocks Which blocks do we need for PDEs? For example: • Derivator Block • Integrator Block • Blocks for Addition, Subtraction, Product, ...

  5. Building Blocks: PDE • PDE Construction After we have the blocks, we can use them to construct PDEs

  6. Example: Advection Equation dq/dt = - c * dq/dx

  7. Example: Advection Equation

  8. Dymola & Modelica • Dymola (Dynamic Modeling Laboratory) is an integrated environment for the modeling and simulation of physical systems in Modelica language • Modelica is a general, high-level language for object-oriented modeling with differential-algebraic equations • Dymola provides standard blocks like sum, product, division, ...

  9. PDE Library • Provides necessary blocks for the PDEs „construction“ and numerical methods for their solution • Implements new blocks and uses standard blocks provided by Modelica • Two numerical methods are provided for solving PDEs: • Method of Lines • Finite Volume Methods

  10. Partial Differential Equations • Definition: A partial differential equation is an equation involving partial derivatives of an unknown function with respect to more than one independent variable • Examples: • Diffusion equation: • Wave equation:

  11. Method of Lines (1D) • The Method of Lines (MOL) solves numerically a PDE by discretizing the space variable but leaving the time variable continuous • We are thus converting a PDE into a set of Ordinary Differential Equations (ODEs)! • Advantage: efficient ODE solvers are known

  12. Method of Lines: Heat Equation • Example: Heat equation

  13. Method of Lines: Heat equation • MOL solution to the heat equation Picture from „Scientific Computing“, M. Heath

  14. Method of Lines: Implementation • Integrator block R

  15. Method of Lines: Implementation • Derivator block: computes derivatives • Provided blocks: • Use Newton-Gregory polynomial to compute the derivatives First-order derivative Second-order derivative

  16. Method of Lines: Implementation • Derivator block: includes three derivative blocks, each with different order of approximation accuracy • Different approximation orders can be selected by the user through the appropriate parameter • Provided approximation orders: • Second-order central difference approximation • Fourth-order central difference approximation • Sixth-order central difference approximation

  17. Method of Lines: Boundary Conditions • There are many possibilities to specify boundary conditions: • Dirichlet The solution of the function at the boundary point is specified • Von Neumann The derivative of the function at the boundary point is specified • Robin A combination of the solution and derivative values of the function at the boundary point is specified • PDE Library currently allows Dirichlet boundary condition and a special case of von Newmann boundary condition: ∂u/∂x = 0

  18. Method of Lines: Examples • Wave equation Cannot be passed to the integrator block in this form X v = ut

  19. Method of Lines: Examples • Wave equation

  20. Method of Lines: Examples • MOL solution to the wave equation 10 grid points were used error ~ 10-2

  21. Method of Lines: Examples • Simple supported beam equation X v = ut w = uxx

  22. Method of Lines: Examples • Simple supported beam equation

  23. Method of Lines: Examples • Simple supported Beam equation 10 grid points 60 grid points

  24. Finite Volume Methods (1D) • Subdivide the spatial domain into intervals (cells) • Approximate the integral of the function q over each of these cells at each time step • Denote the i-th cell by Ci = (xi-1/2, xi+1/2), then the approximation to the average of q in the cell Ci at time t, Qi, is

  25. Finite Volume Methods (1D) • Example: cell average approximation with a constant function • Other approximations: linear (slope # 0), logarithmic, … ... ...

  26. Finite Volume Methods (1D) • How can we find this approximation? • Conservation laws: the average within the cell can only change due to fluxes at the boundaries (assumption: no sink and no source in the cell) • The integral form of the conservation law:

  27. Finite Volume Methods (1D) Integrate in time from t to t+Δt Divide by Δx ≈ Qit+Δt ≈ Qit

  28. Finite Volume Methods (1D) • Average update rule where approximates the average flux along xi-1/2

  29. Finite Volume Methods (1D) • The average update rule can also be written in this form • We have thus an ODE for each cell!

  30. Finite Volume Methods (1D) • Example of fluxes: • Advection equation: qt + uqx = 0 t Fi-1/2 = uQi-1 if u > 0 Fi-1/2 = uQi otherwise t+Δt

  31. Finite Volume Methods: Ghost Cells • Instead of writing special formulas for boundary cells, extend the domain with additional cells, the ghost cells

  32. Finite Volume Methods: Implementation • Integrator block

  33. Finite Volume Methods: Implementation • Flux block: Upwind Fi-1/2 = uQi-1 if u > 0 Fi-1/2 = uQi if u < 0 u

  34. Example: Advection Equation • Upwind flux used

  35. Example: Advection Equation • FVM solution to the advection equation • 10 cells used • Maximum error magnitude of order 10-1

  36. Example: Euler Equations • Fluids (liquids and gases) are governed by conservation laws: • Conservation of mass • Conservation of momentum • Conservation of energy • The resulting system of 3 equations gives the Euler equations of gas dynamics

  37. Example: Euler Equations • How do these equations look like?  It depends on the chosen model • Two fundamental ways to derive the equations: • Eulerian approach • Lagrangian approach

  38. Example: Euler Equations • Consider for ex. the velocity field • Eulerian description: • Describes the behavior of the velocity field at a particular point over time • Lagrangian description: • Describes the behavior of the velocity of the particles as they move through the flow

  39. Example: Euler Equations • Euler system with Eulerian description: • γ = 1.4 for air • The fourth equation comes from the equation of state Conservation of mass Conservation of momentum Conservation of energy

  40. Example: Euler Equations Logarithmic Reconstruction

  41. Example: Euler Equations • FVM solution to Euler Equations: Density 10 cells used

  42. Example: Euler Equations • FVM solution to Euler Equations: Momentum 10 cells used

  43. Example: Euler Equations • FVM solution to Euler Equations: Energy 10 cells used

  44. General Block • Contains two integrators: • MOL Integrator • FVM Integrator • Can be used to solve PDEs with either MOL or FVM technique

  45. Conclusion • Method of Lines • Simple to implement • Gives accurate results • Not suited for the simulation of Euler equations (spurious oscillations) • Finite Volume Method • Poor Literature • Complicated theory • Equations must be rewritten in conservation form • First-order methods are not as accurate as Method of Lines • Better suited for the simulation of Euler equations

  46. Literature • Stanley J. Farlow: Partial Differential Equations for Scientists and Engineers • François E. Cellier, Ernesto Kofman: Continous System Simulation • Randall J. Leveque: Finite Volume Methods for Hyperbolic Problems • John D. Anderson: Computational Fluid Dynamics

  47. QUESTIONS?

More Related