Problem Using adapt_wavelet_limited.h

353 views
Skip to first unread message

Omri Argov

unread,
Jun 8, 2020, 3:37:01 AM6/8/20
to basilisk-fr
Hello all,


I'm trying to use the adapt_wavelet_limited.h in order to use specific AMR on spatial region. 

When compiling the code, the compiler sends error "‘no_coarsen’ undeclared (first use in this function)" 

I wasn't able to find any redirection to no_coarsen in whole basilisk pool. 

Anybody succeed to use adapt_wavelet_limited.h and managed to overcome this problem?

Thanks
Omri.

Gabriele Gennari

unread,
Jun 8, 2020, 5:55:21 AM6/8/20
to basilisk-fr
Hi Omri,

try to replace (in adapt_wavelet_limited.h) :

if (!is_constant(s) && s.coarsen != no_coarsen)

with this (from standard adapt_wavelet):

if (!is_constant(s) && s.restriction != no_restriction) 

Best,
Gabriele

Omri Argov

unread,
Jun 8, 2020, 12:12:16 PM6/8/20
to basilisk-fr
Solved

Thank you!

Wenge Huang

unread,
Oct 8, 2023, 11:55:53 PM10/8/23
to basilisk-fr
Hi everyone,
I have a problem with using the adaptive_wavelet_limited function.
I'm trying to replicate the case in Dr. Vatsal Sanjay's sandbox http://basilisk.fr/sandbox/vatsal/DropOnDropImpact/DropDeposition.c
to test the adaptive_wavelet_limited function.

But there is no adaptive grid generated with the same codes.

I made a little bit change on the adaptive_wavelet_limited.h header file in http://basilisk.fr/sandbox/pairetti/bag_mode/adapt_wavelet_limited.h
in the file, there is a line as :
 local = true, break;
with this line
I always get an error like:

./adapt_wavelet_limited.h:74: warning: Basilisk C parse error near `
       local = true, break'
./adapt_wavelet_limited.h: In function ‘adapt_wavelet_limited’:
./adapt_wavelet_limited.h:74:22: error: expected expression before ‘break’

Then I change it to
 local = true; break;
after this change, there is no error but no adaptive grid is generated.

Also, the codes shared in the following link is the same like:
 local = true, break;

I always get the error with this  "local = true, break;" but I didn't see people report the same error.
I don't know if there is anything I miss about this adaptive_wavelet_limited.h header file.
Can anyone who successfully used the adapt_wavelet_limited function help me with this issue.
Thank you very much with your consideration and time!

Here are the codes:
#include "axi.h"
#include "navier-stokes/centered.h"
#include "two-phase.h"
#include "navier-stokes/conserving.h"
#include "tension.h"
#include "reduced.h"
#include "adapt_wavelet_limited.h"
#include "view.h"

int MAXlevel = 6; // maximum level: This is increased in time.
#define MINlevel 4 // minimum level
#define Ldomain 4
#define tmax 1
#define tsnap (0.05)
// Error tolerances
#define fErr (1e-3) // error tolerance in VOF
#define KErr (1e-4) // error tolerance in KAPPA
#define OmegaErr (1e-3) // error tolerances in vorticity

#define Mu21 (6e-3) // viscosity ratio between the gas and the liquid
#define Rho21 (1./770) // density ratio between the gas and the liquid
char comm[80], FacetName[80], nameOut[80];

u.t[left] = dirichlet(0.0);
f[left] = dirichlet(0.0);

int main(){

  L0=Ldomain;
  X0=0.; Y0=0.;
  init_grid (1 << (4));

  double Bond = 0.308;
  G.x = -Bond;

  f.sigma = 1.;

  mu1 = 1.; mu2 = Mu21;
  rho1 = 1.; rho2 = Rho21;
  run();
}
event init (t=0){
  sprintf (comm, "mkdir -p intermediate%5.4f",  fabs(G.x));
  system(comm);
  //refine (sq(x-1.015625) + sq(y) < sq(1.04) && level < MAXlevel+2);
  fraction (f, 1. - sq(x-1.015625) - sq(y));
}

int refRegion(double x, double y, double z){
  return (x < 0.128 ? MAXlevel+2 : x < 0.256 ? MAXlevel+1 : MAXlevel);
}

scalar KAPPA[], omega[];
event adapt(i++){
  MAXlevel = t < 5.0 ? 6 : t < 10.0 ? 7 : 8;
  curvature(f, KAPPA);
  vorticity (u, omega);
  foreach(){
    omega[] *= (f[]);
  }
  boundary((scalar *){KAPPA, omega});
  adapt_wavelet_limited ((scalar *){f, KAPPA, omega},(double[]){fErr, KErr, OmegaErr}, refRegion, MINlevel);
}

event movies (t += 0.001; t <= tmax)
{

  clear();
  //view (fov = 20, quat = {0,0,-0.707,0.707},tx = 1e-6, ty = -0.5, width = 780, height = 382);
  //view (tx = -0.5);
  draw_vof ("f", lw = 2);
  squares ("p", min = -1., max = 10., linear = false, map = cool_warm);
 mirror (n = {0, 1, 0}, alpha = 0.) {
   draw_vof ("f", lw = 2);
   //draw_vof("f", filled = 1, fc = {0.9, 0.4, 0.2});
   //squares("thin_structure");
 }
  cells();
  save ("TO.10.mp4");
}

Mling

unread,
Aug 20, 2025, 4:36:44 AMAug 20
to basilisk-fr
Then I change it to
 local = true; break;
after this change, there is no error but no adaptive grid is generated.

--yes, and then just "{ local = true; break;}"
Reply all
Reply to author
Forward
0 new messages