FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_ML_helper.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 subroutine hecmw_ml_get_nlocal(id, nlocal, nlocal_allcolumns, ierr)
8  use hecmw_mat_id
9  implicit none
10  integer(kind=kint), intent(in) :: id
11  integer(kind=kint), intent(out) :: nlocal
12  integer(kind=kint), intent(out) :: nlocal_allcolumns
13  integer(kind=kint), intent(out) :: ierr
14  type(hecmwst_matrix), pointer :: hecMAT
15  type(hecmwst_local_mesh), pointer :: hecMESH
16  call hecmw_mat_id_get(id, hecmat, hecmesh)
17  nlocal = hecmat%N * hecmat%NDOF
18  nlocal_allcolumns = hecmat%NP * hecmat%NDOF
19  ierr = 0
20 end subroutine hecmw_ml_get_nlocal
21 
22 subroutine hecmw_ml_get_coord(id, x, y, z, ierr)
24  use hecmw_mat_id
25  implicit none
26  integer(kind=kint), intent(in) :: id
27  real(kind=kreal), intent(out) :: x(*), y(*), z(*)
28  integer(kind=kint), intent(out) :: ierr
29  type(hecmwst_matrix), pointer :: hecMAT
30  type(hecmwst_local_mesh), pointer :: hecMESH
31  integer(kind=kint) :: offset, i
32  call hecmw_mat_id_get(id, hecmat, hecmesh)
33  offset = 0
34  do i = 1, hecmesh%nn_internal
35  x(i) = hecmesh%node(offset+1)
36  y(i) = hecmesh%node(offset+2)
37  z(i) = hecmesh%node(offset+3)
38  offset = offset + 3
39  enddo
40  ierr = 0
41 end subroutine hecmw_ml_get_coord
42 
43 subroutine hecmw_ml_get_rbm(id, rbm, ierr)
45  use hecmw_mat_id
46  use hecmw_etype
47  implicit none
48  integer(kind=kint), intent(in) :: id
49  real(kind=kreal), intent(out) :: rbm(*)
50  integer(kind=kint), intent(out) :: ierr
51  type(hecmwst_matrix), pointer :: hecMAT
52  type(hecmwst_local_mesh), pointer :: hecMESH
53  integer(kind=kint) :: Ndof, vec_leng, node, offset
54  real(kind=kreal) :: x, y, z
55 
56  integer(kind=kint), allocatable :: mark(:)
57  integer(kind=kint) :: itype, ic_type, nn, is, iE, icel, iiS, j, nod
58 
59  call hecmw_mat_id_get(id, hecmat, hecmesh)
60 
61  ! Mark nodes for rotational DOF
62  allocate(mark(hecmesh%n_node))
63  mark = 0
64  do itype = 1, hecmesh%n_elem_type
65  ic_type = hecmesh%elem_type_item(itype)
66  if (hecmw_is_etype_33struct(ic_type)) then
67  nn = hecmw_get_max_node(ic_type)
68  is = hecmesh%elem_type_index(itype-1)+1
69  ie = hecmesh%elem_type_index(itype )
70  do icel = is, ie
71  iis = hecmesh%elem_node_index(icel-1)
72  ! mark latter halves of the nodes
73  do j = nn/2+1, nn
74  nod = hecmesh%elem_node_item(iis+j)
75  mark(nod) = 1
76  enddo
77  enddo
78  endif
79  enddo
80  ndof = hecmat%NDOF
81  vec_leng = hecmesh%nn_internal * ndof
82 
83  if (ndof == 1) then
84 
85  rbm(1:vec_leng)=1.d0
86 
87  else if (ndof == 2) then
88 
89  rbm(1:vec_leng*3)=0.0d0
90 
91  do node = 1, hecmesh%nn_internal
92  x = hecmesh%node(3*node-2)
93  y = hecmesh%node(3*node-1)
94 
95  ! translation x
96  offset = (node-1)*ndof
97  rbm(offset+1)=1.d0
98  rbm(offset+2)=0.d0
99 
100  ! translation y
101  offset = offset + vec_leng
102  rbm(offset+1)=0.d0
103  rbm(offset+2)=1.d0
104 
105  ! rotation z
106  offset = offset + vec_leng
107  rbm(offset+1)= -y
108  rbm(offset+2)= x
109 
110  enddo
111 
112  else
113 
114  rbm(1:vec_leng*6)=0.0d0
115  do node = 1, hecmesh%nn_internal
116  if (mark(node) == 0) then
117 !!! translational DOF
118 
119  x = hecmesh%node(3*node-2)
120  y = hecmesh%node(3*node-1)
121  z = hecmesh%node(3*node )
122 
123  ! translation x
124  offset = (node-1)*ndof
125  rbm(offset+1)=1.d0
126  rbm(offset+2)=0.d0
127  rbm(offset+3)=0.d0
128 
129  ! translation y
130  offset = offset + vec_leng
131  rbm(offset+1)=0.d0
132  rbm(offset+2)=1.d0
133  rbm(offset+3)=0.d0
134 
135  ! translation z
136  offset = offset + vec_leng
137  rbm(offset+1)=0.d0
138  rbm(offset+2)=0.d0
139  rbm(offset+3)=1.d0
140 
141  ! rotation x
142  offset = offset + vec_leng
143  rbm(offset+1)=0.d0
144  rbm(offset+2)= -z
145  rbm(offset+3)= y
146 
147  ! rotation y
148  offset = offset + vec_leng
149  rbm(offset+1)= z
150  rbm(offset+2)=0.d0
151  rbm(offset+3)= -x
152 
153  ! rotation z
154  offset = offset + vec_leng
155  rbm(offset+1)= -y
156  rbm(offset+2)= x
157  rbm(offset+3)=0.d0
158 
159  else
160 !!! rotational DOF
161 
162  ! translation x
163  offset = (node-1)*ndof
164  rbm(offset+1)=0.d0
165  rbm(offset+2)=0.d0
166  rbm(offset+3)=0.d0
167 
168  ! translation y
169  offset = offset + vec_leng
170  rbm(offset+1)=0.d0
171  rbm(offset+2)=0.d0
172  rbm(offset+3)=0.d0
173 
174  ! translation z
175  offset = offset + vec_leng
176  rbm(offset+1)=0.d0
177  rbm(offset+2)=0.d0
178  rbm(offset+3)=0.d0
179 
180  ! rotation x
181  offset = offset + vec_leng
182  rbm(offset+1)=1.d0
183  rbm(offset+2)=0.d0
184  rbm(offset+3)=0.d0
185 
186  ! rotation y
187  offset = offset + vec_leng
188  rbm(offset+1)=0.d0
189  rbm(offset+2)=1.d0
190  rbm(offset+3)=0.d0
191 
192  ! rotation z
193  offset = offset + vec_leng
194  rbm(offset+1)=0.d0
195  rbm(offset+2)=0.d0
196  rbm(offset+3)=1.d0
197  endif
198  enddo
199  endif
200 
201  deallocate(mark)
202  ierr = 0
203 end subroutine hecmw_ml_get_rbm
204 
205 subroutine hecmw_ml_get_loglevel(id, level)
208  use hecmw_mat_id
209  implicit none
210  integer(kind=kint), intent(in) :: id
211  integer(kind=kint), intent(out) :: level
212  type(hecmwst_matrix), pointer :: hecMAT
213  type(hecmwst_local_mesh), pointer :: hecMESH
214  call hecmw_mat_id_get(id, hecmat, hecmesh)
215  level = hecmw_mat_get_timelog(hecmat)
216 end subroutine hecmw_ml_get_loglevel
217 
218 subroutine hecmw_ml_get_opt(id, opt, ierr)
220  use hecmw_mat_id
222  implicit none
223  integer(kind=kint), intent(in) :: id
224  integer(kind=kint), intent(out) :: opt(*)
225  integer(kind=kint), intent(out) :: ierr
226  type(hecmwst_matrix), pointer :: hecMAT
227  type(hecmwst_local_mesh), pointer :: hecMESH
228  integer(kind=kint) :: iopt(10)
229  call hecmw_mat_id_get(id, hecmat, hecmesh)
230  call hecmw_mat_get_solver_opt(hecmat, iopt)
231  opt(1:10) = iopt(1:10)
232  ierr = 0
233 end subroutine hecmw_ml_get_opt
234 
235 subroutine hecmw_ml_set_opt(id, opt, ierr)
237  use hecmw_mat_id
239  implicit none
240  integer(kind=kint), intent(in) :: id
241  integer(kind=kint), intent(in) :: opt(*)
242  integer(kind=kint), intent(out) :: ierr
243  type(hecmwst_matrix), pointer :: hecMAT
244  type(hecmwst_local_mesh), pointer :: hecMESH
245  integer(kind=kint) :: iopt(10)
246  call hecmw_mat_id_get(id, hecmat, hecmesh)
247  iopt(1:10) = opt(1:10)
248  call hecmw_mat_set_solver_opt(hecmat, iopt)
249  ierr = 0
250 end subroutine hecmw_ml_set_opt
hecmw_matrix_misc::hecmw_mat_get_solver_opt
subroutine, public hecmw_mat_get_solver_opt(hecMAT, solver_opt)
Definition: hecmw_matrix_misc.f90:657
hecmw_matrix_misc::hecmw_mat_get_timelog
integer(kind=kint) function, public hecmw_mat_get_timelog(hecMAT)
Definition: hecmw_matrix_misc.f90:488
hecmw_etype::hecmw_get_max_node
integer(kind=kint) function hecmw_get_max_node(etype)
Definition: hecmw_etype_f.f90:14
hecmw_util
I/O and Utility.
Definition: hecmw_util_f.F90:7
hecmw_util::hecmwst_local_mesh
Definition: hecmw_util_f.F90:234
hecmw_ml_get_coord
subroutine hecmw_ml_get_coord(id, x, y, z, ierr)
Definition: hecmw_ML_helper.f90:23
hecmw_etype::hecmw_is_etype_33struct
logical function hecmw_is_etype_33struct(etype)
Definition: hecmw_etype_f.f90:115
hecmw_ml_set_opt
subroutine hecmw_ml_set_opt(id, opt, ierr)
Definition: hecmw_ML_helper.f90:236
hecmw_util::kreal
integer(kind=4), parameter kreal
Definition: hecmw_util_f.F90:16
hecmw_mat_id
Definition: hecmw_mat_id.f90:6
hecmw_ml_get_rbm
subroutine hecmw_ml_get_rbm(id, rbm, ierr)
Definition: hecmw_ML_helper.f90:44
hecmw_matrix_misc
Definition: hecmw_matrix_misc.f90:6
hecmw_matrix_misc::hecmw_mat_set_solver_opt
subroutine, public hecmw_mat_set_solver_opt(hecMAT, solver_opt)
Definition: hecmw_matrix_misc.f90:649
hecmw_ml_get_loglevel
subroutine hecmw_ml_get_loglevel(id, level)
Definition: hecmw_ML_helper.f90:206
hecmw_etype
I/O and Utility.
Definition: hecmw_etype_f.f90:7
hecmw_ml_get_opt
subroutine hecmw_ml_get_opt(id, opt, ierr)
Definition: hecmw_ML_helper.f90:219
hecmw_ml_get_nlocal
subroutine hecmw_ml_get_nlocal(id, nlocal, nlocal_allcolumns, ierr)
Definition: hecmw_ML_helper.f90:7
hecmw_mat_id::hecmw_mat_id_get
subroutine, public hecmw_mat_id_get(id, hecMAT, hecMESH)
Definition: hecmw_mat_id.f90:49
hecmw_util::hecmwst_matrix
Definition: hecmw_util_f.F90:444