Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
 
 

This tutorial is intended to demonstrate how to implement a simple multigrid solver using BoxLib's
data structures.  The code solves Poisson's equation with periodic boundary conditions.  Gauss-Seidel
red-black smoothing is used at each grid level. The inputs are as follows:

max_boxsize = maximum size of each subdomain in the problem domain
n_cells     = total number of cells in the problem domain at the finest grid level
dim         = dimension of the problem
s1          = number of smooths going up (V-cycle and FMG-cycle)
s2          = number of smooths going down (V-cycle and FMG-cycle)
v_bot       = number of smooths at the bottom of the of the V-cycle
fmg_bot     = number of smooths at the bottom of the FMG-cycle
max_iter    = maximum cycles to be applied until automatic termination
cycle_type  = '1' corresponds to V-cycle; '2' corresponds to FMG-cycle
eps         = problem converges when the max norm of the residual gets below this value, and program will terminate
interp_type = '1' corresponds to piecewise constant interpolation; '2' corresponds to piecewise linear
rhs_type    = '1' corresponds to a pure sine wave
              '2' corresponds to random numbers on the interval [-0.5,0.5]
              '3' corresponds to the difference of two delta functions in EACH subdomain (each box is zero
               everywhere, with a -1 in the third quadrant and +1 in the first quadrant)
coeffs_type = '1' corresponds to constant coefficients
              '2' corresponds to random numbers on the interval [1,2]
verbose     = Determines the degree to which results are printed. A verbose setting higher than 2 should not
              be used with large data sets. Each setting of verbose will print everything printed by all lower
              settings.
              '0' prints the final result of the multigrid solver
              '1' prints the result of each cycle
              '2' prints the result of smoothing at each grid level
              '3' prints the solution array at each grid level
              '4' prints the RHS array at each grid level
              '5' prints the residual array at each grid level
              '6' prints the coefficient arrays at each grid level

The four sample input files all solve the same problem with different methods:

inputs_v_pc_2d: Applies V-cycles with piecewise constant interpolation
inputs_v_lin_2d: Applies V-cycles with piecewise linear interpolation
inputs_fmg_pc_2d: Applies FMG-cycles with piecewise constant interpolation 
inputs_fmg_lin_2d: Applies FMG-cycles with piecewise linear interpolation

Note that although this tutorial does not have special solver at the bottom of the cycles, one
may be implemented to replace the smoothing operations that are currently executed at the bottom.
The efficiency of the bottom solver is also dependent on the maximum size of each subdomain.
Because each subdomain cannot coarsen beyond a 2x2, a small subdomain size on a large problem domain
will mean that the 'coarse' grid resolution might not in fact be very coarse.


This tutorial was created by Jonathan Wang, Summer 2013