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