49 logical :: isleaf = .true.
53 integer,
allocatable :: dofs(:)
54 real(kind=
rp) :: xyz(3)
55 real(kind=
rp),
allocatable :: interp_r(:)
56 real(kind=
rp),
allocatable :: interp_p(:)
64 integer :: fine_lvl_dofs = 0
65 real(kind=
rp),
allocatable :: wrk_in(:)
66 real(kind=
rp),
allocatable :: wrk_out(:)
67 integer,
allocatable :: map_f2c_dof(:)
68 integer,
allocatable :: map_c2f_dof(:)
70 integer,
allocatable :: nodes_ptr(:)
71 integer,
allocatable :: nodes_gid(:)
72 integer,
allocatable :: nodes_dofs(:)
73 integer,
allocatable :: nodes_gids(:)
94 type(
gs_t),
pointer :: gs_h
117 subroutine tamg_init(this, ax, Xh, coef, msh, gs_h, nlvls, blst)
119 class(
ax_t),
target,
intent(in) :: ax
120 type(
space_t),
target,
intent(in) :: Xh
121 type(
coef_t),
target,
intent(in) :: coef
122 type(
mesh_t),
target,
intent(in) :: msh
123 type(
gs_t),
target,
intent(in) :: gs_h
124 integer,
intent(in) :: nlvls
125 type(
bc_list_t),
target,
intent(in) :: blst
135 if (nlvls .lt. 2)
then
136 call neko_error(
"Need to request at least two multigrid levels.")
140 allocate( this%lvl(this%nlvls) )
143 allocate( this%lvl(i)%map_f2c_dof( coef%dof%size() ))
144 allocate( this%lvl(i)%map_c2f_dof( coef%dof%size() ))
156 integer,
intent(in) :: lvl
157 integer,
intent(in) :: nnodes
158 integer,
intent(in) :: ndofs
161 tamg_lvl%nnodes = nnodes
162 allocate( tamg_lvl%nodes(tamg_lvl%nnodes) )
163 allocate( tamg_lvl%nodes_ptr(tamg_lvl%nnodes+1) )
164 allocate( tamg_lvl%nodes_gid(tamg_lvl%nnodes) )
165 allocate( tamg_lvl%nodes_dofs(ndofs) )
166 allocate( tamg_lvl%nodes_gids(ndofs) )
168 tamg_lvl%fine_lvl_dofs = ndofs
169 allocate( tamg_lvl%wrk_in( ndofs ) )
170 allocate( tamg_lvl%wrk_out( ndofs ) )
179 integer,
intent(in) :: gid
180 integer,
intent(in) :: ndofs
184 allocate( node%dofs( node%ndofs) )
186 allocate( node%interp_r( node%ndofs) )
187 allocate( node%interp_p( node%ndofs) )
200 real(kind=
rp),
intent(inout) :: vec_out(:)
201 real(kind=
rp),
intent(inout) :: vec_in(:)
202 integer,
intent(in) :: lvl_out
204 call this%matvec_impl(vec_out, vec_in, this%nlvls, lvl_out)
217 real(kind=
rp),
intent(inout) :: vec_out(:)
218 real(kind=
rp),
intent(inout) :: vec_in(:)
219 integer,
intent(in) :: lvl
220 integer,
intent(in) :: lvl_out
229 call this%gs_h%op(vec_in, n, gs_op_add)
230 call col2( vec_in, this%coef%mult(1,1,1,1), n)
232 call this%ax%compute(vec_out, vec_in, this%coef, this%msh, this%Xh)
234 call this%gs_h%op(vec_out, n, gs_op_add)
235 call this%blst%apply(vec_out, n)
238 if (lvl_out .ge. lvl)
then
241 associate( wrk_in => this%lvl(lvl)%wrk_in, wrk_out => this%lvl(lvl)%wrk_out)
244 do n = 1, this%lvl(lvl)%nnodes
245 associate(node => this%lvl(lvl)%nodes(n))
247 wrk_in( node%dofs(i) ) = wrk_in( node%dofs(i) ) + vec_in( node%gid ) * node%interp_p( i )
252 call this%matvec_impl(wrk_out, wrk_in, lvl-1, lvl_out)
255 do n = 1, this%lvl(lvl)%nnodes
256 associate(node => this%lvl(lvl)%nodes(n))
258 vec_out( node%gid ) = vec_out(node%gid ) + wrk_out( node%dofs(i) ) * node%interp_r( i )
263 else if (lvl_out .lt. lvl)
then
265 call this%matvec_impl(vec_out, vec_in, lvl-1, lvl_out)
267 call neko_error(
"TAMG: matvec level numbering problem.")
276 real(kind=rp),
intent(inout) :: vec_out(:)
277 real(kind=rp),
intent(inout) :: vec_in(:)
278 integer,
intent(in) :: lvl_blah
279 integer,
intent(in) :: lvl_out
280 integer :: i, n, cdof, lvl
287 call this%gs_h%op(vec_in, n, gs_op_add)
288 call col2( vec_in, this%coef%mult(1,1,1,1), n)
290 call this%ax%compute(vec_out, vec_in, this%coef, this%msh, this%Xh)
292 call this%gs_h%op(vec_out, n, gs_op_add)
293 call this%blst%apply(vec_out, n)
297 associate( wrk_in => this%lvl(1)%wrk_in, wrk_out => this%lvl(1)%wrk_out)
304 cdof = this%lvl(lvl)%map_f2c_dof(i)
305 wrk_in(i) = vec_in( cdof )
309 call this%gs_h%op(wrk_in, n, gs_op_add)
310 call col2( wrk_in, this%coef%mult(1,1,1,1), n)
312 call this%ax%compute(wrk_out, wrk_in, this%coef, this%msh, this%Xh)
314 call this%gs_h%op(wrk_out, n, gs_op_add)
315 call this%blst%apply(wrk_out, n)
320 cdof = this%lvl(lvl)%map_f2c_dof(i)
321 vec_out(cdof) = vec_out(cdof) + wrk_out( i )
335 real(kind=rp),
intent(inout) :: vec_out(:)
336 real(kind=rp),
intent(inout) :: vec_in(:)
337 integer,
intent(in) :: lvl
338 integer :: i, n, node_start, node_end, node_id
341 do n = 1, this%lvl(lvl)%nnodes
342 associate(node => this%lvl(lvl)%nodes(n))
344 vec_out( node%gid ) = vec_out( node%gid ) + vec_in( node%dofs(i) ) * node%interp_r( i )
365 real(kind=rp),
intent(inout) :: vec_out(:)
366 real(kind=rp),
intent(inout) :: vec_in(:)
367 integer,
intent(in) :: lvl
368 integer :: i, n, node_start, node_end, node_id
371 do n = 1, this%lvl(lvl)%nnodes
372 associate(node => this%lvl(lvl)%nodes(n))
374 vec_out( node%dofs(i) ) = vec_out( node%dofs(i) ) + vec_in( node%gid ) * node%interp_p( i )
Defines a Matrix-vector product.
subroutine, public col2(a, b, n)
Vector multiplication .
integer, parameter, public rp
Global precision used in computations.
Defines a function space.
Implements the base type for TreeAMG hierarchy structure.
recursive subroutine tamg_matvec_impl(this, vec_out, vec_in, lvl, lvl_out)
Matrix vector product using the TreeAMG hierarchy structure b=Ax done as vec_out = A * vec_in This is...
subroutine, public tamg_node_init(node, gid, ndofs)
Initialization of a TreeAMG tree node.
subroutine tamg_restriction_operator(this, vec_out, vec_in, lvl)
Restriction operator for TreeAMG. vec_out = R * vec_in.
subroutine tamg_prolongation_operator(this, vec_out, vec_in, lvl)
Prolongation operator for TreeAMG. vec_out = P * vec_in.
subroutine, public tamg_lvl_init(tamg_lvl, lvl, nnodes, ndofs)
Initialization of a TreeAMG level.
recursive subroutine tamg_matvec(this, vec_out, vec_in, lvl_out)
Wrapper for matrix vector product using the TreeAMG hierarchy structure b=Ax done as vec_out = A * ve...
subroutine tamg_init(this, ax, xh, coef, msh, gs_h, nlvls, blst)
Initialization of TreeAMG hierarchy.
recursive subroutine tamg_matvec_flat_impl(this, vec_out, vec_in, lvl_blah, lvl_out)
Ignore this. For piecewise constant, can create index map directly to finest level.
Base type for a matrix-vector product providing .
A list of allocatable `bc_t`. Follows the standard interface of lists.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
The function space for the SEM solution fields.
Type for a TreeAMG hierarchy.
Type for storing TreeAMG level information.
Type for storing TreeAMG tree node information.