Skip to content

Commit

Permalink
Merge pull request #1642 from ExtremeFLOW/fix/tree_amg_cleanup
Browse files Browse the repository at this point in the history
Cleanup AMG output
  • Loading branch information
njansson authored Dec 16, 2024
2 parents 592ffc5 + 373db9d commit c5d24f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 7 additions & 1 deletion src/multigrid/tree_amg_multigrid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ subroutine tamg_mg_init(this, ax, Xh, coef, msh, gs_h, nlvls_in, blst, max_iter)
character(len=255) :: env_cheby_degree, env_mlvl
character(len=LOG_SIZE) :: log_buf

call neko_log%section('AMG')

call get_environment_variable("NEKO_TAMG_MAX_LVL", &
env_mlvl, env_len)
if (env_len .eq. 0) then
Expand All @@ -106,7 +108,8 @@ subroutine tamg_mg_init(this, ax, Xh, coef, msh, gs_h, nlvls_in, blst, max_iter)
read(env_mlvl(1:env_len), *) mlvl
nlvls = mlvl
end if
print *, "Creating AMG hierarchy with", nlvls, "levels"
write(log_buf, '(A27,I2,A7)') "Creating AMG hierarchy with", nlvls, " levels"
call neko_log%message(log_buf)
if (nlvls .gt. 4) then
call neko_error("Can not do more than four levels right now. I recommend two or three.")
end if
Expand Down Expand Up @@ -161,6 +164,9 @@ subroutine tamg_mg_init(this, ax, Xh, coef, msh, gs_h, nlvls_in, blst, max_iter)
!end do

call fill_lvl_map(this%amg)

call neko_log%end_section()

end subroutine tamg_mg_init


Expand Down
13 changes: 7 additions & 6 deletions src/multigrid/tree_amg_smoother.f90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ subroutine amg_cheby_init(this, n, lvl, max_iter)
this%lvl = lvl
this%max_iter = max_iter
this%recompute_eigs = .true.
print *, "INIT SMOO ON LVL", lvl
! print *, "INIT SMOO ON LVL", lvl

end subroutine amg_cheby_init

Expand All @@ -108,13 +108,14 @@ subroutine amg_cheby_power(this, amg, n)
type(tamg_hierarchy_t), intent(inout) :: amg
integer, intent(in) :: n
real(kind=rp) :: lam, b, a, rn
real(kind=rp) :: boost = 1.1_rp
real(kind=rp) :: lam_factor = 30.0_rp
real(kind=rp), parameter :: boost = 1.1_rp
real(kind=rp), parameter :: lam_factor = 30.0_rp
real(kind=rp) :: wtw, dtw, dtd
integer :: i
associate(w => this%w, d => this%d, coef => amg%coef, gs_h => amg%gs_h, msh=>amg%msh, Xh=>amg%Xh, blst=>amg%blst)
associate(w => this%w, d => this%d, coef => amg%coef, gs_h => amg%gs_h, &
msh=>amg%msh, Xh=>amg%Xh, blst=>amg%blst)

print *, "COMP EIGS on lvl", this%lvl, "n", n
! print *, "COMP EIGS on lvl", this%lvl, "n", n
do i = 1, n
!TODO: replace with a better way to initialize power method
!call random_number(rn)
Expand Down Expand Up @@ -159,7 +160,7 @@ subroutine amg_cheby_power(this, amg, n)
dtd = glsc2(d, d, n)
end if
lam = dtw / dtd
print *, "LAM:", lam
! print *, "LAM:", lam
b = lam * boost
a = lam / lam_factor
this%tha = (b+a)/2.0_rp
Expand Down

0 comments on commit c5d24f6

Please sign in to comment.