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
11  implicit none
12 
13  ! ----------------------------------------------------------------------------
16  type(tmaterial), pointer :: pmaterial => null()
17  real(kind=kreal) :: strain(6)
18  real(kind=kreal) :: stress(6)
19  integer, pointer :: istatus(:) =>null()
20  real(kind=kreal), pointer :: fstatus(:) => null()
21  real(kind=kreal) :: plstrain
22  real(kind=kreal) :: strain_bak(6)
23  real(kind=kreal) :: stress_bak(6)
24  real(kind=kreal) :: nqm(12)
25  real(kind=kreal) :: strain_out(6)
26  real(kind=kreal) :: stress_out(6)
27  real(kind=kreal) :: strain_energy
28  real(kind=kreal) :: strain_energy_bak
29  real(kind=kreal) :: plpotential
30  end type
31 
32  ! ----------------------------------------------------------------------------
34  type telement
35  integer :: etype
36  integer :: iset
37  real(kind=kreal), pointer :: equiforces(:) => null()
38  type(tgaussstatus), pointer :: gausses(:) => null()
39  type(tgaussstatus), pointer :: shell_layer_gausses(:) => null()
40  integer(kind=kint) :: shell_nlayer = 0
41  integer(kind=kint) :: shell_nthick = 0
42  real(kind=kreal), pointer :: aux(:,:) => null()
43  integer :: elemact_flag
44  real(kind=kreal) :: elemact_coeff
45  real(kind=kreal) :: p(1)
46  end type
47 
48 contains
49 
51  subroutine fstr_init_gauss( gauss )
53  type( tgaussstatus ), intent(inout) :: gauss
54  integer :: n
55  gauss%strain=0.d0; gauss%stress=0.d0
56  gauss%strain_bak=0.d0; gauss%stress_bak=0.d0
57  gauss%strain_out=0.d0; gauss%stress_out=0.d0
58  gauss%plstrain =0.d0
59  gauss%plpotential =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 
104  integer(kind=kint) function fstr_shell_num_thickness_points( etype )
105  integer(kind=kint), intent(in) :: etype
106 
109 
111  subroutine fstr_init_shell_layer_gausses( element, ng, nlayer, nthick )
112  type( telement ), intent(inout) :: element
113  integer(kind=kint), intent(in) :: ng, nlayer, nthick
114  integer(kind=kint) :: i, nstatus
115 
116  if( ng <= 0 .or. nlayer <= 0 .or. nthick <= 0 ) return
117  if( .not. associated( element%gausses ) ) return
118  if( associated( element%shell_layer_gausses ) ) return
119 
120  nstatus = ng*nlayer*nthick
121  allocate( element%shell_layer_gausses( nstatus ) )
122  element%shell_nlayer = nlayer
123  element%shell_nthick = nthick
124 
125  do i = 1, nstatus
126  element%shell_layer_gausses(i)%pMaterial => element%gausses(1)%pMaterial
127  call fstr_init_gauss( element%shell_layer_gausses(i) )
128  enddo
129  end subroutine fstr_init_shell_layer_gausses
130 
132  integer(kind=kint) function fstr_shell_layer_gauss_index( element, ig, ilayer, ithick )
133  type( telement ), intent(in) :: element
134  integer(kind=kint), intent(in) :: ig, ilayer, ithick
135  integer(kind=kint) :: ngauss
136 
138  if( .not. associated( element%gausses ) ) return
139  if( .not. associated( element%shell_layer_gausses ) ) return
140  if( element%shell_nlayer <= 0 .or. element%shell_nthick <= 0 ) return
141  if( ilayer < 1 .or. ilayer > element%shell_nlayer ) return
142  if( ithick < 1 .or. ithick > element%shell_nthick ) return
143 
144  ngauss = size( element%gausses )
145  if( ig < 1 .or. ig > ngauss ) return
146  if( size( element%shell_layer_gausses ) < ngauss*element%shell_nlayer*element%shell_nthick ) return
147 
148  fstr_shell_layer_gauss_index = ((ig-1)*element%shell_nlayer + ilayer-1) &
149  *element%shell_nthick + ithick
150  end function fstr_shell_layer_gauss_index
151 
153  subroutine fstr_shell_thickness_quadrature( etype, ithick, zeta, weight, ierr )
154  integer(kind=kint), intent(in) :: etype, ithick
155  real(kind=kreal), intent(out) :: zeta, weight
156  integer(kind=kint), intent(out) :: ierr
157 
158  ierr = 0
159  zeta = 0.0d0
160  weight = 0.0d0
161 
162  if( ithick < 1 .or. ithick > numofshellthicknessquadpoints(etype) ) then
163  ierr = 1
164  return
165  endif
166 
167  call getshellthicknessquadpoint(etype, ithick, zeta)
168  weight = getshellthicknessweight(etype, ithick)
169  end subroutine fstr_shell_thickness_quadrature
170 
172  subroutine fstr_shell_layer_quadrature( element, ilayer, ithick, zeta_layer, weight, ierr )
173  type( telement ), intent(in) :: element
174  integer(kind=kint), intent(in) :: ilayer, ithick
175  real(kind=kreal), intent(out) :: zeta_layer, weight
176  integer(kind=kint), intent(out) :: ierr
177 
178  ierr = 0
179  zeta_layer = 0.0d0
180  weight = 0.0d0
181 
182  if( .not. associated( element%gausses ) ) then
183  ierr = 1
184  return
185  endif
186 
187  call fstr_shell_layer_quadrature_gauss( element%etype, element%gausses(1), ilayer, ithick, &
188  zeta_layer, weight, ierr )
189  end subroutine fstr_shell_layer_quadrature
190 
192  subroutine fstr_shell_layer_quadrature_gauss( etype, gauss, ilayer, ithick, zeta_layer, weight, ierr )
193  integer(kind=kint), intent(in) :: etype, ilayer, ithick
194  type( tgaussstatus ), intent(in) :: gauss
195  real(kind=kreal), intent(out) :: zeta_layer, weight
196  integer(kind=kint), intent(out) :: ierr
197  real(kind=kreal) :: zeta
198 
199  ierr = 0
200  zeta_layer = 0.0d0
201  weight = 0.0d0
202 
203  call fstr_shell_thickness_quadrature( etype, ithick, zeta, weight, ierr )
204  if( ierr /= 0 ) return
205  call fstr_shell_layer_zeta( gauss, ilayer, zeta, zeta_layer, ierr )
206  end subroutine fstr_shell_layer_quadrature_gauss
207 
209  subroutine fstr_shell_layer_zeta( gauss, ilayer, zeta, zeta_layer, ierr )
210  type( tgaussstatus ), intent(in) :: gauss
211  integer(kind=kint), intent(in) :: ilayer
212  real(kind=kreal), intent(in) :: zeta
213  real(kind=kreal), intent(out) :: zeta_layer
214  integer(kind=kint), intent(out) :: ierr
215  integer(kind=kint) :: i
216  real(kind=kreal) :: sumlyr
217 
218  ierr = 0
219  zeta_layer = 0.0d0
220 
221  if( .not. associated( gauss%pMaterial ) ) then
222  ierr = 1
223  return
224  endif
225  if( ilayer < 1 .or. ilayer > gauss%pMaterial%totallyr ) then
226  ierr = 1
227  return
228  endif
229 
230  sumlyr = 0.0d0
231  do i = 1, ilayer
232  sumlyr = sumlyr + 2.0d0*gauss%pMaterial%shell_var(i)%weight
233  enddo
234  zeta_layer = -1.0d0 + sumlyr - gauss%pMaterial%shell_var(ilayer)%weight*(1.0d0-zeta)
235  end subroutine fstr_shell_layer_zeta
236 
238  subroutine fstr_finalize_shell_layer_gausses( element )
239  type( telement ), intent(inout) :: element
240  integer(kind=kint) :: i
241 
242  if( associated( element%shell_layer_gausses ) ) then
243  do i = 1, size( element%shell_layer_gausses )
244  call fstr_finalize_gauss( element%shell_layer_gausses(i) )
245  enddo
246  deallocate( element%shell_layer_gausses )
247  endif
248  element%shell_nlayer = 0
249  element%shell_nthick = 0
250  end subroutine fstr_finalize_shell_layer_gausses
251 
253  subroutine fstr_copy_gauss( gauss1, gauss2 )
254  type( tgaussstatus ), intent(in) :: gauss1
255  type( tgaussstatus ), intent(inout) :: gauss2
256 
257  gauss2%strain = gauss1%strain
258  gauss2%stress = gauss1%stress
259  gauss2%strain_bak = gauss1%strain_bak
260  gauss2%stress_bak = gauss1%stress_bak
261  gauss2%nqm = gauss1%nqm
262  gauss2%strain_out = gauss1%strain_out
263  gauss2%stress_out = gauss1%stress_out
264  gauss2%plstrain = gauss1%plstrain
265  gauss2%strain_energy = gauss1%strain_energy
266  gauss2%strain_energy_bak = gauss1%strain_energy_bak
267  gauss2%plpotential = gauss1%plpotential
268 
269  if( associated(gauss1%istatus) .and. associated(gauss2%istatus) ) then
270  gauss2%istatus = gauss1%istatus
271  end if
272  if( associated(gauss1%fstatus) .and. associated(gauss2%fstatus) ) then
273  gauss2%fstatus = gauss1%fstatus
274  end if
275  end subroutine fstr_copy_gauss
276 
278  subroutine fstr_copy_shell_layer_gausses( element1, element2 )
279  type( telement ), intent(in) :: element1
280  type( telement ), intent(inout) :: element2
281  integer(kind=kint) :: i
282 
283  if( .not. associated( element1%shell_layer_gausses ) ) return
284  if( .not. associated( element2%shell_layer_gausses ) ) return
285  if( size( element1%shell_layer_gausses ) /= size( element2%shell_layer_gausses ) ) return
286 
287  do i = 1, size( element1%shell_layer_gausses )
288  call fstr_copy_gauss( element1%shell_layer_gausses(i), element2%shell_layer_gausses(i) )
289  enddo
290  end subroutine fstr_copy_shell_layer_gausses
291 
292 
293 end module
This module encapsulate the basic functions of all elements provide by this software.
Definition: element.f90:43
subroutine getshellthicknessquadpoint(etype, np, zeta)
Fetch the through-thickness quadrature coordinate of a shell element.
Definition: element.f90:503
integer function numofshellthicknessquadpoints(etype)
Obtains the number of through-thickness quadrature points of a shell element.
Definition: element.f90:489
real(kind=kreal) function getshellthicknessweight(etype, np)
Fetch the through-thickness quadrature weight of a shell element.
Definition: element.f90:521
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:291
character(len=dict_key_length) mc_viscoelastic
Definition: material.f90:144
integer(kind=kint), parameter norton
Definition: material.f90:78
logical function iskinematicharden(mtype)
If it is a kinematic hardening material?
Definition: material.f90:315
integer(kind=kint), parameter usermaterial
Definition: material.f90:63
logical function isviscoelastic(mtype)
If it is an viscoelastic material?
Definition: material.f90:351
logical function iselastoplastic(mtype)
If it is an elastoplastic material?
Definition: material.f90:333
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)
Compatibility accessor for shell history allocation. The quadrature rule itself is defined in element...
Definition: mechgauss.f90:105
subroutine fstr_shell_layer_zeta(gauss, ilayer, zeta, zeta_layer, ierr)
Map layer-local zeta to the whole shell thickness coordinate.
Definition: mechgauss.f90:210
subroutine fstr_init_gauss(gauss)
Initializer.
Definition: mechgauss.f90:52
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:193
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:112
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:133
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:154
subroutine fstr_shell_layer_quadrature(element, ilayer, ithick, zeta_layer, weight, ierr)
Layer-local shell thickness coordinate and quadrature weight.
Definition: mechgauss.f90:173
subroutine fstr_finalize_shell_layer_gausses(element)
Release shell layer/thickness history.
Definition: mechgauss.f90:239
subroutine fstr_copy_gauss(gauss1, gauss2)
Copy.
Definition: mechgauss.f90:254
subroutine fstr_copy_shell_layer_gausses(element1, element2)
Copy shell layer/thickness history.
Definition: mechgauss.f90:279
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
Structure to manage all material related data.
Definition: material.f90:166
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