55 use json_module,
only : json_file
67 use,
intrinsic :: iso_c_binding
74 integer :: smoother_itrs = 10
77 type(
gs_t),
pointer :: gs_h
98 class(
ax_t),
allocatable :: ax
104 integer :: last_metrics_version = -1
108 logical :: update_enabled = .false.
110 logical :: refresh_eigs = .true.
112 integer :: refresh_eigs_frequency = 20
114 logical :: eigs_warm_start = .true.
116 integer :: power_its_refresh = 20
118 integer :: n_refresh = 0
120 character(len=:),
allocatable :: cheby_acc
123 procedure, pass(this) :: init_from_components => &
134 class(
phmg_t),
intent(inout),
target :: this
135 type(
coef_t),
intent(in),
target :: coef
136 type(
bc_list_t),
intent(inout),
target :: bclst
137 type(json_file),
intent(inout) :: phmg_params
138 integer :: crs_tamg_lvls, crs_tamg_itrs, crs_tamg_cheby_degree
139 integer :: smoother_itrs
140 character(len=:),
allocatable :: cheby_acc
141 integer,
allocatable :: pcrs_sched(:)
142 logical :: update_enabled
157 crs_tamg_cheby_degree, 4)
159 if (phmg_params%valid_path(
'pcoarsening_schedule'))
then
160 call json_get(phmg_params,
'pcoarsening_schedule', pcrs_sched)
162 allocate(pcrs_sched(2))
168 update_enabled, .false.)
172 this%refresh_eigs, .true.)
174 this%refresh_eigs_frequency, 20)
176 this%eigs_warm_start, .true.)
178 this%power_its_refresh, 20)
180 call this%init_from_components(coef, bclst, smoother_itrs, &
181 cheby_acc, crs_tamg_lvls, crs_tamg_itrs, crs_tamg_cheby_degree,&
182 pcrs_sched, update_enabled)
187 cheby_acc, crs_tamg_lvls, crs_tamg_itrs, crs_tamg_cheby_degree, &
188 pcrs_sched, update_enabled)
189 class(
phmg_t),
intent(inout),
target :: this
190 type(
coef_t),
intent(in),
target :: coef
191 type(
bc_list_t),
intent(inout),
target :: bclst
192 integer,
intent(in) :: smoother_itrs
193 character(len=:),
allocatable :: cheby_acc
194 integer,
intent(in) :: crs_tamg_lvls, crs_tamg_itrs
195 integer,
intent(in) :: crs_tamg_cheby_degree
196 integer,
intent(in),
allocatable :: pcrs_sched(:)
197 logical,
intent(in),
optional :: update_enabled
198 integer :: lx_crs, lx_mid
199 integer,
allocatable :: lx_lvls(:)
200 integer :: n, i, j, st
201 class(
bc_t),
pointer :: bc_j
202 logical :: use_jacobi, use_cheby
207 this%cheby_acc = trim(cheby_acc)
209 if (
present(update_enabled))
then
210 this%update_enabled = update_enabled
212 this%update_enabled = .false.
215 this%nlvls =
size(pcrs_sched) + 1
216 allocate(lx_lvls(0:this%nlvls - 1))
217 lx_lvls(1:) = pcrs_sched + 1
219 allocate(this%phmg_hrchy%lvl(0:this%nlvls - 1))
221 this%phmg_hrchy%lvl(0)%lvl = 0
222 this%phmg_hrchy%lvl(0)%smoother_itrs = smoother_itrs
223 this%phmg_hrchy%lvl(0)%Xh => coef%Xh
224 this%phmg_hrchy%lvl(0)%coef => coef
225 this%phmg_hrchy%lvl(0)%dm_Xh => coef%dof
226 this%phmg_hrchy%lvl(0)%gs_h => coef%gs_h
228 do i = 1, this%nlvls - 1
229 allocate(this%phmg_hrchy%lvl(i)%Xh)
230 allocate(this%phmg_hrchy%lvl(i)%dm_Xh)
231 allocate(this%phmg_hrchy%lvl(i)%gs_h)
232 allocate(this%phmg_hrchy%lvl(i)%coef)
234 this%phmg_hrchy%lvl(i)%lvl = i
235 this%phmg_hrchy%lvl(i)%smoother_itrs = smoother_itrs
236 call this%phmg_hrchy%lvl(i)%Xh%init(
gll, lx_lvls(i), lx_lvls(i), &
238 call this%phmg_hrchy%lvl(i)%dm_Xh%init(coef%msh, &
239 this%phmg_hrchy%lvl(i)%Xh)
240 call this%phmg_hrchy%lvl(i)%gs_h%init(this%phmg_hrchy%lvl(i)%dm_Xh)
241 call this%phmg_hrchy%lvl(i)%coef%init(this%phmg_hrchy%lvl(i)%gs_h)
244 do i = 0, this%nlvls - 1
245 call this%phmg_hrchy%lvl(i)%r%init(this%phmg_hrchy%lvl(i)%dm_Xh)
246 call this%phmg_hrchy%lvl(i)%w%init(this%phmg_hrchy%lvl(i)%dm_Xh)
247 call this%phmg_hrchy%lvl(i)%z%init(this%phmg_hrchy%lvl(i)%dm_Xh)
249 this%phmg_hrchy%lvl(i)%coef%ifh2 = coef%ifh2
250 call copy(this%phmg_hrchy%lvl(i)%coef%h1, coef%h1, &
251 this%phmg_hrchy%lvl(i)%dm_Xh%size())
253 call this%phmg_hrchy%lvl(i)%bc%init_base(this%phmg_hrchy%lvl(i)%coef)
254 if (bclst%size() .gt. 0 )
then
255 do j = 1, bclst%size()
257 call this%phmg_hrchy%lvl(i)%bc%mark_facets(bc_j%marked_facet)
260 call this%phmg_hrchy%lvl(i)%bc%finalize()
261 call this%phmg_hrchy%lvl(i)%bc%set_g(0.0_rp)
262 call this%phmg_hrchy%lvl(i)%bclst%init()
263 call this%phmg_hrchy%lvl(i)%bclst%append(this%phmg_hrchy%lvl(i)%bc)
266 if (trim(cheby_acc) .eq.
"schwarz")
then
267 call this%phmg_hrchy%lvl(i)%schwarz%init( &
268 this%phmg_hrchy%lvl(i)%Xh, &
269 this%phmg_hrchy%lvl(i)%dm_Xh, &
270 this%phmg_hrchy%lvl(i)%gs_h, &
271 this%phmg_hrchy%lvl(i)%bclst, &
276 call this%phmg_hrchy%lvl(i)%device_jacobi%init(&
277 this%phmg_hrchy%lvl(i)%coef, &
278 this%phmg_hrchy%lvl(i)%dm_Xh, &
279 this%phmg_hrchy%lvl(i)%gs_h)
281 call this%phmg_hrchy%lvl(i)%jacobi%init(&
282 this%phmg_hrchy%lvl(i)%coef, &
283 this%phmg_hrchy%lvl(i)%dm_Xh, &
284 this%phmg_hrchy%lvl(i)%gs_h)
288 if (trim(cheby_acc) .eq.
"jacobi")
then
289 call this%phmg_hrchy%lvl(i)%cheby_device%init( &
290 this%phmg_hrchy%lvl(i)%dm_Xh%size(), smoother_itrs, &
291 this%phmg_hrchy%lvl(i)%device_jacobi)
294 call this%phmg_hrchy%lvl(i)%cheby_device%init( &
295 this%phmg_hrchy%lvl(i)%dm_Xh%size(), smoother_itrs)
297 if (trim(cheby_acc) .eq.
"schwarz")
then
298 this%phmg_hrchy%lvl(i)%cheby_device%schwarz => &
299 this%phmg_hrchy%lvl(i)%schwarz
304 if (trim(cheby_acc) .eq.
"jacobi")
then
305 call this%phmg_hrchy%lvl(i)%cheby%init( &
306 this%phmg_hrchy%lvl(i)%dm_Xh%size(), smoother_itrs, &
307 this%phmg_hrchy%lvl(i)%jacobi)
310 call this%phmg_hrchy%lvl(i)%cheby%init( &
311 this%phmg_hrchy%lvl(i)%dm_Xh%size(), smoother_itrs)
313 if (trim(cheby_acc) .eq.
"schwarz")
then
314 this%phmg_hrchy%lvl(i)%cheby%schwarz => &
315 this%phmg_hrchy%lvl(i)%schwarz
326 call ax_helm_factory(this%ax, full_formulation = .false.)
329 allocate(this%intrp(this%nlvls - 1))
330 do i = 1, this%nlvls -1
331 call this%intrp(i)%init(this%phmg_hrchy%lvl(i-1)%Xh, &
332 this%phmg_hrchy%lvl(i)%Xh)
336 if (this%update_enabled)
then
337 allocate(this%crd_intrp(this%nlvls - 1))
338 do i = 1, this%nlvls - 1
339 call this%crd_intrp(i)%init(this%phmg_hrchy%lvl(i)%Xh, &
340 this%phmg_hrchy%lvl(0)%Xh)
344 call this%amg_solver%init(this%ax, this%phmg_hrchy%lvl(this%nlvls -1)%Xh, &
345 this%phmg_hrchy%lvl(this%nlvls -1)%coef, this%msh, &
346 this%phmg_hrchy%lvl(this%nlvls-1)%gs_h, crs_tamg_lvls, &
347 this%phmg_hrchy%lvl(this%nlvls -1)%bclst, &
348 crs_tamg_itrs, crs_tamg_cheby_degree)
351 this%last_metrics_version = this%phmg_hrchy%lvl(0)%coef%metrics_version
354 if (this%update_enabled)
then
355 do i = 0, this%nlvls - 1
356 this%phmg_hrchy%lvl(i)%cheby%warm_start_eigs = this%eigs_warm_start
357 this%phmg_hrchy%lvl(i)%cheby%power_its_refresh = &
358 this%power_its_refresh
359 this%phmg_hrchy%lvl(i)%cheby_device%warm_start_eigs = &
361 this%phmg_hrchy%lvl(i)%cheby_device%power_its_refresh = &
362 this%power_its_refresh
364 call this%amg_solver%set_eig_refresh(this%eigs_warm_start, &
365 this%power_its_refresh)
367 if (trim(cheby_acc) .eq.
"schwarz")
then
368 call neko_warning(
"PHMG: the Schwarz smoother is not refreshed " // &
369 "when the mesh changes. Its local solves stay at the " // &
377 class(
phmg_t),
intent(inout) :: this
380 call this%amg_solver%free()
382 if (
allocated(this%intrp))
then
383 do i = 1,
size(this%intrp)
384 call this%intrp(i)%free()
386 deallocate(this%intrp)
389 if (
allocated(this%crd_intrp))
then
390 do i = 1,
size(this%crd_intrp)
391 call this%crd_intrp(i)%free()
393 deallocate(this%crd_intrp)
396 if (
allocated(this%ax))
then
400 if (
allocated(this%phmg_hrchy%lvl))
then
401 do i = lbound(this%phmg_hrchy%lvl, 1), ubound(this%phmg_hrchy%lvl, 1)
402 call this%phmg_hrchy%lvl(i)%r%free()
403 call this%phmg_hrchy%lvl(i)%w%free()
404 call this%phmg_hrchy%lvl(i)%z%free()
406 call this%phmg_hrchy%lvl(i)%cheby%free()
407 call this%phmg_hrchy%lvl(i)%cheby_device%free()
408 call this%phmg_hrchy%lvl(i)%jacobi%free()
409 call this%phmg_hrchy%lvl(i)%device_jacobi%free()
411 if (
allocated(this%phmg_hrchy%lvl(i)%schwarz%work1))
then
412 call this%phmg_hrchy%lvl(i)%schwarz%free()
415 call this%phmg_hrchy%lvl(i)%bclst%free()
416 call this%phmg_hrchy%lvl(i)%bc%free()
420 if (this%phmg_hrchy%lvl(i)%lvl .gt. 0)
then
421 call this%phmg_hrchy%lvl(i)%coef%free()
422 call this%phmg_hrchy%lvl(i)%gs_h%free()
423 call this%phmg_hrchy%lvl(i)%dm_Xh%free()
424 call this%phmg_hrchy%lvl(i)%Xh%free()
425 deallocate(this%phmg_hrchy%lvl(i)%coef)
426 deallocate(this%phmg_hrchy%lvl(i)%gs_h)
427 deallocate(this%phmg_hrchy%lvl(i)%dm_Xh)
428 deallocate(this%phmg_hrchy%lvl(i)%Xh)
431 nullify(this%phmg_hrchy%lvl(i)%coef)
432 nullify(this%phmg_hrchy%lvl(i)%gs_h)
433 nullify(this%phmg_hrchy%lvl(i)%dm_Xh)
434 nullify(this%phmg_hrchy%lvl(i)%Xh)
436 deallocate(this%phmg_hrchy%lvl)
444 class(
phmg_t),
intent(inout) :: this
445 integer,
intent(in) :: n
446 real(kind=
rp),
dimension(n),
intent(inout) :: z
447 real(kind=
rp),
dimension(n),
intent(inout) :: r
448 type(c_ptr) :: z_d, r_d
453 associate( mglvl => this%phmg_hrchy%lvl)
474 mglvl(0)%r%x(i,1,1,1) = r(i)
476 mglvl(0)%z%x(i,1,1,1) = 0.0_rp
477 mglvl(0)%w%x(i,1,1,1) = 0.0_rp
489 z(i) = mglvl(0)%z%x(i,1,1,1)
500 class(
phmg_t),
intent(inout) :: this
501 integer :: fine_version
504 if (.not. this%update_enabled)
return
506 fine_version = this%phmg_hrchy%lvl(0)%coef%metrics_version
509 if (fine_version .eq. this%last_metrics_version)
return
515 do_eigs = (this%refresh_eigs) .and. &
516 (this%refresh_eigs_frequency .gt. 0) .and. &
517 (mod(this%n_refresh,
max(this%refresh_eigs_frequency, 1)) &
521 this%n_refresh = this%n_refresh + 1
522 this%last_metrics_version = fine_version
530 class(
phmg_t),
intent(inout) :: this
533 if (.not.
allocated(this%crd_intrp))
then
534 call neko_error(
"PHMG: update requested but coordinate " // &
535 "interpolators were not initialized.")
538 call profiler_start_region(
'PHMG_update_geometry')
539 associate(mg => this%phmg_hrchy%lvl, nelv => this%msh%nelv)
540 do i = 1, this%nlvls - 1
541 call this%crd_intrp(i)%map(mg(i)%dm_Xh%x, mg(0)%dm_Xh%x, &
543 call this%crd_intrp(i)%map(mg(i)%dm_Xh%y, mg(0)%dm_Xh%y, &
545 call this%crd_intrp(i)%map(mg(i)%dm_Xh%z, mg(0)%dm_Xh%z, &
548 call mg(i)%coef%recompute_metrics()
551 call profiler_end_region(
'PHMG_update_geometry')
559 class(
phmg_t),
intent(inout) :: this
562 call profiler_start_region(
'PHMG_update_smoother_acc')
563 associate(mg => this%phmg_hrchy%lvl)
564 select case (trim(this%cheby_acc))
566 do i = 0, this%nlvls - 1
567 if (neko_bcknd_device .eq. 1)
then
568 call mg(i)%device_jacobi%update()
570 call mg(i)%jacobi%update()
580 call profiler_end_region(
'PHMG_update_smoother_acc')
587 class(
phmg_t),
intent(inout) :: this
590 associate(mg => this%phmg_hrchy%lvl)
591 do i = 0, this%nlvls - 1
592 if (neko_bcknd_device .eq. 1)
then
593 mg(i)%cheby_device%recompute_eigs = .true.
595 mg(i)%cheby%recompute_eigs = .true.
600 call this%amg_solver%invalidate_eigs()
606 class(
phmg_t),
intent(inout) :: this
607 type(ksp_monitor_t) :: ksp_results
608 character(len=2) :: lvl_name
611 associate(mg => this%phmg_hrchy%lvl, intrp => this%intrp, &
612 msh => this%msh, ax => this%Ax)
613 do lvl = 0, this%nlvls-2
614 write(lvl_name,
'(I0)') lvl
615 call profiler_start_region(
"PHMG_level_" // trim(lvl_name))
616 associate(z => mg(lvl)%z, r => mg(lvl)%r, w => mg(lvl)%w)
620 if (neko_bcknd_device .eq. 1)
then
621 mg(lvl)%cheby_device%zero_initial_guess = .true.
622 ksp_results = mg(lvl)%cheby_device%solve(ax, z, &
623 r%x, mg(lvl)%dm_Xh%size(), &
624 mg(lvl)%coef, mg(lvl)%bclst, &
625 mg(lvl)%gs_h, niter = mg(lvl)%smoother_itrs)
627 mg(lvl)%cheby%zero_initial_guess = .true.
628 ksp_results = mg(lvl)%cheby%solve(ax, z, &
629 r%x, mg(lvl)%dm_Xh%size(), &
630 mg(lvl)%coef, mg(lvl)%bclst, &
631 mg(lvl)%gs_h, niter = mg(lvl)%smoother_itrs)
637 call ax%compute(w%x, z%x, mg(lvl)%coef, msh, mg(lvl)%Xh)
638 call mg(lvl)%gs_h%op(w%x, mg(lvl)%dm_Xh%size(), gs_op_add, &
640 call device_stream_wait_event(glb_cmd_queue, glb_cmd_event, 0)
641 call mg(lvl)%bclst%apply_scalar(w%x, mg(lvl)%dm_Xh%size())
643 if (neko_bcknd_device .eq. 1)
then
644 call device_add2s1(w%x_d, r%x_d, -1.0_rp, mg(lvl)%dm_Xh%size())
651 do i = 1, mg(lvl)%dm_Xh%size()
652 w%x(i,1,1,1) = r%x(i,1,1,1) - w%x(i,1,1,1)
660 if (neko_bcknd_device .eq. 1)
then
661 call device_col2(w%x_d, mg(lvl)%coef%mult_d, mg(lvl)%dm_Xh%size())
663 call col2(w%x, mg(lvl)%coef%mult, mg(lvl)%dm_Xh%size())
666 call intrp(lvl+1)%map(mg(lvl+1)%r%x, w%x, msh%nelv, mg(lvl+1)%Xh)
668 call mg(lvl+1)%gs_h%op(mg(lvl+1)%r%x, mg(lvl+1)%dm_Xh%size(), &
669 gs_op_add, glb_cmd_event)
670 call device_stream_wait_event(glb_cmd_queue, glb_cmd_event, 0)
672 call mg(lvl+1)%bclst%apply_scalar( &
674 mg(lvl+1)%dm_Xh%size())
676 if (neko_bcknd_device .eq. 1)
then
677 call device_rzero(mg(lvl+1)%z%x_d, mg(lvl+1)%dm_Xh%size())
684 do i = 1, mg(lvl+1)%dm_Xh%size()
685 mg(lvl+1)%z%x(i,1,1,1) = 0.0_rp
690 call profiler_end_region(
"PHMG_level_" // trim(lvl_name))
693 call profiler_start_region(
'PHMG_coarse-solve' )
697 call this%amg_solver%solve(mg(this%nlvls-1)%z%x, &
698 mg(this%nlvls-1)%r%x, &
699 mg(this%nlvls-1)%dm_Xh%size())
700 call profiler_end_region(
'PHMG_coarse-solve' )
702 do lvl = (this%nlvls-2), 0, -1
703 write(lvl_name,
'(I0)') lvl
704 call profiler_start_region(
"PHMG_level_" // trim(lvl_name))
705 associate(z => mg(lvl)%z, r => mg(lvl)%r, w => mg(lvl)%w)
709 call intrp(lvl+1)%map(w%x, mg(lvl+1)%z%x, msh%nelv, mg(lvl)%Xh)
711 call mg(lvl)%gs_h%op(w%x, mg(lvl)%dm_Xh%size(), gs_op_add, &
713 call device_stream_wait_event(glb_cmd_queue, glb_cmd_event, 0)
715 if (neko_bcknd_device .eq. 1)
then
716 call device_col2(w%x_d, mg(lvl)%coef%mult_d, mg(lvl)%dm_Xh%size())
718 call col2(w%x, mg(lvl)%coef%mult, mg(lvl)%dm_Xh%size())
724 if (neko_bcknd_device .eq. 1)
then
725 call device_add2(z%x_d, w%x_d, mg(lvl)%dm_Xh%size())
732 do i = 1, mg(lvl)%dm_Xh%size()
733 z%x(i,1,1,1) = z%x(i,1,1,1) + w%x(i,1,1,1)
741 if (neko_bcknd_device .eq. 1)
then
742 ksp_results = mg(lvl)%cheby_device%solve(ax, z, &
743 r%x, mg(lvl)%dm_Xh%size(), &
744 mg(lvl)%coef, mg(lvl)%bclst, &
745 mg(lvl)%gs_h, niter = mg(lvl)%smoother_itrs)
747 ksp_results = mg(lvl)%cheby%solve(ax, z, &
748 r%x, mg(lvl)%dm_Xh%size(), &
749 mg(lvl)%coef, mg(lvl)%bclst, &
750 mg(lvl)%gs_h, niter = mg(lvl)%smoother_itrs)
753 call profiler_end_region(
"PHMG_level_" // trim(lvl_name))
770 class(ax_t),
intent(inout) :: Ax
771 type(mesh_t),
intent(inout) :: msh
772 type(field_t),
intent(inout) :: z, r, w
773 integer,
intent(in) :: n, lvl
774 integer :: i, j, iblk, ni, niblk
776 ni = mg%smoother_itrs
777 if (neko_bcknd_device .eq. 1)
then
779 call ax%compute(w%x, z%x, mg%coef, msh, mg%Xh)
780 call mg%gs_h%op(w%x, n, gs_op_add, glb_cmd_event)
781 call device_stream_wait_event(glb_cmd_queue, glb_cmd_event, 0)
782 call mg%bclst%apply_scalar(w%x, n)
783 call device_add2s1(w%x_d, r%x_d, -1.0_rp, n)
785 call mg%device_jacobi%solve(w%x, w%x, n)
787 call device_add2s2(z%x_d, w%x_d, 0.6_rp, n)
791 call ax%compute(w%x, z%x, mg%coef, msh, mg%Xh)
792 call mg%gs_h%op(w%x, n, gs_op_add)
793 call mg%bclst%apply_scalar(w%x, n)
794 call add2s1(w%x, r%x, -1.0_rp, n)
796 call mg%jacobi%solve(w%x, w%x, n)
798 call add2s2(z%x, w%x, 0.6_rp, n)
807 class(ax_t),
intent(inout) :: Ax
808 type(mesh_t),
intent(inout) :: msh
809 type(field_t) :: z, r, w
811 character(len=LOG_SIZE) :: log_buf
812 call ax%compute(w%x, z%x, mg%coef, msh, mg%Xh)
813 call mg%gs_h%op(w%x, mg%dm_Xh%size(), gs_op_add)
814 call mg%bclst%apply_scalar(w%x, mg%dm_Xh%size())
815 call device_add2s1(w%x_d, r%x_d, -1.0_rp, mg%dm_Xh%size())
816 val = device_glsc2(w%x_d, w%x_d, mg%dm_Xh%size())
818 write(log_buf,
'(A15,I4,F12.6)')
'PRESMOO - PRE', lvl, val
819 else if (typ .eq. 2)
then
820 write(log_buf,
'(A15,I4,F12.6)')
'PRESMOO -POST', lvl, val
821 else if (typ .eq. 3)
then
822 write(log_buf,
'(A15,I4,F12.6)')
'POSTSMOO- PRE', lvl, val
823 else if (typ .eq. 4)
then
824 write(log_buf,
'(A15,I4,F12.6)')
'POSTSMOO-POST', lvl, val
825 else if (typ .eq. 5)
then
826 write(log_buf,
'(A15,I4,F12.6)')
'TAMG - PRE', lvl, val
827 else if (typ .eq. 6)
then
828 write(log_buf,
'(A15,I4,F12.6)')
'TAMG -POST', lvl, val
830 write(log_buf,
'(A15,I4,F12.6)')
'RESID', lvl, val
832 call neko_log%message(log_buf)
836 integer,
intent(in) :: nlvls
837 integer,
intent(in) :: smoo_type
840 character(len=LOG_SIZE) :: log_buf, smoo_name
842 call neko_log%section(
'PHMG')
844 if (smoo_type .eq. 1)
then
845 write(smoo_name,
'(A16)')
'CHEBY-acc JACOBI'
846 else if (smoo_type .eq. 2)
then
847 write(smoo_name,
'(A17)')
'CHEBY-acc SCHWARZ'
849 write(smoo_name,
'(A5)')
'CHEBY'
852 write(log_buf,
'(A28,I2,A8)') &
853 'Creating PHMG hierarchy with', &
855 call neko_log%message(log_buf)
859 write(log_buf,
'(A8,I2,A8,I2)') &
860 '-- level', i,
'-- lx:',
phmg%lvl(i)%Xh%lx
861 call neko_log%message(log_buf)
863 if (i .eq. clvl)
then
864 write(log_buf,
'(A19,A20)') &
866 call neko_log%message(log_buf)
868 write(log_buf,
'(A22,A20)') &
871 call neko_log%message(log_buf)
873 write(log_buf,
'(A28,I2)') &
875 phmg%lvl(i)%smoother_itrs
876 call neko_log%message(log_buf)
880 call neko_log%end_section()
__device__ T solve(const T u, const T y, const T guess, const T nu, const T kappa, const T B)
Return the device pointer for an associated Fortran array.
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Defines a Matrix-vector product.
Defines a boundary condition.
Chebyshev preconditioner.
Chebyshev preconditioner.
Jacobi preconditioner accelerator backend.
subroutine, public device_add2s1(a_d, b_d, c1, n, strm)
subroutine, public device_add2s2(a_d, b_d, c1, n, strm)
Vector addition with scalar multiplication (multiplication on first argument)
subroutine, public device_add2(a_d, b_d, n, strm)
Vector addition .
subroutine, public device_rzero(a_d, n, strm)
Zero a real vector.
subroutine, public device_copy(a_d, b_d, n, strm)
Copy a vector .
subroutine, public device_col2(a_d, b_d, n, strm)
Vector multiplication .
subroutine, public device_invcol2(a_d, b_d, n, strm)
Vector division .
real(kind=rp) function, public device_glsc2(a_d, b_d, n, strm)
Weighted inner product .
Device abstraction, common interface for various accelerators.
subroutine, public device_stream_wait_event(stream, event, flags)
Synchronize a device stream with an event.
type(c_ptr), bind(C), public glb_cmd_queue
Global command queue.
type(c_ptr), bind(C), public glb_cmd_event
Event for the global command queue.
Defines a dirichlet boundary condition.
Defines a mapping of the degrees of freedom.
Routines to interpolate between different spaces.
Utilities for retrieving parameters from the case files.
Implements the base abstract type for Krylov solvers plus helper types.
integer, parameter, public ksp_max_iter
Maximum number of iters.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
subroutine, public add2s1(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on first argument)
subroutine, public add2(a, b, n)
Vector addition .
subroutine, public col2(a, b, n)
Vector multiplication .
subroutine, public copy(a, b, n)
Copy a vector .
subroutine, public add2s2(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on second argument)
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Hybrid ph-multigrid preconditioner.
subroutine phmg_update_smoother_acc(this)
Rebuild the accelerator the Chebyshev smoother uses, which depends on the geometry.
subroutine phmg_jacobi_smoother(z, r, w, mg, msh, ax, n, lvl)
Wraps jacobi solve as a residual update relaxation method.
subroutine phmg_solve(this, z, r, n)
subroutine phmg_init(this, coef, bclst, phmg_params)
subroutine phmg_update(this)
Bring the preconditioner back in sync after the mesh has changed.
subroutine phmg_update_smoother_eigs(this)
Mark every smoother to re-estimate its eigenvalues on the next solve.
subroutine phmg_update_coarse_geometry(this)
Sample the new fine coordinates on the coarse levels and rebuild their metrics. Level 0 shares the ca...
subroutine phmg_free(this)
subroutine phmg_mg_cycle(this)
subroutine phmg_resid_monitor(z, r, w, mg, msh, ax, lvl, typ)
subroutine print_phmg_info(nlvls, smoo_type, phmg)
subroutine phmg_init_from_components(this, coef, bclst, smoother_itrs, cheby_acc, crs_tamg_lvls, crs_tamg_itrs, crs_tamg_cheby_degree, pcrs_sched, update_enabled)
subroutine, public profiler_start_region(name, region_id)
Started a named (name) profiler region.
subroutine, public profiler_end_region(name, region_id)
End the most recently started profiler region.
Overlapping schwarz solves.
Defines a function space.
integer, parameter, public gll
Implements multigrid using the TreeAMG hierarchy structure. USE:
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
Base type for a matrix-vector product providing .
Base type for a boundary condition.
A list of allocatable `bc_t`. Follows the standard interface of lists.
Defines a Chebyshev preconditioner.
Defines a Chebyshev preconditioner.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Defines a jacobi preconditioner.
Generic Dirichlet boundary condition on .
Interpolation between two space::space_t.
Defines a jacobi preconditioner.
Type for storing initial and final residuals in a Krylov solver.
Base abstract type for a canonical Krylov method, solving .
Defines a canonical Krylov preconditioner.
The function space for the SEM solution fields.
Type for the TreeAMG solver.