Implementation of Simple FSI Model with functionObject

2 downloads 0 Views 11MB Size Report
Jul 22, 2016 - Tacoma Narrows Bridge Collapse (USA, 1940). Source: http://www.youtube.com/watch?v=nFzu6CNtqec. Matvey Kraposhin, Ilia Marchevsky.
Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Implementation of Simple FSI Model with functionObject Matvey Kraposhin, Ilia Marchevsky

Institute for System Programming of RAS Bauman Moscow State Technical University

Guimar˜aes, June 28th , 2016 revised: July 22nd , 2016 Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

1 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Outline 1

Training course materials

2

What is FSI Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

3

FSI model problem FSI example: circular cylinder wind resonance Chosen solution approaches

4

How to implement extensions for OpenFOAM Different strategies to extend OpenFOAM fvOption facility functionObject facility

5

How to implement FSI with functionObject FSI example: circular cylinder wind resonance “Hello, World” functionObject Simplest coupling strategy implementation Restart implementation

6

Numerical example Validation example for laminar flow Turbulent flow example Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

2 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

1

Training course materials

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

3 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Training course materials Location of the course: https://github.com/unicfdlab/TrainingTracks/ Folder simpleFsi-OF3.0.0 for OpenFOAM 3.0.0 version of this course No. 1

Name cases

2

geometry

3

papers

4

src

5

materials

Description Cases that will be used to demonstrate functionObject’s created during the track Contains geometry and mesh files created with SALOME platform, version 7.3.0 Papers that were used in this course. If paper is open-access, then the PDF is placed, otherwise only the reference Source code of functionObject classes considered in this track This presentation and other materials that were used in this course

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

4 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

2

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

What is FSI Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

5 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Examples of FSI in nature and engineering practice What is FSI? Fluid-Structure-Interaction Describes interaction between fluid (liquid or gas) and solid body (structure) in a system fluid interacts with a solid structure, exerting pressure that may cause deformation or displacement in the structure and, thus, alter the flow of the fluid itself

Typically connected with “bad” things fluttering of airplanes deformations vibrations collapse of constructions

Interesting for many researchers in physics, mathematics and computer science Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

6 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Tacoma Narrows Bridge Collapse (USA, 1940)

Source: http://www.youtube.com/watch?v=nFzu6CNtqec Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

7 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Volgograd ‘Dancing’ Bridge (Russia, 2010)

Source: http://www.youtube.com/watch?v=G0RcnngwJ_Q Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

8 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

VIVACE Energy Generator

Source: http://www.youtube.com/watch?v=IcR8HszacOE Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

9 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Flow simulation around movable structures (1) SPH-method

Lagrangian description fluid particles carry their own properties (density, momentum, etc.) ρ(p, t), V (p, t), P (p, t) http://youtube.com/watch?v=EcAZv5xcvn8

low numerical viscosity arbitrary body motion & deformation

Viscous Vortex Domains method (VVD)

may be computationally expensive SPH, PFEM, Vortex Methods, etc http://youtube.com/watch?v=H- snLmMQK0Y

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

10 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Flow simulation around movable structures (2) Eulerian description

Body-fitted mesh

flow properties at every point in space ρ(x, t), V (x, t), P (x, t) not very large displacement & rotation requires mesh deformation/reconstruction ‘body fitted’ mesh methods

http://youtube.com/watch?v=mt2wv5P5zaY

LS-STAG immersed boundary method

ALE description Arbitrary Lagrangian-Eulerian approach Overset meshes (Chimera, etc) Immersed boundary (IB) methods Matvey Kraposhin, Ilia Marchevsky

http://youtube.com/watch?v=H- snLmMQK0Y

Implementation of Simple FSI Model with functionObject

11 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Different approaches for solving FSI problems FSI problems

Monolithic approach

Partitioned approach sdf

Monolithic approach

ds

Treats coupled fluid and structure equations simultaneously System is in general nonlinear, solution involves Newton’s method Advantages: high accuracy & stability

Disadvantages: expensive computation of derivatives (Jacobian matrix) loss of software modularity due to the simultaneous solution of fluid and structure Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

12 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Partitioned approach Example: The piston problem (Interface region expanded for clarity). m fluid

k

Advantages:

pf ps l

Advantages & Disadvantages

customization

z

independent modeling

Figure 1. The piston problem (Interface region expanded for clarity).

Basic ideas

software reuse

2.3 Interface conditions

Systems spatially decomposed into partitions

The interface conditions for the fluid-structure system can be expressed as a dynamic condition and two kinematic conditions. Dynamic equilibrium at the interface requires the pressure to be equal at either side of the interface :

