FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
hecmw_solver.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 
7 contains
8 
9  subroutine hecmw_solve (hecMESH, hecMAT)
10 
11  use hecmw_util
21  use m_hecmw_comm_f
22  implicit none
23 
24  type (hecmwST_matrix), target :: hecMAT
25  type (hecmwST_local_mesh) :: hecMESH
26 
27  real(kind=kreal) :: resid
28  integer(kind=kint) :: myrank, NDOF
29  integer(kind=kint) :: imsg = 51
30  ndof=hecmat%NDOF
31 
32  !C ERROR CHECK
33  if(hecmw_solve_check_zerorhs(hecmesh, hecmat))then
34  hecmat%X = 0.0d0
35  call hecmw_mat_set_flag_converged(hecmat, 1)
36  call hecmw_mat_set_flag_diverged(hecmat, 0)
37  return
38  endif
39 
40  select case(hecmat%Iarray(99))
41  !* Call Iterative Solver
42  case (1)
43  call hecmw_solve_iterative(hecmesh,hecmat)
44  !* Call Direct Solver
45  case(2:)
46  !C
47  !* Please note the following:
48  !* Flag to activate symbolic factorization: 1(yes) 0(no) hecMESH%Iarray(98)
49  !* Flag to activate numeric factorization: 1(yes) 0(no) hecMESH%Iarray(97)
50 
51  if (hecmat%Iarray(97) .gt. 1) hecmat%Iarray(97)=1
52 
53  call hecmw_mat_set_flag_converged(hecmat, 0)
54  call hecmw_mat_set_flag_diverged(hecmat, 0)
55 
56  if (hecmat%Iarray(2) .eq. 102) then
57  if(hecmesh%PETOT.GT.1) then
58  call hecmw_solve_direct_clustermkl(hecmesh, hecmat)
59  else
60  call hecmw_solve_direct_mkl(hecmesh,hecmat)
61  endif
62  elseif (hecmat%Iarray(2) .eq. 104) then
63  call hecmw_solve_direct_mumps(hecmesh, hecmat)
64  elseif (hecmat%Iarray(2) .eq. 106) then
65  call hecmw_solve_direct_mf(hecmesh,hecmat,imsg)
66  else
67  if(hecmesh%PETOT.GT.1) then
68  call hecmw_solve_direct_parallel(hecmesh,hecmat,imsg)
69  else
70  call hecmw_solve_direct(hecmesh,hecmat,imsg)
71  endif
72  endif
73 
74  resid=hecmw_rel_resid_l2(hecmesh,hecmat)
75  myrank=hecmw_comm_get_rank()
76  if (myrank==0) then
77  if (hecmat%Iarray(21) > 0) then
78  write(*,"(a,1pe12.5)")'### Relative residual =', resid
79  endif
80  if( resid >= 1.0d-8) then
81  write(*,"(a)")'### Relative residual exceeded 1.0d-8---Direct Solver### '
82  ! stop
83  endif
84  endif
85  if (resid < hecmw_mat_get_resid(hecmat)) then
86  call hecmw_mat_set_flag_converged(hecmat, 1)
87  endif
88  !C
89  end select
90 
91  end subroutine hecmw_solve
92 
93  subroutine hecmw_substitute_solver(hecMESH, hecMATorig, NDOF)
94 
95  use hecmw_util
101  type (hecmwST_local_mesh) :: hecMESH
102  type (hecmwST_matrix) :: hecMATorig
103  type (hecmwST_matrix),pointer :: hecMAT => null()
104  integer(kind=kint) NDOF
105  if (ndof == hecmatorig%NDOF) then
106  call hecmw_clone_matrix(hecmatorig,hecmat)
107  else if (ndof < hecmatorig%NDOF) then
109  end if
110  ! select case(NDOF)
111  ! case(1)
112  ! call hecmw_solve_11(hecMESH,hecMAT)
113  ! case(2)
114  ! call hecmw_solve_22(hecMESH,hecMAT)
115  ! case(3)
116  ! call hecmw_solve_33(hecMESH,hecMAT)
117  ! case(4)
118  ! call hecmw_solve_iterative(hecMESH,hecMAT)
119  ! case(5)
120  ! call hecmw_solve_iterative(hecMESH,hecMAT)
121  ! case(6)
122  ! call hecmw_solve_66(hecMESH,hecMAT)
123  ! case(7:)
124  ! call hecmw_solve_iterative(hecMESH,hecMAT)
125  ! end select
126  !call hecmw_solve_direct_MUMPS(hecMESH, hecMAT)
127  call hecmw_solve_iterative(hecmesh,hecmat)
128  if (ndof /= hecmatorig%NDOF) then
129  call hecmw_vector_contract(hecmatorig,hecmat,ndof)
130  end if
131  end subroutine hecmw_substitute_solver
132 
133 end module hecmw_solver
subroutine, public hecmw_mat_set_flag_diverged(hecMAT, flag_diverged)
real(kind=kreal) function, public hecmw_mat_get_resid(hecMAT)
subroutine, public hecmw_mat_set_flag_converged(hecMAT, flag_converged)
This module provides linear equation solver interface for Cluster Pardiso.
subroutine, public hecmw_solve_direct_clustermkl(hecMESH, hecMAT)
Multifrontal direct solver (METHOD=DIRECTmf): LDLt with threshold pivoting for symmetric (possibly in...
subroutine, public hecmw_solve_direct_mf(hecMESH, hecMAT, imsg)
This module provides linear equation solver interface for Pardiso.
subroutine, public hecmw_solve_direct_mkl(hecMESH, hecMAT)
This module provides linear equation solver interface for MUMPS.
subroutine, public hecmw_solve_direct_mumps(hecMESH, hecMAT)
subroutine, public hecmw_solve_direct_parallel(hecMESH, hecMAT, ii)
HECMW_SOLVE_DIRECT is a program for the matrix direct solver.
subroutine, public hecmw_solve_direct(hecMESH, hecMAT, Ifmsg)
HECMW_SOLVE_DIRECT is a program for the matrix solver.
logical function hecmw_solve_check_zerorhs(hecMESH, hecMAT)
subroutine hecmw_solve_iterative(hecMESH, hecMAT)
real(kind=kreal) function, public hecmw_rel_resid_l2(hecMESH, hecMAT, COMMtime)
subroutine hecmw_substitute_solver(hecMESH, hecMATorig, NDOF)
subroutine hecmw_solve(hecMESH, hecMAT)
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
integer(kind=kint) function hecmw_comm_get_rank()
subroutine hecmw_clone_matrix(hecMATorig, hecMAT)
subroutine hecmw_vector_contract(hecMATorig, hecMAT, NDOF)