FrontISTR  6.0.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  if( fstrheat%is_dummy_node(in) ) cycle
63  temp = fstrheat%TEMP(in)
64  if(tmax < temp)then
65  tmax = temp
66  nmax = inod
67  endif
68  if(temp < tmin)then
69  tmin = temp
70  nmin = inod
71  endif
72  enddo
73 
74  write(ilog,'(a,f10.3,i10)') ' Maximum Temperature :', tmax
75  write(ilog,'(a,i10)') ' Maximum Node No. :', nmax
76  write(ilog,'(a,f10.3,i10)') ' Minimum Temperature :', tmin
77  write(ilog,'(a,i10)') ' Minimum Node No. :', nmin
78 
79  !global temperature
80  call hecmw_allreduce_r1 (hecmesh, tmax, hecmw_max)
81  call hecmw_allreduce_r1 (hecmesh, tmin, hecmw_min)
82  if( myrank == 0 ) then
83  write(ilog,'(a,f10.3,i10)') ' Maximum Temperature(global) :', tmax
84  write(ilog,'(a,f10.3,i10)') ' Minimum Temperature(global) :', tmin
85  end if
86 
87 
88  end subroutine heat_output_log
89 
90  subroutine fstr_heat_make_result_step(hecMESH, fstrHEAT, fstrSOLID, fstrRESULT, ctime)
91  use m_fstr
92  use m_fstr_elemact
93  implicit none
94  type(hecmwst_local_mesh) :: hecmesh
95  type(fstr_heat) :: fstrHEAT
96  type(fstr_solid) :: fstrSOLID
97  type(hecmwst_result_data) :: fstrRESULT
98  real(kind=kreal) :: ctime
99 
100  real(kind=kreal), pointer :: work(:)
101 
102  fstrresult%ng_component = 1
103  fstrresult%nn_component = 1
104  fstrresult%ne_component = 0
105  allocate(fstrresult%ng_dof(1))
106  allocate(fstrresult%global_label(1))
107  allocate(fstrresult%global_val_item(1))
108  fstrresult%ng_dof(1) = 1
109  fstrresult%global_label(1) = 'TOTALTIME'
110  fstrresult%global_val_item(1) = ctime
111  allocate(fstrresult%nn_dof(1))
112  allocate(fstrresult%node_label(1))
113  allocate(fstrresult%node_val_item(hecmesh%n_node))
114  fstrresult%nn_dof(1) = 1
115  fstrresult%node_label(1) = 'TEMPERATURE'
116  fstrresult%node_val_item = fstrheat%TEMP
117 
118  !elemact state
119  if( fstrheat%elemact%ELEMACT_egrp_tot > 0 ) then
120  fstrresult%ne_component = 1
121  allocate(fstrresult%ne_dof(1))
122  allocate(fstrresult%elem_label(1))
123  allocate(fstrresult%elem_val_item(hecmesh%n_elem))
124  allocate(work(hecmesh%n_elem))
125  call output_elemact_flag( hecmesh, fstrsolid%elements, work )
126 
127  fstrresult%ne_dof(1) = 1
128  fstrresult%elem_label(1) = 'ELEMACT'
129  fstrresult%elem_val_item = work
130  deallocate(work)
131  end if
132 
133  end subroutine
134 
135  subroutine heat_output_result(hecMESH, fstrHEAT, fstrSOLID, tstep, ctime)
136  use m_fstr
137  use m_fstr_elemact
138  implicit none
139  type(hecmwst_local_mesh) :: hecmesh
140  type(fstr_heat) :: fstrHEAT
141  type(fstr_solid) :: fstrSOLID
142  integer(kind=kint) :: tstep
143  real(kind=kreal) :: ctime, work_time(1)
144  character(len=HECMW_HEADER_LEN) :: header
145  character(len=HECMW_MSG_LEN) :: comment
146  character(len=HECMW_NAME_LEN) :: label
147  character(len=HECMW_NAME_LEN) :: nameID
148  real(kind=kreal), pointer :: work(:)
149 
150  header = '*fstrresult'
151  comment = 'nonsteady_heat_result'
152  call hecmw_result_init(hecmesh, tstep, header, comment)
153  work_time(1) = ctime
154  label = 'TOTALTIME'
155  call hecmw_result_add(hecmw_result_dtype_global, 1, label, work_time)
156  label = 'TEMPERATURE'
157  call hecmw_result_add(hecmw_result_dtype_node, 1, label, fstrheat%TEMP)
158 
159  !elemact state
160  if( fstrheat%elemact%ELEMACT_egrp_tot > 0 ) then
161  allocate(work(hecmesh%n_elem))
162  call output_elemact_flag( hecmesh, fstrsolid%elements, work )
163  label = 'ELEMACT'
164  call hecmw_result_add(hecmw_result_dtype_elem, 1, label, work)
165  deallocate(work)
166  end if
167 
168  nameid = 'fstrRES'
169  call hecmw_result_write_by_name(nameid)
170  call hecmw_result_finalize
171  end subroutine heat_output_result
172 
173  subroutine heat_output_visual(hecMESH, fstrRESULT, fstrHEAT, fstrSOLID, tstep, ctime)
174  use m_fstr
175  use m_fstr_elemact
177  implicit none
178  type(hecmwst_local_mesh) :: hecmesh
179  type(fstr_heat) :: fstrHEAT
180  type(hecmwst_result_data) :: fstrRESULT
181  type(fstr_solid) :: fstrSOLID
182  integer(kind=kint) :: tstep
183  real(kind=kreal) :: ctime
184 
185  call hecmw_nullify_result_data(fstrresult)
186  call fstr_heat_make_result_step(hecmesh, fstrheat, fstrsolid, fstrresult, ctime)
187  call fstr2hecmw_mesh_conv(hecmesh)
188  call hecmw_visualize_init
189  call hecmw_visualize( hecmesh, fstrresult, tstep )
190  call hecmw_visualize_finalize
191  call hecmw2fstr_mesh_conv(hecmesh)
192  call hecmw_result_free(fstrresult)
193  end subroutine heat_output_visual
194 
195  subroutine heat_output_restart(hecMESH, fstrHEAT, istep, tstep, current_time)
196  use m_fstr
197  implicit none
198  type(hecmwst_local_mesh) :: hecmesh
199  type(fstr_heat) :: fstrHEAT
200  integer(kind=kint) :: restart_istep(1)
201  integer(kind=kint) :: restart_step(1)
202  real(kind=kreal) :: restart_time(1)
203  integer(kind=kint) :: restrt_data_size
204  integer(kind=kint) :: istep, tstep
205  real(kind=kreal) :: current_time
206 
207  if( fstrheat%restart_nout <= 0 ) return
208 
209  restart_istep(1) = istep
210  restart_step(1) = tstep
211  restart_time(1) = current_time
212  restrt_data_size = size(restart_istep)
213  call hecmw_restart_add_int(restart_istep, restrt_data_size)
214  restrt_data_size = size(restart_step)
215  call hecmw_restart_add_int(restart_step, restrt_data_size)
216  restrt_data_size = size(restart_time)
217  call hecmw_restart_add_real(restart_time, restrt_data_size)
218  restrt_data_size = size(fstrheat%TEMP)
219  call hecmw_restart_add_real(fstrheat%TEMP, restrt_data_size)
220  call hecmw_restart_write()
221  if( hecmesh%my_rank.eq.0 ) then
222  write(imsg,*) '### FSTR output Restart_File.'
223  call flush(imsg)
224  endif
225  end subroutine heat_output_restart
226 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) myrank
PARALLEL EXECUTION.
Definition: m_fstr.F90:107
integer(kind=kint), parameter imsg
Definition: m_fstr.F90:121
integer(kind=kint), parameter ilog
FILE HANDLER.
Definition: m_fstr.F90:118
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
subroutine heat_input_restart(fstrHEAT, hecMESH, istep, tstep, tt)
Definition: heat_io.f90:11
subroutine fstr_heat_make_result_step(hecMESH, fstrHEAT, fstrSOLID, fstrRESULT, ctime)
Definition: heat_io.f90:91
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:440
FSTR INNER CONTROL PARAMETERS (fstrPARAM)
Definition: m_fstr.F90:142