Dear Basilisk Community,
I am currently working on the implementation of a Poisson–Helmholtz solver (http://www.basilisk.fr/src/poisson.h)and have encountered some confusion regarding the residual calculation for different types of grids.
I have come across two different methods for calculating the residual in the code:
For Tree Meshes: /* conservative coarse/fine discretisation (2nd order) */
face vector g[];
foreach_face()
g.x[] = alpha.x[]*face_gradient_x (a, 0);
foreach (reduction(max:maxres), nowarning)
{
res[] = b[] - lambda[]*a[];
foreach_dimension()
res[] -= (g.x[1] - g.x[])/Delta;
}
For Cartesian Grids: /* "naive" discretisation (only 1st order on trees) */
foreach (reduction(max:maxres), nowarning) {
res[] = b[] - lambda[]*a[];
foreach_dimension()
res[] += (alpha.x[0]*face_gradient_x (a, 0) -
alpha.x[1]*face_gradient_x (a, 1))/Delta;
}
I would like to understand the following:
How does the approach for tree meshes (using face values and gradients) differ from the Cartesian grid method (using direct gradient calculations with weights)?
How do these different methods impact the overall accuracy and performance of the solver, especially when dealing with non-regular versus regular grids?