Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
READ_IO_FILES.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 SUBROUTINE read_io_files
55 
56  IMPLICIT NONE
57 
58  CHARACTER*50 :: ichr50
59 
60  integer :: idpacket
61 
62  OPEN(unit = 14, file=prefix(1:length(prefix))//".inp", status="OLD")
63 
64 
65  ichr50 = 'mkdir '//prefix(1:length(prefix))
66  CALL system(ichr50)
67 
68  ! -----READ LOAD DATA
69 ! READ(14,*) numnp, numel ! number of global nodes and elements
70 !
71 ! READ(14,*) delta
72 ! READ(14,*) numprop
73 ! ALLOCATE(ts_proportion(1:numprop),proportion(1:numprop))
74 ! DO l = 1,numprop
75 ! READ(14,*) ts_proportion(l), proportion(l)
76 ! ENDDO
77 
78  ALLOCATE(frontnode); nullify(frontnode%next)
79  first_front_node => frontnode; numscale_np = 0
80 
81  ALLOCATE(backnode); nullify(backnode%next)
82  first_back_node => backnode; numscale_np = 0
83 
84  numscale_bk = 0
85  numscale_ft = 0
86  maxz = -10000
87  minz = 10000
88 
89  DO
90  read(14,*) idpacket
91 
92  print*,idpacket
93 
94  select case (idpacket)
95 
96  case(1)
97  read(14,'()')
98 
99  case(2)
100 
101  !-----READ NODAL COORDINATES.
102  READ(14,*) numnp !, iaux, iaux, iaux, iaux
103 
104  ALLOCATE(node(numnp))
105 
106  ! This initially sets all nodes to have a boundary flag for internal
107  node(1:numnp)%marker = 0
108  node(1:numnp)%meshmark = 0
109 
110  ALLOCATE(meshcoor(1:3,1:numnp))
111  ALLOCATE(nboundtype(1:numnp))
112  DO l=1,numnp
113  READ(14,*) j,node(l)%coord(1:3) ! ,iaux
114 
115  ! Defines the maximum and minimum Z coord values for matching nodes
116  maxz = max(maxz, node(l)%coord(3))
117  minz = min(minz, node(l)%coord(3))
118 
119  ! new ! for ALE formulation
120  meshcoor(1:3,l) = node(l)%coord(1:3)
121 
122  END DO
123 
124  WRITE(6,*) "MinZ = ",minz, "MaxZ = ", maxz
125  ! Reassigns maxZ & minZ to offset possible discrepencies in node coords
126  maxz = maxz - .00001*maxz
127  minz = minz + .00001*minz
128 
129 
130 
131  DO l = 1, numnp
132 
133  IF (node(l)%coord(3) .LE. minz) THEN
134  backnode%ID = l
135  backnode%coord(1:3) = node(l)%coord(1:3)
136  ALLOCATE(backnode%next); backnode => backnode%next; nullify(backnode%next)
137  numscale_np = numscale_np + 1
138  numscale_bk = numscale_bk + 1
139 
140  ELSE IF (node(l)%coord(3) .GE. maxz) THEN
141  frontnode%ID = l
142  frontnode%coord(1:3) = node(l)%coord(1:3)
143  ALLOCATE(frontnode%next); frontnode => frontnode%next; nullify(frontnode%next)
144  numscale_np = numscale_np + 1
145  numscale_ft = numscale_ft + 1
146 
147  ! new ! for ALE formulation
148  meshcoor(1:3,l) = node(l)%coord(1:3)
149  END IF
150  END DO
151 
152  case(3)
153 
154  !---------------------------------!
155  !--- Read Nodal Boundary Flags ---!
156  !---------------------------------!
157 
158  frontnode => first_front_node
159  backnode => first_back_node
160 
161  READ(14,*) numbound ! , iaux
162  ALLOCATE(id(1:numbound))
163 
164  numboundmid = numbound
165  numboundend = numbound
166  numboundfirst = numbound
167 
168  DO l = 1, numbound
169  READ(14,*) id(l)%ID,id(l)%NdBCflag ! , iaux
170  ! Apply marker information to node data struct
171  node(id(l)%ID)%marker = id(l)%NdBCflag
172  IF((id(l)%NdBCflag .GE. 10) .AND. (id(l)%NdBCflag .LT. 100)) THEN
173  numboundmid = numboundmid - 1
174  numboundend = numboundend - 1
175  DO WHILE(associated(backnode%next))
176  IF (backnode%ID .EQ. id(l)%ID) THEN
177  backnode%marker = id(l)%NdBCflag
178  ENDIF
179  backnode => backnode%next
180  ENDDO
181 
182  ELSE IF (id(l)%NdBCflag .GE. 100) THEN
183  numboundmid = numboundmid - 1
184  numboundfirst = numboundfirst - 1
185  DO WHILE(associated(frontnode%next))
186  IF (frontnode%ID .EQ. id(l)%ID) THEN
187  frontnode%marker = id(l)%NdBCflag
188  ENDIF
189  frontnode => frontnode%next
190  ENDDO
191  END IF
192  frontnode => first_front_node
193  backnode => first_back_node
194  ENDDO
195 
196  case(4)
197 
198  !---------------------------------------------!
199  !--- Read Nodal Mesh Motion Boundary Flags ---!
200  !---------------------------------------------!
201 
202  READ(14,*) numboundmesh !, iaux
203  ALLOCATE(idmesh(1:numboundmesh)) !,rmesh(1:3,1:numboundmesh))
204 
205  numbmeshmid = numboundmesh
206  numbmeshend = numboundmesh
207  numbmeshfirst = numboundmesh
208 
209  DO l = 1, numboundmesh
210  READ(14,*) idmesh(l)%ID, idmesh(l)%NdBCflag !, iaux
211  ! Apply marker information to node data struct
212  node(idmesh(l)%ID)%meshmark = idmesh(l)%NdBCflag
213  IF((idmesh(l)%NdBCflag .GE. 10) .AND. (idmesh(l)%NdBCflag .LT. 100)) THEN
214  numbmeshmid = numbmeshmid - 1
215  numbmeshend = numbmeshend - 1
216  DO WHILE(associated(backnode%next))
217  IF (backnode%ID .EQ. idmesh(l)%ID) THEN
218  backnode%mesh = idmesh(l)%NdBCflag
219  ENDIF
220  backnode => backnode%next
221  ENDDO
222 
223  ELSE IF (idmesh(l)%NdBCflag .GE. 100) THEN
224  numbmeshmid = numbmeshmid - 1
225  numbmeshfirst = numbmeshfirst - 1
226  DO WHILE(associated(frontnode%next))
227  IF (frontnode%ID .EQ. idmesh(l)%ID) THEN
228  frontnode%mesh = idmesh(l)%NdBCflag
229  ENDIF
230  frontnode => frontnode%next
231  ENDDO
232  END IF
233  frontnode => first_front_node
234  backnode => first_back_node
235  ENDDO
236 
237 
238 
239  !-----Read cohesive element data, determine the length and angle
240 ! READ(14,*) !numco, numclst, numcohshared, nproc_neigh, num_border_coh
241 ! READ(14,*)
242 
243  case(5)
244 
245 ! READ(14,*) numcstet,l,num_border_cst, priv1, priv2
246  READ(14,*) numcstet,num_border_cst
247 
248  ALLOCATE(lmcstet(1:4,1:numcstet),matcstet(1:numcstet))
249 
250  !
251  ! -- Read element data.
252  ALLOCATE(elemlist); nullify(elemlist%next); nullify(elemlist%previous)
253  ALLOCATE(eboundlist); nullify(eboundlist%next); nullify(eboundlist%previous)
254  firstelem => elemlist
255  firstebound => eboundlist
256 
257  nboundryel3d = 0
258 
259  DO l = 1,numcstet
260  READ(14,*) matcstet(l), lmcstet(1:4,l)
261 
262  DO m = 1, numnp
263 
264  ! If there is a node on the boundary...
265  IF((node(m)%coord(3) .GE. maxz) .OR. (node(m)%coord(3) .LE. 0.000000)) THEN
266 
267  DO n = 1, 4
268  IF (m .EQ. lmcstet(n,l)) THEN
269  eboundlist%ID = l; eboundlist%conn(1:4) = lmcstet(1:4,l)
270  ALLOCATE(eboundlist%next); eboundlist => eboundlist%next; nullify(eboundlist%next)
271  nboundryel3d = nboundryel3d + 1
272 
273  goto 50
274  END IF
275  END DO
276 
277  END IF
278 
279  END DO
280  elemlist%ID = l; elemlist%conn(1:4) = lmcstet(1:4,l)
281  ALLOCATE(elemlist%next); elemlist => elemlist%next; nullify(elemlist%next)
282 50 END DO
283  print*,'Finished Case 5'
284  case (99)
285  exit
286  end select
287  enddo
288 
289 ! DEBUG ROUTINE...
290 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
291 ! OPEN(UNIT = 1000, FILE = "elemlist.dat", STATUS = "UNKNOWN")
292 !
293 ! elemlist => firstelem
294 ! DO WHILE(associated(elemlist%next))
295 ! write(1000,*) elemlist%ID, elemlist%conn(1:4)
296 ! elemlist => elemlist%next
297 ! END DO
298 ! DO WHILE(associated(elemlist%previous))
299 ! write(1000,*) elemlist%ID, elemlist%conn(1:4)
300 ! elemlist => elemlist%previous
301 ! END DO
302 !
303 ! CLOSE(1000)
304 !
305 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
306 
307  !
308  ! -- Read coh nodes that need to be sent to other processors
309  !
310 ! ALLOCATE(neigh(0:scale-1))
311 ! ALLOCATE(neigh_proc(1:nproc_neigh))
312 
313 ! DO i = 0,scale-1
314 ! READ(14,*) iaux ! should always be zero
315 ! ENDDO
316 
317  ! READ(14,*) iaux ! should always be zero
318 
319  !
320  ! -- Read lst nodes that need to be sent to other processors
321  !
322 
323  CLOSE(14)
324 
325  END SUBROUTINE read_io_files
326 
FT m(int i, int j) const
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine read_io_files
Definition: adj.h:150
const std::string & unit() const
Obtain the unit of the attribute.
Definition: Attribute.h:200
const NT & n
virtual std::ostream & print(std::ostream &os) const
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
j indices j
Definition: Indexing.h:6
unsigned long id(const Leda_like_handle &x)
Definition: Handle.h:107