good_mg_cell_nr#

emg3d.meshes.good_mg_cell_nr(max_nr=1024, max_lowest=5, min_div=3)[source]#

Return “good” cell numbers for the multigrid method.

“Good” cell numbers are numbers which can be divided by two as many times as possible. At the end there should be 2 or a small odd number.

The function adds all numbers

\[ \begin{align}\begin{aligned}p\ 2^n &\leq M \ , \text{ for}\\p &= {2, 3, ..., p_\text{max}} \ ;\\n &= {n_\text{min}, n_\text{min}+1, ..., \infty} \ ,\end{aligned}\end{align} \]

where \(M, p_\text{max}, n_\text{min}\) correspond to max_nr, max_lowest, and min_div, respectively.

Parameters
max_nrint, default: 1024

Maximum number of cells.

max_lowestint, default: 5

Maximum permitted lowest number p for p*2^n. {2, 3, 5, 7} are good upper limits in order to avoid too big lowest grids in the multigrid method.

min_divint, default: 3

Minimum times the number can be divided by two.

Returns
numbersndarray

Array containing all possible cell numbers from lowest to highest.