Coupling two solvers

241 views
Skip to first unread message

Stephane Popinet

unread,
Jun 8, 2024, 10:47:38 AMJun 8
to basilisk-fr
Dear all,

You may be interested in this new example:

http://basilisk.fr/src/examples/master.c

Enjoy,

Stephane
OpenPGP_0x78F22AD6304D74BE.asc
OpenPGP_signature.asc

Øystein Lande

unread,
Jun 13, 2024, 5:16:42 AMJun 13
to basilisk-fr
That is surely a neat compilation trick which i have been searching for for quite some time!
Thank you for this Stephane. 

br, Øystein

viko...@gmail.com

unread,
Jun 13, 2024, 9:53:23 AMJun 13
to basilisk-fr
Stephane,

does this basilisk feature work on AMR grids? Any plans to extend it to quad/octree meshes?

Can master and slave work of different grids? 

We would like master solve kinetic equation in 3D and slave solve fluid in 2D or 1D 
(see COMSOL results in http://arxiv.org/abs/2406.05926 ).

All the best,

Vladimir

Stephane Popinet

unread,
Jun 13, 2024, 11:59:32 AMJun 13
to basil...@googlegroups.com
Hi Vladimir,

On 6/13/24 15:53, viko...@gmail.com wrote:
> Stephane,
>
> does this basilisk feature work on AMR grids? Any plans to extend it to
> quad/octree meshes?
>
> Can master and slave work of different grids?

Yes for both, see the recent (yesterday) example by Antoon:

http://basilisk.fr/sandbox/Antoonvh/omega.c

This is also "two-way" coupled.

cheers,

Stephane
OpenPGP_0x78F22AD6304D74BE.asc
OpenPGP_signature.asc

jmlopez...@gmail.com

unread,
Jun 13, 2024, 3:50:16 PMJun 13
to basilisk-fr
Thanks Stephane & Antoon,

The new functionality and examples are impressive.

Pepe

Wojciech Aniszewski

unread,
Jun 14, 2024, 4:52:11 AMJun 14
to Stephane Popinet, basil...@googlegroups.com
Hi,
at first glance (especially looking at Antoon's example) it should be possible e.g. to couple
a Navier Stokes solver on a coarser grid with, say, a diffusion.h-based solver on a much
finer grid (e.g. for heat transfer), am I right?

Are there any specific problems I have to expect using this master-slave trick with MPI?

(oh, and btw https://www.youtube.com/watch?v=vGbiNU6z128)

cheers
Voitek


--
/^..^\
( (••) ) Wojciech (Voitek) ANISZEWSKI
(|)_._(|)~
OrcId : https://orcid.org/0000-0002-4248-1194
Scholar : https://tinyurl.com/y28b8gfp
RG : https://www.researchgate.net/profile/Wojciech_Aniszewski
Mastodon: @w...@fediscience.org
Twitter : @echo_dancers3
GPG ID : AC66485E

Stephane Popinet

unread,
Jun 14, 2024, 6:49:09 AMJun 14
to basil...@googlegroups.com
Hi Pepe,

Note that the new functionality is not really "new". Aside from a few
subtleties in:

http://basilisk.fr/src/slave.h#synchronization-functions

it has been doable since Basilisk started. It actually is one of the
fundamental design choices made when switching from Gerris to Basilisk.
It leverages the "UNIX philosophy" i.e. a system designed (in the
1960s...) so that different programs and programming languages can work
together.

Unfortunately many people do not understand this design well-enough,
probably also because of a lack of adequate education, in particular at
university level and in scientific disciplines not directly related to
computer science.

This is also why I dislike most "high-level scientific programming
languages" (e.g. python, julia etc.) because they very often break this
"collaborative computing framework" and/or make it unnecessarily obscure.

Note in particular that using the same object and linking techniques, it
should be easy to couple a Basilisk solver with another program written
in any other language e.g. fortran, C++, python, julia etc.

On the other hand, Python (and apparently Julia is even worse in this
respect) do not make it easy (or event possible) to compile/call a
program written in their own dialect from another language. Putting it
another way, these languages "do not play fair" by making it
(relatively) easy to import functions written in other languages (and in
particular the many scientific libraries already written in C) and
making it difficult (or even impossible) to export their own functions.

The resulting "babelization" of scientific computing is problematic.

cheers,

Stephane
OpenPGP_0x78F22AD6304D74BE.asc
OpenPGP_signature.asc

jmlopez...@gmail.com

unread,
Jun 14, 2024, 7:39:53 PMJun 14
to basilisk-fr
Hi Stephane,

After your explanation I understand that the master-slave is just the linking  of two codes. I agree with you that these issues are absent usually from the curricula (as for example paralellization). It is looked down upon as a technical part without much importance. Also It is difficult to find out room for these contents in the curricula  (if you want to include them you have the leave  some out). Even for some of us with some computer experience it is difficult to get to them for lack of a clear way to learn it. So your examples (yours and antoon) are essentials.

Cheers
Pepe
Reply all
Reply to author
Forward
0 new messages