# The curvature of a circle with a normalized radius ($R$)

``````#include "grid/quadtree.h"
#include "fractions.h"
#include "curvature.h"
#include "utils.h"
#include "interface_iterator.h"

#define func (sq((x-0.01))+sq(y+(M_PI/100.))-1.)

scalar f[], curv[];

int main(){``````

First we try an equidistant grid with $\frac{\Delta }{R}=3/256$

``````  init_grid (256);
L0 = 3.;
X0 = Y0 = -L0/2.;
f.prolongation = f.refine = fraction_refine;
fraction (f,func);
boundary ({f});
FILE * fp1 = fopen ("facets1","w");
output_facets (f,fp1);
fclose (fp1);
curvature (f, curv);
FILE * fp2 = fopen ("curvature1","w");
double xyn[2];
xyn[0] = X0;
xyn[1] = Y0 + L0;
loop_interfacial_cells (fp2, f, curv, xyn);
fclose (fp2);``````

Second, the left half of the domain is coarsend.

``````  unrefine (x<0);
fraction (f,func);
boundary ({f});
FILE * fp3 = fopen ("facets2","w");
output_facets (f,fp3);
fclose (fp3);
curvature (f, curv);
FILE * fp4 = fopen ("curvature2","w");
loop_interfacial_cells (fp4, f, curv, xyn);
fclose (fp4);``````

Third, the bubble is initialized consistent with the wavelet-based adaptation algorithm.

``````  astats s;
do {
fraction (f, func);
boundary ({f});
s = adapt_wavelet ({f}, (double []){0.001}, maxlevel = 9);
} while (s.nf>15 || s.nc>15);
fraction (f, func);
boundary ({f});
FILE * fp5 = fopen ("facets3","w");
output_facets (f,fp5);
fclose (fp5);
curvature (f, curv);
FILE * fp6 = fopen ("curvature3","w");
loop_interfacial_cells (fp6, f, curv, xyn);
fclose (fp6);
scalar lev[];
foreach()
lev[]=level;
FILE * fp7 = fopen ("level3","w");
loop_interfacial_cells(fp7, f, lev, xyn);
fclose(fp7);``````

Finally, we compare the fidelity of the curvature estimation for the three different grids directly

Adaptation seems to behave a bit strange?

``}``