FrontISTR  5.8.0
Large-scale structural analysis program with finit element method
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 !-------------------------------------------------------------------------------
6 module m_out
7  use hecmw
9 
10  implicit none
11 
12  integer, parameter, private :: MAXOUT = 256
13  integer, parameter, private :: MAXNAMELEN = 24
14  character(len=20), parameter, private :: OUTFILENAME = "ifstr.out"
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 :: frequency
33  type( output_info ) :: outinfo
34  end type t_output_ctrl
35 
36 contains
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 = 44
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  outinfo%on(18) = .true.
104 
105  outinfo%keyWord(19) = "PRINC_NSTRESS"
106  outinfo%vtype(19) = -2
107 
108  outinfo%keyWord(20) = "PRINC_ESTRESS"
109  outinfo%vtype(20) = -2
110 
111  outinfo%keyWord(21) = "PRINC_NSTRAIN"
112  outinfo%vtype(21) = -2
113 
114  outinfo%keyWord(22) = "PRINC_ESTRAIN"
115  outinfo%vtype(22) = -2
116 
117  outinfo%keyWord(23) = "PRINCV_NSTRESS"
118  outinfo%vtype(23) = -2
119 
120  outinfo%keyWord(24) = "PRINCV_ESTRESS"
121  outinfo%vtype(24) = -2
122 
123  outinfo%keyWord(25) = "PRINCV_NSTRAIN"
124  outinfo%vtype(25) = -2
125 
126  outinfo%keyWord(26) = "PRINCV_ESTRAIN"
127  outinfo%vtype(26) = -2
128 
129  outinfo%keyWord(27) = "SHELL_LAYER"
130  outinfo%vtype(27) = -1
131 
132  outinfo%keyWord(28) = "SHELL_SURFACE"
133  outinfo%vtype(28) = -1
134 
135  outinfo%keyWord(29) = "YIELD_RATIO"
136  outinfo%vtype(29) = -1
137 
138  outinfo%keyWord(30) = "CONTACT_NFORCE"
139  outinfo%vtype(30) = -2
140 
141  outinfo%keyWord(31) = "CONTACT_FRICTION"
142  outinfo%vtype(31) = -2
143 
144  outinfo%keyWord(32) = "CONTACT_RELVEL"
145  outinfo%vtype(32) = -2
146 
147  outinfo%keyWord(33) = "CONTACT_STATE"
148  outinfo%vtype(33) = -1
149 
150  outinfo%keyWord(34) = "MATERIAL_ID"
151  outinfo%vtype(34) = -1
152 
153  outinfo%keyWord(35) = "BEAM_NQM"
154  outinfo%vtype(35) = -5
155 
156  outinfo%keyWord(36) = "CONTACT_NTRACTION"
157  outinfo%vtype(36) = -2
158 
159  outinfo%keyWord(37) = "CONTACT_FTRACTION"
160  outinfo%vtype(37) = -2
161 
162  outinfo%keyWord(38) = "NODE_ID"
163  outinfo%vtype(38) = -1
164 
165  outinfo%keyWord(39) = "ELEM_ID"
166  outinfo%vtype(39) = -1
167 
168  outinfo%keyWord(40) = "SECTION_ID"
169  outinfo%vtype(40) = -1
170 
171  outinfo%keyWord(41) = "NOT ASSIGNED"
172  outinfo%vtype(41) = -1
173 
174  outinfo%keyWord(42) = "NOT ASSIGNED"
175  outinfo%vtype(42) = -1
176 
177  outinfo%keyWord(43) = "PL_ESTRAIN"
178  outinfo%vtype(43) = -1
179 
180  outinfo%keyWord(44) = "ELEMACT"
181  outinfo%vtype(44) = -1
182 
183  end subroutine initoutinfo
184 
185  subroutine write_outinfo( fnum, nitem, outinfo, outdata )
186  integer, intent(in) :: fnum
187  integer, intent(in) :: nitem
188  type( output_info ), intent(in) :: outinfo
189  real(kind=kreal), intent(in) :: outdata(:,:)
190 
191  integer :: i, j, nsize, ncomp
192  if( nitem>outinfo%num_items ) return
193  if( .not. outinfo%on(nitem) ) return
194  nsize = size( outdata, 1 )
195  ncomp = size( outdata, 2 )
196  write( fnum, '(a)' ) trim(outinfo%keyWord(nitem))
197  do i=1,nsize
198  write( fnum, * ) (outdata(i,j),j=1,ncomp)
199  enddo
200  end subroutine write_outinfo
201 
202 
203  integer function n_comp_valtype( vtype, ndim )
204  integer, intent(in) :: vtype
205  integer, intent(in) :: ndim
206 
207  if( vtype>0 ) then
208  n_comp_valtype = vtype
209  else if( vtype==-1 ) then
210  n_comp_valtype = 1
211  else if( vtype==-2 ) then
212  n_comp_valtype = ndim
213  else if( vtype==-3 ) then
214  n_comp_valtype = ndim*(ndim+1)/2
215  if(ndim == 4 .or. ndim == 6)n_comp_valtype=6
216  else if( vtype==-4 ) then
217  n_comp_valtype = ndim*ndim
218  else if( vtype==-5 ) then
219  n_comp_valtype = 12
220  else
221  n_comp_valtype = 0
222  endif
223  end function n_comp_valtype
224 
225 
226  ! ----following t_output_ctrl------
227  subroutine fstr_init_outctrl(outctrl)
228  type(t_output_ctrl), intent(out) :: outctrl
229  outctrl%filename= trim(outfilename)
230  outctrl%filenum = -1
231  outctrl%frequency= 1
232  call initoutinfo( outctrl%outinfo )
233  end subroutine
234 
235  subroutine fstr_copy_outctrl(outctrl1, outctrl2)
236  type(t_output_ctrl), intent(out) :: outctrl1
237  type(t_output_ctrl), intent(in) :: outctrl2
238  outctrl1%filename = outctrl2%filename
239  outctrl1%filenum = outctrl2%filenum
240  outctrl1%frequency = outctrl2%frequency
241  end subroutine
242 
243  logical function fstr_output_active( cstep, outctrl )
244  integer, intent(in) :: cstep
245  type(t_output_ctrl), intent(in) :: outctrl
246  fstr_output_active = .false.
247  if( mod( cstep, outctrl%frequency )==0 ) fstr_output_active=.true.
248  end function
249 
250  subroutine fstr_ctrl_get_filename( ctrl, ss )
251  integer(kind=kint), intent(in) :: ctrl
252  character(len=HECMW_NAME_LEN), intent(out) :: ss
253  integer(kind=kint) :: rcode
254  ss = trim(outfilename)
255  rcode = fstr_ctrl_get_param_ex( ctrl, 'FILENAME ', '# ', 0, 'S', ss )
256  end subroutine
257 
258  subroutine fstr_ctrl_get_output( ctrl, outctrl, islog, res, visual, femap )
259  integer(kind=kint), intent(in) :: ctrl
260  type(t_output_ctrl), intent(inout) :: outctrl
261  integer(kind=kint), intent(out) :: islog, res, visual, femap
262  integer(kind=kint) :: rcode, n
263  character(len=HECMW_NAME_LEN) :: ss
264  islog=0; res=0; visual=0; femap=0
265  if( fstr_ctrl_get_param_ex( ctrl, 'LOG ', '# ', 0, 'E', islog )/= 0 ) return
266  if( fstr_ctrl_get_param_ex( ctrl, 'RESULT ', '# ', 0, 'E', res )/= 0 ) return
267  if( fstr_ctrl_get_param_ex( ctrl, 'VISUAL ', '# ', 0, 'E', visual )/= 0 ) return
268  if( fstr_ctrl_get_param_ex( ctrl, 'UTABLE ', '# ', 0, 'E', femap )/= 0 ) return
269 
270  call fstr_init_outctrl(outctrl)
271  ss = ""
272  rcode = fstr_ctrl_get_param_ex( ctrl, 'FILE ', '# ', 0, 'S', ss )
273  if( len(trim(ss))>0 ) then
274  outctrl%filename = trim(ss)
275  endif
276  outctrl%frequency = 1
277  n = 0
278  rcode = fstr_ctrl_get_param_ex( ctrl, 'FREQUENCY ', '# ', 0, 'I', n )
279  if( n>0 ) outctrl%frequency = n
280  end subroutine
281 
282  subroutine print_output_ctrl( nfile, outctrl )
283  integer, intent(in) :: nfile
284  type(t_output_ctrl), intent(inout) :: outctrl
285  integer :: i
286  write( nfile, *) trim(outctrl%filename),outctrl%filenum,outctrl%frequency,outctrl%outinfo%num_items
287  do i=1,outctrl%outinfo%num_items
288  write( nfile, *) trim(outctrl%outinfo%keyWord(i)),outctrl%outinfo%on(i),outctrl%outinfo%vtype(i)
289  enddo
290  end subroutine
291 
292 end 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 information.
Definition: m_out.f90:6
subroutine fstr_init_outctrl(outctrl)
Definition: m_out.f90:228
subroutine initoutinfo(outinfo)
Definition: m_out.f90:40
subroutine print_output_ctrl(nfile, outctrl)
Definition: m_out.f90:283
subroutine fstr_ctrl_get_filename(ctrl, ss)
Definition: m_out.f90:251
integer function n_comp_valtype(vtype, ndim)
Definition: m_out.f90:204
subroutine fstr_copy_outctrl(outctrl1, outctrl2)
Definition: m_out.f90:236
subroutine write_outinfo(fnum, nitem, outinfo, outdata)
Definition: m_out.f90:186
subroutine fstr_ctrl_get_output(ctrl, outctrl, islog, res, visual, femap)
Definition: m_out.f90:259
logical function fstr_output_active(cstep, outctrl)
Definition: m_out.f90:244
output information
Definition: m_out.f90:17
output control such as output filename, output frequency etc.
Definition: m_out.f90:29