FE-Project
Loading...
Searching...
No Matches
scale_multigrid_smoother_base Module Reference

module FElib / Multigrid / Smoother base More...

Data Types

type  mgsmootherbase
 Base type for multigrid smoother. More...
type  mgsmootherbase2d
 Derived type for 2D multigrid smoother. More...
interface  mgsmootherbase2d_advance_itr_1step
type  mgsmootherbase3d
 Derived type for 3D multigrid smoother. More...
interface  mgsmootherbase3d_advance_itr_1step

Functions/Subroutines

subroutine, public mgsmootherbase_init (this)
subroutine, public mgsmootherbase_final (this)
subroutine, public mgsmootherbase2d_init (this)
subroutine, public mgsmootherbase2d_final (this)
subroutine, public mgsmootherbase3d_init (this)
subroutine, public mgsmootherbase3d_final (this)
subroutine, public mgsmootherbase_put_residual_history (this, conv_flag, is_residual_check_step, res_l2, res_max)
 Put residual history and evaluate whether convergence is achieved. This subroutine also updates internal counters.
subroutine, public mgsmootherbase_get_statistic_lc (res_l2_lc, res_max_lc, res_lc, lmesh, elem)
 Get residual statistics on local mesh.

Variables

integer, parameter, public mgsmoother_pre_id = 1
 ID to represent pre-smoothing.
integer, parameter, public mgsmoother_post_id = 2
 ID to represent post-smoothing.
integer, parameter, public mgsmoother_default_num_smooth_ite_max = 10
real(rp), parameter, public mgsmoother_default_threshold_ratio_residual_l2 = 1.0E-3_RP
real(rp), parameter, public mgsmoother_default_threshold_residual_l2 = 1.0E-3_RP
real(rp), parameter, public mgsmoother_default_threshold_residual_max = 1.0E-3_RP

Detailed Description

module FElib / Multigrid / Smoother base

Description
A module to provide derived type to manage multigrid smoother
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ mgsmootherbase_init()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase_init ( class(mgsmootherbase), intent(inout) this)

Definition at line 174 of file scale_multigrid_smoother_base.F90.

175 implicit none
176 class(MGSmootherBase), intent(inout) :: this
177 !---------------------------------
178 this%num_smooth_itr_max = mgsmoother_default_num_smooth_ite_max
179 this%threshold_ratio_residual_l2 = mgsmoother_default_threshold_ratio_residual_l2
180 this%threshold_residual_l2 = mgsmoother_default_threshold_residual_l2
181 this%threshold_residual_max = mgsmoother_default_threshold_residual_max
182 return

References mgsmoother_default_num_smooth_ite_max, mgsmoother_default_threshold_ratio_residual_l2, mgsmoother_default_threshold_residual_l2, and mgsmoother_default_threshold_residual_max.

Referenced by scale_multigrid_smoother_base::mgsmootherbase::get_current_residual_statistics(), mgsmootherbase2d_init(), and mgsmootherbase3d_init().

◆ mgsmootherbase_final()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase_final ( class(mgsmootherbase), intent(inout) this)

Definition at line 186 of file scale_multigrid_smoother_base.F90.

187 implicit none
188 class(MGSmootherBase), intent(inout) :: this
189 !---------------------------------
190 return

Referenced by scale_multigrid_smoother_base::mgsmootherbase::get_current_residual_statistics(), mgsmootherbase2d_final(), and mgsmootherbase3d_final().

◆ mgsmootherbase2d_init()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase2d_init ( class(mgsmootherbase2d), intent(inout) this)

Definition at line 324 of file scale_multigrid_smoother_base.F90.

325 implicit none
326 class(MGSmootherBase2D), intent(inout) :: this
327 !---------------------------------
328 call mgsmootherbase_init( this )
329 return

References mgsmootherbase_init().

Referenced by scale_multigrid_smoother_base::mgsmootherbase2d::set_initial_residual().

