Multigrid Solver

MG_ConstantsType

Structure to pass constants used in multigrid iteration across the Level_Parameters.

  • origs_e

  • terms_e

  • L

  • Deg

  • Deg_inv

  • m

  • n

MG_SettingsType

Structure to pass multigrid parameters.

  • nu1

  • nu2

  • mu

Level_ParametersType

Structure to pass level discretiation parameters.

  • ℓ_vec

  • Nx_vec

  • h_vec

Intergrid Operations

prolongate!Function
prolongate!(v_fine::Vector, lev_para::Level_Parameters, v_coarse::Vector, mg_const::MG_Constants)

Perform matrix free prolongation of vector 'vcoarse' on level 'Nxvec/2' to next finer level 'Nx_vec'.

Calls subroutines

prolongate_E!(v_fine::Vector, lev_para::Level_Parameters, v_coarse::Vector, mg_const::MG_Constants)
prolongate_vector_Nxe(v::Vector ,Nx_e::Int)

to perform prolongation in block form.

prolongate!(v_J::Vector, J::Int, v_Jm1::Vector, mg_const::MG_Constants)

Equilateral version.

prolongate_E!Function
prolongate_E!(v_fine::Vector, lev_para::Level_Parameters, v_coarse::Vector, mg_const::MG_Constants)

Perform prolongation from vertices to edges and inside edges

prolongate_E!(v_J::Vector, J::Int, v_Jm1::Vector, mg_const::MG_Constants)

Equilateral version.

restrict!Function
restrict!(d_coarse::Vector, lev_para::Level_Parameters, d_fine::Vector, mg_const::MG_Constants)

Perform matrix free restriction of vector 'dfine' on level 'Nxvec' to next coarser level 'Nx_vec/2'.

Calls subroutines

restrict_V!(d_coarse::Vector, lev_para::Level_Parameters, d_fine::Vector, mg_const::MG_Constants)
restrict_E!(d_coarse::Vector, lev_para::Level_Parameters, d_fine::Vector, mg_const::MG_Constants)
restrict_vector_Nxe(v::Vector, Nxe::Int)

to perform restriction in block form.

restrict!(d_Jm1::Vector, J::Int, d_J::Vector, mg_const::MG_Constants)

Equilateral version.

restrict_V!Function
restrict_V!(d_coarse::Vector, lev_para::Level_Parameters, d_fine::Vector, mg_const::MG_Constants)

Perform restriction from edge to vertex values.

restrict_V!(d_Jm1::Vector, J::Int, d_J::Vector, mg_const::MG_Constants)

Equilateral version.

restrict_E!Function
restrict_E!(d_coarse::Vector, lev_para::Level_Parameters, d_fine::Vector, mg_const::MG_Constants)

Perform restrictions inside edges

restrict_E!(d_Jm1::Vector, J::Int, d_J::Vector, mg_const::MG_Constants)

Equilateral version.

CN-MGM Solver

cn_mgmFunction
cn_mgm(TP::TPGeneralizedHeat, T::Number, J::Int; nu1=1, nu2=1, mu=1)

Fully Discretized Scheme: Compute FE-CN-MGM discretization of 'TP' at time 'T' and level 'J'.

cn_mgm_cycle!Function
cn_mgm_cycle!(u0::Vector, lev_para::Level_Parameters, dt::Float64, f_J::Vector, mg_const::MG_Constants, mg_set::MG_Settings)

Perform one cycle of the CN-MGM method with initial vector 'u0', right-hand side 'f_J', time stepping size 'dt'

cn_coarse_grid_correction!Function
cn_coarse_grid_correction!(u0::Vector, lev_para::Level_Parameters, dt::Float64, f_J::Vector, mg_const::MG_Constants, mg_set::MG_Settings)

Coarse grid correction including transport to lower level and back.

cn_smooth_jacobi!Function
cn_smooth_jacobi!(u0::Vector, lev_para::Level_Parameters, dt::Number, nu1::Int, f::Vector, mg_const::MG_Constants)

