FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
m_step.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 m_step
7  use hecmw
9 
10  implicit none
11 
12  integer, parameter :: stepstatic = 1
13  integer, parameter :: stepvisco = 2
14  integer, parameter :: stepfixedinc = 1
15  integer, parameter :: stepautoinc = 2
16  integer, parameter :: stepampramp = 1 ! prescribed disp. ramped over the step (default for static)
17  integer, parameter :: stepampstep = 2 ! prescribed disp. applied in full at step start (default for visco)
18 
19  ! statistics of newton iteration
20  integer(kind=kint),parameter :: knstmaxit = 1 ! maximum number of newton iteration
21  integer(kind=kint),parameter :: knstsumit = 2 ! total number of newton iteration
22  integer(kind=kint),parameter :: knstciter = 3 ! number of contact iteration
23  integer(kind=kint),parameter :: knstdresn = 4 ! reason of not to converged
24 
25  ! indices of the convergence criteria: (quantity, DOF group, norm)
26  integer(kind=kint),parameter :: kcnvresidual = 1
27  integer(kind=kint),parameter :: kcnvcorrection = 2
28  integer(kind=kint),parameter :: kcnvtranslation = 1
29  integer(kind=kint),parameter :: kcnvrotation = 2
30  integer(kind=kint),parameter :: kcnvlagrange = 3
31  integer(kind=kint),parameter :: kcnvl2 = 1
32  integer(kind=kint),parameter :: kcnvmax = 2
33 
35  type step_info
36  integer :: solution
37  integer :: inc_type
38  character( len=80 ) :: control
39  character( len=80 ) :: convcontrol
41  real(kind=kreal) :: converg
42  real(kind=kreal) :: converg_lag
43  real(kind=kreal) :: converg_ddisp
44  real(kind=kreal) :: maxres
45  logical :: cnv_check(2,3,2)
46  real(kind=kreal) :: cnv_tol(2,3,2)
47 
48  integer :: num_substep
49  integer :: max_iter
50  integer :: max_contiter
51  integer :: amp_id
52  integer :: amp_default_type
53  real(kind=kreal) :: initdt
54  real(kind=kreal) :: elapsetime
55  real(kind=kreal) :: mindt
56  real(kind=kreal) :: maxdt
57  real(kind=kreal) :: starttime
58  integer, pointer :: boundary(:)=>null()
59  integer, pointer :: load(:)=>null()
60  integer, pointer :: contact(:)=>null()
61  integer, pointer :: elemactivation(:)=>null()
62  integer :: timepoint_id
63  integer :: aincparam_id
64  end type
65 
67  character(HECMW_NAME_LEN) :: name
68  real(kind=kreal) :: ainc_rs
69  real(kind=kreal) :: ainc_rl
70  integer( kind=kint ) :: nrbound_s(10)
71  integer( kind=kint ) :: nrbound_l(10)
72  integer( kind=kint ) :: nrtimes_s
73  integer( kind=kint ) :: nrtimes_l
74  real(kind=kreal) :: ainc_rc
75  integer( kind=kint ) :: cbbound
76  end type
77 
80  character(HECMW_NAME_LEN) :: name
81  logical :: given(2,3,2)
82  logical :: check(2,3,2)
83  real(kind=kreal) :: tol(2,3,2)
84  end type
85 
86 contains
87 
89  subroutine init_stepinfo( stepinfo )
90  type( step_info ), intent(out) :: stepinfo
91  stepinfo%solution = stepstatic
92  stepinfo%inc_type = stepfixedinc
93  stepinfo%num_substep = 1
94  stepinfo%max_iter = 50
95  stepinfo%max_contiter = 10
96  stepinfo%amp_id = -1
97  stepinfo%amp_default_type = stepampramp
98  stepinfo%initdt = 1.d0
99  stepinfo%mindt = 1.d-4
100  stepinfo%maxdt = 1.d0
101  stepinfo%elapsetime = 1.d0
102  stepinfo%starttime = 0.d0
103  stepinfo%converg = 1.d-3
104  ! The multiplier criterion guards against a gap constraint left unsatisfied, which the force residual cannot
105  ! see; the accuracy of the solution is carried by the residual criterion, so this one is left loose enough
106  ! that it does not decide the iteration count on its own.
107  stepinfo%converg_lag = 1.d-2
108  stepinfo%converg_ddisp = 1.d-8
109  stepinfo%maxres = 1.d+10
110  stepinfo%timepoint_id = 0
111  stepinfo%AincParam_id = 0
112  call setup_stepinfo_converg( stepinfo )
113  end subroutine
114 
117  subroutine setup_stepinfo_converg( stepinfo, cnvparam )
118  type( step_info ), intent(inout) :: stepinfo
119  type( tparamconverg ), intent(in), optional :: cnvparam
120 
121  integer :: iq, ig, inorm
122 
123  stepinfo%cnv_check(:,:,:) = .false.
124  stepinfo%cnv_tol(:,:,:) = 0.d0
125  stepinfo%cnv_check(kcnvresidual, kcnvtranslation:kcnvrotation, kcnvl2) = .true.
126  stepinfo%cnv_tol(kcnvresidual, kcnvtranslation:kcnvrotation, kcnvl2) = stepinfo%converg
127  stepinfo%cnv_check(kcnvcorrection, kcnvtranslation:kcnvrotation, kcnvl2) = .true.
128  stepinfo%cnv_tol(kcnvcorrection, kcnvtranslation:kcnvrotation, kcnvl2) = stepinfo%converg_ddisp
129  stepinfo%cnv_check(kcnvcorrection, kcnvlagrange, kcnvl2) = .true.
130  stepinfo%cnv_tol(kcnvcorrection, kcnvlagrange, kcnvl2) = stepinfo%converg_lag
131  if( .not. present(cnvparam) ) return
132  do inorm = kcnvl2, kcnvmax
135  if( .not. cnvparam%given(iq,ig,inorm) ) cycle
136  stepinfo%cnv_check(iq,ig,inorm) = cnvparam%check(iq,ig,inorm)
137  stepinfo%cnv_tol(iq,ig,inorm) = cnvparam%tol(iq,ig,inorm)
138  end do
139  end do
140  end do
141  end subroutine
142 
143  subroutine setup_stepinfo_starttime( stepinfos )
144  type( step_info ), pointer, intent(inout) :: stepinfos(:)
145 
146  integer :: i
147 
148  stepinfos(1)%starttime = 0.d0
149  do i=1,size(stepinfos)-1
150  stepinfos(i+1)%starttime = stepinfos(i)%starttime + stepinfos(i)%elapsetime
151  end do
152  end subroutine
153 
155  logical function isboundaryactive( bnd, stepinfo )
156  integer, intent(in) :: bnd
157  type( step_info ), intent(in) :: stepinfo
158  isboundaryactive = .false.
159  if( .not. associated( stepinfo%Boundary ) ) return
160  if( any( stepinfo%Boundary== bnd ) ) isboundaryactive = .true.
161  end function
162 
164  logical function isloadactive( bnd, stepinfo )
165  integer, intent(in) :: bnd
166  type( step_info ), intent(in) :: stepinfo
167  isloadactive = .false.
168  if( .not. associated( stepinfo%Load ) ) return
169  if( any( stepinfo%Load == bnd ) ) isloadactive = .true.
170  end function
171 
173  logical function iscontactactive( bnd, stepinfo )
174  integer, intent(in) :: bnd
175  type( step_info ), intent(in) :: stepinfo
176  iscontactactive = .false.
177  if( .not. associated( stepinfo%Contact ) ) return
178  if( any( stepinfo%Contact== bnd ) ) iscontactactive = .true.
179  end function
180 
182  logical function iselemactivationactive( bnd, stepinfo )
183  integer, intent(in) :: bnd
184  type( step_info ), intent(in) :: stepinfo
185  iselemactivationactive = .false.
186  if( .not. associated( stepinfo%ElemActivation ) ) return
187  if( any( stepinfo%ElemActivation== bnd ) ) iselemactivationactive = .true.
188  end function
189 
191  subroutine free_stepinfo( step )
192  type(step_info), intent(inout) :: step
193  if( associated( step%Boundary ) ) deallocate( step%Boundary )
194  if( associated( step%Load ) ) deallocate( step%Load )
195  if( associated( step%Contact ) ) deallocate( step%Contact )
196  if( associated( step%ElemActivation ) ) deallocate( step%ElemActivation )
197  end subroutine
198 
200  subroutine init_aincparam( aincparam )
201  type( tparamautoinc ), intent(out) :: aincparam
202 
203  aincparam%name = ''
204  aincparam%ainc_Rs = 0.5d0
205  aincparam%ainc_Rl = 1.75d0
206  aincparam%NRbound_s = 0
207  aincparam%NRbound_s(knstmaxit) = 20
208  aincparam%NRbound_s(knstsumit) = 100
209  aincparam%NRbound_s(knstciter) = 10
210  aincparam%NRbound_l = 0
211  aincparam%NRbound_l(knstmaxit) = 10
212  aincparam%NRbound_l(knstsumit) = 50
213  aincparam%NRbound_l(knstciter) = 5
214  aincparam%NRtimes_s = 2
215  aincparam%NRtimes_l = 2
216  aincparam%ainc_Rc = 0.25d0
217  aincparam%CBbound = 5
218  end subroutine
219 
221  subroutine init_convergparam( cnvparam )
222  type( tparamconverg ), intent(out) :: cnvparam
223 
224  cnvparam%name = ''
225  cnvparam%given = .false.
226  cnvparam%check = .false.
227  cnvparam%tol = 0.d0
228  end subroutine
229 
230 end module
Definition: hecmw.f90:6
This module manages step information.
Definition: m_step.f90:6
logical function iscontactactive(bnd, stepinfo)
Is contact condition in this step active.
Definition: m_step.f90:174
subroutine free_stepinfo(step)
Finalizer.
Definition: m_step.f90:192
integer, parameter stepampstep
Definition: m_step.f90:17
subroutine init_stepinfo(stepinfo)
Initializer.
Definition: m_step.f90:90
integer(kind=kint), parameter kcnvresidual
Definition: m_step.f90:26
logical function iselemactivationactive(bnd, stepinfo)
Is elemact condition in this step active.
Definition: m_step.f90:183
subroutine init_convergparam(cnvparam)
Initializer.
Definition: m_step.f90:222
integer, parameter stepvisco
Definition: m_step.f90:13
integer(kind=kint), parameter kcnvtranslation
Definition: m_step.f90:28
integer, parameter stepfixedinc
Definition: m_step.f90:14
integer(kind=kint), parameter kcnvcorrection
Definition: m_step.f90:27
integer(kind=kint), parameter kcnvmax
Definition: m_step.f90:32
integer(kind=kint), parameter kcnvl2
Definition: m_step.f90:31
subroutine init_aincparam(aincparam)
Initializer.
Definition: m_step.f90:201
logical function isboundaryactive(bnd, stepinfo)
Is boundary condition in this step active.
Definition: m_step.f90:156
integer, parameter stepampramp
Definition: m_step.f90:16
integer(kind=kint), parameter kcnvlagrange
Definition: m_step.f90:30
subroutine setup_stepinfo_converg(stepinfo, cnvparam)
Fix the convergence criteria of a step. For each criterion the built-in default is overridden by CONV...
Definition: m_step.f90:118
integer(kind=kint), parameter knstmaxit
Definition: m_step.f90:20
integer, parameter stepautoinc
Definition: m_step.f90:15
integer(kind=kint), parameter knstdresn
Definition: m_step.f90:23
integer(kind=kint), parameter knstsumit
Definition: m_step.f90:21
integer(kind=kint), parameter knstciter
Definition: m_step.f90:22
subroutine setup_stepinfo_starttime(stepinfos)
Definition: m_step.f90:144
logical function isloadactive(bnd, stepinfo)
Is external load in this step active.
Definition: m_step.f90:165
integer(kind=kint), parameter kcnvrotation
Definition: m_step.f90:29
integer, parameter stepstatic
Definition: m_step.f90:12
Step control such as active boundary condition, convergent condition etc.
Definition: m_step.f90:35
Convergence criteria of !CONVERG_PARAM, indexed like step_infocnv_check.
Definition: m_step.f90:79