◆ mgsmootherbase2d_final()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase2d_final ( class(mgsmootherbase2d), intent(inout) this)

Definition at line 333 of file scale_multigrid_smoother_base.F90.

334 implicit none
335 class(MGSmootherBase2D), intent(inout) :: this
336 !---------------------------------
337 call mgsmootherbase_final( this )
338 return

References mgsmoother_pre_id, mgsmootherbase_final(), mgsmootherbase_get_statistic_lc(), and mgsmootherbase_put_residual_history().

Referenced by scale_multigrid_smoother_base::mgsmootherbase2d::set_initial_residual().

◆ mgsmootherbase3d_init()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase3d_init ( class(mgsmootherbase3d), intent(inout) this)

Definition at line 463 of file scale_multigrid_smoother_base.F90.

464 implicit none
465 class(MGSmootherBase3D), intent(inout) :: this
466 !---------------------------------
467 call mgsmootherbase_init( this )
468 return

References mgsmootherbase_init().

Referenced by scale_multigrid_smoother_base::mgsmootherbase3d::set_initial_residual().

◆ mgsmootherbase3d_final()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase3d_final ( class(mgsmootherbase3d), intent(inout) this)

Definition at line 472 of file scale_multigrid_smoother_base.F90.

473 implicit none
474 class(MGSmootherBase3D), intent(inout) :: this
475 !---------------------------------
476 call mgsmootherbase_final( this )
477 return

References mgsmoother_pre_id, mgsmootherbase_final(), mgsmootherbase_get_statistic_lc(), and mgsmootherbase_put_residual_history().

Referenced by scale_multigrid_smoother_base::mgsmootherbase3d::set_initial_residual().

◆ mgsmootherbase_put_residual_history()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase_put_residual_history ( class(mgsmootherbase), intent(inout) this,
logical, intent(out) conv_flag,
logical, intent(in) is_residual_check_step,
real(rp), intent(in) res_l2,
real(rp), intent(in) res_max )

Put residual history and evaluate whether convergence is achieved. This subroutine also updates internal counters.

Definition at line 602 of file scale_multigrid_smoother_base.F90.

604 implicit none
605 class(MGSmootherBase), intent(inout) :: this
606 logical, intent(out) :: conv_flag
607 logical, intent(in) :: is_residual_check_step
608 real(RP), intent(in) :: res_l2
609 real(RP), intent(in) :: res_max
610 !---------------------------------
611
612 if ( is_residual_check_step ) then
613 !- Store the statistics of residual to history
614 this%history_residual_count = this%history_residual_count + 1
615 this%history_residual_l2 (this%history_residual_count) = res_l2
616 this%history_residual_max(this%history_residual_count) = res_max
617
618 !- Reset remaining step
619 this%history_residual_rstep = this%history_residual_step
620
621 !- Evaluate convergence
622 conv_flag = this%Is_converged( .false. )
623 else
624 this%history_residual_rstep = this%history_residual_rstep - 1
625 conv_flag = .false.
626 end if
627 return

Referenced by scale_multigrid_smoother_base::mgsmootherbase::get_current_residual_statistics(), mgsmootherbase2d_final(), and mgsmootherbase3d_final().

◆ mgsmootherbase_get_statistic_lc()

subroutine, public scale_multigrid_smoother_base::mgsmootherbase_get_statistic_lc ( real(rp), intent(inout) res_l2_lc,
real(rp), intent(inout) res_max_lc,
real(rp), dimension(elem%np,lmesh%nea), intent(in) res_lc,
class(localmeshbase), intent(in), target lmesh,
class(elementbase), intent(in), target elem )

Get residual statistics on local mesh.

Definition at line 632 of file scale_multigrid_smoother_base.F90.