Perform nu1 smooting iterations.

cn_matrix_free_jacobi!Function
cn_matrix_free_jacobi!(u::Vector, lev_para::Level_Parameters, dt::Number, f::Vector, mg_const::MG_Constants)

Perform weighted jacobi smoother in MGM-CN on 'u' with time step size 'dt', right-hand side 'f' and discretization parameters.

cn_mat_mul!Function
cn_mat_mul!(out::Vector, lev_para::Level_Parameters, vec::Vector, dt::Number, mg_const::MG_Constants)

Perform matrix free multiplication (M̂+dt/2L̂)'vec'.

Calls subroutines

cn_mat_mul_VV!(out::Vector, vec::Vector, dt::Float64, Nx_vec::Vector, h_vec::Vector, j::Int, counter::Int)
cn_mat_mul_VE!(out::Vector, vec::Vector,dt::Float64,Nx_vec::Vector,h_vec::Vector,terms_e::Vector,origs_e::Vector,m::Int,counter::Int)
cn_mat_mul_EV_EE!(out::Vector, vec::Vector,dt::Float64,Nx_vec::Vector,h_vec::Vector,terms_e::Vector,origs_e::Vector,m::Int,counter::Int)
cn_mat_mul_e!(out::Vector, vec::Vector,dt::Float64,Nx_vec::Vector,h_vec::Vector,j::Int,counter::Int)

to perform the multiplications in block form

[ (M̂+dt/2*L̂)_VV   (M̂+dt/2*L̂)_VE ]   [ vec_V ]         [(M̂+dt/2*L̂)_VV*vec_V + (M̂+dt/2*L̂)_VE * vec_E ]    
[                               ]   [       ]   =     [                                            ]
[ (M̂+dt/2*L̂)_EV   (M̂+dt/2*L̂)_EE ]   [ vec_E ]         [(M̂+dt/2*L̂)_EV*vec_V + (M̂+dt/2*L̂)_EE * vec_E ]

where

                            [ (M̂+dt/2*L̂)_e1                         ]  [ vec_e1 ]
(M̂+dt/2*L̂)_EE * vec_E =     [                ⋱ ⋱                   ]  [   ⋮    ]  
                            [                        (M̂+dt/2*L̂)_em  ]  [ vec_em ]

is again performed in block form according to the edges e1, … ,em.

MG Nested Iteration Solver (Elliptic)

solve_mgmFunction
solve_mgm(TP::EllipticTestProblem, J::Int; nu1=1, nu2=1, mu=1)

Multigrid solver for elliptic test problem 'TP' at level 'J'. Calls MGMmatrixfree_jacobi!.

ni_mgmFunction
ni_mgm(TP:EllipticTestProblem, J_max::Int)

Nested iteration MG solver for elliptic testproblem 'TP' and Level 'Jmax'. Calls MGMmatrixfreejacobi!.

MGM_matrix_free_jacobi!Function
MGM_matrix_free_jacobi!(u0::Vector, J::Int, f_J::Vector, J0::Int, mg_set::MG_Settings, mg_const::MG_Constants)

Matrix free MGM with jacobi smoother.

mat_mul_M!Function
mat_mul_M!(out::Vector, u::Vector, J::Int, mg_const::MG_Constants)

Perform multiplication M_'J'*'u' and store output in 'out'.

mat_mul_H!Function
mat_mul_H!(out::Vector, J::Int, u::Vector, mg_const::MG_Constants)

Perform multiplication H_'J'*'u' and store output in 'out'.

smooth_jacobi!Function
smooth_jacobi!(u0::Vector, J::Int, f_J::Vector, nu1::Int, mg_const::MG_Constants)

Matrix-free Jacobi smoother.

matrix_free_jacobi!Function
matrix_free_jacobi!(u::Vector, J::Int, f::Vector, mg_const::MG_Constants)

Iteration of matrix-free Jacobi smoother.