Clarification on Residual Calculation for Tree and Cartesian Grids in Poisson Solver

120 views
Skip to first unread message

张元

unread,
Jul 22, 2024, 8:57:46 AMJul 22
to basilisk-fr

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?

Haochen Huang

unread,
Jul 23, 2024, 2:54:21 AMJul 23
to basilisk-fr
Hi,
You may find the answer in section 2.3.2 in my documentation.
Best Regards,
Haochen 

Yannick Peng

unread,
Jul 23, 2024, 5:38:11 AMJul 23
to basilisk-fr
Dear  Haochen,
Thank you for your very detailed documentation, which was very helpful for me to understand the basilisk code.
With best wishes

Reply all
Reply to author
Forward
0 new messages