636 implicit none
637 class(LocalMeshBase), intent(in), target :: lmesh
638 class(ElementBase), intent(in), target :: elem
639 real(RP), intent(inout) :: res_l2_lc
640 real(RP), intent(inout) :: res_max_lc
641 real(RP), intent(in) :: res_lc(elem%Np,lmesh%NeA)
642
643 integer :: ke
644 real(RP) :: res_(elem%Np)
645 !---------------------------------
646
647 !$omp parallel do private(ke,res_) reduction(+:res_l2_lc) reduction(max:res_max_lc)
648 do ke=lmesh%NeS, lmesh%NeE
649 res_(:) = res_lc(:,ke)
650 res_l2_lc = res_l2_lc + sum( res_(:)**2 )
651 res_max_lc = max(res_max_lc, maxval( abs(res_(:)) ))
652 end do
653 return
module FElib / Element / Base
module FElib / Mesh / Local, Base
Derived type representing an arbitrary finite element.
Derived type to manage a local computational domain (base type)

Referenced by scale_multigrid_smoother_base::mgsmootherbase::get_current_residual_statistics(), mgsmootherbase2d_final(), and mgsmootherbase3d_final().

Variable Documentation

◆ mgsmoother_pre_id

integer, parameter, public scale_multigrid_smoother_base::mgsmoother_pre_id = 1

ID to represent pre-smoothing.

Definition at line 46 of file scale_multigrid_smoother_base.F90.

46 integer, public, parameter :: MGSmoother_PRE_ID = 1 !< ID to represent pre-smoothing

Referenced by mgsmootherbase2d_final(), mgsmootherbase3d_final(), scale_multigrid_solver_2d::multigridsolver2d_init(), and scale_multigrid_solver_3d::multigridsolver3d_init().

◆ mgsmoother_post_id

integer, parameter, public scale_multigrid_smoother_base::mgsmoother_post_id = 2

ID to represent post-smoothing.

Definition at line 47 of file scale_multigrid_smoother_base.F90.

47 integer, public, parameter :: MGSmoother_POST_ID = 2 !< ID to represent post-smoothing

Referenced by scale_multigrid_solver_2d::multigridsolver2d_init(), and scale_multigrid_solver_3d::multigridsolver3d_init().

◆ mgsmoother_default_num_smooth_ite_max

integer, parameter, public scale_multigrid_smoother_base::mgsmoother_default_num_smooth_ite_max = 10

Definition at line 80 of file scale_multigrid_smoother_base.F90.

80 integer, public, parameter :: MGSmoother_DEFAULT_NUM_SMOOTH_ITE_MAX = 10

Referenced by mgsmootherbase_init().

◆ mgsmoother_default_threshold_ratio_residual_l2

real(rp), parameter, public scale_multigrid_smoother_base::mgsmoother_default_threshold_ratio_residual_l2 = 1.0E-3_RP

Definition at line 81 of file scale_multigrid_smoother_base.F90.

81 real(RP), public, parameter :: MGSmoother_DEFAULT_THRESHOLD_RATIO_RESIDUAL_L2 = 1.0e-3_rp

Referenced by mgsmootherbase_init().

◆ mgsmoother_default_threshold_residual_l2

real(rp), parameter, public scale_multigrid_smoother_base::mgsmoother_default_threshold_residual_l2 = 1.0E-3_RP

Definition at line 82 of file scale_multigrid_smoother_base.F90.

82 real(RP), public, parameter :: MGSmoother_DEFAULT_THRESHOLD_RESIDUAL_L2 = 1.0e-3_rp

Referenced by mgsmootherbase_init().

◆ mgsmoother_default_threshold_residual_max

real(rp), parameter, public scale_multigrid_smoother_base::mgsmoother_default_threshold_residual_max = 1.0E-3_RP

Definition at line 83 of file scale_multigrid_smoother_base.F90.

83 real(RP), public, parameter :: MGSmoother_DEFAULT_THRESHOLD_RESIDUAL_MAX = 1.0e-3_rp

Referenced by mgsmootherbase_init().