FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
heat_solve_TRAN.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 contains
8 
9  subroutine heat_solve_tran ( hecMESH,hecMAT,fstrSOLID,fstrRESULT,fstrPARAM,fstrHEAT,ISTEP,total_step,current_time )
10  use m_fstr
14  use m_heat_init
16  use m_solve_lineq
17  use m_heat_io
18  implicit none
19  integer(kind=kint) :: ISTEP, iterALL, i, inod, mnod
20  integer(kind=kint) :: total_step
21  real(kind=kreal) :: start_time, delta_time_base, delta_time, current_time, next_time, total_time, end_time, delmax, delmin
22  real(kind=kreal) :: tmpmax, dltmp, tmpmax_myrank, remain_time
23  type(hecmwst_local_mesh) :: hecmesh
24  type(hecmwst_matrix) :: hecMAT
25  type(fstr_solid) :: fstrSOLID
26  type(hecmwst_result_data) :: fstrRESULT
27  type(fstr_param) :: fstrPARAM
28  type(fstr_heat) :: fstrHEAT
29  type(hecmwst_local_mesh), pointer :: hecMESHmpc
30  type(hecmwst_matrix), pointer :: hecMATmpc
31  integer(kind=kint), parameter :: miniter = 4
32  logical :: is_end, outflag
33 
34  call hecmw_mpc_mat_init(hecmesh, hecmat, hecmeshmpc, hecmatmpc)
35 
36  start_time = 0.0d0
37  do i = 1, istep - 1
38  start_time = start_time + fstrheat%STEP_EETIME(i)
39  enddo
40 
41  total_time = start_time + current_time
42 
43  delta_time_base = fstrheat%STEP_DLTIME(istep)
44  end_time = fstrheat%STEP_EETIME(istep)
45  delmin = fstrheat%STEP_DELMIN(istep)
46  delmax = fstrheat%STEP_DELMAX(istep)
47 
48  is_end = .false.
49  hecmat%NDOF = 1
50  hecmat%Iarray(98) = 1 !Assembly complete
51  hecmat%X = 0.0d0
52 
53  if(fstrheat%beta == -1.0d0)then
54  if(fstrheat%is_steady == 1)then
55  fstrheat%beta = 1.0d0
56  else
57  fstrheat%beta = 0.5d0
58  endif
59  endif
60 
61  if(fstrheat%is_steady /= 1 .and. total_step == 1) then
62  if(fstrparam%fg_result==1) then
63  call heat_output_result(hecmesh, fstrheat, fstrsolid, 0, total_time)
64  end if
65  if(fstrparam%fg_visual==1) then
66  call heat_output_visual(hecmesh, fstrresult, fstrheat, fstrsolid, 0, total_time)
67  end if
68  endif
69 
70  !C-------------------- START TRANSIENT LOOP ------------------------
71  tr_loop: do
72 
73  if(end_time <= current_time + delta_time_base + delta_time_base*1.0d-6) then
74  delta_time_base = end_time - current_time
75  endif
76  if( 0.0d0 < delmin .and. fstrheat%timepoint_id > 0 ) then
77  remain_time = get_remain_to_next_timepoints(total_time, 0.0d0, fstrparam%timepoints(fstrheat%timepoint_id))
78  delta_time = dmin1(delta_time_base, remain_time)
79  else
80  delta_time = delta_time_base
81  endif
82  next_time = current_time + delta_time
83  total_time = start_time + next_time
84 
85  if( fstrheat%is_steady == 1 ) then
86  is_end = .true.
87  else
88  if( (end_time - next_time) / end_time < 1.d-12 ) is_end = .true.
89  endif
90 
91  if( 0.0d0 < delmin .and. fstrheat%timepoint_id > 0 ) then
92  outflag = is_end .or. is_at_timepoints(total_time, 0.0d0, fstrparam%timepoints(fstrheat%timepoint_id))
93  else
94  outflag = is_end
95  endif
96 
97  if( hecmesh%my_rank.eq.0 ) then
98  write(imsg,"(a,i8,a,1pe12.5,a,1pe12.5)") " ** Increment No. :", total_step, ", total time: ", &
99  & total_time, ", delta t: ", delta_time
100  write(*, "(a,i8,a,1pe12.5,a,1pe12.5)") " ** Increment No. :", total_step, ", total time: ", &
101  & total_time, ", delta t: ", delta_time
102  endif
103 
104  if(delta_time_base < delmin .and. (.not. is_end))then
105  if(hecmesh%my_rank == 0) write(imsg,*) ' !!! DELTA TIME EXCEEDED TOLERANCE OF TIME INCREMENT'
106  call fstr_abort( hecmw_exit_noconv )
107  endif
108 
109  call heat_solve_main(hecmesh, hecmat, hecmeshmpc, hecmatmpc, &
110  & fstrsolid, fstrparam, fstrheat, istep, iterall, total_time, delta_time)
111 
112  if(0.0d0 < delmin)then
113  tmpmax = 0.0d0
114  do i = 1, hecmesh%nn_internal
115  inod = fstrparam%global_local_id(1,i)
116  dltmp = fstrheat%TEMP0(i) - fstrheat%TEMP(i)
117  if(tmpmax < dabs(dltmp)) then
118  mnod = inod
119  tmpmax = dabs(dltmp)
120  endif
121  enddo
122  tmpmax_myrank = tmpmax
123  call hecmw_allreduce_r1(hecmesh, tmpmax, hecmw_max)
124 
125  if(tmpmax_myrank < tmpmax) mnod = -1
126  call hecmw_allreduce_i1(hecmesh, mnod, hecmw_max)
127 
128  if(delmax < tmpmax .or. fstrheat%is_iter_max_limit)then
129  if(hecmesh%my_rank == 0)then
130  write(*,*) ' *** EXCEEDED TOLERANCE OF VARIATION IN TEMPERATUTE.'
131  write(*,*) ' : NODE NUMBER = ', mnod, ' : DELTA TEMP = ', tmpmax
132  endif
133  delta_time_base = 0.5d0*delta_time_base
134  cycle tr_loop
135  endif
136 
137  if(iterall <= miniter) delta_time_base = delta_time_base*1.5d0
138  else
139  if(fstrheat%is_iter_max_limit) call fstr_abort( hecmw_exit_noconv )
140  endif
141 
142  do i = 1, hecmesh%n_node
143  fstrheat%TEMP0(i) = fstrheat%TEMP(i)
144  enddo
145 
146  call heat_output_log(hecmesh, fstrparam, fstrheat, total_step, total_time)
147  if(fstrparam%fg_result==1 .and. (mod(total_step, fstrparam%fg_irres)==0 .or. outflag)) then
148  call heat_output_result(hecmesh, fstrheat, fstrsolid, total_step, total_time)
149  end if
150  if(fstrparam%fg_visual==1 .and. (mod(total_step, fstrparam%fg_iwres)==0 .or. outflag)) then
151  call heat_output_visual(hecmesh, fstrresult, fstrheat, fstrsolid, total_step, total_time)
152  end if
153  if(fstrheat%restart_nout > 0) then
154  if(mod(total_step, fstrheat%restart_nout) == 0 .or. outflag ) then
155  call heat_output_restart(hecmesh, fstrheat, istep, total_step, next_time)
156  end if
157  end if
158  total_step = total_step + 1
159  current_time = next_time
160  if( is_end ) exit
161  enddo tr_loop
162  !C-------------------- END TRANSIENT LOOP ------------------------
163 
164  call hecmw_mpc_mat_finalize(hecmesh, hecmat, hecmeshmpc, hecmatmpc)
165 
166  end subroutine heat_solve_tran
167 end module m_heat_solve_tran
This module defines common data and basic structures for analysis.
Definition: m_fstr.F90:15
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:121
subroutine fstr_abort(code)
Terminate the analysis with a classified exit status. MPI_ABORT does not perform the Fortran I/O fina...
Definition: m_fstr.F90:692
This module provides functions to initialize heat analysis.
Definition: heat_init.f90:6
This module provides a function to control heat analysis.
Definition: heat_io.f90:6
subroutine heat_output_visual(hecMESH, fstrRESULT, fstrHEAT, fstrSOLID, tstep, ctime)
Definition: heat_io.f90:174
subroutine heat_output_restart(hecMESH, fstrHEAT, istep, tstep, current_time)
Definition: heat_io.f90:196
subroutine heat_output_result(hecMESH, fstrHEAT, fstrSOLID, tstep, ctime)
Definition: heat_io.f90:136
subroutine heat_output_log(hecMESH, fstrPARAM, fstrHEAT, tstep, ctime)
Definition: heat_io.f90:42
This module provides a subroutine for all boundary conditions needed in heat analysis.
This module provides a subroutine to assemble heat capacity matrix.
This module provides a function for stationary heat analysis.
subroutine heat_solve_main(hecMESH, hecMAT, hecMESHmpc, hecMATmpc, fstrSOLID, fstrPARAM, fstrHEAT, ISTEP, iterALL, next_time, delta_time)
This module provide a function to control nonsteady heat analysis.
subroutine heat_solve_tran(hecMESH, hecMAT, fstrSOLID, fstrRESULT, fstrPARAM, fstrHEAT, ISTEP, total_step, current_time)
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.F90:440
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:142