FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
solve_LINEQ_mkl.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 !-------------------------------------------------------------------------------
7 
9  use hecmw_util
10  use m_sparse_matrix
17  use hecmw_ebc_defer
18 
19  implicit none
20 
21  private
23  public :: solve_lineq_mkl_contact
24 
25  logical, save :: NEED_ANALYSIS = .true.
26  type (sparse_matrix), save :: spMAT
27 
28 contains
29 
30  subroutine solve_lineq_mkl_contact_init(hecMESH,is_sym)
31  type (hecmwst_local_mesh), intent(in) :: hecmesh
32  logical, intent(in) :: is_sym
33 
34  integer(kind=kint) :: spmat_type
35  integer(kind=kint) :: spmat_symtype
36 
37  call sparse_matrix_finalize(spmat)
38 
39  if (is_sym) then
40  spmat_symtype = sparse_matrix_symtype_sym
41  else
42  spmat_symtype = sparse_matrix_symtype_asym
43  end if
44  if(hecmesh%PETOT.GT.1) then
45  spmat_type = sparse_matrix_type_coo
46  else
47  spmat_type = sparse_matrix_type_csr
48  endif
49  call sparse_matrix_set_type(spmat, spmat_type, spmat_symtype)
50 
51  need_analysis = .true.
52  end subroutine solve_lineq_mkl_contact_init
53 
55  subroutine solve_lineq_mkl_contact(hecMESH,hecMAT,hecLagMAT,hecEBC,istat,conMAT)
56  type (hecmwst_local_mesh), intent(in) :: hecmesh
57  type (hecmwst_matrix ), intent(inout) :: hecmat
58  type (hecmwst_matrix_lagrange), intent(inout) :: heclagmat
59  type (hecmwst_ebc), intent(inout) :: hecebc
60  integer(kind=kint), intent(out) :: istat
61  type (hecmwst_matrix), intent(inout),optional :: conmat
62 
63  integer(kind=kint) :: phase_start
64  real(kind=kreal) :: t1,t2
65  integer(kind=kint) :: mpc_method
66 
67  t1=hecmw_wtime()
68 
69  mpc_method = hecmw_mat_get_mpc_method(hecmat)
70  if (mpc_method /= 1 .and. mpc_method /= 3) then
71  mpc_method = 1
72  call hecmw_mat_set_mpc_method(hecmat,mpc_method)
73  endif
74  if (mpc_method /= 1) then
75  write(*,*) 'ERROR: MPCMETHOD other than penalty is not available for DIRECTmkl solver', &
76  ' in contact analysis without elimination'
77  stop
78  endif
79  call hecmw_mat_ass_equation(hecmesh, hecmat)
80  call hecmw_mat_ass_equation_rhs(hecmesh, hecmat)
81  if(present(conmat)) then
82  call hecmw_ebc_apply(hecmesh, hecmat, hecebc, conmat)
83  else
84  call hecmw_ebc_apply(hecmesh, hecmat, hecebc)
85  endif
86 
87  call hecmw_mat_dump(hecmat, hecmesh)
88 
89  if (need_analysis) then
90  !constrtuct new structure
91  call sparse_matrix_contact_init_prof(spmat, hecmat, heclagmat, hecmesh)
92  endif
93 
94  ! ---- For Parallel Contact with Multi-Partition Domains
95  if(present(conmat)) then
96  call sparse_matrix_para_contact_set_vals(spmat, hecmat, heclagmat, conmat)
97  call sparse_matrix_para_contact_set_rhs(spmat, hecmat, heclagmat, conmat)
98  else
99  call sparse_matrix_contact_set_vals(spmat, hecmat, heclagmat)
100  call sparse_matrix_contact_set_rhs(spmat, hecmat, heclagmat)
101  endif
102 
103  t2=hecmw_wtime()
104  if ( hecmw_comm_get_rank() == 0 .and. spmat%loglevel > 0) then
105  if( hecmesh%PETOT .GT. 1 ) then
106  write(*,'(A)') ' [Cluster Pardiso]: Setup completed.'
107  else
108  write(*,'(A)') ' [Pardiso]: Setup completed.'
109  end if
110  endif
111  if ( hecmw_comm_get_rank() == 0 .and. spmat%timelog > 0) then
112  if( hecmesh%PETOT .GT. 1 ) then
113  write(*,'(A,f10.3)') ' [Cluster Pardiso]: Setup time(sec)=',t2-t1
114  else
115  write(*,'(A,f10.3)') ' [Pardiso]: Setup time(sec)=',t2-t1
116  end if
117  endif
118 
119  phase_start = 2
120  if (need_analysis) then
121  phase_start = 1
122  need_analysis = .false.
123  endif
124 
125  ! SOLVE
126  if( hecmesh%PETOT.GT.1 ) then
127  call hecmw_clustermkl_wrapper(spmat, phase_start, hecmat%X, istat)
128  call sparse_matrix_contact_get_rhs(spmat, hecmat, heclagmat)
129  else
130  call hecmw_mkl_wrapper(spmat, phase_start, hecmat%X, istat)
131  deallocate(spmat%rhs)
132  endif
133 
134  call hecmw_mat_dump_solution(hecmat)
135  end subroutine solve_lineq_mkl_contact
136 
137 end module m_solve_lineq_mkl_contact
Essential boundary conditions kept as per-DOF marks and values so that they can be imposed on the mat...
subroutine, public hecmw_ebc_apply(hecMESH, hecMAT, hecEBC, conMAT)
subroutine, public hecmw_mat_ass_equation_rhs(hecMESH, hecMAT)
subroutine, public hecmw_mat_ass_equation(hecMESH, hecMAT)
subroutine, public hecmw_mat_dump(hecMAT, hecMESH)
subroutine, public hecmw_mat_dump_solution(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_mpc_method(hecMAT)
subroutine, public hecmw_mat_set_mpc_method(hecMAT, mpc_method)
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
integer(kind=kint) function hecmw_comm_get_rank()
real(kind=kreal) function hecmw_wtime()
This module provides linear equation solver interface for Cluster Pardiso.
subroutine, public hecmw_clustermkl_wrapper(spMAT, phase_start, solution, istat)
This module provides linear equation solver interface for Pardiso.
subroutine, public hecmw_mkl_wrapper(spMAT, phase_start, solx, istat)
This module provides functions to solve sparse system of \linear equitions using intel MKL direct spa...
subroutine, public solve_lineq_mkl_contact_init(hecMESH, is_sym)
subroutine, public solve_lineq_mkl_contact(hecMESH, hecMAT, hecLagMAT, hecEBC, istat, conMAT)
This subroutine executes the MKL solver.
This module provides conversion routines between HEC and FISTR data structures and DOF based sparse m...
subroutine, public sparse_matrix_para_contact_set_vals(spMAT, hecMAT, hecLagMAT, conMAT)
subroutine, public sparse_matrix_contact_get_rhs(spMAT, hecMAT, hecLagMAT)
subroutine, public sparse_matrix_contact_init_prof(spMAT, hecMAT, hecLagMAT, hecMESH)
subroutine, public sparse_matrix_contact_set_rhs(spMAT, hecMAT, hecLagMAT)
subroutine, public sparse_matrix_contact_set_vals(spMAT, hecMAT, hecLagMAT)
subroutine, public sparse_matrix_para_contact_set_rhs(spMAT, hecMAT, hecLagMAT, conMAT)
This module provides DOF based sparse matrix data structure (CSR and COO)
integer(kind=kint), parameter, public sparse_matrix_type_coo
integer(kind=kint), parameter, public sparse_matrix_type_csr
integer(kind=kint), parameter, public sparse_matrix_symtype_sym
subroutine, public sparse_matrix_finalize(spMAT)
integer(kind=kint), parameter, public sparse_matrix_symtype_asym
subroutine, public sparse_matrix_set_type(spMAT, type, symtype)
Structure for Lagrange multiplier-related part of stiffness matrix (Lagrange multiplier-related matri...