Top Banner
Couple OpenFOAM with any other solver using preCICE Gerasimos Chourdakis et al. Technical University of Munich Department of Informatics Chair of Scientific Computing in Computer Science 2nd German OpenFoam User meetiNg TU Braunschweig February 21, 2018
36

Couple OpenFOAM with any other solver using preCICE€¦ · Couple OpenFOAM with any other solver using preCICE Gerasimos Chourdakis et al. Technical University of Munich Department

Oct 21, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • Couple OpenFOAM with any other solver using preCICE

    Gerasimos Chourdakis et al.

    Technical University of MunichDepartment of InformaticsChair of Scientific Computing in Computer Science

    2nd German OpenFoam User meetiNgTU BraunschweigFebruary 21, 2018

  • AgendaPart I:

    +

    Part II:

    +

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 2

  • AgendaPart I:

    +

    Part II:

    +

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 2

  • How to simulate this heat exchanger?

    Geometry of a shell-and-tube heat exchanger (Image by L. Cheung Yau, 2016)

    Surface plot and streamlines of the two fluids colored by temperature. Solid not shown.

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 3

  • A shell-and-tube heat exchanger with preCICE

    Coupling interfaces (Image by L. Cheung Yau, 2016)

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 4

  • preCICEprecise Code Interaction Coupling Environment

    Solver A Solver B

    CommunicationData Mapping

    Coupling Schemes

    libprecice adapter

    • Free (GNU LGPL), developed at TU Munich & Univ. of Stuttgart.• Version 1.0 in November 2017 (10+ years, 3 PhD generations).• Official adapters for CalculiX, Code_Aster, COMSOL, Fluent, OpenFOAM, SU2

    • Third-party adapters for Ateles, Alya, Carat++, FASTEST, FEAP, foam-extend, ...• API in C, C++, Fortran, Python

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 5

  • But why preCICE?

    OpenFOAM

    CalculiX

    in-housesolver

    adapter

    libpreciceCHT

    FSI

    • Pure library approach→ flexibility• Fully parallel, peer-to-peer concept→ scalable and efficient communication• Sophisticated and robust quasi-Newton coupling algorithms• Multi-coupling

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 6

  • The roles of an adapter

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 7

  • Part IIa: previous approach

    +

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 8

  • Duplicated development effort

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 9

  • Duplicated development effort

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 9

  • Duplicated development effort

    All these adapters are bound to specific solvers!

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 9

  • Duplicated development effort

    All these adapters are bound to specific solvers!→We need an official, general adapter!

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 9

  • Example of an adapted solver (previous)

    1 /* Adapter: Initialize coupling */2 adapter.initialize();3

    4 Info

  • Before: Working and validated prototypes

    Image from desertcart.ae.

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 11

  • Before: Working and validated prototypes

    Image from desertcart.ae.

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 11

  • Now: A user-friendly, plug-and-play adapter

    The human-like figure is a property of ikea.com.

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 12

  • Part IIb: a new, official adapter

    +

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 13

  • Making this a function object

    Several challenges:• No changes in the source allowed− Cannot use variables directly− Ask the objects’ registry• One adapter for all the solvers and problem types− Some parameters are not available• Only one call to execute() at the end− We may need to reload a checkpoint at the last timestep...− Set the endTime to GREAT and exit when ready.

    • Collaboration with other function objects− At the end, call any other end() methods explicitly.

    • Error handling− read() degrades errors to warnings− Catch them and throw them in execute

    • One adapter for all the OpenFOAM flavors and versions?− E.g. boundaryField() and boundaryFieldRef()− E.g. missing adjustTimeStep()− How to distribute? Branches/Tags? Preprocessor ifdef?

    • ...

    Several advantages:• No source code changes• Load at runtime• (mostly) Solver agnostic

    However:• Still ready-to-run only for CHT• but...

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 14

  • Making this a function object

    Several challenges:• No changes in the source allowed− Cannot use variables directly− Ask the objects’ registry• One adapter for all the solvers and problem types− Some parameters are not available• Only one call to execute() at the end− We may need to reload a checkpoint at the last timestep...− Set the endTime to GREAT and exit when ready.

    • Collaboration with other function objects− At the end, call any other end() methods explicitly.

    • Error handling− read() degrades errors to warnings− Catch them and throw them in execute

    • One adapter for all the OpenFOAM flavors and versions?− E.g. boundaryField() and boundaryFieldRef()− E.g. missing adjustTimeStep()− How to distribute? Branches/Tags? Preprocessor ifdef?

    • ...

    Several advantages:• No source code changes• Load at runtime• (mostly) Solver agnostic

    However:• Still ready-to-run only for CHT• but...

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 14

  • Making this a function object

    Several challenges:• No changes in the source allowed− Cannot use variables directly− Ask the objects’ registry• One adapter for all the solvers and problem types− Some parameters are not available• Only one call to execute() at the end− We may need to reload a checkpoint at the last timestep...− Set the endTime to GREAT and exit when ready.

    • Collaboration with other function objects− At the end, call any other end() methods explicitly.

    • Error handling− read() degrades errors to warnings− Catch them and throw them in execute

    • One adapter for all the OpenFOAM flavors and versions?− E.g. boundaryField() and boundaryFieldRef()− E.g. missing adjustTimeStep()− How to distribute? Branches/Tags? Preprocessor ifdef?

    • ...

    Several advantages:• No source code changes• Load at runtime• (mostly) Solver agnostic

    However:• Still ready-to-run only for CHT• but...

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 14

  • An extensible adapter

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 15

  • OK! I want to use it!

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 16

  • OpenFOAM configuration

    1 // system/controlDict

    2 functions

    3 {

    4 preCICE_Adapter

    5 {

    6 type preciceAdapterFunctionObject;

    7 libs ("libpreciceAdapterFunctionObject.so");

    8 }

    9 }

    Set the appropriate boundary condition types:

    1 // 0/T2 interface3 {4 type fixedValue;5 value uniform 300;6 }7

    8 // other types: fixedGradient, mixed

    Properties for incompressible solvers:

    1 // constant/transportProperties2 rho rho [ 1 -3 0 0 0 0 0 ] 1;3 Cp Cp [ 0 2 -2 -1 0 0 0 ] 5000;

    Properties for basic solvers:

    1 // constant/transportProperties2 k k [ 1 1 -3 -1 0 0 0 ] 100;

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 17

  • OpenFOAM configuration

    1 // system/controlDict

    2 functions

    3 {

    4 preCICE_Adapter

    5 {

    6 type preciceAdapterFunctionObject;

    7 libs ("libpreciceAdapterFunctionObject.so");

    8 }

    9 }

    Set the appropriate boundary condition types:

    1 // 0/T2 interface3 {4 type fixedValue;5 value uniform 300;6 }7

    8 // other types: fixedGradient, mixed

    Properties for incompressible solvers:

    1 // constant/transportProperties2 rho rho [ 1 -3 0 0 0 0 0 ] 1;3 Cp Cp [ 0 2 -2 -1 0 0 0 ] 5000;

    Properties for basic solvers:

    1 // constant/transportProperties2 k k [ 1 1 -3 -1 0 0 0 ] 100;

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 17

  • preCICE & adapter configuration

    Solver A Solver B

    libprecice adapter

    XML

    preCICE Config

    YAML

    Adapter A Config

    YAML

    Adapter B Config

    To run the simulation, just execute the solvers as usual.

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 18

  • Tutorials

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 19

  • Example: Biomedical applications

    • FSI simulation of an aortic bloodflow• Joint work with the Barcelona Supercomputing Center

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 20

  • Example: Multi-fluid coupling

    • Besides FSI, many other possibleapplications of preCICE

    • Simulation of a subsonic jet• Explicit, parallel coupling between three fluid

    solvers• Joint work with the University of Siegen

    Linearized EulerEquations

    EulerEquations

    Navier-StokesEquations

    EulerEquations

    Linearized EulerEquations

    Info

    w

    Outfow

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 21

  • Does it work with “chocolate” OpenFOAM?

    Known to work with:The OpenFOAM Foundation: 4.0 – devESI - OpenCFD: v1706

    Currently does not work with:The OpenFOAM Foundation: ≤ 3.0ESI - OpenCFD: ≤ v1606+foam-extend: any version

    Coming soon:• Support for older versions• Code improvements and tests• Fluid-Structure Interaction Module

    Contribute on GitHub!

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 22

  • Questions?Website: precice.orgSource/Wiki: github.com/precice �

    Mailing list: precice.org/resourcesMy e-mail: [email protected]

    Homework:• Follow a tutorial• Join our mailing list• Star on GitHub• Send us feedback• Ask me for stickers

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 23

    precice.orggithub.com/preciceprecice.org/[email protected]

  • Questions?Website: precice.orgSource/Wiki: github.com/precice �

    Mailing list: precice.org/resourcesMy e-mail: [email protected]

    Homework:• Follow a tutorial• Join our mailing list• Star on GitHub• Send us feedback• Ask me for stickers

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 23

    precice.orggithub.com/preciceprecice.org/[email protected]

  • Additional slide: Time step sizes

    Time step sizes and checkpointing

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 24

  • Additional slide: Function Objects

    Callbacks in OpenFOAM function objects

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 25

  • Additional slide: The CHT Module

    The Conjugate Heat Transfer module

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 26

  • Additional slide: preCICE scaling

    Strong scaling of a coupled simulation with two Ateles participants and 5.7 ·107dofs

    Gerasimos Chourdakis (TUM) | Couple OpenFOAM with any other solver using preCICE | Feb 21, 2018 | GOFUN2 27