FrontISTR  5.7.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 
18  implicit none
19 
20  private
22  public :: solve_lineq_mkl_contact
23 
24  logical, save :: NEED_ANALYSIS = .true.
25  type (sparse_matrix), save :: spMAT
26 
27 contains
28 
29  subroutine solve_lineq_mkl_contact_init(hecMESH,is_sym)
30  type (hecmwst_local_mesh), intent(in) :: hecmesh
31  logical, intent(in) :: is_sym
32 
33  integer(kind=kint) :: spmat_type
34  integer(kind=kint) :: spmat_symtype
35  integer(kind=kint) :: i
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,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  integer(kind=kint), intent(out) :: istat
60  type (hecmwst_matrix), intent(in),optional :: conmat
61 
62  integer(kind=kint) :: phase_start
63  real(kind=kreal) :: t1,t2
64  integer(kind=kint) :: mpc_method
65 
66  t1=hecmw_wtime()
67 
68  mpc_method = hecmw_mat_get_mpc_method(hecmat)
69  if (mpc_method < 1 .or. 3 < mpc_method) then
70  mpc_method = 1
71  call hecmw_mat_set_mpc_method(hecmat,mpc_method)
72  endif
73  if (mpc_method /= 1) then
74  write(*,*) 'ERROR: MPCMETHOD other than penalty is not available for DIRECTmkl solver', &
75  ' in contact analysis without elimination'
76  stop
77  endif
78  call hecmw_mat_ass_equation(hecmesh, hecmat)
79  call hecmw_mat_ass_equation_rhs(hecmesh, hecmat)
80 
81  call hecmw_mat_dump(hecmat, hecmesh)
82 
83  if (need_analysis) then
84  !constrtuct new structure
85  call sparse_matrix_contact_init_prof(spmat, hecmat, heclagmat, hecmesh)
86  endif
87 
88  ! ---- For Parallel Contact with Multi-Partition Domains
89  if(present(conmat)) then
90  call sparse_matrix_para_contact_set_vals(spmat, hecmat, heclagmat, conmat)
91  call sparse_matrix_para_contact_set_rhs(spmat, hecmat, heclagmat, conmat)
92  else
93  call sparse_matrix_contact_set_vals(spmat, hecmat, heclagmat)
94  !call sparse_matrix_dump(spMAT)
95  call sparse_matrix_contact_set_rhs(spmat, hecmat, heclagmat)
96  endif
97 
98  t2=hecmw_wtime()
99  if ( hecmw_comm_get_rank() == 0 .and. spmat%timelog > 0) then
100  if( hecmesh%PETOT .GT. 1 ) then
101  write(*,'(A,f10.3)') ' [Cluster Pardiso]: Setup completed. time(sec)=',t2-t1
102  else
103  write(*,'(A,f10.3)') ' [Pardiso]: Setup completed. time(sec)=',t2-t1
104  end if
105  endif
106 
107  phase_start = 2
108  if (need_analysis) then
109  phase_start = 1
110  need_analysis = .false.
111  endif
112 
113  ! SOLVE
114  if( hecmesh%PETOT.GT.1 ) then
115  call hecmw_clustermkl_wrapper(spmat, phase_start, hecmat%X, istat)
116  call sparse_matrix_contact_get_rhs(spmat, hecmat, heclagmat)
117  else
118  call hecmw_mkl_wrapper(spmat, phase_start, hecmat%X, istat)
119  deallocate(spmat%rhs)
120  endif
121 
122  call hecmw_mat_dump_solution(hecmat)
123  end subroutine solve_lineq_mkl_contact
124 
125 end module m_solve_lineq_mkl_contact
hecmw_matrix_dump::hecmw_mat_dump_solution
subroutine, public hecmw_mat_dump_solution(hecMAT)
Definition: hecmw_matrix_dump.f90:340
m_hecmw_clustermkl_wrapper::hecmw_clustermkl_wrapper
subroutine, public hecmw_clustermkl_wrapper(spMAT, phase_start, solution, istat)
Definition: hecmw_ClusterMKL_wrapper.F90:48
m_sparse_matrix::sparse_matrix_set_type
subroutine, public sparse_matrix_set_type(spMAT, type, symtype)
Definition: sparse_matrix.f90:59
hecmw_util::hecmw_wtime
real(kind=kreal) function hecmw_wtime()
Definition: hecmw_util_f.F90:549
m_solve_lineq_mkl_contact
This module provides functions to solve sparse system of \linear equitions using intel MKL direct spa...
Definition: solve_LINEQ_mkl.F90:8
hecmw_matrix_misc::hecmw_mat_set_mpc_method
subroutine, public hecmw_mat_set_mpc_method(hecMAT, mpc_method)
Definition: hecmw_matrix_misc.f90:429
m_sparse_matrix_contact::sparse_matrix_contact_set_rhs
subroutine, public sparse_matrix_contact_set_rhs(spMAT, hecMAT, hecLagMAT)
Definition: sparse_matrix_contact.f90:718
m_sparse_matrix::sparse_matrix_finalize
subroutine, public sparse_matrix_finalize(spMAT)
Definition: sparse_matrix.f90:94
m_sparse_matrix_contact::sparse_matrix_contact_set_vals
subroutine, public sparse_matrix_contact_set_vals(spMAT, hecMAT, hecLagMAT)
Definition: sparse_matrix_contact.f90:372
m_sparse_matrix_contact::sparse_matrix_contact_get_rhs
subroutine, public sparse_matrix_contact_get_rhs(spMAT, hecMAT, hecLagMAT)
Definition: sparse_matrix_contact.f90:797
m_solve_lineq_mkl_contact::solve_lineq_mkl_contact_init
subroutine, public solve_lineq_mkl_contact_init(hecMESH, is_sym)
Definition: solve_LINEQ_mkl.F90:30
m_hecmw_mkl_wrapper::hecmw_mkl_wrapper
subroutine, public hecmw_mkl_wrapper(spMAT, phase_start, solx, istat)
Definition: hecmw_MKL_wrapper.F90:36
m_sparse_matrix::sparse_matrix_type_csr
integer(kind=kint), parameter, public sparse_matrix_type_csr
Definition: sparse_matrix.f90:29
hecmw_util
I/O and Utility.
Definition: hecmw_util_f.F90:7
hecmw_util::hecmwst_local_mesh
Definition: hecmw_util_f.F90:234
m_sparse_matrix_contact::sparse_matrix_contact_init_prof
subroutine, public sparse_matrix_contact_init_prof(spMAT, hecMAT, hecLagMAT, hecMESH)
Definition: sparse_matrix_contact.f90:28
m_sparse_matrix_contact
This module provides conversion routines between HEC and FISTR data structures and DOF based sparse m...
Definition: sparse_matrix_contact.f90:7
m_sparse_matrix::sparse_matrix_symtype_sym
integer(kind=kint), parameter, public sparse_matrix_symtype_sym
Definition: sparse_matrix.f90:34
m_sparse_matrix_contact::sparse_matrix_para_contact_set_rhs
subroutine, public sparse_matrix_para_contact_set_rhs(spMAT, hecMAT, hecLagMAT, conMAT)
Definition: sparse_matrix_contact.f90:742
hecmw_util::kreal
integer(kind=4), parameter kreal
Definition: hecmw_util_f.F90:16
m_sparse_matrix_contact::sparse_matrix_para_contact_set_vals
subroutine, public sparse_matrix_para_contact_set_vals(spMAT, hecMAT, hecLagMAT, conMAT)
Definition: sparse_matrix_contact.f90:495
hecmw_matrix_ass
Definition: hecmw_mat_ass.f90:6
m_sparse_matrix::sparse_matrix_symtype_asym
integer(kind=kint), parameter, public sparse_matrix_symtype_asym
Definition: sparse_matrix.f90:32
m_solve_lineq_mkl_contact::solve_lineq_mkl_contact
subroutine, public solve_lineq_mkl_contact(hecMESH, hecMAT, hecLagMAT, istat, conMAT)
This subroutine executes the MKL solver.
Definition: solve_LINEQ_mkl.F90:56
hecmw_matrix_misc
Definition: hecmw_matrix_misc.f90:6
m_sparse_matrix::sparse_matrix_type_coo
integer(kind=kint), parameter, public sparse_matrix_type_coo
Definition: sparse_matrix.f90:30
hecmw_matrix_dump
Definition: hecmw_matrix_dump.f90:6
m_hecmw_mkl_wrapper
This module provides linear equation solver interface for Pardiso.
Definition: hecmw_MKL_wrapper.F90:10
m_sparse_matrix
This module provides DOF based sparse matrix data structure (CSR and COO)
Definition: sparse_matrix.f90:6
hecmw_matrix_misc::hecmw_mat_get_mpc_method
integer(kind=kint) function, public hecmw_mat_get_mpc_method(hecMAT)
Definition: hecmw_matrix_misc.f90:436
hecmw_matrix_dump::hecmw_mat_dump
subroutine, public hecmw_mat_dump(hecMAT, hecMESH)
Definition: hecmw_matrix_dump.f90:32
hecmw_matrix_ass::hecmw_mat_ass_equation
subroutine, public hecmw_mat_ass_equation(hecMESH, hecMAT)
Definition: hecmw_mat_ass.f90:176
hecmw_util::hecmwst_matrix_lagrange
Structure for Lagrange multiplier-related part of stiffness matrix (Lagrange multiplier-related matri...
Definition: hecmw_util_f.F90:427
m_hecmw_clustermkl_wrapper
This module provides linear equation solver interface for Cluster Pardiso.
Definition: hecmw_ClusterMKL_wrapper.F90:16
hecmw_util::hecmw_comm_get_rank
integer(kind=kint) function hecmw_comm_get_rank()
Definition: hecmw_util_f.F90:582
hecmw_matrix_ass::hecmw_mat_ass_equation_rhs
subroutine, public hecmw_mat_ass_equation_rhs(hecMESH, hecMAT)
Definition: hecmw_mat_ass.f90:234
hecmw_util::hecmwst_matrix
Definition: hecmw_util_f.F90:444