Compute distance from an interface using frac-dist.h (from Antoon's sandbox)

225 views
Skip to first unread message

alienor...@gmail.com

unread,
Oct 31, 2022, 5:30:02 AM10/31/22
to basilisk-fr
Dear Basilisk Users, 

I am running simulations of bubbles in turbulent flows and would like to compute, at any point in space the distance from bubble interfaces. The aim is then to compute profiles of flow properties as a function of the distance to the interfaces. 

To do that I found in Antoon's sandbox two very useful pages:
and 
http://basilisk.fr/sandbox/Antoonvh/frac-dist.h : for computing the distance to an interface defined by volume fractions.

Before using this codes in my situation I tried to reproduce the corresponding example:
and I ran into some problems. 
When I compile the code I get the following error:

./frac-dist.h:57:46: error: use of undeclared identifier 'f'
  struct cff nja= ((scalar[]){dff.c, dff.f.x,f.y,f.z,{-1}});
                                             ^
./frac-dist.h:57:50: error: use of undeclared identifier 'f'
  struct cff nja= ((scalar[]){dff.c, dff.f.x,f.y,f.z,{-1}});


I get the same error when compiling the following file that only imports the grid and frac-dist.h:
#include "grid/octree.h"
#include "frac-dist.h"

I compile using the predefined Makefile. 

Does anyone have any insight on how to solve this problem?

Thank you very much for your help, 

Aliénor


j.a.v...@gmail.com

unread,
Oct 31, 2022, 6:27:16 AM10/31/22
to basilisk-fr
Hallo Alienor,

These codes were only tested with the older qcc version. For this problem you can retry after updating the frac-dist.h file

I am exited to finally see the flexibility of profile6.h put to good use!

Antoon
Op maandag 31 oktober 2022 om 10:30:02 UTC+1 schreef alienor...@gmail.com:

alienor...@gmail.com

unread,
Oct 31, 2022, 6:31:32 AM10/31/22
to basilisk-fr
Thanks Antoon! As expected it works now.

Have a good day, 

Aliénor

alienor...@gmail.com

unread,
Nov 3, 2022, 5:53:58 AM11/3/22
to basilisk-fr
Good morning everybody, 

I made some progress in applying these functions to my original problem. However I had some issues when trying to use them in parallel using mpi so I went back to the given examples and had the same troubles. 

For ex, with test6.c 
When I try to create a portable source code (qcc -D_MPI=1 -O2 -source  test6.c) I get the following errors:
./profile6.h:29: error: non-local variable 'g' is modified by this foreach loop:
./profile6.h:29: error: use a loop-local variable, a reduction operation
./profile6.h:29: error: or a serial loop to get rid of this error
(The next step would be to compile the code and I would use : 
mpicc -Wall -O2 -std=c99 -D_MPI=1 _test6.c -I/obs/ariviere/basilisk/src -o test6 -lm)
I tried to fix this problem by defining g inside the foreach(), but then there is an other problem about oa being modified while it's a global variable and I don't really know how to solve it. 

Similarly, for example_frac-dist.c
trying to compile raises: 
./frac-dist.h:27: error: non-local variable 'nr_p' is modified by this foreach loop:
./frac-dist.h:27: error: use a loop-local variable, a reduction operation
./frac-dist.h:27: error: or a serial loop to get rid of this error
which can be solved adding a reduction in the foreach loop.

Since these codes are supposed to work in parallel 'if compiled correctly' my guess is that I'm not doing things properly and that I should not modify them. Can someone explain me where the problem is and what compilation command I should use?

Thank you very much!

Aliénor

j.a.v...@gmail.com

unread,
Nov 3, 2022, 7:49:18 AM11/3/22
to basilisk-fr
Hallo Alienor,

Based on your feedback, I updated profile6 . Your first problem there should be fixed now.

Frac-dist is another story: it inherits the MPI incompatibility from `distance.h'  (or the slightly modified distance2.h)


> Since these codes are supposed to work in parallel 'if compiled correctly'

This statement can be forgotten with the update to profile6

Antoon


Op donderdag 3 november 2022 om 10:53:58 UTC+1 schreef alienor...@gmail.com:

Stephane Popinet

unread,
Nov 3, 2022, 10:06:10 AM11/3/22
to basil...@googlegroups.com
Hi Alienor, Antoon et al,

Thanks for the feedback and bug fixes.

The sequence of events leading to this was interesting and can be
followed here:

http://basilisk.fr/_activity

It went like this:

2022-11-03 10:52:00 CET (Alienor): your initial message on the mailing list

2022-11-03 11:48:46 CET (Stephane Popinet): Parallel version of test6.c
(Makefile)

2022-11-03 11:52:08 CET (Stephane Popinet): The sandbox does not like
symbolic links (Makefile, test6-mpi.c)

I then ran the new(ish) test case:

http://basilisk.fr/sandbox/Antoonvh/test6-mpi.c

and it ran just fine... What was going on? Did Alienor use an old
version of the code? etc..

No! Antoon had just fixed the problem with this patch:

2022-11-03 11:56:37 CET (Antoonvh): parallel update (profile6.h)

As Antoon would write: "Well done Basilisk developers!" :)

cheers,

Stephane



Reply all
Reply to author
Forward
0 new messages