FrontISTR  5.7.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
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 :: 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 = 43
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  end subroutine initoutinfo
181 
182  subroutine write_outinfo( fnum, nitem, outinfo, outdata )
183  integer, intent(in) :: fnum
184  integer, intent(in) :: nitem
185  type( output_info ), intent(in) :: outinfo
186  real(kind=kreal), intent(in) :: outdata(:,:)
187 
188  integer :: i, j, nsize, ncomp
189  if( nitem>outinfo%num_items ) return
190  if( .not. outinfo%on(nitem) ) return
191  nsize = size( outdata, 1 )
192  ncomp = size( outdata, 2 )
193  write( fnum, '(a)' ) trim(outinfo%keyWord(nitem))
194  do i=1,nsize
195  write( fnum, * ) (outdata(i,j),j=1,ncomp)
196  enddo
197  end subroutine write_outinfo
198 
199 
200  integer function n_comp_valtype( vtype, ndim )
201  integer, intent(in) :: vtype
202  integer, intent(in) :: ndim
203 
204  if( vtype>0 ) then
205  n_comp_valtype = vtype
206  else if( vtype==-1 ) then
207  n_comp_valtype = 1
208  else if( vtype==-2 ) then
209  n_comp_valtype = ndim
210  else if( vtype==-3 ) then
211  n_comp_valtype = ndim*(ndim+1)/2
212  if(ndim == 4 .or. ndim == 6)n_comp_valtype=6
213  else if( vtype==-4 ) then
214  n_comp_valtype = ndim*ndim
215  else if( vtype==-5 ) then
216  n_comp_valtype = 12
217  else
218  n_comp_valtype = 0
219  endif
220  end function n_comp_valtype
221 
222 
223  ! ----following t_output_ctrl------
224  subroutine fstr_init_outctrl(outctrl)
225  type(t_output_ctrl), intent(out) :: outctrl
226  outctrl%filename= trim(outfilename)
227  outctrl%filenum = -1
228  outctrl%frequency= 1
229  call initoutinfo( outctrl%outinfo )
230  end subroutine
231 
232  subroutine fstr_copy_outctrl(outctrl1, outctrl2)
233  type(t_output_ctrl), intent(out) :: outctrl1
234  type(t_output_ctrl), intent(in) :: outctrl2
235  outctrl1%filename = outctrl2%filename
236  outctrl1%filenum = outctrl2%filenum
237  outctrl1%frequency = outctrl2%frequency
238  end subroutine
239 
240  logical function fstr_output_active( cstep, outctrl )
241  integer, intent(in) :: cstep
242  type(t_output_ctrl), intent(in) :: outctrl
243  fstr_output_active = .false.
244  if( mod( cstep, outctrl%frequency )==0 ) fstr_output_active=.true.
245  end function
246 
247  subroutine fstr_ctrl_get_filename( ctrl, ss )
248  integer(kind=kint), intent(in) :: ctrl
249  character(len=HECMW_NAME_LEN), intent(out) :: ss
250  integer(kind=kint) :: rcode
251  ss = trim(outfilename)
252  rcode = fstr_ctrl_get_param_ex( ctrl, 'FILENAME ', '# ', 0, 'S', ss )
253  end subroutine
254 
255  subroutine fstr_ctrl_get_output( ctrl, outctrl, islog, res, visual, femap )
256  integer(kind=kint), intent(in) :: ctrl
257  type(t_output_ctrl), intent(inout) :: outctrl
258  integer(kind=kint), intent(out) :: islog, res, visual, femap
259  integer(kind=kint) :: rcode, n
260  character(len=HECMW_NAME_LEN) :: ss
261  islog=0; res=0; visual=0; femap=0
262  if( fstr_ctrl_get_param_ex( ctrl, 'LOG ', '# ', 0, 'E', islog )/= 0 ) return
263  if( fstr_ctrl_get_param_ex( ctrl, 'RESULT ', '# ', 0, 'E', res )/= 0 ) return
264  if( fstr_ctrl_get_param_ex( ctrl, 'VISUAL ', '# ', 0, 'E', visual )/= 0 ) return
265  if( fstr_ctrl_get_param_ex( ctrl, 'UTABLE ', '# ', 0, 'E', femap )/= 0 ) return
266 
267  call fstr_init_outctrl(outctrl)
268  ss = ""
269  rcode = fstr_ctrl_get_param_ex( ctrl, 'FILE ', '# ', 0, 'S', ss )
270  if( len(trim(ss))>0 ) then
271  outctrl%filename = trim(ss)
272  endif
273  outctrl%frequency = 1
274  n = 0
275  rcode = fstr_ctrl_get_param_ex( ctrl, 'FREQUENCY ', '# ', 0, 'I', n )
276  if( n>0 ) outctrl%frequency = n
277  end subroutine
278 
279  subroutine print_output_ctrl( nfile, outctrl )
280  integer, intent(in) :: nfile
281  type(t_output_ctrl), intent(inout) :: outctrl
282  integer :: i
283  write( nfile, *) trim(outctrl%filename),outctrl%filenum,outctrl%frequency,outctrl%outinfo%num_items
284  do i=1,outctrl%outinfo%num_items
285  write( nfile, *) trim(outctrl%outinfo%keyWord(i)),outctrl%outinfo%on(i),outctrl%outinfo%vtype(i)
286  enddo
287  end subroutine
288 
289 end module m_out
m_out::fstr_copy_outctrl
subroutine fstr_copy_outctrl(outctrl1, outctrl2)
Definition: m_out.f90:233
m_out::fstr_output_active
logical function fstr_output_active(cstep, outctrl)
Definition: m_out.f90:241
m_out
This module manages step information.
Definition: m_out.f90:6
m_out::output_info
output information
Definition: m_out.f90:17
m_out::fstr_ctrl_get_filename
subroutine fstr_ctrl_get_filename(ctrl, ss)
Definition: m_out.f90:248
m_out::print_output_ctrl
subroutine print_output_ctrl(nfile, outctrl)
Definition: m_out.f90:280
m_out::t_output_ctrl
output control such as output filename, output frequency etc.
Definition: m_out.f90:29
m_out::fstr_init_outctrl
subroutine fstr_init_outctrl(outctrl)
Definition: m_out.f90:225
m_out::n_comp_valtype
integer function n_comp_valtype(vtype, ndim)
Definition: m_out.f90:201
m_out::fstr_ctrl_get_output
subroutine fstr_ctrl_get_output(ctrl, outctrl, islog, res, visual, femap)
Definition: m_out.f90:256
hecmw
Definition: hecmw.f90:6
m_out::write_outinfo
subroutine write_outinfo(fnum, nitem, outinfo, outdata)
Definition: m_out.f90:183
fstr_ctrl_get_param_ex
int fstr_ctrl_get_param_ex(int *ctrl, const char *param_name, const char *value_list, int *necessity, char *type, void *val)
Definition: fstr_ctrl_util.c:1404
m_out::initoutinfo
subroutine initoutinfo(outinfo)
Definition: m_out.f90:40