combining "refine" and "adapt wavelet"

1,134 views
Skip to first unread message

Bruno SARKIS

unread,
Jun 18, 2018, 9:53:00 AM6/18/18
to basilisk-fr
Hello everyone,

Please suppose that at each timestep someone :
  1. First adaptes wavelet to answer a certain precision criterium
  2. Then refines to maxlevel in a certain zone
So that both criteria (precision and the zone) are satisfied.

Will there be a waste during the next timestep ?
I mean : will the adapt wavelet function have problems or will it work correctly ?

Thank you in advance.

Best

Bruno

Antoon van Hooft

unread,
Jun 18, 2018, 10:32:48 AM6/18/18
to basilisk-fr
Halloo Bruno,

The adapt_wavelet function will work correctly, but i doubt if that corresponds to what you want.

Assuming you use them in the sequence they appear in your post the following will happen:

The adapt_wavelet function will coarsen the cells in a "certain zone" if they do not need to be at the maximum level of refinement.
Next, the refine function will refine the coarsened cells and it will generally fail to reconstruct the original solution exactly.

Meaning that you are in fact introducing additional errors (of the order of the refinement criterion) by the subsequent coarsening and refinement each time step. This will have a smoothening effect and the compound effects of these additional errors are not necessarily small.

If you are really convinced that the wavelet algorithm is not smart enough for your purpose, I propose 3 solutions:

1) Define a noisy artificial field in your "certain zone" and do the wavelet-estimated-error refinement upon that (easiest).
2) Modify Ceasars pairetti's "location dependent maxlevel" to also consider a minimum level of refinement in your zone of interest.
3) Neatest: create a cell flag that tells a modified version of the "coarsen_cell"-function not to coarsen flagged cells.

Antoon

 



Bruno SARKIS

unread,
Jun 19, 2018, 7:38:30 PM6/19/18
to basilisk-fr
Thank you very much Antoon.
I already did sth in the sense of 1)
I'll see it further next soon.

Bruno

Roberto Velasco

unread,
Jan 21, 2019, 12:07:21 PM1/21/19
to basilisk-fr
Here is some code following proposal no. 2

I've been using it for a couple of weeks, and it seems to work well.
adapt_wavelet_minmax.h

Sagar Patankar

unread,
May 6, 2019, 10:53:32 AM5/6/19
to basilisk-fr
Hello Antoon Van Hooft,


I am trying to use the method 2) http://basilisk.fr/sandbox/pairetti/bag_mode/adapt_wavelet_limited.h suggested by you for zonal refinement but am getting an error


In function ‘adapt_wavelet_limited’:
‘no_coarsen’ undeclared (first use in this function)
 if (!is_constant(s) && s.coarsen != no_coarsen)


what should be no_coarsen??


Thanks

Frederik Brasz

unread,
May 7, 2019, 12:02:10 PM5/7/19
to Sagar Patankar, basilisk-fr
I'm not sure I understand exactly how you're trying to refine your domain. You mean you want a constant and relatively higher level of refinement inside the filament compared to outside the filament, and then adaptive refinement at the interface to reach the finest level? If you want that, I would guess that Roberto's code from earlier in this thread will give you what you need. (You could set the min level higher in your filament.)

The modification of Cesar's method that I sent you only changes the maximum level that the adaptive algorithm will be allowed to reach. So as its written, your atomization.c makes the max level 15 inside the circle x^2 + y^2 = 0.49^2, but only 5 outside of it. Since your min level is 5, your grid won't adapt outside of that circle at all (maxlevel=8 will be completely irrelevant).

I'll also reiterate Stephane's caution that you should make sure you really need this flexibility in your mesh refinement before jumping to location-dependent max and min levels.

Best,
Frederik

On Tue, May 7, 2019 at 3:20 AM Sagar Patankar <sagarpa...@gmail.com> wrote:
Hello Frederik,

Following your steps, the error has gone using your modified file but I see that zonal refinement is not happening.


I am simulating a fluid filament where I want fine refinement both inside the filament along with adaptive refinement along with the interface.  It is found that the zone is not refined ?? Please have a look at my simulation file if am I doing correctly.


--
SAGAR PATANKAR
Phd Research scholar
Dept. of Chemical Engg.
IIT Bombay.
Ph: +91-7292046796

Frederik Brasz

unread,
May 7, 2019, 12:59:02 PM5/7/19
to Sagar Patankar, basilisk-fr
It will only reach the max level if the errors found by the wavelet algorithm are large enough. Remember it's an adaptive mesh, so there's no guarantee it reaches the max level. You can either reduce the minimum error in each cell or increase the minimum level to something you find suitable. That's where Roberto's code above could be helpful. With that you could set the minimum to a higher level inside the circle so that all cells are at least that level.

On Tue, May 7, 2019 at 12:51 PM Sagar Patankar <sagarpa...@gmail.com> wrote:
Yes you said it right..... I need refinement only inside the circle    x^2 + y^2 = 0.49^2, where i have tried changing max level inside from 10 to 15 but still the refinement inside the filament remains coarse? Consider i dont need to worry much outside that circle. So, as you can see inside the circle the grid doesn't look like it is refined with max level 15 that is my question?



Sagar Patankar

unread,
May 7, 2019, 1:10:46 PM5/7/19
to Frederik Brasz, basilisk-fr
Ok, thanks for the clarification.   Currently, i am using this trick which does serve my purpose as can be seen from the attached image, But am not sure if this way of refinement is appropriate or not?

event patch (i++) {
refine (  (f[] > 0 && f[]< 1)  && level < 10);
refine (  sq(x) + sq(y) < sq(0.6)  && level < 8);

}

snap.png

Antoon van Hooft

unread,
May 8, 2019, 2:50:13 AM5/8/19
to basilisk-fr
Hallo Sagar,

Your patch event may ruin more than it fixes.

You may enforce constant refinement with something like this,

#define IN_REGION (sq(x) + sq(y) < sq(0.6))
event adapt (i++) {
  scalar region[];
  foreach()
    region[] = IN_REGION*noise()
  adapt_wavelet({region, ...}, (double){0.01,...}, ...
....


And you ,ay enforce refinement at the interface following this page:


Antoon
Reply all
Reply to author
Forward
0 new messages