Commit a50b739866bbeb1327162eab07430b84383c26de

Authored by Elena.Budnik
1 parent af16ae5a
Exists in master

return to old selection with modifs

Sources/Prop_code/sub_slct_p.f
... ... @@ -6,7 +6,8 @@ c======================================================================|
6 6 integer,intent(in) :: nang,ifnpo
7 7 real*8,intent(in) :: angref6(nang),dtr,touts
8 8 character*100 ,intent(in):: fntmp2(nang),fnin,fnout
9   - real*8,allocatable :: jsout(:,:),ddout(:,:,:),jstmp2(:,:)
  9 + real*8,allocatable :: jsout(:,:),ddout(:,:,:)
  10 +!!!! elena : para(13) !!! not para(12)
10 11 real*8 :: angref0,para(13),js1,sec0
11 12 integer :: i,j,ifn0,ifn1,ifn2,iang,nstep
12 13 integer :: iy0,im0,id0,jdd,jdd2,ihr0,imin0,isec0
... ... @@ -30,7 +31,6 @@ c======================================================================|
30 31  
31 32 ifn1=43
32 33 ifn2=44
33   -
34 34 !---read input data
35 35 call count_lines(fnin,nnin)
36 36 allocate(datain(13,nnin),jsin(nnin),dangi(nnin),dangi2(nnin))
... ... @@ -47,13 +47,13 @@ c======================================================================|
47 47 iang=1
48 48 angref0=angref6(iang)
49 49 call count_lines(fntmp2(iang),nstep)
50   - allocate(jsout(nang,nstep),ddout(nang,10,nstep)
  50 +!!!! elena : jsout(nang,nstep), jsoutrev(nang,nstep) => jsout(6,nstep), jsoutrev(6,nstep)
  51 + allocate(jsout(6,nstep),ddout(nang,10,nstep)
51 52 1 ,jsinref(nang,nstep),ang0(nstep),dango(nstep)
52   - 1 ,dang1(nang,nstep),dang2(nang,nstep),jsoutrev(nang,nstep))
  53 + 1 ,dang1(nang,nstep),dang2(nang,nstep),jsoutrev(6,nstep))
53 54 allocate(jstmp(nstep))
54 55 allocate(ddslct(10,nstep),jsslct(nstep))
55 56 allocate(islct(nstep),dangtmp(2,nang,nstep),jsinref2(nstep))
56   - allocate(jstmp2(6,nstep))
57 57  
58 58 do iang=1,nang
59 59 angref0=angref6(iang)
... ... @@ -85,7 +85,8 @@ c---angle evaluation
85 85 bd1=dangi2(1); bd2=dangi2(nnin)
86 86 call convim(jsin,jsinref(iang,:),dangi2,dang1(iang,:)
87 87 1 ,nnin,nstep,bd1,bd2)
88   -
  88 +
  89 +
89 90 dangi(:)=datain(12,:) !--input-ref
90 91 dangi2(1)=dangi(1)
91 92 do i=2,nnin
... ... @@ -96,6 +97,7 @@ c---angle evaluation
96 97 bd1=dangi2(1); bd2=dangi2(nnin)
97 98 call convim(jsin,jsoutrev(iang,:),dangi2,ang0(:)
98 99 1 ,nnin,nstep,bd1,bd2)
  100 +
99 101 dango(:)=ang0(:)-angref0 !--output-ref
100 102  
101 103 c---planeatry rotation effect (2nd step)
... ... @@ -125,24 +127,24 @@ c---angle selection
125 127 do iang=1,nang
126 128 idstep=0
127 129 do i=2,nstep-1
128   - jstmp2(1,i)=jsinref(iang,i+1)-jsinref(iang,i-1)
  130 + jsout(1,i)=jsinref(iang,i+1)-jsinref(iang,i-1)
129 131 if((idprop.eq.-1.and.jsout(1,i).ge.86400.*20.).or.
130 132 1 (idprop.eq.1.and.jsout(1,i).le.-86400.*20.)) then
131 133 idstep=idstep+1
132   - jstmp2(2,idstep)=jsinref(iang,i)
133   - jstmp2(3,idstep)=float(i)
  134 + jsout(2,idstep)=jsinref(iang,i)
  135 + jsout(3,idstep)=float(i)
134 136 endif
135 137 enddo
136 138 if(idstep.ge.1)then
137 139 do i=1,idstep/2.
138   - jstmp2(4,i)=minval(minloc(
139   - 1 abs(jsinref(iang,1:int(jstmp2(3,i)-1))-jstmp2(2,i*2))))
140   - dangtmp(2,iang,int(jstmp2(4,i)):int(jstmp2(3,i*2)))=901.
  140 + jsout(4,i)=minval(minloc(
  141 + 1 abs(jsinref(iang,1:int(jsout(3,i)-1))-jsout(2,i*2))))
  142 + dangtmp(2,iang,int(jsout(4,i)):int(jsout(3,i*2)))=901.
141 143 enddo
142 144 endif
143 145 do i=2,nstep-1
144   - jstmp2(5,i)=dang2(iang,i+1)-dang2(iang,i-1)
145   - if(abs(jstmp2(5,i)).lt.1.e-10) dangtmp(2,iang,i)=902.
  146 + jsout(5,i)=dang2(iang,i+1)-dang2(iang,i-1)
  147 + if(abs(jsout(5,i)).lt.1.e-10) dangtmp(2,iang,i)=902.