Solution is separately advanced in time over each ps = pf . partition (4) Partitions interact on their interface

The first kinematic compatibility condition requires that the position of the fluid boundary, l, is equal to its initial position, l0 , plus the structural displacement. The second requires that the fluid velocity at the boundary is equal to the velocity of the moving boundary. This can be expressed as follows :

Interaction by transmission and synchronization of coupled state (5a) variables l = l0 + z, u = l.˙

modularity

Disadvantages: requires careful formulation and implementation to avoid serious degradation in stability and accuracy parallel implementations are error-prone

(5b)

Michler C., Hulshoff S.J., van Brummelen E.H., de Borst R. A monolithic approach to fluid-structure interaction // Computers & Fluids. 2004. Vol. 33, Is. 5–6. P. 839–848 Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

13 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Example: Monolithic approach Governing equations:  3x˙ + 4x − y = f (t), y˙ + 6y − 2x = g(t)

𝑓(𝑡)

𝑔(𝑡)

X

𝑥(𝑡)

Backward Euler scheme:

Y

𝑦(𝑡)

xn+1 = xn + x˙ n+1 ∆t, y n+1 = y n + y˙ n+1 ∆t

Monolithic coupling scheme Purely implicit discretization scheme leads to common linear system for new state (xn+1 , y n+1 ) of all coupled subsystems:    n+1   n+1  3 + 4∆t −∆t x f ∆t + 3xn = −2∆t 1 + 6∆t y n+1 g n+1 ∆t + y n Felippa C.A., Park K.C., Farhat C. Partitioned analysis of coupled mechanical systems // Department of Aerospace Engineering Sciences and Center for Aerospace Structures University of Colorado at Boulder Boulder. 1999. Report No. CU-CAS-99-06. 28 p. Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

14 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

𝑓(𝑡)

𝑥(𝑡)

X Example: Partitioned approach

Governing equations:  3x˙ + 4x − y = f (t), y˙ + 6y − 2x = g(t)

𝑓(𝑡)

𝑔(𝑡)

X

𝑔(𝑡)

Y

Y

Simple partitioned scheme (weakly coupled scheme) 1. Predict:

y∗n+1

=

yn

+

𝑥(𝑡)

Backward Euler scheme:

𝑦(𝑡)

xn+1 = xn + x˙ n+1 ∆t, y n+1 = y n + y˙ n+1 ∆t

𝑦(𝑡)

𝑥𝑛

Step 2: Ax

y˙ n ∆t

𝑥 𝑛+1 Step 3: S

+ 3xn + y∗n+1 3 + 4∆t

f n+1 ∆t

2. Advance x:

xn+1

=

3. Substitute:

xn+1 ∗

= xn+1

4. Advance y:

y n+1 =

Step 4: Ay

g n+1 ∆t + y n + 2xn+1 ∗ 1 + 6∆t

Matvey Kraposhin, Ilia Marchevsky

𝑦𝑛

𝑦 𝑛+1

Time

Implementation of Simple FSI Model with functionObject

15 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM 𝑛 𝑛 How to implement FSI with functionObject Numerical example

𝑦

𝑦

StepStep 3: S 3: S

𝑦

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach 𝑛+1 𝑛+1 applications architectures FSI-simulation

𝑦

StepStep 4: Ay4: Ay

Different coupling strategies TimeTime StepStep 2 2𝑛+1 𝑛+1 𝑥 𝑥

𝑥𝑛 𝑥𝑛

𝑥 𝑛+2𝑥 𝑛+2

StepStep 3 3

𝑦𝑛 𝑦𝑛

𝑦 𝑛+1𝑦 𝑛+1 StepStep 4 4

StepStep 2 2𝑛+1 𝑛+1 𝑥 𝑥

𝑥𝑛 𝑥𝑛

𝑥 𝑛+2𝑥 𝑛+2

StepStep 1 1 𝑦 𝑛+2𝑦 𝑛+2

TimeTime

𝑦𝑛 𝑦𝑛

𝑦 𝑛+1𝑦 𝑛+1 StepStep 2 2

𝑦 𝑛+2𝑦 𝑛+2

TimeTime

Suppose two communicating programs (“staggered” solution procedure)

With two predictors (both x and y) both programs advance concurrently

One predictor (y)

Better for parallelization

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

16 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Weak & strong coupling Weakly coupled strategies

Strongly coupled strategies

single (one for the fluid part and one for the structure) solution per time step

