FrontISTR  5.8.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  call heat_output_result(hecmesh, fstrheat, fstrsolid, 0, total_time, .true.)
63  call heat_output_visual(hecmesh, fstrresult, fstrheat, fstrsolid, 0, total_time, .true.)
64  endif
65 
66  !C-------------------- START TRANSIENT LOOP ------------------------
67  tr_loop: do
68 
69  if(end_time <= current_time + delta_time_base + delta_time_base*1.0d-6) then
70  delta_time_base = end_time - current_time
71  endif
72  if( 0.0d0 < delmin .and. fstrheat%timepoint_id > 0 ) then
73  remain_time = get_remain_to_next_timepoints(total_time, 0.0d0, fstrparam%timepoints(fstrheat%timepoint_id))
74  delta_time = dmin1(delta_time_base, remain_time)
75  else
76  delta_time = delta_time_base
77  endif
78  next_time = current_time + delta_time
79  total_time = start_time + next_time
80 
81  if( fstrheat%is_steady == 1 ) then
82  is_end = .true.
83  else
84  if( (end_time - next_time) / end_time < 1.d-12 ) is_end = .true.
85  endif
86 
87  if( 0.0d0 < delmin .and. fstrheat%timepoint_id > 0 ) then
88  outflag = is_end .or. is_at_timepoints(total_time, 0.0d0, fstrparam%timepoints(fstrheat%timepoint_id))
89  else
90  outflag = is_end
91  endif
92 
93  if( hecmesh%my_rank.eq.0 ) then
94  write(imsg,"(a,i8,a,1pe12.5,a,1pe12.5)") " ** Increment No. :", total_step, ", total time: ", &
95  & total_time, ", delta t: ", delta_time
96  write(*, "(a,i8,a,1pe12.5,a,1pe12.5)") " ** Increment No. :", total_step, ", total time: ", &
97  & total_time, ", delta t: ", delta_time
98  endif
99 
100  if(delta_time_base < delmin .and. (.not. is_end))then
101  if(hecmesh%my_rank == 0) write(imsg,*) ' !!! DELTA TIME EXCEEDED TOLERANCE OF TIME INCREMENT'
102  call hecmw_abort(hecmw_comm_get_comm())
103  endif
104 
105  call heat_solve_main(hecmesh, hecmat, hecmeshmpc, hecmatmpc, &
106  & fstrsolid, fstrparam, fstrheat, istep, iterall, total_time, delta_time)
107 
108  if(0.0d0 < delmin)then
109  tmpmax = 0.0d0
110  do i = 1, hecmesh%nn_internal
111  inod = fstrparam%global_local_id(1,i)
112  dltmp = fstrheat%TEMP0(i) - fstrheat%TEMP(i)
113  if(tmpmax < dabs(dltmp)) then
114  mnod = inod
115  tmpmax = dabs(dltmp)
116  endif
117  enddo
118  tmpmax_myrank = tmpmax
119  call hecmw_allreduce_r1(hecmesh, tmpmax, hecmw_max)
120 
121  if(tmpmax_myrank < tmpmax) mnod = -1
122  call hecmw_allreduce_i1(hecmesh, mnod, hecmw_max)
123 
124  if(delmax < tmpmax .or. fstrheat%is_iter_max_limit)then
125  if(hecmesh%my_rank == 0)then
126  write(*,*) ' *** EXCEEDED TOLERANCE OF VARIATION IN TEMPERATUTE.'
127  write(*,*) ' : NODE NUMBER = ', mnod, ' : DELTA TEMP = ', tmpmax
128  endif
129  delta_time_base = 0.5d0*delta_time_base
130  cycle tr_loop
131  endif
132 
133  if(iterall <= miniter) delta_time_base = delta_time_base*1.5d0
134  else
135  if(fstrheat%is_iter_max_limit) call hecmw_abort( hecmw_comm_get_comm() )
136  endif
137 
138  do i = 1, hecmesh%n_node
139  fstrheat%TEMP0(i) = fstrheat%TEMP(i)
140  enddo
141 
142  call heat_output_log(hecmesh, fstrparam, fstrheat, total_step, total_time)
143  call heat_output_result(hecmesh, fstrheat, fstrsolid, total_step, total_time, outflag)
144  call heat_output_visual(hecmesh, fstrresult, fstrheat, fstrsolid, total_step, total_time, outflag)
145  call heat_output_restart(hecmesh, fstrheat, istep, total_step, next_time, outflag)
146 
147  total_step = total_step + 1
148  current_time = next_time
149  if( is_end ) exit
150  enddo tr_loop
151  !C-------------------- END TRANSIENT LOOP ------------------------
152 
153  call hecmw_mpc_mat_finalize(hecmesh, hecmat, hecmeshmpc, hecmatmpc)
154 
155  end subroutine heat_solve_tran
156 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:111
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_result(hecMESH, fstrHEAT, fstrSOLID, tstep, ctime, outflag)
Definition: heat_io.f90:90
subroutine heat_output_restart(hecMESH, fstrHEAT, istep, tstep, current_time, outflag)
Definition: heat_io.f90:189
subroutine heat_output_log(hecMESH, fstrPARAM, fstrHEAT, tstep, ctime)
Definition: heat_io.f90:42
subroutine heat_output_visual(hecMESH, fstrRESULT, fstrHEAT, fstrSOLID, tstep, ctime, outflag)
Definition: heat_io.f90:133
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:431
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.f90:155