146 148 if((idprop.eq.-1.and.ddout(iang,10,i).ge.jsin(1))
147 149 1 .or.(idprop.eq.1.and.ddout(iang,10,i).le.jsin(1)))
148 150 1 dangtmp(2,iang,i)=999.
... ... @@ -209,7 +211,12 @@ c---angle evaluation: in-out
209 211 if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
210 212 call convim(jsin,dangw,dangi2,angwin(:)
211 213 1 ,nnin,nwout,bd1,bd2)
212   -
  214 +! write(6,1115) real(dangi(1:60))
  215 +! write(6,*) 'dangi2'
  216 +! write(6,1115) real(dangi2)
  217 +! write(6,*) 'angwin'
  218 +! write(6,1115) real(angwin)
  219 +
213 220 dangi(:)=datain(12,:) !--output-ref
214 221 dangi2(1)=dangi(1)
215 222 do i=2,nnin
... ... @@ -221,41 +228,47 @@ c---angle evaluation: in-out
221 228 if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
222 229 call convim(jsin,jswout,dangi2,angwout(:)
223 230 1 ,nnin,nwout,bd1,bd2)
224   -
225   - dangw=angwin-angwout !--difference
  231 +! write(6, *) 'angwout', nnin, nwout
  232 +! write(6,1115) real(angwout(1:60))
  233 +1115 format(15f7.1)
  234 + dangw=angwin-angwout !--difference
226 235 call angrev(dangw,dangw,nwout)
  236 +! write(6,1115) real(dangw)
  237 +
227 238 idstep=0; idstep2=0
228 239 do i=2,nwout
229 240 angw(i)=dangw(i)-dangw(i-1)
230   - if(angw(i).ge.300.) then
  241 + if(angw(i).ge.300.) then
231 242 idstep=idstep+1
232   - jstmp2(2,idstep)=jswout(i)
233   - jstmp2(3,idstep)=float(i)
  243 + jsout(2,idstep)=jswout(i)
  244 + jsout(3,idstep)=float(i)
234 245 endif
235 246 if(angw(i).le.-300.) then
236 247 idstep2=idstep2+1
237   - jstmp2(4,idstep2)=jswout(i)
238   - jstmp2(5,idstep2)=float(i)
  248 + jsout(4,idstep2)=jswout(i)
  249 + jsout(5,idstep2)=float(i)
239 250 endif
240   - enddo
241   -
  251 + enddo
  252 +
242 253 if(idprop.eq.1.and.idstep.ge.1.and.idstep*2.eq.idstep2)then
243   - dangw(int(jstmp2(5,idstep*2-1)):int(jstmp2(3,idstep)))
244   - 1 =dangw(int(jstmp2(5,idstep*2-1)):int(jstmp2(3,idstep)))+360.
245   - dangw(int(jstmp2(3,idstep)):int(jstmp2(5,idstep*2)))
246   - 1 =dangw(int(jstmp2(3,idstep)):int(jstmp2(5,idstep*2)))-360.
247   -c 1 =dangw(int(jstmp2(3,idstep))-1:int(jstmp2(5,idstep*2)))-360.
248   - ddwout1(11,int(jstmp2(5,idstep*2-1)):int(jstmp2(5,idstep*2)))=1.
  254 + dangw(int(jsout(5,idstep*2-1)):int(jsout(3,idstep)))
  255 + 1 =dangw(int(jsout(5,idstep*2-1)):int(jsout(3,idstep)))+360.
  256 +!!!!!! elena : dimensions mismatch
  257 + dangw(int(jsout(3,idstep)):int(jsout(5,idstep*2)))
  258 + 1 =dangw(int(jsout(3,idstep)):int(jsout(5,idstep*2)))-360.
  259 + ddwout1(11,int(jsout(5,idstep*2-1)):int(jsout(5,idstep*2)))=1.
249 260 endif
250   - if(idprop.eq.-1.and.idstep2.ge.1.and.idstep2*2.eq.idstep)then
251   - dangw(int(jstmp2(3,idstep2*2-1)):int(jstmp2(5,idstep2)))
252   - 1 =dangw(int(jstmp2(3,idstep2*2-1)):int(jstmp2(5,idstep2)))-360.
253   -c dangw(int(jstmp2(5,idstep2)):int(jstmp2(3,idstep2*2)))
254   - dangw(int(jstmp2(5,idstep2))-1:int(jstmp2(3,idstep2*2)))
255   - 1 =dangw(int(jstmp2(5,idstep2))-1:int(jstmp2(3,idstep2*2)))+360.
  261 +
  262 + if(idprop.eq.-1.and.idstep2.ge.1.and.idstep2*2.eq.idstep)then
  263 + dangw(int(jsout(3,idstep2*2-1)):int(jsout(5,idstep2)))
  264 + 1 =dangw(int(jsout(3,idstep2*2-1)):int(jsout(5,idstep2)))-360.
  265 +!!!!!! elena : dimensions mismatch
  266 + dangw(int(jsout(5,idstep2))-1:int(jsout(3,idstep2*2)))
  267 + 1 =dangw(int(jsout(5,idstep2))-1:int(jsout(3,idstep2*2)))+360.
256 268 endif
  269 +
257 270 ddwout1(9,:)=dangw !separation angle
258   -
  271 +! write(6,1115) real(dangw)