alternate fluid and structure solutions within a time step until convergence

easy to implement

treat the interaction between the fluid and the structure synchronously

loss of conservation properties of the continuum fluid-structure system (energy increasing, unstable)

maintain conservation properties

time step is usually small

greater computational cost per time step

improvements by predictors (accuracy and stability)

algorithmic improvements possible

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

17 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

Algorithmical improvements of the partitioned approach 11th OpenFOAM Workshop, Guimaraes, 2016

SubiterationAlgorithmical in detail improvements of the partitioned approach 1

2

3

4

Kinematic condition: fluid velocity = structure velocity Constitutes a boundary condition for the initial-boundary-value problem of the fluid Solve the fluid: the result is the flow velocity and pressure fields Dynamic condition: the result is the fluid pressure (the forces) acting on the structure surface Solve the structure: the result23.Sept.-5.Okt. is the displacement of 2007 every point on the structure Matvey Kraposhin, Ilia Marchevsky

t = t + Δt

No

No Yes

FSI converged

t = tend

Yes

End

Initializ.

Computation of flow field (finite volumes)

mesh

uj

p, vj

Computation of wall forces

Computation of modified mesh

Fw

Computation of deformations (finite elements)

Atanas Gegov, TU München

Implementation of Simple FSI Model with functionObject

18

18 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Examples of FSI in nature and engineering practice Different approaches for solving FSI problems Coupling strategies for partitioned approach FSI-simulation applications architectures

FSI-simulation applications architectures Coupling Scheme Direct communication Fluid coupling scheme inside the Solver programs

Client-server communication Structure Solver

application calls the other for new boundary conditions

requests from client

Structure Solver Communication

Libraries

Coupling interface

Coupling interface

Fluid Solver

applications as servers

Matvey Kraposhin, Ilia Marchevsky

Coupling Scheme Fluid Solver

Structure Solver

Implementation of Simple FSI Model with functionObject

19 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

3

FSI example: circular cylinder wind resonance Chosen solution approaches

FSI model problem FSI example: circular cylinder wind resonance Chosen solution approaches

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

20 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

FSI example: circular cylinder wind resonance Chosen solution approaches

FSI example Governing Equations

C U

~  ∂U ~ ·∇ U ~ = ν∆U ~ − ∇p + U ∂t ρ ~ =0 ∇·U

M

K

M y¨ + C y˙ + Ky = Fy (t)

Dimensionless parameters f ·D U∞ U∞ · D Re = ν U∞ Ur = fn · D 4M ∗ m = ρf πD2 L C ζ= √ 2 KM St =

Notation

– Strouhal number

y(t), Fy

– cylinder vertical displacement and lift force (m, N)

– Reynolds number

M , C, K – system mass, damping coefficient and rigidity (kg, N s/m, N/m)

– reduced velocity

D, L

– mass ratio

U∞ , ρ, ν – flow velocity, density and kinematic viscosity (m/s, kg/m3 , m2 /s) f

– damping ratio

Matvey Kraposhin, Ilia Marchevsky

fn

– cylinder diameter and length (m)

– lift force frequency (Hz) q 1 K – eigenfrequency, fn = 2π M Implementation of Simple FSI Model with functionObject

21 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

FSI example: circular cylinder wind resonance Chosen solution approaches

Chosen solution approaches Flow simulation:

Client-server architecture

– FVM — Finite volume method – ALE — Arbitrary Lagrangian-Eulerian

Structure simulation: – Dynamic model with 1 degree of freedom – RK — Runge-Kutta 2nd order scheme

Custom functionObject Mesh motion library

Fluid Solver

Coupling Scheme

Forces functionObject library

Structure Solver

Coupling strategy: – Partitioned approach – Weak coupling without predictor

Matvey Kraposhin, Ilia Marchevsky

OpenFOAM solver incompressible flow mesh motion

Structure solver 1D oscillator

Implementation of Simple FSI Model with functionObject

22 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

4

Different strategies to extend OpenFOAM fvOption facility functionObject facility

How to implement extensions for OpenFOAM Different strategies to extend OpenFOAM fvOption facility functionObject facility

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

23 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Different strategies to extend OpenFOAM fvOption facility functionObject facility

Different strategies to extend OpenFOAM

Develop new solver

Difficult for further extension

Develop new library: – user-defined boundary condition – user-defined fvOption – user-defined functionObject

→ → →

Use run-time compiled input data: – coded boundary condition – coded fvOption – coded functionObject

Matvey Kraposhin, Ilia Marchevsky

