FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
heat_io.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_heat_io
7 
8 contains
9 
10  subroutine heat_input_restart(fstrHEAT, hecMESH, istep, tstep, tt)
11  use m_fstr
12  implicit none
13  type(hecmwst_local_mesh) :: hecMESH
14  type(fstr_heat) :: fstrHEAT
15  integer(kind=kint) :: restart_istep(1)
16  integer(kind=kint) :: restart_step(1)
17  real(kind=kreal) :: restart_time(1)
18  integer(kind=kint) :: i, istep, tstep
19  real(kind=kreal) :: tt
20 
21  if(fstrheat%restart_nout < 0)then
22  fstrheat%restart_nout = -fstrheat%restart_nout
23  call hecmw_restart_open()
24  call hecmw_restart_read_int(restart_istep)
25  call hecmw_restart_read_int(restart_step)
26  call hecmw_restart_read_real(restart_time)
27  call hecmw_restart_read_real(fstrheat%TEMP0)
28  call hecmw_restart_close()
29  istep = restart_istep(1)
30  tstep = restart_step(1) + 1
31  tt = restart_time(1)
32 
33  do i = 1, hecmesh%n_node
34  fstrheat%TEMPC(i)= fstrheat%TEMP0(i)
35  fstrheat%TEMP (i)= fstrheat%TEMP0(i)
36  enddo
37  write(ilog,*) ' Restart read of temperatures: OK'
38  endif
39  end subroutine heat_input_restart
40 
41  subroutine heat_output_log(hecMESH, fstrPARAM, fstrHEAT, tstep, ctime)
42  use m_fstr
43  implicit none
44  type(hecmwst_local_mesh) :: hecmesh
45  type(fstr_heat) :: fstrHEAT
46  type(fstr_param) :: fstrPARAM
47  integer(kind=kint) :: i, in, inod, tstep, nmax, nmin
48  real(kind=kreal) :: temp, ctime, tmax, tmin
49 
50  tmax = -1.0d10
51  tmin = 1.0d10
52  nmax = -1
53  nmin = -1
54 
55  write(ilog,*)
56  write(ilog,'(a,i6)') ' ISTEP =', tstep
57  write(ilog,'(a,f10.3)') ' Time =', ctime
58 
59  do i = 1, hecmesh%nn_internal
60  inod = fstrparam%global_local_id(1,i)
61  in = fstrparam%global_local_id(2,i)
62  temp = fstrheat%TEMP(in)
63  if(tmax < temp)then
64  tmax = temp
65  nmax = inod
66  endif
67  if(temp < tmin)then
68  tmin = temp
69  nmin = inod
70  endif
71  enddo
72 
73  write(ilog,'(a,f10.3,i10)') ' Maximum Temperature :', tmax
74  write(ilog,'(a,i10)') ' Maximum Node No. :', nmax
75  write(ilog,'(a,f10.3,i10)') ' Minimum Temperature :', tmin
76  write(ilog,'(a,i10)') ' Minimum Node No. :', nmin
77 
78  !global temperature
79  call hecmw_allreduce_r1 (hecmesh, tmax, hecmw_max)
80  call hecmw_allreduce_r1 (hecmesh, tmin, hecmw_min)
81  if( myrank == 0 ) then
82  write(ilog,'(a,f10.3,i10)') ' Maximum Temperature(global) :', tmax
83  write(ilog,'(a,f10.3,i10)') ' Minimum Temperature(global) :', tmin
84  end if
85 
86 
87  end subroutine heat_output_log
88 
89  subroutine heat_output_result(hecMESH, fstrHEAT, fstrSOLID, tstep, ctime, outflag)
90  use m_fstr
91  use m_fstr_elemact
92  implicit none
93  type(hecmwst_local_mesh) :: hecmesh
94  type(fstr_heat) :: fstrHEAT
95  type(fstr_solid) :: fstrSOLID
96  integer(kind=kint) :: restart_step(1)
97  real(kind=kreal) :: restart_time(1)
98  integer(kind=kint) :: i, tstep
99  real(kind=kreal) :: ctime, work_time(1)
100  logical, intent(in) :: outflag
101  character(len=HECMW_HEADER_LEN) :: header
102  character(len=HECMW_MSG_LEN) :: comment
103  character(len=HECMW_NAME_LEN) :: label
104  character(len=HECMW_NAME_LEN) :: nameID
105  real(kind=kreal), pointer :: work(:)
106 
107  if(iresult == 1 .and. (mod(tstep, irres) == 0 .or. outflag))then
108  header = '*fstrresult'
109  comment = 'nonsteady_heat_result'
110  call hecmw_result_init(hecmesh, tstep, header, comment)
111  work_time(1) = ctime
112  label = 'TOTALTIME'
113  call hecmw_result_add(hecmw_result_dtype_global, 1, label, work_time)
114  label = 'TEMPERATURE'
115  call hecmw_result_add(hecmw_result_dtype_node, 1, label, fstrheat%TEMP)
116 
117  !elemact state
118  if( fstrheat%elemact%ELEMACT_egrp_tot > 0 ) then
119  allocate(work(hecmesh%n_elem))
120  call output_elemact_flag( hecmesh, fstrsolid%elements, work )
121  label = 'ELEMACT'
122  call hecmw_result_add(hecmw_result_dtype_elem, 1, label, work)
123  deallocate(work)
124  end if
125 
126  nameid = 'fstrRES'
127  call hecmw_result_write_by_name(nameid)
128  call hecmw_result_finalize
129  endif
130  end subroutine heat_output_result
131 
132  subroutine heat_output_visual(hecMESH, fstrRESULT, fstrHEAT, fstrSOLID, tstep, ctime, outflag)
133  use m_fstr
134  use m_fstr_elemact
136  implicit none
137  type(hecmwst_local_mesh) :: hecmesh
138  type(fstr_heat) :: fstrHEAT
139  type(hecmwst_result_data) :: fstrRESULT
140  type(fstr_solid) :: fstrSOLID
141  integer(kind=kint) :: i, tstep
142  real(kind=kreal) :: ctime
143  logical, intent(in) :: outflag
144  real(kind=kreal), pointer :: work(:)
145 
146  if(ivisual == 1 .and. (mod(tstep, iwres) == 0 .or. outflag))then
147  call hecmw_nullify_result_data(fstrresult)
148  fstrresult%ng_component = 1
149  fstrresult%nn_component = 1
150  fstrresult%ne_component = 0
151  allocate(fstrresult%ng_dof(1))
152  allocate(fstrresult%global_label(1))
153  allocate(fstrresult%global_val_item(1))
154  fstrresult%ng_dof(1) = 1
155  fstrresult%global_label(1) = 'TOTALTIME'
156  fstrresult%global_val_item(1) = ctime
157  allocate(fstrresult%nn_dof(1))
158  allocate(fstrresult%node_label(1))
159  allocate(fstrresult%node_val_item(hecmesh%n_node))
160  fstrresult%nn_dof(1) = 1
161  fstrresult%node_label(1) = 'TEMPERATURE'
162  fstrresult%node_val_item = fstrheat%TEMP
163 
164  !elemact state
165  if( fstrheat%elemact%ELEMACT_egrp_tot > 0 ) then
166  fstrresult%ne_component = 1
167  allocate(fstrresult%ne_dof(1))
168  allocate(fstrresult%elem_label(1))
169  allocate(fstrresult%elem_val_item(hecmesh%n_elem))
170  allocate(work(hecmesh%n_elem))
171  call output_elemact_flag( hecmesh, fstrsolid%elements, work )
172 
173  fstrresult%ne_dof(1) = 1
174  fstrresult%elem_label(1) = 'ELEMACT'
175  fstrresult%elem_val_item = work
176  deallocate(work)
177  end if
178 
179  call fstr2hecmw_mesh_conv(hecmesh)
180  call hecmw_visualize_init
181  call hecmw_visualize( hecmesh, fstrresult, tstep )
182  call hecmw_visualize_finalize
183  call hecmw2fstr_mesh_conv(hecmesh)
184  call hecmw_result_free(fstrresult)
185  endif
186  end subroutine heat_output_visual
187 
188  subroutine heat_output_restart(hecMESH, fstrHEAT, istep, tstep, current_time, outflag)
189  use m_fstr
190  implicit none
191  type(hecmwst_local_mesh) :: hecmesh
192  type(fstr_heat) :: fstrHEAT
193  integer(kind=kint) :: restart_istep(1)
194  integer(kind=kint) :: restart_step(1)
195  real(kind=kreal) :: restart_time(1)
196  integer(kind=kint) :: restrt_data_size
197  integer(kind=kint) :: istep, tstep
198  logical, intent(in) :: outflag
199  real(kind=kreal) :: current_time
200 
201  if( fstrheat%restart_nout <= 0 ) return
202 
203  if( mod(tstep, fstrheat%restart_nout) == 0 .or. outflag )then
204  restart_istep(1) = istep
205  restart_step(1) = tstep
206  restart_time(1) = current_time
207  restrt_data_size = size(restart_istep)
208  call hecmw_restart_add_int(restart_istep, restrt_data_size)
209  restrt_data_size = size(restart_step)
210  call hecmw_restart_add_int(restart_step, restrt_data_size)
211  restrt_data_size = size(restart_time)
212  call hecmw_restart_add_real(restart_time, restrt_data_size)
213  restrt_data_size = size(fstrheat%TEMP)
214  call hecmw_restart_add_real(fstrheat%TEMP, restrt_data_size)
215  call hecmw_restart_write()
216  if( hecmesh%my_rank.eq.0 ) then
217  write(imsg,*) '### FSTR output Restart_File.'
218  call flush(imsg)
219  endif
220  endif
221  end subroutine heat_output_restart
222 end module m_heat_io
This module provide a function to elemact elements.
subroutine output_elemact_flag(hecMESH, elements, outval)
This module defines common data and basic structures for analysis.
Definition: m_fstr.f90:15
integer(kind=kint), pointer iresult
Definition: m_fstr.f90:123
integer(kind=kint) myrank
PARALLEL EXECUTION.
Definition: m_fstr.f90:97
integer(kind=kint), parameter imsg
Definition: m_fstr.f90:111
integer(kind=kint), pointer iwres
Definition: m_fstr.f90:127
integer(kind=kint), parameter ilog
FILE HANDLER.
Definition: m_fstr.f90:108
integer(kind=kint), pointer irres
Definition: m_fstr.f90:126
integer(kind=kint), pointer ivisual
Definition: m_fstr.f90:124
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
subroutine heat_input_restart(fstrHEAT, hecMESH, istep, tstep, tt)
Definition: heat_io.f90:11
HECMW to FSTR Mesh Data Converter. Converting Connectivity of Element Type 232, 342 and 352.
subroutine fstr2hecmw_mesh_conv(hecMESH)
subroutine hecmw2fstr_mesh_conv(hecMESH)
Data for HEAT ANSLYSIS (fstrHEAT)
Definition: m_fstr.f90:431
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.f90:155