259 272 c---output
260 273 open(ifn2,file=fnout,status='unknown',form='formatted')
261 274 do i=1,nwout,1
... ... @@ -275,7 +288,7 @@ c write(62,'(i12,12e18.9)') int(jswout(i)),(ddwout1(j,i),j=1,11)
275 288 c---finish
276 289 deallocate(datain,jsin,dangi,dangi2
277 290 1 ,jsout,ddout,jsinref,ang0,dango,dang1,jsoutrev
278   - 1 ,jswout,ddwout,ddwout1,jstmp2)
  291 + 1 ,jswout,ddwout,ddwout1)
279 292 return
280 293 end
281 294 c==================================================
... ...
Sources/Prop_code/sub_slct_p.f.Tao.new 0 โ†’ 100644
... ... @@ -0,0 +1,282 @@
  1 +c======================================================================|
  2 + subroutine sub_slct(fnin,fnout,fntmp2,angref6,nang
  3 + 1 ,touts,dtr,idprop,ifnpo)
  4 +c======================================================================|
  5 + implicit none
  6 + integer,intent(in) :: nang,ifnpo
  7 + real*8,intent(in) :: angref6(nang),dtr,touts
  8 + character*100 ,intent(in):: fntmp2(nang),fnin,fnout
  9 + real*8,allocatable :: jsout(:,:),ddout(:,:,:),jstmp2(:,:)
  10 + real*8 :: angref0,para(13),js1,sec0
  11 + integer :: i,j,ifn0,ifn1,ifn2,iang,nstep
  12 + integer :: iy0,im0,id0,jdd,jdd2,ihr0,imin0,isec0
  13 + integer :: nwout,nnin
  14 + real*8 :: dtout,jswout0,jswout1,dtin
  15 + real*8 :: pdy0
  16 + real*8,allocatable :: jswout(:),ddwout(:,:,:),ddwout1(:,:)
  17 + real*8,allocatable :: datain(:,:),jsin(:),jsinref(:,:)
  18 + real*8,allocatable :: dang2(:,:),dang1(:,:)
  19 + real*8,allocatable :: dangi(:),dango(:),ang0(:)
  20 + real*8,allocatable :: jsoutrev(:,:),ddoutrev(:,:,:)
  21 + integer :: idprop
  22 + real*8,allocatable :: angwin(:),angwout(:),dangw(:),angw(:)
  23 + real*8,allocatable :: jstmp(:)
  24 + real*8,allocatable :: dangi2(:)
  25 + real*8 :: jstmp0 ,dangtmp0,bd1,bd2
  26 + integer :: idstep,idstep2
  27 + integer,allocatable :: islct(:)
  28 + real*8,allocatable :: dangtmp(:,:,:),ddslct(:,:),jsslct(:)
  29 + real*8,allocatable :: jsinref2(:)
  30 +
  31 + ifn1=43
  32 + ifn2=44
  33 +
  34 +!---read input data
  35 + call count_lines(fnin,nnin)
  36 + allocate(datain(13,nnin),jsin(nnin),dangi(nnin),dangi2(nnin))
  37 + open(ifn2,file=fnin,status='old')
  38 + do i=1,nnin
  39 + read(ifn2,*) js1,(para(j),j=1,13)
  40 + datain(:,i)=para(1:13)
  41 + jsin(i)=js1
  42 + enddo
  43 + dtin=jsin(2)-jsin(1)
  44 + close(ifn2,status='keep')
  45 +
  46 +!---count line & read simulation data
  47 + iang=1
  48 + angref0=angref6(iang)
  49 + call count_lines(fntmp2(iang),nstep)
  50 + allocate(jsout(nang,nstep),ddout(nang,10,nstep)
  51 + 1 ,jsinref(nang,nstep),ang0(nstep),dango(nstep)
  52 + 1 ,dang1(nang,nstep),dang2(nang,nstep),jsoutrev(nang,nstep))
  53 + allocate(jstmp(nstep))
  54 + allocate(ddslct(10,nstep),jsslct(nstep))
  55 + allocate(islct(nstep),dangtmp(2,nang,nstep),jsinref2(nstep))
  56 + allocate(jstmp2(6,nstep))
  57 +
  58 + do iang=1,nang
  59 + angref0=angref6(iang)
  60 + open(ifn1,file=fntmp2(iang),status='old')
  61 + do i=1,nstep
  62 + read(ifn1,*) js1,(para(j),j=1,10)
  63 + jsout(iang,i)=js1
  64 + ddout(iang,:,i)=para(1:10)
  65 + enddo
  66 + close(ifn1,status='keep')
  67 + enddo
  68 + jsinref(:,:)=ddout(:,10,:)
  69 +
  70 + write(ifnpo,*) nnin,nstep
  71 +c---time shift for radial difference
  72 + jsoutrev(:,:)=jsout(:,:)
  73 +
  74 +c---angle evaluation
  75 + do iang=1,nang !---6 ref.angles
  76 + angref0=angref6(iang)
  77 +
  78 + dangi(:)=datain(10,:)-angref0 !--input-ref
  79 + dangi2(1)=dangi(1)
  80 + do i=2,nnin
  81 + dangtmp0=dangi(i)-dangi(i-1)
  82 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  83 + dangi2(i)=dangi2(i-1)+dangtmp0
  84 + enddo
  85 + bd1=dangi2(1); bd2=dangi2(nnin)
  86 + call convim(jsin,jsinref(iang,:),dangi2,dang1(iang,:)
  87 + 1 ,nnin,nstep,bd1,bd2)
  88 +
  89 + dangi(:)=datain(12,:) !--input-ref
  90 + dangi2(1)=dangi(1)
  91 + do i=2,nnin
  92 + dangtmp0=dangi(i)-dangi(i-1)
  93 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  94 + dangi2(i)=dangi2(i-1)+dangtmp0
  95 + enddo
  96 + bd1=dangi2(1); bd2=dangi2(nnin)
  97 + call convim(jsin,jsoutrev(iang,:),dangi2,ang0(:)
  98 + 1 ,nnin,nstep,bd1,bd2)
  99 + dango(:)=ang0(:)-angref0 !--output-ref
  100 +
  101 +c---planeatry rotation effect (2nd step)
  102 + do idstep=1,3
  103 + call angrev(dango,dango,nstep)
  104 + jstmp=jsoutrev(iang,:)+dango/360.*26.*86400
  105 + do i=2,nstep
  106 + if(abs(jstmp(i)-jstmp(i-1)).gt.(maxval(jstmp)-minval(jstmp))
  107 + 1 /float(nstep)*5.) jstmp(i)=jstmp(i-1)
  108 + enddo
  109 +
  110 + bd1=dangi2(1); bd2=dangi2(nnin)
  111 + call convim(jsin,jstmp,dangi2,ang0(:)
  112 + 1 ,nnin,nstep,bd1,bd2)
  113 + dango(:)=ang0(:)-angref0 !--output-ref
  114 + enddo
  115 + dang2(iang,:)=dango(:)
  116 + enddo
  117 +c---angle selection
  118 + do iang=1,nang
  119 + call angrev(dang1(iang,:),dang1(iang,:),nstep)
  120 + call angrev(dang2(iang,:),dang2(iang,:),nstep)
  121 + enddo
  122 + dangtmp(2,:,:)=abs(dang1(:,:))+abs(dang2(:,:))
  123 + dangtmp(1,:,:)=dang1(:,:)+dang2(:,:)
  124 +
  125 + do iang=1,nang
  126 + idstep=0
  127 + do i=2,nstep-1
  128 + jstmp2(1,i)=jsinref(iang,i+1)-jsinref(iang,i-1)
  129 + if((idprop.eq.-1.and.jsout(1,i).ge.86400.*20.).or.
  130 + 1 (idprop.eq.1.and.jsout(1,i).le.-86400.*20.)) then
  131 + idstep=idstep+1
  132 + jstmp2(2,idstep)=jsinref(iang,i)
  133 + jstmp2(3,idstep)=float(i)
  134 + endif
  135 + enddo
  136 + if(idstep.ge.1)then
  137 + do i=1,idstep/2.
  138 + jstmp2(4,i)=minval(minloc(
  139 + 1 abs(jsinref(iang,1:int(jstmp2(3,i)-1))-jstmp2(2,i*2))))
  140 + dangtmp(2,iang,int(jstmp2(4,i)):int(jstmp2(3,i*2)))=901.
  141 + enddo
  142 + endif
  143 + do i=2,nstep-1
  144 + jstmp2(5,i)=dang2(iang,i+1)-dang2(iang,i-1)
  145 + if(abs(jstmp2(5,i)).lt.1.e-10) dangtmp(2,iang,i)=902.
  146 + if((idprop.eq.-1.and.ddout(iang,10,i).ge.jsin(1))
  147 + 1 .or.(idprop.eq.1.and.ddout(iang,10,i).le.jsin(1)))
  148 + 1 dangtmp(2,iang,i)=999.
  149 + enddo
  150 + enddo
  151 +
  152 + do i=1,nstep
  153 + islct(i)=minval(minloc(dangtmp(2,:,i)))
  154 + dango(i)=dangtmp(1,islct(i),i)
  155 + jsslct(i)=jsoutrev(islct(i),i)+ddout(islct(i),9,i)
  156 + 1 +dang2(islct(i),i)/360.*26.*86400.
  157 + ddslct(:,i)=ddout(islct(i),:,i)
  158 + enddo
  159 +
  160 +c---set time
  161 + dtout=touts*dtr
  162 + call js2ymds(iy0,im0,id0,sec0,maxval(jsoutrev(:,1)))
  163 + call ymds2js(iy0,im0,id0+int((idprop+1)*0.5),0.d0,jswout0)
  164 + call js2ymds(iy0,im0,id0,sec0,minval(jsoutrev(:,nstep)))
  165 + call ymds2js(iy0,im0,id0+int((idprop-1)*0.5),0.d0,jswout1)
  166 +
  167 + nwout=abs(jswout1-jswout0)/dtout
  168 + write(ifnpo,*) nwout
  169 +
  170 + allocate(jswout(nwout),ddwout(nang,10,nwout)
  171 + 1 ,ddwout1(11,nwout))
  172 + do i=1,nwout
  173 + if(idprop.eq.1) jswout(i)=jswout0+dble(i)*dtout !--REV0318
  174 + if(idprop.eq.-1) jswout(i)=jswout1+dble(i)*abs(dtout) !--REV0318
  175 + enddo
  176 +
  177 +c---data and angle conversion
  178 + do i=1,10
  179 + bd1=ddslct(i,1); bd2=ddslct(i,nstep)
  180 + if(idprop.eq.-1)then
  181 + bd1=ddslct(i,nstep); bd2=ddslct(i,1)
  182 + endif
  183 + call convim(jsslct(:),jswout(:),ddslct(i,:),ddwout1(i,:)
  184 + 1 ,nstep,nwout,bd1,bd2)
  185 + enddo
  186 +c---data lack
  187 + call convim(jsin,ddwout1(10,:),datain(13,:),ddwout1(11,:)
  188 + 1 ,nnin,nwout,datain(13,1),datain(13,nnin))
  189 + do i=2,nwout
  190 + if(abs(ddwout1(3,i)-ddwout1(3,i-1)).le.abs(ddwout1(3,i))*1.e-10)
  191 + 1 ddwout1(11,i)=1.
  192 + enddo
  193 +c---angle evaluation: in-out
  194 + allocate(angwin(nwout),angwout(nwout),dangw(nwout),angw(nwout))
  195 +
  196 + dangi(:)=datain(10,:) !--input-ref
  197 + dangi2(1)=dangi(1)
  198 + do i=2,nnin
  199 + dangtmp0=dangi(i)-dangi(i-1)
  200 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  201 + dangi2(i)=dangi2(i-1)+dangtmp0
  202 + enddo
  203 + dangw=ddwout1(10,:)
  204 + do i=101,nwout-100
  205 + dangw(i)=sum(ddwout1(10,i-100:i+100))/201.
  206 + enddo
  207 +
  208 + bd1=dangi2(1); bd2=dangi2(nnin)
  209 + if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
  210 + call convim(jsin,dangw,dangi2,angwin(:)
  211 + 1 ,nnin,nwout,bd1,bd2)
  212 +
  213 + dangi(:)=datain(12,:) !--output-ref
  214 + dangi2(1)=dangi(1)
  215 + do i=2,nnin
  216 + dangtmp0=dangi(i)-dangi(i-1)
  217 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  218 + dangi2(i)=dangi2(i-1)+dangtmp0
  219 + enddo
  220 + bd1=dangi2(1); bd2=dangi2(nnin)
  221 + if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
  222 + call convim(jsin,jswout,dangi2,angwout(:)
  223 + 1 ,nnin,nwout,bd1,bd2)
  224 +
  225 + dangw=angwin-angwout !--difference
  226 + call angrev(dangw,dangw,nwout)
  227 + idstep=0; idstep2=0
  228 + do i=2,nwout
  229 + angw(i)=dangw(i)-dangw(i-1)
  230 + if(angw(i).ge.300.) then
  231 + idstep=idstep+1
  232 + jstmp2(2,idstep)=jswout(i)
  233 + jstmp2(3,idstep)=float(i)
  234 + endif
  235 + if(angw(i).le.-300.) then
  236 + idstep2=idstep2+1
  237 + jstmp2(4,idstep2)=jswout(i)
  238 + jstmp2(5,idstep2)=float(i)
  239 + endif
  240 + enddo
  241 +
  242 + if(idprop.eq.1.and.idstep.ge.1.and.idstep*2.eq.idstep2)then
  243 + dangw(int(jstmp2(5,idstep*2-1)):int(jstmp2(3,idstep)))
  244 + 1 =dangw(int(jstmp2(5,idstep*2-1)):int(jstmp2(3,idstep)))+360.
  245 + dangw(int(jstmp2(3,idstep)):int(jstmp2(5,idstep*2)))
  246 + 1 =dangw(int(jstmp2(3,idstep)):int(jstmp2(5,idstep*2)))-360.
  247 +c 1 =dangw(int(jstmp2(3,idstep))-1:int(jstmp2(5,idstep*2)))-360.
  248 + ddwout1(11,int(jstmp2(5,idstep*2-1)):int(jstmp2(5,idstep*2)))=1.
  249 + endif
  250 + if(idprop.eq.-1.and.idstep2.ge.1.and.idstep2*2.eq.idstep)then
  251 + dangw(int(jstmp2(3,idstep2*2-1)):int(jstmp2(5,idstep2)))
  252 + 1 =dangw(int(jstmp2(3,idstep2*2-1)):int(jstmp2(5,idstep2)))-360.
  253 +c dangw(int(jstmp2(5,idstep2)):int(jstmp2(3,idstep2*2)))
  254 + dangw(int(jstmp2(5,idstep2))-1:int(jstmp2(3,idstep2*2)))
  255 + 1 =dangw(int(jstmp2(5,idstep2))-1:int(jstmp2(3,idstep2*2)))+360.
  256 + endif
  257 + ddwout1(9,:)=dangw !separation angle
  258 +
  259 +c---output
  260 + open(ifn2,file=fnout,status='unknown',form='formatted')
  261 + do i=1,nwout,1
  262 + call js2ymds(iy0,im0,id0,sec0,jswout(i))
  263 + ihr0=int(sec0/3600.)
  264 + imin0=int((sec0-ihr0*3600.)/60.)
  265 + isec0=int(sec0-(ihr0*3600.+imin0*60.))
  266 + pdy0=1.67e-27*ddwout1(1,i)*1.e6
  267 + 1 *(ddwout1(3,i)**2+ddwout1(4,i)**2)*1.e6
  268 + write(ifn2,'(i4.4,5(a1,i2.2),12(1pe13.5))')
  269 + 1 iy0,' ',im0,' ',id0,' ',ihr0,':',imin0,':',isec0
  270 + 1 ,ddwout1(1:4,i),ddwout1(7,i)
  271 + 2 ,pdy0*1.e9,ddwout1(9,i),ddwout1(11,i)
  272 +c write(62,'(i12,12e18.9)') int(jswout(i)),(ddwout1(j,i),j=1,11)
  273 + enddo
  274 +
  275 +c---finish
  276 + deallocate(datain,jsin,dangi,dangi2
  277 + 1 ,jsout,ddout,jsinref,ang0,dango,dang1,jsoutrev
  278 + 1 ,jswout,ddwout,ddwout1,jstmp2)
  279 + return
  280 + end
  281 +c==================================================
  282 +
