Axisymmetric viscoelastic multiphase flow inside a sphere

92 views
Skip to first unread message

hausler89

unread,
Oct 18, 2025, 12:29:40 PMOct 18
to basilisk-fr
Good evening, everyone!

Screenshot 2025-10-14 191914.png
I'm currently trying to implement Stokes flow in a sphere with a slip boundary condition. However, I am unsure if this is possible in Basilisk. I aim to use axisymmetry to reduce the performance costs of the problem. Right now, I have a simulation setup that uses embedded boundaries to define a spherical domain and apply the desired surface slip. I've attached the source.

The project "works" in the sense that it runs and produces a video of a tracer advected by the flow. However, "axi.h" is currently commented out. When I actually include the header, the program crashes during runtime with a floating-point exception. " <Signals.SIGFPE: 8>"

My question now is, is this setup currently not supported? The headers, at a glance, seem to indicate that axi.h knows about embedded boundaries, yet I still experience the bug. I am unsure whether I made an error in writing the .c file or tried to combine modules that do not belong together.

Actually, my end goal is a 2-phase flow of two different viscoelastic fluids inside a spherical shell, described in axisymmetric coordinates - I'm curious whether this is out of scope for Basilisk. I originally thought it should be doable, because src/test/fall.c works perfectly, but I do require the spherical domain.

Cheers!

PS. I haven't even tried mesh refinement yet, but that would be another question: whether this is possible.

cylinder.c

Spencer Schwartz

unread,
Oct 20, 2025, 1:53:37 PMOct 20
to basilisk-fr
Hi SL,

I faced a similar issue for a different problem. I got it working by adding a few lines of code in the init event to properly update the metric fields (cm & fs) to account for the embedded boundaries (cs and fs):

    cm_update (cm, cs, fs);
    fm_update (fm, cs, fs);

    cm.refine = cm.prolongation = refine_cm_axi;
    cs.refine = cs.prolongation = fraction_refine;
    fm.x.refine = refine_face_x_axi;
    fm.y.refine = refine_face_y_axi;
    metric_embed_factor = axi_factor;

    restriction ({cs, fs, cm, fm});

I added this to your code. One other thing I had to change to get your code working is adding fm into the mu calculation. Since you're in axisymmetric coordinates, the viscosity field must account for the change in cell volume by doing

    foreach_face()
      muv.x[] = fm.x[]*1.0;

Note this is taken care of automatically if you use two-phase.h and define the viscosity like mu1=1, mu2=0.1, for example.

Best,
Spencer
cylinder.c
Reply all
Reply to author
Forward
0 new messages