FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
m_out.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!-------------------------------------------------------------------------------
6module m_out
7 use hecmw
8 implicit none
9
10 integer, parameter, private :: MAXOUT = 256
11 integer, parameter, private :: MAXNAMELEN = 24
12 character(len=20), parameter, private :: OUTFILENAME = "ifstr.out"
13
14 include 'fstr_ctrl_util_f.inc'
15
18 integer :: num_items
19 character(len=MAXNAMELEN) :: keyword(maxout)
20 integer :: vtype(maxout)
22 logical :: on(maxout)
23 character(HECMW_NAME_LEN) :: grp_id_name
24 integer :: grp_id
25 integer :: actn
26 end type output_info
27
30 character(len=HECMW_NAME_LEN) :: filename
31 integer :: filenum
32 integer :: freqency
33 type( output_info ) :: outinfo
34 end type t_output_ctrl
35
36contains
37
38 ! ----------------------------------------------------------------------------
39 subroutine initoutinfo( outinfo )
40 type( output_info ), intent(out) :: outinfo
41
42 outinfo%grp_id_name = "ALL"
43 outinfo%grp_id = -1
44 outinfo%on(:) = .false.
45 outinfo%num_items = 37
46
47 outinfo%keyWord(1) = "DISP"
48 outinfo%vtype(1) = -2
49 outinfo%on(1) = .true.
50
51 outinfo%keyWord(2) = "REACTION"
52 outinfo%vtype(2) = -2
53
54 outinfo%keyWord(3) = "NSTRAIN"
55 outinfo%vtype(3) = -3
56
57 outinfo%keyWord(4) = "NSTRESS"
58 outinfo%vtype(4) = -3
59 outinfo%on(4) = .true.
60
61 outinfo%keyWord(5) = "NMISES"
62 outinfo%vtype(5) = -1
63 outinfo%on(5) = .true.
64
65 outinfo%keyWord(6) = "ESTRAIN"
66 outinfo%vtype(6) = -3
67
68 outinfo%keyWord(7) = "ESTRESS"
69 outinfo%vtype(7) = -3
70
71 outinfo%keyWord(8) = "EMISES"
72 outinfo%vtype(8) = -1
73
74 outinfo%keyWord(9) = "ISTRAIN"
75 outinfo%vtype(9) = -3
76
77 outinfo%keyWord(10) = "ISTRESS"
78 outinfo%vtype(10) = -3
79
80 outinfo%keyWord(11) = "PL_ISTRAIN"
81 outinfo%vtype(11) = -1
82
83 outinfo%keyWord(12) = "TH_NSTRAIN"
84 outinfo%vtype(12) = -3
85
86 outinfo%keyWord(13) = "TH_ESTRAIN"
87 outinfo%vtype(13) = -3
88
89 outinfo%keyWord(14) = "TH_ISTRAIN"
90 outinfo%vtype(14) = -3
91
92 outinfo%keyWord(15) = "VEL"
93 outinfo%vtype(15) = -2
94
95 outinfo%keyWord(16) = "ACC"
96 outinfo%vtype(16) = -2
97
98 outinfo%keyWord(17) = "TEMP"
99 outinfo%vtype(17) = -1
100
101 outinfo%keyWord(18) = "ROT"
102 outinfo%vtype(18) = -2
103
104 outinfo%keyWord(19) = "PRINC_NSTRESS"
105 outinfo%vtype(19) = -2
106
107 outinfo%keyWord(20) = "PRINC_ESTRESS"
108 outinfo%vtype(20) = -2
109
110 outinfo%keyWord(21) = "PRINC_NSTRAIN"
111 outinfo%vtype(21) = -2
112
113 outinfo%keyWord(22) = "PRINC_ESTRAIN"
114 outinfo%vtype(22) = -2
115
116 outinfo%keyWord(23) = "PRINCV_NSTRESS"
117 outinfo%vtype(23) = -2
118
119 outinfo%keyWord(24) = "PRINCV_ESTRESS"
120 outinfo%vtype(24) = -2
121
122 outinfo%keyWord(25) = "PRINCV_NSTRAIN"
123 outinfo%vtype(25) = -2
124
125 outinfo%keyWord(26) = "PRINCV_ESTRAIN"
126 outinfo%vtype(26) = -2
127
128 outinfo%keyWord(27) = "SHELL_LAYER"
129 outinfo%vtype(27) = -1
130
131 outinfo%keyWord(28) = "SHELL_SURFACE"
132 outinfo%vtype(28) = -1
133
134 outinfo%keyWord(29) = "YIELD_RATIO"
135 outinfo%vtype(29) = -1
136
137 outinfo%keyWord(30) = "CONTACT_NFORCE"
138 outinfo%vtype(30) = -2
139
140 outinfo%keyWord(31) = "CONTACT_FRICTION"
141 outinfo%vtype(31) = -2
142
143 outinfo%keyWord(32) = "CONTACT_RELVEL"
144 outinfo%vtype(32) = -2
145
146 outinfo%keyWord(33) = "CONTACT_STATE"
147 outinfo%vtype(33) = -1
148
149 outinfo%keyWord(34) = "MATERIAL_ID"
150 outinfo%vtype(34) = -1
151
152 outinfo%keyWord(35) = "BEAM_NQM"
153 outinfo%vtype(35) = -5
154
155 outinfo%keyWord(36) = "CONTACT_NTRACTION"
156 outinfo%vtype(36) = -2
157
158 outinfo%keyWord(37) = "CONTACT_FTRACTION"
159 outinfo%vtype(37) = -2
160 end subroutine initoutinfo
161
162
163 subroutine write_outinfo( fnum, nitem, outinfo, outdata )
164 integer, intent(in) :: fnum
165 integer, intent(in) :: nitem
166 type( output_info ), intent(in) :: outinfo
167 real(kind=kreal), intent(in) :: outdata(:,:)
168
169 integer :: i, j, nsize, ncomp
170 if( nitem>outinfo%num_items ) return
171 if( .not. outinfo%on(nitem) ) return
172 nsize = size( outdata, 1 )
173 ncomp = size( outdata, 2 )
174 write( fnum, '(a)' ) trim(outinfo%keyWord(nitem))
175 do i=1,nsize
176 write( fnum, * ) (outdata(i,j),j=1,ncomp)
177 enddo
178 end subroutine write_outinfo
179
180
181 integer function n_comp_valtype( vtype, ndim )
182 integer, intent(in) :: vtype
183 integer, intent(in) :: ndim
184
185 if( vtype>0 ) then
186 n_comp_valtype = vtype
187 else if( vtype==-1 ) then
189 else if( vtype==-2 ) then
190 n_comp_valtype = ndim
191 else if( vtype==-3 ) then
192 n_comp_valtype = ndim*(ndim+1)/2
193 if(ndim == 4 .or. ndim == 6)n_comp_valtype=6
194 else if( vtype==-4 ) then
195 n_comp_valtype = ndim*ndim
196 else if( vtype==-5 ) then
197 n_comp_valtype = ndim*4
198 else
200 endif
201 end function n_comp_valtype
202
203
204 ! ----following t_output_ctrl------
205 subroutine fstr_init_outctrl(outctrl)
206 type(t_output_ctrl), intent(out) :: outctrl
207 outctrl%filename= trim(outfilename)
208 outctrl%filenum = -1
209 outctrl%freqency= 1
210 call initoutinfo( outctrl%outinfo )
211 end subroutine
212
213 subroutine fstr_copy_outctrl(outctrl1, outctrl2)
214 type(t_output_ctrl), intent(out) :: outctrl1
215 type(t_output_ctrl), intent(in) :: outctrl2
216 outctrl1%filename = outctrl2%filename
217 outctrl1%filenum = outctrl2%filenum
218 outctrl1%freqency = outctrl2%freqency
219 end subroutine
220
221 logical function fstr_output_active( cstep, outctrl )
222 integer, intent(in) :: cstep
223 type(t_output_ctrl), intent(in) :: outctrl
224 fstr_output_active = .false.
225 if( mod( cstep, outctrl%freqency )==0 ) fstr_output_active=.true.
226 end function
227
228 subroutine fstr_ctrl_get_filename( ctrl, ss )
229 integer(kind=kint), intent(in) :: ctrl
230 character(len=HECMW_NAME_LEN), intent(out) :: ss
231 integer(kind=kint) :: rcode
232 ss = trim(outfilename)
233 rcode = fstr_ctrl_get_param_ex( ctrl, 'FILENAME ', '# ', 0, 'S', ss )
234 end subroutine
235
236 subroutine fstr_ctrl_get_output( ctrl, outctrl, islog, res, visual, femap )
237 integer(kind=kint), intent(in) :: ctrl
238 type(t_output_ctrl), intent(inout) :: outctrl
239 integer(kind=kint), intent(out) :: islog, res, visual, femap
240 integer(kind=kint) :: rcode, n
241 character(len=HECMW_NAME_LEN) :: ss
242 islog=0; res=0; visual=0; femap=0
243 if( fstr_ctrl_get_param_ex( ctrl, 'LOG ', '# ', 0, 'E', islog )/= 0 ) return
244 if( fstr_ctrl_get_param_ex( ctrl, 'RESULT ', '# ', 0, 'E', res )/= 0 ) return
245 if( fstr_ctrl_get_param_ex( ctrl, 'VISUAL ', '# ', 0, 'E', visual )/= 0 ) return
246 if( fstr_ctrl_get_param_ex( ctrl, 'UTABLE ', '# ', 0, 'E', femap )/= 0 ) return
247
248 call fstr_init_outctrl(outctrl)
249 ss = ""
250 rcode = fstr_ctrl_get_param_ex( ctrl, 'FILE ', '# ', 0, 'S', ss )
251 if( len(trim(ss))>0 ) then
252 outctrl%filename = trim(ss)
253 endif
254 outctrl%freqency = 1
255 n = 0
256 rcode = fstr_ctrl_get_param_ex( ctrl, 'FREQUENCY ', '# ', 0, 'I', n )
257 if( n>0 ) outctrl%freqency = n
258 end subroutine
259
260 subroutine print_output_ctrl( nfile, outctrl )
261 integer, intent(in) :: nfile
262 type(t_output_ctrl), intent(inout) :: outctrl
263 integer :: i
264 write( nfile, *) trim(outctrl%filename),outctrl%filenum,outctrl%freqency,outctrl%outinfo%num_items
265 do i=1,outctrl%outinfo%num_items
266 write( nfile, *) trim(outctrl%outinfo%keyWord(i)),outctrl%outinfo%on(i),outctrl%outinfo%vtype(i)
267 enddo
268 end subroutine
269
270end module m_out
int fstr_ctrl_get_param_ex(int *ctrl, const char *param_name, const char *value_list, int *necessity, char *type, void *val)
Definition: hecmw.f90:6
This module manages step infomation.
Definition: m_out.f90:6
subroutine fstr_init_outctrl(outctrl)
Definition: m_out.f90:206
subroutine initoutinfo(outinfo)
Definition: m_out.f90:40
subroutine print_output_ctrl(nfile, outctrl)
Definition: m_out.f90:261
subroutine fstr_ctrl_get_filename(ctrl, ss)
Definition: m_out.f90:229
integer function n_comp_valtype(vtype, ndim)
Definition: m_out.f90:182
subroutine fstr_copy_outctrl(outctrl1, outctrl2)
Definition: m_out.f90:214
subroutine write_outinfo(fnum, nitem, outinfo, outdata)
Definition: m_out.f90:164
subroutine fstr_ctrl_get_output(ctrl, outctrl, islog, res, visual, femap)
Definition: m_out.f90:237
logical function fstr_output_active(cstep, outctrl)
Definition: m_out.f90:222
output information
Definition: m_out.f90:17
output control such as output filename, output freqency etc.
Definition: m_out.f90:29