Skip to content

Alternative Poisson solvers

franslql edited this page Aug 31, 2021 · 6 revisions

DALES 4.3 introduces experimental support for solving the Poisson equation with iterative methods from the HYPRE library. In general, the traditional FFT solver (default) is faster on a single or a few cores, but the iterative methods may scale better. Version 4.3 also adds the option to use the FFTW library.

Compiling DALES with HYPRE

To use HYPRE, supply the parameter USE_HYPRE=True to cmake before compiling. The location of the library can be supplied with the parameter HYPRE_LIB, if it is not found automatically.

cmake .. -DUSE_HYPRE=True -DHYPRE_LIB=/usr/lib64/openmpi/lib/libHYPRE.so

Example settings

An example for using an iterative solver. This can be tried on for example the Bomex case, by appending the following to namoptions.001.

&SOLVER
solver_id = 2
precond = 2
n_pre = 2
n_post = 2
tolerance = 1E-13
/

This uses the PFMG solver with red-black Gauss-Seidel preconditioner. With a larger value for the tolerance, the iterative method requires fewer iterations and thus less time to converge, at the cost of a less accurate solution. Trial runs are required to determine an acceptable level of accuracy. One measure of the solver accuracy is the divergence value in the diagnostic output from the model - ideally the velocity field should have zero divergence.

On the iterative methods

from the HYPRE documentation

  • "SMG is a particularly robust method."
    • "For periodic problems, the grid size in periodic dimensions currently must be a power-of-two."
  • "PFMG is not as robust as SMG, but is much more efficient per V-cycle"
    • "For periodic problems, users should try to set the grid size in periodic dimensions to be as close to a power-of-two as possible. That is, if the grid size in a periodic dimension is given by 𝑁 = 2𝑚*𝑀 where 𝑀 is not a power-of-two, then 𝑀 should be as small as possible. Large values of 𝑀 will generally result in slower convergence rates."

Notes

Compiling the DALES with HYPRE the library does not seem to work on OSX (segmentation fault on the first call to HYPRE, seems related to dynamic linking of the library. HYPRE was installed with brew. - FJ Jan. 2020).

FFTW-based Poisson solver

Another optional Poisson solver uses the FFTW library. To use it, compile DALES with FFTW:

cmake .. -DUSE_FFTW=True 

Optionally include -DFFTW_LIB=path-to-libfftw3.so to specify the library location, if not found automatically. To use the FFTW solver, add the following to the namelist:

&SOLVER
solver_id = 100
/