FrontISTR  5.2.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,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(hecmwst_result_data) :: fstrRESULT
26  type(fstr_param) :: fstrPARAM
27  type(fstr_heat) :: fstrHEAT
28  type(hecmwst_local_mesh), pointer :: hecMESHmpc
29  type(hecmwst_matrix), pointer :: hecMATmpc
30  integer(kind=kint), parameter :: miniter = 4
31  logical :: is_end, outflag
32 
33  call hecmw_mpc_mat_init(hecmesh, hecmat, hecmeshmpc, hecmatmpc)
34 
35  if(istep == 1)then
36  start_time = 0.0d0
37  else
38  start_time = 0.0d0
39  do i = 1, istep - 1
40  start_time = start_time + fstrheat%STEP_EETIME(i)
41  enddo
42  endif
43  total_time = start_time + current_time
44 
45  delta_time_base = fstrheat%STEP_DLTIME(istep)
46  end_time = fstrheat%STEP_EETIME(istep)
47  delmin = fstrheat%STEP_DELMIN(istep)
48  delmax = fstrheat%STEP_DELMAX(istep)
49 
50  is_end = .false.
51  hecmat%NDOF = 1
52  hecmat%Iarray(98) = 1 !Assmebly complete
53  hecmat%X = 0.0d0
54 
55  if(fstrheat%is_steady == 1)then
56  fstrheat%beta = 1.0d0
57  else
58  fstrheat%beta = 0.5d0
59  endif
60 
61  if(fstrheat%is_steady /= 1 .and. total_step == 1) then
62  call heat_output_result(hecmesh, fstrheat, 0, total_time, .true.)
63  call heat_output_visual(hecmesh, fstrresult, fstrheat, 0, total_time, .true.)
64  endif
65 
66  !C-------------------- START TRANSIET 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, fstrparam, fstrheat, istep, iterall, total_time, delta_time)
106 
107  if(0.0d0 < delmin)then
108  tmpmax = 0.0d0
109  do i = 1, hecmesh%nn_internal
110  inod = fstrparam%global_local_id(1,i)
111  dltmp = fstrheat%TEMP0(i) - fstrheat%TEMP(i)
112  if(tmpmax < dabs(dltmp)) then
113  mnod = inod
114  tmpmax = dabs(dltmp)
115  endif
116  enddo
117  tmpmax_myrank = tmpmax
118  call hecmw_allreduce_r1(hecmesh, tmpmax, hecmw_max)
119 
120  if(tmpmax_myrank < tmpmax) mnod = -1
121  call hecmw_allreduce_i1(hecmesh, mnod, hecmw_max)
122 
123  if(delmax < tmpmax .or. fstrheat%is_iter_max_limit)then
124  if(hecmesh%my_rank == 0)then
125  write(*,*) ' *** EXCEEDED TOLERANCE OF VARIATION IN TEMPERATUTE.'
126  write(*,*) ' : NODE NUMBER = ', mnod, ' : DELTA TEMP = ', tmpmax
127  endif
128  delta_time_base = 0.5d0*delta_time_base
129  cycle tr_loop
130  endif
131 
132  if(iterall <= miniter) delta_time_base = delta_time_base*1.5d0
133  else
134  if(fstrheat%is_iter_max_limit) call hecmw_abort( hecmw_comm_get_comm() )
135  endif
136 
137  do i = 1, hecmesh%n_node
138  fstrheat%TEMP0(i) = fstrheat%TEMP(i)
139  enddo
140 
141  call heat_output_log(hecmesh, fstrparam, fstrheat, total_step, total_time)
142  call heat_output_result(hecmesh, fstrheat, total_step, total_time, outflag)
143  call heat_output_visual(hecmesh, fstrresult, fstrheat, total_step, total_time, outflag)
144  call heat_output_restart(hecmesh, fstrheat, istep, total_step, next_time, is_end)
145 
146  total_step = total_step + 1
147  current_time = next_time
148  if( is_end ) exit
149  enddo tr_loop
150  !C-------------------- END TRANSIET LOOP ------------------------
151 
152  call hecmw_mpc_mat_finalize(hecmesh, hecmat, hecmeshmpc, hecmatmpc)
153 
154  end subroutine heat_solve_tran
155 end module m_heat_solve_tran
This module defined coomon data and basic structures for analysis.
Definition: m_fstr.f90:15
integer(kind=kint), parameter imsg
Definition: m_fstr.f90:94
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_restart(hecMESH, fstrHEAT, istep, tstep, current_time, outflag)
Definition: heat_io.f90:157
subroutine heat_output_log(hecMESH, fstrPARAM, fstrHEAT, tstep, ctime)
Definition: heat_io.f90:42
subroutine heat_output_result(hecMESH, fstrHEAT, tstep, ctime, outflag)
Definition: heat_io.f90:90
subroutine heat_output_visual(hecMESH, fstrRESULT, fstrHEAT, tstep, ctime, outflag)
Definition: heat_io.f90:120
This module provides a subroutine for all boundary conditions needed in heat anaylsis.
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, fstrPARAM, fstrHEAT, ISTEP, iterALL, next_time, delta_time)
This module provide a function to control nonsteady heat analysis.
subroutine heat_solve_tran(hecMESH, hecMAT, fstrRESULT, fstrPARAM, fstrHEAT, ISTEP, total_step, current_time)
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.f90:394
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.f90:138