breaks client-server architecture assumes direct matrix modification primarily designed for postprocessing

 

needs special permissions for execution



difficult to debug

Implementation of Simple FSI Model with functionObject

24 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Different strategies to extend OpenFOAM fvOption facility functionObject facility

fvOption facility Execution order diagram Equition to be solved:

d dt

Z

Z Y (x, t) =

V

S(x, t) V

Solver operations Formulation of discrete equation in solver P V n ρn Y n −V o ρo Y o + φf Yfn = S n ∆t

fvOption operations

f

Adding “sources” from fvOption to solver matrix A and r.h.s. b ::addSup(...) AY n = b Manipulation with matrix A from solver in fvOption ::constrain(...) Y n = A−1 b Manipulation with new solution Y n in fvOption ::correct(...) Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

25 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

Different strategies to extend OpenFOAM fvOption facility functionObject facility

functionObject facility — execution order diagram main/solver

functionObject

«New» time step

«Old» time step

::read(...) ::start() ...

...

t o< te

::read(...) ::execute(...)

Δ tn n o t = t + Δ tn Solve equations d ∫ Y ( x ,t ) = ∫ S( x ,t ) dt V V

::adjustTimeStep() ::timeSet()

Write results n

t r e a d ( d i c t ) ; } // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ D e s t r u c t o r ∗ ∗ ∗ ∗ ∗ Foam : : h e l l o W o r l d : : ˜ h e l l o W o r l d ( ) {} Matvey Kraposhin, Ilia Marchevsky

∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //

∗ ∗ ∗ ∗ ∗ //

readFields )

∗ ∗ ∗ ∗ //

Implementation of Simple FSI Model with functionObject

33 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

FSI example: circular cylinder wind resonance “Hello, World” functionObject Simplest coupling strategy implementation Restart implementation

helloWorld.C (2) // ∗ ∗ ∗ Member F u n c t i o n s

∗ ∗ ∗ //

v o i d Foam : : h e l l o W o r l d : : r e a d ( c o n s t d i c t i o n a r y& d i c t ) { forces : : read ( d i c t ) ; } v o i d Foam : : h e l l o W o r l d : : w r i t e ( ) { i f (! active ) { return ; } forces : : write () ; I n f o C ; d i c t . l o o k u p ( ”K” ) >> K ; d i c t . l o o k u p ( ”R” ) >> R ; d i c t . l o o k u p ( ”Ymax” ) >> Ymax ; } v o i d Foam : : b a s i c F s i : : s e t D i s p l a c e m e n t s ( v o l V e c t o r F i e l d& y D i s p l ) { i f ( Pstream : : parRun ( ) ) Pstream : : s c a t t e r (Y . f i r s t ( ) ) ; v e c t o r YPatch ( 0 . 0 , Y . f i r s t ( ) , 0 . 0 ) ; f o r A l l C o n s t I t e r ( labelHashSet , patchSet , i t e r ) { l a b e l p a t c h I d = i t e r . key ( ) ; f o r A l l ( yDispl . boundaryField () [ patchId ] , faceI ) y D i s p l . b o u n d a r y F i e l d ( ) [ p a t c h I d ] [ f a c e I ] = YPatch ; } }

Matvey Kraposhin, Ilia Marchevsky

Implementation of Simple FSI Model with functionObject

44 / 62

Training course materials What is FSI FSI model problem How to implement extensions for OpenFOAM How to implement FSI with functionObject Numerical example

FSI example: circular cylinder wind resonance “Hello, World” functionObject Simplest coupling strategy implementation Restart implementation

write() function in basicFsi.C v o i d Foam : : b a s i c F s i : : w r i t e ( ) { i f (! active ) return ; forces : : write () ; v o l V e c t o r F i e l d& y D i s p l = c o n s t c a s t ( o b r . l o o k u p O b j e c t (” c e l l D i s p l a c e m e n t ” ) ) ; i f ( Pstream : : m a s t e r ( ) ) { scalar scalar vector scalar

d t = y D i s p l . mesh ( ) c t = y D i s p l . mesh ( ) force = forceEff () yForce = f o r c e . y ()

P a i r Ymid ; ... Y . f i r s t () = . . . ;

. time () . deltaT () . value () ; . time () . value () ; ; ;

// F o r Runge−K u t t a 2−nd o r d e r method Y . s e c o n d ( )= . . . ;

Yold

= Y ;

i f ( l o g ) I n f o Ymax ; d i c t . l o o k u p ( ” append ” ) >> a p p e n d ; I n f o