Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
! |
! ||===\\ |
! || \\ |
! || || //==\\ || || //==|| ||/==\\ |
! || || || || || || || || || || |
! || // || || || || || || || |
! ||===// \\==// \\==\\ \\==\\ || |
! |
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
! |
! WRITE_GLOBAL_OUTPUT Nov. 2006 |
! |
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
subroutine write_global_output (params,istep,iter,current_time,osolve,ov, &
vo,surface,cl,outputtype)
!------------------------------------------------------------------------------|
!(((((((((((((((( Purpose of the routine ))))))))))))))))))))))))))))))))))))))
!------------------------------------------------------------------------------|
! subroutine to generate large global output files in subdirectory OUT
! the files contain:
! - array lengths
! - nodal values
! - icon array
! - octree array
! - bad faces array
! - void arrays
! - surface information
! istep is time step
! osolve is solve octree
! surface are surfaces
! ns is number of surfaces
! see code for details and order of output
! Note that if you modify this routine, you may also need to modify
! define_ov.f90, define_cloud.f90, and define_surface.f90
!------------------------------------------------------------------------------|
!(((((((((((((((( declaration of the subroutine arguments ))))))))))))))))))))
!------------------------------------------------------------------------------|
use definitions
implicit none
type (parameters) params
integer istep,iter
double precision current_time
type (octreesolve) osolve
type (octreev) ov
type (void) vo
type (sheet) surface(params%ns)
type (cloud) cl
character*5 outputtype
!------------------------------------------------------------------------------|
!(((((((((((((((( declaration of the subroutine internal variables )))))))))))))
!------------------------------------------------------------------------------|
integer i,j,is,k
integer iproc,nproc,ierr
character*4 cistep,citer
integer no,nn,nl,nf,ns,np,nsi4,nsi8,i4,i8,lrecord
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|
INCLUDE 'mpif.h'
call mpi_comm_size (mpi_comm_world,nproc,ierr)
call mpi_comm_rank (mpi_comm_world,iproc,ierr)
if (iproc.eq.0) then
! i4 and i8 are the units to be used for a single and a double real
i4=1
i8=i4*2
! first calculates the record length
no=osolve%octree(3)
nn=osolve%nnode
nl=osolve%nleaves
nf=osolve%nface
ns=osolve%nlsf
np=cl%np
select case (outputtype)
case ('debug')
nsi4=0
nsi8=0
do is=1,ns
nsi4=nsi4+2+3*surface(is)%nt
nsi8=nsi8+1+8*surface(is)%nsurface
enddo
case ('final')
nsi4=0
nsi8=0
do is=1,ns
nsi4=nsi4+2+3*surface(is)%nt
nsi8=nsi8+1+11*surface(is)%nsurface
enddo
case default
call stop_run ('pb with argument in write_global_output$')
end select
lrecord=6*i4+i8 &
+6*i8*nn &
+(ns+2)*i8*nn &
+i8*nn+4*i4*nn &
+9*i4*nl+2*i8*nl &
+i4*no+9*i4*nf &
+i4*(5*nn+nf) &
+i4*nsi4+i8*nsi8 &
+i4*np+10*i8*np
! then open the file
write (cistep,'(i4)') istep
if (istep.lt.1000) cistep(1:1)='0'
if (istep.lt.100) cistep(1:2)='00'
if (istep.lt.10) cistep(1:3)='000'
select case (outputtype)
case ('debug')
write (citer,'(i4)') iter
if (iter.lt.1000) citer(1:1)='0'
if (iter.lt.100) citer(1:2)='00'
if (iter.lt.10) citer(1:3)='000'
open (9,file='OUT/time_'//cistep//'_'//citer//'.txt',status='unknown', &
access='direct',form='unformatted',recl=lrecord)
case ('final')
open (9,file='OUT/time_'//cistep//'.txt',status='unknown', &
access='direct',form='unformatted',recl=lrecord)
end select
! write to the file
select case (outputtype)
case ('debug')
write (9,rec=1) no,nn,nl,nf,ns,np,current_time, &
osolve%x(1:nn),osolve%y(1:nn),osolve%z(1:nn),osolve%u(1:nn),osolve%v(1:nn),osolve%w(1:nn), &
(osolve%lsf(1:nn,j),j=1,ns),osolve%temp(1:nn),ov%temporary_nodal_pressure(1:nn), &
osolve%strain(1:nn),osolve%kfix(1:3*nn),osolve%kfixt(1:nn), &
osolve%icon(1:8,1:nl),osolve%crit(1:nl),osolve%e2d(1:nl),ov%whole_leaf_in_fluid(1:nl), &
osolve%octree(1:no),osolve%iface(1:9,1:nf), &
vo%node(1:nn),vo%leaf(1:nn),vo%ftr(1:nn),vo%rtf(1:nn),vo%influid(1:nn),vo%face(1:nf),&
(surface(is)%nsurface,surface(is)%activation_time,surface(is)%nt, &
surface(is)%r(1:surface(is)%nsurface), surface(is)%s(1:surface(is)%nsurface), &
surface(is)%x(1:surface(is)%nsurface),surface(is)%y(1:surface(is)%nsurface), &
surface(is)%z(1:surface(is)%nsurface),surface(is)%xn(1:surface(is)%nsurface) ,&
surface(is)%yn(1:surface(is)%nsurface),surface(is)%zn(1:surface(is)%nsurface), &
surface(is)%icon(1:3,1:surface(is)%nt),is=1,ns), &
cl%x(1:np),cl%y(1:np),cl%z(1:np),cl%x0(1:np),cl%y0(1:np),cl%z0(1:np), &
cl%strain(1:np),cl%lsf0(1:np),cl%temp(1:np),cl%press(1:np),cl%tag(1:np)
case ('final')
write (9,rec=1) no,nn,nl,nf,ns,np,current_time, &
osolve%x(1:nn),osolve%y(1:nn),osolve%z(1:nn),osolve%u(1:nn),osolve%v(1:nn),osolve%w(1:nn), &
(osolve%lsf(1:nn,j),j=1,ns),osolve%temp(1:nn),ov%temporary_nodal_pressure(1:nn), &
osolve%strain(1:nn),osolve%kfix(1:3*nn),osolve%kfixt(1:nn), &
osolve%icon(1:8,1:nl),osolve%crit(1:nl),osolve%e2d(1:nl),ov%whole_leaf_in_fluid(1:nl), &
osolve%octree(1:no),osolve%iface(1:9,1:nf), &
vo%node(1:nn),vo%leaf(1:nn),vo%ftr(1:nn),vo%rtf(1:nn),vo%influid(1:nn),vo%face(1:nf),&
(surface(is)%nsurface,surface(is)%activation_time,surface(is)%nt, &
surface(is)%r(1:surface(is)%nsurface), surface(is)%s(1:surface(is)%nsurface), &
surface(is)%x(1:surface(is)%nsurface),surface(is)%y(1:surface(is)%nsurface), &
surface(is)%z(1:surface(is)%nsurface),surface(is)%xn(1:surface(is)%nsurface) ,&
surface(is)%yn(1:surface(is)%nsurface),surface(is)%zn(1:surface(is)%nsurface), &
surface(is)%u(1:surface(is)%nsurface),surface(is)%v(1:surface(is)%nsurface), &
surface(is)%w(1:surface(is)%nsurface), &
surface(is)%icon(1:3,1:surface(is)%nt),is=1,ns), &
cl%x(1:np),cl%y(1:np),cl%z(1:np),cl%x0(1:np),cl%y0(1:np),cl%z0(1:np), &
cl%strain(1:np),cl%lsf0(1:np),cl%temp(1:np),cl%press(1:np),cl%tag(1:np)
end select
! finally close the file
close (9)
end if
return
end
!------------------------------------------------------------------------------|
!------------------------------------------------------------------------------|