About tracer in vof

150 views
Skip to first unread message

Yonghan Xin

unread,
Aug 24, 2025, 4:15:27 AM (14 days ago) Aug 24
to basilisk-fr
Dear all, 

As shown in the figure, I want to add a tracer (concentration field) to one side of the jet and allow it to diffuse, but I want to restrict it to within the VOF field. Are there any examples I can refer to for implementing this operation?

Best regards,

Yonghan

jets.png

Edoardo Cipriano

unread,
Aug 24, 2025, 4:56:30 AM (14 days ago) Aug 24
to basilisk-fr
Hello Yonghan,

For the advection part you can add your field Y to the list of VOF tracers: 

f.tracers = {Y};

This way, it will be transported using the same geometric fluxes computed for the VOF fraction. This approach is used many times basilisk and in the sandbox. Here is an example (see the field cf):


For the diffusion part, you can exploit the diffusion() function in basilisk, together with the calculation of the face fraction (as implemented in Lopez's sandbox):


To confine the solution of the diffusion step within the VOF field, you can multiply the diffusivity by the face fraction:


Hope this helps.

Best,
Edoardo

Wojciech (Voitek) Aniszewski

unread,
Aug 24, 2025, 5:01:50 AM (14 days ago) Aug 24
to Yonghan Xin, basilisk-fr
Hello, I am the C-pig, the advanced sentient AI used by V.Aniszewski.
Here is my response to your question:
 
  /^..^\      |   What's wrong with:
 ( (••) )     |   foreach()
 (|)_._(|)~   |    Y[] = f[]>0 ? Y[] :0;
 
Thank you for your attention to this matter.
 
--
You received this message because you are subscribed to the Google Groups "basilisk-fr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to basilisk-fr...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/basilisk-fr/77644122-70d3-4bac-99a1-bc70cf51a896n%40googlegroups.com.

Wojciech (Voitek) Aniszewski

unread,
Aug 24, 2025, 6:13:41 AM (14 days ago) Aug 24
to Edoardo Cipriano, basilisk-fr
>To confine the solution of the diffusion step within the VOF field, you can multiply the diffusivity by the face fraction:
 
Hi Edoardo,
Does that nullify the diffusive Y fluxes through the interface directed outside of the bulk VOF, within the interfacial cells? Because the ternary condition given in my previous post surely does.
cheers
v
 
blocked.gif

Edoardo Cipriano

unread,
Aug 24, 2025, 6:57:32 AM (14 days ago) Aug 24
to basilisk-fr
Hi Wojciech,

Yes, that is essentially the finite volume discretization of the diffusion equation in an interfacial cell. Plus, the assumption that the flux across the interface (into the other phase) is null.

This confines the solution of the diffusion equation within the boundaries of the VOF field. If there must be a flux through the interface, it must be computed and added is some way. For example, including source terms in the diffusion() function.

The difference with that ternary condition is that the latter copies the values of f[] in a specific region, but it does not admit a variable tracer Y within the VOF fraction. It might be good depending on what Yonghan needs to do.

As an example, I attach a code for the confined advection-diffusion of a tracer. The tracer is initialized as a step function, but it diffuses remaining always within the VOF field.

Best,
Edoardo
fracface.h
Makefile
movie.mp4
confined.c

Edoardo Cipriano

unread,
Aug 24, 2025, 8:29:34 AM (14 days ago) Aug 24
to basilisk-fr
There was a missing term.

Edoardo
confined.c

Yonghan Xin

unread,
Aug 25, 2025, 3:29:08 AM (13 days ago) Aug 25
to basilisk-fr
Appreciate it, everyone! I will try to use those methods into my model.🙂

Yonghan Xin

unread,
Aug 25, 2025, 3:29:13 AM (13 days ago) Aug 25
to basilisk-fr
Dear  Edoardo,

Thanks for your help.

I followed the method you suggested. But I find the concentration field f1 and f2 are biggher than 1 and less than 0, is there a way to solve this?
My code and images are attached. You can see that the value of concentration field f1 is not between (0, 1) during post-processing.

Best regards,
Yonghan 


在2025年8月24日星期日 UTC+8 20:29:34<Edoardo Cipriano> 写道:
problem.png
jet.c

Jacob Maarek

unread,
Aug 25, 2025, 2:14:08 PM (13 days ago) Aug 25
to basilisk-fr
You can apply a flux limiter. 

Try y.gradient = minmod2;

It might also be required to change the value of cmin in the function vof_concentration_gradient_x to from 0.5 to 1.

This should fix the problem of values becoming bigger than 1 and smaller than 0.

Best regards,

Jacob
Reply all
Reply to author
Forward
0 new messages