Restricting embed_force() Calculations to Specific Boundaries

99 views
Skip to first unread message

alessandr...@gmail.com

unread,
May 6, 2025, 8:21:31 AMMay 6
to basilisk-fr

Dear all,

I am simulating 2D flow past a cylinder (of diameter D) inside a rectangular channel with a height of Ly = 4.1 * D. I am using the embed.h library to define the domain, treating both the upper and lower no-slip channel walls and the cylinder surface as embedded boundaries:

  vertex scalar phi[];

  foreach_vertex() {

    phi[] = intersection (2.05*my_D - y, 2.05*my_D + y);

    phi[] = intersection (phi[], sq(x) + sq(y) - sq(0.5*my_D));

  }

  boundary ({phi});

  fractions (phi, cs, fs);

To compute the lift and drag forces on the cylinder, I use the embed_force() function as follows:

event my_logfile (i+=2000) {

  coord Fp, Fmu;

  embed_force (p, u, mu, &Fp, &Fmu);

  fprintf (stderr, "%d %g %g %.6f %.6f %.6f %.6f\n",

           i, t, dt, Fp.x, Fp.y, Fmu.x, Fmu.y);

}

The issue I’m encountering is that embed_force() seems to include the contributions from all the embed boundaries—i.e., both the cylinder surface and the channel walls. As a result, the computed forces, particularly the friction drag (Fmu.x), are significantly higher than those reported in the literature, likely due to the inclusion of wall friction.

My question is:
Is there an easy way to restrict the force calculations using embed_force() to only a specific embed boundary (e.g., the cylinder surface), excluding others like the channel walls?

Thank you in advance for your help.

Best regards,
Alessandro

Francesco Picella

unread,
May 6, 2025, 9:04:29 AMMay 6
to basilisk-fr
Hello,

Short answer:
Yes!

Try to use Arthur's (or my ;) ) version of _color_embed_force()

where the scalar color function is a cs-like map that turns on-off when you're counting for a specific (colored) embedded boundary.

You'll find an example here:


Best,

F

alessandr...@gmail.com

unread,
May 8, 2025, 4:35:47 AMMay 8
to basilisk-fr
Dear Francesco,
Your suggestion worked smoothly!

Thank you so much,
Alessandro
Reply all
Reply to author
Forward
0 new messages