embed and multigrid

77 views
Skip to first unread message

Bruno Deremble

unread,
Nov 10, 2022, 6:35:42 PM11/10/22
to basilisk-fr
Hi Basilisk users,

It seems that I can't combine anymore "embed" and "multigrid". I am sure I used to
be able to do that in a not-so-distant past (~1 month)

A code like

#include "embed.h"
#include "grid/multigrid.h"
int main() {
N=4;
init_grid(N);
}

will not compile with the first error:


In file included from /home/bderembl/work/basilisk/basilisk/src/grid/multigrid.h:831,
from test.c:2:
/home/bderembl/work/basilisk/basilisk/src/grid/multigrid-common.h:148:61: error: macro "quadratic" requires 4 arguments, but only 3 given
In file included from test.c:1:
/home/bderembl/work/basilisk/basilisk/src/embed.h:370: note: macro "quadratic" defined here
/home/bderembl/work/basilisk/basilisk/src/grid/multigrid-common.h:167:55: error: macro "quadratic" requires 4 arguments, but only 3 given
/home/bderembl/work/basilisk/basilisk/src/embed.h:370: note: macro "quadratic"
defined here


and a bunch of other errors.
This error seems legit (cf. definition of "quadratic" in multigrid-common.h and
embed)


switching the order of #include

#include "grid/multigrid.h"
#include "embed.h"

solves the compilation problem but then the model runs as if there are no
embeded BC.

I am not sure what has changed: nothing obvious in the last patches.
If you have any clue I'd appreciate.

Thank you
Bruno

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

unread,
Nov 11, 2022, 4:41:36 AM11/11/22
to basilisk-fr
Hallo Bruno,

> switching the order of #include solves the compilation problem but then the model runs as if there are no embeded BC.

`embed.h' should indeed be included after 'multigrid.h`. Your minimal example is not suitable to reproduce your "no embeded BC" error. The `karman.c` example works fine after disabling grid adaptation. 

An unsolicited piece of advice: when in doubt, switch grids by using the compiler option, e.g. `$ qcc -grid=multigrid ... '

Antoon


Op vrijdag 11 november 2022 om 00:35:42 UTC+1 schreef Bruno Deremble:

Stephane Popinet

unread,
Nov 11, 2022, 5:41:27 AM11/11/22
to basil...@googlegroups.com
Hi Bruno,

Further to Antoon's reply, their are several test cases which combine
embed.h and multigrid.h, e.g. just do:

cd $BASILISK/test
grep embed.h *.c

and look for multigrid.h, for example

$BASILISK/test/couette.c

By construction all these test cases work with the current release (any
new code is released only if it passes all tests).

So your problem is more specific than you describe.

cheers,

Stephane

Bruno Deremble

unread,
Nov 11, 2022, 10:34:49 AM11/11/22
to Stephane Popinet, basil...@googlegroups.com
Hi Stephane and Antoon,

thank you very much for your emails. my minimal example was indeed far from
complete... and it actually took me a while to figure out that the order of
#include should be

#include "grid/multigrid.h"
#include "embed.h"
#include "navier-stokes/centered.h"

With Antoon's comment to remove grid/multigrid.h, it should then be

#include "embed.h"
#include "navier-stokes/centered.h"


in karman.c
swapping the first two lines as in

#include "navier-stokes/centered.h"
#include "embed.h"

compiles and run fine but produces what I was calling "no embeded BC".

I am sure this is written somewhere in the wiki but in case it's not, I'll add a
line in the documentation if it's ok with you.

Thanks!
Bruno
Reply all
Reply to author
Forward
0 new messages