From 0dc04c0e80899d5b337c23396cebca06316604f5 Mon Sep 17 00:00:00 2001 From: Niclas Jansson Date: Mon, 16 Dec 2024 20:54:15 +0100 Subject: [PATCH 1/3] Avoid implicit save attribute for constants --- src/multigrid/tree_amg_smoother.f90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/multigrid/tree_amg_smoother.f90 b/src/multigrid/tree_amg_smoother.f90 index 849caf7e94c..a9f66c38016 100644 --- a/src/multigrid/tree_amg_smoother.f90 +++ b/src/multigrid/tree_amg_smoother.f90 @@ -108,11 +108,12 @@ 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 do i = 1, n From 3526f28c731289ae2e74c710c419eb4d442aa7d3 Mon Sep 17 00:00:00 2001 From: Niclas Jansson Date: Mon, 16 Dec 2024 22:08:21 +0100 Subject: [PATCH 2/3] Remove debug output --- src/multigrid/tree_amg_smoother.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/multigrid/tree_amg_smoother.f90 b/src/multigrid/tree_amg_smoother.f90 index a9f66c38016..96e51cd3d8e 100644 --- a/src/multigrid/tree_amg_smoother.f90 +++ b/src/multigrid/tree_amg_smoother.f90 @@ -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 @@ -115,7 +115,7 @@ subroutine amg_cheby_power(this, amg, n) 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) @@ -160,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 From 373db9d5f2fc974b099e55e0e151681f31115adb Mon Sep 17 00:00:00 2001 From: Niclas Jansson Date: Mon, 16 Dec 2024 22:08:37 +0100 Subject: [PATCH 3/3] Move output to Neko log --- src/multigrid/tree_amg_multigrid.f90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/multigrid/tree_amg_multigrid.f90 b/src/multigrid/tree_amg_multigrid.f90 index d3b75691b55..7c6433abfb1 100644 --- a/src/multigrid/tree_amg_multigrid.f90 +++ b/src/multigrid/tree_amg_multigrid.f90 @@ -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 @@ -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 @@ -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