Elmer and OpenFOAM coupler for coupling electromagnetics and fluid dynamics.
Elmer:
https://www.csc.fi/web/elmer
OpenFOAM:
http://openfoam.org/
Presented on February 2, 2017 @
University of Latvia, Faculty of Physics and Mathematics
Enjoy, like, share, distribute, remix, tweak, credit is not required.
2. Multiphysics software like
or
but without license fees
Efficient coupling b/w
● Electromagnetics
● Free surface fluids
● Heat transfer
Extra
● Solidification
● Melting
2
Motivation
3. 3
Our requirements
● 3D, time-dependent
● Complex A−V magnetic vector potential formulation
● High Reynolds turbulence models
● Volume of Fluid (VOF) for free surface
● Conductivity and viscosity dependence on temperature
● Complex geometries, multi-regions
● MPI parallelization with good scaling
5. 5
No one code solves our problem
.., but two codes coupled together can!
Elmer + OpenFOAM
● Both can simulate real stuff
● Straight-forward mesh interpolation
● Common pre/post processing (Salome, Paraview)
● Efficient, parallel coupling is very feasible
6. Elmer by CSC (Finland)
6
+ Multiphysics out-of-the-box
+ Extensive documentation and forum
+ Active, responsive developers
+ 40+ solvers, 400+ tests
+ Flexible meshes (tetra, pyramids, wedges, hexa)
+ Meshes from Salome (.unv)
+ Results to Paraview (.vtu)
- Complex code (Fortran), steep learning curve
7. Notable use cases for Elmer
7
● Electromagnetics
● Structural mechanics
● Ice sheet modelling
wikipedia.org
Credit F. Gillet-Chaulet
9. 9
Elmer OpenFOAM
Two-way coupling
File based
● SLOW and does not SCALE on parallel computers
MPI based
● Both codes already use MPI for parallelization
● Probably the most EFFICIENT coupling solution
10. 10
MPI - Message Passing Interface
Elmer
(2 processes)
OpenFOAM
(2 processes)
Run both codes simultaneously
mpirun -n 2 Elmer : -n 2 OpenFOAM
“application that
starts other
applications in
parallel”
MPI_SEND(
data,
type,
size,
to whom)
MPI_RECV(
data,
type,
size,
from whom)
11. 11
Interpolation between meshes
Efficient interpolation between parallel meshes is critical
● EM domain ≥ FD domain
● EM mesh coarser than FD mesh
Elmer => OF (≥1st order accuracy)
● Interpolation matrix, uses basis functions
OF => Elmer (0th order accuracy)
● Saves OF cell numbers for found Elmer nodes
12. 12
Adaptive coupling interval
● FD require smaller Δt than EM
● In steady regime no need to solve EM
● For low Re one OF t-step computes 5-10 times faster
Example: for fluid ratio α=[0,1] we can use condition
max(abs(αold
-α))>0.2
to find out whether surface has changed significantly
enough to call Elmer and update EM fields
13. 13
Relatively easy to set-up
Coupler consists of
● 2 OpenFOAM libraries
● 2 Elmer libraries
These libs take care of MPI communication
User specifies which variables to send/recv
User prepares simulation and runs it
Video (14min)
17. 17
Conclusions
Elmer + OpenFOAM coupler
● Based on MPI, low level
● Presumably good parallel scaling
● Basic tests for 2D/3D free surface MHD done
● It can be used for other Elmer/OpenFOAM solvers
TODO: Joule heating P, parametric σ(α,T), melting, …
Q: Where else it could be useful?
Simulation video
18. Thank you!
juris.vencels@gmail.com
Elmer + OpenFOAM coupler
Laboratory for mathematical modelling of
environmental and technological processes
University of Latvia
https://github.com/jvencels/OpenFOAM_Elmer