Hello Sadhika,
The easiest solution I see is to define a scalar field that varies a lot in the region you want to refine, and feed this scalar to the adapt_wavelet function. Your code could look like this:
scalar impose_refine[];
event adapt (i++) {
foreach() {
if (IS_IN_RECTANGLE) impose_refine[] = noise();
else impose_refine[] = 0;
}
boundary({impose _refine});
adapt_wavelet ({impose_refine,u}, (double []){1.e-6,U_TOL, U_TOL}, maxlevel = LEVEL);
}
Where I assumed you have defined the macro IS_IN_RECTANGLE to be true if the current coordinates x,y correspond to a cell inside the rectangle where you want to impose refinement; and false otherwise. Note that your refined region will likely be slightly larger than the rectangle you want to impose (maybe 2 to 4 cells?), so if you want you could take this into account when defining the IS_IN_RECTANGLE macro.
I hope this help,
Best,
Damien
Dear Basilisk users,
I am simulating bubble rise in water and collapsing of bubble at air water interface. When bubble moves near to the interface, I want to refine a small rectangular region as shown in figure attached below.
Any suggestion would be helpful. Thanks in advance.
With Regards,
Sadhika