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