Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
hsmg_mod.F90
Go to the documentation of this file.
1 
2 !
3 module hsmg
4  use kinds, only : dp
5  use size_m
6  implicit none
7 
8  logical :: use_spectral_coarse
9 
10 ! Allocate MHD memory only if lbx1==lx1
11  integer, parameter :: lmg_mhd=1-(lx1-lbx1)/(lx1-1) !1 if MHD is true, 0 otherwise
12 
13  integer, parameter :: lmgs=1 + lmg_mhd ! max number of multigrid solvers
14  integer, parameter :: lmgn=3 ! max number of multigrid levels
15  integer, parameter :: lmgx=lmgn+1 ! max number of mg index levels
16  integer, parameter :: lxm=lx2+2,lym=lxm,lzm=lz2+2*(ldim-2) ! mgrid sizes
17  integer, parameter :: lmg_rwt=2*lxm*lzm ! restriction weight max size
18  integer, parameter :: lmg_fasts=2*lxm*lxm ! FDM S max size
19  integer, parameter :: lmg_fastd=2*lxm*lym*lzm ! FDM D max size
20  integer, parameter :: lmg_swt=2*lxm*lzm ! schwarz weight max size
21  integer, parameter :: lmg_g=2*lx2*ly2*lz2 ! metrics max size
22  integer, parameter :: lmg_solve=2*lxm*lym*lzm ! solver r,e max size
23 
24  integer :: mg_lmax !>
25  integer :: mg_fld !> @var active mg field
26  integer, allocatable :: mg_nx(:), mg_ny(:), mg_nz(:) !level poly order
27  integer, allocatable :: mg_nh(:), mg_nhz(:) !number of 1d nodes
28  integer, allocatable :: mg_gsh_schwarz_handle(:,:) !dssum schwarz handles
29  integer, allocatable :: mg_gsh_handle(:,:) !dssum handle
30  integer, allocatable :: mg_rstr_wt_index(:,:), mg_mask_index(:,:)
31  integer, allocatable :: mg_fast_s_index(:,:), mg_fast_d_index(:,:)
32  integer, allocatable :: mg_solve_index(:,:)
33  integer, allocatable :: mg_g_index(:,:), mg_schwarz_wt_index(:,:)
34 
35  real(DP), allocatable :: mg_jh(:,:) !c-to-f interpolation matrices
36  real(DP), allocatable :: mg_jht(:,:) !transpose of mg_jh
37  !real(DP), allocatable :: mg_jhfc(:,:) !c-to-f interpolation matrices
38  !real(DP), allocatable :: mg_jhfct(:,:) !transpose of mg_jh
39 
40  real(DP), allocatable :: mg_ah(:,:) !A hat matrices
41  real(DP), allocatable :: mg_bh(:,:) !B hat matrices
42  real(DP), allocatable :: mg_ch(:,:) !C hat matrices
43  real(DP), allocatable :: mg_dh(:,:) !D hat matrices
44  real(DP), allocatable :: mg_dht(:,:) !D hat transpose matrices
45  real(DP), allocatable :: mg_zh(:,:) !Nodal coordinates
46  real(DP), allocatable :: mg_rstr_wt(:) !restriction wt
47 ! real(DP), allocatable :: mg_mask(:) !b.c. mask (Max: might not be used)
48  real(DP), allocatable :: mg_fast_s(:), mg_fast_d(:)
49  real(DP), allocatable :: mg_schwarz_wt(:)
50  real(DP), allocatable :: mg_solve_e(:), mg_solve_r(:)
51  real(DP), allocatable, dimension(:) :: mg_h1,mg_h2,mg_b
52  real(DP), allocatable :: mg_g(:) ! metrics matrices
53 
54 ! must be able to hold two lower level extended schwarz arrays
55  real(DP), allocatable :: mg_work(:),mg_work2(:),mg_worke(:,:)
56 
57  integer, allocatable :: mg_imask(:) ! For h1mg, mask is a ptr
58 
59 ! Specific to h1 multigrid:
60  integer :: mg_h1_lmax
61  integer, allocatable :: mg_h1_n(:,:)
62  integer, allocatable, dimension(:,:) :: p_mg_h1,p_mg_h2,p_mg_b,p_mg_g,p_mg_msk
63 
64 
65  real(DP), allocatable, dimension(:) :: lr,ls,lt &
66  , llr,lls,llt &
67  , lmr,lms,lmt &
68  , lrr,lrs,lrt
69 
70  contains
71 
72  subroutine init_hsmg()
73  use kinds, only : dp
74  use size_m
75  implicit none
76 
77  use_spectral_coarse = .true.
78 
79  allocate(mg_nx(lmgn), mg_ny(lmgn), mg_nz(lmgn))
80  allocate(mg_nh(lmgn), mg_nhz(lmgn))
81  allocate(mg_gsh_schwarz_handle(lmgn,lmgs), mg_gsh_handle(lmgn,lmgs))
82  allocate(mg_rstr_wt_index(lmgx,0:lmgs), mg_mask_index(lmgx,0:lmgs))
83  allocate(mg_solve_index(lmgx,0:lmgs))
84  allocate(mg_fast_s_index(lmgx,0:lmgs), mg_fast_d_index(lmgx,0:lmgs))
85  allocate(mg_schwarz_wt_index(lmgx,0:lmgs), mg_g_index(lmgx,0:lmgs))
86 
87 
88  allocate(mg_jh(lxm*lxm,lmgn) &
89  , mg_jht(lxm*lxm,lmgn) &
90 ! , mg_jhfc (lxm*lxm,lmgn) &
91 ! , mg_jhfct(lxm*lxm,lmgn) & ! verified
92  , mg_ah(lxm*lxm,lmgn) &
93  , mg_bh(lxm,lmgn) &
94  , mg_dh(lxm*lxm,lmgn) &
95  , mg_dht(lxm*lxm,lmgn) &
96  , mg_zh(lxm,lmgn) &
97  , mg_rstr_wt(0:lmgs*lmg_rwt*2*ldim*lelt-1) & !restriction wt
98 ! , mg_mask (0:lmgs*lmg_rwt*4*ldim*lelt-1) & !b.c. mask
99  , mg_fast_s(0:lmgs*lmg_fasts*2*ldim*lelt-1) &
100  , mg_fast_d(0:lmgs*lmg_fastd*lelt-1) & ! verified
101  , mg_schwarz_wt(0:lmgs*lmg_swt*4*ldim*lelt-1) & ! verified
102 ! , mg_solve_e (0:lmg_solve*lelt-1) &
103 ! , mg_solve_r (0:lmg_solve*lelt-1) &
104 ! , mg_h1 (0:lmg_g*lelt-1) &
105 ! , mg_h2 (0:lmg_g*lelt-1) &
106 ! , mg_b (0:lmg_g*lelt-1) & ! verified
107 ! , mg_g (0:lmg_g*((ldim-1)*3)*lelt-1) & !metrics matrices (verified)
108 
109 ! , mg_work (2*lxm*lym*lzm*lelt) & ! verified
110 ! , mg_work2 (lxm*lym*lzm*lelt) & ! two lower level extended
111  , mg_worke(lxm*lym*lzm,6) & ! schwarz arrays
112  )
113  mg_schwarz_wt = 0_dp
114 
115  allocate(mg_imask(0:lmgs*lmg_rwt*4*ldim*lelt-1)) ! verified
116 
117 ! Specific to h1 multigrid:
118  allocate(mg_h1_n(lmgx,ldimt1) &
119  , p_mg_h1(lmgx,ldimt1),p_mg_h2(lmgx,ldimt1) &
120  , p_mg_b(lmgx,ldimt1),p_mg_g(lmgx,ldimt1) &
121  , p_mg_msk(lmgx,ldimt1) )
122 
123  allocate(lr(2*lx1+4),ls(2*lx1+4),lt(2*lx1+4) &
124  , llr(lelt),lls(lelt),llt(lelt) &
125  , lmr(lelt),lms(lelt),lmt(lelt) &
126  , lrr(lelt),lrs(lelt),lrt(lelt) )
127 
128  end subroutine init_hsmg
129 
130 end module hsmg
Module containing data for HSMG.
Definition: hsmg_mod.F90:3
subroutine init_hsmg()
Definition: hsmg_mod.F90:72