... ...
Sources/Prop_code/sub_slct_p.f.my 0 โ†’ 100644
... ... @@ -0,0 +1,294 @@
  1 +c======================================================================|
  2 + subroutine sub_slct(fnin,fnout,fntmp2,angref6,nang
  3 + 1 ,touts,dtr,idprop,ifnpo)
  4 +c======================================================================|
  5 + implicit none
  6 + integer,intent(in) :: nang,ifnpo
  7 + real*8,intent(in) :: angref6(nang),dtr,touts
  8 + character*100 ,intent(in):: fntmp2(nang),fnin,fnout
  9 + real*8,allocatable :: jsout(:,:),ddout(:,:,:)
  10 +!!!! elena : para(13) !!! not para(12)
  11 + real*8 :: angref0,para(13),js1,sec0
  12 + integer :: i,j,ifn0,ifn1,ifn2,iang,nstep
  13 + integer :: iy0,im0,id0,jdd,jdd2,ihr0,imin0,isec0
  14 + integer :: nwout,nnin
  15 + real*8 :: dtout,jswout0,jswout1,dtin
  16 + real*8 :: pdy0
  17 + real*8,allocatable :: jswout(:),ddwout(:,:,:),ddwout1(:,:)
  18 + real*8,allocatable :: datain(:,:),jsin(:),jsinref(:,:)
  19 + real*8,allocatable :: dang2(:,:),dang1(:,:)
  20 + real*8,allocatable :: dangi(:),dango(:),ang0(:)
  21 + real*8,allocatable :: jsoutrev(:,:),ddoutrev(:,:,:)
  22 + integer :: idprop
  23 + real*8,allocatable :: angwin(:),angwout(:),dangw(:),angw(:)
  24 + real*8,allocatable :: jstmp(:)
  25 + real*8,allocatable :: dangi2(:)
  26 + real*8 :: jstmp0 ,dangtmp0,bd1,bd2
  27 + integer :: idstep,idstep2
  28 + integer,allocatable :: islct(:)
  29 + real*8,allocatable :: dangtmp(:,:,:),ddslct(:,:),jsslct(:)
  30 + real*8,allocatable :: jsinref2(:)
  31 +
  32 + ifn1=43
  33 + ifn2=44
  34 +!---read input data
  35 + call count_lines(fnin,nnin)
  36 + allocate(datain(13,nnin),jsin(nnin),dangi(nnin),dangi2(nnin))
  37 + open(ifn2,file=fnin,status='old')
  38 + do i=1,nnin
  39 + read(ifn2,*) js1,(para(j),j=1,13)
  40 + datain(:,i)=para(1:13)
  41 + jsin(i)=js1
  42 + enddo
  43 + dtin=jsin(2)-jsin(1)
  44 + close(ifn2,status='keep')
  45 +
  46 +!---count line & read simulation data
  47 + iang=1
  48 + angref0=angref6(iang)
  49 + call count_lines(fntmp2(iang),nstep)
  50 + allocate(jsout(nang,nstep),ddout(nang,10,nstep)
  51 + 1 ,jsinref(nang,nstep),ang0(nstep),dango(nstep)
  52 + 1 ,dang1(nang,nstep),dang2(nang,nstep),jsoutrev(nang,nstep))
  53 + allocate(jstmp(nstep))
  54 + allocate(ddslct(10,nstep),jsslct(nstep))
  55 + allocate(islct(nstep),dangtmp(2,nang,nstep),jsinref2(nstep))
  56 +
  57 + do iang=1,nang
  58 + angref0=angref6(iang)
  59 + open(ifn1,file=fntmp2(iang),status='old')
  60 + do i=1,nstep
  61 + read(ifn1,*) js1,(para(j),j=1,10)
  62 + jsout(iang,i)=js1
  63 + ddout(iang,:,i)=para(1:10)
  64 + enddo
  65 + close(ifn1,status='keep')
  66 + enddo
  67 + jsinref(:,:)=ddout(:,10,:)
  68 +
  69 + write(ifnpo,*) nnin,nstep
  70 +c---time shift for radial difference
  71 + jsoutrev(:,:)=jsout(:,:)
  72 +
  73 +c---angle evaluation
  74 + do iang=1,nang !---6 ref.angles
  75 + angref0=angref6(iang)
  76 +
  77 + dangi(:)=datain(10,:)-angref0 !--input-ref
  78 + dangi2(1)=dangi(1)
  79 + do i=2,nnin
  80 + dangtmp0=dangi(i)-dangi(i-1)
  81 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  82 + dangi2(i)=dangi2(i-1)+dangtmp0
  83 + enddo
  84 + bd1=dangi2(1); bd2=dangi2(nnin)
  85 + call convim(jsin,jsinref(iang,:),dangi2,dang1(iang,:)
  86 + 1 ,nnin,nstep,bd1,bd2)
  87 +
  88 +
  89 + dangi(:)=datain(12,:) !--input-ref
  90 + dangi2(1)=dangi(1)
  91 + do i=2,nnin
  92 + dangtmp0=dangi(i)-dangi(i-1)
  93 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  94 + dangi2(i)=dangi2(i-1)+dangtmp0
  95 + enddo
  96 + bd1=dangi2(1); bd2=dangi2(nnin)
  97 + call convim(jsin,jsoutrev(iang,:),dangi2,ang0(:)
  98 + 1 ,nnin,nstep,bd1,bd2)
  99 +
  100 + dango(:)=ang0(:)-angref0 !--output-ref
  101 +
  102 +c---planeatry rotation effect (2nd step)
  103 + do idstep=1,3
  104 + call angrev(dango,dango,nstep)
  105 + jstmp=jsoutrev(iang,:)+dango/360.*26.*86400
  106 + do i=2,nstep
  107 + if(abs(jstmp(i)-jstmp(i-1)).gt.(maxval(jstmp)-minval(jstmp))
  108 + 1 /float(nstep)*5.) jstmp(i)=jstmp(i-1)
  109 + enddo
  110 +
  111 + bd1=dangi2(1); bd2=dangi2(nnin)
  112 + call convim(jsin,jstmp,dangi2,ang0(:)
  113 + 1 ,nnin,nstep,bd1,bd2)
  114 + dango(:)=ang0(:)-angref0 !--output-ref
  115 + enddo
  116 + dang2(iang,:)=dango(:)
  117 + enddo
  118 +c---angle selection
  119 + do iang=1,nang
  120 + call angrev(dang1(iang,:),dang1(iang,:),nstep)
  121 + call angrev(dang2(iang,:),dang2(iang,:),nstep)
  122 + enddo
  123 + dangtmp(2,:,:)=abs(dang1(:,:))+abs(dang2(:,:))
  124 + dangtmp(1,:,:)=dang1(:,:)+dang2(:,:)
  125 +
  126 + do iang=1,nang
  127 + idstep=0
  128 + do i=2,nstep-1
  129 + jsout(1,i)=jsinref(iang,i+1)-jsinref(iang,i-1)
  130 + if((idprop.eq.-1.and.jsout(1,i).ge.86400.*20.).or.
  131 + 1 (idprop.eq.1.and.jsout(1,i).le.-86400.*20.)) then
  132 + idstep=idstep+1
  133 + jsout(2,idstep)=jsinref(iang,i)
  134 + jsout(3,idstep)=float(i)
  135 + endif
  136 + enddo
  137 + if(idstep.ge.1)then
  138 + do i=1,idstep/2.
  139 + jsout(4,i)=minval(minloc(
  140 + 1 abs(jsinref(iang,1:int(jsout(3,i)-1))-jsout(2,i*2))))
  141 + dangtmp(2,iang,int(jsout(4,i)):int(jsout(3,i*2)))=901.
  142 + enddo
  143 + endif
  144 + do i=2,nstep-1
  145 + jsout(5,i)=dang2(iang,i+1)-dang2(iang,i-1)
  146 + if(abs(jsout(5,i)).lt.1.e-10) dangtmp(2,iang,i)=902.
  147 + if((idprop.eq.-1.and.ddout(iang,10,i).ge.jsin(1))
  148 + 1 .or.(idprop.eq.1.and.ddout(iang,10,i).le.jsin(1)))
  149 + 1 dangtmp(2,iang,i)=999.
  150 + enddo
  151 + enddo
  152 +
  153 + do i=1,nstep
  154 + islct(i)=minval(minloc(dangtmp(2,:,i)))
  155 + dango(i)=dangtmp(1,islct(i),i)
  156 + jsslct(i)=jsoutrev(islct(i),i)+ddout(islct(i),9,i)
  157 + 1 +dang2(islct(i),i)/360.*26.*86400.
  158 + ddslct(:,i)=ddout(islct(i),:,i)
  159 + enddo
  160 +
  161 +c---set time
  162 + dtout=touts*dtr
  163 + call js2ymds(iy0,im0,id0,sec0,maxval(jsoutrev(:,1)))
  164 + call ymds2js(iy0,im0,id0+int((idprop+1)*0.5),0.d0,jswout0)
  165 + call js2ymds(iy0,im0,id0,sec0,minval(jsoutrev(:,nstep)))
  166 + call ymds2js(iy0,im0,id0+int((idprop-1)*0.5),0.d0,jswout1)
  167 +
  168 + nwout=abs(jswout1-jswout0)/dtout
  169 + write(ifnpo,*) nwout
  170 +
  171 + allocate(jswout(nwout),ddwout(nang,10,nwout)
  172 + 1 ,ddwout1(11,nwout))
  173 + do i=1,nwout
  174 + if(idprop.eq.1) jswout(i)=jswout0+dble(i)*dtout !--REV0318
  175 + if(idprop.eq.-1) jswout(i)=jswout1+dble(i)*abs(dtout) !--REV0318
  176 + enddo
  177 +
  178 +c---data and angle conversion
  179 + do i=1,10
  180 + bd1=ddslct(i,1); bd2=ddslct(i,nstep)
  181 + if(idprop.eq.-1)then
  182 + bd1=ddslct(i,nstep); bd2=ddslct(i,1)
  183 + endif
  184 + call convim(jsslct(:),jswout(:),ddslct(i,:),ddwout1(i,:)
  185 + 1 ,nstep,nwout,bd1,bd2)
  186 + enddo
  187 +c---data lack
  188 + call convim(jsin,ddwout1(10,:),datain(13,:),ddwout1(11,:)
  189 + 1 ,nnin,nwout,datain(13,1),datain(13,nnin))
  190 + do i=2,nwout
  191 + if(abs(ddwout1(3,i)-ddwout1(3,i-1)).le.abs(ddwout1(3,i))*1.e-10)
  192 + 1 ddwout1(11,i)=1.
  193 + enddo
  194 +c---angle evaluation: in-out
  195 + allocate(angwin(nwout),angwout(nwout),dangw(nwout),angw(nwout))
  196 +
  197 + dangi(:)=datain(10,:) !--input-ref
  198 + dangi2(1)=dangi(1)
  199 + do i=2,nnin
  200 + dangtmp0=dangi(i)-dangi(i-1)
  201 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  202 + dangi2(i)=dangi2(i-1)+dangtmp0
  203 + enddo
  204 + dangw=ddwout1(10,:)
  205 + do i=101,nwout-100
  206 + dangw(i)=sum(ddwout1(10,i-100:i+100))/201.
  207 + enddo
  208 +
  209 + bd1=dangi2(1); bd2=dangi2(nnin)
  210 + if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
  211 + call convim(jsin,dangw,dangi2,angwin(:)
  212 + 1 ,nnin,nwout,bd1,bd2)
  213 +! write(6,1115) real(dangi(1:60))
  214 +! write(6,*) 'dangi2'
  215 +! write(6,1115) real(dangi2)
  216 +! write(6,*) 'angwin'
  217 +! write(6,1115) real(angwin)
  218 +
  219 + dangi(:)=datain(12,:) !--output-ref
  220 + dangi2(1)=dangi(1)
  221 + do i=2,nnin
  222 + dangtmp0=dangi(i)-dangi(i-1)
  223 + if(abs(dangtmp0).ge.300.) dangtmp0=0.
  224 + dangi2(i)=dangi2(i-1)+dangtmp0
  225 + enddo
  226 + bd1=dangi2(1); bd2=dangi2(nnin)
  227 + if(idprop.eq.-1)then;bd1=dangi2(nnin);bd2=dangi2(1);endif
  228 + call convim(jsin,jswout,dangi2,angwout(:)
  229 + 1 ,nnin,nwout,bd1,bd2)
  230 +! write(6, *) 'angwout', nnin, nwout
  231 +! write(6,1115) real(angwout(1:60))
  232 +1115 format(15f7.1)
  233 + dangw=angwin-angwout !--difference
  234 + call angrev(dangw,dangw,nwout)
  235 +! write(6,1115) real(dangw)
  236 +
  237 + idstep=0; idstep2=0
  238 + do i=2,nwout
  239 + angw(i)=dangw(i)-dangw(i-1)
  240 + if(angw(i).ge.300.) then
  241 + idstep=idstep+1
  242 + jsout(2,idstep)=jswout(i)
  243 + jsout(3,idstep)=float(i)
  244 + endif
  245 + if(angw(i).le.-300.) then
  246 + idstep2=idstep2+1
  247 + jsout(4,idstep2)=jswout(i)
  248 + jsout(5,idstep2)=float(i)
  249 + endif
  250 + enddo
  251 +
  252 + if(idprop.eq.1.and.idstep.ge.1.and.idstep*2.eq.idstep2)then
  253 + dangw(int(jsout(5,idstep*2-1)):int(jsout(3,idstep)))
  254 + 1 =dangw(int(jsout(5,idstep*2-1)):int(jsout(3,idstep)))+360.
  255 +!!!!!! elena : dimensions mismatch
  256 + dangw(int(jsout(3,idstep)):int(jsout(5,idstep*2)))
  257 + 1 =dangw(int(jsout(3,idstep)):int(jsout(5,idstep*2)))-360.
  258 + ddwout1(11,int(jsout(5,idstep*2-1)):int(jsout(5,idstep*2)))=1.
  259 + endif
  260 +
  261 + if(idprop.eq.-1.and.idstep2.ge.1.and.idstep2*2.eq.idstep)then
  262 + dangw(int(jsout(3,idstep2*2-1)):int(jsout(5,idstep2)))
  263 + 1 =dangw(int(jsout(3,idstep2*2-1)):int(jsout(5,idstep2)))-360.
  264 +!!!!!! elena : dimensions mismatch
  265 + dangw(int(jsout(5,idstep2))-1:int(jsout(3,idstep2*2)))
  266 + 1 =dangw(int(jsout(5,idstep2))-1:int(jsout(3,idstep2*2)))+360.
  267 + endif
  268 +
  269 + ddwout1(9,:)=dangw !separation angle
  270 +! write(6,1115) real(dangw)
  271 +c---output
  272 + open(ifn2,file=fnout,status='unknown',form='formatted')
  273 + do i=1,nwout,1
  274 + call js2ymds(iy0,im0,id0,sec0,jswout(i))
  275 + ihr0=int(sec0/3600.)
  276 + imin0=int((sec0-ihr0*3600.)/60.)
  277 + isec0=int(sec0-(ihr0*3600.+imin0*60.))
  278 + pdy0=1.67e-27*ddwout1(1,i)*1.e6
  279 + 1 *(ddwout1(3,i)**2+ddwout1(4,i)**2)*1.e6
  280 + write(ifn2,'(i4.4,5(a1,i2.2),12(1pe13.5))')
  281 + 1 iy0,' ',im0,' ',id0,' ',ihr0,':',imin0,':',isec0
  282 + 1 ,ddwout1(1:4,i),ddwout1(7,i)
  283 + 2 ,pdy0*1.e9,ddwout1(9,i),ddwout1(11,i)
  284 +c write(62,'(i12,12e18.9)') int(jswout(i)),(ddwout1(j,i),j=1,11)
  285 + enddo
  286 +
  287 +c---finish
  288 + deallocate(datain,jsin,dangi,dangi2
  289 + 1 ,jsout,ddout,jsinref,ang0,dango,dang1,jsoutrev
  290 + 1 ,jswout,ddwout,ddwout1)
  291 + return
  292 + end
  293 +c==================================================
  294 +
... ...