FrontISTR  5.9.0
Large-scale structural analysis program with finit element method
mechgauss.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 !-------------------------------------------------------------------------------
6 module mmechgauss
7  use hecmw_util
8  use mmaterial
12  implicit none
13 
14  ! ----------------------------------------------------------------------------
17  type(tmaterial), pointer :: pmaterial => null()
18  real(kind=kreal) :: strain(6)
19  real(kind=kreal) :: stress(6)
20  integer, pointer :: istatus(:) =>null()
21  real(kind=kreal), pointer :: fstatus(:) => null()
22  real(kind=kreal) :: plstrain
23  real(kind=kreal) :: strain_bak(6)
24  real(kind=kreal) :: stress_bak(6)
25  real(kind=kreal) :: nqm(12)
26  real(kind=kreal) :: strain_out(6)
27  real(kind=kreal) :: stress_out(6)
28  real(kind=kreal) :: strain_energy
29  real(kind=kreal) :: strain_energy_bak
30  real(kind=kreal) :: plpotential
31  end type
32 
33  ! ----------------------------------------------------------------------------
35  type telement
36  integer :: etype
37  integer :: iset
38  real(kind=kreal), pointer :: equiforces(:) => null()
39  type(tgaussstatus), pointer :: gausses(:) => null()
40  type(tgaussstatus), pointer :: shell_layer_gausses(:) => null()
41  integer(kind=kint) :: shell_nlayer = 0
42  integer(kind=kint) :: shell_nthick = 0
43  real(kind=kreal), pointer :: aux(:,:) => null()
44  integer :: elemact_flag
45  real(kind=kreal) :: elemact_coeff
46  real(kind=kreal) :: p(1)
47  end type
48 
49 contains
50 
52  subroutine fstr_init_gauss( gauss )
54  type( tgaussstatus ), intent(inout) :: gauss
55  integer :: n
56  gauss%strain=0.d0; gauss%stress=0.d0
57  gauss%strain_bak=0.d0; gauss%stress_bak=0.d0
58  gauss%strain_out=0.d0; gauss%stress_out=0.d0
59  gauss%plstrain =0.d0
60  gauss%nqm =0.d0
61  gauss%strain_energy =0.d0
62  gauss%strain_energy_bak =0.d0
63  if( gauss%pMaterial%mtype==usermaterial ) then
64  if( gauss%pMaterial%nfstatus> 0 ) then
65  allocate( gauss%fstatus(gauss%pMaterial%nfstatus) )
66  gauss%fstatus(:) = 0.d0
67  endif
68  else if( iselastoplastic(gauss%pMaterial%mtype) ) then
69  allocate( gauss%istatus(1) ) ! 0:elastic 1:plastic
70  if( getyieldfunction( gauss%pMaterial%mtype )==3 ) then ! user defined
71  n = uelastoplasticnumstatus( gauss%pMaterial%variables )
72  if( n>0 ) allocate( gauss%fstatus(n) )
73  elseif( iskinematicharden( gauss%pMaterial%mtype ) ) then
74  allocate( gauss%fstatus(7+6) ) ! plastic strain, back stress
75  else
76  allocate( gauss%fstatus(2) ) ! plastic strain
77  endif
78  gauss%istatus = 0
79  gauss%fstatus = 0.d0
80  else if( isviscoelastic(gauss%pMaterial%mtype) ) then
81  n = fetch_tablerow( mc_viscoelastic, gauss%pMaterial%dict )
82  if( n>0 ) then
83  allocate( gauss%fstatus(12*n+6) ) ! visco stress components
84  gauss%fstatus = 0.d0
85  else
86  stop "Viscoelastic properties not defined"
87  endif
88  else if( gauss%pMaterial%mtype==norton ) then
89  allocate( gauss%fstatus(2) ) ! effective stress, effective viscoplastic strain
90  gauss%fstatus = 0.d0
91  gauss%plstrain = 0.d0
92  endif
93  end subroutine fstr_init_gauss
94 
96  subroutine fstr_finalize_gauss( gauss )
97  type( tgaussstatus ), intent(inout) :: gauss
98  if( associated( gauss%istatus ) ) deallocate( gauss%istatus )
99  if( associated( gauss%fstatus ) ) deallocate( gauss%fstatus )
100  end subroutine
101 
103  integer(kind=kint) function fstr_shell_num_thickness_points( etype )
104  integer(kind=kint), intent(in) :: etype
105 
106  select case( etype )
109  case( fe_mitc9_shell )
111  case default
113  end select
115 
117  subroutine fstr_init_shell_layer_gausses( element, ng, nlayer, nthick )
118  type( telement ), intent(inout) :: element
119  integer(kind=kint), intent(in) :: ng, nlayer, nthick
120  integer(kind=kint) :: i, nstatus
121 
122  if( ng <= 0 .or. nlayer <= 0 .or. nthick <= 0 ) return
123  if( .not. associated( element%gausses ) ) return
124  if( associated( element%shell_layer_gausses ) ) return
125 
126  nstatus = ng*nlayer*nthick
127  allocate( element%shell_layer_gausses( nstatus ) )
128  element%shell_nlayer = nlayer
129  element%shell_nthick = nthick
130 
131  do i = 1, nstatus
132  element%shell_layer_gausses(i)%pMaterial => element%gausses(1)%pMaterial
133  call fstr_init_gauss( element%shell_layer_gausses(i) )
134  enddo
135  end subroutine fstr_init_shell_layer_gausses
136 
138  integer(kind=kint) function fstr_shell_layer_gauss_index( element, ig, ilayer, ithick )
139  type( telement ), intent(in) :: element
140  integer(kind=kint), intent(in) :: ig, ilayer, ithick
141  integer(kind=kint) :: ngauss
142 
144  if( .not. associated( element%gausses ) ) return
145  if( .not. associated( element%shell_layer_gausses ) ) return
146  if( element%shell_nlayer <= 0 .or. element%shell_nthick <= 0 ) return
147  if( ilayer < 1 .or. ilayer > element%shell_nlayer ) return
148  if( ithick < 1 .or. ithick > element%shell_nthick ) return
149 
150  ngauss = size( element%gausses )
151  if( ig < 1 .or. ig > ngauss ) return
152  if( size( element%shell_layer_gausses ) < ngauss*element%shell_nlayer*element%shell_nthick ) return
153 
154  fstr_shell_layer_gauss_index = ((ig-1)*element%shell_nlayer + ilayer-1) &
155  *element%shell_nthick + ithick
156  end function fstr_shell_layer_gauss_index
157 
159  subroutine fstr_shell_thickness_quadrature( etype, ithick, zeta, weight, ierr )
160  integer(kind=kint), intent(in) :: etype, ithick
161  real(kind=kreal), intent(out) :: zeta, weight
162  integer(kind=kint), intent(out) :: ierr
163 
164  ierr = 0
165  zeta = 0.0d0
166  weight = 0.0d0
167 
168  select case( etype )
170  if( ithick < 1 .or. ithick > 2 ) then
171  ierr = 1
172  return
173  endif
174  zeta = gauss1d2(1, ithick)
175  weight = weight1d2(ithick)
176  case( fe_mitc9_shell )
177  if( ithick < 1 .or. ithick > 3 ) then
178  ierr = 1
179  return
180  endif
181  zeta = gauss1d3(1, ithick)
182  weight = weight1d3(ithick)
183  case default
184  ierr = 1
185  end select
186  end subroutine fstr_shell_thickness_quadrature
187 
189  subroutine fstr_shell_layer_quadrature( element, ilayer, ithick, zeta_layer, weight, ierr )
190  type( telement ), intent(in) :: element
191  integer(kind=kint), intent(in) :: ilayer, ithick
192  real(kind=kreal), intent(out) :: zeta_layer, weight
193  integer(kind=kint), intent(out) :: ierr
194 
195  ierr = 0
196  zeta_layer = 0.0d0
197  weight = 0.0d0
198 
199  if( .not. associated( element%gausses ) ) then
200  ierr = 1
201  return
202  endif
203 
204  call fstr_shell_layer_quadrature_gauss( element%etype, element%gausses(1), ilayer, ithick, &
205  zeta_layer, weight, ierr )
206  end subroutine fstr_shell_layer_quadrature
207 
209  subroutine fstr_shell_layer_quadrature_gauss( etype, gauss, ilayer, ithick, zeta_layer, weight, ierr )
210  integer(kind=kint), intent(in) :: etype, ilayer, ithick
211  type( tgaussstatus ), intent(in) :: gauss
212  real(kind=kreal), intent(out) :: zeta_layer, weight
213  integer(kind=kint), intent(out) :: ierr
214  real(kind=kreal) :: zeta
215 
216  ierr = 0
217  zeta_layer = 0.0d0
218  weight = 0.0d0
219 
220  call fstr_shell_thickness_quadrature( etype, ithick, zeta, weight, ierr )
221  if( ierr /= 0 ) return
222  call fstr_shell_layer_zeta( gauss, ilayer, zeta, zeta_layer, ierr )
223  end subroutine fstr_shell_layer_quadrature_gauss
224 
226  subroutine fstr_shell_layer_zeta( gauss, ilayer, zeta, zeta_layer, ierr )
227  type( tgaussstatus ), intent(in) :: gauss
228  integer(kind=kint), intent(in) :: ilayer
229  real(kind=kreal), intent(in) :: zeta
230  real(kind=kreal), intent(out) :: zeta_layer
231  integer(kind=kint), intent(out) :: ierr
232  integer(kind=kint) :: i
233  real(kind=kreal) :: sumlyr
234 
235  ierr = 0
236  zeta_layer = 0.0d0
237 
238  if( .not. associated( gauss%pMaterial ) ) then
239  ierr = 1
240  return
241  endif
242  if( ilayer < 1 .or. ilayer > gauss%pMaterial%totallyr ) then
243  ierr = 1
244  return
245  endif
246 
247  sumlyr = 0.0d0
248  do i = 1, ilayer
249  sumlyr = sumlyr + 2.0d0*gauss%pMaterial%shell_var(i)%weight
250  enddo
251  zeta_layer = -1.0d0 + sumlyr - gauss%pMaterial%shell_var(ilayer)%weight*(1.0d0-zeta)
252  end subroutine fstr_shell_layer_zeta
253 
255  subroutine fstr_finalize_shell_layer_gausses( element )
256  type( telement ), intent(inout) :: element
257  integer(kind=kint) :: i
258 
259  if( associated( element%shell_layer_gausses ) ) then
260  do i = 1, size( element%shell_layer_gausses )
261  call fstr_finalize_gauss( element%shell_layer_gausses(i) )
262  enddo
263  deallocate( element%shell_layer_gausses )
264  endif
265  element%shell_nlayer = 0
266  element%shell_nthick = 0
267  end subroutine fstr_finalize_shell_layer_gausses
268 
270  subroutine fstr_copy_gauss( gauss1, gauss2 )
271  type( tgaussstatus ), intent(in) :: gauss1
272  type( tgaussstatus ), intent(inout) :: gauss2
273 
274  gauss2%strain = gauss1%strain
275  gauss2%stress = gauss1%stress
276  gauss2%strain_bak = gauss1%strain_bak
277  gauss2%stress_bak = gauss1%stress_bak
278  gauss2%nqm = gauss1%nqm
279  gauss2%strain_out = gauss1%strain_out
280  gauss2%stress_out = gauss1%stress_out
281  gauss2%plstrain = gauss1%plstrain
282  gauss2%strain_energy = gauss1%strain_energy
283  gauss2%strain_energy_bak = gauss1%strain_energy_bak
284  gauss2%plpotential = gauss1%plpotential
285 
286  if( associated(gauss1%istatus) .and. associated(gauss2%istatus) ) then
287  gauss2%istatus = gauss1%istatus
288  end if
289  if( associated(gauss1%fstatus) .and. associated(gauss2%fstatus) ) then
290  gauss2%fstatus = gauss1%fstatus
291  end if
292  end subroutine fstr_copy_gauss
293 
295  subroutine fstr_copy_shell_layer_gausses( element1, element2 )
296  type( telement ), intent(in) :: element1
297  type( telement ), intent(inout) :: element2
298  integer(kind=kint) :: i
299 
300  if( .not. associated( element1%shell_layer_gausses ) ) return
301  if( .not. associated( element2%shell_layer_gausses ) ) return
302  if( size( element1%shell_layer_gausses ) /= size( element2%shell_layer_gausses ) ) return
303 
304  do i = 1, size( element1%shell_layer_gausses )
305  call fstr_copy_gauss( element1%shell_layer_gausses(i), element2%shell_layer_gausses(i) )
306  enddo
307  end subroutine fstr_copy_shell_layer_gausses
308 
309 
310 end module
This module encapsulate the basic functions of all elements provide by this software.
Definition: element.f90:43
integer, parameter fe_mitc3_shell361
Definition: element.f90:98
integer, parameter fe_mitc4_shell
Definition: element.f90:94
integer, parameter fe_mitc9_shell
Definition: element.f90:96
integer, parameter fe_mitc4_shell361
Definition: element.f90:99
integer, parameter fe_mitc3_shell
Definition: element.f90:93
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal
This module summarizes all information of material properties.
Definition: material.f90:6
integer function getyieldfunction(mtype)
Get type of yield function.
Definition: material.f90:321
character(len=dict_key_length) mc_viscoelastic
Definition: material.f90:145
integer(kind=kint), parameter norton
Definition: material.f90:78
logical function iskinematicharden(mtype)
If it is a kinematic hardening material?
Definition: material.f90:345
integer(kind=kint), parameter usermaterial
Definition: material.f90:63
logical function isviscoelastic(mtype)
If it is an viscoelastic material?
Definition: material.f90:381
logical function iselastoplastic(mtype)
If it is an elastoplastic material?
Definition: material.f90:363
This modules defines a structure to record history dependent parameter in static analysis.
Definition: mechgauss.f90:6
integer(kind=kint) function fstr_shell_num_thickness_points(etype)
Number of through-thickness quadrature points used by shell stiffness.
Definition: mechgauss.f90:104
subroutine fstr_shell_layer_zeta(gauss, ilayer, zeta, zeta_layer, ierr)
Map layer-local zeta to the whole shell thickness coordinate.
Definition: mechgauss.f90:227
subroutine fstr_init_gauss(gauss)
Initializer.
Definition: mechgauss.f90:53
subroutine fstr_shell_layer_quadrature_gauss(etype, gauss, ilayer, ithick, zeta_layer, weight, ierr)
Layer-local shell thickness coordinate and quadrature weight from material status.
Definition: mechgauss.f90:210
subroutine fstr_init_shell_layer_gausses(element, ng, nlayer, nthick)
Allocate shell history for every surface Gauss point, layer, and thickness point.
Definition: mechgauss.f90:118
integer(kind=kint) function fstr_shell_layer_gauss_index(element, ig, ilayer, ithick)
Convert surface Gauss/layer/thickness indices to shell_layer_gausses index.
Definition: mechgauss.f90:139
subroutine fstr_finalize_gauss(gauss)
Finializer.
Definition: mechgauss.f90:97
subroutine fstr_shell_thickness_quadrature(etype, ithick, zeta, weight, ierr)
Through-thickness quadrature point and weight used by shell elements.
Definition: mechgauss.f90:160
subroutine fstr_shell_layer_quadrature(element, ilayer, ithick, zeta_layer, weight, ierr)
Layer-local shell thickness coordinate and quadrature weight.
Definition: mechgauss.f90:190
subroutine fstr_finalize_shell_layer_gausses(element)
Release shell layer/thickness history.
Definition: mechgauss.f90:256
subroutine fstr_copy_gauss(gauss1, gauss2)
Copy.
Definition: mechgauss.f90:271
subroutine fstr_copy_shell_layer_gausses(element1, element2)
Copy shell layer/thickness history.
Definition: mechgauss.f90:296
This subroutine read in used-defined material properties tangent.
Definition: uyield.f90:7
integer(kind=kint) function, public uelastoplasticnumstatus(matl)
This function returns the number of real state variables.
Definition: uyield.f90:25
This module contains Gauss point information.
Definition: quadrature.f90:28
real(kind=kreal), dimension(2) weight1d2
Definition: quadrature.f90:32
real(kind=kreal), dimension(1, 2) gauss1d2
Definition: quadrature.f90:32
real(kind=kreal), dimension(1, 3) gauss1d3
Definition: quadrature.f90:32
real(kind=kreal), dimension(3) weight1d3
Definition: quadrature.f90:32
Structure to manage all material related data.
Definition: material.f90:167
All data should be recorded in every elements.
Definition: mechgauss.f90:35
All data should be recorded in every quadrature points.
Definition: mechgauss.f90:16