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