FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
hecmw_precond_ML_33.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
5 
6 !C
7 !C***
8 !C*** module hecmw_precond_ML_33
9 !C***
10 !C
12  use hecmw_util
13 
14  private
15 
19 
20  integer(kind=kint), save :: id
21 
22  logical, save :: INITIALIZED = .false.
23 
24 contains
25 
26  subroutine hecmw_precond_ml_33_setup(hecMAT, hecMESH, sym)
28  use hecmw_mat_id
29  implicit none
30  type(hecmwst_matrix), intent(inout) :: hecmat
31  type(hecmwst_local_mesh), intent(in) :: hecmesh
32  integer(kind=kint), intent(in) :: sym
33  integer(kind=kint) :: ierr
34  integer(kind=kint), save :: n_recycle = 0
35  if (initialized) then
36  if (hecmat%Iarray(98) == 1) then ! need symbolic and numerical setup
38  else if (hecmat%Iarray(97) == 1) then ! need numerical setup only
40  else ! no need to setup or skip setup
41  call hecmw_mat_id_clear(id)
42  call hecmw_mat_id_set(hecmat, hecmesh, id)
43  return
44  endif
45  endif
46  call hecmw_mat_id_set(hecmat, hecmesh, id)
47  call hecmw_ml_wrapper_setup(id, sym, hecmat%NDOF, ierr)
48  if (ierr /= 0) then ! HECMW_SUCCESS == 0
49  write(*,'(a)') '#### hecmw_precond_ML_33_setup: ML preconditioner setup failed'
51  end if
52  initialized = .true.
53  hecmat%Iarray(98) = 0 ! symbolic setup done
54  hecmat%Iarray(97) = 0 ! numerical setup done
55  n_recycle = 0
56  end subroutine hecmw_precond_ml_33_setup
57 
59  implicit none
60  real(kind=kreal), intent(inout) :: ww(:)
61  integer(kind=kint) :: ierr
62  call hecmw_ml_wrapper_apply(id, ww, ierr)
63  end subroutine hecmw_precond_ml_33_apply
64 
66  use hecmw_mat_id
67  implicit none
68  integer(kind=kint) :: ierr
69  call hecmw_ml_wrapper_clear(id, ierr)
70  call hecmw_mat_id_clear(id)
71  initialized = .false.
72  end subroutine hecmw_precond_ml_33_clear
73 
74 end module hecmw_precond_ml_33
subroutine, public hecmw_mat_id_set(hecMAT, hecMESH, id)
subroutine, public hecmw_mat_id_clear(id)
subroutine, public hecmw_precond_ml_33_apply(WW)
subroutine, public hecmw_precond_ml_33_clear()
subroutine, public hecmw_precond_ml_33_setup(hecMAT, hecMESH, sym)
I/O and Utility.
Definition: hecmw_util_f.F90:7
subroutine hecmw_abort(comm, code)
integer(kind=kint) function hecmw_comm_get_comm()
integer(kind=4), parameter kreal