FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
fstr_NodalStress.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  use m_fstr
8 
9  implicit none
10  private :: nodalstress_inv3, nodalstress_inv2, inverse_func
11 contains
12 
14  !----------------------------------------------------------------------*
15  subroutine fstr_nodalstress3d( hecMESH, fstrSOLID )
16  !----------------------------------------------------------------------*
17  use m_static_lib
18  type(hecmwst_local_mesh) :: hecMESH
19  type(fstr_solid) :: fstrSOLID
20  real(kind=kreal), pointer :: tnstrain(:), testrain(:), yield_ratio(:)
21  integer(kind=kint), pointer :: is_rot(:)
22  !C** local variables
23  integer(kind=kint) :: itype, icel, ic, is, iE, jS, i, j, k, m, ic_type, nn, ni, ID_area
24  integer(kind=kint) :: nodlocal(20), ntemp
25  integer(kind=kint), allocatable :: nnumber(:)
26  real(kind=kreal) :: estrain(6), estress(6), naturalcoord(3)
27  real(kind=kreal) :: enqm(12)
28  real(kind=kreal) :: ndstrain(20,6), ndstress(20,6), tdstrain(20,6)
29  real(kind=kreal) :: ecoord(3, 20), edisp(60), tt(20), t0(20)
30  real(kind=kreal), allocatable :: func(:,:), inv_func(:,:)
31 
32  !C** Shell33 variables
33  integer(kind=kint) :: isect, ihead, ntot_lyr, nlyr, flag33, cid, truss
34  real(kind=kreal) :: thick, thick_lyr, dtot_lyr
35  call fstr_solid_phys_clear(fstrsolid)
36 
37  allocate( nnumber(hecmesh%n_node) )
38  if( .not. associated(fstrsolid%is_rot) ) allocate( fstrsolid%is_rot(hecmesh%n_node) )
39  !allocate( fstrSOLID%yield_ratio(hecMESH%n_elem) )
40  nnumber = 0
41  fstrsolid%is_rot = 0
42  !fstrSOLID%yield_ratio = 0.0d0
43 
44  tnstrain => fstrsolid%tnstrain
45  testrain => fstrsolid%testrain
46  is_rot => fstrsolid%is_rot
47  yield_ratio => fstrsolid%yield_ratio
48 
49  if( associated(tnstrain) ) tnstrain = 0.0d0
50 
51  !C** setting
52  ntot_lyr = fstrsolid%max_lyr
53  flag33 = fstrsolid%is_33shell
54  truss = fstrsolid%is_33beam
55 
56  !C +-------------------------------+
57  !C | according to ELEMENT TYPE |
58  !C +-------------------------------+
59  do itype = 1, hecmesh%n_elem_type
60  is = hecmesh%elem_type_index(itype-1) + 1
61  ie = hecmesh%elem_type_index(itype )
62  ic_type = hecmesh%elem_type_item(itype)
63  if( ic_type == fe_tet10nc ) ic_type = fe_tet10n
64  if( .not. (hecmw_is_etype_solid(ic_type) .or. ic_type == 781 &
65  & .or. ic_type == 761 .or. ic_type == fe_beam341 ) ) cycle
66  !C** set number of nodes and shape function
67  nn = hecmw_get_max_node( ic_type )
68  ni = numofquadpoints( ic_type )
69  allocate( func(ni,nn), inv_func(nn,ni) )
70  if( ic_type == fe_tet10n ) then
71  ic = hecmw_get_max_node( fe_tet4n )
72  do i = 1, ni
73  call getquadpoint( ic_type, i, naturalcoord )
74  call getshapefunc( fe_tet4n, naturalcoord, func(i,1:ic) )
75  enddo
76  call inverse_func( ic, func, inv_func )
77  else if( ic_type == fe_hex8n ) then
78  do i = 1, ni
79  call getquadpoint( ic_type, i, naturalcoord )
80  call getshapefunc( ic_type, naturalcoord, func(i,1:nn) )
81  enddo
82  call inverse_func( ni, func, inv_func )
83  else if( ic_type == fe_prism15n ) then
84  ic = 0
85  do i = 1, ni
86  if( i==1 .or. i==2 .or. i==3 .or. i==7 .or. i==8 .or. i==9 ) then
87  ic = ic + 1
88  call getquadpoint( ic_type, i, naturalcoord )
89  call getshapefunc( fe_prism6n, naturalcoord, func(ic,1:6) )
90  endif
91  enddo
92  call inverse_func( ic, func, inv_func )
93  ni = ic
94  else if( ic_type == fe_hex20n ) then
95  ic = 0
96  do i = 1, ni
97  if( i==1 .or. i==3 .or. i==7 .or. i==9 .or. &
98  i==19 .or. i==21 .or. i==25 .or. i==27 ) then
99  ic = ic + 1
100  call getquadpoint( ic_type, i, naturalcoord )
101  call getshapefunc( fe_hex8n, naturalcoord, func(ic,1:8) )
102  endif
103  enddo
104  call inverse_func( ic, func, inv_func )
105  ni = ic
106  endif
107  !C** element loop
108  do icel = is, ie
109  js = hecmesh%elem_node_index(icel-1)
110  id_area = hecmesh%elem_ID(icel*2)
111  isect= hecmesh%section_ID(icel)
112  ihead = hecmesh%section%sect_R_index(isect-1)
113  thick = hecmesh%section%sect_R_item(ihead+1)
114  !initialize
115  enqm = 0.0d0
116  estrain = 0.0d0
117  estress = 0.0d0
118  ndstrain = 0.0d0
119  ndstress = 0.0d0
120  !if( ID_area == hecMESH%my_rank ) then
121 
122  !--- calculate nodal and elemental value
123  if( ic_type == 641 ) then
124  do j = 1, 4
125  nodlocal(j) = hecmesh%elem_node_item(js+j)
126  ecoord(1:3,j) = hecmesh%node(3*nodlocal(j)-2:3*nodlocal(j))
127  edisp(3*j-2:3*j) = fstrsolid%unode(3*nodlocal(j)-2:3*nodlocal(j))
128  end do
129  ntemp = 0
130  if( associated( fstrsolid%temperature ) ) then
131  ntemp = 1
132  do j = 1, 4
133  nodlocal(j) = hecmesh%elem_node_item(js+j)
134  t0(j) = fstrsolid%last_temp( nodlocal(j) )
135  tt(j) = fstrsolid%temperature( nodlocal(j) )
136  end do
137  end if
138  call nodalstress_beam_641( ic_type, nn, ecoord, fstrsolid%elements(icel)%gausses, &
139  & hecmesh%section%sect_R_item(ihead+1:), edisp, &
140  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6), tt(1:nn), t0(1:nn), ntemp )
141  call elementalstress_beam_641( fstrsolid%elements(icel)%gausses, estrain, estress, enqm )
142  fstrsolid%ENQM(icel*12-11:icel*12) = enqm(1:12)
143 
144 
145  elseif( ic_type == 781) then
146  do j = 1, 4
147  nodlocal(j ) = hecmesh%elem_node_item(js+j )
148  nodlocal(j+4) = hecmesh%elem_node_item(js+j+4)
149  is_rot(nodlocal(j+4)) = 1
150  ecoord(1:3,j ) = hecmesh%node(3*nodlocal(j )-2:3*nodlocal(j ))
151  ecoord(1:3,j+4) = hecmesh%node(3*nodlocal(j+4)-2:3*nodlocal(j+4))
152  edisp(6*j-5:6*j-3) = fstrsolid%unode(3*nodlocal(j )-2:3*nodlocal(j ))
153  edisp(6*j-2:6*j ) = fstrsolid%unode(3*nodlocal(j+4)-2:3*nodlocal(j+4))
154  enddo
155  ntot_lyr = fstrsolid%elements(icel)%gausses(1)%pMaterial%totallyr
156  do nlyr=1,ntot_lyr
157  call elementstress_shell_mitc( 741, 4, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
158  & ndstrain(1:4,1:6), ndstress(1:4,1:6), thick, 1.0d0, nlyr)
159  call fstr_stress_add_shelllyr(4,fstrsolid,icel,nodlocal,nlyr,ndstrain(1:4,1:6),ndstress(1:4,1:6),1)
160  !minus section
161  call elementstress_shell_mitc( 741, 4, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
162  & ndstrain(1:4,1:6), ndstress(1:4,1:6), thick,-1.0d0, nlyr)
163  call fstr_stress_add_shelllyr(4,fstrsolid,icel,nodlocal,nlyr,ndstrain(1:4,1:6),ndstress(1:4,1:6),-1)
164  enddo
165  call fstr_getavg_shell(4,fstrsolid,icel,nodlocal,ndstrain(1:4,1:6),ndstress(1:4,1:6),estrain,estress)
166 
167  elseif( ic_type == 761) then
168  do j = 1, 3
169  nodlocal(j ) = hecmesh%elem_node_item(js+j )
170  nodlocal(j+3) = hecmesh%elem_node_item(js+j+3)
171  is_rot(nodlocal(j+3)) = 1
172  ecoord(1:3,j ) = hecmesh%node(3*nodlocal(j )-2:3*nodlocal(j ))
173  ecoord(1:3,j+3) = hecmesh%node(3*nodlocal(j+3)-2:3*nodlocal(j+3))
174  edisp(6*j-5:6*j-3) = fstrsolid%unode(3*nodlocal(j )-2:3*nodlocal(j ))
175  edisp(6*j-2:6*j ) = fstrsolid%unode(3*nodlocal(j+3)-2:3*nodlocal(j+3))
176  enddo
177  ntot_lyr = fstrsolid%elements(icel)%gausses(1)%pMaterial%totallyr
178  do nlyr=1,ntot_lyr
179  call elementstress_shell_mitc( 731, 3, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
180  & ndstrain(1:3,1:6), ndstress(1:3,1:6), thick, 1.0d0, nlyr)
181  call fstr_stress_add_shelllyr(3,fstrsolid,icel,nodlocal,nlyr,ndstrain(1:3,1:6),ndstress(1:3,1:6),1)
182  !minus section
183  call elementstress_shell_mitc( 731, 3, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
184  & ndstrain(1:3,1:6), ndstress(1:3,1:6), thick,-1.0d0, nlyr)
185  call fstr_stress_add_shelllyr(3,fstrsolid,icel,nodlocal,nlyr,ndstrain(1:3,1:6),ndstress(1:3,1:6),-1)
186  enddo
187  call fstr_getavg_shell(3,fstrsolid,icel,nodlocal,ndstrain(1:3,1:6),ndstress(1:3,1:6),estrain,estress)
188 
189  else if( ic_type == 301 ) then
190  call nodalstress_c1( ic_type, nn, fstrsolid%elements(icel)%gausses, &
191  ndstrain(1:nn,1:6), ndstress(1:nn,1:6) )
192  call elementstress_c1( ic_type, fstrsolid%elements(icel)%gausses, estrain, estress )
193 
194  else if( ic_type == fe_tet10n .or. ic_type == fe_hex8n .or. &
195  ic_type == fe_prism15n .or. ic_type == fe_hex20n ) then
196  call nodalstress_inv3( ic_type, ni, fstrsolid%elements(icel)%gausses, &
197  inv_func, ndstrain(1:nn,1:6), ndstress(1:nn,1:6), &
198  tdstrain(1:nn,1:6) )
199  call elementstress_c3( ic_type, fstrsolid%elements(icel)%gausses, estrain, estress )
200 
201  else if ( ic_type == 881 .or. ic_type == 891 ) then !for selective es/ns smoothed fem
202  cycle
203  else
204  if( ic_type == 341 .and. fstrsolid%sections(isect)%elemopt341 == kel341sesns ) cycle
205 
206  call nodalstress_c3( ic_type, nn, fstrsolid%elements(icel)%gausses, &
207  ndstrain(1:nn,1:6), ndstress(1:nn,1:6) )
208  !call NodalStress_C3( ic_type, nn, fstrSOLID%elements(icel)%gausses, &
209  ! ndstrain(1:nn,1:6), ndstress(1:nn,1:6), tdstrain(1:nn,1:6) )
210  call elementstress_c3( ic_type, fstrsolid%elements(icel)%gausses, estrain, estress )
211 
212  endif
213 
214  !ADD VALUE and Count node
215  do j = 1, nn
216  ic = hecmesh%elem_node_item(js+j)
217  fstrsolid%STRAIN(6*(ic-1)+1:6*(ic-1)+6) = fstrsolid%STRAIN(6*(ic-1)+1:6*(ic-1)+6) + ndstrain(j,1:6)
218  fstrsolid%STRESS(6*(ic-1)+1:6*(ic-1)+6) = fstrsolid%STRESS(6*(ic-1)+1:6*(ic-1)+6) + ndstress(j,1:6)
219  if( associated(tnstrain) )then
220  tnstrain(6*(ic-1)+1:6*(ic-1)+6) = tnstrain(6*(ic-1)+1:6*(ic-1)+6) + tdstrain(j,1:6)
221  endif
222  nnumber(ic) = nnumber(ic) + 1
223  enddo
224 
225  fstrsolid%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) = fstrsolid%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) + estrain(1:6)
226  fstrsolid%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) = fstrsolid%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) + estress(1:6)
227 
228  !endif
229  enddo
230  deallocate( func, inv_func )
231  enddo
232 
233  !C** calculate nodal stress and strain
234  do i = 1, hecmesh%n_node
235  if( nnumber(i) == 0 ) cycle
236  fstrsolid%STRAIN(6*(i-1)+1:6*(i-1)+6) = fstrsolid%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
237  fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6) = fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
238  if( associated(tnstrain) )then
239  tnstrain(6*(i-1)+1:6*(i-1)+6) = tnstrain(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
240  endif
241  enddo
242 
243  if( fstrsolid%is_smoothing_active ) call fstr_nodalstress3d_c3d4_sesns( &
244  & hecmesh, fstrsolid, nnumber, fstrsolid%STRAIN, fstrsolid%STRESS, fstrsolid%ESTRAIN, fstrsolid%ESTRESS )
245 
246  if( flag33 == 1 )then
247  do nlyr = 1, ntot_lyr
248  do i = 1, hecmesh%n_node
249  if( nnumber(i) == 0 ) cycle
250  fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRAIN(6*(i-1)+1:6*(i-1)+6) = &
251  & fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
252  fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRESS(6*(i-1)+1:6*(i-1)+6) = &
253  & fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
254  fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRAIN(6*(i-1)+1:6*(i-1)+6) = &
255  & fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
256  fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRESS(6*(i-1)+1:6*(i-1)+6) = &
257  & fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
258  enddo
259  enddo
260  endif
261 
262  !C** calculate von MISES stress
263  do i = 1, hecmesh%n_node
264  fstrsolid%MISES(i) = get_mises(fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6))
265  enddo
266  do i = 1, hecmesh%n_elem
267  fstrsolid%EMISES(i) = get_mises(fstrsolid%ESTRESS(6*(i-1)+1:6*(i-1)+6))
268  enddo
269 
270  !C** calculate Elemental Plastic Strain
271  do i = 1, hecmesh%n_elem
272  if (.not. associated(fstrsolid%elements(i)%gausses)) cycle
273  fstrsolid%EPLSTRAIN(i) = get_pl_estrain(fstrsolid%elements(i)%gausses)
274  enddo
275 
276  if( flag33 == 1 )then
277  if( fstrsolid%output_ctrl(3)%outinfo%on(27) .or. fstrsolid%output_ctrl(4)%outinfo%on(27) ) then
278  do nlyr = 1, ntot_lyr
279  call make_principal(fstrsolid, hecmesh, fstrsolid%SHELL%LAYER(nlyr)%PLUS)
280  call make_principal(fstrsolid, hecmesh, fstrsolid%SHELL%LAYER(nlyr)%MINUS)
281  enddo
282  endif
283  call make_principal(fstrsolid, hecmesh, fstrsolid%SHELL)
284  else
285  call make_principal(fstrsolid, hecmesh, fstrsolid%SOLID)
286  endif
287 
288  deallocate( nnumber )
289 
290  end subroutine fstr_nodalstress3d
291 
292  integer(kind=kint) function search_idx_senes( irow, asect, nid, sid )
293  integer(kind=kint), allocatable, intent(in) :: irow(:)
294  integer(kind=kint), allocatable, intent(in) :: asect(:)
295  integer(kind=kint), intent(in) :: nid
296  integer(kind=kint), intent(in) :: sid
297 
298  integer(kind=kint) :: i
299 
300  search_idx_senes = -1
301  do i=irow(nid-1)+1,irow(nid)
302  if( asect(i) == sid ) then
303  search_idx_senes = i
304  return
305  end if
306  end do
307 
308  end function
309 
310  subroutine fstr_nodalstress3d_c3d4_sesns( hecMESH, fstrSOLID, nnumber, &
311  Nodal_STRAIN, Nodal_STRESS, Elemental_STRAIN, Elemental_STRESS )
312  type(hecmwst_local_mesh),intent(in) :: hecMESH
313  type(fstr_solid),intent(inout) :: fstrSOLID
314  integer(kind=kint), allocatable, intent(inout) :: nnumber(:)
315  real(kind=kreal), pointer, intent(inout) :: nodal_strain(:)
316  real(kind=kreal), pointer, intent(inout) :: nodal_stress(:)
317  real(kind=kreal), pointer, intent(inout) :: elemental_strain(:)
318  real(kind=kreal), pointer, intent(inout) :: elemental_stress(:)
319 
320  integer(kind=kint) :: itype, iS, iE, jS, ic_type, icel, i, j, isect
321  integer(kind=kint) :: nsize, nid(2), idx(2), nd
322  integer(kind=kint) :: nnode, nlen
323  type(hecmwst_varray_int), allocatable :: nodal_sections(:)
324  real(kind=kreal) :: tmpval(6), hydval, nsecdup
325  integer(kind=kint), allocatable :: irow(:), jcol(:), asect(:)
326  real(kind=kreal), allocatable :: stress_hyd(:), strain_hyd(:)
327  real(kind=kreal), allocatable :: stress_dev(:)
328  real(kind=kreal), allocatable :: plstrain_dev(:)
329  real(kind=kreal) :: stress_hyd_ndave(6), strain_hyd_ndave(6)
330  real(kind=kreal) :: stress_dev_ndave(6), strain_dev_ndave(6)
331  real(kind=kreal), allocatable :: n_dup_dev(:), n_dup_hyd(:)
332  real(kind=kreal) :: edstrain(6), edstress(6)
333  real(kind=kreal) :: edplstrain
334 
335  nnode = hecmesh%n_node
336  nsize = size(nodal_strain)
337 
338  ! create section info at node
339  call hecmw_varray_int_initialize_all( nodal_sections, nnode, 2 )
340  do itype = 1, hecmesh%n_elem_type
341  ic_type = hecmesh%elem_type_item(itype)
342  if( ic_type /= 341 ) cycle
343 
344  is = hecmesh%elem_type_index(itype-1) + 1
345  ie = hecmesh%elem_type_index(itype )
346 
347  do icel=is,ie
348  isect= hecmesh%section_ID(icel)
349  if( fstrsolid%sections(isect)%elemopt341 /= kel341sesns ) cycle
350  js = hecmesh%elem_node_index(icel-1)
351  do i=1,4
352  nd = hecmesh%elem_node_item(js+i)
353  call hecmw_varray_int_add_if_not_exits( nodal_sections(nd), isect )
354  end do
355  end do
356  enddo
357 
358  ! create CRS arrays of nodal stress/strain with different sections
359  allocate(irow(0:nnode))
360  irow(0) = 0
361  do i=1,nnode
362  irow(i) = irow(i-1)+hecmw_varray_int_get_nitem(nodal_sections(i))
363  end do
364  nlen = irow(nnode)
365 
366  allocate(asect(nlen))
367  do i=1,nnode
368  if( irow(i-1) == irow(i) ) cycle
369  call hecmw_varray_int_get_item_all( nodal_sections(i), asect(irow(i-1)+1:irow(i)) )
370  end do
371 
372  ! add stress/strain from smoothed elements
373  allocate(stress_hyd(6*nlen), strain_hyd(6*nlen))
374  allocate(stress_dev(6*nlen))
375  allocate(plstrain_dev(nlen))
376  allocate(n_dup_dev(nlen),n_dup_hyd(nlen))
377 
378  stress_hyd(:) = 0.d0
379  strain_hyd(:) = 0.d0
380  stress_dev(:) = 0.d0
381  plstrain_dev(:) = 0.d0
382  n_dup_hyd(:) = 0.d0
383  n_dup_dev(:) = 0.d0
384  do itype = 1, hecmesh%n_elem_type
385  ic_type = hecmesh%elem_type_item(itype)
386  if( ic_type /= 881 .and. ic_type /= 891 ) cycle
387 
388  is = hecmesh%elem_type_index(itype-1) + 1
389  ie = hecmesh%elem_type_index(itype )
390 
391  do icel=is,ie
392  js = hecmesh%elem_node_index(icel-1)
393  isect= hecmesh%section_ID(icel)
394  if( ic_type == 881 ) then
395  nid(1) = hecmesh%elem_node_item(js+1)
396  idx(1) = search_idx_senes( irow, asect, nid(1), isect )
397 
398  !strain
399  strain_hyd(6*idx(1)-5:6*idx(1)) = fstrsolid%elements(icel)%gausses(1)%strain_out(1:6)
400  !stress
401  stress_hyd(6*idx(1)-5:6*idx(1)) = fstrsolid%elements(icel)%gausses(1)%stress_out(1:6)
402  !number of duplication
403  n_dup_hyd(idx(1)) = n_dup_hyd(idx(1)) + 1.d0
404  else if( ic_type == 891 ) then
405  nid(1:2) = hecmesh%elem_node_item(js+1:js+2)
406  idx(1) = search_idx_senes( irow, asect, nid(1), isect )
407  idx(2) = search_idx_senes( irow, asect, nid(2), isect )
408 
409  !stress
410  tmpval(1:6) = fstrsolid%elements(icel)%gausses(1)%stress_out(1:6)
411  stress_dev(6*idx(1)-5:6*idx(1)) = stress_dev(6*idx(1)-5:6*idx(1)) + tmpval(1:6)
412  stress_dev(6*idx(2)-5:6*idx(2)) = stress_dev(6*idx(2)-5:6*idx(2)) + tmpval(1:6)
413  !plastic strain
414  plstrain_dev(idx(1)) = plstrain_dev(idx(1)) + fstrsolid%elements(icel)%gausses(1)%plstrain
415  plstrain_dev(idx(2)) = plstrain_dev(idx(2)) + fstrsolid%elements(icel)%gausses(1)%plstrain
416  !number of duplication
417  n_dup_dev(idx(1)) = n_dup_dev(idx(1)) + 1.d0
418  n_dup_dev(idx(2)) = n_dup_dev(idx(2)) + 1.d0
419  end if
420  end do
421  enddo
422 
423  do i=1,nnode
424  if( irow(i-1) == irow(i) ) cycle
425  do j=irow(i-1)+1,irow(i)
426  if( n_dup_dev(j) < 1.0d-8 ) cycle
427  stress_dev(6*j-5:6*j) = stress_dev(6*j-5:6*j)/n_dup_dev(j)
428  plstrain_dev(j) = plstrain_dev(j)/n_dup_dev(j)
429  end do
430  end do
431 
432  ! average at node for nodal output
433  do i=1,nnode
434  if( irow(i-1) == irow(i) ) cycle
435  strain_hyd_ndave(:) = 0.d0
436  stress_hyd_ndave(:) = 0.d0
437  stress_dev_ndave(:) = 0.d0
438  do j=irow(i-1)+1,irow(i)
439  strain_hyd_ndave(1:6) = strain_hyd_ndave(1:6) + strain_hyd(6*j-5:6*j)
440  stress_hyd_ndave(1:6) = stress_hyd_ndave(1:6) + stress_hyd(6*j-5:6*j)
441  stress_dev_ndave(1:6) = stress_dev_ndave(1:6) + stress_dev(6*j-5:6*j)
442  end do
443  nsecdup = dble(irow(i)-irow(i-1))
444  strain_hyd_ndave(1:6) = strain_hyd_ndave(1:6)/nsecdup
445  stress_hyd_ndave(1:6) = stress_hyd_ndave(1:6)/nsecdup
446  stress_dev_ndave(1:6) = stress_dev_ndave(1:6)/nsecdup
447 
448  if( nnumber(i) == 0 ) then
449  nodal_strain(6*i-5:6*i) = strain_hyd_ndave(1:6)
450  nodal_stress(6*i-5:6*i) = stress_hyd_ndave(1:6)+stress_dev_ndave(1:6)
451  else
452  nodal_strain(6*i-5:6*i) = 0.5d0*(nodal_strain(6*i-5:6*i)+strain_hyd_ndave(1:6))
453  nodal_stress(6*i-5:6*i) = 0.5d0*(nodal_stress(6*i-5:6*i)+stress_hyd_ndave(1:6)+stress_dev_ndave(1:6))
454  endif
455  end do
456 
457  ! ELEMENTAL STRAIN and STRESS
458  do itype = 1, hecmesh%n_elem_type
459  ic_type = hecmesh%elem_type_item(itype)
460  if( ic_type /= 341 ) cycle
461 
462  is = hecmesh%elem_type_index(itype-1) + 1
463  ie = hecmesh%elem_type_index(itype )
464 
465  do icel=is,ie
466  isect= hecmesh%section_ID(icel)
467  if( fstrsolid%sections(isect)%elemopt341 /= kel341sesns ) cycle
468  js = hecmesh%elem_node_index(icel-1)
469  edstrain(1:6) = 0.d0
470  edstress(1:6) = 0.d0
471  edplstrain = 0.d0
472  do i=1,4
473  nd = hecmesh%elem_node_item(js+i)
474  idx(1) = search_idx_senes( irow, asect, hecmesh%elem_node_item(js+i), isect )
475  edstrain(1:6) = edstrain(1:6) + strain_hyd(6*idx(1)-5:6*idx(1))
476  edstress(1:6) = edstress(1:6) + stress_hyd(6*idx(1)-5:6*idx(1)) + stress_dev(6*idx(1)-5:6*idx(1))
477  edplstrain = edplstrain + plstrain_dev(idx(1))
478  end do
479  edstrain(1:6) = 0.25d0*edstrain(1:6)
480  edstress(1:6) = 0.25d0*edstress(1:6)
481  edplstrain = 0.25d0*edplstrain
482 
483  elemental_strain(6*(icel-1)+1:6*(icel-1)+6) = elemental_strain(6*(icel-1)+1:6*(icel-1)+6) + edstrain(1:6)
484  elemental_stress(6*(icel-1)+1:6*(icel-1)+6) = elemental_stress(6*(icel-1)+1:6*(icel-1)+6) + edstress(1:6)
485 
486  fstrsolid%elements(icel)%gausses(1)%strain_out(1:6) = elemental_strain(6*(icel-1)+1:6*(icel-1)+6)
487  fstrsolid%elements(icel)%gausses(1)%stress_out(1:6) = elemental_stress(6*(icel-1)+1:6*(icel-1)+6)
488  fstrsolid%elements(icel)%gausses(1)%plstrain = edplstrain
489  end do
490  enddo
491 
492  deallocate(stress_hyd, strain_hyd)
493  deallocate(stress_dev, plstrain_dev)
494  deallocate(n_dup_dev, n_dup_hyd)
495 
496  end subroutine
497 
498  subroutine fstr_stress_add_shelllyr(nn,fstrSOLID,icel,nodLOCAL,nlyr,strain,stress,flag)
499  implicit none
500  type(fstr_solid) :: fstrsolid
501  integer(kind=kint) :: nodlocal(20)
502  integer(kind=kint) :: nn, i, j, k, m, nlyr, weight, icel, flag
503  real(kind=kreal) :: strain(nn, 6), stress(nn, 6)
504  type(fstr_solid_physic_val), pointer :: layer => null()
505 
506  do j = 1, nn
507  i = nodlocal(j)
508  m = nodlocal(j+nn)
509  if(flag == 1)then
510  layer => fstrsolid%SHELL%LAYER(nlyr)%PLUS
511  elseif(flag == -1)then
512  layer => fstrsolid%SHELL%LAYER(nlyr)%MINUS
513  endif
514  do k = 1, 6
515  layer%STRAIN(6*(i-1)+k) = layer%STRAIN(6*(i-1)+k) + strain(j,k)
516  layer%STRAIN(6*(m-1)+k) = layer%STRAIN(6*(m-1)+k) + strain(j,k)
517  layer%STRESS(6*(i-1)+k) = layer%STRESS(6*(i-1)+k) + stress(j,k)
518  layer%STRESS(6*(m-1)+k) = layer%STRESS(6*(m-1)+k) + stress(j,k)
519  layer%ESTRAIN(6*(icel-1)+k) = layer%ESTRAIN(6*(icel-1)+k) + strain(j,k)/nn
520  layer%ESTRESS(6*(icel-1)+k) = layer%ESTRESS(6*(icel-1)+k) + stress(j,k)/nn
521  enddo
522  enddo
523  end subroutine fstr_stress_add_shelllyr
524 
525  subroutine fstr_getavg_shell(nn,fstrSOLID,icel,nodLOCAL,strain,stress,estrain,estress)
526  implicit none
527  type (fstr_solid) :: fstrsolid
528  integer(kind=kint) :: nodlocal(20)
529  integer(kind=kint) :: nn, i, j, k, m, nlyr, icel, flag, ntot_lyr
530  real(kind=kreal) :: strain(nn,6), stress(nn,6), estrain(6), estress(6), weight
531  type(fstr_solid_physic_val), pointer :: layer => null()
532 
533  ntot_lyr = fstrsolid%elements(icel)%gausses(1)%pMaterial%totallyr
534  strain = 0.0d0
535  stress = 0.0d0
536  estrain = 0.0d0
537  estress = 0.0d0
538 
539  do nlyr = 1, ntot_lyr
540  layer => fstrsolid%SHELL%LAYER(nlyr)
541  weight = fstrsolid%elements(icel)%gausses(1)%pMaterial%shell_var(nlyr)%weight
542  do j = 1, nn
543  i = nodlocal(j)
544  do k = 1, 6
545  strain(j,k) = strain(j,k) &
546  & + weight*(0.5d0*layer%PLUS%STRAIN(6*(i-1)+k) + 0.5d0*layer%MINUS%STRAIN(6*(i-1)+k))
547  stress(j,k) = stress(j,k) &
548  & + weight*(0.5d0*layer%PLUS%STRESS(6*(i-1)+k) + 0.5d0*layer%MINUS%STRESS(6*(i-1)+k))
549  enddo
550  estrain(j) = estrain(j) &
551  & + weight*(0.5d0*layer%PLUS%ESTRAIN(6*(icel-1)+j) + 0.5d0*layer%MINUS%ESTRAIN(6*(icel-1)+j))
552  estress(j) = estress(j) &
553  & + weight*(0.5d0*layer%PLUS%ESTRESS(6*(icel-1)+j) + 0.5d0*layer%MINUS%ESTRESS(6*(icel-1)+j))
554  enddo
555  enddo
556  call set_shell_layer_surface_results(fstrsolid%elements(icel), fstrsolid, icel)
557  call get_shell_layer_gauss_average(fstrsolid%elements(icel), estrain, estress)
558  end subroutine fstr_getavg_shell
559 
560  subroutine set_shell_layer_surface_results(element, fstrSOLID, icel)
561  implicit none
562  type(telement), intent(in) :: element
563  type(fstr_solid), intent(inout) :: fstrSOLID
564  integer(kind=kint), intent(in) :: icel
565  integer(kind=kint) :: ilayer
566  real(kind=kreal) :: estrain(6), estress(6)
567 
568  if( .not. associated(element%shell_layer_gausses) ) return
569  if( element%shell_nlayer <= 0 ) return
570 
571  do ilayer = 1, element%shell_nlayer
572  call get_shell_layer_surface_average(element, ilayer, 1, estrain, estress)
573  fstrsolid%SHELL%LAYER(ilayer)%PLUS%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) = estrain(1:6)
574  fstrsolid%SHELL%LAYER(ilayer)%PLUS%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) = estress(1:6)
575  call get_shell_layer_surface_average(element, ilayer, -1, estrain, estress)
576  fstrsolid%SHELL%LAYER(ilayer)%MINUS%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) = estrain(1:6)
577  fstrsolid%SHELL%LAYER(ilayer)%MINUS%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) = estress(1:6)
578  enddo
579  end subroutine set_shell_layer_surface_results
580 
581  subroutine get_shell_layer_surface_average(element, ilayer, flag, estrain, estress)
582  implicit none
583  type(telement), intent(in) :: element
584  integer(kind=kint), intent(in) :: ilayer, flag
585  real(kind=kreal), intent(out) :: estrain(6), estress(6)
586  integer(kind=kint) :: ig, ithick, ishell, ierr, surface_ithick, npoint
587  real(kind=kreal) :: zeta_layer, weight, surface_zeta
588 
589  estrain(1:6) = 0.0d0
590  estress(1:6) = 0.0d0
591  if( .not. associated(element%shell_layer_gausses) ) return
592  if( .not. associated(element%gausses) ) return
593  if( element%shell_nlayer <= 0 .or. element%shell_nthick <= 0 ) return
594 
595  surface_ithick = 0
596  if( flag > 0 ) then
597  surface_zeta = -huge(1.0d0)
598  else
599  surface_zeta = huge(1.0d0)
600  endif
601 
602  do ithick = 1, element%shell_nthick
603  call fstr_shell_layer_quadrature(element, ilayer, ithick, zeta_layer, weight, ierr)
604  if( ierr /= 0 ) cycle
605  if( flag > 0 ) then
606  if( zeta_layer > surface_zeta ) then
607  surface_zeta = zeta_layer
608  surface_ithick = ithick
609  endif
610  else
611  if( zeta_layer < surface_zeta ) then
612  surface_zeta = zeta_layer
613  surface_ithick = ithick
614  endif
615  endif
616  enddo
617  if( surface_ithick <= 0 ) return
618 
619  npoint = 0
620  do ig = 1, size(element%gausses)
621  ishell = fstr_shell_layer_gauss_index(element, ig, ilayer, surface_ithick)
622  if( ishell <= 0 ) cycle
623  estrain(1:6) = estrain(1:6) + element%shell_layer_gausses(ishell)%strain_out(1:6)
624  estress(1:6) = estress(1:6) + element%shell_layer_gausses(ishell)%stress_out(1:6)
625  npoint = npoint + 1
626  enddo
627  if( npoint > 0 ) then
628  estrain(1:6) = estrain(1:6) / npoint
629  estress(1:6) = estress(1:6) / npoint
630  endif
631  end subroutine get_shell_layer_surface_average
632 
633  subroutine get_shell_layer_gauss_average(element, estrain, estress)
634  implicit none
635  type(telement), intent(in) :: element
636  real(kind=kreal), intent(inout) :: estrain(6), estress(6)
637  integer(kind=kint) :: ig, ilayer, ithick, ishell, ierr
638  real(kind=kreal) :: zeta_layer, weight, total_weight
639  real(kind=kreal) :: avg_strain(6), avg_stress(6)
640 
641  if( .not. associated(element%shell_layer_gausses) ) return
642  if( .not. associated(element%gausses) ) return
643  if( element%shell_nlayer <= 0 .or. element%shell_nthick <= 0 ) return
644 
645  avg_strain(1:6) = 0.0d0
646  avg_stress(1:6) = 0.0d0
647  total_weight = 0.0d0
648 
649  do ig = 1, size(element%gausses)
650  do ilayer = 1, element%shell_nlayer
651  do ithick = 1, element%shell_nthick
652  ishell = fstr_shell_layer_gauss_index(element, ig, ilayer, ithick)
653  if( ishell <= 0 ) cycle
654  call fstr_shell_layer_quadrature(element, ilayer, ithick, zeta_layer, weight, ierr)
655  if( ierr /= 0 ) cycle
656  avg_strain(1:6) = avg_strain(1:6) &
657  + element%shell_layer_gausses(ishell)%strain_out(1:6) * weight
658  avg_stress(1:6) = avg_stress(1:6) &
659  + element%shell_layer_gausses(ishell)%stress_out(1:6) * weight
660  total_weight = total_weight + weight
661  enddo
662  enddo
663  enddo
664 
665  if( total_weight > 0.0d0 ) then
666  estrain(1:6) = avg_strain(1:6) / total_weight
667  estress(1:6) = avg_stress(1:6) / total_weight
668  endif
669  end subroutine get_shell_layer_gauss_average
670 
671  !----------------------------------------------------------------------*
672  subroutine nodalstress_inv3( etype, ni, gausses, func, edstrain, edstress, tdstrain )
673  !----------------------------------------------------------------------*
674  use mmechgauss
675  integer(kind=kint) :: etype, ni
676  type(tgaussstatus) :: gausses(:)
677  real(kind=kreal) :: func(:, :), edstrain(:, :), edstress(:, :), tdstrain(:, :)
678  integer :: i, j, k, ic
679 
680  edstrain = 0.0d0
681  edstress = 0.0d0
682  tdstrain = 0.0d0
683 
684  if( etype == fe_hex8n ) then
685  do i = 1, ni
686  do j = 1, ni
687  do k = 1, 6
688  edstrain(i,k) = edstrain(i,k) + func(i,j) * gausses(j)%strain_out(k)
689  edstress(i,k) = edstress(i,k) + func(i,j) * gausses(j)%stress_out(k)
690  ! tdstrain(i,k) = tdstrain(i,k) + func(i,j) * gausses(j)%tstrain(k)
691  enddo
692  enddo
693  enddo
694  else if( etype == fe_tet10n ) then
695  do i = 1, ni
696  do j = 1, ni
697  do k = 1, 6
698  edstrain(i,k) = edstrain(i,k) + func(i,j) * gausses(j)%strain_out(k)
699  edstress(i,k) = edstress(i,k) + func(i,j) * gausses(j)%stress_out(k)
700  ! tdstrain(i,k) = tdstrain(i,k) + func(i,j) * gausses(j)%tstrain(k)
701  enddo
702  enddo
703  enddo
704  edstrain(5,1:6) = ( edstrain(1,1:6) + edstrain(2,1:6) ) / 2.0
705  edstress(5,1:6) = ( edstress(1,1:6) + edstress(2,1:6) ) / 2.0
706  tdstrain(5,1:6) = ( tdstrain(1,1:6) + tdstrain(2,1:6) ) / 2.0
707  edstrain(6,1:6) = ( edstrain(2,1:6) + edstrain(3,1:6) ) / 2.0
708  edstress(6,1:6) = ( edstress(2,1:6) + edstress(3,1:6) ) / 2.0
709  tdstrain(6,1:6) = ( tdstrain(2,1:6) + tdstrain(3,1:6) ) / 2.0
710  edstrain(7,1:6) = ( edstrain(3,1:6) + edstrain(1,1:6) ) / 2.0
711  edstress(7,1:6) = ( edstress(3,1:6) + edstress(1,1:6) ) / 2.0
712  tdstrain(7,1:6) = ( tdstrain(3,1:6) + tdstrain(1,1:6) ) / 2.0
713  edstrain(8,1:6) = ( edstrain(1,1:6) + edstrain(4,1:6) ) / 2.0
714  edstress(8,1:6) = ( edstress(1,1:6) + edstress(4,1:6) ) / 2.0
715  tdstrain(8,1:6) = ( tdstrain(1,1:6) + tdstrain(4,1:6) ) / 2.0
716  edstrain(9,1:6) = ( edstrain(2,1:6) + edstrain(4,1:6) ) / 2.0
717  edstress(9,1:6) = ( edstress(2,1:6) + edstress(4,1:6) ) / 2.0
718  tdstrain(9,1:6) = ( tdstrain(2,1:6) + tdstrain(4,1:6) ) / 2.0
719  edstrain(10,1:6) = ( edstrain(3,1:6) + edstrain(4,1:6) ) / 2.0
720  edstress(10,1:6) = ( edstress(3,1:6) + edstress(4,1:6) ) / 2.0
721  tdstrain(10,1:6) = ( tdstrain(3,1:6) + tdstrain(4,1:6) ) / 2.0
722  else if( etype == fe_prism15n ) then
723  do i = 1, ni
724  ic = 0
725  do j = 1, numofquadpoints(etype)
726  if( j==1 .or. j==2 .or. j==3 .or. j==7 .or. j==8 .or. j==9 ) then
727  ic = ic + 1
728  do k = 1, 6
729  edstrain(i,k) = edstrain(i,k) + func(i,ic) * gausses(j)%strain_out(k)
730  edstress(i,k) = edstress(i,k) + func(i,ic) * gausses(j)%stress_out(k)
731  ! tdstrain(i,k) = tdstrain(i,k) + func(i,ic) * gausses(j)%tstrain(k)
732  enddo
733  endif
734  enddo
735  enddo
736  edstrain(7,1:6) = ( edstrain(1,1:6) + edstrain(2,1:6) ) / 2.0
737  edstress(7,1:6) = ( edstress(1,1:6) + edstress(2,1:6) ) / 2.0
738  tdstrain(7,1:6) = ( tdstrain(1,1:6) + tdstrain(2,1:6) ) / 2.0
739  edstrain(8,1:6) = ( edstrain(2,1:6) + edstrain(3,1:6) ) / 2.0
740  edstress(8,1:6) = ( edstress(2,1:6) + edstress(3,1:6) ) / 2.0
741  tdstrain(8,1:6) = ( tdstrain(2,1:6) + tdstrain(3,1:6) ) / 2.0
742  edstrain(9,1:6) = ( edstrain(3,1:6) + edstrain(1,1:6) ) / 2.0
743  edstress(9,1:6) = ( edstress(3,1:6) + edstress(1,1:6) ) / 2.0
744  tdstrain(9,1:6) = ( tdstrain(3,1:6) + tdstrain(1,1:6) ) / 2.0
745  edstrain(10,1:6) = ( edstrain(4,1:6) + edstrain(5,1:6) ) / 2.0
746  edstress(10,1:6) = ( edstress(4,1:6) + edstress(5,1:6) ) / 2.0
747  tdstrain(10,1:6) = ( tdstrain(4,1:6) + tdstrain(5,1:6) ) / 2.0
748  edstrain(11,1:6) = ( edstrain(5,1:6) + edstrain(6,1:6) ) / 2.0
749  edstress(11,1:6) = ( edstress(5,1:6) + edstress(6,1:6) ) / 2.0
750  tdstrain(11,1:6) = ( tdstrain(5,1:6) + tdstrain(6,1:6) ) / 2.0
751  edstrain(12,1:6) = ( edstrain(6,1:6) + edstrain(4,1:6) ) / 2.0
752  edstress(12,1:6) = ( edstress(6,1:6) + edstress(4,1:6) ) / 2.0
753  tdstrain(12,1:6) = ( tdstrain(6,1:6) + tdstrain(4,1:6) ) / 2.0
754  edstrain(13,1:6) = ( edstrain(1,1:6) + edstrain(4,1:6) ) / 2.0
755  edstress(13,1:6) = ( edstress(1,1:6) + edstress(4,1:6) ) / 2.0
756  tdstrain(13,1:6) = ( tdstrain(1,1:6) + tdstrain(4,1:6) ) / 2.0
757  edstrain(14,1:6) = ( edstrain(2,1:6) + edstrain(5,1:6) ) / 2.0
758  edstress(14,1:6) = ( edstress(2,1:6) + edstress(5,1:6) ) / 2.0
759  tdstrain(14,1:6) = ( tdstrain(2,1:6) + tdstrain(5,1:6) ) / 2.0
760  edstrain(15,1:6) = ( edstrain(3,1:6) + edstrain(6,1:6) ) / 2.0
761  edstress(15,1:6) = ( edstress(3,1:6) + edstress(6,1:6) ) / 2.0
762  tdstrain(15,1:6) = ( tdstrain(3,1:6) + tdstrain(6,1:6) ) / 2.0
763  else if( etype == fe_hex20n ) then
764  do i = 1, ni
765  ic = 0
766  do j = 1, numofquadpoints(etype)
767  if( j==1 .or. j==3 .or. j==7 .or. j==9 .or. &
768  j==19 .or. j==21 .or. j==25 .or. j==27 ) then
769  ic = ic + 1
770  do k = 1, 6
771  edstrain(i,k) = edstrain(i,k) + func(i,ic) * gausses(j)%strain_out(k)
772  edstress(i,k) = edstress(i,k) + func(i,ic) * gausses(j)%stress_out(k)
773  ! tdstrain(i,k) = tdstrain(i,k) + func(i,ic) * gausses(j)%tstrain(k)
774  enddo
775  endif
776  enddo
777  enddo
778  edstrain(9,1:6) = ( edstrain(1,1:6) + edstrain(2,1:6) ) / 2.0
779  edstress(9,1:6) = ( edstress(1,1:6) + edstress(2,1:6) ) / 2.0
780  tdstrain(9,1:6) = ( tdstrain(1,1:6) + tdstrain(2,1:6) ) / 2.0
781  edstrain(10,1:6) = ( edstrain(2,1:6) + edstrain(3,1:6) ) / 2.0
782  edstress(10,1:6) = ( edstress(2,1:6) + edstress(3,1:6) ) / 2.0
783  tdstrain(10,1:6) = ( tdstrain(2,1:6) + tdstrain(3,1:6) ) / 2.0
784  edstrain(11,1:6) = ( edstrain(3,1:6) + edstrain(4,1:6) ) / 2.0
785  edstress(11,1:6) = ( edstress(3,1:6) + edstress(4,1:6) ) / 2.0
786  tdstrain(11,1:6) = ( tdstrain(3,1:6) + tdstrain(4,1:6) ) / 2.0
787  edstrain(12,1:6) = ( edstrain(4,1:6) + edstrain(1,1:6) ) / 2.0
788  edstress(12,1:6) = ( edstress(4,1:6) + edstress(1,1:6) ) / 2.0
789  tdstrain(12,1:6) = ( tdstrain(4,1:6) + tdstrain(1,1:6) ) / 2.0
790  edstrain(13,1:6) = ( edstrain(5,1:6) + edstrain(6,1:6) ) / 2.0
791  edstress(13,1:6) = ( edstress(5,1:6) + edstress(6,1:6) ) / 2.0
792  tdstrain(13,1:6) = ( tdstrain(5,1:6) + tdstrain(6,1:6) ) / 2.0
793  edstrain(14,1:6) = ( edstrain(6,1:6) + edstrain(7,1:6) ) / 2.0
794  edstress(14,1:6) = ( edstress(6,1:6) + edstress(7,1:6) ) / 2.0
795  tdstrain(14,1:6) = ( tdstrain(6,1:6) + tdstrain(7,1:6) ) / 2.0
796  edstrain(15,1:6) = ( edstrain(7,1:6) + edstrain(8,1:6) ) / 2.0
797  edstress(15,1:6) = ( edstress(7,1:6) + edstress(8,1:6) ) / 2.0
798  tdstrain(15,1:6) = ( tdstrain(7,1:6) + tdstrain(8,1:6) ) / 2.0
799  edstrain(16,1:6) = ( edstrain(8,1:6) + edstrain(5,1:6) ) / 2.0
800  edstress(16,1:6) = ( edstress(8,1:6) + edstress(5,1:6) ) / 2.0
801  tdstrain(16,1:6) = ( tdstrain(8,1:6) + tdstrain(5,1:6) ) / 2.0
802  edstrain(17,1:6) = ( edstrain(1,1:6) + edstrain(5,1:6) ) / 2.0
803  edstress(17,1:6) = ( edstress(1,1:6) + edstress(5,1:6) ) / 2.0
804  tdstrain(17,1:6) = ( tdstrain(1,1:6) + tdstrain(5,1:6) ) / 2.0
805  edstrain(18,1:6) = ( edstrain(2,1:6) + edstrain(6,1:6) ) / 2.0
806  edstress(18,1:6) = ( edstress(2,1:6) + edstress(6,1:6) ) / 2.0
807  tdstrain(18,1:6) = ( tdstrain(2,1:6) + tdstrain(6,1:6) ) / 2.0
808  edstrain(19,1:6) = ( edstrain(3,1:6) + edstrain(7,1:6) ) / 2.0
809  edstress(19,1:6) = ( edstress(3,1:6) + edstress(7,1:6) ) / 2.0
810  tdstrain(19,1:6) = ( tdstrain(3,1:6) + tdstrain(7,1:6) ) / 2.0
811  edstrain(20,1:6) = ( edstrain(4,1:6) + edstrain(8,1:6) ) / 2.0
812  edstress(20,1:6) = ( edstress(4,1:6) + edstress(8,1:6) ) / 2.0
813  tdstrain(20,1:6) = ( tdstrain(4,1:6) + tdstrain(8,1:6) ) / 2.0
814  endif
815  end subroutine nodalstress_inv3
816 
817  function get_mises(s)
818  implicit none
819  real(kind=kreal) :: get_mises, s(1:6)
820  real(kind=kreal) :: s11, s22, s33, s12, s23, s13, ps, smises
821 
822  s11 = s(1)
823  s22 = s(2)
824  s33 = s(3)
825  s12 = s(4)
826  s23 = s(5)
827  s13 = s(6)
828  ps = ( s11 + s22 + s33 ) / 3.0d0
829  smises = 0.5d0 * ( (s11-ps)**2 + (s22-ps)**2 + (s33-ps)**2 ) + s12**2 + s23**2 + s13**2
830  get_mises = dsqrt( 3.0d0 * smises )
831 
832  end function get_mises
833 
834  function get_pl_estrain(gausses)
835  implicit none
836  real(kind=kreal) :: get_pl_estrain
837  type(tgaussstatus), intent(in) :: gausses(:)
838  integer(kind=kint) :: i
839 
840  get_pl_estrain = 0.d0
841  if( size(gausses) <= 0 ) return
842 
843  do i = 1, size(gausses)
844  get_pl_estrain = get_pl_estrain + gausses(i)%plstrain
845  enddo
846  get_pl_estrain = get_pl_estrain / size(gausses)
847 
848  end function get_pl_estrain
849 
851  !----------------------------------------------------------------------*
852  subroutine fstr_nodalstress2d( hecMESH, fstrSOLID )
853  !----------------------------------------------------------------------*
854  use m_static_lib
855  type (hecmwst_local_mesh) :: hecMESH
856  type (fstr_solid) :: fstrSOLID
857  real(kind=kreal), pointer :: tnstrain(:), testrain(:)
858  !C** local variables
859  integer(kind=kint) :: itype, icel, ic, is, iE, jS, i, j, ic_type, nn, ni, ID_area
860  real(kind=kreal) :: estrain(4), estress(4), tstrain(4), naturalcoord(4)
861  real(kind=kreal) :: edstrain(8,4), edstress(8,4), tdstrain(8,4)
862  real(kind=kreal) :: s11, s22, s33, s12, s23, s13, ps, smises
863  real(kind=kreal), allocatable :: func(:,:), inv_func(:,:)
864  integer(kind=kint), allocatable :: nnumber(:)
865 
866  tnstrain => fstrsolid%tnstrain
867  testrain => fstrsolid%testrain
868  call fstr_solid_phys_clear(fstrsolid)
869 
870  allocate( nnumber(hecmesh%n_node) )
871  if( .not. associated(fstrsolid%is_rot) ) allocate( fstrsolid%is_rot(hecmesh%n_node) )
872  nnumber = 0
873  fstrsolid%is_rot = 0
874 
875  !C +-------------------------------+
876  !C | according to ELEMENT TYPE |
877  !C +-------------------------------+
878  do itype = 1, hecmesh%n_elem_type
879  is = hecmesh%elem_type_index(itype-1) + 1
880  ie = hecmesh%elem_type_index(itype )
881  ic_type = hecmesh%elem_type_item(itype)
882  if( .not. hecmw_is_etype_surface(ic_type) ) cycle
883  !C** set number of nodes and shape function
884  nn = hecmw_get_max_node( ic_type )
885  ni = numofquadpoints( ic_type )
886  allocate( func(ni,nn), inv_func(nn,ni) )
887  if( ic_type == fe_tri6n ) then
888  ic = hecmw_get_max_node( fe_tri3n )
889  do i = 1, ni
890  call getquadpoint( ic_type, i, naturalcoord )
891  call getshapefunc( fe_tri3n, naturalcoord, func(i,1:ic) )
892  enddo
893  call inverse_func( ic, func, inv_func )
894  else if( ic_type == fe_quad4n ) then
895  do i = 1, ni
896  call getquadpoint( ic_type, i, naturalcoord )
897  call getshapefunc( ic_type, naturalcoord, func(i,1:nn) )
898  enddo
899  call inverse_func( ni, func, inv_func )
900  else if( ic_type == fe_quad8n ) then
901  ic = 0
902  do i = 1, ni
903  if( i==1 .or. i==3 .or. i==7 .or. i==9 ) then
904  ic = ic + 1
905  call getquadpoint( ic_type, i, naturalcoord )
906  call getshapefunc( fe_quad4n, naturalcoord, func(ic,1:4) )
907  endif
908  enddo
909  call inverse_func( ic, func, inv_func )
910  ni = ic
911  endif
912  !C** element loop
913  do icel = is, ie
914  js = hecmesh%elem_node_index(icel-1)
915  id_area = hecmesh%elem_ID(icel*2)
916  !--- calculate nodal stress and strain
917  if( ic_type == fe_tri6n .or. ic_type == fe_quad4n .or. ic_type == fe_quad8n ) then
918  call nodalstress_inv2( ic_type, ni, fstrsolid%elements(icel)%gausses, &
919  inv_func, edstrain(1:nn,1:4), edstress(1:nn,1:4), &
920  tdstrain(1:nn,1:4) )
921  else
922  call nodalstress_c2( ic_type, nn, fstrsolid%elements(icel)%gausses, &
923  edstrain(1:nn,1:4), edstress(1:nn,1:4) )
924  ! call NodalStress_C2( ic_type, nn, fstrSOLID%elements(icel)%gausses, &
925  ! edstrain(1:nn,1:4), edstress(1:nn,1:4), tdstrain(1:nn,1:4) )
926  endif
927  do j = 1, nn
928  ic = hecmesh%elem_node_item(js+j)
929  fstrsolid%STRAIN(3*ic-2) = fstrsolid%STRAIN(3*ic-2) + edstrain(j,1)
930  fstrsolid%STRAIN(3*ic-1) = fstrsolid%STRAIN(3*ic-1) + edstrain(j,2)
931  fstrsolid%STRAIN(3*ic-0) = fstrsolid%STRAIN(3*ic-0) + edstrain(j,3)
932  fstrsolid%STRESS(3*ic-2) = fstrsolid%STRESS(3*ic-2) + edstress(j,1)
933  fstrsolid%STRESS(3*ic-1) = fstrsolid%STRESS(3*ic-1) + edstress(j,2)
934  fstrsolid%STRESS(3*ic-0) = fstrsolid%STRESS(3*ic-0) + edstress(j,3)
935 
936  if( associated(tnstrain) ) then
937  tnstrain(3*ic-2) = tnstrain(3*ic-2) + tdstrain(j,1)
938  tnstrain(3*ic-1) = tnstrain(3*ic-1) + tdstrain(j,2)
939  tnstrain(3*ic ) = tnstrain(3*ic ) + tdstrain(j,3)
940  endif
941  nnumber(ic) = nnumber(ic) + 1
942  enddo
943  !--- calculate elemental stress and strain
944  ! if( ID_area == hecMESH%my_rank ) then
945  call elementstress_c2( ic_type, fstrsolid%elements(icel)%gausses, estrain, estress )
946  ! call ElementStress_C2( ic_type, fstrSOLID%elements(icel)%gausses, estrain, estress, tstrain )
947 
948  fstrsolid%ESTRAIN(3*icel-2) = estrain(1)
949  fstrsolid%ESTRAIN(3*icel-1) = estrain(2)
950  fstrsolid%ESTRAIN(3*icel-0) = estrain(3)
951  fstrsolid%ESTRESS(3*icel-2) = estress(1)
952  fstrsolid%ESTRESS(3*icel-1) = estress(2)
953  fstrsolid%ESTRESS(3*icel-0) = estress(3)
954 
955  !if( associated(testrain) ) then
956  ! testrain(3*icel-2) = tstrain(1)
957  ! testrain(3*icel-1) = tstrain(2)
958  ! testrain(3*icel ) = tstrain(3)
959  !endif
960  s11 = estress(1)
961  s22 = estress(2)
962  s12 = estress(3)
963  smises = 0.5d0 * ((s11-s22)**2+(s11)**2+(s22)**2) + 3*s12**2
964  fstrsolid%EMISES(icel) = sqrt( smises )
965  ! endif
966  enddo
967  deallocate( func, inv_func )
968  enddo
969 
970  !C** average over nodes
971  do i = 1, hecmesh%n_node
972  if( nnumber(i) == 0 ) cycle
973  fstrsolid%STRAIN(3*i-2:3*i-0) = fstrsolid%STRAIN(3*i-2:3*i-0) / nnumber(i)
974  fstrsolid%STRESS(3*i-2:3*i-0) = fstrsolid%STRESS(3*i-2:3*i-0) / nnumber(i)
975  if( associated(tnstrain) ) tnstrain(3*i-2:3*i) = tnstrain(3*i-2:3*i) / nnumber(i)
976  enddo
977  !C** calculate von MISES stress
978  do i = 1, hecmesh%n_node
979  s11 = fstrsolid%STRESS(3*i-2)
980  s22 = fstrsolid%STRESS(3*i-1)
981  s12 = fstrsolid%STRESS(3*i-0)
982  smises = 0.5d0 * ((s11-s22)**2+(s11)**2+(s22)**2) + 3*s12**2
983  fstrsolid%MISES(i) = sqrt( smises )
984  enddo
985 
986  deallocate( nnumber )
987  end subroutine fstr_nodalstress2d
988 
989  !----------------------------------------------------------------------*
990  subroutine nodalstress_inv2( etype, ni, gausses, func, edstrain, edstress, tdstrain )
991  !----------------------------------------------------------------------*
992  use mmechgauss
993  integer(kind=kint) :: etype, ni
994  type(tgaussstatus) :: gausses(:)
995  real(kind=kreal) :: func(:,:), edstrain(:,:), edstress(:,:), tdstrain(:,:)
996  integer :: i, j, k, ic
997 
998  edstrain = 0.0d0
999  edstress = 0.0d0
1000  tdstrain = 0.0d0
1001 
1002  if( etype == fe_quad4n ) then
1003  do i = 1, ni
1004  do j = 1, ni
1005  do k = 1, 4
1006  edstrain(i,k) = edstrain(i,k) + func(i,j) * gausses(j)%strain_out(k)
1007  edstress(i,k) = edstress(i,k) + func(i,j) * gausses(j)%stress_out(k)
1008  ! tdstrain(i,k) = tdstrain(i,k) + func(i,j) * gausses(j)%tstrain(k)
1009  enddo
1010  enddo
1011  enddo
1012  else if( etype == fe_tri6n ) then
1013  do i = 1, ni
1014  do j = 1, ni
1015  do k = 1, 4
1016  edstrain(i,k) = edstrain(i,k) + func(i,j) * gausses(j)%strain_out(k)
1017  edstress(i,k) = edstress(i,k) + func(i,j) * gausses(j)%stress_out(k)
1018  ! tdstrain(i,k) = tdstrain(i,k) + func(i,j) * gausses(j)%tstrain(k)
1019  enddo
1020  enddo
1021  enddo
1022  edstrain(4,1:4) = ( edstrain(1,1:4) + edstrain(2,1:4) ) / 2.0
1023  edstress(4,1:4) = ( edstress(1,1:4) + edstress(2,1:4) ) / 2.0
1024  tdstrain(4,1:4) = ( tdstrain(1,1:4) + tdstrain(2,1:4) ) / 2.0
1025  edstrain(5,1:4) = ( edstrain(2,1:4) + edstrain(3,1:4) ) / 2.0
1026  edstress(5,1:4) = ( edstress(2,1:4) + edstress(3,1:4) ) / 2.0
1027  tdstrain(5,1:4) = ( tdstrain(2,1:4) + tdstrain(3,1:4) ) / 2.0
1028  edstrain(6,1:4) = ( edstrain(3,1:4) + edstrain(1,1:4) ) / 2.0
1029  edstress(6,1:4) = ( edstress(3,1:4) + edstress(1,1:4) ) / 2.0
1030  tdstrain(6,1:4) = ( tdstrain(3,1:4) + tdstrain(1,1:4) ) / 2.0
1031  else if( etype == fe_quad8n ) then
1032  do i = 1, ni
1033  ic = 0
1034  do j = 1, numofquadpoints(etype)
1035  if( j==1 .or. j==3 .or. j==7 .or. j==9 ) then
1036  ic = ic + 1
1037  do k = 1, 4
1038  edstrain(i,k) = edstrain(i,k) + func(i,ic) * gausses(j)%strain_out(k)
1039  edstress(i,k) = edstress(i,k) + func(i,ic) * gausses(j)%stress_out(k)
1040  ! tdstrain(i,k) = tdstrain(i,k) + func(i,ic) * gausses(j)%tstrain(k)
1041  enddo
1042  endif
1043  enddo
1044  enddo
1045  edstrain(5,1:4) = ( edstrain(1,1:4) + edstrain(2,1:4) ) / 2.0
1046  edstress(5,1:4) = ( edstress(1,1:4) + edstress(2,1:4) ) / 2.0
1047  tdstrain(5,1:4) = ( tdstrain(1,1:4) + tdstrain(2,1:4) ) / 2.0
1048  edstrain(6,1:4) = ( edstrain(2,1:4) + edstrain(3,1:4) ) / 2.0
1049  edstress(6,1:4) = ( edstress(2,1:4) + edstress(3,1:4) ) / 2.0
1050  tdstrain(6,1:4) = ( tdstrain(2,1:4) + tdstrain(3,1:4) ) / 2.0
1051  edstrain(7,1:4) = ( edstrain(3,1:4) + edstrain(4,1:4) ) / 2.0
1052  edstress(7,1:4) = ( edstress(3,1:4) + edstress(4,1:4) ) / 2.0
1053  tdstrain(7,1:4) = ( tdstrain(3,1:4) + tdstrain(4,1:4) ) / 2.0
1054  edstrain(8,1:4) = ( edstrain(4,1:4) + edstrain(1,1:4) ) / 2.0
1055  edstress(8,1:4) = ( edstress(4,1:4) + edstress(1,1:4) ) / 2.0
1056  tdstrain(8,1:4) = ( tdstrain(4,1:4) + tdstrain(1,1:4) ) / 2.0
1057  endif
1058  end subroutine nodalstress_inv2
1059 
1060  !----------------------------------------------------------------------*
1061  subroutine inverse_func( n, a, inv_a )
1062  !----------------------------------------------------------------------*
1063  integer(kind=kint) :: n
1064  real(kind=kreal) :: a(:,:), inv_a(:,:)
1065  integer(kind=kint) :: i, j, k
1066  real(kind=kreal) :: buf
1067 
1068  do i = 1, n
1069  do j = 1, n
1070  if( i == j ) then
1071  inv_a(i,j) = 1.0
1072  else
1073  inv_a(i,j) = 0.0
1074  endif
1075  enddo
1076  enddo
1077 
1078  do i = 1, n
1079  buf = 1.0 / a(i,i)
1080  do j = 1, n
1081  a(i,j) = a(i,j) * buf
1082  inv_a(i,j) = inv_a(i,j) *buf
1083  enddo
1084  do j = 1, n
1085  if( i /= j ) then
1086  buf = a(j,i)
1087  do k = 1, n
1088  a(j,k) = a(j,k) - a(i,k) * buf
1089  inv_a(j,k) = inv_a(j,k) - inv_a(i,k) * buf
1090  enddo
1091  endif
1092  enddo
1093  enddo
1094  end subroutine inverse_func
1095 
1097  !----------------------------------------------------------------------*
1098  subroutine fstr_nodalstress6d( hecMESH, fstrSOLID )
1099  !----------------------------------------------------------------------*
1100  use m_static_lib
1102  type (hecmwST_local_mesh) :: hecMESH
1103  type (fstr_solid) :: fstrSOLID
1104  !C** local variables
1105  integer(kind=kint) :: itype, icel, is, iE, jS, i, j, k, it, ic, ic_type, nn, isect, ihead, ID_area, nbase
1106  integer(kind=kint) :: nodLOCAL(20), n_layer, ntot_lyr, nlyr, n_totlyr, com_total_layer, shellmatl
1107  real(kind=kreal) :: ecoord(3,9), edisp(6,9), estrain(6), estress(6), ndstrain(9,6), ndstress(9,6)
1108  real(kind=kreal) :: enqm(12)
1109  real(kind=kreal) :: triad_cur(9,9), triad_ref(9,9)
1110  real(kind=kreal) :: thick, thick_layer
1111  real(kind=kreal) :: s11, s22, s33, s12, s23, s13, t11, t22, t33, t12, t23, t13, ps, smises, tmises
1112  integer(kind=kint), allocatable :: nnumber(:)
1113  type(fstr_solid_physic_val), pointer :: layer => null()
1114 
1115  call fstr_solid_phys_clear(fstrsolid)
1116 
1117  n_totlyr = fstrsolid%max_lyr
1118 
1119  allocate( nnumber(hecmesh%n_node) )
1120  if( .not. associated(fstrsolid%is_rot) ) allocate( fstrsolid%is_rot(hecmesh%n_node) )
1121  nnumber = 0
1122  fstrsolid%is_rot = 0
1123  call fstr_ensure_finite_rotation_state(hecmesh, fstrsolid, 6)
1124 
1125  !C +-------------------------------+
1126  !C | according to ELEMENT TYPE |
1127  !C +-------------------------------+
1128  do itype = 1, hecmesh%n_elem_type
1129  is = hecmesh%elem_type_index(itype-1) + 1
1130  ie = hecmesh%elem_type_index(itype )
1131  ic_type = hecmesh%elem_type_item(itype)
1132  if( .not. (hecmw_is_etype_shell(ic_type) .or. ic_type == 611) ) then
1133  ntot_lyr = 0
1134  cycle
1135  end if
1136  if( ic_type == 611 ) ntot_lyr = 0
1137  nn = hecmw_get_max_node( ic_type )
1138  !C** element loop
1139  do icel = is, ie
1140  js = hecmesh%elem_node_index(icel-1)
1141  id_area = hecmesh%elem_ID(icel*2)
1142  do j = 1, nn
1143  nodlocal(j) = hecmesh%elem_node_item(js+j)
1144  ecoord(1,j) = hecmesh%node(3*nodlocal(j)-2)
1145  ecoord(2,j) = hecmesh%node(3*nodlocal(j)-1)
1146  ecoord(3,j) = hecmesh%node(3*nodlocal(j) )
1147  edisp(1,j) = fstrsolid%unode(6*nodlocal(j)-5)
1148  edisp(2,j) = fstrsolid%unode(6*nodlocal(j)-4)
1149  edisp(3,j) = fstrsolid%unode(6*nodlocal(j)-3)
1150  edisp(4,j) = fstrsolid%unode(6*nodlocal(j)-2)
1151  edisp(5,j) = fstrsolid%unode(6*nodlocal(j)-1)
1152  edisp(6,j) = fstrsolid%unode(6*nodlocal(j) )
1153  enddo
1154  isect = hecmesh%section_ID(icel)
1155  ihead = hecmesh%section%sect_R_index(isect-1)
1156  thick = hecmesh%section%sect_R_item(ihead+1)
1157  !--- calculate elemental stress and strain
1158  if( ic_type == 611 ) then
1159  estrain = 0.0d0
1160  estress = 0.0d0
1161  enqm = 0.0d0
1162  ndstrain = 0.0d0
1163  ndstress = 0.0d0
1164  call nodalstress_beam( ic_type, nn, ecoord, fstrsolid%elements(icel)%gausses, &
1165  & hecmesh%section%sect_R_item(ihead+1:), edisp(1:6,1:nn), &
1166  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6) )
1167  call elementalstress_beam( fstrsolid%elements(icel)%gausses, estrain, estress, enqm )
1168  fstrsolid%ENQM(icel*12-11:icel*12) = enqm(1:12)
1169  else if( ic_type == 731 .or. ic_type == 741 .or. ic_type == 743 ) then
1170  ntot_lyr = fstrsolid%elements(icel)%gausses(1)%pMaterial%totallyr
1171  if( ic_type == 741 ) then
1172  do j = 1, nn
1173  nbase = 9*(nodlocal(j)-1)
1174  triad_cur(1:9,j) = 0.0d0
1175  triad_ref(1:9,j) = 0.0d0
1176  if( associated(fstrsolid%shell_triad) ) triad_cur(1:9,j) = fstrsolid%shell_triad(nbase+1:nbase+9)
1177  if( associated(fstrsolid%shell_ref_triad) ) triad_ref(1:9,j) = fstrsolid%shell_ref_triad(nbase+1:nbase+9)
1178  enddo
1179  endif
1180  do nlyr=1,ntot_lyr
1181  if( ic_type == 741 ) then
1182  call elementstress_shell_mitc( ic_type, nn, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
1183  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6), thick, 1.0d0, nlyr, &
1184  & ndtriad=triad_cur(1:9,1:nn), ndreftriad=triad_ref(1:9,1:nn))
1185  else
1186  call elementstress_shell_mitc( ic_type, nn, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
1187  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6), thick, 1.0d0, nlyr)
1188  endif
1189  do j = 1, nn
1190  i = nodlocal(j)
1191  layer => fstrsolid%SHELL%LAYER(nlyr)%PLUS
1192  do k = 1, 6
1193  layer%STRAIN(6*(i-1)+k) = layer%STRAIN(6*(i-1)+k) + ndstrain(j,k)
1194  layer%STRESS(6*(i-1)+k) = layer%STRESS(6*(i-1)+k) + ndstress(j,k)
1195  layer%ESTRAIN(6*(icel-1)+k) = layer%ESTRAIN(6*(icel-1)+k) + ndstrain(j,k)/nn
1196  layer%ESTRESS(6*(icel-1)+k) = layer%ESTRESS(6*(icel-1)+k) + ndstress(j,k)/nn
1197  enddo
1198  enddo
1199  !minus section
1200  if( ic_type == 741 ) then
1201  call elementstress_shell_mitc( ic_type, nn, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
1202  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6), thick,-1.0d0, nlyr, &
1203  & ndtriad=triad_cur(1:9,1:nn), ndreftriad=triad_ref(1:9,1:nn))
1204  else
1205  call elementstress_shell_mitc( ic_type, nn, 6, ecoord, fstrsolid%elements(icel)%gausses, edisp, &
1206  & ndstrain(1:nn,1:6), ndstress(1:nn,1:6), thick,-1.0d0, nlyr)
1207  endif
1208  do j = 1, nn
1209  i = nodlocal(j)
1210  layer => fstrsolid%SHELL%LAYER(nlyr)%MINUS
1211  do k = 1, 6
1212  layer%STRAIN(6*(i-1)+k) = layer%STRAIN(6*(i-1)+k) + ndstrain(j,k)
1213  layer%STRESS(6*(i-1)+k) = layer%STRESS(6*(i-1)+k) + ndstress(j,k)
1214  layer%ESTRAIN(6*(icel-1)+k) = layer%ESTRAIN(6*(icel-1)+k) + ndstrain(j,k)/nn
1215  layer%ESTRESS(6*(icel-1)+k) = layer%ESTRESS(6*(icel-1)+k) + ndstress(j,k)/nn
1216  enddo
1217  enddo
1218  enddo
1219  call fstr_getavg_shell(nn,fstrsolid,icel,nodlocal,ndstrain(1:nn,1:6),ndstress(1:nn,1:6),estrain,estress)
1220  endif
1221 
1222  !if( ID_area == hecMESH%my_rank ) then
1223  !ADD VALUE and Count node
1224  do j = 1, nn
1225  ic = hecmesh%elem_node_item(js+j)
1226  fstrsolid%STRAIN(6*(ic-1)+1:6*(ic-1)+6) = fstrsolid%STRAIN(6*(ic-1)+1:6*(ic-1)+6) + ndstrain(j,1:6)
1227  fstrsolid%STRESS(6*(ic-1)+1:6*(ic-1)+6) = fstrsolid%STRESS(6*(ic-1)+1:6*(ic-1)+6) + ndstress(j,1:6)
1228  !if( associated(tnstrain) )then
1229  ! tnstrain(6*(ic-1)+1:6*(ic-1)+6) = tnstrain(6*(ic-1)+1:6*(ic-1)+6) + tdstrain(j,1:6)
1230  !endif
1231  nnumber(ic) = nnumber(ic) + 1
1232  enddo
1233 
1234  fstrsolid%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) = fstrsolid%ESTRAIN(6*(icel-1)+1:6*(icel-1)+6) + estrain(1:6)
1235  fstrsolid%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) = fstrsolid%ESTRESS(6*(icel-1)+1:6*(icel-1)+6) + estress(1:6)
1236  !endif
1237  enddo
1238  enddo
1239 
1240  !C** calculate nodal stress and strain
1241  do i = 1, hecmesh%n_node
1242  if( nnumber(i) == 0 ) cycle
1243  fstrsolid%STRAIN(6*(i-1)+1:6*(i-1)+6) = fstrsolid%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1244  fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6) = fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1245  !if( associated(tnstrain) )then
1246  ! tnstrain(6*(i-1)+1:6*(i-1)+6) = tnstrain(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1247  !endif
1248  enddo
1249 
1250  do nlyr = 1, ntot_lyr
1251  do i = 1, hecmesh%n_node
1252  if( nnumber(i) == 0 ) cycle
1253  fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRAIN(6*(i-1)+1:6*(i-1)+6) = &
1254  & fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1255  fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRESS(6*(i-1)+1:6*(i-1)+6) = &
1256  & fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1257  fstrsolid%SHELL%LAYER(nlyr)%PLUS%MISES(i) = &
1258  & get_mises(fstrsolid%SHELL%LAYER(nlyr)%PLUS%STRESS(6*(i-1)+1:6*(i-1)+6))
1259 
1260  fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRAIN(6*(i-1)+1:6*(i-1)+6) = &
1261  & fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRAIN(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1262  fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRESS(6*(i-1)+1:6*(i-1)+6) = &
1263  & fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRESS(6*(i-1)+1:6*(i-1)+6) / nnumber(i)
1264  fstrsolid%SHELL%LAYER(nlyr)%MINUS%MISES(i) = &
1265  & get_mises(fstrsolid%SHELL%LAYER(nlyr)%MINUS%STRESS(6*(i-1)+1:6*(i-1)+6))
1266  enddo
1267  enddo
1268 
1269  !C** calculate von MISES stress
1270  do i = 1, hecmesh%n_node
1271  fstrsolid%MISES(i) = get_mises(fstrsolid%STRESS(6*(i-1)+1:6*(i-1)+6))
1272  enddo
1273  do i = 1, hecmesh%n_elem
1274  fstrsolid%EMISES(i) = get_mises(fstrsolid%ESTRESS(6*(i-1)+1:6*(i-1)+6))
1275  enddo
1276 
1277  !C** calculate Elemental Plastic Strain
1278  do i = 1, hecmesh%n_elem
1279  if (.not. associated(fstrsolid%elements(i)%gausses)) cycle
1280  fstrsolid%EPLSTRAIN(i) = get_pl_estrain(fstrsolid%elements(i)%gausses)
1281  enddo
1282 
1283  deallocate( nnumber )
1284 
1285  end subroutine fstr_nodalstress6d
1286 
1287  subroutine make_principal(fstrSOLID, hecMESH, RES)
1288  use hecmw_util
1289  use m_out
1290  use m_static_lib
1291 
1292  type(fstr_solid) :: fstrSOLID
1293  type(hecmwst_local_mesh) :: hecMESH
1294  type(fstr_solid_physic_val) :: RES
1295  integer(kind=kint) :: i, flag
1296  real(kind=kreal) :: tmat(3, 3), tvec(3), strain(6)
1297 
1298  flag=ieor(flag,flag)
1299  if( fstrsolid%output_ctrl(3)%outinfo%on(19) .or. fstrsolid%output_ctrl(4)%outinfo%on(19) ) then
1300  if ( .not. associated(res%PSTRESS) ) then
1301  allocate(res%PSTRESS( 3*hecmesh%n_node ))
1302  endif
1303  flag=ior(flag,b'00000001')
1304  end if
1305  if( fstrsolid%output_ctrl(3)%outinfo%on(23) .or. fstrsolid%output_ctrl(4)%outinfo%on(23) ) then
1306  if ( .not. associated(res%PSTRESS_VECT) ) then
1307  allocate(res%PSTRESS_VECT( 3*hecmesh%n_node ,3))
1308  endif
1309  flag=ior(flag,b'00000010')
1310  end if
1311  if( fstrsolid%output_ctrl(3)%outinfo%on(21) .or. fstrsolid%output_ctrl(4)%outinfo%on(21) ) then
1312  if ( .not. associated(res%PSTRAIN) ) then
1313  allocate(res%PSTRAIN( 3*hecmesh%n_node ))
1314  endif
1315  flag=ior(flag,b'00000100')
1316  end if
1317  if( fstrsolid%output_ctrl(3)%outinfo%on(25) .or. fstrsolid%output_ctrl(4)%outinfo%on(25) ) then
1318  if ( .not. associated(res%PSTRAIN_VECT) ) then
1319  allocate(res%PSTRAIN_VECT( 3*hecmesh%n_node ,3))
1320  endif
1321  flag=ior(flag,b'00001000')
1322  end if
1323  if( fstrsolid%output_ctrl(3)%outinfo%on(20) .or. fstrsolid%output_ctrl(4)%outinfo%on(20) ) then
1324  if ( .not. associated(res%EPSTRESS) ) then
1325  allocate(res%EPSTRESS( 3*hecmesh%n_elem ))
1326  endif
1327  flag=ior(flag,b'00010000')
1328  end if
1329  if( fstrsolid%output_ctrl(3)%outinfo%on(24) .or. fstrsolid%output_ctrl(4)%outinfo%on(24) ) then
1330  if ( .not. associated(res%EPSTRESS_VECT) ) then
1331  allocate(res%EPSTRESS_VECT( 3*hecmesh%n_elem ,3))
1332  endif
1333  flag=ior(flag,b'00100000')
1334  end if
1335  if( fstrsolid%output_ctrl(3)%outinfo%on(22) .or. fstrsolid%output_ctrl(4)%outinfo%on(22) ) then
1336  if ( .not. associated(res%EPSTRAIN) ) then
1337  allocate(res%EPSTRAIN( 3*hecmesh%n_elem ))
1338  endif
1339  flag=ior(flag,b'01000000')
1340  end if
1341  if( fstrsolid%output_ctrl(3)%outinfo%on(26) .or. fstrsolid%output_ctrl(4)%outinfo%on(26) ) then
1342  if ( .not. associated(res%EPSTRAIN_VECT) ) then
1343  allocate(res%EPSTRAIN_VECT( 3*hecmesh%n_elem ,3))
1344  endif
1345  flag=ior(flag,b'10000000')
1346  end if
1347 
1348  if (iand(flag,b'00000011') /= 0) then
1349  do i = 1, hecmesh%n_node
1350  call get_principal(res%STRESS(6*i-5:6*i), tvec, tmat)
1351  if (iand(flag,b'00000001') /= 0) res%PSTRESS(3*(i-1)+1:3*(i-1)+3)=tvec
1352  if (iand(flag,b'00000010') /= 0) res%PSTRESS_VECT(3*(i-1)+1:3*(i-1)+3,1:3)=tmat
1353  end do
1354  end if
1355  if (iand(flag,b'00001100') /= 0) then
1356  do i = 1, hecmesh%n_node
1357  strain(1:6) = res%STRAIN(6*i-5:6*i)
1358  strain(4:6) = 0.5d0*strain(4:6)
1359  call get_principal(strain, tvec, tmat)
1360  if (iand(flag,b'00000100') /= 0) res%PSTRAIN(3*(i-1)+1:3*(i-1)+3)=tvec
1361  if (iand(flag,b'00001000') /= 0) res%PSTRAIN_VECT(3*(i-1)+1:3*(i-1)+3,1:3)=tmat
1362  end do
1363  end if
1364 
1365  if (iand(flag,b'00110000') /= 0) then
1366  do i = 1, hecmesh%n_elem
1367  call get_principal( res%ESTRESS(6*i-5:6*i), tvec, tmat)
1368  if (iand(flag,b'00010000') /= 0) res%EPSTRESS(3*(i-1)+1:3*(i-1)+3)=tvec
1369  if (iand(flag,b'00100000') /= 0) res%EPSTRESS_VECT(3*(i-1)+1:3*(i-1)+3,1:3)=tmat
1370  end do
1371  end if
1372  if (iand(flag,b'11000000') /= 0) then
1373  do i = 1, hecmesh%n_elem
1374  strain(1:6) = res%ESTRAIN(6*i-5:6*i)
1375  strain(4:6) = 0.5d0*strain(4:6)
1376  call get_principal(strain, tvec, tmat)
1377  if (iand(flag,b'01000000') /= 0) res%EPSTRAIN(3*(i-1)+1:3*(i-1)+3)=tvec
1378  if (iand(flag,b'10000000') /= 0) res%EPSTRAIN_VECT(3*(i-1)+1:3*(i-1)+3,1:3)=tmat
1379  end do
1380  end if
1381  end subroutine make_principal
1382 
1383 end module m_fstr_nodalstress
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
Finite-rotation nodal kinematics for NLGEOM.
subroutine, public fstr_ensure_finite_rotation_state(hecMESH, fstrSOLID, ndof)
Build the per-node reference frames once, by averaging element shell triads at shared nodes....
This module provides functions to calculation nodal stress.
subroutine get_shell_layer_gauss_average(element, estrain, estress)
subroutine set_shell_layer_surface_results(element, fstrSOLID, icel)
subroutine fstr_stress_add_shelllyr(nn, fstrSOLID, icel, nodLOCAL, nlyr, strain, stress, flag)
real(kind=kreal) function get_pl_estrain(gausses)
subroutine fstr_nodalstress3d(hecMESH, fstrSOLID)
Calculate NODAL STRESS of solid elements.
subroutine fstr_nodalstress6d(hecMESH, fstrSOLID)
Calculate NODAL STRESS of shell elements.
real(kind=kreal) function get_mises(s)
subroutine fstr_nodalstress3d_c3d4_sesns(hecMESH, fstrSOLID, nnumber, Nodal_STRAIN, Nodal_STRESS, Elemental_STRAIN, Elemental_STRESS)
subroutine fstr_nodalstress2d(hecMESH, fstrSOLID)
Calculate NODAL STRESS of plane elements.
subroutine get_shell_layer_surface_average(element, ilayer, flag, estrain, estress)
subroutine make_principal(fstrSOLID, hecMESH, RES)
integer(kind=kint) function search_idx_senes(irow, asect, nid, sid)
subroutine fstr_getavg_shell(nn, fstrSOLID, icel, nodLOCAL, strain, stress, estrain, estress)
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter kel341sesns
Definition: m_fstr.F90:77
subroutine fstr_solid_phys_clear(fstrSOLID)
Definition: m_fstr.F90:1195
This module manages step information.
Definition: m_out.f90:6
This modules just summarizes all modules used in static analysis.
Definition: static_LIB.f90:6
This modules defines a structure to record history dependent parameter in static analysis.
Definition: mechgauss.f90:6
Data for STATIC ANSLYSIS (fstrSOLID)
Definition: m_fstr.F90:216
All data should be recorded in every quadrature points.
Definition: mechgauss.f90:15