text stringlengths 9 3.83M |
|---|
subroutine DRAWSSD(aK1,aK2,ncont,svals,nobs,x,y,w)
c To draw SSD contours for fit of hyperbola
c Much the same as drawcont.for (called from CVSIMPg), but data arrays
c x,y,n specified differently -to draw Scrit contours when problems
c are encountered in hypfit program (called from hyplik.for)
c Two values of Ymax are calculated for each specified K, by call
c to CONTSSD. In the call, specify the range of K values to be used
c as aK1 to aK2, and the number of contours to be calculated, as ncont
c contours, for SSD=svals(i), i=1,2,..,ncont
real*4 svals(ncont)
real*4 x(100),y(100),w(100)
allocatable:: yhi,ylo,ycal,xcal
real*4 yhi(:),ylo(:),ycal(:,:),xcal(:,:)
allocatable:: XVAL,YVAL
real XVAL(:,:),YVAL(:,:) !for VPLOT
c real*4 xobs(niobs,njset),yobs(niobs,njset),wt(niobs,njset)
c integer nj(njset)
logical complex,allocated,first,bad
c= real aKint(nint),Ymint(nint)
character*1 ans,UC
c For vplot
integer ndat(3),icurvd(3),isym(3),ijoin(3)
integer icurvw(3) !new for VPLOT5
real symsiz(3)
c for calc curves
allocatable:: ncal,icurvc,iline
integer ncal(:),icurvc(:),iline(:)
logical fitted,doframe,autplt,interp,landscap
character*40 titlex,titley
character*44 title1
real theta(1) !not used
logical mono
COMMON/cols/icol(100),mono
c
3 continue
c First calculate the contours
ncalc=500
if(aK1.gt.aK2) then
temp=aK1
aK1=aK2
aK2=temp
endif
dk=(aK2-aK1)/float(ncalc)
c
n2=2*ncalc !get two y values for eah x (=K) value
Allocate(ylo(ncalc),yhi(ncalc))
allocate(ycal(n2+1,ncont),xcal(n2+1,ncont))
allocate(ncal(ncont),icurvc(ncont),iline(ncont))
nint=1
allocate(xval(nint,3),yval(nint,3)) !not used
ndc1=n2+1
ndimc=ncont
nint=1 !no data points
ndv1=nint
ndimd=3
c
ymin1=1.e37
ymax1=-1.e37
c Calculate contours
do n=1,ncont !contour number n
SSD=svals(n)
n1=0 !number of pairs of points to be plotted for contour #n
first=.false.
i=0 !index for x values
do k=1,ncalc !loop through K values
aK=aK1+float(k-1)*dk !current K value
c CONTSSD calculates the SSD contours for fit of hyperbola
c Returns the two values of Ymax in y1,y2 (if complex=false), given
c data in x,y,n and specified values of K and SSD.
c Check that K+x is not near zero (can happen with simulated expts!)
do j=1,n
bad=x(j)+aK.lt.1.e-5
enddo
if(bad) goto 11 !skip this K value
call CONTSSD(y1,y2,complex,x,y,w,nobs,SSD,aK)
if(.not.complex) then
first=.true.
n1=n1+1
yhi(n1)=y1
ylo(n1)=y2
xcal(n1,n)=aK
else
if(first) goto 10 !end of this contour passed
endif
11 continue
enddo
10 continue
c One contour now completed, for current SSD. Keep it in ycal(i,n).
c To display must have correct sequence (if points are to be joined by lines)
ncal(n)=n1
do i=1,n1
ycal(i,n)=ylo(i)
enddo
n2=2*n1
do i=1,n1
j=n2-i+1
ycal(j,n)=yhi(i)
xcal(j,n)=xcal(i,n)
enddo
ncal(n)=n2 !total number to be plotted
do i=1,ncal(n)
if(ycal(i,n).gt.ymax1) ymax1=ycal(i,n)
if(ycal(i,n).lt.ymin1) ymin1=ycal(i,n)
enddo
c Add one more point, = first point, so contour closed
n2=n2+1
ncal(n)=n2
xcal(n2,n)=xcal(1,n)
ycal(n2,n)=ycal(1,n)
enddo
c
deallocate(yhi,ylo)
c
c Now plot them
ncurvd=0
c ncurvd=3
ndat(1)=1 !init guess
ndat(2)=nint-2 !the rest
ndat(3)=1 !the minimum
c xval(1,1)=aKint(1)
c yval(1,1)=Ymint(1)
c do i=1,nint-2
c xval(i,2)=aKint(i+1)
c yval(i,2)=Ymint(i+1)
c enddo
c xval(1,3)=aKint(nint)
c yval(1,3)=Ymint(nint)
isym(1)=-3 !square
isym(2)=-1 !triangle
isym(3)=-7 !circle
symsiz(1)=2.
symsiz(2)=1.
symsiz(3)=2.
do i=1,3
icurvd(i)=i
ijoin(i)=0
icurvw(i)=-1
enddo
isetcol=0 !default colours
isetcol=1 !default if -1 on entry
do i=1,100
icol(i)=-1
enddo
c Calc curves
c ISCAL=4 if input values of xmin,xmax,ymin,ymax to be used; rest internal
c iscal=1 !scale internally
iscal=4
xmin=0.
xmax=aK2
if(aK2.lt.1.0) xmax=1.0
ymin=0.
ymax=ymax1
c
c call FIXAX(aK1,aK2,xmin,xmax,xtic,0) !always non-log
c call FIXAX(ymin1,ymax1,ymin,ymax,ytic,0)
ncurvc=ncont
do i=1,ncont
icurvc(i)=i
iline(i)=0 !continuous
enddo
c ixlo=-1 !whole screen
ixlo=1300 !square graph
ixhi=5500
iylo=1500
iyhi=5700
ntx=5
nty=5
itx=1 !ticks orientated normally
ity=1
symsiz(1)=-1.0 !default symbol sizes
doframe=.true.
landscap=.true.
autplt=.false.
ncjump=0
nvjump=0
autplt=.false.
fitted=.false.
itrace=0
c kwi=niobs !dimensions of weight()
c kwj=njset
kwi=1
kwj=1
kth=1 !declared dimension of theta
cbig=2.5
ifont=4
ilog=0
ilabel=1
titlex='value of K'
titley='value of Ymax'
c iask=2
iask=-2
c
call VPLOT5(XVAL,YVAL,NDAT,icurvd,ncurvd,ijoin,symsiz,ndimd,
& XCAL,YCAL,NCAL,icurvc,ncurvc,iline,ndimc,ISYM,ILOG,ISCAL,
& XMIN,XMAX,YMIN,YMAX,XTIC,YTIC,xcross,ycross,ntx,nty,itx,ity,
& iXLO,iXHI,iYLO,iYHI,y0,yinf,inumx,inumy,ncjump,nvjump,ivplot,
& titlex,titley,ilabel,doframe,idiskq,autplt,plotonly,itit,title1,
& cbig,ifont,landscap,fitted,iask,theta,ifitype,ncomp,interp,
& isetcol,itrace,ndv1,ndc1,weight,kwi,kwj,icurvw,kth)
c
DEALLOCATE(xcal,ycal,xval,yval)
DEallocate(ncal,icurvc,iline)
print 1
1 format(' Redraw with different range of K values [N] ? ')
read 101,ans
101 format(a1)
if(UC(ans).eq.'Y') then
print 2
2 format(' K1, K2 = ')
call INPUT2r(aK1,aK2)
goto 3
endif
RETURN
end
c
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! readinputsize.f: Read input data size
! Author: Shuangshuang Jin
! Last updated: 9-30-2019
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUBROUTINE readinputsize(filename)
USE DEFDP
USE CONSTANTS
USE INPUTSIZE
IMPLICIT NONE
CHARACTER*200 filename
INTEGER::i,j,k
INTEGER::tst,flagF,ios
REAL(KIND=DP)::tstrl1,tstrl2,label9
!!! Initialize counters
nbus=0
nbrch=0
ngen=0
nSW=0
nPV=0
nPQ=0
nswtch=0
label9=9999999.0
!!! Initialize module INPUTSIZE
OPEN(1,FILE=filename,IOSTAT=ios)
IF (ios<0) PRINT *,'Cannot open file: ',filename
flagF=0
DO WHILE (flagF .EQ. 0)
READ(1,FMT=101,IOSTAT=ios) tstrl1,tstrl2
flagF=INT(tstrl1)
tst=INT(tstrl2)
IF (flagF .NE. label9) THEN
nbus=nbus+1
IF (tst .EQ. swing_bus) nSW=nSW+1
IF (tst .EQ. generator_bus) nPV=nPV+1
IF (tst .EQ. load_bus) nPQ=nPQ+1
flagF=0
ELSE
flagF=1
END IF
END DO
101 FORMAT(F12.5,96X,F12.5)
flagF=0
DO WHILE (flagF .EQ. 0)
READ(1,FMT=102,IOSTAT=ios) tstrl1
flagF=INT(tstrl1)
IF (ios<0) EXIT
IF (flagF .NE. label9) THEN
nbrch=nbrch+1
flagF=0
ELSE
flagF=1
END IF
END DO
102 FORMAT(F12.5)
flagF=0
DO WHILE (flagF .EQ. 0)
READ(1,FMT=102,IOSTAT=ios) tstrl1
flagF=INT(tstrl1)
IF (ios<0) EXIT
IF (flagF .NE. label9) THEN
ngen=ngen+1
flagF=0
ELSE
flagF=1
END IF
END DO
flagF=0
DO WHILE (flagF .EQ. 0)
READ(1,FMT=103,IOSTAT=ios) tstrl1
flagF=INT(tstrl1)
IF (ios<0) EXIT
IF (flagF .NE. label9) THEN
nswtch=nswtch+1
flagF=0
ELSE
flagF=1
END IF
END DO
103 FORMAT(F12.5)
CLOSE(1)
RETURN
END
|
C @(#)systxt.f 20.3 2/13/96
subroutine systxt
C
include 'ipfinc/parametr.inc'
include 'ipfinc/arcntl.inc'
include 'ipfinc/blank.inc'
include 'ipfinc/com012.inc'
include 'ipfinc/data.inc'
include 'ipfinc/merge.inc'
include 'ipfinc/prt.inc'
C
dimension word(40)
character word*30
C
C DETERMINE TEXT COMMAND
C
idat = 0
100 call readtx
if (index('/(',card).ne.0) go to 710
call scan( buf,word,nwrd )
iwrd = 1
islnsw = ickdic( word(iwrd),mrgdic,lmrg )
if (islnsw.eq.0) then
write (errbuf(1),130) buf(1:80)
130 format (' MERGE COMMAND NOT RECOGNIZED :(',a,')')
call prterx ('W',1)
inptls=1
idat = 0
go to 100
endif
C
C IPR,SAR,SZN,SBA,SBU,IBU,EBU,IBR,RNB,EXBR,USE
C
go to (210,230,150,560,400,480,480,310,630,10310,140) islnsw
C
C > USE_AIC <
C
140 comvar(9) = 1
inptls = 1
idat = 0
go to 100
C
C > SAVE_ZONES, ... <
C
150 idatx = nwrd
idat=0
iwrd = iwrd + 1
if (idatx .eq. 1) go to 190
152 continue
do 160 i = iwrd, idatx
if (word(i)(1:1).eq.'#') word(i)(1:1)=' '
if (word(i)(2:2).eq.'#') word(i)(2:2)=' '
idat = idat + 1
if (idat .gt. MAXCZN) then
write (errbuf(1),170)
170 format (' MORE THAN 150 "SAVED ZONES" SUBMITTED. ',
1 'REMAINING DATA ITEMS IGNORED. ')
call prterx ('W',1)
idat=150
ksw=1
goto 162
endif
savzns(idat) = word(i)(1:2)
160 continue
162 continue
175 if(index(buf,'<').eq.0.and.index(word(idatx),'.').eq.0) then
call readtx
call scan( buf, word, idatx)
iwrd = 1
go to 152
endif
inptls=1
190 if (idat.gt.0) go to 720
write (errbuf(1),200)
200 format (' NO DATA ENCOUNTERED FROM "SAVE ZONES".')
call prterx ('W',1)
go to 100
C
C >INTERFACE_Preference = COMParison<
C = REJECT<
C = ACCEPT<
C
210 continue
iwrd = iwrd + 1
savbas(1)=1.0
if( iwrd .le. nwrd ) then
if( ickdic( word(iwrd),'ACCEPT',1).eq.1) savbas(1)=2.0
if( ickdic( word(iwrd),'REJECT',1).eq.1) savbas(1)=0.0
endif
inptls=1
go to 720
C
C > SAVE_AREAS <
C
230 ksw=0
inptls=1
240 call readtx
if (card.ne.'A') go to 290
if (ksw.eq.0) go to 250
inptls=1
go to 240
250 idat=idat+1
if (idat.le.MAXCAR) go to 270
write (errbuf(1),260)
260 format (' MORE THAN ',i3,' "SAVE AREAS". REMAINING DATA ITEMS',
1 'IGNORED. ')
call prterx ('W',1)
idat=MAXCAR
ksw=1
go to 240
270 read (buf,280) savare(idat)
280 format (3x,a10)
inptls=1
go to 240
290 if (idat.gt.0) go to 720
write (errbuf(1),300)
300 format (' NO DATA ENCOUNTERED FROM "SAVE AREAS".')
call prterx ('W',1)
go to 100
C
C > INTERFACE BRANCHES <
C
310 ksw=0
inptls=1
320 call readtx
if (index('LTE',card).eq.0) go to 380
if (index(buf,'EXCLUDE').ne.0) go to 380
330 if (ksw.eq.0) go to 340
inptls=1
go to 320
340 idat=idat+1
if (idat.le.100) go to 360
write (errbuf(1),350)
350 format (' MORE THAN 100 "INTERFACE BRANCHES". ',
1 'REMAINING DATA ITEMS IGNORED. ')
call prterx ('W',1)
idat=100
ksw=1
go to 320
360 read (buf,370) (facbus(i,idat),facbas(i,idat),i=1,2)
370 format (bz, 6x, a8, f4.0, 1x, a8, f4.0)
inptls=1
go to 320
380 if (idat.gt.0) go to 720
write (errbuf(1),390)
390 format (' NO DATA ENCOUNTERED FROM "INTERFACE BRANCHES".')
call prterx ('W',1)
go to 100
C
C > EXCLUDE BRANCHES <
C
10310 ksw=0
inptls=1
10320 call readtx
if (index('LTE',card).eq.0) go to 10380
if (index(buf,'EXCLUDE').ne.0) go to 10380
10330 if (ksw.eq.0) go to 10340
inptls=1
go to 10320
10340 idat=idat+1
if (idat.le.100) go to 10360
write (errbuf(1),10350)
10350 format (' MORE THAN 100 EXCLUDED BRANCES. REMAINING ITEMS',
1 'ignored.')
call prterx ('W',1)
idat=100
ksw=1
go to 10320
10360 read (buf,10370) (facbus(i,idat),facbas(i,idat),i=1,2)
10370 format (bz, 6x, a8, f4.0, 1x, a8, f4.0)
inptls=1
go to 10320
10380 if (idat.gt.0) go to 720
write (errbuf(1),10390)
10390 format (' NO DATA ENCOUNTERED FROM "EXCLUDE BRANCHES".')
call prterx ('W',1)
go to 100
C > SAVE BUSES <
400 ksw=0
inptls=1
410 call readtx
if (card.ne.'B') go to 460
if (ksw.eq.0) go to 420
inptls=1
go to 410
420 idat=idat+1
if (idat.le.500) go to 440
write (errbuf(1),430)
430 format (' MORE THAN 500 "SAVE BUSES" ENCOUNTERED. REMAINING',
1 'data items ignored. ')
call prterx ('W',1)
ksw=1
go to 410
440 read (buf,450) savbus(idat),savbas(idat)
450 format (bz, 6x, a8, f4.0)
inptls=1
go to 410
460 if (idat.gt.0) go to 720
write (errbuf(1),470)
470 format (' NO DATA ENCOUNTERED FROM "SAVE BUSES".')
call prterx ('W',1)
go to 100
C
C > INCLUDE BUSES <
C > EXCLUDE BUSES <
C
480 ksw=0
inptls=1
490 call readtx
if (card.ne.'B') go to 540
if (ksw.eq.0) go to 500
inptls=1
go to 490
500 idat=idat+1
if (idat.le.100) go to 520
write (errbuf(1),510)
510 format (' More than 100 "INCLUDE" or "EXCLUDE" ',
1 'buses encountered. Remaining items ignored.')
call prterx ('W',1)
ksw=1
idat=100
go to 490
520 read (buf,530) savbus(idat),savbas(idat)
530 format (bz, 6x, a8, f4.0)
inptls=1
go to 490
540 if (idat.ne.0) go to 720
write (errbuf(1),550)
550 format (' No data encountered from "INCLUDE BUSES" or "EXCLUDE B
1USES".')
call prterx ('W',1)
go to 100
C
C PROCESS "SAVE BASES"
C
560 ksw=0
idatx = nwrd
idat=0
iwrd = iwrd + 1
570 continue
if( idatx .eq. 1) go to 610
do 572 i = iwrd, idatx
idat = idat + 1
savbas( idat ) = rval(word(i))
572 continue
574 continue
if (idat .gt. 50) then
write (errbuf(1),580)
580 format (' MORE THAN 50 "SAVED BASES" ENCOUNTERD. REMAINING',
1 'data items ignored.')
call prterx ('W',1)
idat=50
ksw=1
go to 570
endif
if (index (buf,'<').ne.0) then
inptls=1
call readtx
if (card .eq. ' ') then
call scan( buf,word,idatx)
iwrd = 1
go to 570
endif
endif
610 if (idat.gt.0) go to 720
write (errbuf(1),620)
620 format (' NO DATA ENCOUNTERED FROM "SAVE BASES". ')
call prterx ('W',1)
go to 100
C
C PROCESS "RENAME BUSES"
C
630 ksw=0
inptls=1
640 call readtx
if (card.ne.'B') go to 690
if (ksw.eq.0) go to 650
inptls=1
go to 640
650 idat=idat+1
if (idat .gt. 100) then
write (errbuf(1),660)
660 format (' More than 100 "RENAME BUSES" encountered. Remainin
1g data items ignored.')
call prterx ('W',1)
idat=100
ksw=1
go to 640
endif
read (buf,680) (facbus(i,idat),facbas(i,idat),i=1,2)
680 format (bz, 6x, a8, f4.0, 1x, a8, f4.0)
inptls=1
go to 640
690 if (idat.gt.0) go to 720
write (errbuf(1),700)
700 format (' NO DATA ENCOUNTERED FROM "RENAME BUSES".')
call prterx ('W',1)
go to 100
710 islnsw=0
720 return
end
|
C MEMBER XSOH26
C (from old member FCXSOH26)
C
C DESC COMPUTE MODIFIED PULS CURVE (O VS. S+0/2) FROM ELEV VS Q CURVE.
C---------------------------------------------------------------------
SUBROUTINE XSOH26(SUNUM,PO,W,LOCOWS,SPEL,SPQ,NSP,CONSTQ,IUSE)
C--------------------------------------------------------------------
C SUBROUTINE TO COMPUTE A MODIFIED PULS CURVE ( O VS. S+O/2 ) FROM
C AN ELEVATION VS. DISCHARGE CURVE.
C THE 'IUSE' VARIABLE CONTROLS THE ADDITION OF A NON-SPILLWAY DISCHARGE
C TO THE CURVE (=0, DON'T ADD, = 1, ADD TO DISCHARGE)
C
C---------------------------------------------------------------------
C WRITTEN BY - JOE OSTROWSKI - HRL - SEPT 1983
C---------------------------------------------------------------------
C
INCLUDE 'common/resv26'
INCLUDE 'common/exg26'
INCLUDE 'common/fdbug'
C
DIMENSION PO(1),W(1),LOCOWS(1),SPEL(1),SPQ(1)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcst_res/RCS/xsoh26.f,v $
. $', '
.$Id: xsoh26.f,v 1.1 1995/09/17 19:07:06 dws Exp $
. $' /
C ===================================================================
C
C
IF (IBUG.GE.1) WRITE(IODBUG,1600)
1600 FORMAT(' *** ENTER XSOH26 ***')
C
C GET BASE AND LEVEL OF CALLING ROUTINE
C
CALL XPTR26(SUNUM,PO,IORD,IBASE,LEVEL,LOCPM,LOCTS,LOCCO)
C
C NO NEED TO REDEFINE CURVE IF ALREADY IN CORE.
C
ISUNUM = IBASE*10 + LEVEL
IF (MRLOC(5) .EQ. ISUNUM) GO TO 9000
C
C COMPUTE CURVE
C
MRLOC(5) = ISUNUM
NOSOH = NSP
DO 100 I=1,NSP
LOCO = LOCOWS(10) + I - 1
LOCSOH = LOCO + NOSOH
O = SPQ(I)
IF (IUSE.EQ.1) O = O + CONSTQ
W(LOCO) = O
CALL NTER26(SPEL(I),S,PO(LESELV),PO(LESSTO),NSE,IFLAG,NTERP,IBUG)
W(LOCSOH) = S + O/2.0
100 CONTINUE
C
IF (IBUG.GE.2) WRITE(IODBUG,1690) (W(LOCOWS(10)+I-1),I=1,NOSOH)
IF (IBUG.GE.2) WRITE(IODBUG,1691) (W(LOCOWS(10)+NOSOH+I-1),
. I=1,NOSOH)
1690 FORMAT(/' *MODIFIED PULS CURVE AS COMPUTED (O VS S+O/2)',//,
. (6F12.3))
1691 FORMAT((6F12.3))
C
C THAT'S ALL!
C
9000 CONTINUE
IF (IBUG.GE.1) WRITE(IODBUG,1699)
1699 FORMAT(' *** EXIT XSOH26 ***')
RETURN
END
|
LOCAL INCLUDE 'INPUT.INC'
C Declarations for inputs
INCLUDE 'INCS:PAOOF.INC'
INCLUDE 'INCS:PUVD.INC'
INTEGER NPARMS
PARAMETER (NPARMS=29)
INTEGER AVTYPE(NPARMS), AVDIM(2,NPARMS)
CHARACTER AVNAME(NPARMS)*8
LOCAL END
LOCAL INCLUDE 'INPUTDATA.INC'
C DATA statments defining input
C parameters.
C 1 2 3 4
DATA AVNAME /'INNAME', 'INCLASS', 'INSEQ', 'INDISK',
C 5 6 7 8 9
* 'TIMERANG', 'DOCALIB', 'GAINUSE', 'FLAGVER', 'STOKES',
C 10 11 12 13 14 15
* 'OUTNAME', 'OUTCLASS', 'OUTSEQ', 'OUTDISK', 'OPTYPE', 'APARM',
C 16 17 18 19 20 21
* 'IMSIZE', 'CELLSIZE', 'ROTATE', 'SHIFT', 'REWEIGHT', 'XTYPE',
C 22 23 24 25 26 27
* 'YTYPE', 'XPARM', 'YPARM', 'FACTOR', 'NCOUNT', 'DPARM',
C 28
* 'DOCAT', 'BADDISK'/
C 1 2 3 4
DATA AVTYPE /OOACAR, OOACAR, OOAINT, OOAINT,
C 5 6 7 8 9
* OOARE, OOALOG, OOAINT, OOAINT, OOACAR,
C 10 11 12 13 14 15
* OOACAR, OOACAR, OOAINT, OOAINT, OOACAR, OOARE,
C 16 17 18 19 20 21
* OOAINT, OOARE, OOARE, OOARE, OOARE, OOAINT,
C 22 23 24 25 26 27
* OOAINT, OOARE, OOARE, OOARE, OOAINT, OOARE,
C 28
* OOALOG, OOAINT/
C 1 2 3 4
DATA AVDIM /12,1, 6,1, 1,1, 1,1,
C 5 6 7 8 9
* 8,1, 1,1, 1,1, 1,1, 4,1,
C 10 11 12 13 14 15
* 12,1, 6,1, 1,1, 1,1, 4,1, 10,1,
C 16 17 18 19 20 21
* 2,1, 2,1, 1,1, 2,1, 2,1, 1,1,
C 22 23 24 25 26 27 28 29
* 1,1, 10,1, 10,1, 1,1, 1,1, 10,1, 1,1, 10,1/
LOCAL END
LOCAL INCLUDE 'BSGRD.INC'
INTEGER CTYPX, CTYPY, CTYPX2, CTYPY2
REAL XPARM(10), YPARM(10), XPARM2(10), YPARM2(10)
COMMON /BSGRID/ CTYPX, CTYPY, CTYPX2, CTYPY2, XPARM, YPARM,
* XPARM2, YPARM2
LOCAL END
PROGRAM BSGRD
C-----------------------------------------------------------------------
C! Singledish beam-switched continuum imaging
C# Task AP Imaging OOP SINGLEDISH
C-----------------------------------------------------------------------
C; Copyright (C) 1997-2000, 2015
C; Associated Universities, Inc. Washington DC, USA.
C;
C; This program is free software; you can redistribute it and/or
C; modify it under the terms of the GNU General Public License as
C; published by the Free Software Foundation; either version 2 of
C; the License, or (at your option) any later version.
C;
C; This program is distributed in the hope that it will be useful,
C; but WITHOUT ANY WARRANTY; without even the implied warranty of
C; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C; GNU General Public License for more details.
C;
C; You should have received a copy of the GNU General Public
C; License along with this program; if not, write to the Free
C; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
C; MA 02139, USA.
C;
C; Correspondence concerning AIPS should be addressed as follows:
C; Internet email: aipsmail@nrao.edu.
C; Postal address: AIPS Project Office
C; National Radio Astronomy Observatory
C; 520 Edgemont Road
C; Charlottesville, VA 22903-2475 USA
C-----------------------------------------------------------------------
CHARACTER PRGM*6, BSIMAG*32, UVDATA(2)*32, SDTEMP(2)*32
INTEGER IRET, BUFF1(256)
INCLUDE 'INCS:DFIL.INC'
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DDCH.INC'
INCLUDE 'INCS:DHDR.INC'
DATA PRGM /'BSGRD'/
C-----------------------------------------------------------------------
C Startup
CALL BSGRIN (PRGM, UVDATA, SDTEMP, BSIMAG, IRET)
C grid
IF (IRET.EQ.0) CALL BSGRIT (UVDATA, SDTEMP, BSIMAG, IRET)
C History
IF (IRET.EQ.0) CALL BSGRHI (UVDATA(1), BSIMAG)
C Close down files, etc.
CALL DIE (IRET, BUFF1)
C
999 STOP
END
SUBROUTINE BSGRIN (PRGN, UVDATA, SDTEMP, BSIMAG, IRET)
C-----------------------------------------------------------------------
C BSGRIN gets input parameters for BSGRD and creates the needed
C objects.
C Inputs:
C PRGN C*6 Program name
C Output:
C BSIMAG C*32 Name of IMAGE object (contains output objects)
C UVDATA C*32 Name of input uv data.
C IRET I Error code: 0 => ok
C-----------------------------------------------------------------------
INTEGER IRET
CHARACTER PRGN*6, BSIMAG*(*), UVDATA(2)*(*), SDTEMP(2)*(*)
C
INCLUDE 'INCS:PUVD.INC'
INTEGER NKEY1, NKEY2, NKEY3
C NKEY1=no. adverbs to copy to
C UVDATA object
PARAMETER (NKEY1=13)
C NKEY2 = no. adverb for SD image
PARAMETER (NKEY2=6)
C NKEY3 = # adverb for SD grid
PARAMETER (NKEY3=6)
INCLUDE 'INPUT.INC'
INTEGER DIM(7), TYPE, BCHAN, ECHAN, NAXIS(7), IMSI(2), IWT,
* DUMMY, BIF, EIF, FQINDX, IDDEG
CHARACTER INK1(NKEY1)*8, OUTK1(NKEY1)*32, INK2(NKEY2)*8,
* OUTK2(NKEY2)*32, INK3(NKEY3)*8, OUTK3(NKEY3)*32, STOKES*4,
* UVTYPE*2, CHTYPE*4, TNAME*12, TCLASS*6, CDUMMY*1, CNAME*8,
* KEYW*8
REAL APARM(10), RWT(2)
DOUBLE PRECISION COORD(2)
INCLUDE 'INCS:PSTD.INC'
INCLUDE 'INCS:DFIL.INC'
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'BSGRD.INC'
INCLUDE 'INPUTDATA.INC'
C Adverbs for UVDATA object
DATA INK1 /'INNAME', 'INCLASS', 'INSEQ', 'INDISK', 'OUTNAME',
* 'OUTCLASS', 'OUTDISK', 'OUTSEQ', 'STOKES', 'DOCALIB',
* 'GAINUSE', 'FLAGVER', 'TIMERANG'/
DATA OUTK1 /'NAME', 'CLASS', 'IMSEQ', 'DISK', 'OUTNAME',
* 'OUTCLASS', 'OUTDISK', 'OUTSEQ', 'CALEDIT.STOKES',
* 'CALEDIT.DOCAL', 'CALEDIT.CLUSE', 'CALEDIT.FGVER',
* 'CALEDIT.TIMRNG'/
C Adverbs for BSIMAG image object
DATA INK2 /'OUTNAME', 'OUTCLASS', 'OUTSEQ', 'OUTDISK', 'CELLSIZE',
* 'SHIFT'/
DATA OUTK2 /'NAME', 'CLASS', 'IMSEQ', 'DISK', 'CELLSIZE',
* 'SHIFT'/
C Adverbs for +- image objects
DATA INK3 /'OUTNAME', 'OUTSEQ', 'OUTDISK', 'CELLSIZE', 'XPARM',
* 'YPARM'/
DATA OUTK3 /'NAME', 'IMSEQ', 'DISK', 'CELLSIZE', 'XPARM', 'YPARM'/
C-----------------------------------------------------------------------
C Startup
CALL AV2INP (PRGN, NPARMS, AVNAME, AVTYPE, AVDIM, 'Input', IRET)
IF (IRET.NE.0) GO TO 999
C BADDISK
CALL OGET ('Input', 'BADDISK', TYPE, DIM, IBAD, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C Grid types
CALL OGET ('Input', 'XTYPE', TYPE, DIM, CTYPX, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'YTYPE', TYPE, DIM, CTYPY, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'XPARM', TYPE, DIM, XPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'YPARM', TYPE, DIM, YPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CTYPX2 = CTYPX/100
CTYPY2 = CTYPY/100
CTYPX = MOD (CTYPX, 100)
CTYPY = MOD (CTYPY, 100)
IF (CTYPX2.EQ.0) CTYPX2 = CTYPX
IF (CTYPY2.EQ.0) CTYPY2 = CTYPY
CALL RCOPY (10, XPARM, XPARM2)
CALL RCOPY (10, YPARM, YPARM2)
C Declare 'BSTHROW' a header
C keyword for the image class.
C Also TOTHROW as header word
CNAME = 'IMAGE'
KEYW = 'BSTHROW'
CALL OBVHKW (CNAME, KEYW, OOARE, IRET)
IF (IRET.NE.0) GO TO 999
KEYW = 'TOTHROW'
CALL OBVHKW (CNAME, KEYW, OOARE, IRET)
IF (IRET.NE.0) GO TO 999
C Default output Name = input
CALL OGET ('Input', 'OUTNAME', TYPE, DIM, DUMMY, TNAME, IRET)
IF (IRET.NE.0) GO TO 999
IF (TNAME.EQ.' ') THEN
CALL OGET ('Input', 'INNAME', TYPE, DIM, DUMMY, TNAME, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT ('Input', 'OUTNAME', TYPE, DIM, DUMMY, TNAME, IRET)
IF (IRET.NE.0) GO TO 999
END IF
C Default output Class = TSKNAM
CALL OGET ('Input', 'OUTCLASS', TYPE, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
IF (TCLASS.EQ.' ') THEN
TCLASS = TSKNAM
CALL OPUT ('Input', 'OUTCLASS', TYPE, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
END IF
C Set default stokes.
CALL OGET ('Input', 'STOKES', TYPE, DIM, DUMMY, STOKES, IRET)
IF (IRET.NE.0) GO TO 999
IF (STOKES .EQ. ' ') STOKES = 'I'
CALL OPUT ('Input', 'STOKES', TYPE, DIM, DUMMY, STOKES, IRET)
IF (IRET.NE.0) GO TO 999
C Create BSIMAG object
BSIMAG = 'BSIMAG process object'
CALL CREATE (BSIMAG, 'IMAGE', IRET)
IF (IRET.NE.0) GO TO 999
C Copy adverbs to object
CALL IN2OBJ ('Input', NKEY2, INK2, OUTK2, BSIMAG, IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 1
DIM(2) = 1
CALL OPUT (BSIMAG, 'CTYPX', OOAINT, DIM, CTYPX2, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'CTYPY', OOAINT, DIM, CTYPY2, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 10
DIM(2) = 1
IF (CTYPX2.NE.CTYPX) CALL RFILL (10, 0.0, XPARM2)
IF (CTYPY2.NE.CTYPY) CALL RFILL (10, 0.0, YPARM2)
CALL OPUT (BSIMAG, 'XPARM', OOARE, DIM, XPARM2, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'YPARM', OOARE, DIM, YPARM2, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C Create Plus grid object
SDTEMP(1) = 'Plus throw image'
CALL CREATE (SDTEMP(1), 'IMAGE', IRET)
IF (IRET.NE.0) GO TO 999
C Create Plus grid object
SDTEMP(2) = 'Minus throw image'
CALL CREATE (SDTEMP(2), 'IMAGE', IRET)
IF (IRET.NE.0) GO TO 999
C Copy adverbs to object
CALL IN2OBJ ('Input', NKEY3, INK3, OUTK3, SDTEMP(1), IRET)
IF (IRET.NE.0) GO TO 999
CALL IN2OBJ ('Input', NKEY3, INK3, OUTK3, SDTEMP(2), IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 1
DIM(2) = 1
CALL OPUT (SDTEMP(1), 'CTYPX', OOAINT, DIM, CTYPX, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'CTYPY', OOAINT, DIM, CTYPY, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'CTYPX', OOAINT, DIM, CTYPX, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'CTYPY', OOAINT, DIM, CTYPY, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C Create other objects
C UVDATA: plus
UVDATA(1) = 'Plus throw UVdata'
CALL CREATE (UVDATA(1), 'UVDATA', IRET)
IF (IRET.NE.0) GO TO 999
CALL IN2OBJ ('Input', NKEY1, INK1, OUTK1, UVDATA(1), IRET)
IF (IRET.NE.0) GO TO 999
C UVDATA: minus
UVDATA(2) = 'Minus throw UVdata'
CALL CREATE (UVDATA(2), 'UVDATA', IRET)
IF (IRET.NE.0) GO TO 999
CALL IN2OBJ ('Input', NKEY1, INK1, OUTK1, UVDATA(2), IRET)
IF (IRET.NE.0) GO TO 999
C Fix class name
CALL OGET ('Input', 'INCLASS', TYPE, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
TCLASS(6:6) = '+'
CALL OPUT (UVDATA(1), 'CLASS', TYPE, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
TCLASS(6:6) = '-'
CALL OPUT (UVDATA(2), 'CLASS', TYPE, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
C Get IF channel selection
CALL SECSLT (UVDATA(1), BIF, EIF, BCHAN, ECHAN, STOKES, IRET)
IF (IRET.NE.0) GO TO 999
C All Stokes', IF, channels
CALL SECSAV (UVDATA(1), 1, 0, 1, 0, ' ', IRET)
IF (IRET.NE.0) GO TO 999
CALL SECSAV (UVDATA(2), 1, 0, 1, 0, ' ', IRET)
IF (IRET.NE.0) GO TO 999
C Open UVDATA to be sure it's OK.
CALL OOPEN (UVDATA(1), 'READ', IRET)
IF (IRET.NE.0) GO TO 999
C Get type of data
CALL UVDGET (UVDATA(1), 'TYPEUVD', TYPE, DIM, DUMMY, UVTYPE, IRET)
IF (IRET.NE.0) GO TO 999
IF (UVTYPE.NE.'SB') THEN
MSGTXT = 'I ONLY WORK ON SB DATA NOT ''' // UVTYPE // ''''
CALL MSGWRT (8)
IRET = 8
GO TO 999
END IF
CALL OCLOSE (UVDATA(1), IRET)
IF (IRET.NE.0) GO TO 999
CALL OOPEN (UVDATA(2), 'READ', IRET)
IF (IRET.NE.0) GO TO 999
CALL UVDGET (UVDATA(2), 'TYPEUVD', TYPE, DIM, DUMMY, UVTYPE, IRET)
IF (IRET.NE.0) GO TO 999
IF (UVTYPE.NE.'SB') THEN
MSGTXT = 'I ONLY WORK ON SB DATA NOT ''' // UVTYPE // ''''
CALL MSGWRT (8)
IRET = 8
GO TO 999
END IF
CALL OCLOSE (UVDATA(2), IRET)
IF (IRET.NE.0) GO TO 999
C Reset Selection: one IF
EIF = BIF
CALL SECSAV (UVDATA(1), BIF, EIF, BCHAN, ECHAN, STOKES, IRET)
IF (IRET.NE.0) GO TO 999
CALL SECSAV (UVDATA(2), BIF, EIF, BCHAN, ECHAN, STOKES, IRET)
IF (IRET.NE.0) GO TO 999
C Attach UVDATA to image
DIM(1) = LEN (UVDATA(1))
DIM(2) = 1
CALL OPUT (SDTEMP(1), 'UVDATA', OOACAR, DIM, DUMMY, UVDATA(1),
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'UVDATA', OOACAR, DIM, DUMMY, UVDATA(2),
* IRET)
IF (IRET.NE.0) GO TO 999
C Min. image sizes
CALL OGET ('Input', 'IMSIZE', TYPE, DIM, IMSI, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C No images smaller than 32
C and must be even
IMSI(1) = MAX (IMSI(1), 32)
IMSI(2) = MAX (IMSI(2), 32)
IMSI(1) = ((IMSI(1) + 1) / 2) * 2
IMSI(2) = ((IMSI(2) + 1) / 2) * 2
CALL OPUT ('Input', 'IMSIZE', OOAINT, DIM, IMSI, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'IMSIZE', OOAINT, DIM, IMSI, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'IMSIZE', OOAINT, DIM, IMSI, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'IMSIZE', OOAINT, DIM, IMSI, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C Coordinates
CALL OGET ('Input', 'APARM', TYPE, DIM, APARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
COORD(1) = (APARM(1) + APARM(2)/60. + APARM(3)/3600.) * 15.0
IDDEG = ABS (APARM(4))
COORD(2) = (IDDEG + APARM(5)/60. + (APARM(6)/3600.)) *
* SIGN (1.0, APARM(4))
DIM(1) = 2
CALL OPUT (BSIMAG, 'CCENTER', OOADP, DIM, COORD, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'OPTYPE', TYPE, DIM, DUMMY, CHTYPE, IRET)
IF (IRET.NE.0) GO TO 999
IF (CHTYPE.EQ.' ') CHTYPE = '-SIN'
CALL OPUT (BSIMAG, 'CPROJ', OOACAR, DIM, DUMMY, CHTYPE, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'CPROJ', OOACAR, DIM, DUMMY, CHTYPE, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'CPROJ', OOACAR, DIM, DUMMY, CHTYPE, IRET)
IF (IRET.NE.0) GO TO 999
C Image type, cutoff
CALL OGET ('Input', 'REWEIGHT', TYPE, DIM, RWT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IWT = -1
IF (RWT(2).EQ.0.0) RWT(2) = -0.01
RWT(1) = MIN (0.05, RWT(2))
DIM(1) = 1
C SD type, cutoff
CALL OPUT (BSIMAG, 'SDCUTOFF', OOARE, DIM, RWT(1), CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'SDTYPE', OOAINT, DIM, IWT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'SDCUTOFF', OOARE, DIM, RWT(2), CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'SDTYPE', OOAINT, DIM, IWT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'SDCUTOFF', OOARE, DIM, RWT(2), CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
C Default BCHAN, ECHAN
C Find size of freq. axis.
CALL UVDFND (UVDATA(1), 2, 'FREQ', FQINDX, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (UVDATA(1), 'UV_DESC.NAXIS', TYPE, DIM, NAXIS, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
BCHAN = 1
ECHAN = NAXIS(FQINDX)
DIM(1) = 1
CALL OPUT (SDTEMP(1), 'BCHAN', OOAINT, DIM, BCHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'ECHAN', OOAINT, DIM, ECHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'BCHAN', OOAINT, DIM, BCHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(2), 'ECHAN', OOAINT, DIM, ECHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C two were for coordinates
ECHAN = NAXIS(FQINDX) - 2
CALL OPUT (BSIMAG, 'BCHAN', OOAINT, DIM, BCHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'ECHAN', OOAINT, DIM, ECHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT ('Input', 'BCHAN', OOAINT, DIM, BCHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT ('Input', 'ECHAN', OOAINT, DIM, ECHAN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C IF numbers
BIF = 1
EIF = 1
C Save in Inputs for history
DIM(1) = 1
CALL OPUT ('Input', 'BIF', OOAINT, DIM, BIF, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT ('Input', 'EIF', OOAINT, DIM, EIF, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C fix temp file names
DIM(1) = LEN (TCLASS)
DIM(2) = 1
TCLASS = 'BSGRD+'
CALL OPUT (SDTEMP(1), 'CLASS', OOACAR, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
TCLASS = 'BSGRD-'
CALL OPUT (SDTEMP(2), 'CLASS', OOACAR, DIM, DUMMY, TCLASS, IRET)
IF (IRET.NE.0) GO TO 999
C
999 RETURN
END
SUBROUTINE BSGRIT (UVDATA, SDTEMP, BSIMAG, IRET)
C-----------------------------------------------------------------------
C Routine to call OUVIMG to make image
C Inputs:
C UVDATA C*? Input UV data
C BSIMAG C*? Image process object
C Output:
C IRET I > 0 => die
C-----------------------------------------------------------------------
CHARACTER BSIMAG*(*), UVDATA(2)*(*), SDTEMP(2)*(*)
INTEGER IRET
C
CHARACTER ROTEMP*32, CDUMMY*1, NAME*12, CLASS*6, KEYW*8, CNAME*8
INTEGER DIM(7), TYPE, DUMMY, I, DISK, HWIDTH, ORDER, WIN(4),
* IROUND, IMSIZE(2), IDISK, ICNO, ODISK, OCNO, BUFFER(512), IMSEQ
REAL ROTATE, SHIFT(2), CROTA(7), DPARM(10), FACTOR, MAXCWT,
* XNLIM, BMJ, BMN, BPA, THROWP, THROWM
LOGICAL DOCAT
INCLUDE 'INCS:PAOOF.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'INCS:PSTD.INC'
INCLUDE 'BSGRD.INC'
C-----------------------------------------------------------------------
CALL OGET ('Input', 'OUTSEQ', TYPE, DIM, IMSEQ, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'DOCAT', TYPE, DIM, DOCAT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'ROTATE', TYPE, DIM, ROTATE, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IF (ROTATE.GT.0) THEN
C Declare 'BSTHROW' a header
C keyword for the uvdata class
CNAME = 'UVDATA'
KEYW = 'BSTHROW'
CALL OBVHKW (CNAME, KEYW, OOARE, IRET)
CALL OGET (UVDATA(1), 'BSTHROW', TYPE, DIM, THROWP, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
SHIFT(1) = -THROWP * (1.0 - 1.0 / COS (ROTATE * DG2RAD))
SHIFT(2) = -THROWP * SIN (ROTATE * DG2RAD)
DIM(1) = 2
DIM(2) = 1
CALL OPUT (SDTEMP(1), 'SHIFT', OOARE, DIM, SHIFT, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
END IF
CALL OSDIMG (UVDATA(1), SDTEMP(1), IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'XPARM', TYPE, DIM, XPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'YPARM', TYPE, DIM, YPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IF (ROTATE.GT.0) THEN
CALL OGET (UVDATA(2), 'BSTHROW', TYPE, DIM, THROWM, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
SHIFT(1) = -THROWM * (1.0 - 1.0 / COS (ROTATE * DG2RAD))
SHIFT(2) = -THROWM * SIN (ROTATE * DG2RAD)
DIM(1) = 2
DIM(2) = 1
CALL OPUT (SDTEMP(2), 'SHIFT', OOARE, DIM, SHIFT, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
END IF
CALL OSDIMG (UVDATA(2), SDTEMP(2), IRET)
IF (IRET.NE.0) GO TO 999
C save for final output image
CALL OGET (SDTEMP(1), 'MAXCWT', TYPE, DIM, MAXCWT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'XNLIM', TYPE, DIM, XNLIM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'BSTHROW', TYPE, DIM, THROWP, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(2), 'BSTHROW', TYPE, DIM, THROWM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL UVDGET (UVDATA(1), 'BMAJ', TYPE, DIM, BMJ, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL UVDGET (UVDATA(1), 'BMIN', TYPE, DIM, BMN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL UVDGET (UVDATA(1), 'BPA', TYPE, DIM, BPA, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C rotate
CALL OGET ('Input', 'ROTATE', TYPE, DIM, ROTATE, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IF (ROTATE.LT.0) THEN
SHIFT(1) = THROWP * (1.0 - 1.0 / COS (ROTATE * DG2RAD))
SHIFT(2) = THROWP * SIN (ROTATE * DG2RAD)
ROTATE = 0.0
HWIDTH = 1
ROTEMP = 'Plus image rotated'
DO 20 I = 1,2
CALL CREATE (ROTEMP, 'IMAGE', IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(I), 'NAME', TYPE, DIM, DUMMY, NAME, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(I), 'OUTNAME', TYPE, DIM, DUMMY, NAME,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(I), 'CLASS', TYPE, DIM, DUMMY, CLASS,
* IRET)
IF (IRET.NE.0) GO TO 999
CLASS(1:5) = 'BSROT'
CALL OPUT (SDTEMP(I), 'OUTCLASS', TYPE, DIM, DUMMY, CLASS,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(I), 'DISK', TYPE, DIM, DISK, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(I), 'OUTDISK', TYPE, DIM, DISK, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(I), 'OUTSEQ', TYPE, DIM, IMSEQ, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL IMGCLN (SDTEMP(I), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(I), 'IMAGE_DESC.CROTA', TYPE, DIM, CROTA,
* CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CROTA(2) = CROTA(2) + ROTATE
CALL OPUT (ROTEMP, 'IMAGE_DESC.CROTA', TYPE, DIM, CROTA,
* CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
C Interpolate
CALL IMGINT (SDTEMP(I), SHIFT, ROTATE, HWIDTH, ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
SHIFT(1) = THROWM * SHIFT(1) / THROWP
SHIFT(2) = THROWM * SHIFT(2) / THROWP
C Copy catalog header keywords.
CALL OBDSKC (SDTEMP(I), IDISK, ICNO, IRET)
IF (IRET.NE.0) GO TO 999
CALL OBDSKC (ROTEMP, ODISK, OCNO, IRET)
IF (IRET.NE.0) GO TO 999
CALL KEYCOP (IDISK, ICNO, ODISK, OCNO, IRET)
IF (IRET.NE.0) GO TO 999
C kill the old one
IF (.NOT.DOCAT) THEN
CALL IMGZAP (SDTEMP(I), IRET)
IF (IRET.NE.0) GO TO 999
C Try to move in the beam parms
ELSE
CALL BEMCOP (SDTEMP(I), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
CALL OCLOSE (ROTEMP, IRET)
END IF
SDTEMP(I) = ROTEMP
ROTEMP = 'Minus image rotated'
20 CONTINUE
END IF
C Correction step
ROTEMP = 'Corrected Az-El image'
CALL CREATE (ROTEMP, 'IMAGE', IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'NAME', TYPE, DIM, DUMMY, NAME, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'OUTNAME', TYPE, DIM, DUMMY, NAME, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'CLASS', TYPE, DIM, DUMMY, CLASS, IRET)
IF (IRET.NE.0) GO TO 999
CLASS = 'BSGCOR'
CALL OPUT (SDTEMP(1), 'OUTCLASS', TYPE, DIM, DUMMY, CLASS, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET (SDTEMP(1), 'DISK', TYPE, DIM, DISK, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'OUTDISK', TYPE, DIM, DISK, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(1), 'OUTSEQ', TYPE, DIM, IMSEQ, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL IMGCLN (SDTEMP(1), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
C Create
CALL OOPEN (ROTEMP, 'DEST', IRET)
IF (IRET.NE.0) GO TO 999
C Copy beam parameters
CALL BEMCOP (SDTEMP(1), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
C Total throw
DIM(1) = 1
THROWP = THROWP - THROWM
CALL OPUT (ROTEMP, 'TOTHROW', OOARE, DIM, THROWP, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OCLOSE (ROTEMP, IRET)
C Move adverbs from input
CALL OGET ('Input', 'IMSIZE', TYPE, DIM, IMSIZE, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'FACTOR', TYPE, DIM, FACTOR, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IF (FACTOR.LE.0.0) FACTOR = 1.0
CALL OPUT ('Input', 'FACTOR', TYPE, DIM, FACTOR, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'NCOUNT', TYPE, DIM, ORDER, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
ORDER = MAX (0, MIN (1, ORDER))
CALL OPUT ('Input', 'NCOUNT', TYPE, DIM, ORDER, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OGET ('Input', 'DPARM', TYPE, DIM, DPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
IF (DPARM(1).LE.0.0) DPARM(1) = 1.0
IF (DPARM(2).GT.0.0) THEN
DPARM(2) = DPARM(1)
DPARM(1) = 1.0
ELSE
DPARM(2) = 1.0
END IF
WIN(1) = IROUND (DPARM(3))
WIN(2) = IROUND (DPARM(4))
WIN(3) = IROUND (DPARM(5))
WIN(4) = IROUND (DPARM(6))
WIN(1) = MAX (1, WIN(1))
IF (WIN(2).LT.WIN(1)) WIN(2) = IMSIZE(1)
IF (WIN(4).LE.0) WIN(4) = IMSIZE(1)
IF (WIN(3).LE.0) WIN(3) = IMSIZE(1) * 10
DPARM(3) = WIN(1)
DPARM(4) = WIN(2)
DPARM(5) = WIN(3)
DPARM(6) = WIN(4)
CALL OPUT ('Input', 'DPARM', TYPE, DIM, DPARM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
DO 30 I = 1,2
DIM(1) = 1
DIM(2) = 1
CALL OPUT (SDTEMP(I), 'FACTOR', TYPE, DIM, FACTOR, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (SDTEMP(I), 'BLORDER', OOAINT, DIM, ORDER, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 2
CALL OPUT (SDTEMP(I), 'REWEIGHT', OOAINT, DIM, DPARM, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 4
CALL OPUT (SDTEMP(I), 'BLWINDOW', OOAINT, DIM, WIN, CDUMMY,
* IRET)
IF (IRET.NE.0) GO TO 999
30 CONTINUE
C Correct
CALL IMGBSC (SDTEMP(1), SDTEMP(2), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
C Clean up keywords
CALL OBDSKC (ROTEMP, ODISK, OCNO, IRET)
IF (IRET.NE.0) GO TO 999
KEYW = 'BSTHROW'
CALL REMKEY (ODISK, OCNO, KEYW, 1, BUFFER, IRET)
IF (IRET.GT.0) GO TO 999
C clean up
IF (.NOT.DOCAT) THEN
DO 40 I = 1,2
CALL IMGZAP (SDTEMP(I), IRET)
IF (IRET.NE.0) GO TO 999
40 CONTINUE
END IF
C Regrid
CALL IMGRGR (ROTEMP, BSIMAG, IRET)
IF (IRET.NE.0) GO TO 999
DIM(1) = 1
DIM(2) = 1
DIM(3) = 0
IF (.NOT.DOCAT) THEN
CALL IMGZAP (ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
ELSE
CALL OOPEN (ROTEMP, 'WRIT', IRET)
IF (IRET.NE.0) GO TO 999
CALL BEMCOP (SDTEMP(1), ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
CALL OCLOSE (ROTEMP, IRET)
IF (IRET.NE.0) GO TO 999
END IF
CALL OPUT (BSIMAG, 'MAXCWT', OOARE, DIM, MAXCWT, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'XNLIM', OOARE, DIM, XNLIM, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'BEAM.BMAJ', OOARE, DIM, BMJ, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'BEAM.BMIN', OOARE, DIM, BMN, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OPUT (BSIMAG, 'BEAM.BPA', OOARE, DIM, BPA, CDUMMY, IRET)
IF (IRET.NE.0) GO TO 999
CALL OCLOSE (BSIMAG, IRET)
C
999 RETURN
END
SUBROUTINE BSGRHI (UVDATA, BSIMAG)
C-----------------------------------------------------------------------
C Routine to write history file to output BSIMAG image object.
C Inputs:
C UVDATA C*? Input UV data
C BSIMAG C*? Image process object
C-----------------------------------------------------------------------
CHARACTER BSIMAG*(*), UVDATA*32
C
INCLUDE 'INCS:PUVD.INC'
INTEGER NADV0
PARAMETER (NADV0=26)
CHARACTER LIST(NADV0)*8, CDUMMY*1, CPROJ*4, LINE*64
INTEGER IERR, TYPE, DIM(7), I, DUMMY, MSGSAV
REAL PARM(10), MAXCWT, XNLIM, RWT
DOUBLE PRECISION COORD(2)
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:PAOOF.INC'
INCLUDE 'BSGRD.INC'
C Adverbs to copy to history
DATA LIST /'INNAME', 'INCLASS', 'INSEQ', 'TIMERANG', 'DOCALIB',
* 'GAINUSE', 'FLAGVER', 'STOKES', 'BCHAN', 'ECHAN', 'BIF',
* 'OUTNAME', 'OUTCLASS', 'OUTSEQ', 'IMSIZE', 'CELLSIZE', 'XTYPE',
* 'YTYPE', 'XPARM', 'YPARM', 'OPTYPE', 'APARM', 'SHIFT',
* 'FACTOR', 'ROTATE', 'DPARM'/
C-----------------------------------------------------------------------
MSGSAV = MSGSUP
C Move adverbs to Input
CALL OGET (BSIMAG, 'XPARM', TYPE, DIM, XPARM2, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OPUT ('Input', 'XPARM', TYPE, DIM, XPARM2, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'YPARM', TYPE, DIM, YPARM2, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OPUT ('Input', 'YPARM', TYPE, DIM, YPARM2, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'CTYPX', TYPE, DIM, I, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OPUT ('Input', 'XTYPE', TYPE, DIM, I, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'CTYPY', TYPE, DIM, I, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OPUT ('Input', 'YTYPE', TYPE, DIM, I, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'CPROJ', TYPE, DIM, DUMMY, CPROJ, IERR)
IF (IERR.NE.0) GO TO 990
CALL OPUT ('Input', 'OPTYPE', TYPE, DIM, DUMMY, CPROJ, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'CCENTER', TYPE, DIM, COORD, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
COORD(1) = COORD(1) / 15.0D0
I = COORD(1)
PARM(1) = I
COORD(1) = 60.0D0 * (COORD(1) - I)
I = COORD(1)
PARM(2) = I
PARM(3) = 60.0D0 * (COORD(1) - I)
DUMMY = 1
IF (COORD(2).LT.0) DUMMY = -1
COORD(2) = ABS (COORD(2))
I = COORD(2)
PARM(4) = I * DUMMY
COORD(2) = 60.0D0 * (COORD(2) - I)
I = COORD(2)
PARM(5) = I
PARM(6) = 60.0D0 * (COORD(2) - I)
IF ((DUMMY.LT.0) .AND. (PARM(4).EQ.0.0)) PARM(4) = -1.0E-10
DIM(1) = 10
DIM(2) = 1
CALL OPUT ('Input', 'APARM', OOARE, DIM, PARM, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
C Copy old history
CALL OHCOPY (UVDATA, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
C Copy base adverb values.
CALL OHLIST ('Input', LIST, NADV0, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
C First grid type:
IF ((CTYPX2.NE.CTYPX) .OR. (CTYPY2.NE.CTYPY)) THEN
LINE = '/ Convolution function for Az-El'
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
WRITE (LINE,1000) 'X', CTYPX
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
WRITE (LINE,1001) 'X', (XPARM(I), I = 1,5)
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
WRITE (LINE,1000) 'Y', CTYPY
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
WRITE (LINE,1001) 'Y', (YPARM(I), I = 1,5)
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
END IF
C computed results
CALL OGET (BSIMAG, 'SDCUTOFF', TYPE, DIM, RWT, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 999
CALL OGET (BSIMAG, 'MAXCWT', TYPE, DIM, MAXCWT, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
CALL OGET (BSIMAG, 'XNLIM', TYPE, DIM, XNLIM, CDUMMY, IERR)
IF (IERR.NE.0) GO TO 990
IF (RWT.GT.0.0) THEN
WRITE (LINE,1010) XNLIM
ELSE
WRITE (LINE,1011) XNLIM
END IF
CALL OHWRIT (LINE, BSIMAG, IERR)
IF (IERR.NE.0) GO TO 990
GO TO 999
C Error
990 MSGTXT = 'ERROR WRITING HISTORY FOR ' // BSIMAG
CALL MSGWRT (6)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT (A1,'TYPE =',I3,' /convolution type with parms:')
1001 FORMAT (A1,'PARM =',4(F8.4,','),F7.1)
1010 FORMAT ('WEIGHT =',F9.3,' / Scaled min sum of convolved weights')
1011 FORMAT ('WEIGHT =',F9.3,
* ' / Scaled min ABS(sum of convolved weights)')
END
|
*+TO_ECLIP
subroutine TO_ECLIP( ra, dec, jd, lambda, beta )
implicit none
double precision fox, fifteen
parameter( fox = 2.415020d+06 )
parameter( fifteen = 1.5d+01 )
double precision ra, dec, jd, lambda, beta
* Description:
* Converts celestial coordinates (ra, dec), ra in decimal hours
* and dec in decimal degrees, to ecliptic coordinates (lambda, beta)
* for time = jd (unmodified Julian date)
*
* Parameters/Arguments:
* fox (p) : JD at the beginning of the 20th century
* fifteen (p) : 15.0, in double precision
* ra, dec (i) : Celestial coordinates
* jd (i) : Time in unmodified Julian date
* lambda, beta (o) : Ecliptic coordinates
*
* Dependencies:
* Duffet-Smith routine EQECL_DS below.
*
* Origin:
* KM's wrapper routine for DS library routine
*
* Author:
* Koji Mukai, 1993 Feb 08, First official release
*-TO_ECLIP
double precision rad, djd
djd = jd - fox
rad = ra * fifteen
call EQECL_DS( djd, rad, dec, +1, lambda, beta )
end
*+FM_ECLIP
subroutine FM_ECLIP( lambda, beta, jd, ra, dec )
implicit none
double precision fox, fifteen
parameter( fox = 2.415020d+06 )
parameter( fifteen = 1.5d+01 )
double precision lambda, beta, jd, ra, dec
* Description:
* Reverse of TO_ECLIP above
*
* Parameters/Arguments:
* fox (p) : JD at the beginning of the 20th century
* fifteen (p) : 15.0, in double precision
* lambda, beta (i) : Ecliptic coordinates
* jd (i) : Time in unmodified Julian date
* ra, dec (o) : Celestial coordinates
*
* Dependencies:
* Duffet-Smith routine EQECL_DS below.
*
* Origin:
* KM's wrapper routine for DS library routine
*
* Author:
* Koji Mukai, 1993 Feb 08, First official release
* Koji Mukai, 1993 Mar 16, ra and rad mix-up fixed.
*-TO_ECLIP
double precision rad, djd
djd = jd - fox
call EQECL_DS( djd, lambda, beta, -1, rad, dec )
ra = rad / fifteen
end
*+EQECL_DS
subroutine EQECL_DS( djd, x, y, switch, p, q )
implicit none
double precision deg2rad
parameter( deg2rad = 1.74532925199433d-02 )
* = pi / 180, converts from degrees to radians
double precision d_psi, d_eps, rcp, rsp, height
common / astro1 / d_psi, d_eps, rcp, rsp, height
double precision djd, x, y, p, q
integer switch
* Description:
* Bottom level routine for Celestial/Ecliptic conversion
*
* Common Block Variables/Arguments:
* d_psi, d_eps (c) : nutation parameters
* rcp, rsp (c) : Something to do with horizontal parallax
* height (c) : Obervatory altitude
* djd (i) : JD since beginning of 20th century
* x, y (i) : Input coordinates
* switch (i) : +1 for celestial to ecliptic, -1 for reverse
* p, q (o) : Output coorddinates
*
* Dependencies:
* SET_NUTATE, another D-S routine
*
* Origin:
* Duffet-Smith p.59
*
* Author
* Koji Mukai, 1993 Feb 08, first official release
*-EQECL_DS
double precision t, c, eps, eps1, s_eps, c_eps
double precision sy, cy, sx, cx, sq, a, ty
call SET_NUTATE( djd )
* from subroutine OBLIQ, p.51
t = djd / 3.6525d+04
c = ( ( ( -1.81d-03 * t ) + 5.9d-03 ) * t + 4.6845d+01 ) * t
eps = 2.345229444d+01 - ( c / 3.6d+03 )
* end of OBLIQ
eps1 = eps + d_eps
s_eps = sin( eps1 * deg2rad )
c_eps = cos( eps1 * deg2rad )
cy = cos( y * deg2rad )
sy = sin( y * deg2rad )
if( abs( cy ) .lt. 1.0d-20 ) cy = 1.0d-20
ty = sy / cy
cx = cos( x * deg2rad )
sx = sin( x * deg2rad )
sq = ( sy * c_eps ) - ( cy * s_eps * sx * switch )
q = atan( sq / ( sqrt( 1.0d+00 - sq * sq ) + 1.0d-20 ) )
& / deg2rad
a = ( sx * c_eps ) + ( ty * s_eps * switch )
p = atan( a / cx ) / deg2rad
if( cx .lt. 0.0d+00 ) p = p + 1.8d+02
if( p .gt. 3.6d+02 ) p = P - 3.6d+02
if( p .lt. 0.0d+00 ) p = p + 3.6d+02
end
|
SUBROUTINE iniconst
IMPLICIT NONE
c
c P. Le Van
c
c-----------------------------------------------------------------------
c Declarations:
c -------------
c
#include "dimensions.h"
#include "paramet.h"
#include "comconst.h"
#include "temps.h"
#include "control.h"
#include "comvert.h"
INTEGER :: l
c
c
EXTERNAL disvert
c
c-----------------------------------------------------------------------
c dimension des boucles:
c ----------------------
im = iim
jm = jjm
lllm = llm
imp1 = iim
jmp1 = jjm + 1
lllmm1 = llm - 1
lllmp1 = llm + 1
c-----------------------------------------------------------------------
dtdiss = idissip * dtvr
dtphys = iphysiq * dtvr
unsim = 1./iim
pi = 2.*ASIN( 1. )
c-----------------------------------------------------------------------
c
r = cpp * kappa
PRINT*,' R CPP Kappa ', r , cpp, kappa
c
c-----------------------------------------------------------------------
CALL disvert
c
c
RETURN
END
|
HANSARD REVISE * NUMERO 124
Le mercredi 23 septembre 1998
LE FESTIVAL INTERNATIONAL DU FILM DE TORONTO
M. Pierre de Savoye
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
LE PRESIDENT DE L'AFRIQUE DU SUD
M. Svend J. Robinson
Le tres hon. Jean Chretien
M. Svend J. Robinson
Mme Diane St-Jacques
Mme Diane St-Jacques
M. Gurbax Singh Malhi
L'hon. Pierre S. Pettigrew
REPONSE DU GOUVERNEMENT A DES PETITIONS
Le ministre des Travaux publics et des Services
LOI PORTANT MISE EN OEUVRE DU TRAITE D'INTERDICTION COMPLETE
Projet de loi C-52. Presentation et premiere lecture
LOI SUR LE FINANCEMENT DES PETITES ENTREPRISES DU CANADA
Presentation et premiere lecture
LA LOI SUR LA SOCIETE CANADIENNE DES POSTES
Presentation et premiere lecture
LOI SUR LA FORMATION POUR LE MARCHE DU TRAVAIL
Presentation et premiere lecture
Presentation et premiere lecture
M. Leon E. Benoit
Le programme de retraite anticipee post-LSPA
Projet de loi C-20. Troisieme lecture
Report du vote sur la motion
HANSARD REVISE * NUMERO 124
Le mercredi 23 septembre 1998
La seance est ouverte a 14 heures.
Tous les deputes se levent et entonnent l'hymne national.]
M. Carmen Provenzano (Sault Ste. Marie, Lib.):
M. Myron Thompson (Wild Rose, Ref.):
L'accident a aneanti son reve de devenir policier.
A mon avis, il merite plus qu'une simple lettre type des deputes ministeriels.
La loi s'occupera-t-elle d'incidents comme celui dont j'ai ete victime?
Tout ce que nous, les victimes, demandons, c'est que justice soit rendue.
Mme Claudette Bradshaw (Moncton-Riverview-Dieppe, Lib.):
Je tiens a feliciter sincerement M. Doucet pour ces mentions d'honneur bien meritees.
M. Stan Dromisky (Thunder Bay-Atikokan, Lib.):
C'est un programme qui profite a tous.
Le Canada y gagne parce que de jeunes Canadiens deviennent plus productifs.
Les participants y gagnent parce qu'ils acquierent de nouvelles competences et de l'assurance.
Le programme est finance par le secteur prive et Ressources humaines Canada.
Mme Elsie Wayne (Saint John, PC):
Le ministre a repondu qu'on ne pouvait pas revenir en arriere.
M. Peter Adams (Peterborough, Lib.):
Elle a ete rachetee par This Week , l'un des journaux communautaires de Peterborough.
J'invite tous les deputes a renouveler leur abonnement a la revue Oldtimers' Hockey News .
M. Gurmant Grewal (Surrey-Centre, Ref.):
Il laisse une femme et quatre enfants.
Mme Sarmite Bulte (Parkdale-High Park, Lib.):
M. Janko Peric (Cambridge, Lib.):
J'invite la ministre a capitaliser sur ce succes.
M. Peter Goldring (Edmonton-Est, Ref.):
Pourquoi les contraindre a une situation aussi intolerable, monsieur le ministre?
LA CIRCONSCRIPTION DE BEAUPORT-MONTMORENCY-COTE-DE-BEAUPRE-ILE-D'ORLEANS
M. Michel Guimond (Beauport-Montmorency-Cote-de-Beaupre-ile-d'Orleans, BQ):
Ce nom est Beauport-Montmorency-Cote-de-Beaupre-ile-d'Orleans.
Je vous explique les caracteristiques inherentes a cette designation:
Mme Angela Vautour (Beausejour-Petitcodiac, NPD):
Les fonctionnaires federales attendent depuis beaucoup trop longtemps.
Je me permets de signaler a la Chambre le cas d'une de ces fonctionnaires.
Elle croyait fermement au principe de l'equite salariale.
Cette lettre etait vraiment importante pour Mme Wry.
Elle l'a conservee jusqu'a son deces, en janvier dernier.
Mais c'etait en vain.
Combien d'autres femmes mourront avant que cette question soit reglee?
M. George Proud (Hillsborough, Lib.):
Nous les felicitons tous deux.
LE FESTIVAL INTERNATIONAL DU FILM DE TORONTO
Mme Carolyn Bennett (St. Paul's, Lib.):
Je suis tres heureuse d'intervenir aujourd'hui...
Le depute de Portneuf a la parole.
M. Pierre de Savoye (Portneuf, BQ):
L'honorable depute de Langley-Abbotsford a la parole.
M. Randy White (Langley-Abbotsford, Ref.):
M. Yvon Charbonneau (Anjou-Riviere-des-Prairies, Lib.):
Monsieur le President, cette semaine est la Semaine maritime mondiale declaree par l'ONU.
M. Preston Manning (chef de l'opposition, Ref.):
Cinq d'entre eux sont devenus si violents qu'ils ont du etre arretes.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, ils ont ete arretes.
M. Preston Manning (chef de l'opposition, Ref.):
Monsieur le President, cinq d'entre eux ont ete arretes...
Le chef de l'opposition a la parole.
Cinq d'entre eux ont ete arretes, monsieur le President.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Les regles s'appliquaient de la meme facon pour tout le monde.
M. Preston Manning (chef de l'opposition, Ref.):
Qui fera enquete sur le role du premier ministre dans cette affaire?
Le premier ministre donnera-t-il son entiere collaboration?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, je n'ai rien a cacher.
Ils ont accepte volontiers.
Le sherpa responsable de la conference comparaitra aussi.
La commission decidera qui elle veut entendre.
Elle fera son travail.
Laissons-la faire son travail.
M. John Reynolds (West Vancouver-Sunshine Coast, Ref.):
Monsieur le President, ma question s'adresse au premier ministre.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
En fait, les Canadiens ont tous les droits a la verite sur cette affaire.
Je souhaite vraiment que nos vis-a-vis laissent la commission accomplir son travail.
M. John Reynolds (West Vancouver-Sunshine Coast, Ref.):
Monsieur le President, j'ai une question complementaire a l'intention du premier ministre.
Comme tous les Canadiens, nous voulons connaitre la verite.
Nous savons qu'il existe une commission.
Nous savons que la commission ne peut pas faire enquete sur le gouvernement.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, la reponse est non.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Richard Marceau (Charlesbourg, BQ):
Monsieur le President, ma question s'adresse au premier ministre.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Richard Marceau (Charlesbourg, BQ):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Mme Alexa McDonough (Halifax, NPD):
Monsieur le President, ma question s'adresse au premier ministre.
Depuis, il a eu le temps de repenser a tout cela.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Une enquete est en cours et ces questions seront posees.
La commission aura acces a tout ce dont elle aura besoin.
Nous avons recu ces chefs d'Etat et tout s'est passe comme...
Le chef du Nouveau Parti democratique a la parole.
Mme Alexa McDonough (Halifax, NPD):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Les mecanismes pour ce faire existent.
Mme Elsie Wayne (Saint John, PC):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Elle comprend tres certainement que le parti doit evoluer un peu.
Et nous nous rejouissons de la visite de Nelson Mandela dans notre pays.
La parole est au chef du Parti conservateur.
Mme Elsie Wayne (Saint John, PC):
En Indonesie, sous le regne du president Suharto, une foule de personnes ont ete tuees.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Jim Abbott (Kootenay-Columbia, Ref.):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Jim Abbott (Kootenay-Columbia, Ref.):
Ce ministre a des responsabilites en tant que solliciteur general.
Il n'est pas un simple membre du Cabinet.
Il est le solliciteur general du Canada au service de tous les Canadiens.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
C'est parfaitement exact, monsieur le President, et j'en suis tres conscient.
M. Michel Gauthier (Roberval, BQ):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Michel Gauthier (Roberval, BQ):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
La verite sera connue, comme les Canadiens s'y attendent.
Mme Deborah Grey (Edmonton-Nord, Ref.):
Nos candidats sont ici aujourd'hui.
Ils sont sur les rangs.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Deborah Grey (Edmonton-Nord, Ref.):
Il est devenu premier ministre a l'automne 1993.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Nous ne pouvons pas le faire tout seuls.
M. Yvan Loubier (Saint-Hyacinthe-Bagot, BQ):
L'hon. Paul Martin (ministre des Finances, Lib.):
Mais ce n'est certainement pas notre intention d'accepter la suggestion du Bloc quebecois.
Le huard n'a pas besoin de ce cirque.
C'etait la suggestion du Bloc quebecois.
M. Yvan Loubier (Saint-Hyacinthe-Bagot, BQ):
Je pense que le minitre doit en tenir compte.
L'hon. Paul Martin (ministre des Finances, Lib.):
Monsieur le President, encore une fois, je ne demande pas qu'on accepte ma parole.
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
Le tres hon. Jean Chretien (premier ministre, Lib.):
J'ai nomme des personnes de differentes religions et de differentes couleurs.
Je leur ai donne la chance de sieger a l'autre endroit.
M. Antoine Dube (Levis-et-Chutes-de-la-Chaudiere, BQ):
Il existe egalement d'autres projets du genre un peu partout au Canada.
LE PRESIDENT DE L'AFRIQUE DU SUD
Mme Marlene Jennings (Notre-Dame-de-Grace-Lachine, Lib.):
Je veux savoir ce que le Canada entend faire pour souligner...
Nous procedons maintenant aux travaux du merveilleux mercredi.
Pourtant, monsieur le President, ma question est assez anodine.
L'hon. David Kilgour (secretaire d'Etat (Amerique latine et Afrique), Lib.):
Demain, le president Mandela s'adressera au Parlement.
Mme Diane Ablonczy (Calgary-Nose Hill, Ref.):
L'hon. Paul Martin (ministre des Finances, Lib.):
C'etait la premiere fois que j'en entendais parler.
Je tiens a dire clairement...
La deputee de Calgary-Nose Hill a la parole.
Mme Diane Ablonczy (Calgary-Nose Hill, Ref.):
L'hon. Paul Martin (ministre des Finances, Lib.):
Monsieur le President, je serai enchante de le faire.
Ce n'est pas moi qui prend ces decisions.
M. Dussault releve du surintendant des institutions financieres.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Svend J. Robinson (Burnaby-Douglas, NPD):
Monsieur le President, le document de l'ambassadeur est tres eloquent.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Mme Diane St-Jacques (Shefford, PC):
Monsieur le President, ma question s'adresse au premier ministre.
Une fois admis dans le pays, ces miliciens ont menace de tirer sur les Canadiens.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Mme Diane St-Jacques (Shefford, PC):
Monsieur le President, au cas ou ce gouvernement l'ignorerait, je vais le renseigner.
L'armee de Suharto a tue des millions de personnes en Indonesie.
Ce sont ces memes soldats qui ont ete admis au Canada.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
M. Gurbax Singh Malhi (Bramalea-Gore-Malton, Lib.):
Monsieur le President, ma question s'adresse au ministre de la Sante.
L'hon. Allan Rock (ministre de la Sante, Lib.):
Des audiences ont actuellement lieu dans tout le pays.
Plus tot, ce mois-ci, nous etions a Halifax.
Nous avons egalement cree un comite scientifique consultatif tout a fait independant.
M. Howard Hilstrom (Selkirk-Interlake, Ref.):
C'etait il y a 24 heures.
Quelles mesures ont ete prises dans le cadre de l'ALENA ou de l'OMC?
L'hon. Lyle Vanclief (ministre de l'Agriculture et de l'Agroalimentaire, Lib.):
Nous allons avoir recours au processus judiciaire prevu dans l'ALENA et l'OMC.
Mme Helene Alarie (Louis-Hebert, BQ):
L'hon. Lyle Vanclief (ministre de l'Agriculture et de l'Agroalimentaire, Lib.):
La maladie doit etre traitee de cette facon.
M. Peter Mancini (Sydney-Victoria, NPD):
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Au contraire, monsieur le President.
La commission nous a assures que le processus se veut informel, et non contradictoire.
M. Bill Matthews (Burin-St.
Le ministre du Developpement des ressources humaines a la parole.
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines, Lib.):
Nous savons bien que des decisions extremement difficiles ont du etre prises.
Nous avons propose un regime qui est, je crois, juste et equilibre.
M. John Harvard (Charleswood-Assiniboine, Lib.):
Monsieur le President, ma question s'adresse au ministre du Commerce international.
L'hon. Sergio Marchi (ministre du Commerce international, Lib.):
Notre patience a des limites.
Voila qui met fin a la periode des questions pour aujourd'hui.
Mme Brenda Chamberlain (secretaire parlementaire du ministre du Travail, Lib.):
REPONSE DU GOUVERNEMENT A DES PETITIONS
LE MINISTRE DES TRAVAUX PUBLICS ET DES SERVICES GOUVERNEMENTAUX
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
C'est a cette Chambre que les renovations sont apportees.
Le president suppleant (M. McClelland):
Nous revenons maintenant aux affaires courantes.
Mme Carolyn Parrish (secretaire parlementaire du ministre des Travaux publics et des Services gouvernementaux, Lib.):
Nous avons presque reussi a faire signer les Etats-Unis.
M. Joe Comuzzi (Thunder Bay-Superior-Nord, Lib.):
Ce n'est la qu'un des succes reels du Groupe interparlementaire Canada-Etats-Unis.
Il y en a plusieurs autres dont je compte vous parler plus tard.
LOI PORTANT MISE EN OEUVRE DU TRAITE D'INTERDICTION COMPLETE DES ESSAIS NUCLEAIRES
LOI SUR LE FINANCEMENT DES PETITES ENTREPRISES DU CANADA
LA LOI SUR LA SOCIETE CANADIENNE DES POSTES
Je parle des 5 000 courriers des routes rurales.
LOI SUR LA FORMATION POUR LE MARCHE DU TRAVAIL
Le projet de loi modifierait l'article 161 du Code criminel.
M. John Richardson (Perth-Middlesex, Lib.):
M. Leon E. Benoit (Lakeland, Ref.):
M. Ted White (North Vancouver, Ref.):
Monsieur le President, j'ai deux petitions a presenter a la Chambre aujourd'hui.
LE PROGRAMME DE RETRAITE ANTICIPEE POST-LSPA
M. Bill Matthews (Burin-St.
Il y a de graves injustices dans le programme actuel.
M. Grant Hill (Macleod, Ref.):
Monsieur le President, j'ai deux petitions a presenter aujourd'hui.
La premiere vient de la Colombie-Britannique et de l'Alberta.
M. Grant Hill (Macleod, Ref.):
M. Howard Hilstrom (Selkirk-Interlake, Ref.):
Je presente cette petition au nom de ces electeurs.
Monsieur le President, je suggere que toutes les questions soient reservees.
Le president suppleant (M. McClelland):
Motion no P-30
Monsieur le President, j'invoque le Reglement.
Le president suppleant (M. McClelland):
Je demande donc au depute de retirer sa motion.
Le president suppleant (M. McClelland):
La presidence donne la parole au solliciteur general.
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Monsieur le President, je propose que la motion soit renvoyee pour debat ulterieur.
Le president suppleant (M. McClelland):
La motion est renvoyee pour debat ulterieur, conformement au paragraphe 97(1) du Reglement.
Monsieur le President, j'ai un autre point a soulever.
Le president suppleant (M. McClelland):
Veuillez attendre juste un moment.
Le depute de Saskatoon-Humboldt invoque le Reglement.
M. Jim Pankiw (Saskatoon-Humboldt, Ref.):
Ces questions figurent au Feuilleton depuis plus de sept mois.
Je le fais une troisieme fois.
Le secretaire parlementaire pourrait-il me dire quand j'obtiendrai des reponses?
Quand vais-je obtenir des reponses?
M. Dick Harris (Prince George-Bulkley Valley, Ref.):
Motion no P-31
L'hon. Andy Scott (solliciteur general du Canada, Lib.):
Monsieur le President, je demande qu'elle soit renvoyee pour debat ulterieur.
Le president suppleant (M. McClelland):
La motion est renvoyee pour debat ulterieur, conformement au paragraphe 97(1) du Reglement.
Motion no P-4
Motion no P-29
Le president suppleant (M. McClelland):
M. John Bryden (Wentworth-Burlington, Lib.):
Le president suppleant (M. McClelland):
Je vais maintenant parler de mes deux amendements.
Le ministre de l'Industrie n'a pas cesse de m'encourager a cet egard.
Je ne vous retiendrai pas longtemps.
A propos, avez-vous des enfants ou des petits-enfants?
Pourtant, il s'agit d'un organisme de charite.
En voici un exemple.
Le fonds international pour le bien-etre des animaux a son siege a l'etranger.
L'organisation fait parvenir de tres belles photos montrant des blanchons ensanglantes.
En fait, la loi canadienne interdit l'abattage des blanchons.
Ce type d'activite n'a pas cours au Canada.
Ces gens n'ont cependant aucun scrupule a agir de la sorte.
Il faut se rappeler que ce qui importe, c'est le mot deliberement.
Il n'est pas question d'erreurs accidentelles.
C'est un premier pas partiel.
Je vais vous donner un petit exemple.
En d'autres termes, il s'agit du meme compte aupres de Postes Canada.
La encore, c'est un enorme pas en avant.
Je vais donner un exemple du probleme.
Encore une fois, le mot cle est deliberement.
La liste est interminable.
On aurait pu croire qu'ils pourraient faire le travail eux-memes.
International Fund for Animal Welfare.
Ce groupe ne fait meme pas son propre travail lui-meme.
Ce n'est pas un organisme de charite.
Ils sont 22 000 environ.
Il est interessant que seules ces deux chapitres de Centraide apparaissent.
J'imagine que les autres font affaire avec d'autres vendeurs directs aux Etats-Unis.
Voter Education South Africa Canada, Whale Adoption Fund, Campagne du Ruban Blanc.
Il etait ici il y a quelques annees.
Wild Life Preservation Trust Canada.
M. Mac Harb (Ottawa-Centre, Lib.):
Elle comporte trois elements.
C'est une modification relative a la denonciation.
L'autre volet de la proposition a trait a l'interdiction.
La proposition renferme un troisieme volet, qui porte sur l'infraction et la peine.
Cet amendement vient regler ce probleme.
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
L'element le plus important de cette mesure legislative concerne le telemarketing.
Premierement, les televendeurs doivent indiquer l'identite de l'entreprise qu'ils representent.
Deuxiemement, ils doivent indiquer le prix des services ou des produits qu'ils vendent.
Troisiemement, ils doivent indiquer la raison de leur appel.
En l'absence de ces dispositions, un televendeur peut tromper le consommateur comme il veut.
Le telemarketing au Canada est une industrie qui vaut des milliards.
Sans une protection adequate contre la fraude, cette industrie ne continuera pas a se developper.
Pour que le marche soit libre, le gouvernement ne doit pas s'en meler.
Dire qu'un Etat libere les marches est une contradiction.
C'est le role que le gouvernement doit jouer dans une economie libre.
Le gouvernement affaiblit l'economie en faisant croire qu'il la raffermit.
Le seul objectif d'une entreprise est d'acculer ses concurrents a la faillite.
Selon la Loi sur la concurrence, cette pratique est illegale.
On dit qu'il s'agit de prix anticoncurrentiels et de dumping.
Desole, mais cela aussi est contraire aux regles etablies.
C'est ce qu'on appelle la collusion.
C'est ce qu'on appelle de l'exploitation.
Nos lois sur la concurrence ne sont qu'une accumulation de contradictions impossibles a appliquer.
Le ministre nous dira qu'il essaie simplement de proteger les consommateurs canadiens.
Ce n'est tout simplement pas la verite.
Le ministre est un vieil ami du consommateur canadien.
Je voudrais egalement toucher un mot des modifications apportees aux dispositions relatives aux fusionnements.
M. Antoine Dube (Levis-et-Chutes-de-la-Chaudiere, BQ):
A cet egard, je leur rends hommage.
Ils ont regarde et considere l'interet des consommateurs pour etablir leur position.
Je les remercie de leur appui pour la plupart des amendements que nous avons proposes.
Je souligne encore une fois l'appui des deputes du Nouveau Parti democratique.
Je vais faire un rappel rapide des differentes motions.
Cela veut dire qu'une declaration de culpabilite ne comporte plus les memes exigences.
Ce sont parfois de grosses organisations.
C'est un probleme grave et important.
Il faut qu'une loi soit bonne.
Il est encore question ici d'intentions.
Dans ce delai, il est possible pour des entreprises de s'entendre avec lui.
Mais il y a une chose que je ne comprends pas.
C'est deja une realite.
C'est cela l'avenir.
C'est laisser beaucoup de pouvoirs a une seule personne.
Je sais maintenant pour quelle raison le gouvernement liberal a voulu agir ainsi.
Il aurait besoin de beaucoup d'amelioration.
On deplore aussi que tous les amendements que nous avons proposes aient ete rejetes.
Mais nous ne croyons pas que c'est le cas, bien au contraire.
En ce qui concerne la suppression de la TPS, ce fut la meme chose.
Ils reprochaient aux conservateurs de le faire.
Ils en ont paye le prix, notamment dans les Maritimes, comme on le sait.
Mais aujourd'hui, le Parti liberal est loin de ces preoccupations.
M. Chris Axworthy (Saskatoon-Rosetown-Biggar, NPD):
La deuxieme partie du projet de loi C-20 fait davantage probleme.
Cette partie du projet ne repond pas tout a fait aux besoins des Canadiens.
Permettez-moi de dire un mot des dispositions sur la fraude dans le telemarketing.
Comment cela peut-il se produire?
Ces fraudeurs s'enrichissent enormement.
Nous connaissons bien les questions qui touchent l'Internet.
Nous avons probablement tous deja utilise l'Internet a ces fins.
On a repondu que cela n'entrait pas vraiment dans la categorie du telemarketing.
Ce n'est pas exactement la meme chose, mais ce n'est pas si different.
Nous avons une nouvelle forme de marketing qui est axee sur la technologie.
C'est n'est pas si different du telemarketing.
J'aurais souhaite que le gouvernement tienne compte de ces suggestions.
Je sais que le secretaire parlementaire est tres vigilant par rapport a ces questions.
Comme le secretaire parlementaire acquiesce, je suis certain que c'est ce qui se produira.
Le gouvernement fait une erreur fondamentale a l'egard de la concurrence.
Il aurait fallu rendre les dispositions plus severes, pas les affaiblir.
M. Jim Jones (Markham, PC):
La plupart des activites de telemarketing sont legitimes, mais certaines ne le sont malheureusement pas.
Ce sont ces dernieres qui me preoccupent.
Ce chiffre a gonfle a plus de 75 millions de dollars en 1996.
Au Canada, cela correspondrait a 400 millions de dollars par annee.
Le moment est venu d'actualiser la loi en tenant compte des pratiques commerciales modernes.
Ce cadre est indispensable afin de permettre au secteur prive de maintenir sa position concurrentielle.
Il ne faut pas oublier le stigmate lie au processus judiciaire.
Les Canadiens ont manifeste leur preference pour les soldes et les articles en solde.
Le projet de loi ne traite pas de facon satisfaisante de la question des fusions.
Pourtant, l'inflation justifie une telle mesure.
Ce ne sont pas les exemples qui font defaut.
Elles demandent egalement au parlement de clarifier son intention.
Une definition plus claire du telemarketing s'impose.
En quoi consiste au juste le telemarketing?
C'est egalement le voeu de l'Association du Barreau canadien.
Bref, une clarification des definitions s'impose dans la mesure legislative.
C'est une approche que la loi pourrait retenir.
Mon parti aimerait que cette question fasse l'objet d'un plus large debat.
Il faut toutefois etablir des lignes directrices rigoureuses pour empecher ce genre d'activite.
Il faut prendre immediatement des mesures efficaces pour y remedier.
M. Walt Lastewka (secretaire parlementaire du ministre de l'Industrie, Lib.):
La Chambre est-elle prete a se prononcer?
La Chambre a entendu la motion.
Plait-il a la Chambre d'adopter la motion?
Que tous ceux qui sont en faveur de la motion veuillent bien dire oui.
Que tous ceux qui sont contre veuillent bien dire non.
A mon avis, les oui l'emportent.
Et plus de cinq deputes s'etant leves:
Et la sonnerie s'etant arretee:
M. Bob Kilger (Stormont-Dundas, Lib.):
Monsieur le President, j'invoque le Reglement.
( La seance est suspendue a 16 h 43.)
La seance reprend a 17 h 14.
Le president suppleant (M. McClelland):
(La motion, mise aux voix, est adoptee.)
Le president suppleant (M. McClelland):
Je declare la motion adoptee.
(Le projet de loi est lu pour la troisieme fois et adopte.)
Le president suppleant (M. McClelland):
Une des choses dont ils parlent, bien sur, c'est l'economie.
Aujourd'hui, ils s'inquietent de la chute du dollar et des perspectives economiques.
Il ne savait tout simplement pas quoi faire.
Ils n'etaient pas certains d'etre en securite dans les rues.
Mes electeurs sont tres preoccupes par toutes ces questions.
Nous pouvons certainement faire mieux que cela.
Voila le genre de questions dont discutent mes electeurs.
Naturellement, les centres de detention coutent cher.
Mais n'est-ce pas la meilleure garantie que l'argent peut procurer?
Il jugeait cela trop barbare.
Je ne voudrais pas etre emprisonne.
Elle n'est pas necessaire a la bonne administration de la justice.
Elle n'a pas sa place dans le droit penal.
Elle sape le systeme.
Mais l'abrogation n'irait pas sans probleme.
C'etait une question de retroactivite.
En tant que pays, nous voulons nous sentir en securite.
J'insiste sur ce dernier point, parce que les liberaux ne s'en occupent pas.
J'etais surprise, mais je n'aurais pas du l'etre.
J'etais en colere, mais je n'aurais pas du l'etre.
J'ai eu le sentiment d'avoir ete trahie et j'ai panique.
Je ne pouvais plus respirer ni rester en place.
Je faisais les cent pas.
Pourquoi devons-nous subir tout cela de nouveau?
Je me sentais faible, vulnerable.
Je risquais encore de perdre ma dignite.
Il semblait si parfait.
Il a ete battu au point de devenir meconnaissable.
Je ne laisserai ni Olson ni le systeme le faire une deuxieme fois.
C'est facile de parler.
Les liberaux prechent qu'il faut laisser une deuxieme chance aux meurtriers.
Peut-etre changeraient-ils d'avis?
Ces victimes ont le droit de se faire entendre.
Elles ont le droit a notre plus grand respect.
C'est l'impression qu'a l'opinion publique canadienne.
Chaque fois que cela se produira, ses victimes renoueront avec la souffrance.
Nous avons de nombreuses obligations en tant que legislateurs.
C'est le but de ce modeste projet de loi.
La n'est pas la question.
Pour une fois, faisons ce que nous devons et abrogeons l'article 745.
De nombreuses personnes ont demande qu'il soit abroge au nom de la securite publique.
Cela comprend les meurtres en serie.
Les modifications sont entrees en vigueur le 9 janvier 1997.
Oui, nous avons le coeur tendre au Parti liberal.
M. Michel Bellehumeur (Berthier-Montcalm, BQ):
Je pense que tout le systeme canadien est comme une espece de gros casse-tete.
Toutes sortes de choses ont ete dites.
Il ne faut pas tomber dans les exces dans le domaine de la justice.
Ce n'est pas de cette facon que l'on peut regler le probleme.
C'est extremement important.
Une rehabilitation n'est pas automatique, c'est evident.
Il y a une analyse et une procedure de revision extremement importante.
Il faut vivre avec ca et en retirer les elements positifs.
L'analyse est faite de facon tres rigoureuse et se fait en deux temps.
Il doit convaincre le jury de la pertinence de sa demande de liberation.
Ce n'est pas une mince affaire.
C'est un procede tres complexe.
Je ne dis pas que c'est trop complexe pour le criminel.
On a un systeme qui a ete ameliore avec les annees.
C'est l'equite.
Je vais resumer tres brievement pourquoi le Bloc quebecois est contre ce projet de loi.
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
Trois modifications fondamentales ont alors ete adoptees.
Bien que bien intentionnees, ces modifications renferment un certain nombre de lacunes.
Cela en dit long sur les priorites du gouvernement.
Cela irait dans le meme sens.
Les victimes pourraient se faire mieux entendre au sein du systeme judiciaire.
Le president suppleant (M. McClelland):
Y a-t-il consentement unanime?
Le president suppleant (M. McClelland):
M. John Nunziata (York-Sud-Weston, Ind.):
Nous discutons de ce qui serait une peine appropriee pour ce genre de crime.
Or, ce n'etait pas exact.
Cet etat de choses est tout simplement inacceptable.
Il y a la matiere a un autre debat.
M. Grant McNally (Dewdney-Alouette, Ref.):
Je voudrais etre plutot bref et concis, et une histoire personnelle.
C'est le pere de l'une des victimes de M. Olson.
C'est ce dont il est question.
On nous parle aujourd'hui a la Chambre d'une divergence ideologique.
Il y a certes une tres grande divergence ideologique.
La secretaire parlementaire a parle des modifications que le gouvernement avait apportees.
Je n'oublierai jamais les observations de M. King.
C'est la tragedie dont il est question aujourd'hui.
M. Lynn Myers (Waterloo-Wellington, Lib.):
Je tiens a reiterer la position du gouvernement.
L'article 745.6 fixe des conditions extremement rigoureuses.
L'article 745.6 souleve beaucoup d'inquietudes au sein de la population.
Cette modification vise egalement les meurtres en serie.
Le president suppleant (M. McClelland):
M. Paul Forseth (New Westminster-Coquitlam-Burnaby, Ref.):
Le president suppleant (M. McClelland):
L'article 745 doit disparaitre.
Il n'offre aucun avantage au niveau de l'administration de la justice.
J'ai moi-meme eu a superviser des detenus en liberte conditionnelle.
J'ai entendu toutes les excuses possibles.
Elles n'ont pas leur place dans le droit penal du Canada.
C'est l'objectif de la population, un objectif universel au pays.
Des milliers de noms figurent sur des petitions presentees ici a ce sujet.
Que faut-il faire pour avoir gain de cause?
Pourtant, c'est une question d'importance nationale qui ne disparaitra pas toute seule.
J'ai represente mon projet de loi pour la ramener sur le tapis.
Le president suppleant (M. McClelland):
Y a-t-il consentement unanime?
Le president suppleant (M. McClelland):
Il n'y a pas consentement unanime.
M. Paul Bonwick (Simcoe-Grey, Lib.):
Le president suppleant (M. McClelland):
Y a-t-il consentement unanime?
Je remercie mes collegues de m'offrir la possibilite de prononcer ce discours.
Permettez-moi de clarifier ma position a cet egard.
Je voudrais donner brievement un exemple qui saura peut-etre influencer quelques-uns des deputes.
Il y a 17 ou 18 ans, les enfants avaient reagi comme des enfants.
Ils avaient reussi a oublier et la vie avait continue.
Cela a eu un impact tres negatif sur leur vie.
Le president suppleant (M. McClelland):
M. Gordon Earle (Halifax-Ouest, NPD):
J'espere que le gouvernement peut clarifier ce qui est de moins en moins limpide.
Cette position du gouvernement va clairement a l'encontre des interets des autochtones.
Le Commissaire aux droits de la personne ecrivait, dans son rapport de 1993:
M. David Iftody (secretaire parlementaire du ministre des Affaires indiennes et du Nord canadien, Lib.):
Le gouvernement federal prend au serieux cette responsabilite a l'egard des peuples autochtones.
M. Greg Thompson (Nouveau-Brunswick-Sud-Ouest, PC):
Voila qui, a mon avis, n'est pas sans risques pour de nombreux Canadiens.
Cela risque de mettre la vie des Canadiens en danger.
Que fait l'interesse?
Il prend des mesures correctives.
C'est exactement ce qu'a fait la Croix rouge.
Les essais cliniques, par exemple, mettent la sante des Canadiens en danger.
Mme Elinor Caplan (secretaire parlementaire du ministre de la Sante, Lib.):
Nous comprenons le role crucial que remplit cette direction generale, la DGPS.
Nous avons d'ailleurs entame une consultation pancanadienne.
Il y a deja eu une rencontre a Halifax.
Il y en aura partout au Canada.
J'invite mon vis-a-vis a y participer.
C'est pourquoi le ministre a reuni des personnalites canadiennes ayant une orientation scientifique.
Le comite consultatif scientifique supervise l'etude.
Le president suppleant (M. McClelland):
(La seance est levee a 19 h 6.)
|
C$PRAGMA C (GET_APPS_DEFAULTS)
subroutine ecord(segid,ijdlst,ihlst,c,maxc,ier)
c
C.................................
C Modified by Scott Townsend RTi July 2003
C Added code to fix a bug which kept an esp verification run
C from completing since expected carryover values were not
C written to the carryover file which was needed by the ESP
C historic traces run. Added code checks to keep a segment
C fault from occuring if the carryover file did not contain
C all of the expected data. An error message is written instead
C of a hard crash.
C.................................
include 'common/fctime'
include 'common/ionum'
include 'common/fdbug'
include 'common/where'
include 'common/egentr'
include 'common/fcio'
include 'common/fcunit'
c
dimension segid(2)
dimension sbname(2),oldopn(2),segidf(2),c(1)
c
cfan integer tmplen,dirlen
integer tmplen,dirlen,filelen !cfan
c
character diresp*256,file*22,tempfile*22,filename*256,
1 tmpstr*64,csegid*8,cmo*2,cda*2,chr*2,ctzc*4,dot*1,tzc*4
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/shared_esp/RCS/ecord.f,v $
. $', '
.$Id: ecord.f,v 1.5 2006/04/10 16:13:02 xfan Exp $
. $' /
C ===================================================================
C
c
data sbname/4hecor,4hd /
data name/4hecor/
c
ioldop=iopnum
iopnum=0
do 10 i=1,2
oldopn(i)=opname(i)
opname(i)=sbname(i)
10 continue
c
if(itrace.ge.1) write(iodbug,900)
900 format(1h0,'ecord entered')
c
lbug=.false.
if(ifbug(name).eq.1) lbug=.true.
c
ier=0
c
call mdyh2(ijdlst,ihlst,ijmonth,ijday,iyear,ijhour,100 , 0 ,
1 tzc)
c
tmplen=10
tmpstr='ens_files'
tmpstr(10:10)=char(0)
c
call get_apps_defaults(tmpstr,tmplen,diresp,dirlen)
c
if(dirlen.gt.234) then
write(ipr,600)
600 format('**ERROR** THE ESP CARRYOVER DIRECTORY EXCEEDS ',
1 '234 CHARACTERS. THE PATH MUST BE SHORTENED.')
ier=1
call error
go to 999
endif
c
diresp(dirlen+1:dirlen+11)='/carryover/'
c
write(csegid,21) (segid(j),j=1,2)
21 format(2a4)
22 format(i2.2)
write(cmo,22) ijmonth
write(cda,22) ijday
write(chr,22) ijhour
write(ctzc,21) timezn
c
dot='.'
tempfile=' '
tempfile=csegid//dot//cmo//dot//cda//dot//chr//dot//ctzc
c
j=1
file=' '
do 30 i=1,22
if (tempfile(i:i).ne.' ') then
file(j:j)=tempfile(i:i)
j=j+1
endif
30 continue
c
call ulenth(file,22,tmplen)
filename=diresp(1:dirlen+11)//file(1:tmplen)
filelen=dirlen+11+tmplen
filename(filelen+1:filelen+1)=char(0)
c
iunit=79
lrecl=-1
c call upopen(iunit,filename,lrecl,'u',ic)
open(unit=iunit,file=filename,access='sequential',
! form='unformatted',status='old', iostat=ioerr)
if(ioerr.ne.0) then
write(ipr,604) filename
604 format('**ERROR** OPENING HISTORICAL CARRYOVER FILE',A)
ier=1
call error
go to 999
endif
c
40 read(iunit) segidf,iwocry,icday,ichour,nc,ncops
call mdyh2(icday,ichour,ifmonth,ifday,ifyear,ifhour,lstz,ids,
! timezn)
c
ijdtest=ijdlst*24+ihlst
icdtest=icday*24+ichour
c
c Added RTi July 2003
c Testing to make sure the index values are not assigned a huge value
c i.e. the conditional check to see if we reached the end of the data
c is broken. This would happen if for some reason not all of the carryover
C written to the carryover file. If so we just write an error msg.
icheck1=1
icheck2=1
if(icdtest.lt.ijdtest) then
do 44 n=1,ncops
read(iunit,end=990) ic1,ic2,(c(i),i=ic1,ic2)
c Added RTi July 2003
c The following condition checks to see if an actual integer was
c read in to the pointers or a float in binary integer form! If a
c float then an error in the following array assignment would cause
c a hard crash so we exit with an error message.
if(ic1.ge.icheck1*1000)go to 46
if(ic2.ge.icheck2*1000)go to 46
icptr=c(ic1+1)
if(icptr.eq.nc)go to 40
c Added RTi July 2003
c Update the checking values.
icheck1=ic1
icheck2=ic2
44 continue
write(ipr,605)
605 format('*** ERROR ** NC DOES NOT AGREE WITH CARRYOVER POINTERS')
c
elseif(icdtest.eq.ijdtest) then
do 45 n=1,ncops
read(iunit,end=990) ic1,ic2,(c(i),i=ic1,ic2)
c Added RTi July 2003
c The following condition checks to see if an actual integer was
c read in to the pointers or a float in binary integer form! If a
c float then an error in the following array assignment would cause
c a hard crash so we exit with an error message.
if(ic1.ge.icheck1*1000)go to 46
if(ic2.ge.icheck2*1000)go to 46
icptr=c(ic1+1)
if(icptr.eq.nc)go to 999
c Added RTi July 2003
c Update the checking values.
icheck1=ic1
icheck2=ic2
45 continue
46 continue
write(ipr,605)
c
endif
c
990 continue
write(ipr,606)
606 format('**ERROR** DATE NOT FOUND ON HISTORICAL CARRYOVER',
1'FILE')
ier=1
call error
c
999 continue
opname(1)=oldopn(1)
opname(2)=oldopn(2)
return
end
|
C
C $Id: mdiaty.f,v 1.3 2008-07-27 00:17:06 haley Exp $
C
C Copyright (C) 2000
C University Corporation for Atmospheric Research
C All Rights Reserved
C
C The use of this Software is governed by a License Agreement.
C
INTEGER FUNCTION MDIATY (IAIN)
C
INTEGER IAIN
C
PARAMETER (MNAI=8000)
C
C The value of MDIATY(IAIN) is the area type for the area whose area
C identifier is IAIN.
C
COMMON /MAPCMX/ IATY(MNAI),ISCI(MNAI),IPAR(MNAI)
INTEGER IATY,ISCI,IPAR
SAVE /MAPCMX/
C
MDIATY=0
IF (IAIN.GE.1.AND.IAIN.LE.MNAI) THEN
MDIATY=IATY(IAIN)
END IF
RETURN
END
|
subroutine clear_plot
character*1 gs,esc,ff
gs=char(29)
esc=char(24)
ff=char(12)
write(*,100) gs//esc//ff
100 format(' ',a,$)
return
end
|
C FUNCTION DMEAN is the bridge between the Discrete environment and the
C real FUNCTION MEAN.
DOUBLE PRECISION FUNCTION DMEAN (PER,TRAIT,PAR,NPAR,VARDATA,NVAR
1,NTOT,MALE)
DOUBLE PRECISION PAR(NPAR),VARDATA(NVAR,NTOT)
INTEGER TRAIT,PER
LOGICAL MALE
DOUBLE PRECISION EXTRA(10),MEAN
INTEGER NEXTRA,NTRAIT,PED
C EXTRA isn't actually used
NEXTRA = 10
C PED isn't used
PED = 1
C NTRAIT isn't used
NTRAIT = 1
DMEAN=MEAN(EXTRA,PAR,VARDATA(1,PER),NEXTRA,NPAR,NTRAIT,NVAR,PED
1,PER,TRAIT,MALE)
END
|
!!!!!!!!!!!!!!!!!!!!!! FitFUNCTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function FitFun(X1,X2) ! FitFun = value which fits y at argument x
IMPLICIT REAL*8 (A-H,O-Z)
!Real*8 XNe,gamma1,gamma2,xi,wB,w
real*8 kappa !, anPar(4) !f(100),
data c /2.997925d10/ !speed of light
character*3 ftype
common/VAR/EPS,STEP,NPAR,NX1,NX2,KX
common/Eminmax/E_min, E_max, T_fix,are_arc,dep_arc
common/OptDepth/tau,gaunt,densTh
common/ARR/FUNDAT(300,9),ERRDAT(300,9),X1dat(300),X2dat(9), ! NX1max=300, NX2max=9
*PAR(15),DPAR(15),VECT(15),PSCALE(15),PARmin(15),PARmax(15), ! NPARmax=15
*FUNC(19),AS(19,15) ! 19=NPARmax+4 (for SIMPLEX)
common /parms/ area, dep, enth, enrl, bmag, theta,
& E0, E1, E2, delta1, delta2, EBR, temp, epsTh, kappa, etr, ftype
common/B2Ind/NB2
!common /AnPar/AnPar !For Alt anis test 01-11-16
Cc External SynFitFun
External FitKlein
c----------------------------------------------------------------------
c
c ----- Set some default values
c ------------------------
DepArcSec=dep_arc !8. !20. !24. !20.
AreaArcSec= are_arc !4. !DepArcSec*DepArcSec !Par(4) !30.*DepArcSec
eNrl_tot=0.3e35
!DepArcSec=10. !Altyntsev's event 2012-07-06
!AreaArcSec=15.*DepArcSec !Altyntsev's event 2012-07-06
area =AreaArcSec*7.27e7*7.27e7 !*100*14 !Par(4) !1e20 !3e18 *Par(4) ! 1.e20
!area =DepArcSec*7.27e7*7.27e7 !*Par(5)
dep = DepArcSec*7.27e7 !Par(3)*7.27e7 ! *Par(3) !*Par(1) ! 1e10 !3e9 !*Par(4) !*Par(4) !1.e10
!temp = 1.e7 !*Par(6) !1.e9
temp = T_fix !4.e7
If(Npar.gt.6) temp = 1d6*Par(7) !1.e9
!2018_June 04 Temporarily vary Temp
epsTh = 0.05 !04 !25 !0.050
kappa = 4.0 ! must be gt 1.5
E0 = Par(8) !1.0
E1 = E_min !0.02 !Par(6) ! 0.064 !Par(6) ! 0.1 !0.02
!E2 = Par(6) !5.0 !Par(6) !5. !Par(6) !5. !Par(6) !10.0 !
E2 = E_max !10d0 !Par(6) !5.0 !Par(6) !5. !Par(6) !5. !Par(6) !10.0 !
If(Npar.gt.5) E2 = Par(6)
!2018_June 04 Temporarily fix Emax and vary Emin above
EBR = 1.0
delta1 =Par(5) !6-0.02*Par(5) !5. ! Par(6) !4. !4.0*
delta2 = delta1 !Par(7) !delta1 !delta1 !Par(1) !6.0 !9.0 !4.0
enth = 0.1e10*Par(4) !0.25 !Par(5) !3.e10*Par(4) - default value !0.0
!tau1=Par(1) !(16.+0.01*Par(1))
enrl = 1e7*Par(1) !ENrl_tot/area/dep*tau1 !*Par(4) !*Par(3)
bmag = 100.*Par(2) !100.*(1.+0.01*Par(2)) !*1.5 !*1.5 !*Par(2) ! !1.0
theta = Par(3) !70. !45. !Par(5) !60. !Par(5) ! 45. !80.0
ftype = 'PLW' !'dpl' !'plp' !''plp' !'kap' !'tnt' !'plg' !'kap' !'tnt' !'thm' !'tnt' !'tng' !'plp'
etr = 25.
c !Below: Altyntsev Test parms for beam case
c delta1 =2.
c
!E2 = 3.
c AnPar(1)=60.
c AnPar(2)=180. !180. !90.
c AnPar(3)=Par(6) !0.4 !0.4 !0.1
c AnPar(4)=10.
CC Test parameters:
Cc XNe=1d19*Par(1) !1d19*Par(1) !Total Number of relativistic electrons normalized
!to N(>100 keV)*V=10^33
Cc xi=Par(3) !Energy spectral index
Cc gamma2=Par(4) !hIGH-ENERGY CUT-OFF
Cc gamma1=Par(5) !Low-ENERGY CUT-OFF
Cc Bgauss=200.*Par(2) !Par(5) !250. !Par(4) !Magnetic field
DensTh=enth+enrl !1.e10*Par(6) !Thermal number density in cm^{-3}
CC Derived parameters
fpe=9e3*sqrt(DensTh) !plasma frequency in Hz
fpeGHz=fpe/1e9
fBe=2.8e6*Bmag
wB=fBe/fpe
If(X1.le.fpe) then
FitFun=0
Cc write(*,*)'x1=',x1,fpe
Return
Else
CC write(*,*)'Fundat=',fundat(11,1)
c RefInd=sqrt(1.-fpeGHz**2/X1**2)
c print*,refind
End If
frqHz=X1 !X1 - frequency in Hz!!!
Cc FitFun=SynFitFun(XNe,gamma1,gamma2,xi,wB,w,fpe)
X2=0
FitFun=FitKlein(frqHz,X2)
!write(*,*) 'X2= ', X2
return
end
|
PROGRAM MAIN
C GAUSSIAN ELIMINATION
C From: http://users.metu.edu.tr/azulfu/courses/es361/programs/fortran/GAUEL.FOR
IMPLICIT NONE
REAL, DIMENSION (20,21) :: A
INTEGER :: I, J, N
10 FORMAT(/,' GAUSS ELIMINATION')
WRITE (*,10)
C INITIALIZATION
C DATA N/4/
C DATA (A(1,J), J=1,5) /-40.0,28.5,0.,0.,1.81859/
C DATA (A(2,J), J=1,5) /21.5,-40.0,28.5,0.,-1.5136/
C DATA (A(3,J), J=1,5) /0.,21.5,-40.0,28.5,-0.55883/
C DATA (A(4,J), J=1,5) /0.,0.,21.5,-40.0,1.69372/
N = 4
11 FORMAT(5(X,F8.2))
OPEN(10, FILE="INFILE-GAUSSIAN")
DO I = 1, N
READ (10,11) A(I,1), A(I,2), A(I,3), A(I,4), A(I,5)
END DO
CLOSE(10)
C END INITIALIZATION
12 FORMAT(/,' AUGMENTED MATRIX',/)
WRITE(*,12)
61 FORMAT(5(1X,f8.4))
DO I=1,N
WRITE(*, 61) A(I,1), A(I,2), A(I,3), A(I,4), A(I,5)
END DO
13 FORMAT('')
14 FORMAT(' SOLUTION')
15 FORMAT(' ...........................................')
16 FORMAT(' I X(I)')
WRITE(*,13)
CALL GAUSS(N,A)
WRITE(*,13)
WRITE(*,14)
WRITE(*,15)
WRITE(*,16)
WRITE(*,15)
72 FORMAT(5X,I5, F12.6)
DO I=1,N
WRITE (*,72) I, A(I,N+1)
END DO
WRITE(*,15)
WRITE(*,13)
STOP
END PROGRAM MAIN
C*************************************
SUBROUTINE GAUSS(N,A)
REAL, DIMENSION(20,21) :: A
INTEGER PV, I, J, K, N, R, JC, JR, KC, NV
REAL :: EPS, EPS2, DET, TM, TEMP, VA
EPS=1.0
DO WHILE (1.0+EPS.GT.1.0)
EPS=EPS/2.0
END DO
EPS=EPS*2
11 FORMAT (' MACHINE EPSILON=',E16.8)
WRITE(*,11) EPS
EPS2=EPS*2
1005 DET=1.0
DO 1010 I=1,N-1
PV=I
DO J=I+1,N
IF (ABS(A(PV,I)) .LT. ABS(A(J,I))) PV=J
END DO
IF (PV.NE.I) THEN
DO JC=1,N+1
TM=A(I,JC)
A(I,JC)=A(PV,JC)
A(PV,JC)=TM
END DO
1045 DET=-1*DET
END IF
1050 IF (A(I,I).EQ.0.0) THEN
STOP 'MATRIX IS SINGULAR'
END IF
DO JR=I+1,N
IF (A(JR,I).NE.0.0) THEN
R=A(JR,I)/A(I,I)
DO KC=I+1,N+1
TEMP=A(JR,KC)
A(JR,KC)=A(JR,KC)-R*A(I,KC)
IF (ABS(A(JR,KC)).LT.EPS2*TEMP) A(JR,KC)=0.0
END DO
END IF
1060 END DO
1010 CONTINUE
DO I=1,N
DET=DET*A(I,I)
END DO
12 FORMAT(/,' DETERMINANT= ',F16.5,/)
WRITE(*,12) DET
IF (A(N,N).EQ.0.0) THEN
STOP 'MATRIX IS SINGULAR'
END IF
A(N,N+1)=A(N,N+1)/A(N,N)
DO NV=N-1,1,-1
VA=A(NV,N+1)
DO K=NV+1,N
VA=VA-A(NV,K)*A(K,N+1)
END DO
A(NV,N+1)=VA/A(NV,NV)
END DO
RETURN
1100 CONTINUE
RETURN
END
|
C$Procedure LBREM ( Line buffer, remove )
SUBROUTINE LBREM_1 ( POS, PTRS, BUFFER )
IMPLICIT NONE
C$ Abstract
C
C Remove a line from a line buffer.
C
C$ Disclaimer
C
C THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
C CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
C GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
C ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
C PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
C TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
C WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
C PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
C SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
C SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
C
C IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
C BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
C LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
C INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
C REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
C REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
C
C RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
C THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
C CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
C ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
C
C$ Required_Reading
C
C CB, LB
C
C$ Keywords
C
C ASCII
C CHARACTER
C STRING
C TEXT
C
C$ Declarations
INTEGER LBCELL
PARAMETER ( LBCELL = -5 )
INTEGER LBCBUF
PARAMETER ( LBCBUF = 0 )
INTEGER POS
INTEGER PTRS ( LBCELL:* )
CHARACTER*(*) BUFFER ( LBCBUF:* )
C$ Brief_I/O
C
C Variable I/O Description
C -------- --- --------------------------------------------------
C POS I Position of line to be removed.
C PTRS,
C BUFFER I,O Line buffer.
C
C$ Detailed_Input
C
C POS is the position of an existing line within a line
C buffer.
C
C PTRS,
C BUFFER are the pointer and character components of a line
C buffer.
C
C$ Detailed_Output
C
C PTRS,
C BUFFER are the pointer and character components of the
C same line buffer, after the specified line has been
C removed.
C
C$ Files
C
C None.
C
C$ Exceptions
C
C 1) If POS is less than one, or if POS is greater than the
C number of lines currently stored in the buffer, the error
C 'SPICE(LBNOSUCHLINE)' is signalled.
C
C$ Particulars
C
C Existing lines may be removed from at any position within a line
C buffer. All subsequent lines are moved forward to take up the
C slack.
C
C$ Examples
C
C Let the line buffer (P,B) contain the following lines
C
C If you can make one heap of all your winnings
C And risk it on one turn of pitch-and-toss,
C And lose, and start again at your beginnings,
C And never breathe a word about your loss:
C If you can force your heart and nerve and sinew
C To serve your turn long after they are gone,
C
C Following the calls
C
C CALL LBREM ( 3, P, B )
C CALL LBREP ( 3, P, B )
C
C it contains the lines
C
C If you can make one heap of all your winnings
C And risk it on one turn of pitch-and-toss,
C If you can force your heart and nerve and sinew
C To serve your turn long after they are gone,
C
C$ Restrictions
C
C None.
C
C$ Literature_References
C
C None.
C
C$ Author_and_Institution
C
C Dagny Taggart, (JPL)
C
C$ Version
C
C- Inspekt Version 3.0.0 9-May-1994 (WLT)
C
C Added a "TOUCHC" to the input buffer so that compilers
C won't complain about input arguments not being used.
C
C And fixed the addition of "TOUCHC" to refere to LBCBUF
C instead of LBCELL
C
C- Beta Version 1.0.0, 19-JAN-1989 (DT)
C
C-&
C
C SPICELIB functions
C
LOGICAL RETURN
C
C Other Functions
C
CHARACTER*(1) TOUCHC
C
C Local variables
C
INTEGER MAXLN
INTEGER NLINE
INTEGER NCOM
INTEGER PCARD
INTEGER POSPTR
INTEGER POSCOM
INTEGER BEGIN
INTEGER END
INTEGER PTR ( 2 )
INTEGER OFFSET
INTEGER I
C
C Equivalences
C
EQUIVALENCE ( BEGIN, PTR(1) )
EQUIVALENCE ( END, PTR(2) )
C
C Standard error handling.
C
IF ( RETURN() ) THEN
RETURN
ELSE
CALL CHKIN ( 'LBREM_1' )
END IF
C
C We touch the input buffer so that compilers will not complain
C that BUFFER is an unused argument. It really is unused, but
C it's in the calling sequence for the sake of uniformity of
C the calling sequences for the line buffer routines.
C
BUFFER(LBCBUF)(1:1) = TOUCHC ( BUFFER(LBCBUF) )
C
C Recover the essential control information.
C
CALL LBDES_1 ( PTRS, MAXLN, NLINE, NCOM, PCARD )
C
C No way to remove a line that's not in the table.
C
IF ( POS .LT. 1 .OR. POS .GT. NLINE ) THEN
CALL SETMSG ( 'Tried to access line # of #.' )
CALL ERRINT ( '#', POS )
CALL ERRINT ( '#', NLINE )
CALL SIGERR ( 'SPICE(LBNOSUCHLINE)' )
CALL CHKOUT ( 'LBREM_1' )
RETURN
END IF
C
C Save the bounds of the stored line before removing the name
C and pointers from their respective tables.
C
POSPTR = 2 * POS - 1
BEGIN = PTRS(POSPTR )
END = PTRS(POSPTR+1)
NLINE = NLINE - 1
CALL REMLAI ( 2, POSPTR, PTRS(1), PCARD )
C
C Add the interval to the complement. Insert it directly, then
C do any merges required.
C
OFFSET = NLINE * 2
POSCOM = OFFSET + 1
DO I = OFFSET+2, PCARD, 2
IF ( BEGIN .GT. PTRS(I) ) THEN
POSCOM = I + 1
END IF
END DO
CALL INSLAI ( PTR, 2, POSCOM, PTRS(1), PCARD )
DO I = PCARD-2, OFFSET+2, -2
IF ( PTRS(I+1) .EQ. PTRS(I) + 1 ) THEN
CALL REMLAI ( 2, I, PTRS(1), PCARD )
END IF
END DO
NCOM = ( PCARD / 2 ) - NLINE
CALL LBUPD_1 ( NLINE, NCOM, PTRS )
CALL CHKOUT ( 'LBREM_1' )
RETURN
END
|
Debats du Senat (hansard)
1ere Session, 36 e Legislature,
Volume 137, Numero 126
Le mardi 13 avril 1999
L'honorable Gildas L. Molgat, President
Le deces de l'honorable Paul David
Les travaux du Senat
Le deces de l'honorable Paul David
Le Kosovo-Les problemes de la guerre
La commemoration de l'holocauste
La conference internationale sur les enfants et le tabac
Le rapport du Royaume-Uni-Le racisme d'agents de police
Le systeme canadien de soins de sante
L'Organisation du traite de l'Atlantique Nord
L'intervention en Yougoslavie-Le rapport avec le droit international-Avis d'interpellation
Les efforts diplomatiques entourant les evenements dans l'ex-Yougoslavie-Demande de renseignements
Les forces de l'OTAN dans l'ex-Yougoslavie-La situation critique des Kosovars
Depot des reponses a des questions inscrites au Feuilleton
La defense nationale-Le budget du Commandement des forces terrestres-Le deficit
Projet de loi sur la gestion des terres des Premieres nations
Rapport du comite-Ajournement du debat
Projet de loi modificatif-Deuxieme lecture-Ajournement du debat
Projet de loi sur la reconnaissance des services de guerre de la marine marchande
Deuxieme lecture-Report du debat
L'examen des politiques sur les armes nucleaires
Les travaux du senat
L'expose du ministre des Finances-Interpellation-Suite du debat
Le mardi 13 avril 1999
La seance est ouverte a 14 heures, le President, etant au fauteuil.
Le deces de l'honorable Paul David
L'honorable John Lynch-Staunton (chef de l'opposition) :
Les travaux du Senat
Son Honneur le President :
Si vous n'y voyez pas d'inconvenient, nous pourrions attendre encore cinq minutes.
Son Honneur le President :
La delegation est conduite par M. Vladimir A. Torlopov.
Au nom de tous les honorables senateurs, je vous souhaite la bienvenue au Senat.
Le deces de l'honorable Paul David
L'honorable John Lynch-Staunton (chef de l'opposition) :
La semaine derniere, le Senat perdait un de ses illustres membres.
Le 5 avril 1999 s'eteignait le pere de la cardiologie quebecoise.
Avec la disparition du docteur David, le Quebec et le Canada perdaient un grand homme.
Son travail acharne et sa renommee internationale lui vaudront une multitude de distinctions.
J'aimerais vous citer les paroles emouvantes de sa fille Therese lors des funerailles:
Ta plus grande victoire, c'est d'avoir surmonte les difficultes des sept dernieres annees.
J'ai decouvert un nouvel homme.
A son epouse, le docteur Lemire, et a ses enfants, j'offre mes respectueuses condoleances.
Honorables senateurs, je desire rendre hommage a un homme remarquable, l'honorable Paul David.
L.O. David avait ecrit une biographie de Laurier et l'histoire des patriotes.
Nous lui devons, entre autres, le celebre prix David.
C'est sa plus grande realisation.
Il commenca une carriere politique a l'age de 65 ans.
L'honorable Therese Lavoie-Roux :
On ne le voyait jamais s'enferrer dans des discussions partisanes.
Il etait au service des autres, et non au service d'un parti politique.
Ce fonds de recherche analyse toutes les demandes pour les subventions de recherche.
Il est fort connu et tres important au Quebec.
L'honorable Wilbert J. Keon :
Imaginez le courage dont il a du faire preuve.
Le docteur David avait vraiment une bonne longueur d'avance sur son epoque.
Le docteur David etait cependant une personnalite unique en son genre.
Le docteur David a touche tant de gens et de tant de facons!
Il m'a touche d'une maniere tangible que je garderai en memoire a jamais.
M. Mulroney a nomme Paul David au Senat en 1985.
Les donneurs a cette epoque etaient rares.
Le docteur David donnait des explications simples que tout le monde comprenait.
Il expliquait par exemple ce qu'etait une operation du c9ur.
Tout le monde en avait peur, personne ne voulait y aller.
Sa presence, son image et son calme rassuraient les gens.
Son depart nous chagrine tous profondement.
Honneur a ce grand disparu.
Le Kosovo-Les problemes de la guerre
L'honorable Nicholas W. Taylor :
J'ai souleve cette question le 25 mars.
Malheureusement, ni l'OTAN ni le president americain ne nous ont ecoutes.
J'ai parle du caractere insense du projet de bombardement a l'epoque.
C'est aussi une erreur sur le plan militaire.
Il n'y a que des montagnes et rien d'autre.
M. Tito m'avait engage pour dresser un leve geologique.
Voila le type de pays auquel nos soldats auront affaire.
Enfin, c'est moralement injustifie.
La fin ne justifie pas les moyens.
La commemoration de l'holocauste
L'honorable Jerahmiel S. Grafstein :
Quelle est la meilleure facon de commemorer l'Holocauste?
C'est mon oncle qui l'a presente a ma mere.
Il s'est egalement etabli a Toronto.
Au cours de cette visite, un apres-midi, je...
Son Honneur le President :
Honorables senateurs, le senateur a-t-il la permission de continuer?
La bibliotheque occupait deux des quatre cotes de cette magnifique place.
Le cimetiere juif a completement disparu.
Nous voyons, honorables senateurs, que l'Holocauste est beaucoup plus qu'un mot.
La cruaute selective et episodique de l'homme envers l'homme se poursuit toujours.
La conference internationale sur les enfants et le tabac
Durant cette periode de deux jours et demi, nous avons eu 22 heures de reunions.
Soixante delegues de quelque 31 pays ont participe a cette conference.
Le rapport du Royaume-Uni-Le racisme d'agents de police
L'honorable Donald H. Oliver :
J'ai eu l'occasion d'en faire la lecture pendant le conge de Paques.
Le rapport recommandait que:
Selon moi, pareille definition est une etape importante dans la gestion des relations raciales.
Le racisme doit etre defini par ceux qui en sont victimes.
L'honorable Sharon Carstairs (leader adjoint du gouvernement) :
Son Honneur le President :
Est-ce d'accord, honorables senateurs?
L'honorable J. Michael Forrestall :
Honorables senateurs, je donne avis que, le mercredi 14 avril 1999, je proposerai:
L'honorable James F. Kelleher :
Honorables senateurs, je donne avis que demain, le mercredi 14 avril 1999, je proposerai:
Le systeme canadien de soins de sante
L'honorable Wilbert J. Keon :
L'Organisation du traite de l'Atlantique Nord
L'intervention en Yougoslavie-Le rapport avec le droit international-Avis d'interpellation
L'honorable Jerahmiel S. Grafstein :
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
Honorables senateurs, ma question s'adresse au leader du gouvernement au Senat.
L'honorable B. Alasdair Graham (leader du gouvernement) :
Le ministre pourrait-il donner quelques details plus precis au Senat?
Il est rentre au Canada aujourd'hui.
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
L'honorable B. Alasdair Graham (leader du gouvernement) :
Je crois avoir deja dit que je faisais confiance au Conseil de securite.
Ce droit de veto n'est pas nouveau.
Les efforts diplomatiques entourant les evenements dans l'ex-Yougoslavie-Demande de renseignements
L'honorable A. Raynell Andreychuk :
L'honorable B. Alasdair Graham (leader du gouvernement) :
Le Canada continue de consulter la Russie, l'Ukraine et d'autres pays.
L'honorable Gerry St. Germain :
Honorables senateurs, ma question s'adresse aussi au leader du gouvernement au Senat.
Nous n'avons toujours pas recu de reponse a cette question.
L'honorable B. Alasdair Graham (leader du gouvernement) :
Fondamentalement, c'etait trop tard.
Or, cet accord est bel et bien mort.
Le Canada en a-t-il pris note?
L'honorable B. Alasdair Graham (leader du gouvernement) :
Oui, il l'a fait, honorables senateurs.
Les souffrances endurees par des civils innocents ne doivent pas etre prolongees.
- enfin, permettre a la communaute internationale de verifier que ces engagements sont respectes.
Il n'a pas dit que le Canada pronait cette solution.
Honorables senateurs, le secretaire general continue d'avoir l'appui non equivoque du Canada.
L'honorable J. Michael Forrestall :
Honorables senateurs, ma question s'adresse au leader du gouvernement au Senat.
... nous n'avons pas defini ce qui constituerait une victoire ni etabli d'objectifs concrets.
L'honorable B. Alasdair Graham (leader du gouvernement) :
Tout a ete detruit!
Ils seront tous morts!
Songez a ce qui se serait produit si nous n'etions pas intervenus.
Nous esperons que les bombardements prendront fin sous peu.
Une fois que vous aurez tout detruit.
La voie diplomatique a echoue a Rambouillet et une intervention s'imposait.
L'OTAN, dont le Canada est membre, a reagi de maniere responsable.
A mon avis, personne n'est en desaccord avec cela.
Sommes-nous prets a envoyer une force expeditionnaire bien entrainee?
C'est une longue serie de questions.
Je crois avoir deja repondu plus tot a certaines d'entre elles.
Je ne sais pas quelle serait la-bas la filiere de commandement.
La question n'etait pourtant pas compliquee.
J'ai demande quelles troupes pretes au combat pouvons-nous envoyer?
Neanmoins, je vais tenter de trouver cette reponse pour le senateur Forrestall.
Les forces de l'OTAN dans l'ex-Yougoslavie-La situation critique des Kosovars
L'honorable Gerry St. Germain :
Voila ce que je voudrais savoir et ce qui me preoccupe.
Je ne recherche pas l'affrontement.
Personne au monde n'a leve le petit doigt pour mettre fin a cette boucherie.
L'honorable Alasdair B. Graham (leader du gouvernement) :
Le Canada est un des cinq pays qui participent aux frappes aeriennes strategiques.
L'honorable James F. Kelleher :
Honorables senateurs, ma question s'adresse au leader du gouvernement au Senat.
Trop lent, trop lourd, trop complexe et inefficace.
Plus de deux ans plus tard, rien n'a ete fait pour regler ce probleme.
L'honorable B. Alasdair Graham (leader du gouvernement) :
Je serai tres heureux de le faire.
Je sais que c'est un sujet sur lequel le senateur Kelleher revient tres souvent.
En tant qu'ancien ministre du Commerce, il porte un interet special a cette question.
Si je me trompe, qu'on me le dise.
Nous esperons que les deux provinces parviendront rapidement a un accord bilateral.
Honorables senateurs, le senateur n'est pas aussi bien informe que je ne le croyais.
Vous ne seriez pas le premier a le penser.
Ne blamez pas Ottawa, honorables senateurs.
Demandez plutot aux provinces pourquoi elles n'ont pas invoque ces dispositions.
Il ne fonctionne pas.
C'est pourquoi le gouvernement de l'Ontario est tellement frustre.
C'est pourquoi il a agi de lui-meme.
Honorables senateurs, j'attirerai encore une fois l'attention de mes collegues la-dessus.
Notre objectif est d'eliminer toutes les barrieres pour encourager le marche libre au Canada.
Depot des reponses a des questions inscrites au Feuilleton
La defense nationale-Le budget du Commandement des forces terrestres-Le deficit
Projet de loi sur la gestion des terres des Premieres nations
L'honorable Gerry St. Germain :
Cinq de ces groupes se trouvent dans ma province, la Colombie-Britannique.
Honorables senateurs, je siege au comite senatorial permanent des peuples autochtones.
A titre de parlementaires, nous nous trouvons tres souvent dans une situation impossible.
Il arrive d'ailleurs malheureusement que les accusations soient plus acerbes encore.
Que devrons-nous en faire?
Nous examinons la question en detail de ce temps-ci.
Dans la majorite des cas, elle y a ete forcee.
Selon les tribunaux, il s'agit d'un droit protege par la Constitution.
La Cour supreme a ordonne la tenue d'un nouveau proces.
Soyons realistes, nous sommes tous ici pour y rester.
Quelle est la position du Parlement a cet egard?
Toutefois, en tant que parlementaire, je n'ai rien a dire.
Ce sont les tribunaux qui decident.
Je ne cherche pas a denigrer les tribunaux.
Je ne peux pas etre moins partisan qu'en citant un ancien premier ministre liberal.
On n'y fait aucune mention de la bande indienne de Musqueam.
Les impots fonciers etaient verses a la ville de Vancouver.
Le gouvernement federal doit le faire.
Madame la ministre dit que les codes fonciers doivent recevoir son approbation.
Le verificateur est independant du gouvernement du Canada et de la Premiere nation.
Ce n'est peut-etre pas une mauvaise chose.
Nous nous eloignons peut-etre du MAINC, du ministre et de toute la bureaucratie.
C'est peut-etre un pas dans la bonne direction.
Le paragraphe 28(1) du projet deloi C-49 precise que:
On ne sait trop ce que les fins d'interet collectif peuvent englober.
Le ministre n'exerce aucun role de surveillance a ce chapitre.
Ne les decevons donc pas.
Je sais qu'on est souvent force de voter d'une certaine facon.
A un certain moment, j'etais president d'un caucus de 211 deputes.
Je sais exactement ce qui se passe.
Non, je ne nommerai pas de noms.
J'ai dit que je serais impartial, alors je ne nommerai pas de noms.
Faisons ce qui est bon pour tous les Canadiens.
J'ai recu des tonnes de lettres.
J'en ai quelques-unes ici.
Son Honneur le President :
Votre Honneur, mettez-vous en doute la valeur d'un discours aussi excellent?
Puis-je continuer, monsieur?
Son Honneur le President :
J'ai parle aux gens d'un bout a l'autre de ma province.
Puis, il m'a demande si sa reponse me scandalisait.
Honorables senateurs, la volonte est la, il nous suffit de proceder intelligemment.
Le premier ministre Clark se donne les coudees franches avec cet accord.
Ils veulent bien appuyer la mesure.
Ils ont le coeur au bon endroit.
Si l'un d'eux avait reussi, je ne me tiendrais pas ici aujourd'hui.
Ou de nourrir vos poules.
Le senateur St. Germain : ... ou de nourrir mes poules.
Honorables senateurs, nous devons participer au debat sur le projet de loi C-49.
Son Honneur le President :
Vous plait-il d'adopter la motion?
(La motion est adoptee et le projet de loi est lu une deuxieme fois.)
Son Honneur le President :
Honorables senateurs, quand ce projet de loi sera-t-il lu une troisieme fois?
Rapport du comite-Ajournement du debat
L'honorable John B. Stewart :
Honorables senateurs, je propose que le rapport soit adopte.
Son Honneur le President :
Vous plait-il, honorables senateurs, d'adopter la motion?
Souhaitez-vous prendre la parole, senateur Stewart?
Nous ferons de notre mieux.
L'honorable A. Raynell Andreychuk :
A mon avis, nous ne devrions pas prendre cette mesure a la legere.
Le comite a fait un excellent travail.
Nous avons propose un certain nombre d'amendements.
Dans l'ensemble, je les accepte.
En outre, le Canada servira-t-il de point de transit?
Je vois donc qu'il existe certaines difficultes techniques qu'il faudra regler.
C'est peut-etre vrai.
Il se peut qu'on mette sur pied un projet pilote a Anchorage, en Alaska.
A mon avis, un amendement a ameliore le projet de loi.
Ces cas ont ete regles de facon officieuse.
Honorables senateurs, je voudrais poser une question a madame le senateur.
Elle a parle d'une situation ou un voyageur se presente au precontrole.
Le paragraphe 10(1) du projet de loi prescrit:
Le senateur Stewart a raison.
Les amendements donnent plus de souplesse.
Il reste a voir quelles seront les modalites de mise en oeuvre.
Les sanctions ont ete allegees.
Cette partie a donc ete rectifiee.
Nous sommes a des annees-lumiere de ce qui existait auparavant.
A mon avis, nous etions entierement a la merci du systeme americain.
Nous disons maintenant que ce doit etre la reponse.
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
Honorables senateurs, j'ai une question pour ma collegue, madame le senateur Andreychuk.
Ce qu'il faut determiner, c'est quelle part est legitime.
Les Americains doivent-ils adopter une mesure legislative similaire a celle-ci?
Il n'y a pas assez de voyageurs qui passent par les Etats-Unis.
Je voudrais poser une question complementaire pour obtenir davantage d'information.
Son Honneur le President :
Honorables senateurs, nous avons depasse de beaucoup le temps reserve a la periode des questions.
Acceptez-vous de prolonger davantage cette periode?
La meme chose est vrai de la cote Est.
Cela est aussi vrai pour l'Europe que pour l'Asie.
Je crois qu'il y a la un avantage evident.
Je ne peux donc pas accepter vos remarques a ce sujet.
C'est certes pratique.
Ce sera desormais la loi.
Le projet de loi dont nous sommes saisis vise a nous accorder cette possibilite.
(Sur la motion du senateur Kinsella, le debat est ajourne.)
Projet de loi modificatif-Deuxieme lecture-Ajournement du debat
(Sur la motion du senateur Carstairs, le debat est ajourne.)
Projet de loi sur la reconnaissance des services de guerre de la marine marchande
Deuxieme lecture-Report du debat
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
Demain, ce sera le quatorzieme jour que cette question est reportee.
L'honorable Sharon Carstairs (leader adjoint du gouvernement) :
L'examen des politiques sur les armes nucleaires
Permission ayant ete accordee de revenir a l'article no 128:
Honorables senateurs, j'invoque le Reglement.
Comme cette motion est inscrite a mon nom, la question m'interesse.
Son Honneur le President :
Je croyais avoir entendu le mot reporte quand cet ordre a ete appele.
La question a ete reportee et ne peut etre debattue.
Son Honneur le President :
Je me trouve dans une drole de position parce que le debat a ete reporte.
Toutefois, si le Senat souhaite revenir a cette question, cela pourrait etre envisage.
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
Le debat de la question pourra ensuite etre ajourne au nom d'un autre senateur.
Bien entendu, le gouvernement est represente par le Cabinet.
Honorables senateurs, nous avons recemment adopte une autre motion concernant l'OTAN.
Les travaux du senat
L'honorable B. Alasdair Graham (leader du gouvernement) :
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
Son Honneur le President :
L'expose du ministre des Finances-Interpellation-Suite du debat
L'honorable B. Alasdair Graham (leader du gouvernement) :
Oui, grace au libre-echange!
Voyons la dette du marche.
La dette a bondi de 208 a 508 milliards de dollars.
Honorables senateurs, il est aussi question d'un allegement fiscal equitable.
Les mesures que propose ce budget se renforcent mutuellement.
(Sur la motion du senateur Kinsella, au nom du senateur LeBreton, le debat est ajourne.)
L'honorable Noel A. Kinsella (chef adjoint de l'opposition) :
(Sur la motion du senateur Kinsella, au nom du senateur Eyton, le debat est ajourne.)
(Le Senat s'ajourne au mercredi 14 avril 1999, a 13 h 30.)
|
C------ INTERNAL BOUNDARY HANDLING FOR EXPLICIT ROUTING ------------
C FOR A DAM OR BRIDGE BETWEEN L AND L+1, REDEFINEING
C QU(L,J),QU(L+1,J),YU(L,J),YU(L+1,J)
C-----------------------------------------------------------------------
SUBROUTINE EXIN55(PO,CO,Z,ST1,LTST1,T1,LTT1,POLH,LTPOLH,ITWT,
. LTITWT,J,L,TE,DTE,INTYP,YU,YD,QU,QD,DDX,NCML,K1,K2,K7,K8,K9,K15,
. K16,K19,K20,K21,TFH,HFDD,NFAILD,QBRCH,QOVTP,QOTHR,QDI,YDI)
COMMON/SS55/ NCS,A,B,DB,R,DR,AT,BT,P,DP,ZH
COMMON/M155/NU,JN,JJ,KIT,G,DT,TT,TIMF,F1
COMMON/M3455/KXP,ICD,ITMAX,KWARM
INCLUDE 'common/fdbug'
INCLUDE 'common/ofs55'
DIMENSION PO(*),Z(*),ST1(*),LTST1(*),T1(*),LTT1(*),POLH(*)
DIMENSION LTPOLH(*),ITWT(*),LTITWT(*),YU(K2,K1)
DIMENSION YD(K2,K1),QU(K2,K1),QD(K2,K1),DDX(K2,K1)
DIMENSION TFH(K16,K1),HFDD(K16,K1),NFAILD(K16,K1),QBRCH(K16,K1)
DIMENSION QOVTP(K16,K1),QOTHR(K16,K1),QDI(K2,K1),YDI(K2,K1)
CHARACTER*8 SNAME
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcst_fldwav/RCS/exin55.f,v $
. $', '
.$Id: exin55.f,v 1.3 2000/12/19 15:49:16 dws Exp $
. $' /
C ===================================================================
C
DATA SNAME/ 'EXIN55 ' /
C
CALL FPRBUG(SNAME,1,55,IBUG)
CALL IDDB55(L,J,PO(LONLAD),PO(LOLAD),KL,K1,K16)
CC IF ((YD(L,J)+0.0001).GE.HFDD(KL,J)) NFAILD(KL,J)=3
CC IF (KIT.LE.(KWARM+1)) NFAILD(KL,J)=1
TF=ABS(TFH(KL,J))
MF=NFAILD(KL,J)
IF ((YD(L,J)+0.0001).GE.HFDD(KL,J)) NFAILD(KL,J)=3
IF (KIT.LE.(KWARM+1)) THEN
NFAILD(KL,J)=1
Q2=QBRCH(KL,J)+QOVTP(KL,J)+QOTHR(KL,J)
QU(L,J)=QDI(L,J)
QU(L+1,J)=QDI(L+1,J)
YU(L,J)=YDI(L,J)
YU(L+1,J)=YDI(L+1,J)
GOTO 998
ENDIF
IF(TF.LE.0.0000001.AND.MF.EQ.3) THEN
QBRCH(KL,J)=0.0
QOVTP(KL,J)=0.0
QOTHR(KL,J)=0.0
GOTO 999
ENDIF
TTEMP=TT
TT=TE
DY=0.1
C------------------ UPSTREAM SECTION L -------------------------------
DTX=DTE/DDX(L-1,J)
L1=L-1
Y=YD(L-1,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AD1=AT
L1=L
Y=YD(L,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AD2=AT
L1=L-1
Y=YU(L-1,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AU1=AT
Y=YD(L,J)
Y1=Y-DY
Y2=Y+DY
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L,Y1,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
A1=AT
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L,Y2,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
A2=AT
QQ=QD(L,J)
IFL=0
ITRS=0
II=2*L
II2=2*L+1
L1=2
L2=1
L3=4
L4=4
YU(L+1,J)=YD(L+1,J)
C DAM
IF (INTYP.EQ.1) THEN
YU(L,J)=Y1
QU(L,J)=QD(L,J)
NCALL=0
1111 CALL DAM55(PO,CO,Z,ST1,LTST1,T1,LTT1,POLH,LTPOLH,ITWT,LTITWT,
. Z(LZD),Z(LZC),Z(LZQU),Z(LZQD),Z(LZYU),Z(LZYD),PO(LOHDD),
. PO(LOHSPD),PO(LOHGTD),PO(LOCSD),PO(LOCGD),PO(LOZBCH),PO(LOCDOD),
. PO(LCNFLD),Z(LZBBP),Z(LZYBP),Z(LZSQS1),Z(LZSQS2),Z(LZSQO),
. Z(LZQBCH),Z(LZQOTP),Z(LZQOTR),PO(LOKRCH),PO(LOQGH),PO(LOCLL),
. PO(LOSPL),PO(LORHI),PO(LORQI),PO(LOTIQH),QDI,QN,DQNYU,DT,IFL,
. ITRS,II,II2,L1,L2,L3,L4,ITQ,L,J,K1,K2,K7,K8,K9,K15,K16,K19,
. K20,K21)
NCALL=NCALL+1
IF (NCALL.EQ.1) THEN
Q1=QN
YU(L,J)=Y2
GOTO 1111
ENDIF
Q2=QN
C BRIDGE
ELSE
DH=YD(L,J)-YD(L+1,J)
YUL=Y1
YUR=YUL-DH
YDR=YD(L+1,J)
NCALL=0
2222 CALL BRIDGE55(PO,Z,NCML,PO(LONQCM),L,J,II,II2,L1,L2,L3,L4,YUL,YUR,
. YDR,PO(LCDDX),PO(LOEBE1),PO(LOEBE2),PO(LOBRGW),PO(LOCDBR),Z(LZD),
. Z(LZC),Z(LZQU),PO(LCNFLD),Z(LZBBP),Z(LZYBP),Z(LZSQW),Z(LZSQS1),
. Z(LZSQO),Z(LZQBCH),Z(LZQOTP),Z(LZQOTR),PO(LOHS),QTS,TT,QQ,
. PO(LOZBCH),PO(LCTOPN),PO(LOEBW2),PO(LOEBW1),K1,K2,K7,K8,K9,K15,
. K16)
NCALL=NCALL+1
IF (NCALL.EQ.1) THEN
Q1=QTS
YUL=Y2
YUR=YUL-DH
GOTO 2222
ENDIF
Q2=QTS
ENDIF
AK=(Q2-Q1)/(A2-A1)
AB=0.5*(-AK*(A1+A2)+(Q1+Q2))
AC=1.0+DTX*AK
AU2=(AD1+AD2-AU1+DTX*(QD(L-1,J)+QU(L-1,J)-QD(L,J)-AB))/AC
QU(L,J)=AK*AU2+AB
CALL EXAH55(J,NCS,L,AU2,HL,PO(LOHS),PO(LOBS),PO(LOBSS),PO(LOAS),
$ PO(LOASS),K1,K2,K9)
YU(L,J)=HL
C------------------ DOWNSTREAM SECTION L+1 ---------------------------
100 QU(L+1,J)=QU(L,J)
DTX=DTE/DDX(L+1,J)
L1=L+1
Y=YD(L+1,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AD1=AT
L1=L+2
Y=YD(L+2,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AD2=AT
L1=L+2
Y=YU(L+2,J)
CALL SECT55(PO(LCPR),PO(LOAS),PO(LOBS),PO(LOHS),PO(LOASS),
$ PO(LOBSS),J,L1,Y,PO(LCHCAV),PO(LCIFCV),K1,K2,K9)
AU2=AT
AU1=AD1+AD2-AU2+DTX*(QD(L+1,J)+QU(L+1,J)-QD(L+2,J)-QU(L+2,J))
CALL EXAH55(J,NCS,L+1,AU1,HL,PO(LOHS),PO(LOBS),PO(LOBSS),PO(LOAS),
$ PO(LOASS),K1,K2,K9)
YU(L+1,J)=HL
C-----------------------------------------------------------------------
998 IF (ABS(Q2).LE.1.0) GOTO 999
QFACT=QU(L,J)/Q2
QBRCH(KL,J)=QFACT*QBRCH(KL,J)
QOVTP(KL,J)=QFACT*QOVTP(KL,J)
QOTHR(KL,J)=QFACT*QOTHR(KL,J)
TT=TTEMP
999 RETURN
END
|
SUBROUTINE CREATE (GPLST,X,U,DEFORM,CONMIN,CONMAX,ELMTID,STORE,
1 LCOR,B1,B2)
C
INTEGER GPLST(1),DEFORM,LAYER,IDUMMY(2),EST,PRNT,SCR1,
1 OES1,STRESS,B1,B2,WHERE,DIRECT,SUB,ESTSYM(7),
2 SKIPWD(20),ELID,ESYM,GPTS(12),ELMTID(100),
3 MSG1(20),ERR(2),OFFSET
REAL X(3,1),U(2,1),STORE(202)
DIMENSION ISYM(14),ITYPE(14),PT(2,5),THIRD(2),C(2,4),
1 CENTRD(2)
COMMON /BLANK / SKIP(12),EST,SKIP1(7),PRNT,SKI(2),OES1,SCR1,SCR2,
1 NEW
COMMON /XXPARM/ SKIP4(157),NCNTR,CNTR(50),ICNTVL,WHERE,DIRECT,SUB,
1 FLAG,VALUE,SKP20(20),LAYER
EQUIVALENCE (NEW,NEWOES), (KQ4,ISYM(13)), (KT3,ISYM(14))
DATA NTYPES / 14 /
DATA ISYM / 2HSH,2HT1,2HTB,2HTP,2HTM,2HQP,2HQM,2HT2,2HQ2,2HQ1,
1 2HM1,2HM2,2HQ4,2HT3/, KBAR/2HBR/
DATA ITYPE / 4, 6, 7, 8, 9, 15, 16, 17, 18, 19, 62, 63, 64, 83/
DATA ESTSYM / 7*0 /
DATA SKIPWD /-5,-6,-7,-1,-2,-3,-4,-5,-6,4*0,0,-1,-2,-5,-6,-7,0 /
DATA NMSG1 , MSG1/20,4H(48H,4H NO ,4HSTRE,4HSS C,4HALCU,4HLATI,
1 4HON F , 4HOUND,4H FOR,4H ELE,4HMENT,4H NUM,4HBER ,4H,I8,,
2 4H19H , 4H- EL,4HEMEN,4HT IG,4HNORE,4HD.) /
C
TWOPI = 8.0*ATAN(1.0)
IRDEST = 0
CALL GOPEN (SCR1,GPLST(B1),1)
STRESS = OES1
IF ((ICNTVL.GE.4 .AND. ICNTVL.LE.9) .AND. DIRECT.EQ.2)
1 STRESS = NEWOES
IF (STRESS.EQ.OES1 .AND. (ICNTVL.EQ.6 .OR. ICNTVL.EQ.8 .OR.
1 ICNTVL.EQ.9)) GO TO 130
IF (STRESS .EQ. OES1) SKIPWD(7) = -3
CALL OPEN (*130,STRESS,GPLST(B2),0)
CONMIN = 0.0
CONMAX = 0.0
IEOR = 0
C
C CREATE A LIST OF ELEMENTS TYPES TO BE PLOTTED IN THIS SET
C
JTJ = 1
K = 1
KEST = 0
CALL READ (*135,*135,EST,ESYM,1,0,M)
IF (ICNTVL .EQ. 20) GO TO 7
C
C ELIMINATE ALL BUT MAXSHEAR FOR CSHEAR ELEMENT
C
3 IF (ESYM.EQ.ISYM(1) .AND. ICNTVL.NE.3) GO TO 7
C
C ELIMINATE MID STRESS FOR TRIA1, QUAD1, TRPLT, OR QDPLT
C
IF ((ESYM.EQ.ISYM(2) .OR. ESYM.EQ.ISYM(10) .OR. ESYM.EQ.ISYM(4)
1 .OR. ESYM.EQ.ISYM(6)) .AND. WHERE.EQ.3) GO TO 7
C
C ELIMINATE Z2 AND AVER STRESS FOR CTRMEM, CQDMEM, MEM1, MEM2
C
IF ((ESYM.EQ.ISYM(5) .OR. ESYM.EQ.ISYM(7) .OR. ESYM.EQ.ISYM(11)
1 .OR. ESYM.EQ.ISYM(12)) .AND. (WHERE.EQ.-1 .OR. WHERE.EQ.3))
2 GO TO 7
C
C ELIMINATE Z1, Z2 AND MAX FOR TRIA2 OR TRBSC ELEMENTS
C
IF ((ESYM.EQ.ISYM(8) .OR. ESYM.EQ.ISYM(3)) .AND.
1 (IABS(WHERE).EQ.1 .OR. WHERE.EQ.2)) GO TO 7
DO 5 I = 1,NTYPES
IF (ESYM .EQ. ISYM(I)) GO TO 6
5 CONTINUE
GO TO 7
6 ESTSYM(K) = I
K = K + 1
7 CALL FREAD (EST,NGPPE,1,0)
C
8 OFFSET = 0
IF (ESYM .EQ. KBAR) OFFSET = 6
IF (ESYM.EQ.KT3 .OR. ESYM.EQ.KQ4) OFFSET = 1
C
C FLUSH TO NEXT SYMBOL
C
9 CALL FREAD (EST,ELID,1,0)
IF (ELID .EQ. 0) GO TO (11,25), JTJ
J = 1 + NGPPE + OFFSET
CALL FREAD (EST,0,-J,0)
GO TO 9
C
C READ NEXT SYMBOL
C
11 CALL READ (*12,*12,EST,ESYM,1,0,M)
GO TO 3
C
C LOOP BACK UNTIL ALL EST SYMBOLS ARE IN CORE
C
12 K = K - 1
CALL BCKREC (EST)
JTJ = 2
C
C NOTE THAT THE ASSUMPTION THAT STRESS AND EST FILES ARE ORDERED IN
C THE SAME WAY IS NO LONGER NECESSARY
C
15 IF (IEOR .EQ. 0) CALL FWDREC (*125,STRESS)
IF (ICNTVL .NE. 20) GO TO 20
CALL FWDREC (*125,STRESS)
GO TO 25
20 CALL READ (*125,*120,STRESS,IDUMMY,2,0,M)
CALL FREAD (STRESS,IELTYP,1,0)
CALL FREAD (STRESS,ISUB,1,0)
CALL FREAD (STRESS,DETAIL,1,0)
CALL FREAD (STRESS,EIGEN,1,0)
EIGEN = SQRT(ABS(EIGEN))/TWOPI
CALL FREAD (STRESS,0,-3,0)
CALL FREAD (STRESS,NWDS,1,1)
IF (SUB.GT.0 .AND. ISUB.NE.SUB) GO TO 50
IF (FLAG.EQ.1.0 .AND. DETAIL.NE.VALUE) GO TO 50
IF (FLAG.EQ.2.0 .AND. ABS(EIGEN-VALUE).GT.1.0E-5) GO TO 50
IEOR = 0
DO 22 I = 1,K
J = ESTSYM(I)
IF (J .EQ. 0) GO TO 22
IF (IELTYP .EQ. ITYPE(J)) GO TO 25
22 CONTINUE
GO TO 50
C
C YES, WE DO WANT THIS ELEMENT TYPES STRESS DATA. FIND THIS TYPES
C ELEMENTS IN THE EST
C
25 CALL READ (*905,*905,EST,ESYM,1,0,M)
IRDEST = 1
CALL FREAD (EST,NGPPE,1,0)
IF (ICNTVL.EQ.20 .OR. ESYM.EQ.ISYM(J)) GO TO 27
C
C FLUSH THE FILE UNTIL FOUND
C
GO TO 8
C
27 CALL WRITE (SCR1,ESYM,1,0)
KEST = KEST + 1
MEM = 0
IF (IELTYP.EQ.9 .OR. IELTYP.EQ.16 .OR. IELTYP.EQ.15 .OR.
1 IELTYP.EQ.62 .OR. IELTYP.EQ.63) MEM = 1
C TRMEM(9), QDMEM(16), QDPLT(15), QDMEM1(62), QDMEM2(63)
C
IWDS = SKIPWD(ICNTVL)
IF (ICNTVL .GT. 13) GO TO 29
IF (MEM .EQ. 1) IWDS = IWDS + 1
IF (WHERE.EQ.-1 .AND. MEM.NE.1) IWDS = IWDS - 8
NWDS = -NWDS - IWDS + 2
IF (IABS(WHERE).NE.1 .AND. MEM.NE.1) NWDS = NWDS + 8
IF (WHERE.EQ.-1 .AND. MEM.EQ.1) GO TO 50
IF (IELTYP.EQ.4 .AND. ICNTVL.NE.3) GO TO 50
C SHEAR(4)
C
29 IS = 0
C
C READ STRESS FILE
C
30 IS = IS + 1
CALL READ (*58,*58,STRESS,ELMTID(IS),1,0,M)
IF (ICNTVL.LE.9 .OR. ICNTVL.EQ.20) GO TO 35
CALL FREAD (STRESS,NLAYER,1,0)
LAYTOT = NLAYER*11
LAYSKP = -((LAYER-1)*10+2)
CALL FREAD (STRESS,0,LAYSKP,0)
35 IF (IELTYP .NE. 4) GO TO 40
C
C MAXIMUM SHEAR FOR CSHEAR ELEMENT
C
CALL FREAD (STRESS,STORE(IS),1,0)
CALL FREAD (STRESS,0,-2,0)
IF (IS .EQ. LCOR) GO TO 60
GO TO 30
40 CALL FREAD (STRESS,0,IWDS,0)
CALL FREAD (STRESS,STORE(IS),1,0)
IF (ICNTVL.LE.9 .OR. ICNTVL.EQ.20) GO TO 41
NLFIN = -(LAYTOT-1+LAYSKP+IWDS)
CALL FREAD (STRESS,0,NLFIN,0)
GO TO 30
41 IF (ICNTVL .LT. 20) GO TO 42
CALL FREAD (STRESS,0,-1,0)
GO TO 30
42 IF (IABS(WHERE).EQ.1 .OR. MEM.EQ.1) GO TO 45
CALL FREAD (STRESS,0,-7,0)
CALL FREAD (STRESS,CONTUR,1,0)
45 CALL FREAD (STRESS,0,NWDS,0)
IF (MEM.EQ.1 .AND. IS.GE.LCOR) GO TO 60
IF (MEM .EQ. 1) GO TO 30
IF (WHERE .EQ. 2) STORE(IS) = AMAX1(STORE(IS),CONTUR)
IF (WHERE .EQ. 3) STORE(IS) = (STORE(IS)+CONTUR)/2.0
IF (IS .GE. LCOR) GO TO 60
GO TO 30
C
C SKIP THIS TYPE
C
50 CALL FWDREC (*125,STRESS)
GO TO 20
C
C END OF RECORD ON STRESS FILE
C
58 IEOR = 1
IS = IS - 1
C
C STORE STRESS VALUES WITH ELEMENT ID.S
C
60 CALL FREAD (EST,ELID,1,0)
IF (ELID .EQ. 0) GO TO 90
CALL FREAD (EST,0,-1,0)
CALL FREAD (EST,GPTS,NGPPE+OFFSET,0)
C
C THE VERY NEXT LINE WAS ACCIDENTALLY DROPPED IN 88 VERSION
C
IF (ELID .GT. ELMTID(IS)/10) GO TO 100
DO 65 IST = 1,IS
IF (ELID .EQ. ELMTID(IST)/10) GO TO 70
65 CONTINUE
ERR(1) = 1
ERR(2) = ELID
CALL WRTPRT (PRNT,ERR,MSG1,NMSG1)
GO TO 60
C
C FIND ELEMENTS CENTROID
C
70 DO 75 I = 1,NGPPE
IG = GPTS(I)
IG = IABS(GPLST(IG))
IF (DEFORM .NE. 0) GO TO 74
PT(1,I) = X(2,IG)
PT(2,I) = X(3,IG)
GO TO 75
74 PT(1,I) = U(1,IG)
PT(2,I) = U(2,IG)
75 CONTINUE
THIRD(1) = PT(1,3)
THIRD(2) = PT(2,3)
INDEX = 1
PT(1,NGPPE+1) = PT(1,1)
PT(2,NGPPE+1) = PT(2,1)
IF (NGPPE .LT. 4) GO TO 80
INDEX = 4
CALL CENTRE (*90,PT(1,1),PT(2,1),PT(1,2),PT(2,2),PT(1,3),PT(2,3),
1 PT(1,4),PT(2,4),CENTRD)
THIRD(1) = CENTRD(1)
THIRD(2) = CENTRD(2)
80 DO 85 I = 1,INDEX
CALL CENTRE (*90,PT(1,I),PT(2,I),PT(1,I+1),PT(2,I+1),(THIRD(1)+
1 PT(1,I+1))*.5,(THIRD(2)+PT(2,I+1))*.5,
2 (THIRD(1)+PT(1,I))*.5,(THIRD(2)+PT(2,I))*.5,CENTRD)
C(1,I) = CENTRD(1)
C(2,I) = CENTRD(2)
85 CONTINUE
IF (NGPPE .LT. 4) GO TO 90
CALL CENTRE (*90,C(1,1),C(2,1),C(1,2),C(2,2),C(1,3),C(2,3),C(1,4),
1 C(2,4),CENTRD)
90 CALL WRITE (SCR1,ELID,1,0)
IF (ELID .NE. 0) GO TO 91
905 IF (KEST .EQ. K) GO TO 120
CALL BCKREC (EST)
IRDEST = 0
GO TO 15
91 CONTINUE
CALL WRITE (SCR1,STORE(IST),1,0)
CALL WRITE (SCR1,CENTRD,2,0)
IF (CONMIN.NE.0.0 .OR. CONMAX.NE.0.0) GO TO 92
CONMIN = STORE(IST)
CONMAX = CONMIN
GO TO 60
92 CONMIN = AMIN1(CONMIN,STORE(IST))
CONMAX = AMAX1(CONMAX,STORE(IST))
GO TO 60
C
C REFILL STRESS STORAGE AREA
C
100 IS = 0
IF (IEOR .EQ. 0) GO TO 30
ERR(1) = 1
ERR(2) = ELID
CALL WRTPRT (PRNT,ERR,MSG1,NMSG1)
GO TO 60
120 IF (STRESS .EQ. NEWOES) GO TO 126
CALL READ (*125,*125,OES1,0,-3,0,M)
CALL FREAD (OES1,ISUB,1,0)
CALL FREAD (OES1,DETAIL,1,0)
CALL FREAD (OES1,EIGEN,1,1)
EIGEN = SQRT(ABS(EIGEN))/TWOPI
IF (ISUB .NE. SUB) GO TO 125
IF (FLAG.EQ.1.0 .AND. DETAIL.NE.VALUE) GO TO 125
IF (FLAG.EQ.2.0 .AND. ABS(EIGEN-VALUE).GT.1.0E-5) GO TO 125
CALL FWDREC (*125,OES1)
GO TO 120
125 CALL BCKREC (STRESS)
126 CALL CLOSE (STRESS,2)
130 CALL WRITE (SCR1,0,0,1)
CALL CLOSE (SCR1,1)
IF (IRDEST) 140,140,135
135 CALL BCKREC (EST)
140 CONTINUE
RETURN
END
|
C MEMBER EX10
C (from old member FCEX10)
C
SUBROUTINE EX10(PO,QZERO,QIN,QOUT,QT)
C.......................................
C THIS IS THE EXECUTION SUBROUTINE FOR THE ADD/SUB OPERATION.
C MISSING DATA VALUES ARE ALLOWED IN THIS OPERATION.
C WORKING SPACE NEEDED IF TIME INTERVALS OF TIME SERIES ARE NOT
C THE SAME.
C.......................................
C SUBROUTINE INITIALLY WRITTEN BY. . .
C ERIC ANDERSON - HRL OCT. 1979
C.......................................
DIMENSION PO(1),QIN(1),QOUT(1),QT(1)
C
C COMMON BLOCKS.
COMMON/FDBUG/IODBUG,ITRACE,IDBALL,NDEBUG,IDEBUG(20)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcst_ex/RCS/ex10.f,v $
. $', '
.$Id: ex10.f,v 1.1 1995/09/17 18:56:32 dws Exp $
. $' /
C ===================================================================
C
C.......................................
C TRACE LEVEL FOR THIS SUBROUTINE=1.
IF(ITRACE.GE.1) WRITE(IODBUG,900)
900 FORMAT(1H0,15H** EX10 ENTERED)
C.......................................
C GET CONTROL VALUES FROM THE PO ARRAY.
IADD=PO(2)
ICO=PO(11)
IDT=PO(10)
IODT=PO(6)
NEG=PO(12)
C.......................................
C
C CALL THE ADD/SUBTRACT SUBROUTINE.
IADD = IADD-2
CALL FADD(IADD,ICO,NEG,IDT,IODT,QZERO,QIN,QOUT,QT)
IF (ITRACE.GE.1) WRITE(IODBUG,901)
901 FORMAT(1H0,12H** EXIT EX10)
RETURN
END
|
C MEMBER CHECKP
C (from old member FCCHECKP)
C
SUBROUTINE CHECKP(I,L,IER)
C.......................................................................
C
C THIS SUBROUTINE CHECKS TO SEE IF THS NUMBER OF POSITIONS
C REQUESTED IN THE P ARRAY ARE AVAILABLE.
C IF THE POSITIONS ARE NOT AVAILABLE A MESSAGE IS PRINTED,
C SUBROUTINE ERROR IS CALLED, AND AN ERROR FLAG IS RETURNED.
C
C SUBROUTINE CHECKC PERFORMS THE SAME CHECK FOR THE C ARRAY.
C THE ARGUMENT LISTS FOR SUBROUTINE CHECKP AND SUBROUTINE
C CHECKC ARE IDENTICAL.
C.......................................................................
C
C SUBROUTINE ORIGINALLY WRITTEN BY
C GEORGE F. SMITH - HRL OCTOBER 1979 VERSION 1
C.......................................................................
C
C VARIABLES IN ARGUMENT LIST
C
C 1. I - NUMBER OF POSITIONS REQUESTED
C 2. L - NUMBER OF POSITIONS AVAILABLE
C 3. IER - ERROR FLAG
C = 0, NO ERROR
C = 1, ERROR DETECTED
C.......................................................................
C
INCLUDE 'common/ionum'
DIMENSION NAME(2)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcinit_util/RCS/checkp.f,v $
. $', '
.$Id: checkp.f,v 1.2 1999/04/23 17:28:02 page Exp $
. $' /
C ===================================================================
C
DATA NAME/1HP,1HC/
INAM=1
IER=0
IF(I.LE.L)RETURN
WRITE(IPR,900) NAME(INAM),I,L
900 FORMAT(1H0,10X,20H**ERROR** IN ARRAY ,A1/
1 11X,I6,32H POSITIONS WERE REQUESTED, ONLY ,I6,
1 15H ARE AVAILABLE.)
CALL ERROR
IER=1
RETURN
END
|
* Copyright (c) Colorado School of Mines, 2010.
* All rights reserved.
* Copyright (c) Colorado School of Mines, 2010.
* All rights reserved.
ccccccccc
c CSHOT2 builds traces given the ray data calculated by CSHOT1.
c There are 2 modes of operation:
c (1) Generate shot gathers
c (2) Generate receiver gathers
c For case (1), you specify the record numbers of the shots to build.
c Also, the traces to generate within each shot are given. You can
c create a common offset data set by choosing to build only 1 trace/shot
c and by being careful with the geometry cards in CSHOT1 (ie, you have to make
c sure that the trace in question is the same distance from the shot in all
c records).
c In case (2) you specify a range of shot records to search for the common
c receiver data. You also specify the range of receivers for which gathers
c are to be built.
ccccccccc
cc Variable List:
c AMP Wavelet is caled by this amplitude factor (calculated
c by CSHOT1)
c CAUSTC TRUE if the ray has passed through a caustic (wavelet
c will be phase shifted)
c DATIN Unit number of input data (generated by CSHOT1)
c DATOUT Unit number of output data (traces)
c DELTAT Sample rate used in calculating wavelet
c EOF TRUE if the end of file of the input data has been reached
c FLL,FHL,FLR,FHR Amplitude spectrum of wavelet
c FNYQ Nyquist frequency
c FUDGE Constant scale factor applied to all amplitudes
c HEAD TRUE if this is a head wave event
c I Counter
c IBACK Number of records to backspace in input data file to get
c back to start of current shot (used when paneling the output)
c IDUMMY Dummy integer variable
c INFIL Name of the input data file (created by CSHOT1)
c IRECD Record number
c IRECD1 First (shot) record in sort
c IRECDN Last (shot) record in sort
c IRECV Station number of the receiver
c IRPREV Previous record number
c IROUT Loop variable over receiver sorts
c IROUT1 First receiver sort to output
c IROUTN Last receiver sort to output
c ITR1 First trace to build
c ITRN Last trace to build
c ISOUT Current output record number
c ITRACE Trace number
c ITRMAX Maximum trace to output in this panel of the shot record
c ITRMIN Minimum trace to output in this panel of the shot record
c J,K,L Counters
c JOB Job descriptor (s, r, or o)
c KEY Either the recievr number or the trace number, depending
c on the sort option
c MAXTPT MAximum number of samples/trace
c MAXTR Maximum number of traces/panel - for shot records
c MAXWAV MAximum number of samples in the wavelet (at input sample rate)
c NMOD2 Number samples in wavelet modulo 2
c NPTBY2 NPTWAV / 2
c NPTWAV Number of time samples in wavelet (at input sample rate)
c NREC Number of traces/shot in input data set
c NRSWAV Number of points in the resampled wavelet
c NSHOTS Number of shots in the input data set
c NTPTS Number of samples/trace
c NTRACE Number of traces per output panel
c NWAVMX Maximum number of points in resampled wavelet
c OFFSRT TRUE for common offset (ie, common trace) sort
c OUTFIL Name of the output file containing the traces
c PARIN Unit number of input parameter file PARAM2
c PHASE Phase due to post critical reflections
c PI 3.1415927E+000
c RECSRT TRUE for a receiver sort
c RESAMP Factor by which to resample wavelet (should be even)
c SHTSRT TRUE for shot sort
c SRATE Sample rate in seconds
c TARGET Receiver number or trace number for sort
c TIME Arrival time of wavelet
c TMAX Trace end time
c TRACE(,) Array containing traces
c WAVLEN Length in seconds of the wavelet
c WHEAD() Head wave wavelet
c WIMAG() Imaginary part of (zero phase) wavelet
c WREAL() Real part of (zero phase) wavelet 10240 5104
c XDUMMY Dummy float variable
c ZDUMMY Dummy float variable
INTEGER DATIN, DATOUT, parin, STDERR
PARAMETER ( STDERR = 0,
: DATIN = 12,
: DATOUT = 13,
: parin = 14)
INTEGER MAXTR, MAXTPT, MAXWAV
PARAMETER ( MAXTR = 500,
: MAXTPT =1001,
c : MAXWAV = 513)
: MAXWAV = 257)
integer resamp, nwavmx
c resamp should be an EVEN integer OR 1 for no resampling
parameter ( resamp = 64)
parameter ( nwavmx = maxwav*resamp )
REAL WREAL(2*nwavmx), WIMAG(nwavmx),
: whead(nwavmx), TRACE(MAXTPT,maxtr)
REAL AMP, deltat, FUDGE,
: FLL, FHL, FLR, FHR, FNYQ,
: PHASE, PI, SRATE, TIME, TMAX,
: WAVLEN, xdummy, zdummy
INTEGER I, J, K, L, iback,
: isout, irecd1, irecdn,
: irecd, irprev, irecv, key,
: itrace, itrmin, itrmax, ntrace,
: nmod2, NPTWAV, nptby2, NREC, nrswav,
: nshots, NTPTS, itr1, itrn,
: irout, irout1, iroutn, idummy
CHARACTER INFIL*20, OUTFIL*20, job*1
logical shtsrt, recsrt, caustc, head,
: eof, offsrt
PARAMETER ( PI = 3.141592653589,
: FUDGE = 1.)
OPEN(UNIT=parin,FILE='param2',STATUS='old',ERR=5)
GO TO 10
5 WRITE(STDERR,'(A)') 'Can''t open file : ''param2'''
STOP
10 REWIND parin
c read job description
READ(parin,'(A)',err=15) job
go to 16
15 write(stderr,'(1x,a)')
:'MAIN: Can''t read job option, file ''param2'''
stop
16 continue
c read first and last records to sort on
read(parin,*,err=18) irecd1, irecdn
go to 19
18 write(stderr,'(1x,a,a)')
:'MAIN: Error reading first, last records for sort,',
:' file ''param2'''
stop
19 continue
if(job.eq.'s'.or.job.eq.'S') THEN
shtsrt = .true.
c read first and last traces to build
read(parin,*,err=20) itr1, itrn
go to 21
20 write(stderr,'(1x,a,a)')
: 'MAIN: Error reading first, last traces to build,',
: ' file ''param2'''
stop
21 continue
else if(job.eq.'r'.or.job.eq.'R') THEN
recsrt = .true.
c read receiver numbers for sort
read(parin,*,err=23) irout1, iroutn
go to 24
23 write(stderr,'(1x,a)')
: 'MAIN: Error reading receiver sort numbers, file ''param2'''
stop
24 continue
else
write(stderr,'(/1x,a,/33x,a/)')
: 'MAIN: unrecognized option - use s for shot records,',
: 'r for receiver sort.'
stop
end if
c get corner frequencies of wavelet
READ(parin,*,err=30) FLL,FHL,FLR,FHR
go to 31
30 write(stderr,'(1x,a)')
:'MAIN: Error reading filter frequencies, file ''param2'''
stop
31 continue
IF(FLL.LT.0.) THEN
WRITE(STDERR,'(1x,A)')'MAIN: negative frequency in spectrum'
WRITE(STDERR,'(1x,A)')'Specify positive half of spectrum only'
STOP
END IF
c fll<=fhl<=flr<=fhr
if(fhl.lt.fll) fhl = fll
if(fhr.lt.flr) fhr = flr
if(flr.lt.fhl) then
write(stderr,'(1x,a)')
: 'MAIN: Error in frequency specification of wavelet.'
stop
end if
c length of wavelet
READ(parin,*,err=35) WAVLEN
go to 36
35 write(stderr,'(1x,a)')
:'MAIN: Error reading wavelet length, file ''param2'''
stop
36 continue
c sample rate in seconds
READ(parin,*,err=40) SRATE
go to 41
40 write(stderr,'(1x,a)')
:'MAIN: Error reading sample rate, file ''param2'''
stop
41 continue
c resampling rate for wavelet
deltat = srate / resamp
c Check frequencies less than Nyquist.
FNYQ = 1. / ( 2. * SRATE)
IF(FHR.GT.FNYQ) THEN
WRITE(STDERR,'(1x,A)') 'MAIN : frequency beyond Nyquist.'
STOP
END IF
c number of points in wavelet
nptwav = wavlen / srate + 1
nmod2 = mod(nptwav,2)
if(nmod2.eq.0) then
c make number of points in wavelet an odd number
nptwav = nptwav + 1
end if
if(resamp.eq.1) then
nrswav = nptwav
else
nrswav = nptwav * resamp + 1
end if
nptby2 = ( nptwav - 1 ) / 2
IF(nrswav.GT.nwavmx) THEN
WRITE(STDERR,'(1x,A)') 'MAIN : too many points in wavelet.'
STOP
END IF
c trace length
READ(parin,*,err=50) TMAX
go to 55
50 write(stderr,'(1x,a)')
:'MAIN: Error reading trace length.'
stop
55 continue
NTPTS = 1 + ( TMAX + SRATE / 2. ) / SRATE
IF(NTPTS.GT.MAXTPT) THEN
WRITE(STDERR,'(A)') 'MAIN : too many points / trace.'
STOP
END IF
IF(NPTWAV.GT.NTPTS) THEN
WRITE(STDERR,'(A)') 'MAIN : wavelet length > trace length.'
STOP
END IF
c Read the names of the input and output data files
READ(parin,'(A)',err=70) INFIL
go to 75
70 write(stderr,'(1x,a)')
:'MAIN: Error reading input file name in file ''param2'''
stop
75 continue
READ(parin,'(A)',err=80) OUTFIL
go to 85
80 write(stderr,'(1x,a)')
:'MAIN: Error reading output file name in file ''param2'''
stop
85 continue
OPEN(UNIT=DATIN,FILE=infil,STATUS='old',
:form='UNFORMATTED',ERR=140)
c :ERR=140)
GO TO 145
140 WRITE(STDERR,'(1x,A)') 'Error opening input data file.'
STOP
145 REWIND DATIN
c OPEN(UNIT=DATOUT,FILE=OUTFIL,ERR=150)
OPEN(UNIT=DATOUT,FORM='UNFORMATTED',FILE=OUTFIL,
:ERR=150)
GO TO 155
150 WRITE(STDERR,'(1x,A)') 'Error creating output trace file.'
STOP
155 REWIND DATOUT
c Constructing the wavelet.
CALL WAVLET(FLL,FHL,FLR,FHR,NrsWAV,deltat,
:nwavmx,PI,WREAL,WIMAG,whead,stderr)
if(shtsrt) then
c SHOT GATHERS
c initialize shot counter
isout = irecd1
iback = 0
nrec = itrn - itr1 + 1
c number of traces/record = number of receivers/shot
900 itrmin = itr1
if(nrec.gt.maxtr) then
c will have to panel the output
itrmax = itrmin + maxtr - 1
ntrace = maxtr
else
itrmax = itrn
ntrace = nrec
end if
c zero the trace array for this shot
DO 950 i = 1, ntrace
do 925 j = 1, ntpts
trace(j,i) = 0.
925 continue
950 continue
eof = .false.
1000 read(datin,end=1050) irecd,itrace,irecv,time,
: xdummy,idummy,zdummy,
: amp,phase,caustc,head
if(irecd.lt.isout) go to 1000
if(irecd.gt.isout) go to 1100
iback = iback + 1
if(itrace.lt.itrmin.or.itrace.gt.itrmax) go to 1000
c trace number within this panel
itrace = itrace - itrmin + 1
amp = amp * fudge
c put the wavelet on the trace
call addwav(phase,caustc,nptwav,nptby2,time,ntpts,trace,
: amp,wimag,wreal,whead,pi,itrace,srate,
: deltat,head,resamp,maxtr,maxtpt)
go to 1000
1050 eof = .true.
if(irecd.lt.irecd1) then
c at eof and did not find any records within range
c close file, stop
write(stderr,'(1x,a)') 'No shots within specified range.'
write(stderr,'(1x,a,i4)') 'Max record is ',irecd
close(unit=datout)
stop
end if
1100 continue
c output the shot panel
write(stderr,'(1x,a,i4,1x,a,i4,a,i4)')
: 'Outputting shot ',isout,'traces',itrmin,' - ',itrmax
DO 1300 I = 1, ntrace
write(datout)(trace(j,i),j=1,ntpts)
1300 CONTINUE
if(itrmax.lt.itrn) then
c more traces for this shot
itrmin = itrmin + maxtr
itrmax = itrmax + maxtr
if(itrmax.gt.itrn) itrmax = itrn
ntrace = itrmax - itrmin + 1
c backspace to beginning of data for this shot
do 1305 l = 1, iback + 1
backspace datin
1305 continue
iback = 0
c zero the trace array for the next panel
DO 1320 i = 1, ntrace
do 1310 j = 1, ntpts
trace(j,i) = 0.
1310 continue
1320 continue
go to 1000
end if
if(eof.or.isout.eq.irecdn) then
c done reading events
c close file, stop
close(unit=datout)
stop
else
c next shot
isout = isout + 1
c backspace once to pick up first record of new shot
backspace datin
iback = 0
go to 900
end if
end if
if(recsrt) then
c RECEIVER SORT
c The number of traces is not known in advance when performing a
c receiver sort - it depends on the recording geometry. The
c number of traces will be the number of different shots for which
c the receiver was active (and recorded some events).
c Output one trace at a time
ntrace = 1
do 2000 irout = irout1, iroutn
c initialize the current record number to a non-existent record
irprev = -1
c irprev will become positive when a target event has been read
1500 read(datin,end=1750) irecd,itrace,irecv,time,
: xdummy,idummy,zdummy,
: amp,phase,caustc,head
if(irecd.lt.irecd1) go to 1500
if(irecd.gt.irecdn) go to 1750
if(irecv.ne.irout) go to 1500
if(irecd.ne.irprev) then
c this is a new shot (may be the first)
if(irprev.gt.0) then
c output the trace from the previous shot
c write(stderr,'(1x,a,i4)')'receiver sort-record ',irprev
write(datout)(trace(j,ntrace),j=1,ntpts)
c zero trace for new shot
do 1710 j = 1, ntpts
trace(j,ntrace) = 0.
1710 continue
end if
irprev = irecd
end if
amp = amp*fudge
call addwav(phase,caustc,nptwav,nptby2,time,ntpts,trace,
: amp,wimag,wreal,whead,pi,ntrace,srate,deltat,head,resamp,
: maxtr,maxtpt)
go to 1500
1750 continue
c output last trace for this receiver sort
if(irprev.gt.0) then
c write(stderr,'(1x,a,i4)')'receiver sort-record ',irprev
write(stderr,'(1x,a,i4)')'Done receiver ',irout
write(datout)(trace(j,ntrace),j=1,ntpts)
end if
c done outputting sort for this receiver
c zero trace for new receiver
do 1810 j = 1, ntpts
trace(j,ntrace) = 0.
1810 continue
rewind datin
2000 continue
c close file, stop
close(unit=datout)
stop
end if
STOP
END
c-----------------------------------------------------
|
c======================================================================c
c--------------- LAGRANGIAN PARTICLE TRACKING MAIN CODE ---------------c
c======================================================================c
c NOTE: VARIABLES STARTING WITH I,J,K,L,M,N ARE INTEGERS c
c c
c SWITCHES: c
c IPRESTART - Restart from file? (1-Yes,0-No) c
c IDRAG - Drag force (1-On,0-Off) c
c ILIFT - Lift force (1-On,0-Off) c
c IGRAV - Gravity/Buoyancy force (1-On,0-Off) c
c IPRES - Pressure Gradient force (1-On,0-Off) c
c IMASS - Virtual Mass force (1-On,0-Off) c
c ITWOWAY - Two-way coupling (1-On,0-Off) c
c IFOURWAY - Four-way coupling (1-On,0-Off) c
c IAGGLOM - DLVO Agglomeration (1-On,0-Off) c
c c
c STATSWITCHES: c
c I3DPLOT - Particle 3D plotting (X-Frequency,0-No) c
c ISTATGET - Particle stat recorder (X-Frequency,0-No) c
c ISTATFLUSH - Particle stat write (X-Frequency,0-No) c
c c
c FLOW PROPERTIES: c
c brey - Flow bulk reynolds number c
c srey - Flow shear reynolds number c
c bwall(ldim*2) - Domain boundaries c
c bcwall(ldim*2) - Boundary condition c
c fvel(ldim,lpart) - Fluid velocity at particle positions c
c fdvu(ldim,lpart) - Fluid u div field at particle positions c
c fdvv(ldim,lpart) - Fluid v div field at particle positions c
c fdvw(ldim,lpart) - Fluid w div field at particle positions c
c c
c PARTICLE TRACKER VARIABLES: c
c diam_p - Particle ND diameter c
c dt_p - Particle timestep c
c dens_pf - Particle ND density c
c rad_p - Particle ND radius c
c stkb_p - Particle bulk stokes number c
c stkt_p - Particle shear stokes number c
c vfrac_p - Particle volume fraction c
c ppos(ldim,lpart) - Particle current position c
c ppos0(ldim,lpart) - Particle position last step c
c pvel(ldim,lpart) - Particle current velocity c
c pvel0(ldim,lpart) - Particle velocity last step c
c c
c TWO-WAY COUPLING VARIABLES: c
c twowayforcex,y,z - Force on fluid element (i,j,k,v) c
c xmc, xxc - Minimum and maximum x value for cell c
c ymc, yxc - Minimum and maximum y value for cell c
c zmc, zxc - Minimum and maximum z value for cell c
c vol - Volume of cell (i,j,k,v) c
c======================================================================c
subroutine lpt_main
include 'SIZE'
include 'TOTAL'
include 'ZPER' ! for nelx,nely,nelz
common /switches/ IPRESTART, IDRAG, ILIFT, IGRAV, IPRES, IMASS
$ , ITWOWAY, IFOURWAY, IAGGLOM
common /statswitches/ I3DPLOT, ISTATGET, ISTATFLUSH, IFORCESTAT
$ , IWALLCONC
if(nid.EQ.0) write(*,*) "ENTERING LPT_MAIN. ISTEP = ", istep
c === CALL INITIALISATION IF FIRST TIMESTEP ===
if(istep.EQ.0) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_INIT."
call lpt_init
endif
c === CALL INJECTION OR RESTART===
if(istep.EQ.0 .AND. IPRESTART .EQ. 0) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_INJECT."
call lpt_inject
else if(istep.EQ.0 .AND. IPRESTART .EQ. 1) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_RESTART."
call lpt_restart(0)
endif
c === CALL TWO-WAY SETUP ===
if(istep.EQ.0 .AND. ITWOWAY .EQ. 1) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_TWOWAY(0)."
call lpt_twoway(0)
endif
c === CALL TWO-WAY ===
if(istep.GT.0 .AND. ITWOWAY .EQ. 1) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_TWOWAY(1)."
call lpt_twoway(1)
endif
c === CALL PARTICLE FORCING FOR ADVECTION ===
if(istep.GT.0) then
if(nid.EQ.0) write(*,*) "ENTERING LPT_ADVECT."
call lpt_advect
endif
c === CALL RESTART WRITING ===
if(istep.GT.0 .AND. mod(ISTEP,IOSTEP) .EQ. 0) then
call lpt_restart(1)
endif
c === CALL 3D PLOTTING FUNCTION ===
if(istep.GT.0 .AND. I3DPLOT .GT. 0) then
if(MOD(ISTEP,I3DPLOT) .EQ. 0) then
if(nid.eq.0) write(*,*) 'Calling LPT_3D.'
call lpt_3D
endif
endif
c === CALL STATS GATHERING FUNCTION ===
if(istep.GT.0) then
if(MOD(ISTEP,ISTATGET) .EQ. 0) then
if(nid.eq.0) write(*,*) 'Calling LPT_STATGET.'
call lpt_statget
endif
endif
c === CALL WALLCONC FLUSHING FUNCTION ===
if(istep.GT.0) then
if(MOD(ISTEP,ISTATFLUSH) .EQ. 0
$ .AND. IWALLCONC .EQ. 1) then
if(nid.eq.0) write(*,*) 'Calling LPT_WALLCONC.'
call lpt_wallconc
endif
endif
c === CALL STATS FLUSHING FUNCTION ===
if(istep.GT.0) then
if(MOD(ISTEP,ISTATFLUSH) .EQ. 0) then
if(nid.eq.0) write(*,*) 'Calling LPT_STATFLUSH.'
call lpt_statflush
endif
endif
return
end
c-----------------------------------------------------------------------c
|
program TRANK
c
c To test use of NAGLIB routines to find rank of matrix
real*8 Q(10,10)
c For NAG
c real*8 aijmax(5) !output
c real*8 d(5),u(10,5),du(5) !workspace
real*8 cx,tol
c integer inc(5)
c For SVD
real*8 v(10,10),w(10)
real*8 prec
c
q(1,1)=7.d0
q(1,2)=-2.d0
q(1,3)=4.d0
q(1,4)=9.d0
q(1,5)=1.8d0
q(2,1)=3.d0
q(2,2)=8.d0
q(2,3)=-4.d0
q(2,4)=6.d0
q(2,5)=1.3d0
q(3,1)=9.d0
q(3,2)=6.d0
q(3,3)=1.d0
q(3,4)=5.d0
q(3,5)=2.1d0
q(4,1)=-8.d0
q(4,2)=7.d0
q(4,3)=5.d0
q(4,4)=2.d0
q(4,5)=0.6d0
q(5,1)=4.d0
q(5,2)=-1.d0
q(5,3)=2.d0
q(5,4)=8.d0
q(5,5)=1.3d0
q(6,1)=1.d0
q(6,2)=6.d0
q(6,3)=3.d0
q(6,4)=-5.d0
q(6,5)=0.5d0
c
call RANK(Q,5,5,10,10,irank)
print 1,irank
1 format(' From DC routine, rank = ',i3)
c
c Need F90 verion of NAGLIB
cc m=6
c m=5
c n=5
c ia=10
c iu=10
cc tol=1.d-10
cc set tolerance to 10*norm of Q
c cx=1.d0
c do i=1,m
c do j=1,n
c cx=cx+q(i,j)**2
c enddo
c enddo
c tol= dsqrt(cx)*X02AJF()
cc ifail=0
c ifail=1
c
c call F01BLF(m,n,tol,Q,ia,aijmax,irank,inc,d,u,iu,du,ifail)
c print 2,irank
c2 format(' From NAG routine, rank = ',i3)
cc
c Test SVD from Press et al
c m=6
m=5
n=5
call dsvdcmp(Q,m,n,10,10,w,v) !destroys Q
c set tolerance to 10*norm of Q
cx=1.d0
do i=1,m
do j=1,n
cx=cx+q(i,j)**2
enddo
enddo
prec=2.d0**(-31) !machine precision
tol=dsqrt(cx)*prec
irank=0
do i=1,5
if(dabs(w(i)).gt.tol) irank=irank+1
enddo
print 3,irank
3 format(' From SVD routine (Press et al), rank = ',i3)
c
c
q(1,1)=7.d0
q(1,2)=-2.d0
q(1,3)=4.d0
q(1,4)=9.d0
q(1,5)=1.8d0
q(2,1)=3.d0
q(2,2)=8.d0
q(2,3)=-4.d0
q(2,4)=6.d0
q(2,5)=1.3d0
q(3,1)=9.d0
q(3,2)=6.d0
q(3,3)=1.d0
q(3,4)=5.d0
q(3,5)=2.1d0
q(4,1)=-8.d0
q(4,2)=7.d0
q(4,3)=5.d0
q(4,4)=2.d0
q(4,5)=0.6d0
q(5,1)=4.d0
q(5,2)=-1.d0
q(5,3)=2.d0
q(5,4)=8.d0
q(5,5)=1.3d0
q(6,1)=1.d0
q(6,2)=6.d0
q(6,3)=3.d0
q(6,4)=-5.d0
q(6,5)=0.5d0
c
call RANK_SVD(Q,m,n,10,10,irank)
print 4,irank
4 format(' From RANK_SVD routine, rank = ',i3)
c
end
|
C$Procedure WRITLN ( Write a text line to a logical unit )
SUBROUTINE WRITLN ( LINE, UNIT )
C$ Abstract
C
C Write a single line of text to the Fortran logical unit UNIT.
C
C$ Disclaimer
C
C THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
C CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
C GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
C ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
C PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
C TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
C WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
C PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
C SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
C SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
C
C IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
C BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
C LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
C INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
C REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
C REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
C
C RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
C THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
C CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
C ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
C
C$ Required_Reading
C
C None.
C
C$ Keywords
C
C ASCII
C TEXT
C FILES
C
C$ Declarations
CHARACTER*(*) LINE
INTEGER UNIT
C$ Brief_I/O
C
C Variable I/O Description
C -------- --- --------------------------------------------------
C LINE I The line which is to be written to UNIT.
C UNIT I The Fortran unit number to use for output.
C
C$ Detailed_Input
C
C LINE This contains the text line which is to be written
C to UNIT.
C
C The value of this variable is not modified.
C
C UNIT The Fortran unit number for the output. This may be
C either the unit number for the terminal, or the unit
C number of a previously opened text file.
C
C$ Detailed_Output
C
C None.
C
C$ Parameters
C
C None.
C
C$ Exceptions
C
C 1) If an error occurs while attempting to write to the text
C file attached to UNIT, the error SPICE(FILEWRITEFAILED) will
C be signalled.
C
C This routine only checks in with the error handler in the event
C that an error occurred. (Discovery check in)
C
C$ Files
C
C None.
C
C$ Particulars
C
C This routine will write a single text line to the device
C specified by UNIT. UNIT may be the terminal, or it may be
C a logical unit number obtained from a Fortran OPEN or INQUIRE
C statement. When written, the line will have trailing spaces
C removed.
C
C$ Examples
C
C CALL WRITLN( LINE, UNIT )
C
C You have now written a line of text to unit UNIT.
C
C$ Restrictions
C
C None.
C
C$ Literature_References
C
C None.
C
C$ Author_and_Institution
C
C K.R. Gehringer (JPL)
C
C$ Version
C
C- SPICELIB Version 2.25.0, 10-MAR-2014 (BVS)
C
C Updated for SUN-SOLARIS-64BIT-INTEL.
C
C- SPICELIB Version 2.24.0, 10-MAR-2014 (BVS)
C
C Updated for PC-LINUX-64BIT-IFORT.
C
C- SPICELIB Version 2.23.0, 10-MAR-2014 (BVS)
C
C Updated for PC-CYGWIN-GFORTRAN.
C
C- SPICELIB Version 2.22.0, 10-MAR-2014 (BVS)
C
C Updated for PC-CYGWIN-64BIT-GFORTRAN.
C
C- SPICELIB Version 2.21.0, 10-MAR-2014 (BVS)
C
C Updated for PC-CYGWIN-64BIT-GCC_C.
C
C- SPICELIB Version 2.20.1, 18-MAY-2010 (BVS)
C
C Removed "C$" marker from text in the header.
C
C- SPICELIB Version 2.20.0, 13-MAY-2010 (BVS)
C
C Updated for SUN-SOLARIS-INTEL.
C
C- SPICELIB Version 2.19.0, 13-MAY-2010 (BVS)
C
C Updated for SUN-SOLARIS-INTEL-CC_C.
C
C- SPICELIB Version 2.18.0, 13-MAY-2010 (BVS)
C
C Updated for SUN-SOLARIS-INTEL-64BIT-CC_C.
C
C- SPICELIB Version 2.17.0, 13-MAY-2010 (BVS)
C
C Updated for SUN-SOLARIS-64BIT-NATIVE_C.
C
C- SPICELIB Version 2.16.0, 13-MAY-2010 (BVS)
C
C Updated for PC-WINDOWS-64BIT-IFORT.
C
C- SPICELIB Version 2.15.0, 13-MAY-2010 (BVS)
C
C Updated for PC-LINUX-64BIT-GFORTRAN.
C
C- SPICELIB Version 2.14.0, 13-MAY-2010 (BVS)
C
C Updated for PC-64BIT-MS_C.
C
C- SPICELIB Version 2.13.0, 13-MAY-2010 (BVS)
C
C Updated for MAC-OSX-64BIT-INTEL_C.
C
C- SPICELIB Version 2.12.0, 13-MAY-2010 (BVS)
C
C Updated for MAC-OSX-64BIT-IFORT.
C
C- SPICELIB Version 2.11.0, 13-MAY-2010 (BVS)
C
C Updated for MAC-OSX-64BIT-GFORTRAN.
C
C- SPICELIB Version 2.10.0, 18-MAR-2009 (BVS)
C
C Updated for PC-LINUX-GFORTRAN.
C
C- SPICELIB Version 2.9.0, 18-MAR-2009 (BVS)
C
C Updated for MAC-OSX-GFORTRAN.
C
C- SPICELIB Version 2.8.0, 19-FEB-2008 (BVS)
C
C Updated for PC-LINUX-IFORT.
C
C- SPICELIB Version 2.7.0, 14-NOV-2006 (BVS)
C
C Updated for PC-LINUX-64BIT-GCC_C.
C
C- SPICELIB Version 2.6.0, 14-NOV-2006 (BVS)
C
C Updated for MAC-OSX-INTEL_C.
C
C- SPICELIB Version 2.5.0, 14-NOV-2006 (BVS)
C
C Updated for MAC-OSX-IFORT.
C
C- SPICELIB Version 2.4.0, 14-NOV-2006 (BVS)
C
C Updated for PC-WINDOWS-IFORT.
C
C- SPICELIB Version 2.3.0, 26-OCT-2005 (BVS)
C
C Updated for SUN-SOLARIS-64BIT-GCC_C.
C
C- SPICELIB Version 2.2.0, 03-JAN-2005 (BVS)
C
C Updated for PC-CYGWIN_C.
C
C- SPICELIB Version 2.1.0, 03-JAN-2005 (BVS)
C
C Updated for PC-CYGWIN.
C
C- SPICELIB Version 2.0.5, 17-JUL-2002 (BVS)
C
C Added MAC-OSX environments.
C
C- SPICELIB Version 2.0.4, 08-OCT-1999 (WLT)
C
C The environment lines were expanded so that the supported
C environments are now explicitely given. New
C environments are WIN-NT
C
C- SPICELIB Version 2.0.3, 16-SEP-1999 (NJB)
C
C CSPICE environments were added. Some typos were corrected.
C
C- SPICELIB Version 2.0.2, 28-JUL-1999 (WLT)
C
C The environment lines were expanded so that the supported
C environments are now explicitly given. New
C environments are PC-DIGITAL, SGI-O32 and SGI-N32.
C
C- SPICELIB Version 2.0.1, 18-MAR-1999 (WLT)
C
C The environment lines were expanded so that the supported
C environments are now explicitly given. Previously,
C environments such as SUN-SUNOS and SUN-SOLARIS were implied
C by the environment label SUN.
C
C- SPICELIB Version 2.0.0, 08-APR-1998 (NJB)
C
C Module was updated for the PC-LINUX platform.
C
C- SPICELIB Version 1.1.1, 20-AUG-1996 (WLT)
C
C Corrected the heading for the Index_Entries section.
C
C- SPICELIB Version 1.1.0, 29-FEB-1996 (KRG)
C
C For the Macintosh, we need to use real Fortran I/O, i.e.,
C using the first column for carriage control. The change
C was to move the MAC environment indicator from one
C environment case to the other.
C
C Also, for UNIX environments, the parameter STDOUT is no
C longer defined. This only appears for platforms that
C need it to differentiate between writing to a file and
C the terminal screen (standard output), currently: VAX,
C PC-LAHEY, PC-MS, and MAC.
C
C- SPICELIB Version 1.0.0, 20-DEC-1995 (KRG)
C
C The routine graduated
C
C- Beta Version 3.1.0, 18-AUG-1995 (KRG)
C
C Moved the PC-LAHEY environment indicator from one environment
C case to the other. The Lahey compiler on the PC does treat text
C files and the standard output device differently.
C
C- Beta Version 3.0.1, 01-JAN-1995 (KRG)
C
C Moved the description of the input variable UNIT from the $
C Detailed_Output section of the header to the correct location
C in the $ Detailed_Input section of the header.
C
C- Beta Version 3.0.0, 11-JUL-1994 (HAN)
C
C Edited master source file to correct the code for the
C PC/Microsoft FORTRAN PowerStation environment. It should use
C the same code as the VAX, not the PC/Lahey Fortran code. Also,
C code was included for the DEC Alpha OpenVMS/DEC Fortran and
C Sun Solaris/Sun Fortran environments.
C
C- Beta Version 2.0.0, 30-MAR-1994 (HAN)
C
C Edited master source file to include new environments:
C Silicon Graphics IRIX/Silicon Graphics Fortran,
C DEC Alpha-OSF/1, and NeXT/Absoft Fortran.
C
C- Beta Version 1.0.0, 17-DEC-1992 (KRG)
C
C-&
C$ Index_Entries
C
C write a text line to a logical unit
C
C-&
C$ Revisions
C
C- SPICELIB Version 2.0.0, 08-APR-1998 (NJB)
C
C Module was updated for the PC-LINUX platform.
C
C- SPICELIB Version 1.1.0, 29-FEB-1996 (KRG)
C
C For the Macintosh, we need to use real Fortran I/O, i.e.,
C using the first column for carriage control. The change
C was to move the MAC environment indicator from one
C environment case to the other.
C
C Also, for UNIX environments, the parameter STDOUT is no
C longer defined. This only appears for platforms that
C need it to differentiate between writing to a file and
C the terminal screen (standard output), currently: VAX,
C PC-LAHEY, PC-MS, and MAC.
C
C- SPICELIB Version 1.0.0, 20-DEC-1995 (KRG)
C
C The routine graduated
C
C- Beta Version 3.1.0, 18-AUG-1995 (KRG)
C
C Moved the PC-LAHEY environment indicator from one environment
C case to the other. The Lahey compiler on the PC does treat text
C files and the standard output device differently.
C
C- Beta Version 3.0.1, 01-JAN-1995 (KRG)
C
C Moved the description of the input variable UNIT from the $
C Detailed_Output section of the header to the correct location
C in the $ Detailed_Input section of the header.
C
C- Beta Version 3.0.0, 11-JUL-1994 (HAN)
C
C Edited master source file to correct the code for the
C PC/Microsoft FORTRAN PowerStation environment. It should use
C the same code as the VAX, not the PC/Lahey Fortran code. Also,
C code was included for the DEC Alpha OpenVMS/DEC Fortran and
C Sun Solaris/Sun Fortran environments.
C
C- Beta Version 2.0.0, 30-MAR-1994 (HAN)
C
C Edited master source file to include new environments:
C Silicon Graphics IRIX/Silicon Graphics Fortran,
C DEC Alpha-OSF/1, and NeXT/Absoft Fortran.
C
C- Beta Version 1.0.0, 17-DEC-1992 (KRG)
C
C-&
C
C SPICELIB functions
C
INTEGER RTRIM
C
C Local variables
C
INTEGER IOSTAT
C
C UNIX based fortran implementations typically do not distinguish
C between a text file and the standard output unit, so no leading
C vertical spacing character is required.
C
WRITE ( UNIT, FMT='(A)', IOSTAT=IOSTAT ) LINE(:RTRIM(LINE))
C
C Check to see if we got a write error, and signal it if we did.
C Also check in and check out.
C
IF ( IOSTAT .NE. 0 ) THEN
CALL CHKIN ( 'WRITLN' )
CALL SETMSG ( 'Error Writing to file: #. IOSTAT = #.' )
CALL ERRFNM ( '#', UNIT )
CALL ERRINT ( '#', IOSTAT )
CALL SIGERR ( 'SPICE(FILEWRITEFAILED)' )
CALL CHKOUT ( 'WRITLN' )
RETURN
END IF
RETURN
END
|
LOCAL INCLUDE 'VLAMP.INC'
C Local include for VLAMP
INCLUDE 'INCS:PUVD.INC'
INCLUDE 'INCS:ZPBUFSZ.INC'
HOLLERITH XNAMEI(3), XCLAIN(2), XCALOU(12)
REAL XSIN, XDISIN, XFQID, XSUBA, XFLAG, XINV, XGAINV, XINV2,
* BADD(10),
* SCRBUF(256), BUFF2(UVBFSS), CURTIM, FINC(MAXIF), CENCH
INTEGER SEQIN, DISKIN, JBUFSZ, OLDCNO, NANT, ISYVER, ICLVER,
* IGCVER, OSYVER, OCLVER, OGCVER, NIF, NPOL, EXTRAP,
* NMSG, TXLUN, TXIND, CURSOU, SUBARR, FGVER, FRQSEL,
* ISBAND(MAXIF), ANTOK(MAXANT), IBUFF2(UVBFSS)
CHARACTER NAMEIN*12, CLAIN*6, CALOUT*48, BANDC*4
DOUBLE PRECISION JD, JD0, FOFF(MAXIF)
EQUIVALENCE (IBUFF2, BUFF2)
COMMON /INPARM/ XNAMEI, XCLAIN, XSIN, XDISIN, XFQID, XSUBA, XFLAG,
* XINV, XGAINV, XINV2, XCALOU, BADD
COMMON /VLAMPP/ JD, JD0, FOFF, FINC, ISBAND, ANTOK, SEQIN,
* DISKIN, OLDCNO, CURTIM, NANT, NIF, NPOL, ISYVER, ICLVER,
* IGCVER, OSYVER, OCLVER, OGCVER, EXTRAP, NMSG, TXIND, TXLUN,
* CURSOU, SUBARR, FGVER, FRQSEL, CENCH
COMMON /CHARPM/ NAMEIN, CLAIN, CALOUT, BANDC
COMMON /BUFRS/ SCRBUF, BUFF2, JBUFSZ
INCLUDE 'INCS:DCAT.INC'
INCLUDE 'INCS:DMSG.INC'
C End local include for VLAMP
LOCAL END
LOCAL INCLUDE 'PUVCOP.INC'
INCLUDE 'INCS:PUVD.INC'
C set flag parameters
INTEGER MAXFLG
C MAXFLG= max. no. flags active
PARAMETER (MAXFLG=100001)
LOCAL END
LOCAL INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:PUVD.INC'
INCLUDE 'INCS:PGCV.INC'
INTEGER SYBUFF(512), ISYRNO, SYKOLS(12), SYNUMV(12), LSTSOU,
* TRECA(MAXANT), TRECB(MAXANT)
REAL TS1A(2,MAXIF,MAXANT), TS1B(2,MAXIF,MAXANT),
* T1A(MAXANT), T1B(MAXANT), TCAL(4,MAXIF,MAXANT),
* VEFF(2,MAXIF,MAXANT), PSYS(2,MAXIF,MAXANT)
COMMON /SYVALS/ SYBUFF, TS1A, TS1B, TCAL, T1A, T1B, PSYS, ISYRNO,
* SYKOLS, SYNUMV, LSTSOU, VEFF, TRECA, TRECB
INTEGER GCBUFF(512), GCKOLS(MAXGCC), GCNUMV(MAXGCC), IGCRNO,
* CLBUFF(512), ICLRNO, CLKOLS(MAXCLC), CLNUMV(MAXCLC)
REAL CLAMPS(2,MAXIF,MAXANT)
COMMON /CLVALS/ CLAMPS, CLBUFF, GCBUFF, CLKOLS, CLNUMV, GCKOLS,
* GCNUMV, ICLRNO, IGCRNO
INTEGER MAXSCN
PARAMETER (MAXSCN=5000)
REAL TIMENX(2,MAXSCN)
INTEGER SRCNX(MAXSCN), MAXNX, CURNX
COMMON /NXVALS/ TIMENX, SRCNX, MAXNX, CURNX
LOCAL END
PROGRAM VLAMP
C-----------------------------------------------------------------------
C! determine phased VLA sensitivity for VLBI
C# Utility UV VLA Calibration VLBI
C-----------------------------------------------------------------------
C; Copyright (C) 2013-2018
C; Associated Universities, Inc. Washington DC, USA.
C;
C; This program is free software; you can redistribute it and/or
C; modify it under the terms of the GNU General Public License as
C; published by the Free Software Foundation; either version 2 of
C; the License, or (at your option) any later version.
C;
C; This program is distributed in the hope that it will be useful,
C; but WITHOUT ANY WARRANTY; without even the implied warranty of
C; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C; GNU General Public License for more details.
C;
C; You should have received a copy of the GNU General Public
C; License along with this program; if not, write to the Free
C; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
C; MA 02139, USA.
C;
C; Correspondence concerning AIPS should be addressed as follows:
C; Internet email: aipsmail@nrao.edu.
C; Postal address: AIPS Project Office
C; National Radio Astronomy Observatory
C; 520 Edgemont Road
C; Charlottesville, VA 22903-2475 USA
C-----------------------------------------------------------------------
C VLAMP sums the nominal sensitivities from an SY table and forms
C ANTAB-format values of Tsys and gain.
C Inputs:
C AIPS adverb Prg. name. Description.
C INNAME NAMEIN Name of input UV data.
C INCLASS CLAIN Class of input UV data.
C INSEQ SEQIN Seq. of input UV data.
C INDISK DISKIN Disk number of input VU data.
C SUBARRAY SUBARR Subarray to do
C FREQID FRQSEL FREQID to do
C INVERS ISYVER SY table version
C GAINVER ICLVER CL table version
C IN2VERS IGCVER GC table version
C-----------------------------------------------------------------------
CHARACTER PRGM*6
INTEGER IRET
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:DFIL.INC'
INCLUDE 'INCS:DDCH.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'INCS:DUVH.INC'
DATA PRGM /'VLAMP '/
C-----------------------------------------------------------------------
C Get input parameters and
C create output file if nec.
CALL VLAMPI (PRGM, IRET)
IF (IRET.NE.0) GO TO 990
C Call routine that sends data
C to the user routine.
CALL VLAMPD (IRET)
IF (IRET.EQ.0) THEN
IF (EXTRAP.GT.0) THEN
WRITE (MSGTXT,1000) EXTRAP
CALL MSGWRT (6)
END IF
CALL VLAMPH
END IF
CALL VLAMPC
C Close down files, etc.
990 CALL DIE (IRET, SCRBUF)
C
999 STOP
C-----------------------------------------------------------------------
1000 FORMAT ('Note:',I12,' samples had to be extrapolated in time')
END
SUBROUTINE VLAMPI (PRGN, JERR)
C-----------------------------------------------------------------------
C VLAMPI gets input parameters for VLAMP and creates an output file
C if necessary.
C Inputs:
C PRGN C*6 Program name
C Output:
C JERR I Error code: 0 => ok
C 5 => catalog troubles
C 8 => can't start
C Output in common:
C NRPRMI I Input number of random parameters.
C INCSI I Input Stokes' increment in vis.
C INCFI I Input frequency increment in vis.
C INCIFI I Input IF increment in vis.
C LRECO I Output file record length
C NRPRMO I Output number of random parameters.
C INCSO I Output Stokes' increment in vis.
C INCFO I Output frequency increment in vis.
C INCIFO I Output IF's increment in vis.
C Commons: /INPARM/ all input adverbs in order given by INPUTS
C file
C /MAPHDR/ output file catalog header
C-----------------------------------------------------------------------
INTEGER JERR
CHARACTER PRGN*6
C
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
CHARACTER STAT*4, PTYPE*2, KEYWRD*8, FRMATC*8, BNDCOD(MAXIF)*8,
* CALIN*48
INTEGER IROUND, NPARM, IERR, I, J, LUN(3), KEY(2,2), IP, IIF,
* IANT, VER, KEYSUB(2,2), NTERM
REAL FKEY(2,2), GMMOD
INCLUDE 'INCS:DFIL.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'INCS:DDCH.INC'
INCLUDE 'INCS:DUVH.INC'
INCLUDE 'INCS:DANS.INC'
DATA LUN /59,60,61/
DATA FKEY /1.0,0.0, 1.0,0.0/
DATA KEYSUB /4*1/
C SY format change date
DATA FRMATC /'20110223'/
C-----------------------------------------------------------------------
C Init for AIPS, disks, ...
CALL ZDCHIN (.TRUE.)
CALL VHDRIN
CALL SELINI
TXIND = -1
FGVER = -1
NMSG = 0
CURTIM = -1.E5
JBUFSZ = UVBFSS * 2
LSTSOU = -999
CALL JULDAY (FRMATC, JD0)
C Initialize /CFILES/
NSCR = 0
NCFILE = 0
JERR = 0
C Get input parameters.
NPARM = 35
CALL GTPARM (PRGN, NPARM, RQUICK, XNAMEI, SCRBUF, IERR)
IF (IERR.NE.0) THEN
RQUICK = .TRUE.
JERR = 8
IF (IERR.EQ.1) GO TO 999
WRITE (MSGTXT,1000) IERR
CALL MSGWRT (8)
END IF
C Restart AIPS
IF (RQUICK) CALL RELPOP (JERR, SCRBUF, IERR)
IF (JERR.NE.0) GO TO 999
JERR = 5
DO 5 I = 1,10
IBAD(I) = IROUND(BADD(I))
5 CONTINUE
C Crunch input parameters.
CALL H2CHR (12, 1, XNAMEI, NAMEIN)
CALL H2CHR (6, 1, XCLAIN, CLAIN)
CALL H2CHR (48, 1, XCALOU, CALOUT)
SEQIN = IROUND (XSIN)
DISKIN = IROUND (XDISIN)
C Info for UVGET:
C Put selection criteria into
C correct common.
SUBARR = IROUND (XSUBA)
IF (SUBARR.LE.0) SUBARR = 1
C Get CATBLK from old file.
OLDCNO = 1
PTYPE = 'UV'
CALL CATDIR ('SRCH', DISKIN, OLDCNO, NAMEIN, CLAIN, SEQIN,
* PTYPE, NLUSER, STAT, SCRBUF, IERR)
IF (IERR.NE.0) THEN
WRITE (MSGTXT,1030) IERR, NAMEIN, CLAIN, SEQIN, DISKIN,
* NLUSER
GO TO 990
END IF
CALL CATIO ('READ', DISKIN, OLDCNO, CATBLK, 'REST', SCRBUF, IERR)
IF (IERR.NE.0) THEN
WRITE (MSGTXT,1040) IERR
GO TO 990
END IF
C Save input CATBLK
CALL H2CHR (8, 1, CATH(KHDOB), KEYWRD)
CALL JULDAY (KEYWRD, JD)
FGVER = IROUND (XFLAG)
CALL FNDEXT ('FG', CATBLK, I)
IF (FGVER.GT.I) FGVER = I
IF (FGVER.LE.0) FGVER = -1
C Get uv header info.
CALL UVPGET (JERR)
IF (JERR.NE.0) GO TO 999
C number antennas
CALL GETANT (DISKIN, OLDCNO, SUBARR, CATBLK, IBUFF2, JERR)
IF (JERR.NE.0) GO TO 999
NANT = NSTNS
CALL FILL (MAXANT, -1, ANTOK)
DO 10 I = 1,NANT
IF ((STNNAM(I).NE.'OUT') .AND. (STNNAM(I).NE.' '))
* ANTOK(I) = 1
10 CONTINUE
NPOL = CATBLK(KINAX+JLOCS)
NPOL = MIN (2, NPOL)
NIF = 1
IF (JLOCIF.GE.0) NIF = CATBLK(KINAX+JLOCIF)
C SY Table version - flagging
ISYVER = IROUND (XINV)
CALL FNDEXT ('SY', CATBLK, J)
IF (J.LE.0) THEN
MSGTXT = 'NO SY TABLES: I QUIT'
JERR = 10
GO TO 990
END IF
IF ((ISYVER.LE.0) .OR. (ISYVER.GT.J)) ISYVER = J
OSYVER = J + 1
IF (FGVER.LE.0) OSYVER = J
C CL
ICLVER = IROUND (XGAINV)
CALL FNDEXT ('CL', CATBLK, J)
IF (J.LE.0) THEN
MSGTXT = 'NO CL TABLES: I QUIT'
JERR = 10
GO TO 990
END IF
IF ((ICLVER.LE.0) .OR. (ICLVER.GT.J)) ICLVER = J
OCLVER = J
C GC
IGCVER = IROUND (XINV2)
CALL FNDEXT ('GC', CATBLK, J)
IF (J.LE.0) THEN
MSGTXT = 'NO GC TABLES: I WILL NO DO AS MUCH'
CALL MSGWRT (6)
END IF
IF ((IGCVER.LE.0) .OR. (IGCVER.GT.J)) IGCVER = J
OGCVER = J
C Freq id
FRQSEL = IROUND (XFQID)
IF (FRQSEL.LE.0) FRQSEL = 1
C Save input file info
C Read CD table
I = 0
CALL GETCDS (DISKIN, OLDCNO, I, SUBARR, FRQSEL, CATBLK,
* TCAL, JERR)
IF (JERR.NE.0) GO TO 999
C get frequencies, efficiencies
I = 2 * MAXIF * MAXANT
CALL RFILL (I, 1.0, VEFF)
BANDC = ' '
VER = 1
CENCH = CATBLK(KINAX+JLOCF) / 2.0 + 1.0
CALL CHNDAT ('READ', SYBUFF, DISKIN, OLDCNO, VER, CATBLK, LUN,
* NIF, FOFF, ISBAND, FINC, BNDCOD, FRQSEL, JERR)
IF (JERR.EQ.0) THEN
DO 30 J = 1,NIF
FOFF(J) = (FOFF(J) + CATD(KDCRV+JLOCF) + FINC(J) *
* (CENCH - CATR(KRCRP+JLOCF))) / 1.D9
30 CONTINUE
CALL GETBND (NIF, FOFF, BNDCOD, JERR, BANDC)
CALIN = ' '
CALL FNDEFF (NIF, FOFF, BANDC, NSTNS, CALIN, IBUFF2, VEFF)
END IF
JERR = 0
C NX table info
CALL GETNX (DISKIN, OLDCNO, CATBLK, SUBARR, CLBUFF, MAXNX, TIMENX,
* SRCNX, JERR)
IF (JERR.NE.0) GO TO 999
C open and sort CL table
CALL CALINI ('READ', CLBUFF, DISKIN, OLDCNO, ICLVER, CATBLK,
* LUN(2), ICLRNO, CLKOLS, CLNUMV, IANT, IP, IIF, NTERM, GMMOD,
* JERR)
IF (JERR.NE.0) GO TO 999
KEY(1,2) = 4
KEY(1,1) = 1
IF ((CLBUFF(43).NE.KEY(1,1)) .OR. (CLBUFF(44).NE.KEY(1,2)))
* THEN
CALL TABIO ('CLOS', 0, ICLRNO, CLBUFF, CLBUFF, JERR)
CALL TABSRT (DISKIN, OLDCNO, 'CL', ICLVER, ICLVER, KEY,
* KEYSUB, FKEY, CLBUFF, CATBLK, JERR)
IF (JERR.NE.0) GO TO 999
CALL CALINI ('READ', CLBUFF, DISKIN, OLDCNO, ICLVER, CATBLK,
* LUN(2), ICLRNO, CLKOLS, CLNUMV, IANT, IP, IIF, NTERM, GMMOD,
* JERR)
IF (JERR.NE.0) GO TO 999
END IF
IF ((IP.NE.NPOL) .OR. (IIF.NE.NIF)) THEN
MSGTXT = 'CL TABLE NO MATCH FOR POL AND/OR IFS'
JERR = 10
GO TO 999
END IF
C open GC table
IF (IGCVER.GT.0) THEN
CALL GCINI ('READ', GCBUFF, DISKIN, OLDCNO, IGCVER, CATBLK,
* LUN(3), IGCRNO, GCKOLS, GCNUMV, IP, IIF, NTERM, JERR)
IF (JERR.NE.0) GO TO 999
IF ((IP.NE.NPOL) .OR. (IIF.NE.NIF)) THEN
MSGTXT = 'CL TABLE NO MATCH FOR POL AND/OR IFS'
JERR = 10
GO TO 999
END IF
END IF
C open and sort SY table
CALL SYINI ('READ', SYBUFF, DISKIN, OLDCNO, ISYVER, CATBLK,
* LUN(1), ISYRNO, SYKOLS, SYNUMV, IANT, IP, IIF, JERR)
IF (JERR.NE.0) GO TO 999
KEY(1,2) = 4
KEY(1,1) = 1
IF ((SYBUFF(43).NE.KEY(1,1)) .OR. (SYBUFF(44).NE.KEY(1,2)))
* THEN
CALL TABIO ('CLOS', 0, ISYRNO, SYBUFF, SYBUFF, JERR)
CALL TABSRT (DISKIN, OLDCNO, 'SY', ISYVER, ISYVER, KEY,
* KEYSUB, FKEY, SYBUFF, CATBLK, JERR)
IF (JERR.NE.0) GO TO 999
CALL SYINI ('READ', SYBUFF, DISKIN, OLDCNO, ISYVER, CATBLK,
* LUN(1), ISYRNO, SYKOLS, SYNUMV, IANT, IP, IIF, JERR)
IF (JERR.NE.0) GO TO 999
END IF
IF ((IP.NE.NPOL) .OR. (IIF.NE.NIF)) THEN
MSGTXT = 'SY TABLE NO MATCH FOR POL AND/OR IFS'
JERR = 10
GO TO 999
END IF
C Put input file in READ
PTYPE = 'UV'
STAT = 'WRIT'
CALL CATDIR ('CSTA', DISKIN, OLDCNO, NAMEIN, CLAIN, SEQIN,
* PTYPE, NLUSER, STAT, SCRBUF, IERR)
NCFILE = NCFILE + 1
FVOL(NCFILE) = DISKIN
FCNO(NCFILE) = OLDCNO
FRW(NCFILE) = 1
C open text file
TXLUN = 3
CALL ZTXOPN ('WRIT', TXLUN, TXIND, CALOUT, .FALSE., JERR)
IF (JERR.NE.0) THEN
TXIND = -1
MSGTXT = 'UNABLE TO OPEN TEXT FILE'
GO TO 990
END IF
C write initial info to text file
CALL TXINIT (JERR)
IF (JERR.NE.0) GO TO 999
C flag the SY table
IF (OSYVER.NE.ISYVER) THEN
CALL TABIO ('CLOS', 0, ISYRNO, SYBUFF, SYBUFF, JERR)
CALL SYFSEL (DISKIN, OLDCNO, ISYVER, OSYVER, CATBLK,
* SYBUFF, IBUFF2, JERR)
IF (JERR.NE.0) GO TO 999
CALL SYINI ('READ', SYBUFF, DISKIN, OLDCNO, OSYVER, CATBLK,
* LUN(1), ISYRNO, SYKOLS, SYNUMV, IANT, IP, IIF, JERR)
IF (JERR.NE.0) GO TO 999
END IF
JERR = 0
GO TO 999
C
990 CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('VLAMPI: ERROR',I3,' OBTAINING INPUT PARAMETERS')
1030 FORMAT ('ERROR',I3,' FINDING ',A12,'.',A6,'.',I4,' DISK=',
* I3,' USID=',I5)
1040 FORMAT ('ERROR',I3,' COPYING CATBLK ')
END
SUBROUTINE GETNX (DISK, CNO, CATBLK, ISUB, BUFFER, NOSCAN, TSCAN,
* SSCAN, IRET)
C-----------------------------------------------------------------------
C GETNX reads the NX table and makes a list of scan boundaries
C Inputs:
C DISK I Disk number
C CNO I Catalog number
C CATBLK I(*) Header
C ISUB I Limit to subarray ISUB - 0 -> all
C Outputs
C BUFFER I(512) Scratch buffer
C NOSCAN I Number of times in TSCAN
C TSCAN R(2,*) Times of scan boundaries
C SSCAN I(*) source number for each scan
C IRET I error code
C-----------------------------------------------------------------------
INTEGER DISK, CNO, CATBLK(256), ISUB, BUFFER(*), NOSCAN,
* SSCAN(*), IRET
REAL TSCAN(2,*)
C
INCLUDE 'INCS:PUVD.INC'
INTEGER VER, INXRNO, NXKOLS(MAXNXC), NXNUMV(MAXNXC), LUN,
* LUNTMP, IDSOUR, SUBARR, VSTART, VEND, FREQID, NROW, IROW
REAL TIME, DTIME
INCLUDE 'INCS:DMSG.INC'
C-----------------------------------------------------------------------
VER = 1
LUN = LUNTMP (1)
CALL NDXINI ('READ', BUFFER, DISK, CNO, VER, CATBLK, LUN, INXRNO,
* NXKOLS, NXNUMV, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'OPENING INDEX TABLE'
GO TO 900
END IF
NROW = BUFFER(5)
NOSCAN = 0
DO 100 IROW = 1,NROW
CALL TABNDX ('READ', BUFFER, INXRNO, NXKOLS, NXNUMV, TIME,
* DTIME, IDSOUR, SUBARR, VSTART, VEND, FREQID, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING INDEX TABLE'
GO TO 900
END IF
IF ((ISUB.LE.0) .OR. (SUBARR.LE.0) .OR. (ISUB.EQ.SUBARR)) THEN
NOSCAN = NOSCAN + 1
TSCAN(1,NOSCAN) = TIME - 0.5 * DTIME
TSCAN(2,NOSCAN) = TIME + 0.5 * DTIME
SSCAN(NOSCAN) = IDSOUR
END IF
100 CONTINUE
C
900 IF (IRET.NE.0) THEN
CALL MSGWRT (6)
NOSCAN = 0
END IF
CALL TABNDX ('CLOS', BUFFER, INXRNO, NXKOLS, NXNUMV, TIME, DTIME,
* IDSOUR, SUBARR, VSTART, VEND, FREQID, IROW)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('GETNX ERROR',I4,' ON ',A)
END
SUBROUTINE TXINIT (IRET)
C-----------------------------------------------------------------------
C TXINIT write the text file header for VLAMP
C Inputs from COMMON:
C TXLUN I LUN for text file
C TXIND I file pointer for text file
C Outputs:
C IRET I > 0 => fatal error
C-----------------------------------------------------------------------
INTEGER IRET
C
CHARACTER OLINE*132, OBS*8, DATEOB*8, CT1*12, CT2*12, SBC*1,
* POLC(2)*3
INTEGER JT, JTRIM, LUN, LUNTMP, LF, IP, J, IP0
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:DSOU.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'INCS:DUVH.INC'
DATA POLC /'RCP','LCP'/
C-----------------------------------------------------------------------
C date header
CALL VLDATE (OLINE)
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! '
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
C Tsys
OLINE = '! ----- Tsys information for Y -----'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! This section can be read by ANTAB in AIPS'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! System temperatures are given in channel order' //
* ' left to right'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! followed by min and max number antennas' //
* ' contributing to the averages'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! A system temperature of 999.9 indicates a bad' //
* ' data point.'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! Times are in UT'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! Scan headings are Station id, observer, Source, ' //
* 'calcode, and scan time range'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! "Channel" header: Chan Pol SB CentFreq Tcal(ant 1)' //
* ' band'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
C first scan source
JT = SRCNX(1)
LUN = LUNTMP (1)
CALL GETSOU (JT, DISKIN, OLDCNO, CATBLK, LUN, IRET)
IF (IRET.EQ.11) THEN
SNAME = '????????'
WRITE (MSGTXT,1000) CURSOU
CALL MSGWRT (6)
ELSE IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING SOURCE INFORMATION'
CALL MSGWRT (8)
GO TO 999
END IF
CALL H2CHR (8, 1, CATH(KHOBS), OBS)
CALL H2CHR (8, 1, CATH(KHDOB), DATEOB)
JT = JTRIM (SNAME)
JT = MAX (JT, 8)
CALL TFORMF (DATEOB, TIMENX(1,1), CT1)
CALL TFORMF (DATEOB, TIMENX(2,1), CT2)
WRITE (OLINE,1010) OBS, SNAME(:JT), CALCOD, CT1, CT2
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
C frequencies
IF (CATD(KDCRV+JLOCS).EQ.-1.0D0) THEN
IP0 = 0
ELSE
IP0 = 1
END IF
J = 0
WRITE (OLINE,1019) CENCH
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
DO 30 LF = 1,NIF
DO 20 IP = 1,NPOL
J = J + 1
IF (ISBAND(LF).GE.0) THEN
SBC = 'U'
ELSE
SBC = 'L'
END IF
WRITE (OLINE,1020) J, POLC(IP+IP0), SBC, FOFF(LF)*1.D3,
* TCAL(IP,LF,1), BANDC(:2)
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
20 CONTINUE
30 CONTINUE
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = 'TSYS timeoff = 0.0 Y FT = 1.0/'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
GO TO 999
C
990 WRITE (MSGTXT,1990) IRET, 'WRITING OUTPUT TEXT FILE'
CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('TXINIT: SOURCE ID',I8,' NOT RECOGNIZED')
1010 FORMAT ('! Y ',A8,' ''',A,'''/''',A4,''' ',A,'/',A)
1019 FORMAT ('!!! Frequencies are for spectral channel',F9.2)
1020 FORMAT ('! ',I3,1X,A3,1X,A1,F10.2,'MHz',F7.2,2X,A2)
1990 FORMAT ('TXINIT: ERROR',I4,' ON ',A)
END
SUBROUTINE VLDATE (OLINE)
C-----------------------------------------------------------------------
C VLDATE processes the date information to make an output string
C Outputs:
C OLINE C*(*) Date information
C-----------------------------------------------------------------------
CHARACTER OLINE*(*)
C
INTEGER IDATE(3,2), ITIME(4,2), DAYN(2), I, J, K, DAYMTH(12,2)
REAL TT(2)
CHARACTER DTEMP*8, MONTH(12)*3
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:DHDR.INC'
DATA DAYMTH /31,28,31,30,31,30,31,31,30,31,30,31,
* 31,29,31,30,31,30,31,31,30,31,30,31/
DATA MONTH /'JAN','FEB','MAR','APR','MAY','JUN','JUL',
* 'AUG','SEP','OCT','NOV','DEC'/
C-----------------------------------------------------------------------
TT(1) = TIMENX(1,1)
TT(2) = TIMENX(2,MAXNX)
C figure out dates
DO 50 I = 1,2
CALL H2CHR (8, 1, CATH(KHDOB), DTEMP)
CALL DATEST (DTEMP, IDATE(1,I))
CALL DAYNUM (IDATE(1,I), IDATE(3,I), IDATE(2,I), DAYN(I))
C next day(s)?
J = TT(I)
IF (J.GT.0) THEN
DAYN(I) = DAYN(I) + J
IDATE(3,I) = IDATE(3,I) + J
TT(I) = TT(I) - J
20 IF (MOD(IDATE(1,I),4).EQ.0) THEN
K = 2
ELSE
K = 1
END IF
C next month?
IF (IDATE(3,I).GT.DAYMTH(IDATE(2,I),K)) THEN
IDATE(3,I) = IDATE(3,I) - DAYMTH(IDATE(2,I),K)
IDATE(2,I) = IDATE(2,I) + 1
C year?
IF (IDATE(2,I).GT.12) THEN
IDATE(2,I) = IDATE(2,I)- 12
IDATE(1,I) = IDATE(1,I) + 1
DAYN(I) = DAYN(I) - 364 - K
END IF
GO TO 20
END IF
END IF
C times
CALL TODHMS (TT(I), ITIME(1,I))
50 CONTINUE
C format
WRITE (OLINE,1050) IDATE(1,1), MONTH(IDATE(2,1)), IDATE(3,1),
* DAYN(1), ITIME(2,1), ITIME(3,1), ITIME(4,1), IDATE(1,2),
* MONTH(IDATE(2,2)), IDATE(3,2), DAYN(2), ITIME(2,2), ITIME(3,2),
* ITIME(4,2)
C
999 RETURN
C-----------------------------------------------------------------------
1050 FORMAT ('! For UT timerange: ',I4,A3,I2.2,'/',I3.3,' at ',
* 2(I2.2,':'),I2.2,' to ',I4,A3,I2.2,'/',I3.3,' at ',2(I2.2,':'),
* I2.2)
END
SUBROUTINE TFORMF (DATEOB, TIME, CT)
C-----------------------------------------------------------------------
C TFORMF formats the time as day number in year, HH MM SS
C Inputs:
C DATEOB C*8 Date of observation in header
C TIME R Time in hours wrt to date obs
C Outputs:
C CT C*12 DDD HH:MM:SS
C-----------------------------------------------------------------------
CHARACTER DATEOB*8, CT*(*)
REAL TIME
C
INTEGER ITT(4), DNUM
C-----------------------------------------------------------------------
CALL DATEST (DATEOB, ITT)
CALL DAYNUM (ITT(1), ITT(3), ITT(2), DNUM)
CALL TODHMS (TIME, ITT)
ITT(1) = ITT(1) + DNUM
WRITE (CT,1000) ITT
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT (I3.3,'-',I2.2,2(':',I2.2))
END
SUBROUTINE VLAMPD (IRET)
C-----------------------------------------------------------------------
C VLAMPD reads through the CL table, for each time it finds the SY
C table values which apply, and writes the T_pa(t).
C Outputs:
C IRET I > 0 => failure
C-----------------------------------------------------------------------
INTEGER IRET
C
INCLUDE 'TYTABS.INC'
INCLUDE 'VLAMP.INC'
INTEGER CLMAX, IP, LIF, I, NS, J, DATP(128,2), LRNO, NROW, KOL,
* RTYPE, NSMIN, NSMAX, IROW, CNT(MAXIF,MAXANT,4)
REAL SUM, VAL(2*MAXIF), T, SENS(MAXIF), SUM1, SUM2
LOGICAL DOSOUR
CHARACTER KEY*8
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DDCH.INC'
C-----------------------------------------------------------------------
CLMAX = CLBUFF(5)
ICLRNO = 0
I = MAXANT*MAXIF*4
CALL FILL (I, 0, CNT)
10 IF (ICLRNO.LT.CLMAX) THEN
CALL GETCLV (T, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'GETTING CL VALUES FROM GETCLV'
GO TO 990
END IF
DOSOUR = CURSOU.NE.LSTSOU
CALL GETSYV (T, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'GETTING SY VALUES FROM GETSY'
GO TO 990
END IF
J = 0
NSMIN = NANT + 1
NSMAX = 0
DO 50 LIF = 1,NIF
DO 40 IP = 1,NPOL
SUM = 0.0
NS = 0
DO 30 I = 1,NANT
IF ((CLAMPS(IP,LIF,I).NE.FBLANK) .AND.
* (PSYS(IP,LIF,I).NE.FBLANK) .AND.
* (CLAMPS(IP,LIF,I).GT.0.0) .AND.
* (PSYS(IP,LIF,I).GT.0.0)) THEN
NS = NS + 1
C CLAMPS is squared gain
SUM = SUM + 1.0 / (CLAMPS(IP,LIF,I) *
* PSYS(IP,LIF,I))
CNT(LIF,I,IP) = CNT(LIF,I,IP) + 1
END IF
30 CONTINUE
J = J + 1
NSMIN = MIN (NS, NSMIN)
NSMAX = MAX (NS, NSMAX)
IF (NS.GT.0) THEN
VAL(J) = NS / SUM
ELSE
VAL(J) = 999.90
END IF
40 CONTINUE
50 CONTINUE
C output values
CALL TXOUTS (DOSOUR, T, J, VAL, NSMIN, NSMAX, IRET)
GO TO 10
END IF
C close CL, SY
CALL TABIO ('CLOS', 0, ISYRNO, BUFF2, SYBUFF, I)
CALL TABIO ('CLOS', 0, ICLRNO, BUFF2, CLBUFF, I)
C polarization 1
C estimate # antennas
CALL RFILL (2*NIF, 0.0, VAL)
DO 120 LIF = 1,NIF
J = LIF + NIF
DO 100 I = 1,NANT
IF (CNT(LIF,I,1).GT.0) VAL(J) = VAL(J) + 1.0
100 CONTINUE
120 CONTINUE
CALL FILL (MAXIF, 0, CNT)
KEY = 'SENS_1'
CALL FNDCOL (1, KEY, 8, .TRUE., GCBUFF, KOL, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'FINDING SENS_1 COLUMN IN GC TABLE'
GO TO 990
END IF
NROW = GCBUFF(5)
CALL ZFIO ('READ', GCBUFF(81), GCBUFF(82), GCBUFF(45), DATP, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING GC TABLE FOR DATP'
GO TO 990
END IF
DO 140 IROW = 1,NROW
CALL GETCOL (IROW, KOL, DATP, LRNO, GCBUFF, RTYPE, SENS,
* BUFF2, IRET)
IF (IRET.GT.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING GC TABLE WITH GETCOL'
GO TO 990
ELSE IF (IRET.EQ.0) THEN
DO 130 LIF = 1,NIF
J = LIF + NIF
IF ((VAL(J).GT.0.0) .AND. (SENS(LIF).NE.FBLANK) .AND.
* (SENS(LIF).GT.0.0)) THEN
VAL(LIF) = VAL(LIF) + SENS(LIF)
CNT(LIF,1,1) = CNT(LIF,1,1) + 1
END IF
130 CONTINUE
END IF
140 CONTINUE
T = 0.0
SUM1 = 0.0
DO 150 LIF = 1,NIF
IF (CNT(LIF,1,1).GT.0) THEN
VAL(LIF) = VAL(LIF) * VAL(LIF+NIF) / CNT(LIF,1,1)
SUM1 = SUM1 + VAL(LIF)
T = T + 1.0
END IF
150 CONTINUE
IF (T.GT.0.0) SUM1 = SUM1 / T
C polarization 2
SUM2 = 0.0
IF (NPOL.GT.1) THEN
C estimate # antennas
CALL RFILL (2*NIF, 0.0, VAL)
DO 220 LIF = 1,NIF
J = LIF + NIF
DO 200 I = 1,NANT
IF (CNT(LIF,I,2).GT.0) VAL(J) = VAL(J) + 1.0
200 CONTINUE
220 CONTINUE
CALL FILL (MAXIF, 0, CNT)
KEY = 'SENS_2'
CALL FNDCOL (1, KEY, 8, .TRUE., GCBUFF, KOL, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET,
* 'FINDING SENS_2 COLUMN IN GC TABLE'
GO TO 990
END IF
NROW = GCBUFF(5)
CALL ZFIO ('READ', GCBUFF(81), GCBUFF(82), GCBUFF(45), DATP,
* IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING GC TABLE FOR DATP'
GO TO 990
END IF
DO 240 IROW = 1,NROW
CALL GETCOL (IROW, KOL, DATP, LRNO, GCBUFF, RTYPE, SENS,
* BUFF2, IRET)
IF (IRET.GT.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING GC TABLE WITH GETCOL'
GO TO 990
ELSE IF (IRET.EQ.0) THEN
DO 230 LIF = 1,NIF
J = LIF + NIF
IF ((VAL(J).GT.0.0) .AND. (SENS(LIF).NE.FBLANK) .AND.
* (SENS(LIF).GT.0.0)) THEN
VAL(LIF) = VAL(LIF) + SENS(LIF)
CNT(LIF,1,1) = CNT(LIF,1,1) + 1
END IF
230 CONTINUE
END IF
240 CONTINUE
T = 0.0
SUM2 = 0.0
DO 250 LIF = 1,NIF
IF (CNT(LIF,1,1).GT.0) THEN
VAL(LIF) = VAL(LIF) * VAL(LIF+NIF) / CNT(LIF,1,1)
SUM2 = SUM2 + VAL(LIF)
T = T + 1.0
END IF
250 CONTINUE
CALL TABIO ('CLOS', 0, IGCRNO, BUFF2, GCBUFF, I)
IF (T.GT.0.0) SUM2 = SUM2 / T
END IF
C write GC information
CALL TXSENS (SUM1, SUM2, IRET)
GO TO 999
C
990 CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('VLAMPD: ERROR',I5,' ON ',A)
END
SUBROUTINE TXSENS (VAL1, VAL2, IRET)
C-----------------------------------------------------------------------
C TXSENS write the text file sensitivity line
C Inputs:
C VAL R value
C Outputs:
C IRET I error code
C-----------------------------------------------------------------------
INTEGER IRET
REAL VAL1, VAL2
C
INCLUDE 'VLAMP.INC'
INTEGER JT, JTRIM, I
CHARACTER OLINE*132
C----------------------------------------------------------------------
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '/'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '! ----- Gain information for Y -----'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
C data line
IF (NPOL.LT.2) THEN
WRITE (OLINE,1000) VAL1
ELSE
WRITE (OLINE,1001) VAL1, VAL2
END IF
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
WRITE (OLINE,1010)
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
WRITE (OLINE,1020) BANDC(:JTRIM(BANDC))
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
GO TO 995
C
990 WRITE (MSGTXT,1990) IRET, 'WRITING GC VALUES TO TEXT FILE'
CALL MSGWRT (8)
C
995 CALL ZTXCLS (TXLUN, TXIND, I)
TXIND = -1
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('Y GAIN ALTAZ DPFU=',F8.4)
1001 FORMAT ('Y GAIN ALTAZ DPFU=',F8.4,' ,',F8.4)
1010 FORMAT (' POLY = 1.0 /')
1020 FORMAT ('! BAND = ''',A,'''')
1990 FORMAT ('TXSENS ERROR',I4,' ON ',A)
END
SUBROUTINE TXOUTS (DOSOUR, TIME, NVAL, VALS, NMIN, NMAX, IRET)
C-----------------------------------------------------------------------
C TXOUTS outputs the data values perhaps preceded by a scan line
C Inputs:
C DOSOUR L T => do scan lines
C TIME R Time of observation
C NVAL I Number of values
C VALS R(*) Values to output
C NMIN I Minimum # values in average
C NMAX I Maximum # values in average
C Outputs:
C IRET I > 0 => fatal error
C-----------------------------------------------------------------------
LOGICAL DOSOUR
REAL TIME, VALS(*)
INTEGER NVAL, NMIN, NMAX, IRET
C
CHARACTER OLINE*1100, OBS*8, DATEOB*8, CT1*12, CT2*12
INTEGER JT, JTRIM, I
REAL TEPS
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:DSOU.INC'
INCLUDE 'INCS:DHDR.INC'
C-----------------------------------------------------------------------
IF (DOSOUR) THEN
OLINE = '!'
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
C find scan
TEPS = -5.0 / (24.0 * 3600.0)
DO 10 CURNX = 1,MAXNX
IF (CURSOU.EQ.SRCNX(CURNX)) THEN
IF ((TIME-TIMENX(1,CURNX).GE.TEPS) .AND.
* (TIMENX(2,CURNX)-TIME.GE.TEPS)) GO TO 20
END IF
10 CONTINUE
WRITE (MSGTXT,1010) CURSOU, TIME
CALL MSGWRT (6)
20 CALL H2CHR (8, 1, CATH(KHOBS), OBS)
CALL H2CHR (8, 1, CATH(KHDOB), DATEOB)
JT = JTRIM (SNAME)
JT = MAX (JT, 8)
IF (CURNX.LE.MAXNX) THEN
CALL TFORMF (DATEOB, TIMENX(1,CURNX), CT1)
CALL TFORMF (DATEOB, TIMENX(2,CURNX), CT2)
ELSE
CALL TFORMF (DATEOB, TIME, CT1)
CALL TFORMF (DATEOB, TIME, CT2)
END IF
WRITE (OLINE,1020) OBS, SNAME(:JT), CALCOD, CT1, CT2
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
END IF
C data line
CALL TFORMD (DATEOB, TIME, OLINE)
WRITE (OLINE(14:),1030) (VALS(I), I = 1,NVAL)
JT = JTRIM (OLINE)
WRITE (OLINE(JT+1:),1031) NMIN, NMAX
JT = JTRIM (OLINE)
CALL ZTXIO ('WRITE', TXLUN, TXIND, OLINE(:JT), IRET)
IF (IRET.NE.0) GO TO 990
GO TO 999
C
990 WRITE (MSGTXT,1990) IRET, 'WRITING OUTPUT TEXT FILE'
CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1010 FORMAT ('TXOUTS: CANNOT FIND SOURCE',I4,' AT',F10.6)
1020 FORMAT ('! Y ',A8,' ''',A,'''/''',A4,''' ',A,'/',A)
1030 FORMAT (180F6.1)
1031 FORMAT (' !',I3,'-',I2)
1990 FORMAT ('TXINIT: ERROR',I4,' ON ',A)
END
SUBROUTINE TFORMD (DATEOB, TIME, CT)
C-----------------------------------------------------------------------
C TFORMF formats the time as day number in year, HH MM SS
C Inputs:
C DATEOB C*8 Date of observation in header
C TIME R Time in hours wrt to date obs
C Outputs:
C CT C*12 DDD HH:MM:SS
C-----------------------------------------------------------------------
CHARACTER DATEOB*8, CT*(*)
REAL TIME
C
INTEGER ITT(4), DNUM
REAL TEMP
C-----------------------------------------------------------------------
CALL DATEST (DATEOB, ITT)
CALL DAYNUM (ITT(1), ITT(3), ITT(2), DNUM)
CALL TODHMS (TIME, ITT)
TEMP = TIME
ITT(1) = TEMP
TEMP = (TEMP - ITT(1)) * 24.0
ITT(2) = TEMP
TEMP = (TEMP - ITT(2)) * 60.0
ITT(1) = ITT(1) + DNUM
WRITE (CT,1000) ITT(1), ITT(2), TEMP
IF (CT(8:8).EQ.' ') CT(8:8) = '0'
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT (I3.3,1X,I2.2,':',F6.3)
END
SUBROUTINE VLAMPH
C-----------------------------------------------------------------------
C VLAMPH copies and updates history file. It also copies any tables.
C-----------------------------------------------------------------------
CHARACTER HILINE*72
INTEGER LUN, IERR, JTRIM, J
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DFIL.INC'
INCLUDE 'INCS:DHIS.INC'
INCLUDE 'INCS:DCAT.INC'
INCLUDE 'INCS:DDCH.INC'
DATA LUN /27/
C-----------------------------------------------------------------------
C Write History.
CALL HIINIT (3)
C output file written
CALL HIOPEN (LUN, DISKIN, OLDCNO, IBUFF2, IERR)
IF (IERR.GT.0) THEN
WRITE (MSGTXT,1000) IERR, 'OPEN OLD HISTORY FILE'
CALL MSGWRT (6)
GO TO 100
END IF
C versions applied
WRITE (HILINE,1010) TSKNAM, ISYVER
CALL HIADD (LUN, HILINE, IBUFF2, IERR)
IF (IERR.NE.0) GO TO 100
WRITE (HILINE,1011) TSKNAM, ICLVER
CALL HIADD (LUN, HILINE, IBUFF2, IERR)
IF (IERR.NE.0) GO TO 100
WRITE (HILINE,1012) TSKNAM, IGCVER
CALL HIADD (LUN, HILINE, IBUFF2, IERR)
IF (IERR.NE.0) GO TO 100
IF (FGVER.GT.0) THEN
WRITE (HILINE,1015) TSKNAM, FGVER
CALL HIADD (LUN, HILINE, IBUFF2, IERR)
IF (IERR.NE.0) GO TO 100
END IF
C output file
J = JTRIM (CALOUT)
WRITE (HILINE,1020) TSKNAM, CALOUT(:J)
CALL HIADD (LUN, HILINE, IBUFF2, IERR)
IF (IERR.NE.0) GO TO 100
C Close HI file
100 CALL HICLOS (LUN, .TRUE., IBUFF2, IERR)
C Copy tables
CALL CATIO ('UPDT', DISKIN, OLDCNO, CATBLK, 'REST', SCRBUF, IERR)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('VLAMPH: ERROR',I3,' COPY/OPEN HISTORY FILE')
1010 FORMAT (A6,'INVERS =',I5,5X,'/ SY file version')
1011 FORMAT (A6,'GAINVER =',I5,5X,'/ CL file version')
1012 FORMAT (A6,'IN2VERS =',I5,5X,'/ GC file version')
1015 FORMAT (A6,'FLAGVER =',I5,5X,'/ Flag file version applied to SY')
1020 FORMAT (A6,'OUTTEXT =''',A,'''')
END
SUBROUTINE GETSYV (T, IRET)
C-----------------------------------------------------------------------
C GETSYV fills in the set of SY values for nominal sensitivities.
C It then computes PSYS for time T.
C Inputs:
C T R New time
C Outputs:
C IRET I IO error in SY reads
C Assumes that CURSOU, SUBARR, FRQSEL are set to apply to the current
C data.
C-----------------------------------------------------------------------
REAL T
INTEGER IRET
C
INCLUDE 'INCS:PUVD.INC'
INCLUDE 'VLAMP.INC'
INCLUDE 'TYTABS.INC'
INTEGER I, J, RNOMAX, SOURID, ANTNO, SUBA, FREQID, INEED, IA,
* INRNO, SYRNO, II, CALTYP
REAL TIMEI, PDIF(2,MAXIF), PSUM(2,MAXIF), PGAIN(2,MAXIF),
* TEPS, TINY, TENSEC, F1
DOUBLE PRECISION TIME
LOGICAL NEWSOU, NEED, ANEED(MAXANT)
INCLUDE 'INCS:DDCH.INC'
INCLUDE 'INCS:DMSG.INC'
SAVE SYRNO
DATA SYRNO /1/
C-----------------------------------------------------------------------
C remove nom sens
IF (ISYVER.GT.0) THEN
NEWSOU = CURSOU.NE.LSTSOU
IF (NEWSOU) THEN
NEED = .TRUE.
INEED = NANT
CALL LFILL (MAXANT, .TRUE., ANEED)
CALL RFILL (MAXANT, 1.E5, T1A)
DO 5 ANTNO = 1,NANT
IF (ANTOK(ANTNO).LE.0) ANEED(ANTNO) = .FALSE.
5 CONTINUE
CALL RFILL (MAXANT, -1.E5, T1B)
I = 2 * MAXANT * MAXIF
CALL RFILL (I, FBLANK, TS1A)
CALL RFILL (I, FBLANK, TS1B)
ELSE
I = 2 * MAXIF
NEED = .FALSE.
INEED = 0
CALL LFILL (MAXANT, .FALSE., ANEED)
DO 10 ANTNO = 1,NANT
IF (T.GT.T1B(ANTNO)) THEN
NEED = .TRUE.
ANEED(ANTNO) = .TRUE.
INEED = INEED + 1
T1A(ANTNO) = T1B(ANTNO)
CALL RCOPY (I, TS1B(1,1,ANTNO), TS1A(1,1,ANTNO))
END IF
10 CONTINUE
END IF
END IF
IF ((ISYVER.GT.0) .AND. (NEED)) THEN
RNOMAX = SYBUFF(5)
20 IRET = 999
IF (SYRNO.LE.RNOMAX) CALL TABSY ('READ', SYBUFF, SYRNO,
* SYKOLS, SYNUMV, NPOL, NIF, TIME, TIMEI, CALTYP, SOURID,
* ANTNO, SUBA, FREQID, PDIF, PSUM, PGAIN, IRET)
IF (IRET.EQ.0) THEN
IF ((SUBA.GT.0) .AND. (SUBARR.GT.0) .AND. (SUBA.NE.SUBARR))
* GO TO 20
IF ((FREQID.GT.0) .AND. (FRQSEL.GT.0) .AND.
* (FREQID.NE.FRQSEL)) GO TO 20
C record useful
IF ((SOURID.LE.0) .OR. (CURSOU.LE.0) .OR.
* (SOURID.EQ.CURSOU)) THEN
IF (T.GT.T1B(ANTNO)) THEN
C convert units, check
DO 30 I = 1,NIF
DO 25 J = 1,2
IF ((PDIF(J,I).EQ.FBLANK) .OR.
* (PSUM(J,I).EQ.FBLANK) .OR.
* (TCAL(J,I,ANTNO).EQ.FBLANK) .OR.
* (PGAIN(J,I).LE.0.0) .OR. (PDIF(J,I).LE.0.0)
* .OR. PSUM(J,I).LE.PDIF(J,I)) THEN
PDIF(J,I) = FBLANK
PSUM(J,I) = FBLANK
PGAIN(J,I) = FBLANK
ELSE
PSUM(J,I) = PSUM(J,I) * TCAL(J,I,ANTNO) / 2.0
* / PDIF(J,I)
PDIF(J,I) = PDIF(J,I) / TCAL(J,I,ANTNO)
END IF
25 CONTINUE
30 CONTINUE
C keep as first time
I = 2 * NIF
IF ((T1A(ANTNO).GT.1.E4) .OR.
* ((TIME.GT.T1A(ANTNO)) .AND. (T.GE.TIME))) THEN
T1A(ANTNO) = TIME
CALL RCOPY (I, PSUM, TS1A(1,1,ANTNO))
TRECA(ANTNO) = SYRNO-1
END IF
C keep as second time
IF (T.GT.T1B(ANTNO)) THEN
T1B(ANTNO) = TIME
CALL RCOPY (I, PSUM, TS1B(1,1,ANTNO))
TRECB(ANTNO) = SYRNO-1
IF ((T.GE.T1A(ANTNO)) .AND. (T.LE.T1B(ANTNO)) .AND.
* (ANEED(ANTNO))) THEN
ANEED(ANTNO) = .FALSE.
INEED = INEED - 1
END IF
END IF
GO TO 20
ELSE
SYRNO = SYRNO - 1
END IF
C another source
ELSE
IF (TIME.LT.T) GO TO 20
SYRNO = SYRNO - 1
END IF
C error
ELSE
IF (IRET.NE.999) GO TO 999
IRET = 0
END IF
C check for missing antennas
IF (INEED.GT.0) THEN
DO 90 IA = 1,NANT
C the antenna has occurred
IF (((TRECA(IA).GT.0) .OR. (TRECB(IA).GT.0)) .AND.
* (ANEED(IA)) .AND. (ANTOK(IA).GT.0)) THEN
INRNO = MIN (TRECA(IA), TRECB(IA)) + 1
INRNO = MAX (INRNO, 1)
DO 80 II = INRNO,RNOMAX
SYRNO = II
CALL TABSY ('READ', SYBUFF, SYRNO, SYKOLS, SYNUMV,
* NPOL, NIF, TIME, TIMEI, CALTYP, SOURID, ANTNO,
* SUBA, FREQID, PDIF, PSUM, PGAIN, IRET)
IF (IRET.GT.0) GO TO 999
IF (IRET.LT.0) GO TO 80
IF (ANTNO.NE.IA) GO TO 80
IF ((SUBA.GT.0) .AND. (SUBARR.GT.0) .AND.
* (SUBA.NE.SUBARR)) GO TO 80
IF ((FREQID.GT.0) .AND. (FRQSEL.GT.0) .AND.
* (FREQID.NE.FRQSEL)) GO TO 80
C record useful
IF ((SOURID.GT.0) .AND. (CURSOU.GT.0) .AND.
* (SOURID.NE.CURSOU)) GO TO 80
C convert units, check
DO 50 I = 1,NIF
DO 45 J = 1,2
IF ((PDIF(J,I).EQ.FBLANK) .OR.
* (PSUM(J,I).EQ.FBLANK) .OR.
* (TCAL(J,I,ANTNO).EQ.FBLANK) .OR.
* (PGAIN(J,I).EQ.FBLANK) .OR.
* (PGAIN(J,I).LE.0.0) .OR.
* (PDIF(J,I).LE.0.0).OR.
* (PSUM(J,I).LE.PDIF(J,I))) THEN
PDIF(J,I) = FBLANK
PSUM(J,I) = FBLANK
PGAIN(J,I) = FBLANK
ELSE
PSUM(J,I) = PSUM(J,I) * TCAL(J,I,ANTNO) /
* 2.0 / PDIF(J,I)
PDIF(J,I) = PDIF(J,I) / TCAL(J,I,ANTNO)
END IF
45 CONTINUE
50 CONTINUE
C keep as first time
I = 2 * NIF
IF ((T1A(ANTNO).GT.1.E4) .OR.
* ((TIME.GT.T1A(ANTNO)) .AND. (T.GE.TIME))) THEN
T1A(ANTNO) = TIME
CALL RCOPY (I, PSUM, TS1A(1,1,ANTNO))
TRECA(ANTNO) = SYRNO-1
END IF
C keep as second time
IF (T.GT.T1B(ANTNO)) THEN
T1B(ANTNO) = TIME
CALL RCOPY (I, PSUM, TS1B(1,1,ANTNO))
TRECB(ANTNO) = SYRNO-1
IF ((T.GE.T1A(ANTNO)) .AND. (T.LE.T1B(ANTNO))
* .AND. (ANEED(ANTNO))) THEN
ANEED(ANTNO) = .FALSE.
INEED = INEED - 1
GO TO 90
END IF
ELSE
IF (TIME.GT.T1B(ANTNO)) GO TO 90
END IF
80 CONTINUE
ELSE
IF (ANEED(IA)) INEED = INEED - 1
END IF
90 CONTINUE
END IF
END IF
LSTSOU = CURSOU
C Now find the system temperatures
TENSEC = 10.1 / (24.0 * 3600.0)
TINY = MAX (TENSEC / 100.0, TIMEI/2.0)
DO 200 IA = 1,NANT
C check times again
TEPS = MIN (6.*TENSEC, MAX (TENSEC, T1B(IA)-T1A(IA)))
IF (ANTOK(IA).GT.0) THEN
IF ((T.LT.T1A(IA)-TINY) .OR. (T.GT.T1B(IA)+TINY)) THEN
EXTRAP = EXTRAP + 1
IF ((T.LT.T1A(IA)-TEPS) .OR. (T.GT.T1B(IA)+TEPS)) THEN
IF (NMSG.LT.100) THEN
WRITE (MSGTXT,1000) T, IA, T1A(IA), T1B(IA)
CALL MSGWRT (7)
NMSG = NMSG + 1
END IF
END IF
END IF
END IF
F1 = 0.0
IF (T1A(IA).NE.T1B(IA)) F1 = (T - T1A(IA)) /
* (T1B(IA) - T1A(IA))
DO 150 I = 1,NIF
DO 140 J = 1,NPOL
IF ((TS1A(J,I,IA).NE.FBLANK) .AND.
* (TS1B(J,I,IA).NE.FBLANK)) THEN
PSYS(J,I,IA) = (1.0-F1) * TS1A(J,I,IA) +
* F1 * TS1B(J,I,IA)
ELSE IF ((TS1A(J,I,IA).NE.FBLANK) .AND. (F1.LE.0.3)) THEN
PSYS(J,I,IA) = TS1A(J,I,IA)
ELSE IF ((TS1B(J,I,IA).NE.FBLANK) .AND. (F1.GE.0.7)) THEN
PSYS(J,I,IA) = TS1B(J,I,IA)
ELSE
PSYS(J,I,IA) = FBLANK
END IF
140 CONTINUE
150 CONTINUE
200 CONTINUE
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('SY T1=',F11.6,' AN',I3,' NOT IN',2F14.6)
END
SUBROUTINE GETCLV (T, IRET)
C-----------------------------------------------------------------------
C GETCLV finds the next time in the CL table and returns that time
C in the call sequence and the CL table amplitudes in COMMON. It
C also gets source info for any new source
C Outputs:
C T R Time in days
C IRET I > 0 => error
C-----------------------------------------------------------------------
REAL T
INTEGER IRET
C
INCLUDE 'TYTABS.INC'
INCLUDE 'VLAMP.INC'
INTEGER IREC, NREC, JREC, SOURID, ANTNO, SUBA, FREQID, I, LF,
* REFA(2,MAXIF), FOUND(MAXANT), LUN, LUNTMP, IP, FREC, GOTONE
REAL TIMEI, IFR, DOPOFF(MAXIF), ATMOS(2), DATMOS(2),
* MBDELY(2), CLOCK(2), DCLOCK(2), DISP(2), DDISP(2),
* CREAL(2,MAXIF), CIMAG(2,MAXIF), DELAY(2,MAXIF), RATE(2,MAXIF),
* WEIGHT(2,MAXIF)
DOUBLE PRECISION TIME, GEODLY(10), TT, DT
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DSOU.INC'
INCLUDE 'INCS:DDCH.INC'
C-----------------------------------------------------------------------
10 NREC = CLBUFF(5)
JREC = ICLRNO + 1
DT = 0.11D0 / (24.0D0 * 3600.0D0)
FREC = 0
DO 100 IREC = JREC,NREC
ICLRNO = IREC
CALL TABCAL ('READ', CLBUFF, ICLRNO, CLKOLS, CLNUMV, NPOL,
* NIF, TIME, TIMEI, SOURID, ANTNO, SUBA, FREQID, IFR,
* GEODLY, DOPOFF, ATMOS, DATMOS, MBDELY, CLOCK, DCLOCK, DISP,
* DDISP, CREAL, CIMAG, DELAY, RATE, WEIGHT, REFA, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING OLD CL TABLE'
GO TO 990
END IF
C match ?
IF ((SUBARR.GT.0) .AND. (SUBA.GT.0) .AND. (SUBARR.NE.SUBA))
* GO TO 100
IF ((FRQSEL.GT.0) .AND. (FREQID.GT.0) .AND. (FRQSEL.NE.FREQID))
* GO TO 100
C first in this group
IF (FREC.LE.0) THEN
FREC = IREC
TT = TIME
T = TIME
I = 2 * MAXIF * NANT
CALL RFILL (I, FBLANK, CLAMPS)
CALL FILL (NANT, 0, FOUND)
GOTONE = -1
CURSOU = SOURID
IF (CURSOU.NE.LSTSOU) THEN
LUN = LUNTMP (1)
CALL GETSOU (CURSOU, DISKIN, OLDCNO, CATBLK, LUN, IRET)
IF (IRET.EQ.11) THEN
SNAME = '????????'
WRITE (MSGTXT,1010) CURSOU
CALL MSGWRT (6)
ELSE IF (IRET.NE.0) THEN
WRITE (MSGTXT,1000) IRET, 'READING SOURCE INFORMATION'
GO TO 990
END IF
END IF
C are we done?
ELSE
IF (TIME-TT.GT.DT) THEN
ICLRNO = IREC - 1
GO TO 999
END IF
IF (SOURID.NE.CURSOU) THEN
WRITE (MSGTXT,1015) SOURID, CURSOU
ICLRNO = IREC - 1
GO TO 990
END IF
IF (FOUND(ANTNO).GT.0) THEN
WRITE (MSGTXT,1020) ANTNO
ICLRNO = IREC - 1
GO TO 990
END IF
END IF
C not done save data
DO 50 LF = 1,NIF
DO 40 IP = 1,NPOL
IF ((CREAL(IP,LF).NE.FBLANK) .AND.
* (CIMAG(IP,LF).NE.FBLANK)) THEN
CLAMPS(IP,LF,ANTNO) = CREAL(IP,LF)**2 +
* CIMAG(IP,LF)**2
FOUND(ANTNO) = 1
GOTONE = 1
END IF
40 CONTINUE
50 CONTINUE
100 CONTINUE
IF (GOTONE.LE.0) GO TO 10
GO TO 999
C
990 CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('GETCLV: ERROR',I4,' ON ',A)
1010 FORMAT ('GETCLV: SOURCE ID',I8,' NOT RECOGNIZED')
1015 FORMAT ('GETCLV: TWO SOURCE IDS IN SAME TIME',2I8)
1020 FORMAT ('GETCLV: ANTENNA',I4,' TWO VALUES WITHIN ONE TIME')
END
SUBROUTINE VLAMPC
C-----------------------------------------------------------------------
C VLAMPC closes the text file and deletes any special SY tables
C-----------------------------------------------------------------------
C
INCLUDE 'VLAMP.INC'
INTEGER IERR, JERR
CHARACTER PHNAME*48
C-----------------------------------------------------------------------
C close text file
IF (TXIND.GT.0) THEN
CALL ZTXCLS (TXLUN, TXIND, IERR)
TXIND = -1
END IF
C delete SY table
CALL FNDEXT ('SY', CATBLK, IERR)
IF ((OSYVER.GT.ISYVER) .AND. (OSYVER.EQ.IERR)) THEN
CALL ZPHFIL ('SY', DISKIN, OLDCNO, OSYVER, PHNAME, IERR)
CALL ZDESTR (DISKIN, PHNAME, IERR)
CALL DELEXT ('SY', DISKIN, OLDCNO, 'WRWR', CATBLK, SCRBUF,
* OSYVER, JERR)
IF ((IERR.NE.0) .OR. (JERR.NE.0)) THEN
WRITE (MSGTXT,1000) IERR, 'DELETING FLAGGED SY TABLE'
IF (IERR.GT.0) CALL MSGWRT (7)
WRITE (MSGTXT,1000) JERR, 'REMOVING FLAGGED SY TABLE' //
* ' FROM HEADER'
IF (JERR.GT.0) CALL MSGWRT (7)
ELSE
WRITE (MSGTXT,1010) OSYVER
CALL MSGWRT (2)
END IF
END IF
C
999 RETURN
C-----------------------------------------------------------------------
1000 FORMAT ('VLAMPC: ERROR',I4,' ON ',A)
1010 FORMAT ('VLAMPC deleted flagged SY table version',I4)
END
SUBROUTINE SYFSEL (DISK, CNO, IVER, OVER, CATBLK, BUFFER, OBUFF,
* IRET)
C-----------------------------------------------------------------------
C Copies an SY table applying data flags
C Inputs:
C DISKI I Input volume number
C CNOI I Input catalog number
C IVER I Version to check/modify
C OVER I output version
C CATBLK I(256) Input/output catalog header
C Input/Output:
C BUFFER I(*) Work buffer
C OBUFF I(*) Work buffer
C Output:
C IRET I Error, 0 => OK
C-----------------------------------------------------------------------
INTEGER DISK, CNO, IVER, CATBLK(256), BUFFER(*), OBUFF(*), IRET
C
INCLUDE 'INCS:PUVD.INC'
INTEGER MAXSYC
PARAMETER (MAXSYC=13)
C
INTEGER ISYRNO, SYKOLS(MAXSYC), SYNUMV(MAXSYC), NUMANT, NUMPOL,
* NUMIF, OKOLS(MAXSYC), ONUMV(MAXSYC), NSYROW, I, SOURID, ANTNO,
* SUBA, FREQID, OSYRNO, JIF, IPOL, OVER, NDEL, NTOT, JRET, NPART,
* LUNI, LUNO, LUNTMP, CALTYP
REAL PDIFF(2,MAXIF), PSUM(2,MAXIF), PGAIN(2,MAXIF), TIMEI
DOUBLE PRECISION TIME
LOGICAL REFMT, GOTONE
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DDCH.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'PUVCOP.INC'
INCLUDE 'INCS:DFLG.INC'
C-----------------------------------------------------------------------
C open flag table
TMFLST = -1.E20
NUMFLG = 0
IFGRNO = 1
NDEL = 0
NTOT = 0
NPART = 0
C Open SY file
LUNI = LUNTMP (1)
CALL SYINI ('READ', BUFFER, DISK, CNO, IVER, CATBLK, LUNI, ISYRNO,
* SYKOLS, SYNUMV, NUMANT, NUMPOL, NUMIF, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1010) IRET
GO TO 990
END IF
C # rows in old table
NSYROW = BUFFER(5)
C Open up new SY table
LUNO = LUNTMP (1)
CALL SYINI ('WRIT', OBUFF, DISK, CNO, OVER, CATBLK, LUNO,
* OSYRNO, OKOLS, ONUMV, NUMANT, NUMPOL, NUMIF, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1020) IRET
GO TO 990
END IF
C Loop and copy
DO 100 I = 1,NSYROW
CALL TABSY ('READ', BUFFER, ISYRNO, SYKOLS, SYNUMV, NUMPOL,
* NUMIF, TIME, TIMEI, CALTYP, SOURID, ANTNO, SUBA, FREQID,
* PDIFF, PSUM, PGAIN, IRET)
IF (IRET.GT.0) THEN
WRITE (MSGTXT,1030) IRET
GO TO 990
END IF
C flag info
CALL SYFLG (NUMPOL, NUMIF, TIME, SOURID, ANTNO, SUBA, FREQID,
* PDIFF, PSUM, PGAIN, NPART, JRET)
IF (JRET.GT.0) THEN
IRET = JRET
GO TO 999
END IF
GOTONE = .FALSE.
DO 90 JIF = 1,NUMIF
DO 80 IPOL = 1,NUMPOL
IF (PDIFF(IPOL,JIF).NE.FBLANK) GOTONE = .TRUE.
IF (PSUM(IPOL,JIF).NE.FBLANK) GOTONE = .TRUE.
80 CONTINUE
90 CONTINUE
IF (GOTONE) THEN
NTOT = NTOT + 1
CALL TABSY ('WRIT', OBUFF, OSYRNO, OKOLS, ONUMV, NUMPOL,
* NUMIF, TIME, TIMEI, CALTYP, SOURID, ANTNO, SUBA, FREQID,
* PDIFF, PSUM, PGAIN, IRET)
IF (IRET.NE.0) THEN
WRITE (MSGTXT,1040) IRET
GO TO 990
END IF
ELSE
REFMT = .TRUE.
END IF
100 CONTINUE
IRET = 0
C Close both tables
CALL TABIO ('CLOS', 0, ISYRNO, BUFFER, BUFFER, IRET)
CALL TABIO ('CLOS', 0, OSYRNO, OBUFF, OBUFF, IRET)
IF ((MSGSUP.LT.31990) .OR. (MSGSUP.GE.32000)) THEN
IF (REFMT) THEN
WRITE (MSGTXT,1100) 'Reformatted SY', DISK, CNO, IVER,
* OVER
ELSE
WRITE (MSGTXT,1100) 'Copied SY', DISK, CNO, IVER, OVER
END IF
CALL MSGWRT (3)
NTOT = NTOT + NDEL
WRITE (MSGTXT,1101) NDEL, NTOT
CALL REFRMT (MSGTXT, '_', I)
CALL MSGWRT (3)
WRITE (MSGTXT,1102) NPART
CALL REFRMT (MSGTXT, '_', I)
IF (NPART.GT.0) CALL MSGWRT (3)
END IF
GO TO 999
C Error
990 CALL MSGWRT (6)
C
999 RETURN
C-----------------------------------------------------------------------
1010 FORMAT ('SYFSEL: ERROR ',I3,' INITING OLD TABLE')
1020 FORMAT ('SYFSEL: ERROR ',I3,' INITING NEW TABLE')
1030 FORMAT ('SYFSEL: ERROR ',I3,' READING OLD TABLE')
1040 FORMAT ('SYFSEL: ERROR ',I3,' WRITING NEW TABLE')
1100 FORMAT (A,' file from vol/cno/vers',I3,I5,I4,' to vers',I4)
1101 FORMAT ('__Fully deleted',I10,' of',I12,' SY records applying',
* ' flag table')
1102 FORMAT ('__Partly flagged',I10,' SY records applying flag table')
END
SUBROUTINE SYFLG (NUMPOL, NUMIF, TIME, SOURID, ANTNO, SUBA,
* FREQID, PDIFF, PSUM, PGAIN, NPART, IRET)
C-----------------------------------------------------------------------
C Flags a TY table row based on the flags in FG table loaded to Common
C Inputs:
C NUMPOL I Number polarizations in TY data
C NUMIF I Number of IFs in those data
C TIME R Time of table row
C SOURID I Source number of row
C ANTNO I Antenna number of row
C SUBA I Subarray of row
C FREQID I Frequency ID if row
C In/Out:
C PDIFF R(*) Pon-Poff
C PSUM R(*) Pon+Poff
C PGAIN R(*) Post detection gains
C NPART I count of partly flagged records
C Inputs from include DSEL.INC:
C NUMFLG I Number of flagging entries.
C TMFLST R Time of last visibility for which flagging
C was checked.
C FLGSOU(*) I Source id numbers to flag, 0=all.
C FLGANT(*) I Antenna numbers to flag, 0=all.
C FLGBAS(*) I Baseline (A1*32768+A2) numbers to flag, 0=all.
C FLGSUB(*) I Subarray numbers to flag, 0=all.
C FLGFQD(*) I Freqid numbers to flag, <=0=all.
C Following should have defaults filled in.
C FLGBIF(*) I First IF to flag.
C FLGEIF(*) I Highest IF to flag.
C FLGBCH(*) I First channel to flag.
C FLGECH(*) I Highest channel to flag.
C FLGPOL(4,*)L Flags for the polarizations, should correspond
C to selected polarization types.
C Output:
C IRET I 0 -> okay, -1 -> all flagged
C-----------------------------------------------------------------------
INTEGER NUMPOL, NUMIF, SOURID, ANTNO, SUBA, FREQID, NPART, IRET
REAL PDIFF(2,*), PSUM(2,*), PGAIN(2,*)
DOUBLE PRECISION TIME
C
INTEGER IFLAG, FLGA, JPOLN, JIF, LIMF1, LIMF2, IPOLPT
REAL RTIME
LOGICAL PART
INCLUDE 'PUVCOP.INC'
INCLUDE 'INCS:DFLG.INC'
INCLUDE 'INCS:DDCH.INC'
C-----------------------------------------------------------------------
IRET = 0
RTIME = TIME
IF (TMFLST.LT.TIME) CALL NXTFLG (RTIME, .TRUE., IRET)
IF (IRET.NE.0) GO TO 999
IF (NUMFLG.LE.0) GO TO 999
PART = .FALSE.
C loop over current flags
DO 50 IFLAG = 1,NUMFLG
C Check time if needed
IF ((TIME.LT.FLGTST(IFLAG)) .OR. (TIME.GT.FLGTND(IFLAG)))
* GO TO 50
C Check source
IF ((FLGSOU(IFLAG).NE.SOURID) .AND. (FLGSOU(IFLAG).NE.0) .AND.
* (SOURID.NE.0)) GO TO 50
C Check antenna
FLGA = FLGANT(IFLAG)
IF ((FLGA.NE.0) .AND. (FLGA.NE.ANTNO)) GO TO 50
C Check subarray
IF ((FLGSUB(IFLAG).GT.0) .AND. (FLGSUB(IFLAG).NE.SUBA))
* GO TO 50
C Check freqid.: may be changed
C from input to 1 already
IF ((FLGFQD(IFLAG).GT.0) .AND. (FLGFQD(IFLAG).NE.FREQID) .AND.
* (FREQID.GT.0)) GO TO 50
C Some data to be flagged
C Set limits
LIMF1 = FLGBIF(IFLAG)
LIMF2 = FLGEIF(IFLAG)
C Loop over polarizations
IPOLPT = ABS(KCOR0) - 1
IF (IPOLPT.GT.4) IPOLPT = IPOLPT - 4
DO 40 JPOLN = 1,NUMPOL
IF (FLGPOL(JPOLN+IPOLPT,IFLAG)) THEN
PART = .TRUE.
C Loop over IF
DO 30 JIF = LIMF1,LIMF2
PDIFF(JPOLN,JIF) = FBLANK
PSUM(JPOLN,JIF) = FBLANK
PGAIN(JPOLN,JIF) = FBLANK
30 CONTINUE
END IF
40 CONTINUE
50 CONTINUE
C Check if data all flagged
IF (PART) NPART = NPART + 1
DO 70 JPOLN = 1,NUMPOL
DO 60 JIF = 1,NUMIF
IF ((PDIFF(JPOLN,JIF).NE.FBLANK) .OR.
* (PSUM(JPOLN,JIF).NE.FBLANK)) GO TO 999
60 CONTINUE
70 CONTINUE
IF (PART) NPART = NPART - 1
IRET = -1
C
999 RETURN
END
SUBROUTINE NXTFLG (TIME, TABLE, IERR)
C-----------------------------------------------------------------------
C Updates flagging tables in common fron an FG table.
C Inputs:
C TIME R Current time (days) for flag entries
C TABLE L If table true then ignore baseline dependent
C and channel dependent flags
C Inputs from common /CFMINF/(INCLUDEs C/DSEL.INC):
C NUMFLG I number of current FLAG entries.
C FGKOLS I(MAXFGC) The column pointer array in order, SOURCE,
C SUBARRAY, FREQID, ANTS, TIMERANG, IFS, CHANS,
C PFLAGS, REASON
C FGNUMV I(MAXFGC) Element count for each column
C IFGRNO I Current FLAG file record.
C Output to common /CFMINF/:
C NUMFLG I Number of flagging entries.
C TMFLST R Time of last visibility for which flagging
C was checked.
C FLGSOU I(*) Source id numbers to flag, 0=all.
C FLGANT I(*) Antenna numbers to flag, 0=all.
C FLGBAS I(*) Baseline (A1*32768+A2) numbers to flag, 0=all.
C FLGSUB I(*) Subarray numbers to flag, 0=all.
C FLGFQD I(*) Freqid numbers to flag, <=0=all.
C Following should have defaults filled in.
C FLGBIF I(*) First IF to flag.
C FLGEIF I(*) Highest IF to flag.
C FLGBCH I(*) First channel to flag.
C FLGECH I(*) Highest channel to flag.
C FLGPOL L(4,*) Flags for the polarizations, should correspond
C to selected polarization types.
C FLGTST R(*) Start time of flag.
C FLGTND R(*) End time of flag.
C Output:
C IERR I Return code, 0=OK, else TABIO error number.
C 10 => too many flags
C **** REVISED VERSION NOT DEPENDING ON DSEL.INC ***
C **** IGNORES SOURCE, FQ, IF SELECTIONS
C-----------------------------------------------------------------------
REAL TIME
LOGICAL TABLE
INTEGER IERR
C
INTEGER NDROP, LIMIT, RECI(30), MXFLG, SOUKOL, SUBKOL, FRQKOL,
* ANTKOL, TIMKOL, IFKOL, CHKOL, POLKOL, REAKOL, A1, A2, IT, I4,
* NFGREC, I, LIMIT4
REAL RECORD(31)
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DHDR.INC'
INCLUDE 'PUVCOP.INC'
INCLUDE 'INCS:DFLG.INC'
INCLUDE 'INCS:DCAT.INC'
INCLUDE 'INCS:DUVH.INC'
EQUIVALENCE (RECORD, RECI)
EQUIVALENCE (FGKOLS(1), SOUKOL), (FGKOLS(2), SUBKOL),
* (FGKOLS(3), FRQKOL), (FGKOLS(4), ANTKOL), (FGKOLS(5),TIMKOL),
* (FGKOLS(6), IFKOL), (FGKOLS(7), CHKOL), (FGKOLS(8), POLKOL),
* (FGKOLS(9), REAKOL)
DATA I4 /4/
C-----------------------------------------------------------------------
IERR = 0
MXFLG = MAXFLG
TMFLST = TIME
C Check if any flags expired.
C Check if any flags expired.
10 NDROP = 0
C Find highest number expired flag
IF ((NUMFLG.GT.0) .AND. (TIMORD)) THEN
DO 20 I = 1,NUMFLG
IF (FLGTND(I).LT.TIME) NDROP = I
20 CONTINUE
END IF
C Compress, dropping flag.
IF (NDROP.GT.0) THEN
IF (NDROP.LT.NUMFLG) THEN
LIMIT = NDROP + 1
DO 150 I = LIMIT,NUMFLG
IT = I - 1
FLGTST(IT) = FLGTST(I)
FLGTND(IT) = FLGTND(I)
FLGSOU(IT) = FLGSOU(I)
FLGANT(IT) = FLGANT(I)
FLGFQD(IT) = FLGFQD(I)
FLGBAS(IT) = FLGBAS(I)
FLGSUB(IT) = FLGSUB(I)
FLGBIF(IT) = FLGBIF(I)
FLGEIF(IT) = FLGEIF(I)
FLGBCH(IT) = FLGBCH(I)
FLGECH(IT) = FLGECH(I)
FLGPOL(1,IT) = FLGPOL(1,I)
FLGPOL(2,IT) = FLGPOL(2,I)
FLGPOL(3,IT) = FLGPOL(3,I)
FLGPOL(4,IT) = FLGPOL(4,I)
150 CONTINUE
END IF
NUMFLG = NUMFLG - 1
GO TO 10
END IF
C Find next valid flag.
NFGREC = FGBUFF(5)
C Check if list exhausted
IF (IFGRNO.GT.NFGREC) GO TO 999
C Loop through records
310 LIMIT4 = IFGRNO
DO 360 I = LIMIT4,NFGREC
IFGRNO = I
IERR = 1
C Read record.
CALL TABIO ('READ', 0, IFGRNO, RECORD, FGBUFF, IERR)
C Check if flagged
IF (IERR.LT.0) GO TO 360
C Check error
IF (IERR.GT.0) GO TO 999
C Check time.
IF (TIMORD) THEN
IF (TIME.LT.RECORD(TIMKOL)) GO TO 999
IF (TIME.GT.RECORD(TIMKOL+1)) GO TO 360
END IF
360 CONTINUE
IERR = 0
GO TO 999
C Next entry
NUMFLG = NUMFLG + 1
C Check if too big
IERR = 0
C Fill in tables
FLGTST(NUMFLG) = RECORD(TIMKOL)
FLGTND(NUMFLG) = RECORD(TIMKOL+1)
FLGSOU(NUMFLG) = RECI(SOUKOL)
FLGFQD(NUMFLG) = RECI(FRQKOL)
A1 = MIN (RECI(ANTKOL), RECI(ANTKOL+1))
A2 = MAX (RECI(ANTKOL), RECI(ANTKOL+1))
IF (A1.LE.0) THEN
FLGANT(NUMFLG) = A2
FLGBAS(NUMFLG) = 0
ELSE
FLGANT(NUMFLG) = RECI(ANTKOL)
FLGBAS(NUMFLG) = A1*32768 + A2
END IF
FLGSUB(NUMFLG) = RECI(SUBKOL)
FLGBIF(NUMFLG) = RECI(IFKOL)
FLGEIF(NUMFLG) = RECI(IFKOL+1)
IF (FLGBIF(NUMFLG).LE.0) FLGBIF(NUMFLG) = 1
IF (FLGEIF(NUMFLG).LE.0) THEN
IF (JLOCIF.GT.0) FLGEIF(NUMFLG) = CATBLK (KINAX+JLOCIF)
IF (JLOCIF.LE.0) FLGEIF(NUMFLG) = 1
END IF
FLGBCH(NUMFLG) = RECI(CHKOL)
FLGECH(NUMFLG) = MIN (CATBLK(KINAX+JLOCF), RECI(CHKOL+1))
IF (FLGBCH(NUMFLG).LE.0) FLGBCH(NUMFLG) = 1
IF (FLGECH(NUMFLG).LE.0) FLGECH(NUMFLG) = CATBLK (KINAX+JLOCF)
C Ensure that IF and channel
C selection are in range
FLGEIF(NUMFLG) = MIN (FLGEIF(NUMFLG), CATBLK(KINAX+JLOCIF))
FLGECH(NUMFLG) = MIN (FLGECH(NUMFLG), CATBLK(KINAX+JLOCF))
C
CALL LG2BIT (I4, FLGPOL(1,NUMFLG), RECI(POLKOL), -1)
C table ignores baseline based
C and channel based
IF (TABLE) THEN
IF ((FLGBAS(NUMFLG).NE.0) .OR. (FLGBCH(NUMFLG).NE.1) .OR.
* (FLGECH(NUMFLG).NE.CATBLK(KINAX+JLOCF))) NUMFLG = NUMFLG - 1
END IF
C test for at limit
IF (NUMFLG.GT.MXFLG-1) THEN
IERR = 10
WRITE (MSGTXT,1500) MXFLG-1
GO TO 990
END IF
C Increment flag counter
IFGRNO = IFGRNO + 1
C Loop back for next
IF (IFGRNO.LE.NFGREC) GO TO 310
GO TO 999
C Error
990 CALL MSGWRT (8)
C
999 RETURN
C-----------------------------------------------------------------------
1500 FORMAT ('TOO MANY FLAGS AT SAME TIME (>',I7,')')
END
|
Function Ran_Gauss()
Implicit None
Ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
C Random Number From A Gaussian Distribution C
C Mean=0; Sd=1 C
C C
C X + Y*Ran_Gauss() Will Return A Gaussian Distributed C
C Number With Mean=X And Sd=Y C
Ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Double Precision Ran1,Ran2,Ran_Gauss,Ran_Uniform,Ransq
1 Ran1 = 2.0d0*RAND() - 1.0d0
Ran2 = 2.0d0*RAND() - 1.0d0
Ransq = Ran1*Ran1 + Ran2*Ran2
If (Ransq.Ge.1.0d0.Or.Ransq.Le.0.0d0) Goto 1
Ran_Gauss = Ran1*Dsqrt(-2.0d0*Dlog(Ransq)/Ransq)
Return
End
|
! *******************
MODULE FRICTION_DEF
! *******************
!
!
!***********************************************************************
! TELEMAC2D V6P1 21/08/2010
!***********************************************************************
!
!history
!+
!+ V5P6
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
TYPE POINTER_TO_FRICTION
! SEQUENCE
TYPE(FRICTION_OBJ), POINTER :: P
END TYPE POINTER_TO_FRICTION
!
TYPE FRICTION_OBJ
! SEQUENCE
INTEGER :: GNUMB(2) ! GLOBAL NUMBER OF THE ZONE
INTEGER :: RTYPE(2) ! TYPE OF LAW USED
! USE REAL BECAUSE CHESTR IS SAVED AS SIMPLE PRECISION IN SELAFIN DATA
! --------------------------------------------------------------------
DOUBLE PRECISION :: RCOEF(2) ! FRICTION PARAMETER
DOUBLE PRECISION :: NDEF(2) ! DEFAULT MANNING (FOR C-W LAW)
DOUBLE PRECISION :: DP ! DIAMETER OF ROUGHNESS ELEMENT
DOUBLE PRECISION :: SP ! SPACING OF ROUGHNESS ELEMENT
TYPE(POINTER_TO_FRICTION), POINTER, DIMENSION(:) :: ADR
END TYPE FRICTION_OBJ
!
END MODULE FRICTION_DEF
|
HANSARD REVISE * NUMERO 56
Le mardi 10 fevrier 1998
Le projet de loi S-3-Decision de la presidence
REPONSE DU GOUVERNEMENT A DES PETITIONS
Presentation et premiere lecture
Le fonds d'indemnisation des agents de la securite publique
Les remedes et les supplements a base d'herbes medicinales
L'accord multilateral sur l'investissement
Les remedes et les supplements a base d'herbes medicinales
L'Accord multilateral sur l'investissement
Jour designe-L'avenir du Quebec
L'hon. Jean J. Charest
L'hon. Jean J. Charest
Mme Jocelyne Girard-Bujold
Mme Madeleine Dalphond-Guiral
M. Jean-Paul Marchand
Mme Madeleine Dalphond-Guiral
M. Jean-Paul Marchand
LA SEMAINE DE LA CITOYENNETE ET DU PATRIMOINE
LE DEVELOPPEMENT RURAL AU QUEBEC
M. Guy St-Julien
LE SERVICE D'ASSISTANCE CANADIEN AUX ORGANISMES
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
L'hon. Jean J. Charest
Le tres hon. Jean Chretien
L'hon. Jean J. Charest
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
L'hon. Pierre S. Pettigrew
Mme Judy Wasylycia-Leis
L'hon. Pierre S. Pettigrew
L'hon. Pierre S. Pettigrew
LES FONDS D'INVESTISSEMENTS DES TRAVAILLEURS
Certains propos tenus au cours de la periode des questions
Jour designe-L'avenir du Quebec
M. Brent St. Denis
LOI SUR L'ARBITRAGE DES PROPOSITIONS FINALES DANS LES
M. Jean-Guy Chretien
HANSARD REVISE * NUMERO 56
Le mardi 10 fevrier 1998
La seance est ouverte a 10 heures.
LE PROJET DE LOI S-3-DECISION DE LA PRESIDENCE
Avant d'aller plus loin, je veux clarifier deux points.
Le depute affirme que les deux projets sont en substance semblables.
Je conclus donc que le projet de loi S-3 est recevable a la Chambre.
Je ne me prononce pas en faveur ou contre un depute ou un parti.
REPONSE DU GOUVERNEMENT A DES PETITIONS
LE FONDS D'INDEMNISATION DES AGENTS DE LA SECURITE PUBLIQUE
M. Paul Szabo (Mississauga-Sud, Lib.):
LES REMEDES ET LES SUPPLEMENTS A BASE D'HERBES MEDICINALES
M. Chuck Strahl (Fraser Valley, Ref.):
Monsieur le President, c'est avec plaisir que je presente aujourd'hui plusieurs petitions.
Ils sont d'avis que ces remedes sont traites trop severement.
M. Chuck Strahl (Fraser Valley, Ref.):
Monsieur le President, la deuxieme petition porte sur l'age du consentement.
M. Chuck Strahl (Fraser Valley, Ref.):
L'ACCORD MULTILATERAL SUR L'INVESTISSEMENT
M. Bill Blaikie (Winnipeg-Transcona, NPD):
Monsieur le President, j'ai le plaisir de presenter deux petitions ce matin.
La premiere concerne l'accord multilateral sur l'investissement.
M. Bill Blaikie (Winnipeg-Transcona, NPD):
M. Philip Mayfield (Cariboo-Chilcotin, Ref.):
Monsieur le President, je presente aujourd'hui deux petitions.
LES REMEDES ET LES SUPPLEMENTS A BASE D'HERBES MEDICINALES
M. Philip Mayfield (Cariboo-Chilcotin, Ref.):
Mme Libby Davies (Vancouver-Est, NPD):
Monsieur le President, j'aimerais presenter trois petitions a la Chambre aujourd'hui.
La premiere vise l'abolition des armes nucleaires.
Mme Libby Davies (Vancouver-Est, NPD):
L'ACCORD MULTILATERAL SUR L'INVESTISSEMENT
Mme Libby Davies (Vancouver-Est, NPD):
La troisieme petition, monsieur le President, a trait a l'Accord multilateral sur l'investissement.
M. Yvon Godin (Acadie-Bathurst, NPD):
Monsieur le President, on repondra aujourd'hui a la question no 54.
L'hon. Harbance Singh Dhaliwal (ministre du Revenu national, Lib.):
Le ministere de la Justice fournit egalement un soutien a Revenu Canada.
Toutefois, les couts relies specifiquement aux activites de perception ne sont pas suivis de pres.
e) nombre de saisies effectuees-1 081
Monsieur le President, je suggere que les autres questions soient reservees.
JOUR DESIGNE-L'AVENIR DU QUEBEC
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ) propose:
Je vais relire la motion.
M. Duceppe, appuye par Mme Debien, propose:
Ce consensus regroupe des Quebecois de tous les horizons politiques, tant federalistes que souverainistes.
Il s'agit d'un consensus historique.
Sans peuple, il n'y a pas de constitution.
La Cour supreme, leur Cour supreme, leur rule of law, leur pretention coloniale depassee!
La motion devant nous aujourd'hui nous permettra de faire tomber les masques.
Les neo-democrates respecteront le resultat de l'exercice democratique de ce droit.
M. Preston Manning (Calgary-Sud-Ouest, Ref.):
Monsieur le President, je voudrais poser une question simple au chef du Bloc.
Monsieur le President, je remercie le chef du Parti reformiste d'avoir pose cette question.
Tous les partis au Quebec, federalistes et souverainistes confondus, n'ont jamais accepte cette Constitution.
Pensons-y deux minutes.
On les a vus.
On vous aime, en francais, en anglais, en multiculturel, dans toutes les langues.
On n'est meme capable de parler le francais a Nagano.
Ces discours hypocrites, on en a plein le casque, monsieur le President.
M. Michel Bellehumeur (Berthier-Montcalm, BQ):
Et on verra, au moment du vote, ou ces partis logent.
Cependant, au Quebec, on a compris l'enjeu.
Je vais en nommer quelques-uns, compte tenu du temps qui m'est alloue:
Le consensus est ne au Quebec, le consensus est la au Quebec.
Que le gouvernement d'en face en prenne acte.
La question de l'avenir du Quebec n'est pas une question juridique mais politique.
Je ne suis pas le seul a le penser.
Ca, c'est fort.
On dit, au Quebec: On ne mord pas la main qui nous nourrit.
C'est une phrase qui se comprend tres bien.
Cela peut etre prouve.
Les Quebecois n'ont rien a attendre de la Cour supreme du Canada.
Malheureusement, l'histoire lui a donne raison.
En outre, l'amendement est acceptable.
M. Paul Crete (Kamouraska-Riviere-du-Loup-Temiscouata-Les Basques, BQ):
Monsieur le President, je remercie le depute pour cette question.
Cela me donne l'occasion de completer un peu mon argumentation.
C'est au peuple quebecois de decider de son avenir.
Ce n'est pas une question juridique, c'est une question politique.
Cela n'est nulle part dans la Constitution canadienne.
C'est une interpretation des juges.
Il faut respecter les droits.
Nous croyons que ce droit n'existe pas.
Est-ce que les Cris seraient moins un peuple?
Notre gouvernement est d'accord avec cette position.
Le 19 septembre 1995, a la Chambre, le premier ministre du Canada a declare:
D'ailleurs, peut-etre que je pourrais expliquer au chef de l'opposition ceci.
Le 20 septembre, le premier ministre ajoutait:
L'Australie, dans sa Constitution, se declare un Commonwealth federal indissoluble.
Est-ce une mauvaise democratie?
La Finlande, autre pays multilingue: Le territoire de l'Etat de Finlande est indivisible.
J'ai toute une liste de democraties qui ont decide qu'elles etaient indivisibles.
Donc, l'amendement est absurde, parce qu'une secession se negocie.
Les Quebecois ne peuvent decider seuls du partage de la dette.
La presidente suppleante (Mme Thibeault):
Donc, tout sous-amendement doit etre lie a cet amendement.
La presidente suppleante (Mme Thibeault):
La presidente suppleante (Mme Thibeault):
L'honorable depute de Joliette invoque le Reglement.
La presidente suppleante (Mme Thibeault):
Il y a eu une demande de consentement unanime.
On va s'en tenir la.
Madame la Presidente, je desire intervenir simplement a titre de clarification.
Tout d'abord, c'est un debat tres important dont on est saisis aujourd'hui.
M. Real Menard (Hochelaga-Maisonneuve, BQ):
C'est cela, la democratie.
Madame la Presidente, il faut en effet respecter la Loi quebecoise sur les consultations populaires.
C'est un minimum.
C'est ce qui est en jeu.
Il me semble que dans n'importe quelle democratie au monde, cela irait de soi.
M. Ghislain Lebel (Chambly, BQ):
Madame la Presidente, je voudrais demander au ministre qui vient...
La presidente suppleante (Mme Thibeault):
Le depute de Winnipeg-Transcona invoque le Reglement.
Les deputes du Bloc quebecois en sont a une deuxieme question consecutive.
Je pense qu'il faudrait laisser la chance a d'autres.
La presidente suppleante (Mme Thibeault):
Comment avez-vous pu ne pas le remarquer?
Je ne suis pas particulierement petit.
Dois-je monter sur mon bureau?
La presidente suppleante (Mme Thibeault):
Je regardais dans une seule direction.
M. Ghislain Lebel (Chambly, BQ):
C'est un peu comme dans un cas de divorce, finalement.
On parle de divorce ici.
C'est un peu cela.
Je voudrais qu'il soit plus explicite la-dessus.
Je suis sur que les juges ont a coeur d'etre honnetes et competents.
Il ne faut pas confondre les enjeux simplement pour des raisons politiciennes.
C'est un enjeu trop important.
On ne va pas prendre des decisions graves sans avoir une information.
La presidente suppleante (Mme Thibeault):
Je m'excuse d'interrompre le ministre, mais le temps est ecoule.
Madame la Presidente, j'invoque le Reglement.
Je crois plutot qu'elle a choisi de ne pas m'accorder la parole.
La presidente suppleante (Mme Thibeault):
M. Preston Manning (chef de l'opposition, Ref.):
L'opposition officielle est extremement soucieuse de l'avenir des Quebecois.
A mon avis, la motion dont nous sommes saisis est incomplete.
Tout droit a ses limites.
Les droits sont limites par ceux des autres.
Mon droit de montrer le poing s'arrete au bout de votre nez.
Par consequent, la motion que nous examinons est incomplete.
Cette loi ne renferme aucune disposition explicite prevoyant la secession d'une province.
Les reformistes ont ete tres clairs sur ce point.
Nous voulons que les Quebecois demeurent dans le Canada.
Nous souhaitons ardemment un Canada uni pour le XXIe siecle.
L'hon. Jean J. Charest (Sherbrooke, PC):
Si tel n'est pas le cas, le chef du Parti reformiste a le choix.
Sa deuxieme raison, c'est que cela mettrait un terme au bilinguisme et au multiculturalisme.
M. Levant poursuit au nom du Parti reformiste.
Les promesses de pavage de routes ne nous manqueront pas.
C'est ce qu'ils semblent montrer par leur attitude.
J'ai une deuxieme breve question a poser au chef du Parti reformiste.
Ce sont deux questions directes adressees au chef du Parti reformiste.
Reste que l'occasion est tout indiquee pour faire connaitre nos positions.
M. Bill Blaikie (Winnipeg-Transcona, NPD):
Cela me parait un debat.
Je parle de vous, Bellehumeur.
La presidente suppleante (Mme Thibeault):
Je croyais qu'il y avait consensus a ce sujet.
Il serait inacceptable de deroger a ce principe.
Ce sont la des questions de procedure qui doivent etre clarifiees.
J'ai entendu certains deputes parler de ces preoccupations.
C'est cela qui nous inquiete.
Ce sont la des questions raisonnables.
M. Yves Rocheleau (Trois-Rivieres, BQ):
Nous avons toujours cru que cette victoire etait impossible.
C'est en partie ce qui preservait l'unite du pays.
L'hon. Jean J. Charest (Sherbrooke, PC):
Je veux d'abord regler la question de cette motion.
La motion, tel qu'elle se lit, dit ceci:
Que la Chambre reconnaisse le consensus quebecois en vertu duquel il appartient au peuple quebecois [...]
[...] et a lui seul, de decider librement de son avenir.
C'est une question que mon parti a deja traite a plusieurs reprises.
Pour nous, cela ne represente pas une grande difficulte.
Ce ne sont pas les mots de la motion auxquels les gens s'objecteraient.
Le vrai probleme est la.
Alors, la motion, c'est beau, et oui, nous sommes capables de l'appuyer.
Cela fait partie du probleme.
Et cela egalement, il faut le dire franchement.
C'est toujours dans un esprit de dire les choses comme elles sont.
Il y a une raison pour cela.
L'hon. Jean J. Charest:
C'est ca le probleme.
Sur le plan du droit international, il faut aussi dire les choses comme elles sont.
Sur le plan du droit international, il n'y a pas de regle.
Il y a une autre regle.
C'est ca la verite.
C'est ce que la Cour supreme peut nous dire.
Nous pensons que ce n'est pas une bonne idee.
C'est un probleme politique.
Quelques options s'offrent a nous.
J'ai recommande des modifications institutionnelles.
Nous pourrions nous engager a fournir des services a la population.
Dans un tel pacte, nous pourrions prevoir un financement stable.
Le secteur de la sante est sans doute le meilleur exemple.
Depuis quelques annees, le budget du systeme de sante a ete decapite.
Le systeme de sante doit donc etre reconstitue, repare.
Nous avons tenu les pires debats sur ces questions.
Il a fait campagne la-dessus aux dernieres elections.
Maintenant, le concept de caractere unique est sur la table.
L'hon. Jean J. Charest:
Le depute reformiste dit que c'est profond.
L'hon. Jean J. Charest:
Voici dix raisons pour lesquelles l'Alberta s'en porterait mieux.
J'en citerai trois.
Nous pourrions supprimer le bilinguisme et le multiculturalisme.
M. Rene Laurin (Joliette, BQ):
Il parle de realite, il parle de verite.
Tous les partis, sans exception, l'ont reclame.
Il arrive que les gens ne la respectent pas.
On l'a vu dans le cas de la contrebande.
Ils ont ete trompes.
Ces changements-la ne sont jamais venus.
La realite, c'est celle-la.
L'hon. Jean J. Charest:
L'hon. Jean J. Charest:
Oui, il dit que c'etait cela.
La realite, c'est qu'il ne fonctionne pas.
L'hon. Jean J. Charest:
Ils veulent que cela fonctionne.
C'est leur premier choix.
Il le sait, et je le sais.
Cela a permis a notre langue et a notre culture de survivre.
C'est dans cette perspective que je fais, moi, mon evaluation de mon pays.
M. Pierre Brien (Temiscamingue, BQ):
C'est ce qui a amene un nombre grandissant de Quebecois a appuyer la souverainete.
On le voit, on va d'echec constitutionnel en echec constitutionnel.
On ne peut pas en parler eternellement.
Plus tot, mon collegue de Joliette disait que cela dure depuis 30 ans.
On est rendus a 35 ans.
Le Parti conservateur a clairement dit qu'il ne l'appuyait pas.
Pour le gouvernement federal, cet avenir doit etre defini par d'autres que les Quebecois.
Par des juges de la Cour supreme?
Par les gens des autres provinces?
Si les Quebecois ne peuvent pas le faire, qui peut le faire?
Quelle est cette strategie d'Ottawa?
On joue sur deux tableaux.
Qu'est-ce que cela donne comme tableau?
Il faut le regarder.
Au Quebec, personne ne parle de la declaration de Calgary.
Il y a la une contradiction profonde.
On est muet la-dessus.
On a toutes les miseres du monde a vendre cela.
De fois en fois, on recommence a plus petit que la derniere fois.
Apres cela, il y a eu l'Accord de Charlottetown, rejete par tous les Quebecois.
Comme cela n'a pas fonctionne, on a essaye avec encore moins.
Donc, on joue sur les deux fronts.
Maintenant, notre cher ministre des Affaires intergouvernementales, dans tout cela, a lance un debat philosophique.
On prevoyait donc un mecanisme de transition.
Ottawa reconnait qu'il ne respecterait pas la volonte democratique des Quebecois.
Ils n'oseront pas mettre ce debat-la sur la table.
C'est lui d'ailleurs l'inspirateur.
M. Michel Guimond (Beauport-Montmorency-Orleans, BQ):
Moi, je pense que les gens ont tres bien compris.
Cela a ete un long debat, qui n'est pas nouveau au Quebec.
Les gens comprennent bien les enjeux.
Personne n'a enclenche la souverainete.
Imaginez le beau tandem qui est en train de nous organiser notre avenir.
C'est bon pour tous les peuples, y compris le peuple quebecois.
Mme Jocelyne Girard-Bujold (Jonquiere, BQ):
Tous s'entendent pour dire que c'est au peuple quebecois de decider.
Les decisions des populations etablissent et fondent le droit constitutionnel.
Cette impasse constitutionnelle dure depuis quinze ans.
Avec cette nouvelle cause, la cour se dirige vers une nouvelle impasse.
Est-ce qu'elle doit s'en surprendre?
Soyons fiers d'etre Quebecois.
M. Paul Mercier (Terrebonne-Blainville, BQ):
Mme Jocelyne Girard-Bujold:
Monsieur le President, je remercie le depute de Terrebonne-Blainville.
Je suis completement d'accord avec le depute.
Je pense que c'est vrai.
Il y a le peuple canadien et le peuple quebecois.
Mme Marlene Jennings (Notre-Dame-de-Grace-Lachine, Lib.):
Plusieurs raisons militaient en faveur de ces choix que nous avons faits.
Ces composantes de l'identite canadienne sont de precieux atouts pour l'avenir.
Ces valeurs partagees tissent la toile de fond de l'identite canadienne.
Chaque fois, enfin, les Quebecois ont dit non a la secession et oui au Canada.
Ce qui fait la force du Canada, ce sont les valeurs qui inspirent notre identite.
Avec raison, l'ouverture, la solidarite et le respect des droits individuels sont frequemment mentionnes.
Ce sont ces memes valeurs dont est impregne notre cheminement collectif.
A chaque occasion, les Quebecois ont dit oui a la composante canadienne de notre identite.
Notre gouvernement, lui, fait le pari de la clarte.
En depit de l'opposition dogmatique du Bloc, notre pays progresse et evolue.
En tant que Quebecois et Canadiens, on ne peut pas voter en faveur de cela.
Mme Madeleine Dalphond-Guiral (Laval-Centre, BQ):
Je voudrais lui poser deux questions.
Ma premiere question est celle-ci:
N'oublie pas 1992.
Majoritairement, nous avons dit: On veut rester au Canada.
On veut continuer a sauvegarder notre identite canadienne et notre identite quebecoise.
Nous avons repondu: On veut rester au Canada.
M. Jean-Paul Marchand (Quebec-Est, BQ):
C'est sur qu'ils ont bien compris.
C'est tout a fait democratique.
On n'a pas voulu manipuler.
Alors, c'est le meilleur exemple de la confusion qui regnait a ce moment-la.
Une des choses, c'est qu'il faut avoir une question claire.
C'est assez clair...
Je regrette, mais le temps prevu pour les questions et commentaires est termine.
La parole est maintenant a l'honorable secretaire parlementaire du ministre de la Cooperation internationale.
Mme Claudette Bradshaw (secretaire parlementaire du ministre de la Cooperation internationale, Lib.):
Le Canada est un pays remarquable.
La province a prospere au sein du Canada, en particulier depuis la Revolution tranquille.
Le Quebec au sein du Canada possede egalement une culture dynamique, vivante et unique.
Nos enfants sont notre avenir.
Toutefois, cela ne signifie pas que notre Constitution est ou devrait etre immuable.
Bien sur, nous avons nos defis.
Quel pays n'en a pas?
Nous devons voir nos difficultes dans une juste perspective.
Aucun de ces defis ne devrait conduire a la rupture du pays.
M. Yves Rocheleau (Trois-Rivieres, BQ):
J'aimerais savoir ou est la confusion la-dedans.
Le peuple quebecois s'est prononce a 94 p. 100 en 1995.
Cela, c'est le referendum sur l'Accord de Charlottetown en 1992.
Pour nous, c'est tres clair.
Monsieur le President, je remercie le depute de m'appeler son amie de l'Acadie.
C'est vrai que comme Acadiennes, nous sommes les amies des Quebecois et des Quebecoises.
Mais j'aimerais raconter mon histoire de la soiree du referendum.
Je vais repondre a votre question.
Je ne pense pas que ce soit la meme question.
M. Paul Mercier (Terrebonne-Blainville, BQ):
Si elle n'est pas confuse, qu'on ne dise plus qu'elle l'est.
Mme Madeleine Dalphond-Guiral (Laval-Centre, BQ):
Mais de quels peuples s'agit-il donc?
Mais est-il moral?
C'est une autre affaire.
Trudeau et ses sbires n'ont que faire de ces nuances.
En 1995, le Quebec tient son second referendum sur l'avenir du peuple quebecois.
Cette consultation est toujours encadree par la Loi quebecoise sur les consultations populaires.
Une fois de plus, les regles du jeu sont reconnues par tous.
Et les enjeux sont clairs.
Les referendums qui se sont tenus au Quebec en sont des exemples eloquents.
Voila un geste antidemocratique et illegitime.
L'hon. Sheila Finestone (Mont-Royal, Lib.):
Je voudrais lui poser deux questions simples.
Est-ce ainsi qu'on concoit la democratie au Quebec?
Mme Madeleine Dalphond-Guiral:
Monsieur le President, je suis vraiment en train d'hesiter.
La premiere question de ma collegue portait sur le nombre de fois.
Je crois fondamentalement que le peuple quebecois existe.
C'est ce que je crois fondamentalement.
Cent fois sur le metier remettons notre ouvrage.
J'ai presque envie de faire un commentaire.
M. Daniel Turp (Beauharnois-Salaberry, BQ):
Non, cette manoeuvre est politicienne.
S'il etait si essentiel, encore faudrait-il qu'il soit compris.
Ce qui est essentiel, pourtant, ce n'est pas le droit.
M. Andre Harvey (Chicoutimi, PC):
J'aimerais l'entendre sur cette question-la.
Monsieur le President, je remercie mon collegue pour sa question.
Questions et commentaires, avec une question tres courte.
La parole est a l'honorable deputee de Mont-Royal.
L'hon. Sheila Finestone (Mont-Royal, Lib.):
Pourquoi n'a-t-il pas voulu en traiter et l'accepter?
M. Steve Mahoney (Mississauga-Ouest, Lib.):
Nous croyons que vous contribuez a notre pays par votre caractere unique.
Ces individus incarnent la magnifique synergie qui existe entre les deux provinces.
Permettez-moi de citer certains de leurs accomplissements.
Le Quebec est bien le deuxieme partenaire commercial de l'Ontario et vice-versa.
Il ne faut toutefois pas confondre egalite et uniformite.
Il semble que ce soit un signal que les Quebecois peuvent reconnaitre.
C'est ce que nous et le gouvernement du Canada entendons faire.
Ensemble, notre presence dans le monde et sur la scene mondiale est plus forte.
Je sais que les Quebecois voient plus loin que la simple survie.
C'est pour toutes ces raisons que je ne peux appuyer la motion.
M. Jean-Paul Marchand (Quebec-Est, BQ):
C'est tout a fait le contraire.
C'est un autre sujet que j'aurais bien aime aborder.
Dans le passe, il y a eu plusieurs referendums.
Si c'est le cas, je l'en remercie.
Le depute a parle de certains evenements historiques en Ontario.
Je faisais partie du gouvernement de David Peterson, en Ontario.
Cela n'a pas ete chose facile.
En realite, l'Ontario reconnait l'importance de la collectivite francophone.
C'est la raison pour laquelle nous n'appuierons pas cette motion.
Cependant, nous voulons que les Quebecois demeurent au Canada.
M. Claude Drouin (Beauce, Lib.):
Voila pourquoi nous voulons nous assurer que ce sera le cas.
Rien n'est plus faux.
Ce pays a ete bati sur l'ouverture et la tolerance.
Personne n'est retenu contre son gre dans ce pays.
Nous ne voulons pas que les Quebecois perdent leur pays sur un malentendu.
Nous ne voulons pas que l'on fasse de l'experience democratique une mauvaise blague.
Son choix, il devra le faire en toute connaissance de cause.
Rappelons les declarations controversees de Jacques Parizeau au sujet d'une declaration unilaterale d'independance.
A ce sujet, les resultats du dernier referendum se veulent des plus revelateurs.
L'entente Parizeau-Bouchard-Dumont etait extraordinaire a sa facon.
Bel exemple de transparence et de respect de la population.
Une question ambigue et alambiquee a failli entrainer la brisure du Canada.
Nous sommes pour la clarte, pas pour la confusion.
Nous sommes pour la democratie, mais nous avons aussi confiance dans le jugement des Quebecois.
Nos concitoyens ont pris une part preponderante a l'edification de ce pays.
Ces valeurs, nous les avons inscrites dans notre Charte canadienne des droits et libertes.
M. Odina Desrochers (Lotbiniere, BQ):
On constate que les liberaux federaux sont de plus en plus seuls dans cette aventure.
Ils semblent de plus en plus se distancer des deputes liberaux federaux.
Mme Val Meredith (South Surrey-White Rock-Langley, Ref.):
On aurait prefere que le gouvernement du Quebec le fasse.
M. Yves Rocheleau (Trois-Rivieres, BQ):
Il dit qu'il aimerait avoir une question claire.
Est-ce que ce sera possible pour vous d'avoir une question claire et honnete?
Ils ne sont pas capables.
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
Monsieur le President, j'attendrai apres la periode des questions.
Comme il est 14 heures, la Chambre passe maintenant aux declarations de deputes.
M. Andrew Telegdi (Kitchener-Waterloo, Lib.):
Je souhaite bonne chance a Cindy.
A tous les participants aux Jeux olympiques, bravo!
Mme Val Meredith (South Surrey-White Rock-Langley, Ref.):
Monsieur le President, le gouvernement presentera sous peu son budget 1998-1999.
Mais la question est de savoir ce que les Canadiens souhaitent, eux.
M. Carmen Provenzano (Sault Ste. Marie, Lib.):
On a l'impression d'etre en train de jouer a Battleship avec le gouvernement.
Lorsqu'on a essaye G6, le premier ministre s'est leve et a dit: Non.
Le lendemain, on a essaye B-3, et le vice-premier ministre a dit: Non.
Nous avons droit a des reponses.
Les liberaux devraient cesser de nous mener en bateaux.
LA SEMAINE DE LA CITOYENNETE ET DU PATRIMOINE
M. Stan Dromisky (Thunder Bay-Atikokan, Lib.):
M. Bill Blaikie (Winnipeg-Transcona, NPD):
Sous la direction des liberaux, le Canada est devenu un pays sans choix.
LE DEVELOPPEMENT RURAL AU QUEBEC
M. Guy St-Julien (Abitibi, Lib.):
Mme Elsie Wayne (Saint John, PC):
M. Garry Breitkreuz (Yorkton-Melville, Ref.):
Les medias soulevent-ils une tempete de protestations pour que le gouvernement fasse quelque chose?
M. Bernard Patry (Pierrefonds-Dollard, Lib.):
Nos athletes ont beaucoup de merite.
M. Maurice Godin (Chateauguay, BQ):
Vous n'etes pas ici comme conquerants.
Madame, vous etes en presence du bilinguisme canadien.
Mme Aileen Carroll (Barrie-Simcoe-Bradford, Lib.):
La parole est au depute de Calgary-Ouest.
M. Rob Anders (Calgary-Ouest, Ref.):
Monsieur le President, quel mois pour le senateur Andy Thompson!
Ils veulent pouvoir elire leurs representants a la Chambre haute.
Nous n'avons pas a tolerer de tels amigos absents.
M. Peter Adams (Peterborough, Lib.):
Rien n'est moins vrai.
M. Denis Paradis (Brome-Missisquoi, Lib.):
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
Nous devrions commencer par lui rappeler certains de nos usages locaux.
La Chambre haute ne ressemble en rien aux plages du Mexique.
Il faut y porter une chemise en tout temps.
LE SERVICE D'ASSISTANCE CANADIEN AUX ORGANISMES
M. John McKay (Scarborough-Est, Lib.):
M. Norman Doyle (St. John's-Est, PC):
Une societe tres distincte, celle de Terre-Neuve, risque de disparaitre.
M. Preston Manning (chef de l'opposition, Ref.):
Les frappes viseront-elles les usines d'armes ou quelque chose de plus gros?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Une fregate et des avions Hercules se rendront dans la region.
Il y aura aussi quelques Canadiens dans les avions AWACS americains.
Pour le moment, les efforts diplomatiques se poursuivent.
Nous n'en sommes cependant pas encore la.
M. Preston Manning (chef de l'opposition, Ref.):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Preston Manning (chef de l'opposition, Ref.):
L'heure n'est plus aux reponses et aux assurances vagues.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, j'ai ete tres clair sur la position du gouvernement.
Une fregate sera envoyee sur place.
Les avions Hercules apporteront un soutien au personnel militaire.
M. Monte Solberg (Medicine Hat, Ref.):
Les familles canadiennes ont peine a se maintenir la tete au-dessus de l'eau.
L'hon. Paul Martin (ministre des Finances, Lib.):
Nous avons reduit les impots des familles comprenant des personnes handicapees.
Nous continuerons dans la meme veine.
M. Monte Solberg (Medicine Hat, Ref.):
Monsieur le President, voila une prestation digne d'un Oscar.
Cela me rappelle un peu Forest Gump .
Leur revenu disponible a diminue de 3 000 $ depuis 1990.
L'hon. Paul Martin (ministre des Finances, Lib.):
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Les compagnies comme Hydro-Quebec ne sont pas admissibles.
La qualification dans ce domaine, c'est clair et net.
Les regles ont ete etablies en 1988 quand Lucien Bouchard etait ministre du gouvernement conservateur.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
J'imagine que c'est une subtilite qui echappe au premier ministre.
En d'autres mots, la balle est dans le camp du gouvernement.
Vont-ils repondre aux demandes?
Le tres hon. Jean Chretien (Saint-Maurice, Lib.):
C'est clair et net.
Le depute de Temiscamingue a la parole.
M. Pierre Brien (Temiscamingue, BQ):
Monsieur le President, ma question s'adresse au premier ministre.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Nous ne compensons pas les grandes compagnies.
M. Pierre Brien (Temiscamingue, BQ):
Il y a une grande difference entre les deux.
Pourquoi, dans ce contexte, le gouvernement refuse-t-il obstinement de compenser le Quebec?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Alexa McDonough (Halifax, NPD):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Alexa McDonough (Halifax, NPD):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, nous sommes tres actifs sur le plan diplomatique.
Je me suis entretenu plus tot de ces initiatives avec le president francais.
Je l'ai consulte et nous avons exprime nos points de vue respectifs.
L'hon. Jean J. Charest (Sherbrooke, PC):
Le tres hon. Jean Chretien (premier ministre, Lib.):
L'hon. Jean J. Charest (Sherbrooke, PC):
Pourquoi le Canada ne...
Le premier ministre a la parole.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Deborah Grey (Edmonton-Nord, Ref.):
Monsieur le President, nous attendons aujourd'hui un grand evenement.
Le senateur Andrew Thompson devrait etre de retour de sa longue sieste au Mexique.
Ma question s'adresse au premier ministre.
Pourquoi les contribuables canadiens doivent-ils payer le salaire du senateur?
Je ne sais pas si cette question releve de la responsabilite administrative du gouvernement.
Je permettrai toutefois au premier ministre d'y repondre s'il le desire.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Je ne peux pas le forcer a partir.
C'est ce que les Canadiens lui demandent de faire.
Mme Deborah Grey (Edmonton-Nord, Ref.):
Les senateurs devraient etre elus et pouvoir etre revoques.
Le premier ministre nous dit qu'il ne peut exiger son depart.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Le parti reformiste a vote contre au moment de l'Accord de Charlottetown.
Mme Francine Lalonde (Mercier, BQ):
Monsieur le President, ma question s'adresse au premier ministre.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Francine Lalonde (Mercier, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Mike Scott (Skeena, Ref.):
La GRC enquete maintenant sur ces allegations.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Les reformistes portent atteinte a la reputation des fonctionnaires.
Ils ont conteste sans aucune preuve la legitimite de conseils et de chefs dument elus.
M. Mike Scott (Skeena, Ref.):
Monsieur le President, la ministre sait fort bien que ces propos sont cites hors contexte.
Il est tres clair que M. Starlight a ecrit a la ministre.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Je dois m'interroger sur les motivations de l'opposition.
A mon avis, c'est pour cette raison que nous formons...
M. Yvan Loubier (Saint-Hyacinthe-Bagot, BQ):
Ma question s'adresse au premier ministre.
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Yvan Loubier (Saint-Hyacinthe-Bagot, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Deborah Grey (Edmonton-Nord, Ref.):
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Monsieur le President, je rends hommage a la contribution qu'a faite la deputee.
Mme Deborah Grey (Edmonton-Nord, Ref.):
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
M. Daniel Turp (Beauharnois-Salaberry, BQ):
Monsieur le President, ma question s'adresse au ministre des Affaires etrangeres.
Ma question est simple.
Je regrette d'interrompre l'honorable depute.
Le ministre des Affaires etrangeres a la parole.
L'hon. Lloyd Axworthy (ministre des Affaires etrangeres, Lib.):
Monsieur le President, je ne suis pas sur.
M. Joe McGuire (Egmont, Lib.):
Monsieur le President, ma question s'adresse au ministre du Developpement des ressources humaines.
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines):
Je tiens a les remercier pour l'excellent travail qu'ils ont fait.
M. Myron Thompson (Wild Rose, Ref.):
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Monsieur le President, je m'interesse de pres au travail de l'enqueteur.
Je veux m'assurer qu'une enquete complete a ete faite.
Nous ferons connaitre les conclusions de l'enquete quand elle sera terminee.
M. Myron Thompson (Wild Rose, Ref.):
Monsieur le President, il y a une chose qui ne devrait pas prendre de temps.
La lettre porte le sceau de la ministre.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Mme Judy Wasylycia-Leis (Winnipeg-Centre-Nord, NPD):
Monsieur le President, ma question s'adresse au ministre des Finances.
Une femme est morte dans une salle d'urgence apres quatre heures d'attente.
L'hon. Allan Rock (ministre de la Sante, Lib.):
Ces mesures refletent l'importance que le gouvernement accorde aux soins de sante au Canada.
Mme Libby Davies (Vancouver-Est, NPD):
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines, Lib.):
Il s'agit d'un engagement que nous avons pris.
Le ministere des Affaires indiennes a le programme Bon depart.
Nous faisons de notre mieux et nous entendons faire encore plus dans l'avenir.
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
Les salles d'urgence de Montreal et de Toronto sont confrontees a une crise.
L'hon. Allan Rock (ministre de la Sante, Lib.):
Nous entendons prendre les moyens voulus pour y parvenir.
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
Monsieur le President, nous avons toujours droit aux memes inepties.
Les ministeriels prennent des dollars et rendent des sous.
L'hon. Allan Rock (ministre de la Sante, Lib.):
Monsieur le President, nous deployons tous les jours des efforts pour realiser cet objectif meme.
La semaine prochaine, je vais rencontrer a nouveau mes homologues des provinces et des territoires.
Ce n'est pas la facon de proceder.
Nous allons appliquer des solutions liberales.
Nous allons agir de facon efficace.
M. Claude Drouin (Beauce, Lib.):
L'hon. Lyle Vanclief (ministre de l'Agriculture et de l'Agroalimentaire, Lib.):
M. Preston Manning (chef de l'opposition, Ref.):
Je tiens a lui dire pourquoi nous sabrerions dans ses depenses.
La parole est a la ministre des Affaires indiennes.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Il ne m'a pas encore donne signe de vie.
C'est a se demander jusqu'a quel point ces dossiers l'interessent vraiment.
M. Paul Crete (Kamouraska-Riviere-du-Loup-Temiscouata-Les Basques, BQ):
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines, Lib.):
LES FONDS D'INVESTISSEMENTS DES TRAVAILLEURS
M. Pat Martin (Winnipeg-Centre, NPD):
L'hon. Paul Martin (ministre des Finances, Lib.):
Nous surveillons actuellement la situation.
M. Gilles Bernier (Tobique-Mactaquac, PC):
L'hon. Paul Martin (ministre des Finances, Lib.):
Mme Sophia Leung (Vancouver Kingsway, Lib.):
L'hon. Lucienne Robillard (ministre de la Citoyennete et de l'Immigration, Lib.):
Nous avons meme ajoute des journees de consultation, et les comites parlementaires...
M. John Duncan (Ile de Vancouver-Nord, Ref.):
Monsieur le President, ma femme et mes enfants ont le statut d'Indien.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Pour lui, ces droits n'existent pas.
La deputee de Rimouski-Mitis.
Mme Suzanne Tremblay (Rimouski-Mitis, BQ):
Monsieur le President, ma question s'adresse a la ministre du Patrimoine.
L'hon. Sheila Copps (ministre du Patrimoine canadien, Lib.):
Monsieur le President, la deputee m'a appris des choses aujourd'hui.
CERTAINS PROPOS TENUS AU COURS DE LA PERIODE DES QUESTIONS
M. Mike Scott (Skeena, Ref.):
Monsieur le President, j'invoque le Reglement.
Elle semble disposee a se lever.
Elle a la parole.
L'hon. Jane Stewart (ministre des Affaires indiennes et du Nord canadien, Lib.):
Monsieur le President, je n'avais aucunement l'intention d'attribuer des intentions au depute.
Je ne voulais que presenter les faits tels qu'ils m'apparaissaient.
JOUR DESIGNE-L'AVENIR DU QUEBEC
La Chambre reprend l'etude de la motion, ainsi que de l'amendement.
M. Rahim Jaffer (Edmonton-Strathcona, Ref.):
La motion se lit comme suit:
Nous pouvons tous travailler ensemble a la Chambre a reequilibrer la federation.
Je souhaite que nous travaillions tous ensemble a realiser cette fin mutuellement benefique.
M. Andre Harvey (Chicoutimi, PC):
Madame la Presidente, je crois que nous apprenons tous de nos erreurs.
Tel est le message que nous avons tente de faire passer.
Nous avons toujours lutte pour faire valoir que l'Ouest veut etre de la partie.
Dans ce cas-ci, efforcons-nous de representer efficacement les regions.
Voila ce que le Parti reformiste desire.
M. Claude Bachand (Saint-Jean, BQ):
On fait souvent reference a l'exemple des Cris.
J'ai deux questions a poser a mon collegue.
Si c'est non, la meme chose s'applique pour le Quebec.
Nous savons qu'il y a des problemes au Quebec.
Il y a des problemes en Alberta et dans tout le Canada.
Nous voulons reequilibrer les pouvoirs au Canada.
M. John Herron (Fundy-Royal, PC):
M. Levant disait quelque chose comme: Dites non aux autres groupes d'interets speciaux.
Ce genre d'extremisme n'ajoute rien aux debats politiques.
Je demande au depute s'il se dissocie de ces commentaires.
Le fait demeure que ces messages publicitaires etaient assez limpides.
Ces messages seront utilises de nouveau au cours du debat.
La cle, c'est que le message etait clair.
C'est ce que l'Ouest veut.
C'est exactement ce que nous allons defendre.
Ils peuvent s'exprimer librement.
La plupart des deputes se battraient contre cela.
Je trouve vraiment dommage que le depute n'ait pas brosse un tableau plus exact.
Le fait est qu'Ezra etait journaliste quand il a tenu ces propos.
La presidente suppleante (Mme Thibeault):
L'honorable depute de Beauharnois-Salaberry a la parole.
La presidente suppleante (Mme Thibeault):
La presidente suppleante (Mme Thibeault):
La presidente suppleante (Mme Thibeault):
Je crains ne pas avoir entendu cette precision.
M. Daniel Turp (Beauharnois-Salaberry, BQ):
Il est donc evident que nous devons avoir des parametres pour nous guider.
C'est pourquoi nous avons appuye le renvoi a la Cour supreme.
Dans cette motion, le Bloc demande a la Chambre de reconnaitre le consensus...
Mme Val Meredith (South Surrey-White Rock-Langley, Ref.):
Madame la Presidente, j'invoque le Reglement.
La presidente suppleante (Mme Thibeault):
Madame la Presidente, je suis heureuse de l'occasion qui m'est offerte.
Trois questions ont ete soumises a la Cour supreme:
Il doit y avoir entente sur le partage des biens et des dettes.
Personne ne le souhaite.
Les Quebecois peuvent decider s'ils veulent partir, mais il faut se conformer aux lois.
Il a bien dit apres avoir conclu un accord.
Esperons que les separatistes n'obtiendront jamais la majorite.
La presidente suppleante (Mme Thibeault):
Je pense que cela rectifie la situation.
M. Mac Harb (Ottawa-Centre, Lib.):
Les frontieres tombent les unes apres les autres a la vitesse du son.
Les peuples du monde ont plus que jamais tendance a s'unir.
Les rapports entre personnes deviendront l'element-cle de notre village planetaire.
Il peut faire pratiquement ce qu'il veut.
Madame la Presidente, manifestement, ce n'etait pas une question.
C'est une question tres grave.
L'hon. David Kilgour (secretaire d'Etat (Amerique latine et Afrique), Lib.):
Voici le message que je rapporte de ces voyages.
C'est ce qui nous a faconnes.
On me rappelle que je partage mon temps de parole.
Mon portefeuille actuel me sensibilise beaucoup a la presence du Canada sur la scene internationale.
Je ne crois pas que cela arrivera.
Mais l'Alberta est egalement le foyer de l'esprit pionnier au Canada.
Alors, nous, Albertains, apprecions le genre de determination necessaire pour vaincre dans des situations difficiles.
Ce n'est pas rien.
En 1997, pas moins de 94 p. 100 des Quebecois peuvent s'exprimer en francais.
Je sais que la solidarite est une valeur chere aux Quebecois et aux Quebecoises.
Elle est egalement importante pour les Albertains.
Nos deux langues officielles nous donnent un avantage en matiere de concurrence internationale.
Les deux sont reconnues par les Nations Unies.
Notre pays profite de son appartenance au Commonwealth et a la francophonie.
Notre travail dans ce domaine est bon pour notre image internationale.
Le fait que nous soyons un pays uni nous donne un plus grand poids economique.
Ensemble, nous sommes suffisamment forts pour faire partie du G7.
Toutes les provinces beneficient de cela.
M. Michel Bellehumeur (Berthier-Montcalm, BQ):
C'est quelqu'un qui connait extremement bien le systeme judiciaire canadien.
J'aimerais qu'il m'explique.
Madame la presidente, je remercie enormement le depute de Berthier-Montcalm.
Ses remarques sont tres eloquentes.
J'ai ecoute avec beaucoup d'interet les propos de l'honorable depute.
M. Reginald Belair (Timmins-Baie-James, Lib.):
Les francophones qui vivent en dehors du Quebec sont trois fois minoritaires.
Ils le sont sur leur continent, dans leur pays et dans leur province.
Ce qui touche les Quebecois nous touche aussi.
Ma communaute a ete du relever des defis particuliers.
Voila pourquoi nous sommes contre la secession du Quebec.
Notre langue fait partie de notre Constitution.
Non pas que justice fut toujours facile a obtenir.
Encore aujourd'hui, nous devons faire valoir nos droits linguistiques.
Les francophones du Canada sont fiers de ce que notre pays a accompli jusqu'ici.
Qu'on ne me demande pas de rester indifferent au debat politique quebecois.
En quittant le Canada, le Quebec nous priverait d'une part vitale de nous-memes.
Le federalisme canadien a beaucoup contribue a la vitalite du fait francais] au pays.
Le Canada tire profit de sa participation a la francophonie.
Cette contribution est attribuable a une vitalite qui est particuliere a chacune de nos communautes.
Le Canada ne serait pas le meme sans le Quebec.
Nous, francophones hors Quebec, avons besoin de nos compatriotes du Quebec.
Les Canadiens savent que la diversite se veut une force, non pas une faiblesse.
Personne ne songe a retenir de force les Quebecois dans ce pays.
Pourquoi renoncer a une partie de ce que vous etes, de ce que nous sommes?
Tout le monde en sortirait perdant.
Les Canadiens eux-memes en seraient irremediablement appauvris, les francophones hors Quebec le seraient doublement.
Ensemble, nous avons fait de ce pays une reussite exceptionnelle.
M. Yvan Bernier (Bonaventure-Gaspe-Iles-de-la-Madeleine-Pabok, BQ):
On peut etre Canadiens comme on le veut.
C'est ce qu'il nous disait dans son discours.
On n'a rien contre les francophones hors Quebec, on les aime nous aussi.
C'est a partir de la que s'est creee la fameuse Confederation, en 1867.
La question qui est posee aujourd'hui est celle-ci:
Pourquoi le Quebec voudrait-il quitter le Canada?
La question est la suivante, pour le depute:
Si vous faites ceci, on va vous taper sur les doigts.
Lors du dernier referendum, le premier ministre est venu faire des promesses a Verdun.
Sont-elles suffisantes pour que les Quebecois restent.
C'est sur que nous avons enormement d'affinites.
Pensez aussi aux consequences.
J'aurais aime en parler plus longuement.
Mme Francine Lalonde (Mercier, BQ):
C'est cela, le fond des choses.
Il faut aller au fond des choses.
Ce n'est pas cela, la verite.
Et je pourrais continuer.
Le debat d'aujourd'hui s'inscrit dans une trame historique, dans un mouvement.
Ils sont le fruit d'une histoire, mais pas seulement d'une histoire.
Je l'ai repete, la pauvrete est quelque chose de tres partage au Quebec.
L'autre peuple, pas une province comme les autres.
Qu'est-ce qu'on nous offre?
Ce Canada theorique n'existe qu'en theorie.
Ils diraient que les Quebecois, a la fin, sont un peuple.
Ce debat pour nous etait fondamental.
Mme Karen Redman (Kitchener-Centre, Lib.):
Mais il y a une chose qui est extremement importante a comprendre.
Comme peuple different, c'est une petite partie des problemes que nous ressentons justement.
M. Reginald Belair (Timmins-Baie-James, Lib.):
Madame la Presidente, pour le peu de temps qui reste, je serai extremement bref.
Madame la Presidente, je trouve cette question fort interessante.
On a discute de la facon dont on negocierait.
D'ailleurs, nous trouverions normal qu'on commence a s'en parler.
Mme Helene Alarie (Louis-Hebert, BQ):
Je m'adresse directement a eux, a vous, comme partie prenante de la societe quebecoise
Jamais une cour de justice ne pourra se substituer a la volonte d'un peuple.
Elles n'etaient plus applicables et valides.
Ce renvoi est une tentative de detournement de la democratie.
Ce renvoi est une tentative de mise en tutelle de nos institutions democratiques.
Ce renvoi nie l'existence du peuple quebecois.
Parlons d'histoire, la grande et la petite.
Nous les avons acquis en occupant l'espace politique, tout en respectant les regles democratiques.
Notre grande histoire fait en sorte que nous sommes devenus aujourd'hui une democratie avancee.
C'est de la qu'est ne mon engagement politique.
M. Paul Crete (Kamouraska-Riviere-du-Loup-Temiscouata-Les Basques, BQ):
Effectivement, je pense qu'elle est allee au fond des choses dans son discours.
Le resultat de cela, c'est cette spirale qu'on a devant nous.
Je poserai donc une question a la deputee de Louis-Hebert.
Madame la Presidente, je crois que mon collegue a souleve un point tres important.
Je m'attends a ce que nous ayons des jours bien tristes.
M. Yvan Bernier (Bonaventure-Gaspe-Iles-de-la-Madeleine-Pabok, BQ):
Madame la Presidente, je vais vous faire une petite lecon de geographie.
Madame la Presidente, je vais completer l'elan du coeur de mon collegue.
Ca, il faut que tout le monde au Canada le sache.
Une secession qui s'opererait dans le cadre du droit poserait deja d'enormes problemes.
Nous, Quebecois, ne voudrions pas voir notre societe plongee dans une telle instabilite.
La presidente suppleante (Mme Thibeault):
M. Brent St. Denis (Algoma-Manitoulin, Lib.):
Madame la Presidente, j'ai ecoute attentivement ce que le secretaire parlementaire avait a dire.
La primaute du droit est importante.
Il faut proceder de facon ordonnee.
En parlant de la primaute du droit, il avait declare:
La primaute du droit n'est pas un obstacle au changement.
Elle permet cependant de le faire de facon ordonnee.
Le gouvernement veut des explications.
Nous voulons simplement que cela se fasse d'une maniere ordonnee.
M. Real Menard (Hochelaga-Maisonneuve, BQ):
Je voudrais emettre trois commentaires et une question.
J'aimerais entendre l'honorable collegue sur cette question.
M. Jacques Saada (Brossard-La Prairie, Lib.):
J'ai certaines reserves que je vais exprimer.
Malgre ces reserves, j'aurais ete presque enclin a appuyer cette motion.
Les reserves, certains les jugent fondamentales.
Souvent, c'est purement de la semantique.
On parle d'un consensus.
Le terme consensus est employe a toutes les sauces.
On l'utilise, on en abuse, on interprete.
Y a-t-il vraiment un consensus au Quebec?
La aussi, on pourrait en debattre, mais je suis loin d'en etre convaincu.
Malgre cela, j'aurais pu etre enclin a appuyer la motion.
Nous avons propose un amendement.
La Presidence de la Chambre a dit que ce n'etait pas acceptable.
Je parle de notre influence dans le monde.
Il y a une contradiction, deux poids, deux mesures.
Il y a fondamentalement une contradiction.
La presidente suppleante (Mme Thibeault):
L'honorable depute de Richelieu invoque le Reglement.
Il vient de remettre en question la decision de la Presidence, et c'est inacceptable.
C'est le processus democratique etabli dans cette Chambre.
La presidente suppleante (Mme Thibeault):
C'est par une decision de la chambre que cela a ete refuse.
C'est la Chambre qui a refuse, ce n'est pas la Presidence.
L'honorable depute de Richelieu invoque le Reglement?
Il y a une mise en cause de la decision de la Presidence.
Ce muselage, je le refuse.
M. Paul Crete (Kamouraska-Riviere-du-Loup-Temiscouata-Les Basques, BQ):
Madame la Presidente, j'ai plusieurs questions a poser a mon collegue.
Deuxiemement, quand on dit une question claire, c'est faire insulte aux Quebecois.
Est-ce qu'il n'y a pas la un message clair?
Ils connaissent tres bien la question politique en jeu.
Et c'est faire injure a leur intelligence que d'avoir une attitude semblable.
On a fait la meme chose ce matin avec la question de l'amendement.
C'est tres important de faire la difference.
L'amendement n'a pas ete accepte, parce qu'il etait irrecevable.
On peut faire n'importe quoi avec le consentement unanime de la Chambre.
Cela se fait tout le temps, ce n'etait rien d'extraordinaire.
La presidente suppleante (Mme Thibeault):
La question a dure assez longtemps.
J'ai bien hate de voir la reponse qu'il va donner a cette question.
Ca, c'est un jugement.
On parle d'un consensus.
Cela, on n'en parle pas parce que ca ne fait pas son affaire.
C'est ca qui etait l'insulte.
Pourquoi veut-on tromper les gens si on est si surs de cela?
Rene Levesque doit se retourner dans sa tombe.
M. Gordon Earle (Halifax-Ouest, NPD):
Le libelle de la motion est tres general et ambigu.
Que dire de la position adoptee par les Cris du Quebec?
Cela va au centre de l'une des difficultes que presente la motion.
La motion invoque le concept ambigu de consensus.
La Commission royale sur les peuples autochtones ecrit:
Il procede des normes emergentes du droit international et des principes fondamentaux de moralite publique.
Comment cette notion tient-elle compte de l'autodetermination des autochtones?
La presidente suppleante (Mme Thibeault):
La Chambre est-elle prete a se prononcer?
La presidente suppleante (Mme Thibeault):
Le vote porte sur l'amendement.
Plait-il a la Chambre d'adopter l'amendement?
La presidente suppleante (Mme Thibeault):
Que tous ceux qui sont en faveur de l'amendement veuillent bien dire oui.
La presidente suppleante (Mme Thibeault):
Que tous ceux qui sont contre veuillent bien dire non.
La presidente suppleante (Mme Thibeault):
A mon avis, les non l'emportent.
Et plus de cinq deputes s'etant leves:
La presidente suppleante (Mme Thibeault):
(L'amendement, mis aux voix, est rejete.)
Je declare l'amendement rejete.
Le vote porte maintenant sur la motion principale.
Plait-il a la Chambre d'adopter la motion?
Que tous ceux qui sont en faveur de la motion veuillent bien dire oui.
Que tous ceux qui sont contre veuillent bien dire non.
A mon avis, les non l'emportent.
Et plus de cinq deputes s'etant leves:
(La motion, mise aux voix, est rejetee.)
Je declare la motion rejetee.
M. Paul Bonwick (Simcoe-Grey, Lib.):
Monsieur le President, je souleve la question de privilege.
Le depute voudra peut-etre presenter des excuses pour ce geste grossier et antiparlementaire.
Je n'ai rien vu.
Toutefois, le gouvernement ne voit pas la necessite d'une solution permanente.
Au lieu de cela, le gouvernement prefere regler les conflits de travail a la piece.
En tant que pays commercant, nous ne pouvons pas nous permettre de perdre du terrain.
Les employeurs, par ailleurs, vont perdre des ventes et des revenus.
Habituellement, ce sont la des incitatifs suffisamment puissants en faveur d'un reglement negocie.
Cependant, dans les secteurs economiques cles, cette garantie courante ne s'applique pas.
Il est impossible de legiferer pour ordonner le maintien de saines relations de travail.
Il ne privilegie aucune des parties.
Voici comment cela fonctionne.
Pour ces dernieres, chacune des parties doit faire une proposition finale de reglement.
La decision de l'arbitre lie les deux parties.
Il faut reduire au minimum le risque pour les emplois canadiens.
L'arbitrage des propositions finales n'est pas un nouveau concept.
C'est ce que nous disons depuis le debut.
Meme le gouvernement Mulroney a reconnu les avantages des propositions finales.
En periode de prosperite, c'est un dur coup pour l'economie.
En cas de recession, c'est devastateur.
Les cereales representent 30 p. 100 du volume du fret au port de Vancouver.
Les agriculteurs ne veulent pas etre l'enjeu des conflits de travail des autres.
Une greve nationale du chemin de fer le printemps prochain n'est pas a exclure.
L'arbitrage des propositions finales n'est pas discriminatoire.
Mme Brenda Chamberlain (secretaire parlementaire du ministre du Travail, Lib.):
Je sais que mon collegue s'efforce toujours de trouver de bonnes solutions.
Les deputes voudront savoir si le systeme est parfait.
Le gouvernement pense que le systeme devrait demeurer ainsi, avec raison.
Le depute d'en face acquiesce et me fait signe qu'il est d'accord.
Permettez-moi d'expliquer ce que je veux dire.
Le preambule du Code canadien du travail est ainsi libelle:
Cela signifie que les syndicats ont un role important a jouer dans l'economie.
Son parti represente principalement des circonscriptions rurales, ou les interets agricoles ont une importance dominante.
Si les ports ferment, les produits ne pourront pas parvenir a destination a l'etranger.
L'arbitrage des offres finales est l'un des nombreux mecanismes qui peuvent etre choisis.
Plus le conflit est complique, plus la situation est difficile.
C'est un probleme tres grave.
Il y a de meilleures solutions.
Il augmente la flexibilite et favorise la resolution des conflits.
Au lieu de chercher a etablir un equilibre, il renverse tout.
M. Pat Martin (Winnipeg-Centre, NPD):
Essentiellement, c'est ce que dit ce projet de loi.
C'est une lutte permanente.
C'est peut-etre la premiere greve connue de toute l'histoire.
Cela fait partie des droits et libertes les plus fondamentaux des travailleurs.
Il n'y a certainement la rien de nouveau.
Ils hesitent a innover dans leurs decisions.
Le fait est que, au Manitoba, on utilise tres peu l'APF.
Il est mal redige et comprend de nombreuses erreurs et omissions.
M. Jim Gouk (West Kootenay-Okanagan, Ref.):
Il a evoque un complot de la droite dirigee par le Partie reformiste.
Il n'est pas droite comme le Parti reformiste.
Cette methode a ete employee par le Parti conservateur.
Les deputes de ce parti siegent a la droite des reformistes a la Chambre.
Il y a lieu de corriger un certain nombre de fausses impressions.
Les greves et les lock-outs ne font pas partie de la negociation collective.
Ce sont les resultats de l'echec de la negociation collective.
Il n'est plus question de negociation collective.
C'est plutot l'echec d'une negociation collective.
La greve ou le lock-out est un mecanisme de reglement des differends.
C'est cela la negociation collective.
Prenons le cas de la Societe canadienne des postes que les deux deputes ont mentionne.
La derniere greve a ete en 1997 et le gouvernement a utilise la meme tactique.
On peut constater un scenario repetitif, n'est-ce pas?
Le gouvernement a adopte une loi de retour au travail.
La deuxieme fois, les travailleurs ont tenu un vote de greve.
Cela ne rejouit pas la partie en cause.
Le gouvernement a l'habitude d'intervenir dans les conflits de travail au Canada.
Nous sommes donc confrontes a un probleme.
Nous avons deja entendu combien la greve dans les ports a coute.
Elles peuvent se mettre d'accord sur une meme proposition.
Elles peuvent dire qu'elles n'avaient pas l'intention d'aller si loin.
C'est la bonne facon de fonctionner.
C'est juste et raisonnable.
On ne peut laisser continuer pareille chose.
Quelle consequence cela a-t-il?
Il s'agit d'un conflit economique entre un employeur et ses employes.
Qui d'autre en souffre?
Mais surtout, les repercussions s'en font sentir sur les lieux de travail.
La negociation collective continuera d'exister.
M. Dale Johnston (Wetaskiwin, Ref.):
Il faut corriger des idees fausses qu'ils ont en regard de ce processus.
Nous ne preconisons pas du tout ici une approche tres severe.
C'est un outil que tous deux peuvent utiliser egalement.
Je vois cela comme un reel progres.
C'est un outil que les deux parties peuvent utiliser egalement.
Elles passeraient tout de suite aux derniers elements de l'affaire.
C'est exactement ce que nous souhaitons qu'il arrive.
Mon collegue reformiste de la Colombie-Britannique a fait valoir un excellent point.
La secretaire parlementaire dit que ce processus ne marchera pas.
Au contraire, une foule de precedents dans l'histoire du Canada montrent qu'il marche.
Rien n'est regle.
La presidente suppleante (Mme Thibeault):
M. Yvon Godin (Acadie-Bathurst, NPD):
Il m'a repondu qu'il allait offrir le plus large eventail possible aux jeunes.
Ce gouvernement n'en fait pas assez pour nos jeunes.
Clairement, les liberaux ont manque le bateau en ce qui a trait aux jeunes Canadiens.
La majorite d'entre eux pense meme que le pire est a venir.
De plus, l'inegalite dans notre societe s'accroit de jour en jour.
Cette insecurite se fait ressentir particulierement chez nos jeunes.
Les jeunes Canadiens sont la marque de notre avenir.
J'ai rencontre, la semaine derniere, de jeunes etudiants du Nouveau-Brunswick.
M. Julian Reed (secretaire parlementaire du ministre du Commerce international, Lib.):
Tout le systeme d'education est la responsabilite des provinces.
Il a accru l'aide offerte aux etudiants ayant des personnes a charge...
La presidente suppleante (Mme Thibeault):
Le temps du depute est ecoule.
M. Lynn Myers (Waterloo-Wellington, Lib.):
Le Canada a ressenti les effets de la crise asiatique.
Que peut faire le Canada pour amoindrir toute repercussion negative possible?
J'aimerais que le secretaire parlementaire du ministre du Commerce international reponde a ces questions.
M. Julian Reed (secretaire parlementaire du ministre du Commerce international, Lib.):
La presidente suppleante (Mme Thibeault):
Je regrette, mais je dois vous interrompre a nouveau.
M. Jean-Guy Chretien (Frontenac-Megantic, BQ):
C'etait en date du 24 novembre, un mois avant Noel.
C'est 3 p. 100 de benefices nets.
Les produits laitiers etaient voues a un contingentement...
La presidente suppleante (Mme Thibeault):
Je m'excuse, mais le temps de parole de l'honorable depute est ecoule.
M. John Harvard (secretaire parlementaire du ministre de l'Agriculture et de l'Agroalimentaire, Lib.):
Madame la Presidente, je remercie le depute de sa question.
La presidente suppleante (Mme Thibeault):
La motion portant que la Chambre s'ajourne maintenant est reputee adoptee.
(La seance est levee a 19 h 06.)
|
subroutine vertical_mean(ff,i_name)
include 'SIZE'
include 'TOTAL'
parameter(nelz=16)
real ff(lx1,ly1,lz1,lelt)
real fbar(lz1,nelz)
real zbar(lz1,nelz)
real wght(lz1,nelz)
real work(lz1,nelz)
integer e,eg,ex,ey,ez,f
nelxy = nelgv/nelz
call rzero(fbar,lz1*nelz)
call rzero(zbar,lz1*nelz)
call rzero(wght,lz1*nelz)
f = 5 ! to evaluate surface Jacobian
do e=1,nelv
eg = lglel(e)
call get_exyz(ex,ey,ez,eg,nelxy,1,nelz)
do k=1,nz1
do i=1,nx1*ny1
fbar(k,ez) = fbar(k,ez)+area(i,1,f,e)*ff(i,1,k,e)
zbar(k,ez) = zbar(k,ez)+area(i,1,f,e)*zm1(i,1,k,e)
wght(k,ez) = wght(k,ez)+area(i,1,f,e)
enddo
enddo
enddo
call gop(fbar,work,'+ ',lz1*nelz)
call gop(zbar,work,'+ ',lz1*nelz)
call gop(wght,work,'+ ',lz1*nelz)
do i=1,lz1*nelz
fbar(i,1)=fbar(i,1)/wght(i,1)
zbar(i,1)=zbar(i,1)/wght(i,1)
enddo
if(nid.eq.0)then
if(i_name.eq.1)OPEN(10,file="ver_uzte.dat",position="append")
if(i_name.eq.2)OPEN(10,file="ver_epst.dat",position="append")
if(i_name.eq.3)OPEN(10,file="ver_epsv.dat",position="append")
if(i_name.eq.4)OPEN(10,file="ver_temp.dat",position="append")
if(i_name.eq.5)OPEN(10,file="ver_dtdz.dat",position="append")
do k=1,nelz
do i=1,lz1-1
write(10,*)zbar(i,k),fbar(i,k)
enddo
enddo
CLOSE(10)
endif
return
end
c-----------------------------------------------------------------------
subroutine pdf_calc(ff,step,i_offset,i_name)
include 'SIZE'
include 'TOTAL'
parameter(npdf=2401)
real ff(lx1,ly1,lz1,lelt)
real pdf(npdf)
real work(npdf)
real val, vol, offset, wght, norm
integer e
call rzero(pdf,npdf)
call rzero(work,npdf)
if(i_offset==0) offset=0.0
if(i_offset==1) offset=int(npdf/2)*step
!-----Volume for aspect ratio=1
vol=atan(1.0)
do e=1,nelv
do k=1,nz1
do j=1,ny1
do i=1,nx1
wght= bm1(i,j,k,e)
val= ff(i,j,k,e)
do ipdf=1,npdf
dm1=(ipdf -1 )*step-offset
dm2= ipdf *step-offset
if((val.ge.dm1).and.(val.lt.dm2))then
pdf(ipdf)=pdf(ipdf)+wght
endif
enddo
enddo
enddo
enddo
enddo
do i=1,npdf
pdf(i)=pdf(i)/vol
enddo
call gop(pdf,work,'+ ',npdf)
!------------------------------------------------------------
if(nid.eq.0)then
if(i_name.eq.1)OPEN(10,file="pdf_dudx.dat",position="append")
if(i_name.eq.2)OPEN(10,file="pdf_epst.dat",position="append")
if(i_name.eq.3)OPEN(10,file="pdf_epsv.dat",position="append")
if(i_name.eq.4)OPEN(10,file="pdf_temp.dat",position="append")
if(i_name.eq.5)OPEN(10,file="pdf_dtdx.dat",position="append")
do ipdf=1,npdf
write(10,*) (ipdf-1)*step-offset, pdf(ipdf)
enddo
CLOSE(10)
norm=0.0
do ipdf=1,npdf
norm=norm+pdf(ipdf)
enddo
if(i_name.eq.1)write(77,*)'dudx',norm
if(i_name.eq.2)write(77,*)'epsT',norm
if(i_name.eq.3)write(77,*)'epsv',norm
if(i_name.eq.4)write(77,*)'Temp',norm
if(i_name.eq.5)write(77,*)'dTdx',norm
endif
return
end
c-----------------------------------------------------------------------
subroutine pdf_calc_bulk(ff,step,i_offset,i_name)
include 'SIZE'
include 'TOTAL'
parameter(npdf=2401)
real ff(lx1,ly1,lz1,lelt)
real pdf(npdf)
real work(npdf)
real val, vol, offset, wght, norm, height1, height2, radius, radiusc
integer e
!-----Set arrays to zero
call rzero(pdf,npdf)
call rzero(work,npdf)
!-----Offset
if(i_offset==0) offset=0.0
if(i_offset==1) offset=int(npdf/2)*step
!-----Volume for aspect ratio=1
radiusc=0.3
height1=0.2
height2=0.8
vol=4*atan(1.0)*radiusc**2*(height2-height1)
do e=1,nelv
do k=1,nz1
do j=1,ny1
do i=1,nx1
wght= bm1(i,j,k,e)
val= ff(i,j,k,e)
radius=sqrt(xm1(i,j,k,e)**2+ym1(i,j,k,e)**2)
IF (radius.le.radiusc) THEN
!-----------------------------------------------------------------------
if ((zm1(i,j,k,e).ge.height1).and.(zm1(i,j,k,e).le.height2)) then
do ipdf=1,npdf
dm1=(ipdf -1 )*step-offset
dm2= ipdf *step-offset
if((val.ge.dm1).and.(val.lt.dm2))then
pdf(ipdf)=pdf(ipdf)+wght
endif
enddo
endif
!-----------------------------------------------------------------------
ENDIF
enddo
enddo
enddo
enddo
do i=1,npdf
pdf(i)=pdf(i)/vol
enddo
call gop(pdf,work,'+ ',npdf)
if(nid.eq.0) then
if(i_name.eq.1)OPEN(10,file="pdf_dudx_b.dat",position="append")
if(i_name.eq.2)OPEN(10,file="pdf_epst_b.dat",position="append")
if(i_name.eq.3)OPEN(10,file="pdf_epsv_b.dat",position="append")
if(i_name.eq.4)OPEN(10,file="pdf_temp_b.dat",position="append")
if(i_name.eq.5)OPEN(10,file="pdf_dtdx_b.dat",position="append")
do ipdf=1,npdf
write(10,*) (ipdf-1)*step-offset, pdf(ipdf)
enddo
CLOSE(10)
norm=0.0
do ipdf=1,npdf
norm=norm+pdf(ipdf)
enddo
if(i_name.eq.1)write(78,*)'dudx',norm
if(i_name.eq.2)write(78,*)'epsT',norm
if(i_name.eq.3)write(78,*)'epsv',norm
if(i_name.eq.4)write(78,*)'Temp',norm
if(i_name.eq.5)write(78,*)'dTdx',norm
endif
return
end
c-----------------------------------------------------------------------
subroutine volume_mean(ff,i_name)
include 'SIZE'
include 'TOTAL'
real ff(lx1,ly1,lz1,lelt)
real work1
real vol, vol_check, mean_val1, mean_val2, mean_val3, mean_val4
integer e
call rzero(mean_val1,1)
call rzero(mean_val2,1)
call rzero(mean_val3,1)
call rzero(mean_val4,1)
call rzero(vol_check,1)
call rzero(work1,1)
!-----Volume for aspect ratio=1
vol=atan(1.0)
do e=1,nelv
do k=1,nz1
do j=1,ny1
do i=1,nx1
vol_check=vol_check + bm1(i,j,k,e)
mean_val1=mean_val1 + ff(i,j,k,e)*bm1(i,j,k,e)
mean_val2=mean_val2 + (ff(i,j,k,e)**2)*bm1(i,j,k,e)
mean_val3=mean_val3 + (ff(i,j,k,e)**3)*bm1(i,j,k,e)
mean_val4=mean_val4 + (ff(i,j,k,e)**4)*bm1(i,j,k,e)
enddo
enddo
enddo
enddo
!-----Normalization
mean_val1=mean_val1/vol
mean_val2=mean_val2/vol
mean_val3=mean_val3/vol
mean_val4=mean_val4/vol
!-----Gather over all processes (-> mpi_allreduce)
call gop(mean_val1,work1,'+ ',1)
call gop(mean_val2,work1,'+ ',1)
call gop(mean_val3,work1,'+ ',1)
call gop(mean_val4,work1,'+ ',1)
call gop(vol_check,work1,'+ ',1)
!------------------------------------------------------------
if(nid.eq.0)then
if(i_name.eq.1)OPEN(10,file="mean_epst.dat",position="append")
if(i_name.eq.2)OPEN(10,file="mean_epsv.dat",position="append")
if(i_name.eq.3)OPEN(10,file="mean_uzte.dat",position="append")
write(10,*)mean_val1,mean_val2,mean_val3,mean_val4,vol_check,vol
CLOSE(10)
endif
return
end
c-----------------------------------------------------------------------
subroutine bulk_mean(ff,i_name)
include 'SIZE'
include 'TOTAL'
real ff(lx1,ly1,lz1,lelt)
real work1
real vol, vol_check, mean_val1, mean_val2, mean_val3, mean_val4
integer e
real height1, height2, radius, radiusc
call rzero(mean_val1,1)
call rzero(mean_val2,1)
call rzero(mean_val3,1)
call rzero(mean_val4,1)
call rzero(vol_check,1)
call rzero(work1,1)
radiusc=0.3
height1=0.2
height2=0.8
vol=4*atan(1.0)*radiusc**2*(height2-height1)
do e=1,nelv
do k=1,nz1
do j=1,ny1
do i=1,nx1
radius=sqrt(xm1(i,j,k,e)**2+ym1(i,j,k,e)**2)
if (radius.le.radiusc) then
if (zm1(i,j,k,e).ge.height1 .and.
$ zm1(i,j,k,e).le.height2) then
vol_check=vol_check + bm1(i,j,k,e)
mean_val1=mean_val1 + ff(i,j,k,e)*bm1(i,j,k,e)
mean_val2=mean_val2 + (ff(i,j,k,e)**2)*bm1(i,j,k,e)
mean_val3=mean_val3 + (ff(i,j,k,e)**3)*bm1(i,j,k,e)
mean_val4=mean_val4 + (ff(i,j,k,e)**4)*bm1(i,j,k,e)
endif
endif
enddo
enddo
enddo
enddo
mean_val1=mean_val1/vol
mean_val2=mean_val2/vol
mean_val3=mean_val3/vol
mean_val4=mean_val4/vol
call gop(mean_val1,work1,'+ ',1)
call gop(mean_val2,work1,'+ ',1)
call gop(mean_val3,work1,'+ ',1)
call gop(mean_val4,work1,'+ ',1)
call gop(vol_check,work1,'+ ',1)
if(nid.eq.0)then
if(i_name.eq.1)OPEN(10,file="mean_epst_b.dat",position="append")
if(i_name.eq.2)OPEN(10,file="mean_epsv_b.dat",position="append")
if(i_name.eq.3)OPEN(10,file="mean_uzte_b.dat",position="append")
write(10,*)mean_val1,mean_val2,mean_val3,mean_val4,vol_check,vol
CLOSE(10)
endif
return
end
c-----------------------------------------------------------------------
subroutine nusselt
include 'SIZE'
include 'TOTAL'
parameter (lt=lx1*ly1*lz1*lelt)
real dtdx(lt),dtdy(lt),dtdz(lt),w(lt)
common /chkcmnr/ atime,timel,flux(2)
common /chkcmni/ iesurf(0:2*lelt,2),ifsurf(0:2*lelt,2)
integer icalld
save icalld
data icalld /0/
if (icalld.eq.0) then
icalld = icalld + 1
atime = 0.
timel = time
call find_srf(iesurf(0,1),ifsurf(0,1),5) ! bottom face
call find_srf(iesurf(0,2),ifsurf(0,2),6) ! top face
endif
!-----Compute temperature gradients for surface fluxes
call gradm1(dtdx,dtdy,dtdz,t)
do k = 1,2
flux(k) = 0.0
do isurf = 1,iesurf(0,k)
ie = iesurf(isurf,k)
iface = ifsurf(isurf,k)
if (CBC(IFACE,IE,1) .NE .'E ') then
call surface_flux(dq,dtdx,dtdy,dtdz,ie,iface,w)
flux(k) = flux(k) + dq
end if
enddo
enddo
call gop(flux,w,'+ ',2)
!-----Output of Nusselt number at top/bottom plate
dtime = time - timel
atime = atime + dtime
pi4=atan(1.0)
if (nid.eq.0) then
write(6,1) istep,time,atime,flux(1)/pi4,-flux(2)/pi4
endif
1 format(i6,' Nusselt',1p4e14.6)
timel = time
return
end
c-----------------------------------------------------------------------
subroutine find_srf(iesurf,ifsurf,inface)
c
c Find list of surfaces over which the flux should be computed
c Number of such surfaces is returned in iesurf(0).
c
include 'SIZE'
include 'TOTAL'
integer iesurf(0:lelt),ifsurf(0:lelt)
nsurf = 0
nfaces = 2*ndim
do ie=1,nelv
nsurf = nsurf+1
iesurf(nsurf) = ie
ifsurf(nsurf) = inface
enddo
iesurf(0) = nsurf
ifsurf(0) = nsurf
return
end
c-----------------------------------------------------------------------
|
! 13 Sep 06 - IUCHI - EMPLOY HIGHER PRECISION
! 20 OCT 05 - IUCHI - ADD MOVIE OUTPUT PART
!
subroutine traject
x (ltraj,cfgname,atmnam,idnode,imcon,istraj,keytrj,natms,
x nstraj,nstep,tstep,cell,chge,weight,xxx,yyy,zzz,vxx,vyy,
x vzz,fxx,fyy,fzz)
use multibead, only: bead_suffix
c
c***********************************************************************
c
c dl_poly subroutine for writing history file at selected
c intervals in simulation
c
c copyright - daresbury laboratory 1992
c author - w. smith dec 1992.
c
c wl
c 2001/05/30 12:40:27
c 1.7
c Exp
c
! Last updated: Oct 20, 2005 by S. Iuchi
!
c***********************************************************************
c
#include "dl_params.inc"
logical newjob,ltraj
character*80 cfgname
character*8 atmnam(mxatms)
dimension cell(9)
dimension chge(mxatms),weight(mxatms)
dimension xxx(mxatms),yyy(mxatms),zzz(mxatms)
dimension vxx(mxatms),vyy(mxatms),vzz(mxatms)
dimension fxx(mxatms),fyy(mxatms),fzz(mxatms)
save newjob
data newjob/.true./
#ifdef VAMPIR
call VTBEGIN(70, ierr)
#endif
if(ltraj.and.idnode.eq.0)then
c
c open the history file if new job or file closed
if(newjob)then
newjob = .false.
open(nhist,file='HISTORY'//bead_suffix,position='append')
! add MOVIE file
open(nmovi,file='MOVIE'//bead_suffix,position='append')
endif
if(nstep.eq.nstraj)then
write(nhist,'(a80)') cfgname
write(nhist,'(3i10)') keytrj,imcon,natms
endif
if(mod(nstep-nstraj,istraj).eq.0)then
write(nhist,'(a8,4i10,f12.6)') 'timestep',
x nstep,natms,keytrj,imcon,tstep
! add MOVIE file
write(nmovi,'(i10)') natms
write(nmovi,'(a9,i12)') 'timestep:',nstep
if(imcon.gt.0) write(nhist,'(3g12.4)') cell
do i = 1,natms
write(nhist,'(a8,i10,2f12.6)')
x atmnam(i),i,weight(i),chge(i)
write(nhist,'(1p,3e20.10)') xxx(i),yyy(i),zzz(i)
if(keytrj.ge.1)then
write(nhist,'(1p,3e20.10)') vxx(i),vyy(i),vzz(i)
endif
if(keytrj.ge.2)then
write(nhist,'(1p,3e20.10)') fxx(i),fyy(i),fzz(i)
endif
! add MOVIE file
write(nmovi,'(a2,2x,1p,3e12.4)') atmnam(i)(1:2),
$ xxx(i),yyy(i),zzz(i)
enddo
endif
c
c close history file at regular intervals
if(.not.newjob.and.mod(nstep,ndump).eq.0)then
close (nhist)
close (nmovi) ! for MOVIE file
newjob = .true.
endif
endif
#ifdef VAMPIR
call VTEND(70, ierr)
#endif
return
end
|
PROMPT "{_>2500}f"
!,"","GOTO slash.help","",0,NONE
/,"","GOTO slash./","",0,NONE
I,"","GOTO slash./fi","",0,NONE
U,"","GOTO slash./fu","",0,NONE
|
C MODULE PVVNS
C-----------------------------------------------------------------------
C
C ROUTINE TO CHECK IF STATION TO BE PROCESSED.
C
SUBROUTINE PVVNS (STAID,LSSTA,LSMSF,NSTA,IMF,ICOND)
C
C IN: STAID ...... STA ID NAME (AS 8 CHARS) FOR CURRENT OPERATN - CHAR
C IN: LSSTA(1) ... LIST OF ALLOWABLE STA (8 CHR/STA), USES 'ALL' - INT
C IN: LSMSF(1) ... INDICATORS TO INCLUDE MISSG DATA (0,2=NO 1,3=YES),
C IN: OR ESTIMATED DATA (0,1=NO 2,3=YES) - INT
C IN: NSTA ....... NUMBER OF STATION NAMES IN LSSTA - INT
C OUT: IMF ........ INCLUDE-MISSING-DATA FLAG, 0=NO, 1=YES - INT
C I/O: ICOND ...... PGM COND: IF NOT 0 SKIP, SET 1 = ERR, NO TYP - INT
C
CHARACTER*8 STAID
CHARACTER*4 LSSTA(*)
DIMENSION LSMSF(*)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/ppdutil_dmpsh/RCS/pvvns.f,v $
. $', '
.$Id: pvvns.f,v 1.2 2000/07/21 19:53:59 page Exp $
. $' /
C ===================================================================
C
C
CALL PVSUBB ('PVVNS ',ICOND)
C
ICOND=0
C
C CHCEK IF STATION IN LIST
IMF=0
ILSSTA=1
DO 45 ISTA=1,NSTA
IF (LSSTA(ILSSTA).EQ.'ALL') THEN
IMF=LSMSF(ISTA)
GO TO 50
ENDIF
CALL U4BCP (STAID(1:4),LSSTA(ILSSTA),ISTAT)
IF (ISTAT.NE.0) GO TO 40
CALL U4BCP (STAID(5:8),LSSTA(ILSSTA+1),ISTAT)
IF (ISTAT.NE.0) GO TO 40
IMF=LSMSF(ISTA)
GO TO 50
40 ILSSTA=ILSSTA+2
45 CONTINUE
C
ICOND=1
C
50 CALL PVSUBE ('PVVNS ',ICOND)
C
RETURN
C
END
|
C $Header: /u/gcmpack/MITgcm/pkg/mdsio/mdsio_writevector.F,v 1.14 2009/09/01 19:00:15 jmc Exp $
C $Name: $
#include "MDSIO_OPTIONS.h"
SUBROUTINE MDSWRITEVECTOR(
I fName,
I filePrec,
I globalfile,
I arrType,
I narr,
I arr,
I bi,
I bj,
I irecord,
I myIter,
I myThid )
C Arguments:
C
C fName string :: base name for file to written
C filePrec integer :: number of bits per word in file (32 or 64)
C globalFile logical :: selects between writing a global or tiled file
C arrType char(2) :: declaration of "arr": either "RS" or "RL"
C narr integer :: size of third dimension: normally either 1 or Nr
C arr RS/RL :: array to write, arr(narr)
C bi integer :: x tile index
C bj integer :: y tile index
C irecord integer :: record number to read
C myIter integer :: time step number
C myThid integer :: thread identifier
C
C Created: 03/26/99 eckert@mit.edu
C Modified: 03/29/99 adcroft@mit.edu + eckert@mit.edu
C Fixed to work work with _RS and _RL declarations
C Modified: 07/27/99 eckert@mit.edu
C Customized for state estimation (--> active_file_control.F)
C Changed: 05/31/00 heimbach@mit.edu
C open(dUnit, ..., status='old', ... -> status='unknown'
IMPLICIT NONE
C Global variables / common blocks
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "EESUPPORT.h"
C Routine arguments
CHARACTER*(*) fName
INTEGER filePrec
LOGICAL globalfile
CHARACTER*(2) arrType
INTEGER narr
_RL arr(narr)
INTEGER bi,bj
INTEGER irecord
INTEGER myIter
INTEGER myThid
#ifdef ALLOW_AUTODIFF
C Functions
INTEGER ILNBLNK
INTEGER MDS_RECLEN
EXTERNAL ILNBLNK
EXTERNAL MDS_RECLEN
C Local variables
CHARACTER*(MAX_LEN_FNAM) dataFName,metaFName,pfName
INTEGER iG,jG,irec,dUnit,IL,pIL
LOGICAL fileIsOpen
INTEGER dimList(3,3), nDims, map2gl(2)
INTEGER length_of_rec
CHARACTER*(MAX_LEN_MBUF) msgBuf
cph(
cph Deal with useSingleCpuIO
cph Not implemented here for EXCH2
INTEGER vec_size
#ifdef ALLOW_USE_MPI
LOGICAL lprint
INTEGER K,L
c INTEGER iG_IO,jG_IO,npe
Real*8 global(narr*nPx*nPy)
_RL local(narr)
#endif
cph)
Real*4 xy_buffer_r4(narr*nPx*nPy)
Real*8 xy_buffer_r8(narr*nPx*nPy)
_RL dummyRL(1)
CHARACTER*8 blank8c
DATA dummyRL(1) / 0. _d 0 /
DATA blank8c / ' ' /
DATA map2gl / 0, 1 /
C ------------------------------------------------------------------
vec_size = narr*nPx*nPy
C Only do I/O if I am the master thread
_BEGIN_MASTER( myThid )
C Record number must be >= 1
IF (irecord .LT. 1) THEN
WRITE(msgBuf,'(A,I9.8)')
& ' MDSWRITEVECTOR: argument irecord = ',irecord
CALL PRINT_ERROR( msgBuf, myThid )
WRITE(msgBuf,'(A)')
& ' MDSWRITEVECTOR: invalid value for irecord'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR'
ENDIF
C Assume nothing
fileIsOpen = .FALSE.
IL = ILNBLNK( fName )
pIL = ILNBLNK( mdsioLocalDir )
C Assign special directory
IF ( mdsioLocalDir .NE. ' ' ) THEN
WRITE(pfName,'(2A)')
& mdsioLocalDir(1:pIL), fName(1:IL)
ELSE
pfName= fName
ENDIF
pIL=ILNBLNK( pfName )
C Assign a free unit number as the I/O channel for this routine
CALL MDSFINDUNIT( dUnit, myThid )
#ifdef ALLOW_USE_MPI
_END_MASTER( myThid )
C If option globalFile is desired but does not work or if
C globalFile is too slow, then try using single-CPU I/O.
IF (useSingleCpuIO) THEN
C Master thread of process 0, only, opens a global file
_BEGIN_MASTER( myThid )
IF( mpiMyId .EQ. 0 ) THEN
WRITE(dataFName,'(2a)') fName(1:IL),'.data'
length_of_rec=MDS_RECLEN(filePrec,vec_size,myThid)
IF (irecord .EQ. 1) THEN
OPEN( dUnit, file=dataFName, status=_NEW_STATUS,
& access='direct', recl=length_of_rec )
ELSE
OPEN( dUnit, file=dataFName, status=_OLD_STATUS,
& access='direct', recl=length_of_rec )
ENDIF
ENDIF
_END_MASTER( myThid )
C Gather array and write it to file, one vertical level at a time
DO k=1,1
IF ( arrType.EQ.'RS' ) THEN
CALL MDS_BUFFERtoRS( local, arr, narr, .FALSE., myThid )
ELSEIF ( arrType.EQ.'RL' ) THEN
CALL MDS_BUFFERtoRL( local, arr, narr, .FALSE., myThid )
ELSE
WRITE(msgBuf,'(A)')
& ' MDSWRITEVECTOR: illegal value for arrType'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR'
ENDIF
cph(
cph IF ( irecord .EQ. 1 .AND. fName(1:IL) .EQ.
cph & 'tapelev2_7_the_main_loop_theta.it0000' ) THEN
cph lprint = .TRUE.
cph ELSE
lprint = .FALSE.
cph ENDIF
cph)
CALL GATHER_VECTOR( lprint, narr, global, local, myThid )
_BEGIN_MASTER( myThid )
IF( mpiMyId .EQ. 0 ) THEN
irec=irecord
IF (filePrec .EQ. precFloat32) THEN
cph#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO)
c
cph#else /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */
DO L=1,narr*nPx*nPy
xy_buffer_r4(L) = global(L)
ENDDO
cph#endif /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */
#ifdef _BYTESWAPIO
CALL MDS_BYTESWAPR4( vec_size, xy_buffer_r4 )
#endif
WRITE(dUnit,rec=irec) xy_buffer_r4
ELSEIF (filePrec .EQ. precFloat64) THEN
cph#if defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO)
c
cph#else /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */
DO L=1,narr*nPx*nPy
xy_buffer_r8(L) = global(L)
ENDDO
cph#endif /* defined(ALLOW_EXCH2) && !defined(MISSING_TILE_IO) */
#ifdef _BYTESWAPIO
CALL MDS_BYTESWAPR8( vec_size, xy_buffer_r8 )
#endif
WRITE(dUnit,rec=irec) xy_buffer_r8
ELSE
WRITE(msgBuf,'(A)')
& ' MDSWRITEVECTOR: illegal value for filePrec'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR'
ENDIF
ENDIF
_END_MASTER( myThid )
C End k loop
ENDDO
C Close data-file and create meta-file
_BEGIN_MASTER( myThid )
IF( mpiMyId .EQ. 0 ) THEN
CLOSE( dUnit )
WRITE(metaFName,'(2a)') fName(1:IL),'.meta'
dimList(1,1)=vec_size
dimList(2,1)=1
dimList(3,1)=vec_size
dimList(1,2)=vec_size
dimList(2,2)=1
dimList(3,2)=vec_size
dimList(1,3)=1
dimList(2,3)=1
dimList(3,3)=1
nDims = 1
CALL MDS_WRITE_META(
I metaFName, dataFName, the_run_name, ' ',
I filePrec, nDims, dimList, map2gl, 0, blank8c,
I 0, dummyRL, irecord, myIter, myThid )
ENDIF
_END_MASTER( myThid )
C To be safe, make other processes wait for I/O completion
_BARRIER
ELSEIF ( .NOT. useSingleCpuIO ) THEN
_BEGIN_MASTER( myThid )
#endif /* ALLOW_USE_MPI */
C If we are writing to a global file then we open it here
IF (globalFile) THEN
WRITE(dataFName,'(2A)') fName(1:IL),'.data'
IF (irecord .EQ. 1) THEN
length_of_rec = MDS_RECLEN( filePrec, narr, myThid )
OPEN( dUnit, file=dataFName, status=_NEW_STATUS,
& access='direct', recl=length_of_rec )
fileIsOpen=.TRUE.
ELSE
length_of_rec = MDS_RECLEN( filePrec, narr, myThid )
OPEN( dUnit, file=dataFName, status=_OLD_STATUS,
& access='direct', recl=length_of_rec )
fileIsOpen=.TRUE.
ENDIF
ENDIF
C Loop over all tiles
c DO bj=1,nSy
c DO bi=1,nSx
C If we are writing to a tiled MDS file then we open each one here
IF (.NOT. globalFile) THEN
iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles
jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles
WRITE(dataFName,'(2A,I3.3,A,I3.3,A)')
& pfName(1:pIL),'.',iG,'.',jG,'.data'
IF (irecord .EQ. 1) THEN
length_of_rec = MDS_RECLEN( filePrec, narr, myThid )
OPEN( dUnit, file=dataFName, status=_NEW_STATUS,
& access='direct', recl=length_of_rec )
fileIsOpen=.TRUE.
ELSE
length_of_rec = MDS_RECLEN( filePrec, narr, myThid )
OPEN( dUnit, file=dataFName, status=_OLD_STATUS,
& access='direct', recl=length_of_rec )
fileIsOpen=.TRUE.
ENDIF
ENDIF
IF (fileIsOpen) THEN
IF (globalFile) THEN
iG = myXGlobalLo-1+(bi-1)*sNx
jG = myYGlobalLo-1+(bj-1)*sNy
irec = 1 + int(iG/sNx) + (jG/sNy)*nSx*nPx +
& (irecord-1)*nSx*nPx*nSy*nPy
ELSE
iG = 0
jG = 0
irec = irecord
ENDIF
IF ( arrType.EQ.'RS' ) THEN
CALL MDS_WR_REC_RS( arr, xy_buffer_r4, xy_buffer_r8,
I filePrec, dUnit, irec, narr, myThid )
ELSEIF ( arrType.EQ.'RL' ) THEN
CALL MDS_WR_REC_RL( arr, xy_buffer_r4, xy_buffer_r8,
I filePrec, dUnit, irec, narr, myThid )
ELSE
WRITE(msgBuf,'(A)')
& ' MDSWRITEVECTOR: illegal value for arrType'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR'
ENDIF
ELSE
WRITE(msgBuf,'(A)')
& ' MDSWRITEVECTOR: I should never get to this point'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR'
ENDIF
C If we were writing to a tiled MDS file then we close it here
IF (fileIsOpen .AND. (.NOT. globalFile)) THEN
CLOSE( dUnit )
fileIsOpen = .FALSE.
ENDIF
C Create meta-file for each tile file
IF (.NOT. globalFile) THEN
iG=bi+(myXGlobalLo-1)/sNx ! Kludge until unstructered tiles
jG=bj+(myYGlobalLo-1)/sNy ! Kludge until unstructered tiles
WRITE(metaFName,'(2a,i3.3,a,i3.3,a)')
& pfName(1:pIL),'.',iG,'.',jG,'.meta'
dimList(1,1) = nPx*nSx*narr
dimList(2,1) = ((myXGlobalLo-1)/sNx + (bi-1))*narr + 1
dimList(3,1) = ((myXGlobalLo-1)/sNx + bi )*narr
dimList(1,2) = nPy*nSy
dimList(2,2) = (myYGlobalLo-1)/sNy + bj
dimList(3,2) = (myYGlobalLo-1)/sNy + bj
dimList(1,3) = 1
dimList(2,3) = 1
dimList(3,3) = 1
nDims = 1
CALL MDS_WRITE_META(
I metaFName, dataFName, the_run_name, ' ',
I filePrec, nDims, dimList, map2gl, 0, blank8c,
I 0, dummyRL, irecord, myIter, myThid )
ENDIF
C End of bi,bj loops
c ENDDO
c ENDDO
C If global file was opened then close it
IF (fileIsOpen .AND. globalFile) THEN
CLOSE( dUnit )
fileIsOpen = .FALSE.
ENDIF
C Create meta-file for global file
IF (globalFile) THEN
WRITE(metaFName,'(2A)') fName(1:IL),'.meta'
dimList(1,1) = nPx*nSx*narr
dimList(2,1) = 1
dimList(3,1) = nPx*nSx*narr
dimList(1,2) = nPy*nSy
dimList(2,2) = 1
dimList(3,2) = nPy*nSy
dimList(1,3) = 1
dimList(2,3) = 1
dimList(3,3) = 1
nDims = 1
CALL MDS_WRITE_META(
I metaFName, dataFName, the_run_name, ' ',
I filePrec, nDims, dimList, map2gl, 0, blank8c,
I 0, dummyRL, irecord, myIter, myThid )
c I metaFName, dataFName, the_run_name, titleLine,
c I filePrec, nDims, dimList, map2gl, nFlds, fldList,
c I nTimRec, timList, irecord, myIter, myThid )
ENDIF
_END_MASTER( myThid )
#ifdef ALLOW_USE_MPI
C End-if useSingleCpuIO
ENDIF
#endif /* ALLOW_USE_MPI */
#else /* ALLOW_AUTODIFF */
STOP 'ABNORMAL END: S/R MDSWRITEVECTOR is empty'
#endif /* ALLOW_AUTODIFF */
C ------------------------------------------------------------------
RETURN
END
|
SUBROUTINE SLOPE55(J,N,XFACT,X,HS,KRCH,SLOP,K1,K2,K9)
COMMON/M3255/IOBS,KTERM,KPL,JNK,TEH
COMMON/FDBUG/IODBUG,ITRACE,IDBALL,NDEBUG,IDEBUG(20)
COMMON/IONUM/IN,IPR,IPU
DIMENSION X(K2,K1),HS(K9,K2,K1),KRCH(K2,K1),SLOP(K2,K1)
CHARACTER*8 SNAME
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcinit_fldwav/RCS/slope55.f,v $
. $', '
.$Id: slope55.f,v 1.2 2004/02/02 20:41:45 jgofus Exp $
. $' /
C ===================================================================
C
DATA SNAME/'SLOPE55 '/
CALL FPRBUG(SNAME, 1, 55, IBUG)
C IF(IBUG.EQ.1) WRITE(IODBUG,1)
1 FORMAT(1X,'** ENTER SLOPE **')
NM=N-1
58 FORMAT(/10X,'(SLOP(I,J),I=1,N) FOR RIVER NO. ',I3)
59 FORMAT(8F10.6)
DO 10 I=1,NM
DX=ABS(X(I+1,J)-X(I,J))*XFACT
IF(DX.LT.1.) DX=1.
DH=HS(1,I,J)-HS(1,I+1,J)
SLOP(I,J)=(HS(1,I,J)-HS(1,I+1,J))/DX
IF(SLOP(I,J).LE.0.000001) SLOP(I,J)=0.000001
10 CONTINUE
DO 20 I=1,NM
KR=KRCH(I,J)
IF(KR.NE.-2.OR.KR.NE.-3) GO TO 30
KRCH(I,J)=-KRCH(I,J)
20 CONTINUE
SLS=SLOP(1,J)
DO 25 I=2,NM
SAU=(SLS+SLOP(I,J))/2.
SAD=(SLOP(I,J)+SLOP(I+1,J))/2.
DXU=ABS(X(I-1,J)-X(I,J))
DXD=ABS(X(I,J)-X(I+1,J))
SLS=SLOP(I,J)
SLOP(I,J)=(SAU*DXU+SAD*DXD)/(DXU+DXD)
25 CONTINUE
30 CONTINUE
IF(SLOP(N,J).LE.0.000001) SLOP(N,J)=SLOP(NM,J)
IF (JNK.LT.4) GO TO 999
IF(IBUG.EQ.1) WRITE(IODBUG,58) J
IF(IBUG.EQ.1) WRITE(IODBUG,59) (SLOP(I,J),I=1,N)
999 RETURN
END
|
C
C $Id: agftol.f,v 1.6 2008-07-27 00:14:34 haley Exp $
C
C Copyright (C) 2000
C University Corporation for Atmospheric Research
C All Rights Reserved
C
C The use of this Software is governed by a License Agreement.
C
SUBROUTINE AGFTOL (IAXS,IDMA,VINP,VOTP,VLCS,LLUA,UBEG,UDIF,FUNS,
+ NBTP,SBSE)
C
C The routine AGFTOL is used by AGAXIS to map a fractional distance
C along the axis to a value in the label coordinate system or vice-
C versa. Its arguments are as follows:
C
C -- IAXS specifies which axis is being drawn. It is passed to the
C routine AGUTOL. See AGAXIS for a complete description of IAXS.
C
C -- IDMA specifies the direction of the mapping - from the fractional
C system to the label system if IDMA .GT. 0 or from the label system
C to the fractional system if IDMA .LT. 0. IDMA also specifies how
C the label-system value is given to or returned by AGFTOL.
C
C -- If ABSV(IDMA) .EQ. 1, an actual value in the label coordinate
C system (VLCS) is given to or returned by AGFTOL.
C
C -- If ABSV(IDMA) .NE. 1, a value of the exponent/multiplier EXMU
C corresponding to VLCS is given to or returned by AGFTOL.
C
C -- VINP is an input value in one coordinate system.
C
C -- VOTP is an output value in the other coordinate system.
C
C -- VLCS is an output value in the label coordinate system, returned
C no matter what the value of IDMA.
C
C -- LLUA, UBGA, and UDFA specify the mapping from the user coordinate
C system to the fractional system and vice-versa. See the routine
C AGAXIS for a complete description of these parameters.
C
C -- FUNS is a function-selector, to be used in calls to AGUTOL. It
C selects the mapping from the user coordinate system to the label
C coordinate system and vice-versa. See the routine AGAXIS for a
C complete description of this parameter.
C
C -- NBTP and SBSE specify the mapping of label-coordinate-system values
C to exponent/multiplier values and vice-versa. See the routine
C AGNUMB for a complete dexcription of these parameters.
C
C Determine desired direction of mapping.
C
IF (IDMA.GT.0) THEN
C
C Map axis fraction VINP to a label-coordinate-system value VLCS.
C
VUCS=UBEG+VINP*UDIF
IF (LLUA.NE.0) VUCS=10.**VUCS
CALL AGUTOL (IAXS,FUNS,1,VUCS,VLCS)
C
C If IDMA .EQ. 1, caller wants VLCS - otherwise, map VLCS to the
C appropriate exponent/multiplier value EXMU - return value in VOTP.
C
IF (IDMA.EQ.1) THEN
VOTP=VLCS
RETURN
END IF
C
GO TO (101,102,103) , NBTP
C
101 VOTP=VLCS/SBSE
RETURN
C
102 VOTP=ALOG10(VLCS/SBSE)
RETURN
C
103 VOTP=ALOG10(ABS(VLCS))/ALOG10(ABS(SBSE))
RETURN
C
ELSE
C
C If IDMA .EQ. -1, caller has provided VINP .EQ. VLCS, a value in the
C label coordinate system - otherwise, VINP .EQ. EXMU, the exponent/
C multiplier needed to generate VLCS.
C
IF (IDMA.EQ.(-1)) THEN
VLCS=VINP
GO TO 107
END IF
C
GO TO (104,105,106) , NBTP
C
104 VLCS=SBSE*VINP
GO TO 107
C
105 VLCS=SBSE*10.**VINP
GO TO 107
C
106 VLCS=SIGN(1.,SBSE)*ABS(SBSE)**VINP
C
C Map label-system value VLCS to a user-system value VUCS.
C
107 CALL AGUTOL (IAXS,FUNS,-1,VLCS,VUCS)
C
C Map user-system value VUCS to an axis fraction VOTP and return.
C
IF (LLUA.NE.0) VUCS=ALOG10(VUCS)
VOTP=(VUCS-UBEG)/UDIF
RETURN
C
END IF
C
END
|
SUBROUTINE SNINI (OPCODE, BUFFER, DISK, CNO, VER, CATBLK, LUN,
* ISNRNO, SNKOLS, SNNUMV, NUMANT, NUMPOL, NUMIF, NUMNOD, GMMOD,
* RANOD, DECNOD, ISAPPL, IERR)
C-----------------------------------------------------------------------
C! Create/open/initialize solution (SN) tables.
C# EXT-util UV Calibration
C-----------------------------------------------------------------------
C; Copyright (C) 1995-1996, 1998, 2000, 2006, 2015
C; Associated Universities, Inc. Washington DC, USA.
C;
C; This program is free software; you can redistribute it and/or
C; modify it under the terms of the GNU General Public License as
C; published by the Free Software Foundation; either version 2 of
C; the License, or (at your option) any later version.
C;
C; This program is distributed in the hope that it will be useful,
C; but WITHOUT ANY WARRANTY; without even the implied warranty of
C; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C; GNU General Public License for more details.
C;
C; You should have received a copy of the GNU General Public
C; License along with this program; if not, write to the Free
C; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
C; MA 02139, USA.
C;
C; Correspondence concerning AIPS should be addressed as follows:
C; Internet email: aipsmail@nrao.edu.
C; Postal address: AIPS Project Office
C; National Radio Astronomy Observatory
C; 520 Edgemont Road
C; Charlottesville, VA 22903-2475 USA
C-----------------------------------------------------------------------
C Creates and initializes solution (SN) extension tables.
C REVISION 10
C Inputs:
C OPCODE C*4 Operation code:
C 'WRIT' = create/init for write or read
C 'READ' = open for read only
C BUFFER(512) I I/O buffer and related storage, also defines file
C if open.
C DISK I Disk to use.
C CNO I Catalog slot number
C VER I SN file version
C CATBLK(256) I Catalog header block.
C LUN I Logical unit number to use
C Input (create) / output (pre-existing)
C NUMANT I Number of antennas
C NUMPOL I Number of IFs per group
C NUMIF I Number of IF groups
C NUMNOD I Number of interpolation nodes. Will handle
C up to 25 interpolation nodes.
C GMMOD R Mean gain modulus
C RANOD(*) R RA offset of interpolation nodes (deg.)
C DECNOD(*) R Dec. offset of interpolation nodes (deg.)
C ISAPPL L True if this SN table has been applied to
C the CL table.
C Output:
C ISNRNO I Next scan number, start of the file if 'READ',
C the last+1 if WRITE
C SNKOLS(MAXSNC) I The column pointer array in order defined by
C the parameters given in PSNTAB.INC.
C SNNUMV(MAXSNC) I Element count in each column.
C IERR I Return error code, 0=>OK, else TABINI or TABIO
C error.
C-----------------------------------------------------------------------
CHARACTER OPCODE*4
INTEGER BUFFER(512), DISK, CNO, VER, CATBLK(256), LUN, ISNRNO,
* SNKOLS(*), SNNUMV(*), NUMANT, NUMPOL, NUMIF, NUMNOD, IERR
REAL GMMOD, RANOD(25), DECNOD(25)
LOGICAL ISAPPL
C
INCLUDE 'INCS:PUVD.INC'
INCLUDE 'INCS:PSNTAB.INC'
CHARACTER KEYW(57)*8, TTITLE*56, TITLE(MAXSNC)*24, UNITS(MAXSNC)*8
HOLLERITH HOLTMP(6)
INTEGER NKEY, NREC, DATP(128,2), NCOL
REAL KEYVAR(120)
INTEGER NTT, DTYP(MAXSNC), NDATA, KLOCS(57), KEYVAL(120), NC,
* KEYTYP(57), IPOINT, J, JNUM, I, JERR, REVNO, MSGSAV, ITRIM
DOUBLE PRECISION KEYVAD
LOGICAL T, DOREAD, NEWFIL
INCLUDE 'INCS:DMSG.INC'
INCLUDE 'INCS:DDCH.INC'
EQUIVALENCE (KEYVAL, KEYVAR)
DATA T /.TRUE./
DATA NTT /56/
DATA TTITLE /'AIPS UV DATA FILE SOLUTION TABLE '/
C Values larger than 10 are
C scalars
DATA DTYP /11,12,14,14,14,14,12,14,3*12,5*2,4,3*12,5*2,4/
C NOTE: change PSNTAB.INC if the
C columns are changed.
DATA TITLE /'TIME ',
* 'TIME INTERVAL ',
* 'SOURCE ID ', 'ANTENNA NO. ',
* 'SUBARRAY ', 'FREQ ID ',
* 'I.FAR.ROT ', 'NODE NO. ',
* 'MBDELAY1 ',
* 'DISP 1 ', 'DDISP 1 ',
* 'REAL1 ', 'IMAG1 ',
* 'DELAY 1 ', 'RATE 1 ',
* 'WEIGHT 1 ', 'REFANT 1 ',
* 'MBDELAY2 ',
* 'DISP 2 ', 'DDISP 2 ',
* 'REAL2 ', 'IMAG2 ',
* 'DELAY 2 ', 'RATE 2 ',
* 'WEIGHT 2 ', 'REFANT 2 '/
DATA KEYW /'NO_ANT ', 'NO_POL ', 'NO_IF ',
* 'NO_NODES', 'MGMOD ', 'APPLIED ', 'REVISION',
* 'RA_OFF1 ', 'DEC_OFF1', 'RA_OFF2 ', 'DEC_OFF2',
* 'RA_OFF3 ', 'DEC_OFF3', 'RA_OFF4 ', 'DEC_OFF4',
* 'RA_OFF5 ', 'DEC_OFF5', 'RA_OFF6 ', 'DEC_OFF6',
* 'RA_OFF7 ', 'DEC_OFF7', 'RA_OFF8 ', 'DEC_OFF8',
* 'RA_OFF9 ', 'DEC_OFF9', 'RA_OFF10', 'DEC_OF10',
* 'RA_OFF11', 'DEC_OF11', 'RA_OFF12', 'DEC_OF12',
* 'RA_OFF13', 'DEC_OF13', 'RA_OFF14', 'DEC_OF14',
* 'RA_OFF15', 'DEC_OF15', 'RA_OFF16', 'DEC_OF16',
* 'RA_OFF17', 'DEC_OF17', 'RA_OFF18', 'DEC_OF18',
* 'RA_OFF19', 'DEC_OF19', 'RA_OFF20', 'DEC_OF20',
* 'RA_OFF21', 'DEC_OF21', 'RA_OFF22', 'DEC_OF22',
* 'RA_OFF23', 'DEC_OF23', 'RA_OFF24', 'DEC_OF24',
* 'RA_OFF25', 'DEC_OF25'/
DATA UNITS /'DAYS', 'DAYS', 4*' ', 'RAD/M**2',
* ' ', 'SECONDS', 'SEC/M**2', 'S/S/M**2', 2*' ', 'SECONDS ',
* 'SEC/SEC', 2*' ', 'SECONDS', 'SEC/M**2', 'S/S/M**2',
* 2*' ', 'SECONDS ', 'SEC/SEC', 2*' '/
C-----------------------------------------------------------------------
C Check OPCODE
DOREAD = OPCODE.EQ.'READ'
C Open file
NREC = 1000
NCOL = 8 + NUMPOL * 9
IF (DOREAD) NCOL = 0
NKEY = 7 + NUMNOD * 2
NDATA = MAXSNC
CALL FILL (NDATA, 0, SNKOLS)
CALL FILL (NDATA, 0, SNNUMV)
C Fill in types
IF (.NOT.DOREAD) THEN
CALL COPY (NDATA, DTYP, DATP(1,2))
DO 10 J = 1,NDATA
IF (DTYP(J).LT.10) DATP(J,2) = DTYP(J) + 10 * NUMIF
10 CONTINUE
END IF
C Create/open file
CALL TABINI (OPCODE, 'SN', DISK, CNO, VER, CATBLK, LUN, NKEY,
* NREC, NCOL, DATP, BUFFER, IERR)
IF (IERR.GT.0) THEN
CALL TABERR (OPCODE, 'TABINI', 'SNINI', IERR)
GO TO 990
END IF
NEWFIL = IERR.LT.0
C Get number of scans
ISNRNO = BUFFER(5) + 1
IF (DOREAD) ISNRNO = 1
NKEY = 7 + NUMNOD * 2
C File created, initialize
IF (NEWFIL) THEN
C Col. labels.
DO 40 I = 1,NCOL
CALL CHR2H (24, TITLE(I), 1, HOLTMP)
CALL TABIO ('WRIT', 3, I, HOLTMP, BUFFER, IERR)
IF (IERR.GT.0) THEN
CALL TABERR ('WRIT', 'TABIO', 'SNINI', IERR)
GO TO 990
END IF
C Units
CALL CHR2H (8, UNITS(I), 1, HOLTMP)
CALL TABIO ('WRIT', 4, I, HOLTMP, BUFFER, IERR)
IF (IERR.GT.0) THEN
CALL TABERR ('WRIT', 'TABIO', 'SNINI', IERR)
GO TO 990
END IF
40 CONTINUE
C Fill in Table title
CALL CHR2H (NTT, TTITLE, 1, BUFFER(101))
C Set keyword values
C No. antennas.
KLOCS(1) = 1
KEYTYP(1) = 4
KEYVAL(1) = NUMANT
C No. polarizations
KLOCS(2) = 2
KEYTYP(2) = 4
KEYVAL(2) = NUMPOL
C No. IFs
KLOCS(3) = 3
KEYTYP(3) = 4
KEYVAL(3) = NUMIF
C No. interpolation nodes.
KLOCS(4) = 4
KEYTYP(4) = 4
KEYVAL(4) = NUMNOD
C Gain modulus
KLOCS(5) = 5
KEYTYP(5) = 1
KEYVAD = GMMOD
IPOINT = KLOCS(5)
CALL RCOPY (NWDPDP, KEYVAD, KEYVAR(IPOINT))
IPOINT = IPOINT + NWDPDP
C APPLIED flag
KLOCS(6) = IPOINT
KEYTYP(6) = 5
CALL COPY (1, ISAPPL, KEYVAL(IPOINT))
IPOINT = IPOINT + 1
C Revision number from PSNTAB.INC
REVNO = SNREV
KLOCS(7) = IPOINT
KEYTYP(7) = 4
KEYVAL(IPOINT) = REVNO
IPOINT = IPOINT + 1
C Interpolation nodes
IF (NUMNOD.GT.0) THEN
JNUM = 8
DO 50 J = 1,NUMNOD
KLOCS(JNUM) = IPOINT
KEYTYP(JNUM) = 1
KEYVAD = RANOD(J)
CALL RCOPY (NWDPDP, KEYVAD, KEYVAR(IPOINT))
IPOINT = IPOINT + NWDPDP
JNUM = JNUM + 1
KLOCS(JNUM) = IPOINT
KEYTYP(JNUM) = 1
KEYVAD = DECNOD(J)
CALL RCOPY (NWDPDP, KEYVAD, KEYVAR(IPOINT))
IPOINT = IPOINT + NWDPDP
JNUM = JNUM + 1
50 CONTINUE
END IF
C Only write if just created.
CALL TABKEY (OPCODE, KEYW, NKEY, BUFFER, KLOCS, KEYVAL, KEYTYP,
* IERR)
IF ((IERR.GE.1) .AND. (IERR.LE.20)) THEN
CALL TABERR ('WRIT', 'TABKEY', 'SNINI', IERR)
GO TO 990
END IF
C Read keywords
ELSE
MSGSAV = MSGSUP
MSGSUP = 32000
CALL TABKEY ('READ', KEYW, NKEY, BUFFER, KLOCS, KEYVAL, KEYTYP,
* IERR)
MSGSUP = MSGSAV
IF ((IERR.GE.1) .AND. (IERR.LE.20)) THEN
CALL TABERR ('READ', 'TABKEY', 'SNINI', IERR)
GO TO 990
END IF
C Retrieve keyword values
C No. antennas.
IPOINT = KLOCS(1)
IF (IPOINT.GT.0) NUMANT = KEYVAL(IPOINT)
C No. IFs per group.
IPOINT = KLOCS(2)
IF (IPOINT.GT.0) NUMPOL = KEYVAL(IPOINT)
C No. IF groups.
IPOINT = KLOCS(3)
IF (IPOINT.GT.0) NUMIF = KEYVAL(IPOINT)
C No. interpolation nodes.
IPOINT = KLOCS(4)
IF (IPOINT.GT.0) NUMNOD = KEYVAL(IPOINT)
C Gain modulus
IPOINT = KLOCS(5)
IF (IPOINT.GT.0) THEN
IF (KEYTYP(5).EQ.1) THEN
CALL RCOPY (NWDPDP, KEYVAR(IPOINT), KEYVAD)
GMMOD = KEYVAD
ELSE
GMMOD = KEYVAR(IPOINT)
END IF
END IF
C APPLIED flag
IPOINT = KLOCS(6)
IF (IPOINT.GT.0) CALL COPY (1, KEYVAL(IPOINT), ISAPPL)
C Revision level
IPOINT = KLOCS(7)
REVNO = -1
IF (IPOINT.GT.0) REVNO = KEYVAL(IPOINT)
C Interpolation nodes
IF (NUMNOD.GT.0) THEN
JNUM = 8
DO 100 J = 1,NUMNOD
IPOINT = KLOCS(JNUM)
IF (IPOINT.GT.0) THEN
IF (KEYTYP(JNUM).EQ.1) THEN
CALL RCOPY (NWDPDP, KEYVAR(IPOINT), KEYVAD)
RANOD(J) = KEYVAD
ELSE
RANOD(J) = KEYVAR(IPOINT)
END IF
END IF
JNUM = JNUM + 1
IPOINT = KLOCS(JNUM)
IF (IPOINT.GT.0) THEN
IF (KEYTYP(JNUM).EQ.1) THEN
CALL RCOPY (NWDPDP, KEYVAR(IPOINT), KEYVAD)
DECNOD(J) = KEYVAD
ELSE
DECNOD(J) = KEYVAR(IPOINT)
END IF
END IF
JNUM = JNUM + 1
100 CONTINUE
END IF
END IF
C Get array indices
C Cover your ass from FNDCOL -
C close to flush the buffers and
C then reopen.
CALL TABIO ('CLOS', 0, ISNRNO, KEYVAL, BUFFER, IERR)
IF (IERR.GT.0) THEN
CALL TABERR ('CLOS', 'TABIO', 'SNINI', IERR)
GO TO 990
END IF
NKEY = 0
CALL TABINI (OPCODE, 'SN', DISK, CNO, VER, CATBLK, LUN, NKEY,
* NREC, NCOL, DATP, BUFFER, IERR)
IF (IERR.GT.0) THEN
CALL TABERR (OPCODE, 'TABINI', 'SNINI', IERR)
GO TO 990
END IF
NCOL = 8 + NUMPOL * 9
CALL FNDCOL (NCOL, TITLE, 24, T, BUFFER, SNKOLS, JERR)
C no message on DISP, DDISP
DO 150 I = 1,NCOL
IPOINT = SNKOLS(I)
IF (IPOINT.GT.0) THEN
SNKOLS(I) = DATP(IPOINT,1)
SNNUMV(I) = DATP(IPOINT,2) / 10
IF (SNNUMV(I).LE.0) THEN
NC = ITRIM (TITLE(I))
WRITE (MSGTXT,1100) TITLE(I)(:NC)
IF ((I.NE.10) .AND. (I.NE.11) .AND. (I.NE.19). AND.
* (I.NE.20)) CALL MSGWRT (6)
END IF
ELSE
SNKOLS(I) = -1
SNNUMV(I) = 0
NC = ITRIM (TITLE(I))
WRITE (MSGTXT,1101) TITLE(I)(:NC)
IF ((I.NE.10) .AND. (I.NE.11) .AND. (I.NE.19). AND.
* (I.NE.20)) CALL MSGWRT (6)
END IF
150 CONTINUE
GO TO 999
C Error
990 WRITE (MSGTXT,1990) OPCODE
CALL MSGWRT (7)
C
999 RETURN
C-----------------------------------------------------------------------
1100 FORMAT ('SNINI: ''',A,''' COLUMN HAS NO VALUES')
1101 FORMAT ('SNINI: ''',A,''' COLUMN NOT FOUND')
1990 FORMAT ('SNINI: ERROR INITIALIZING SOLUTION TABLE FOR ',A4)
END
|
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief USER API FUNCTIONS
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
MODULE API_INTERFACE
!
USE API_HANDLE_ERROR
USE API_HANDLE_VAR_T2D
USE API_INSTANCE_T2D
USE API_RUN_T2D
USE API_HANDLE_VAR_SIS
USE API_INSTANCE_SIS
USE API_RUN_SIS
USE API_COUPLING
USE DECLARATIONS_PARTEL
IMPLICIT NONE
INTEGER, EXTERNAL :: GLOBAL_TO_LOCAL_POINT
!
CONTAINS
!
!***********************************************************************
! PARTEL/GRETEL
!***********************************************************************
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE TELEMAC2D VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN & C. GOEURY (EDF R&D, LNHE)
!+ 24/08/2016
!+ V6P3
!+ PARTITIONNING TREATMENT
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_PARTEL(ID,NAMEINP, NAMECLI, NPARTS, PMETHOD,
& FFORMAT,NAMESEC, NAMEZFI,NAMESEU, IERR)
!
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT):: IERR
CHARACTER(LEN=250), INTENT(IN) :: NAMEINP
CHARACTER(LEN=250), INTENT(IN) :: NAMECLI
INTEGER, INTENT(IN) :: NPARTS
INTEGER, INTENT(IN) :: PMETHOD
CHARACTER(LEN=8), INTENT(INOUT) :: FFORMAT
CHARACTER(LEN=250), INTENT(IN) :: NAMESEC
CHARACTER(LEN=250), INTENT(IN) :: NAMEZFI
CHARACTER(LEN=250), INTENT(IN) :: NAMESEU
!
INTEGER :: EXEC_POS
!
IERR = 0
CODE = 'T2D'
! The partitioning is done sequentially
! PARITIONING THE GEOMETRY FILE
CALL PARTEL(NAMEINP, NAMECLI, NPARTS, PMETHOD, FFORMAT,
& NAMESEC, NAMEZFI, NAMESEU)
!
END SUBROUTINE RUN_PARTEL
!
!
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE TELEMAC2D VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY C. GOEURY (EDF R&D, LNHE)
!+ 31/08/2016
!+ V7p1
!+ PARTITIONNING TREATMENT
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_PARRES(ID,NAMEGEO, NAMEINP, NPARTS, GEOFORMAT,
& INPFORMAT,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT):: IERR
CHARACTER(LEN=250), INTENT(IN) :: NAMEGEO
CHARACTER(LEN=250), INTENT(IN) :: NAMEINP
INTEGER, INTENT(IN) :: NPARTS
CHARACTER(LEN=8), INTENT(INOUT) :: GEOFORMAT
CHARACTER(LEN=8), INTENT(INOUT) :: INPFORMAT
!
INTEGER :: EXEC_POS
!
CODE = 'T2D'
! The partitioning is done sequentially
! PARITIONING THE GEOMETRY FILE
CALL PARRES(NAMEGEO, NAMEINP, NPARTS, GEOFORMAT,INPFORMAT)
!
END SUBROUTINE RUN_PARRES
!
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE TELEMAC2D VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY C. GOEURY (EDF R&D, LNHE)
!+ 24/08/2016
!+ V6P3
!+ PARTITIONNING TREATMENT
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_GRETEL(ID,GEO,GEOFORMAT,RES,RESFORMAT,NPROC,
& NPLAN_RES)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=250), INTENT(IN) :: GEO
CHARACTER(LEN=250), INTENT(IN) :: RES
CHARACTER(LEN=8), INTENT(INOUT) :: GEOFORMAT,RESFORMAT
INTEGER, INTENT(IN) :: NPROC
INTEGER, INTENT(INOUT) :: NPLAN_RES
!
INTEGER :: EXEC_POS
!
! The partitioning is done sequentially
! PARITIONING THE GEOMETRY FILE
CALL GRETEL_AUTOP(GEO,GEOFORMAT,RES,RESFORMAT,NPROC,NPLAN_RES)
END SUBROUTINE RUN_GRETEL
!
!***********************************************************************
! TELEMAC2D
!***********************************************************************
!
!
! EXECUTION FUNCTIONS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE INSTANCE AND SET THE OUTPUT
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [OUT] ID OF THE INSTANCE
!PARAM LU [IN] OUTPUT STREAM ID
!PARAM LNG [IN] OUTPUT LANGUAGE 2 ENGLISH 1 FRENCH
!PARAM COMM [IN] MPI COMMUNICATOR
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_SET_CONFIG_T2D(ID,LU,LNG,COMM,IERR)
!
INTEGER, INTENT(OUT) :: ID
INTEGER, INTENT(IN) :: LU, LNG, COMM
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CREATE_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
WRITE(LU, *) 'POSITION',EXEC_POS,RUN_READ_CASE_POS
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_SET_CONFIG_T2D',
& NO_POSITION,
& RUN_READ_CASE_POS,IERR)
IF(IERR.NE.0) RETURN
!
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_SET_CONFIG_POS
!
CALL RUN_SET_CONFIG_T2D_D(INSTANCE_LIST_T2D(ID),LU,LNG,
& COMM,IERR)
IF(IERR.NE.0) RETURN
CALL SET_VAR_LIST_T2D_D(IERR)
!
END SUBROUTINE RUN_SET_CONFIG_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief initializes variables for TELEMAC2D in case of coupling
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (EDF R&D, LNHE)
!+ 15/04/2016
!+ V7P1
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE TELEMAC2D INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE CPL_INIT(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
IERR = 0
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
CALL CPL_INIT_T2D(ID,IERR)
END SUBROUTINE CPL_INIT
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF READS THE CASE FILE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM CAS_FILE [IN] PATH TO THE CASE FILE
!PARAM DICO_FILE [IN] PATH TO THE DICTIONARY FILE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_READ_CASE_T2D(ID,CAS_FILE, DICO_FILE, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=144), INTENT(IN) :: CAS_FILE
CHARACTER(LEN=144), INTENT(IN) :: DICO_FILE
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_READ_CASE_T2D',
& RUN_SET_CONFIG_POS,
& RUN_ALLOCATION_POS,IERR)
IF(IERR.NE.0) RETURN
!
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_READ_CASE_POS
!
CALL RUN_READ_CASE_T2D_D(INSTANCE_LIST_T2D(ID),CAS_FILE,
& DICO_FILE, IERR)
!
END SUBROUTINE RUN_READ_CASE_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF ALLOCATE ALL OF TELEMAC2D VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_ALLOCATION_T2D(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_ALLOCATION_T2D',
& RUN_READ_CASE_POS,
& RUN_INIT_POS,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_ALLOCATION_POS
!
CALL RUN_ALLOCATION_T2D_D(INSTANCE_LIST_T2D(ID),IERR)
!
END SUBROUTINE RUN_ALLOCATION_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE TELEMAC2D VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_INIT_T2D(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_INIT_T2D',
& RUN_ALLOCATION_POS,
& RUN_TIMESTEP_POS,IERR)
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_INIT_POS
!
CALL RUN_INIT_T2D_D(INSTANCE_LIST_T2D(ID),IERR)
END SUBROUTINE RUN_INIT_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF RUN A TIMESTEP IN TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_TIMESTEP_T2D(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_TIMESTEP_T2D',
& RUN_INIT_POS,RUN_FINALIZE_POS,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_TIMESTEP_POS
!
CALL RUN_TIMESTEP_T2D_D(INSTANCE_LIST_T2D(ID),IERR)
!
END SUBROUTINE RUN_TIMESTEP_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF FINALIZE A TELEMAC2D RUN
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_FINALIZE_T2D(ID,IERR)
!
INTEGER :: EXEC_POS
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_T2D(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_FINALIZE_T2D',
& RUN_TIMESTEP_POS,NO_POSITION,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_T2D(ID)%MYPOSITION = RUN_FINALIZE_POS
!
CALL RUN_FINALIZE_T2D_D(INSTANCE_LIST_T2D(ID),IERR)
IF(IERR.NE.0) RETURN
CALL DELETE_INSTANCE_T2D(ID,IERR)
DEALLOCATE(VNAME_T2D)
DEALLOCATE(VINFO_T2D)
!
END SUBROUTINE RUN_FINALIZE_T2D
!
! VARIABLE ACCESS FUNCTIONS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A DOUBLE VARIABLE FROM TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!HISTORY C GOEURY (EDF R&D, LNHE)
!+ 01/09/2016
!+ V7P1
!+ TREATMENT OF PARTITIONNING
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_DOUBLE_T2D
& (ID, VARNAME, VALUE, GLOBAL_NUM, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
DOUBLE PRECISION, INTENT(OUT) :: VALUE
INTEGER, INTENT(INOUT) :: INDEX1
INTEGER, INTENT(INOUT) :: INDEX2
INTEGER, INTENT(INOUT) :: INDEX3
LOGICAL, INTENT(IN) :: GLOBAL_NUM
INTEGER, INTENT(OUT) :: IERR
!
CHARACTER(LEN=T2D_TYPE_LEN) :: VARTYPE
LOGICAL :: READONLY
INTEGER :: NDIM
INTEGER :: IENT
INTEGER :: JENT
INTEGER :: KENT
INTEGER :: ID1
INTEGER :: ID2
INTEGER :: ID3
DOUBLE PRECISION P_DMIN,P_DMAX
EXTERNAL P_DMIN,P_DMAX
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
VALUE = 0
IF(GLOBAL_NUM)THEN
CALL GET_VAR_TYPE_T2D(VARNAME, VARTYPE, READONLY,
& NDIM,IENT,JENT,KENT,IERR)
IF(IENT.EQ.1)THEN
ID1 = GLOBAL_TO_LOCAL_POINT(INDEX1,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID1=INDEX1
END IF
IF(JENT.EQ.1)THEN
ID2 = GLOBAL_TO_LOCAL_POINT(INDEX2,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID2=INDEX2
END IF
IF(KENT.EQ.1)THEN
ID3 = GLOBAL_TO_LOCAL_POINT(INDEX3,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID3=INDEX3
END IF
!
IF((.NOT.(ID1.EQ.0.AND.ID2.EQ.0.AND.ID3.EQ.0)).OR.
& (INDEX1.EQ.0.AND.INDEX2.EQ.0.AND.INDEX3.EQ.0)) THEN
CALL GET_DOUBLE_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME,
& VALUE,ID1,ID2, ID3, IERR)
END IF
VALUE=P_DMAX(VALUE)
ELSE
IF(IENT.EQ.1)THEN
ID1 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX1)
ELSE
ID1=INDEX1
END IF
IF(JENT.EQ.1)THEN
ID2 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX2)
ELSE
ID2=INDEX2
END IF
IF(KENT.EQ.1)THEN
ID3 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX3)
ELSE
ID3=INDEX3
END IF
CALL GET_DOUBLE_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& ID1, ID2, ID3, IERR)
END IF
!
END SUBROUTINE GET_DOUBLE_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A DOUBLE VARIABLE OF TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!HISTORY C GOEURY (EDF R&D, LNHE)
!+ 01/09/2016
!+ V7P1
!+ TREATMENT OF PARTITIONNING
!!
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_DOUBLE_T2D
& (ID, VARNAME, VALUE, GLOBAL_NUM, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
DOUBLE PRECISION, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
LOGICAL, INTENT(IN) :: GLOBAL_NUM
INTEGER, INTENT(OUT) :: IERR
!
CHARACTER(LEN=T2D_TYPE_LEN) :: VARTYPE
LOGICAL :: READONLY
INTEGER :: NDIM
INTEGER :: IENT
INTEGER :: JENT
INTEGER :: KENT
INTEGER :: ID1
INTEGER :: ID2
INTEGER :: ID3
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
IF(GLOBAL_NUM)THEN
CALL GET_VAR_TYPE_T2D(VARNAME, VARTYPE, READONLY,
& NDIM,IENT,JENT,KENT,IERR)
! TODO: Create dedcaced error message
IF ((IENT.EQ.1).AND.(ID1.LE.0).OR.
& (JENT.EQ.1).AND.(ID2.LE.0).OR.
& (KENT.EQ.1).AND.(ID3.LE.0)) THEN
IERR = -1
ENDIF
IF(IENT.EQ.1)THEN
ID1 = GLOBAL_TO_LOCAL_POINT(INDEX1,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID1 = INDEX1
END IF
IF(JENT.EQ.1)THEN
ID2 = GLOBAL_TO_LOCAL_POINT(INDEX2,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID2 = INDEX2
END IF
IF(KENT.EQ.1)THEN
ID3 = GLOBAL_TO_LOCAL_POINT(INDEX3,
& INSTANCE_LIST_T2D(ID)%MESH)
ELSE
ID3=INDEX3
END IF
!
IF((.NOT.(ID1.EQ.0.AND.ID2.EQ.0.AND.ID3.EQ.0)).OR.
& (INDEX1.EQ.0.AND.INDEX2.EQ.0.AND.INDEX3.EQ.0)) THEN
CALL SET_DOUBLE_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME,
& VALUE, ID1,ID2, ID3, IERR)
END IF
ELSE
IF(IENT.EQ.1)THEN
ID1 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX1)
ELSE
ID1=INDEX1
END IF
IF(JENT.EQ.1)THEN
ID2 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX2)
ELSE
ID2=INDEX2
END IF
IF(KENT.EQ.1)THEN
ID3 = INSTANCE_LIST_T2D(ID)%MESH%KNOLG%I(INDEX3)
ELSE
ID3=INDEX3
END IF
CALL SET_DOUBLE_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& ID1,ID2, ID3, IERR)
END IF
!
END SUBROUTINE SET_DOUBLE_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET AN INTEGER VARIABLE FROM TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_INTEGER_T2D(ID, VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_INTEGER_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE GET_INTEGER_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF AN INTEGER VARIABLE OF TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_INTEGER_T2D(ID, VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_INTEGER_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE SET_INTEGER_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A STRING VARIABLE FROM TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_STRING_T2D(ID, VARNAME, VALUE,
& VALUELEN, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUELEN
CHARACTER, INTENT(OUT) :: VALUE(VALUELEN)
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_STRING_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& VALUELEN, IERR)
!
END SUBROUTINE GET_STRING_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A STRING VARIABLE OF TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_STRING_T2D(ID, VARNAME, VALUE,
& VALUELEN, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUELEN
CHARACTER, INTENT(IN) :: VALUE(VALUELEN)
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_STRING_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& VALUELEN, IERR)
!
END SUBROUTINE SET_STRING_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A BOOLEAN VARIABLE FROM TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_BOOLEAN_T2D
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_BOOLEAN_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE GET_BOOLEAN_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A BOOLEAN VARIABLE OF TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_BOOLEAN_T2D
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_BOOLEAN_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE SET_BOOLEAN_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET INFORMATIONS ON A VARIABLE OF TELEMAC2D
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM VARNAME [IN] NAME OF THE VARIABLE
!PARAM VARTYPE [OUT] TYPE OF THE VARIABLE
!+ (INTEGER, DOUBLE, STRING, BOOLEAN)
!PARAM READONLY [OUT] 0 IF THE VARIABLE IS READ ONLY
!+ 1 IF IT IS WRITTABLE
!PARAM NDIM [OUT] NUMBER OF DIMENSION
!+ (0 IF IT IS NOT AN ARRAY)
!PARAM IENT [OUT] 1 if the numbering is on point
!PARAM JENT [OUT] 1 if the numbering is on point
!PARAM KENT [OUT] 1 if the numbering is on point
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_TYPE_T2D
& (VARNAME, VARTYPE, READONLY, NDIM,IENT,JENT,KENT, IERR)
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
CHARACTER(LEN=T2D_TYPE_LEN), INTENT(OUT) :: VARTYPE
LOGICAL, INTENT(OUT) :: READONLY
INTEGER, INTENT(OUT) :: NDIM
INTEGER, INTENT(OUT) :: IERR
INTEGER, INTENT(OUT) :: IENT
INTEGER, INTENT(OUT) :: JENT
INTEGER, INTENT(OUT) :: KENT
!
CALL GET_VAR_TYPE_T2D_D
& (VARNAME, VARTYPE, READONLY, NDIM,IENT,JENT,KENT, IERR)
END SUBROUTINE GET_VAR_TYPE_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET THE SIZE OF EACH DIMENSION OF A VARAIBLE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARAIBLE
!PARAM DIM1 [OUT] SIZE OF THE FIRST DIMENSION
!PARAM DIM2 [OUT] SIZE OF THE SECOND DIMENSION
!PARAM DIM3 [OUT] SIZE OF THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_SIZE_T2D(ID, VARNAME, DIM1, DIM2, DIM3, IERR)
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=T2D_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: DIM1
INTEGER, INTENT(OUT) :: DIM2
INTEGER, INTENT(OUT) :: DIM3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_T2D(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_VAR_SIZE_T2D_D(INSTANCE_LIST_T2D(ID), VARNAME,
& DIM1, DIM2, DIM3, IERR)
!
END SUBROUTINE GET_VAR_SIZE_T2D
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A DESCRIPTION OF EACH VARIABLE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY Y AUDOUIN (EDF R&D, LNHE)
!+ 21/08/2013
!+ V6P3
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM VARNAME [OUT] LIST OF ALL THE VARIABLES
!PARAM VARINFO [OUT] LIST OF ALL THE DESCRIPTIONS
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_LIST_T2D(VARNAME, VARINFO, IERR)
!
CHARACTER(LEN=T2D_VAR_LEN), INTENT(INOUT) :: VARNAME(*)
CHARACTER(LEN=T2D_INFO_LEN), INTENT(INOUT) :: VARINFO(*)
INTEGER, INTENT(OUT) :: IERR
!
INTEGER I
IERR = 0
DO I=1,NB_VAR_T2D
VARNAME(I) = VNAME_T2D(I)
VARINFO(I) = VINFO_T2D(I)
ENDDO
!
END SUBROUTINE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief Returns the error message of the instance
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history y audouin (edf r&d, lnhe)
!+ 21/08/2013
!+ V6P3
!+ creation of the file
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!param id [in] id of the instance
!param ierr [in] Error code
!param mess [out] The erro message
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_ERROR_MESSAGE_T2D(ID,IERR,MESS)
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(IN) :: IERR
CHARACTER(LEN=ERROR_MESS_LEN), INTENT(OUT) :: MESS
!
CHARACTER(LEN=T2D_INFO_LEN) :: INST_MESS
CHARACTER(LEN=50) :: ERR_TYPE
INTEGER :: IERR2
!
CALL CHECK_INSTANCE_T2D(ID,IERR2)
IF(IERR2.NE.0) THEN
MESS = TRIM(ERR_MESS)
ELSE
CALL GET_INSTANCE_ERROR_T2D(ID,INST_MESS)
CALL GET_ERROR_TYPE(ID,INST_MESS)
MESS = TRIM(ERR_TYPE) // '\n' // INST_MESS
ENDIF
!
END SUBROUTINE GET_ERROR_MESSAGE_T2D
!
!***********************************************************************
! SISYPHE
!***********************************************************************
!
! EXECUTION FUNCTIONS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE INSTANCE AND SET THE OUTPUT
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [OUT] ID OF THE INSTANCE
!PARAM LU [IN] OUTPUT STREAM ID
!PARAM LNG [IN] OUTPUT LANGUAGE 2 ENGLISH 1 FRENCH
!PARAM COMM [IN] MPI COMMUNICATOR
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_SET_CONFIG_SIS(ID,LU,LNG,COMM,IERR)
!
INTEGER, INTENT(OUT) :: ID
INTEGER, INTENT(IN) :: LU, LNG,COMM
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CREATE_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
WRITE(LU, *) 'POSITION',EXEC_POS,RUN_READ_CASE_POS
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_SET_CONFIG_SIS',
& NO_POSITION,
& RUN_READ_CASE_POS,IERR)
IF(IERR.NE.0) RETURN
!
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_SET_CONFIG_POS
!
CALL RUN_SET_CONFIG_SIS_D(INSTANCE_LIST_SIS(ID),LU,LNG,COMM,
& IERR)
CALL SET_VAR_LIST_SIS_D(IERR)
!
END SUBROUTINE RUN_SET_CONFIG_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF READS THE CASE FILE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM CODE [IN] CODE FOR COUPLED CALL
!PARAM CAS_FILE [IN] PATH TO THE CASE FILE
!PARAM DICO_FILE [IN] PATH TO THE DICTIONARY FILE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_READ_CASE_SIS(ID,CODE,CAS_FILE, DICO_FILE, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=24), INTENT(IN) :: CODE
CHARACTER(LEN=144), INTENT(IN) :: CAS_FILE
CHARACTER(LEN=144), INTENT(IN) :: DICO_FILE
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_READ_CASE_SIS',
& RUN_SET_CONFIG_POS,
& RUN_ALLOCATION_POS,IERR)
IF(IERR.NE.0) RETURN
!
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_READ_CASE_POS
!
CALL RUN_READ_CASE_SIS_D(INSTANCE_LIST_SIS(ID),CODE,CAS_FILE,
& DICO_FILE, IERR)
!
END SUBROUTINE RUN_READ_CASE_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF ALLOCATE ALL OF SISYPHE VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI(EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_ALLOCATION_SIS(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_ALLOCATION_SIS',
& RUN_READ_CASE_POS,
& RUN_INIT_POS,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_ALLOCATION_POS
!
CALL RUN_ALLOCATION_SIS_D(INSTANCE_LIST_SIS(ID),IERR)
!
END SUBROUTINE RUN_ALLOCATION_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF INITIALISE THE SISYPHE VARIABLES
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_INIT_SIS(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_INIT_SIS',
& RUN_ALLOCATION_POS,
& RUN_TIMESTEP_POS,IERR)
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_INIT_POS
!
CALL RUN_INIT_SIS_D(INSTANCE_LIST_SIS(ID),IERR)
END SUBROUTINE RUN_INIT_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF RUN A TIMESTEP IN SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_TIMESTEP_SIS(ID,IERR)
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
INTEGER :: EXEC_POS
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_TIMESTEP_SIS',
& RUN_INIT_POS,RUN_FINALIZE_POS,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_TIMESTEP_POS
!
CALL RUN_TIMESTEP_SIS_D(INSTANCE_LIST_SIS(ID),IERR)
!
END SUBROUTINE RUN_TIMESTEP_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF FINALIZE A SISYPHE RUN
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE RUN_FINALIZE_SIS(ID,IERR)
!
INTEGER :: EXEC_POS
!
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
EXEC_POS = INSTANCE_LIST_SIS(ID)%MYPOSITION
CALL CHECK_CALL_POSITION(EXEC_POS,'RUN_FINALIZE_SIS',
& RUN_TIMESTEP_POS,NO_POSITION,IERR)
IF(IERR.NE.0) RETURN
INSTANCE_LIST_SIS(ID)%MYPOSITION = RUN_FINALIZE_POS
!
CALL RUN_FINALIZE_SIS_D(INSTANCE_LIST_SIS(ID),IERR)
IF(IERR.NE.0) RETURN
CALL DELETE_INSTANCE_SIS(ID,IERR)
!
END SUBROUTINE RUN_FINALIZE_SIS
!
! VARIABLE ACCESS FUNCTIONS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A DOUBLE VARIABLE FROM SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_DOUBLE_SIS
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
DOUBLE PRECISION, INTENT(OUT) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_DOUBLE_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE GET_DOUBLE_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A DOUBLE VARIABLE OF SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_DOUBLE_SIS
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
DOUBLE PRECISION, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_DOUBLE_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE SET_DOUBLE_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET AN INTEGER VARIABLE FROM SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_INTEGER_SIS(ID, VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_INTEGER_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE GET_INTEGER_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF AN INTEGER VARIABLE OF SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_INTEGER_SIS(ID, VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_INTEGER_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE SET_INTEGER_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A STRING VARIABLE FROM SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_STRING_SIS(ID, VARNAME, VALUE,
& VALUELEN, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUELEN
CHARACTER, INTENT(OUT) :: VALUE(VALUELEN)
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_STRING_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& VALUELEN, IERR)
!
END SUBROUTINE GET_STRING_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A STRING VARIABLE OF SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_STRING_SIS(ID, VARNAME, VALUE,
& VALUELEN, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUELEN
CHARACTER, INTENT(IN) :: VALUE(VALUELEN)
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_STRING_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& VALUELEN, IERR)
!
END SUBROUTINE SET_STRING_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A BOOLEAN VARIABLE FROM SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO READ
!PARAM VALUE [OUT] CONTAINIS THE READ VALUE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_BOOLEAN_SIS
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_BOOLEAN_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE GET_BOOLEAN_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF DEFINES THE VALUE OF A BOOLEAN VARIABLE OF SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARIABLE TO WRITE
!PARAM VALUE [IN] THE VALUE TO WRITE IN THE VARIABLE
!PARAM INDEX1 [IN] INDEX ON THE FIRST DIMENSION
!PARAM INDEX2 [IN] INDEX ON THE SECOND DIMENSION
!PARAM INDEX3 [IN] INDEX ON THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_BOOLEAN_SIS
& (ID, VARNAME, VALUE, INDEX1, INDEX2, INDEX3, IERR)
!
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(IN) :: VALUE
INTEGER, INTENT(IN) :: INDEX1
INTEGER, INTENT(IN) :: INDEX2
INTEGER, INTENT(IN) :: INDEX3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL SET_BOOLEAN_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME, VALUE,
& INDEX1, INDEX2, INDEX3, IERR)
!
END SUBROUTINE SET_BOOLEAN_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET INFORMATIONS ON A VARIABLE OF SISYPHE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM VARNAME [IN] NAME OF THE VARIABLE
!PARAM VARTYPE [OUT] TYPE OF THE VARIABLE
!+ (INTEGER, DOUBLE, STRING, BOOLEAN)
!PARAM READONLY [OUT] 0 IF THE VARIABLE IS READ ONLY
!+ 1 IF IT IS WRITTABLE
!PARAM NDIM [OUT] NUMBER OF DIMENSION
!+ (0 IF IT IS NOT AN ARRAY)
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_TYPE_SIS
& (VARNAME, VARTYPE, READONLY, NDIM, IERR)
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
CHARACTER(LEN=SIS_TYPE_LEN), INTENT(OUT) :: VARTYPE
LOGICAL, INTENT(OUT) :: READONLY
INTEGER, INTENT(OUT) :: NDIM
INTEGER, INTENT(OUT) :: IERR
!
CALL GET_VAR_TYPE_SIS_D
& (VARNAME, VARTYPE, READONLY, NDIM, IERR)
END SUBROUTINE GET_VAR_TYPE_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET THE SIZE OF EACH DIMENSION OF A VARAIBLE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID [IN] ID OF THE INSTANCE
!PARAM VARNAME [IN] NAME OF THE VARAIBLE
!PARAM DIM1 [OUT] SIZE OF THE FIRST DIMENSION
!PARAM DIM2 [OUT] SIZE OF THE SECOND DIMENSION
!PARAM DIM3 [OUT] SIZE OF THE THIRD DIMENSION
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_SIZE_SIS(ID, VARNAME, DIM1, DIM2, DIM3, IERR)
INTEGER, INTENT(IN) :: ID
CHARACTER(LEN=SIS_VAR_LEN), INTENT(IN) :: VARNAME
INTEGER, INTENT(OUT) :: DIM1
INTEGER, INTENT(OUT) :: DIM2
INTEGER, INTENT(OUT) :: DIM3
INTEGER, INTENT(OUT) :: IERR
!
CALL CHECK_INSTANCE_SIS(ID,IERR)
IF(IERR.NE.0) RETURN
!
CALL GET_VAR_SIZE_SIS_D(INSTANCE_LIST_SIS(ID), VARNAME,
& DIM1, DIM2, DIM3, IERR)
!
END SUBROUTINE GET_VAR_SIZE_SIS
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!BRIEF GET A DESCRIPTION OF EACH VARIABLE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!HISTORY R-S MOURADI (EDF R&D, LNHE)
!+ 17/03/2016
!+ V7P1
!+ CREATION OF THE FILE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM VARNAME [OUT] LIST OF ALL THE VARIABLES
!PARAM DICO_FILE [OUT] LIST OF ALL THE DESCRIPTIONS
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_VAR_LIST_SIS(VARNAME, VARINFO, IERR)
!
CHARACTER(LEN=SIS_VAR_LEN), INTENT(OUT) :: VARNAME(NB_VAR_SIS)
CHARACTER(LEN=SIS_INFO_LEN), INTENT(OUT) :: VARINFO(NB_VAR_SIS)
INTEGER, INTENT(OUT) :: IERR
!
INTEGER I
IERR = 0
DO I=1,NB_VAR_SIS
VARNAME(I) = VNAME_SIS(I)
VARINFO(I) = VINFO_SIS(I)
ENDDO
!
END SUBROUTINE
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief Returns the error message of the instance
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (edf r&d, lnhe)
!+ 17/03/2016
!+ V7P1
!+ creation of the file
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!param id [in] id of the instance
!param ierr [in] Error code
!param mess [out] The erro message
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE GET_ERROR_MESSAGE_SIS(ID,IERR,MESS)
INTEGER, INTENT(IN) :: ID
INTEGER, INTENT(IN) :: IERR
CHARACTER(LEN=ERROR_MESS_LEN), INTENT(OUT) :: MESS
!
CHARACTER(LEN=SIS_INFO_LEN) :: INST_MESS
CHARACTER(LEN=50) :: ERR_TYPE
INTEGER :: IERR2
!
CALL CHECK_INSTANCE_SIS(ID,IERR2)
IF(IERR2.NE.0) THEN
MESS = TRIM(ERR_MESS)
ELSE
CALL GET_INSTANCE_ERROR_SIS(ID,INST_MESS)
CALL GET_ERROR_TYPE(ID,INST_MESS)
MESS = TRIM(ERR_TYPE) // '\n' // INST_MESS
ENDIF
!
END SUBROUTINE GET_ERROR_MESSAGE_SIS
!
!***********************************************************************
! COUPLING T2D_SIS
!***********************************************************************
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief saves original charr and susp values after first sisyphe call
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (EDF R&D, LNHE)
!+ 15/04/2016
!+ V7P1
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID_T2D [IN] ID OF THE TELEMAC2D INSTANCE
!PARAM ID_SIS [IN] ID OF THE SISYPHE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
SUBROUTINE SAVE_CHARR_SUSP(ID_T2D, ID_SIS,IERR)
!
INTEGER, INTENT(IN) :: ID_T2D
INTEGER, INTENT(IN) :: ID_SIS
INTEGER, INTENT(OUT) :: IERR
!
IERR = 0
CALL CHECK_INSTANCE_T2D(ID_T2D,IERR)
IF(IERR.NE.0) RETURN
CALL CHECK_INSTANCE_SIS(ID_SIS,IERR)
IF(IERR.NE.0) RETURN
CALL SAVE_CHARR_SUSP_CPL(INSTANCE_LIST_SIS(ID_SIS),
& INSTANCE_LIST_T2D(ID_T2D), IERR)
END SUBROUTINE SAVE_CHARR_SUSP
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief deals with cases : BEDLOAD OF SUSPENSION
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (EDF R&D, LNHE)
!+ 15/04/2016
!+ V7P1
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID_T2D [IN] ID OF THE TELEMAC2D INSTANCE
!PARAM ID_SIS [IN] ID OF THE SISYPHE INSTANCE
!param CHARR_SUSP [OUT] DEFINES WHICH SISYPHE CALL
! = 1 Means Bedload
! = 2 Means Suspension
! = 3 Means Both
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
SUBROUTINE CHARR_OR_SUSP(ID_T2D, ID_SIS, CHARR_SUSP, IERR)
!
INTEGER, INTENT(IN) :: ID_T2D
INTEGER, INTENT(IN) :: ID_SIS
INTEGER, INTENT(OUT) :: CHARR_SUSP
INTEGER, INTENT(OUT) :: IERR
!
IERR = 0
CALL CHECK_INSTANCE_T2D(ID_T2D,IERR)
IF(IERR.NE.0) RETURN
CALL CHECK_INSTANCE_SIS(ID_SIS,IERR)
IF(IERR.NE.0) RETURN
CALL CHARR_OR_SUSP_CPL(INSTANCE_LIST_SIS(ID_SIS),
& INSTANCE_LIST_T2D(ID_T2D),
& CHARR_SUSP,IERR)
END SUBROUTINE CHARR_OR_SUSP
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief sets loop variables for sisyphe in case of coupling
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (EDF R&D, LNHE)
!+ 15/04/2016
!+ V7P1
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID_T2D [IN] ID OF THE TELEMAC2D INSTANCE
!PARAM ID_SIS [IN] ID OF THE SISYPHE INSTANCE
!param CALL_TYPE [IN] DEFINES WHICH SISYPHE CALL
! = 0 Means Initializing
! = 1 Means Bedload CALL
! = 2 Means Suspension CALL
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_VAR_SIS(ID_T2D,ID_SIS, CALL_TYPE,IERR)
!
INTEGER, INTENT(IN) :: ID_T2D
INTEGER, INTENT(IN) :: ID_SIS
INTEGER, INTENT(IN) :: CALL_TYPE
INTEGER, INTENT(OUT) :: IERR
!
IERR = 0
CALL CHECK_INSTANCE_T2D(ID_T2D,IERR)
IF(IERR.NE.0) RETURN
CALL CHECK_INSTANCE_SIS(ID_SIS,IERR)
IF(IERR.NE.0) RETURN
CALL SET_VAR_SIS_CPL(INSTANCE_LIST_T2D(ID_T2D), CALL_TYPE,
& INSTANCE_LIST_SIS(ID_SIS),IERR)
END SUBROUTINE SET_VAR_SIS
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!brief sends variables to telemac2d after sisyphe call
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
!history R-S MOURADI (EDF R&D, LNHE)
!+ 15/04/2016
!+ V7P1
!+ Creation of the file
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!PARAM ID_T2D [IN] ID OF THE TELEMAC2D INSTANCE
!PARAM ID_SIS [IN] ID OF THE SISYPHE INSTANCE
!PARAM IERR [OUT] 0 IF SUBROUTINE SUCCESSFULL,
!+ ERROR ID OTHERWISE
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUBROUTINE SET_VAR_T2D(ID_T2D, ID_SIS, IERR)
!
INTEGER, INTENT(IN) :: ID_T2D
INTEGER, INTENT(IN) :: ID_SIS
INTEGER, INTENT(OUT) :: IERR
!
IERR = 0
CALL CHECK_INSTANCE_T2D(ID_T2D,IERR)
IF(IERR.NE.0) RETURN
CALL CHECK_INSTANCE_SIS(ID_SIS,IERR)
IF(IERR.NE.0) RETURN
CALL SET_VAR_T2D_CPL(INSTANCE_LIST_SIS(ID_SIS),
& INSTANCE_LIST_T2D(ID_T2D),IERR)
END SUBROUTINE SET_VAR_T2D
END MODULE API_INTERFACE
|
SUBROUTINE GASUB(TIME,DT,L,R,RAIN,NEND,TRAI)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C The subroutine solves and infiltration problem for unsteady rainfall C
C case using the Green-Ampt infiltration model. The program is based on C
C Skaggs and Khaleel (1982) in Hydrologic modeling of small watersheds C
C ASAE monograph no. 5, and Chu (1978) Water Resour. Res. C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C THIS IS A MODIFIED VERSION OF THE ORIGINAL METHOD. IN THIS CASE C
C THE INFILTRATION IS ALLOWED TO BE ITS MAXIMUM POTENTIAL AFTER THE C
C FIRST PODING. THE IMPLICATION HERE IS THAT AFTER THE ORIGINAL C
C PONDING IS ACHIEVED, THE RUNOFF WATER MOVING AT THE SURFACE WILL C
C SUPPLY ENOUGH WATER TO SUSTAIN THE MAXIMUM POSSIBLE INFILTRATION C
C FOR THAT TIME STEP, IN OTHER WORDS, THE EFFECTIVE RAILFALL FEEDED C
C INTO THE MAIN FE-PROGRAM (R) WILL BE IN MOST CASES A NEGATIVE VALUE C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C Ponding indicator: beginning of the period (NPOND=1 ponded;0 no-ponded)C
C (Note:rmc,3/2011) end of the period (CU>0 ponded;CU=<0 no-ponded) C
C C
C units: m,s C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
IMPLICIT DOUBLE PRECISION(A-H,O-Z)
COMMON/GA1/PS,PSOLD,PST,F,RO,TP,TPP,FPI,STO,CU,AGA,BGA,DM,SM,Z
COMMON/GA2/LO,NPOND,NPFORCE,NPFORCE0
DIMENSION RAIN(200,2)
MAXIT=100
C2=BGA/AGA
c------Check if end of field runoff has been reached and if so reset case as---
c------no-ponding at beginning and end of the period (NPOND=0,CU<0)(Case 1b)---
IF(NEND.EQ.1)THEN
NPOND=0
CU=-1.D0
ENDIF
c------Check if time step belongs to the same rainfall period as before (L=LO)-
c------and if not reset the total rainfall value for the end of the period ----
IF(L.NE.LO) THEN
PSOLD=PS
PST = PS + RAIN(L,2)*(RAIN(L+1,1)-RAIN(L,1))
c-----------rmc03/2011- missing case for NPOND=1 and new_rain<end_infiltration-
c-----------of last period (fp,capacity since soil was ponded, i.e. NPOND=1)---
IF(NPOND.EQ.1.AND.FPI.GT.RAIN(L,2)) NPOND=0
ENDIF
c-----rmc03/2011-new surface ponding forcing scheme (NPFORCE=1)when overland flow
c-----sustains infiltration capacity regardless of point excess rainfall calculation
IF(NPFORCE.EQ.1) NPOND=1
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C Surface ponding at beginning? y(npond=1), n (npond=0): C
C CASE 1. Without surface ponding at the beginning of the period C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
IF(NPOND.EQ.0) THEN
c-----------If new rainfall period calculate the cum. infiltration at tp (FP)
c-----------to find out if at the end of period there is ponding (CU>0)
IF(L.NE.LO) THEN
FP= BGA/(RAIN(L,2)-AGA)
IF(FP.LT.0.D0) FP=F
CU= PST - RO - FP
IF(AGA.GE.RAIN(L,2))CU=-1.D0
ENDIF
C-----1-a) With ponding at the end of the period (Cu >0)-----------------------
IF (CU.GT.0.D0) THEN
fcase=1.1d0
c-------------Recalculate time to ponding and shift time when we regain ponding
c-------------within the current the time step (i.e. there was no ponding (npond=0)
c-------------at the beginning of time step but there is at the end (Cu>0).
IF(L.NE.LO) THEN
TP=(FP-PS+RO)/RAIN(L,2)+RAIN(L,1)
IF (TP.LT.RAIN(L,1))THEN
TP=RAIN(L,1)
FP=F
ENDIF
TPP=(FP-C2*DLOG(1.D0+FP/(C2)))/AGA
ENDIF
PS= PSOLD + RAIN(L,2)*(TIME-RAIN(L,1))
c-------------Split time step in before tp (fpi=i) and after (fpi=f)
IF(TIME.LT.TP)THEN
F= PS -RO
FPI=RAIN(L,2)
ELSE
C1= AGA*(TIME-TP+TPP)
F=RNEWTON(C1,C2,F)
FPI=AGA+BGA/F
EXCESS= PS -F - RO -STO
STO =STO +EXCESS
IF (STO.GT.SM) THEN
ROI=STO-SM
STO=SM
RO =RO +ROI
ENDIF
ENDIF
c-------------Left hand side of kinematic wave equation (re=i-f)
R=RAIN(L,2)-FPI
c-------------If the end of time step falls in new rain period calculate f
c-------------for that time and reset initial condition to ponding
IF((TIME+DT).GT.RAIN(L+1,1)) THEN
C1=AGA*(RAIN(L+1,1)-TP+TPP)
F=RNEWTON(C1,C2,F)
NPOND=1
ENDIF
C-----1-b) No ponding at the end of the period (Cu <0, fpi=i)-----------
ELSE
fcase=1.2d0
PS= PSOLD + RAIN(L,2)*(TIME-RAIN(L,1))
c-------------rmc/5/2011/ account for storage in mass balance at end of runoff
IF(STO.GT.0.D0.AND.NEND.EQ.1)THEN
F=PS-RO+STO
ELSE
F=PS-RO
ENDIF
FPI=RAIN(L,2)
c-------------Left hand side of kinematic wave equation (re=i-f)
R=RAIN(L,2)-FPI
IF((TIME+DT).GT.RAIN(L+1,1))F = PST -RO
ENDIF
C-----------Do mass balance at the end of this rainfall period----------
IF((TIME+DT).GT.RAIN(L+1,1)) THEN
PS=PST
EXCESS= PS -F - RO -STO
STO =STO +EXCESS
IF (STO.GT.SM) THEN
ROI=STO-SM
STO=SM
RO =RO +ROI
ENDIF
ENDIF
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C CASE 2. With surface ponding at the beginning of the period (NPOND=1) C
C Note: this assumes that once field inflow starts (at NCHCK) the soil C
C will be kept ponded by overland runoff until the inflow hydrograph ends C
C (i.e. NEND=1). The case when ponding ceases at the end of the time step C
C is not considered since the time steps are small and the error caused C
C by ignoring this is neglibible (i.e considering only ponding that step).C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
ELSE
fcase=2.0d0
PS= PSOLD + RAIN(L,2)*(TIME-RAIN(L,1))
C1= AGA*(TIME-TP+TPP)
F=RNEWTON(C1,C2,F)
IF(ISNAN(F)) F=PS
FPI=AGA+BGA/F
ROI= PS -F - RO
IF(ROI.LT.0.d0) ROI=0.d0
RO =RO +ROI
R=RAIN(L,2)-FPI
IF((TIME+DT).GT.RAIN(L+1,1))THEN
F=PST-RO
PS=PST
ROI= PS -F - RO -STO
RO =RO +ROI
ENDIF
ENDIF
c--rmc,03/2011, Calculate wetting front front depth, z(m) for new .ohy output
Z=F/DM
c-----Set rainfall period for next time step as the current one and total
c-----cummulative rain to the one just calculated in this time step
LO=L
TRAI=PS
c--for debug--gasub-----
c write(19,100)time,tw,z,F,PS,RO,FPI,RAIN(L,2),tp,tpp,NPFORCE,
c & fcase,CU
c100 format(2f10.1,6e11.3,2f12.4,i4,f5.2,2f10.4)
c--for debug--gasub-----
RETURN
END
FUNCTION RNEWTON(C1,C2,F)
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
VF=F+1.0D-6
MAXIT=101000
ERROR=1.D0
NS=0
DO 120 WHILE(NS.LT.MAXIT.AND.ERROR.GT.1D-8)
VFO=VF
PHI=C1-VF+C2*DLOG(1.D0+VF/C2)
DPHI=C2/(C2+VF)-1.D0
VF=VFO-PHI/DPHI
ERROR=DABS(VFO-VF)
NS=NS+1
120 CONTINUE
RNEWTON=VF
if(ns.ge.maxit) print*,'ns=',ns
return
END
|
C
C $Id: dpdsym.f,v 1.4 2008-07-27 00:16:58 haley Exp $
C
C Copyright (C) 2000
C University Corporation for Atmospheric Research
C All Rights Reserved
C
C The use of this Software is governed by a License Agreement.
C
SUBROUTINE DPDSYM (XPSW,YPSW,CSYM,WOSW,ANGD)
C
CHARACTER*1 CSYM
C
C This routine is called by DPDRAW to draw a symbol at the point
C (XPSW,YPSW) in the world coordinate system. The symbol to be
C drawn is the one associated with the character CSYM. Its width
C is to be WOSW, in the world coordinate system, and it is to be
C written at the angle ANGD, in degrees measured counterclockwise
C from a horizontal vector pointing to the right.
C
C Declare coordinate arrays in which to define the mark.
C
DIMENSION XCRA(37),YCRA(37)
C
C Define a multiplicative constant to convert from degrees to radians.
C
DATA DTOR / .017453292519943 /
C
C Compute the coordinates of the point defining the mark. The curious
C constants used in some of this code are intended to make each symbol
C have the same area as that of a circle symbol.
C
IF (CSYM.EQ.'0'.OR.CSYM.EQ.'5') THEN
C
C The mark is a circle.
C
DO 101 I=1,37
ANGR=DTOR*(REAL(I-1)*10.)
XCRA(I)=XPSW+(WOSW/2.)*COS(ANGR)
YCRA(I)=YPSW+(WOSW/2.)*SIN(ANGR)
101 CONTINUE
C
NCRA=37
C
ELSE IF (CSYM.EQ.'1'.OR.CSYM.EQ.'6') THEN
C
C The mark is a square.
C
DO 102 I=1,5
ANGR=DTOR*(ANGD+45.+REAL(I-1)*90.)
XCRA(I)=XPSW+1.25331*(WOSW/2.)*COS(ANGR)
YCRA(I)=YPSW+1.25331*(WOSW/2.)*SIN(ANGR)
102 CONTINUE
C
NCRA=5
C
ELSE IF (CSYM.EQ.'2'.OR.CSYM.EQ.'7') THEN
C
C The mark is a triangle.
C
DO 103 I=1,4
ANGR=DTOR*(ANGD+90.+REAL(I-1)*120.)
XCRA(I)=XPSW+1.55512*(WOSW/2.)*COS(ANGR)
YCRA(I)=YPSW+1.55512*(WOSW/2.)*SIN(ANGR)
103 CONTINUE
C
NCRA=4
C
ELSE IF (CSYM.EQ.'3'.OR.CSYM.EQ.'8') THEN
C
C The mark is a diamond.
C
DO 104 I=1,5
ANGR=DTOR*(ANGD+REAL(I-1)*90.)
XCRA(I)=XPSW+1.25331*(WOSW/2.)*COS(ANGR)
YCRA(I)=YPSW+1.25331*(WOSW/2.)*SIN(ANGR)
104 CONTINUE
C
NCRA=5
C
ELSE IF (CSYM.EQ.'4'.OR.CSYM.EQ.'9') THEN
C
C The mark is a star.
C
DO 105 I=1,11
ANGR=DTOR*(ANGD+18.+REAL(I-1)*36.)
IF (MOD(I,2).EQ.0) THEN
RADI=.381966
ELSE
RADI=1.
END IF
XCRA(I)=XPSW+1.67289*RADI*(WOSW/2.)*COS(ANGR)
YCRA(I)=YPSW+1.67289*RADI*(WOSW/2.)*SIN(ANGR)
105 CONTINUE
C
NCRA=11
END IF
C
C Fill or outline the mark.
C
IF (CSYM.GE.'0'.AND.CSYM.LE.'4') THEN
CALL GFA (NCRA,XCRA,YCRA)
ELSE IF (CSYM.GE.'5'.AND.CSYM.LE.'9') THEN
CALL GPL (NCRA,XCRA,YCRA)
END IF
C
C Done.
C
RETURN
C
END
|
subroutine sub1
write(6, *) 'output from sub1.'
return
end
|
C @(#)loadarea.f 20.5 1/4/99
subroutine loadarea (xbuf, error)
character xbuf*(*)
integer error
c
c load area records into tables
c
include 'ipfinc/parametr.inc'
include 'ipfinc/arcntl.inc'
include 'ipfinc/area.inc'
include 'ipfinc/arsort.inc'
include 'ipfinc/blank.inc'
include 'ipfinc/prt.inc'
common /is_batch / is_batch
if (xbuf(1:2) .eq. 'AC' .or. xbuf(1:2) .eq. 'A ' .or.
& xbuf(1:2) .eq. 'A0') then
ntotc=ntotc+1
if (ntotc .le. MAXCAR) then
read (xbuf,270,err=900) arcnam(ntotc),arcbus(ntotc),
1 arcbas(ntotc),arcnet(ntotc),(arczns(i,ntotc),i=1,MAXCAZR)
270 format (bz,3x,a10,a8,f4.0,1x,f8.0,10(1x,a2))
arcnet(ntotc)=arcnet(ntotc)/bmva
do i = MAXCAZR+1, MAXCAZ
arczns(i,ntotc) = ' '
enddo
else
write (errbuf(1),290) MAXCAR
290 format (' More than ',i3,' area interchange control areas,',
1 ' interchange aborted.')
if (is_batch .eq. 0) then
call prterx ('E',1)
else
call prterx ('F',1)
endif
kase1(6)=0
ntotc=0
kabort=1
endif
else if (xbuf(1:2) .eq. 'AO' ) then
natot=natot+1
if (natot .gt. 90) then
write (errbuf(1),310)
310 format(' More than 90 area output sort areas. ',
1 'AREA sort aborted.')
call prterx ('W',1)
minerr=1
natot=0
else
read (xbuf,330,err=900) arsnam(natot),
1 (arsens(k,natot),k=1,22)
330 format (bz,3x,a10,22(1x,a2))
do k = 23, MAXCAZ
arsens(k,natot) = ' '
enddo
endif
else if ( xbuf(1:1) .eq. 'A' ) then
read (xbuf(2:2), '(i1)') isubtyp
if ( isubtyp .lt. MAXCAZ / MAXCAZR ) then
j1 = isubtyp * MAXCAZR + 1
j2 = (isubtyp+1) * MAXCAZR
read (xbuf,360,err=900) (arczns(i,ntotc),i=j1,j2)
endif
360 format (t35,10(1x,a2))
else if (xbuf(1:1) .eq. 'I') then
c
c process area intertie "i" records
c
ntotic = ntotic+1
if (ntotic.gt.5*MAXCAR-1) then
write(errbuf(1),392) 5*MAXCAR
392 format(' More than ',i4,
& ' area intertie "I" records. Interchange aborted.')
if (is_batch .eq. 0) then
call prterx ('E',1)
else
call prterx ('F',1)
endif
ntotic = 0
kabort = 1
else
read (xbuf,393,err=900) arcint(1,ntotic),arcint(2,ntotic),
1 arcinp(ntotic)
393 format(bz,3x,a10,1x,a10,2x,f8.0)
ntotic = ntotic+1
arcint(1,ntotic) = arcint(2,ntotic-1)
arcint(2,ntotic) = arcint(1,ntotic-1)
arcinp(ntotic) = -arcinp(ntotic-1)
endif
endif
500 continue
return
900 write (errbuf(1),910) xbuf(1:80)
910 format (' Illegal data in field :(',a80,')')
call prterx ('W',1)
go to 500
end
|
/* vcdnps.f
* MODULE
Название Программного Модуля
* DESCRIPTION
Назначение программы, описание процедур и функций
* RUN
Способ вызова программы, описание параметров, примеры вызова
* CALLER
Список процедур, вызывающих этот файл
* SCRIPT
Список скриптов, вызывающих этот файл
* INHERIT
Список вызываемых процедур
* MENU
Перечень пунктов Меню Прагмы
* AUTHOR
31/12/99 pragma
* CHANGES
*/
/* vcdnps.f Валютный контроль
Форма паспорта сделки/доплиста
18.10.2002 nadejda создан
21.03.2008 galina изменен формат вывода номера паспорта сделки
07.04.2008 galina - добавлено новое поле "ОСНОВ.ОФОРМ";
выбор значения поля "ОСНОВ.ОФОРМ" из справочника
17.04.2008 galina - ввод значений поля "ОСНОВ.ОФОРМ" вручную через запятую;
проверка наличия значений поля "ОСНОВ.ОФОРМ" в справочнике;
добавлены поля СРОКИ, ВАЛЮТ.ОГОВОРКА, ФОРМЫ РАСЧЕТОВ, ВАЛЮТЫ ПЛАТЕЖА
18.05.2009 galina - возмоность ввода пустой даты завершения контракта
7/10/2010 aigul - полe "ОСОБЫЕ ОТМ" увеличение на 6 строк и каждую по 50 символов
25/11/2010 galina - поправила редактирование поля "ОСОБЫЕ ОТМ"
17.01.2011 aigul - добавила вывод след данных в МТ111 (запись идет в поле vcps.info[3])
11 ОКПО банка
12 Наименование экспортера/импортера
13 Код ОКПО экспортера/импортера
14 Код РНН экспортера/импортера
15 ОПФ экспортера/импортера
16 Номер контракта
17 Дата контракта
18 Сумма контракта
19 Наименование нерезидента
20 страна нерезидента
21 Сроки репатриации
22 Особые отметки
23 Валюта контракта
24 Последняя дата
25 Валюта платежа
26 Код способа расчетов
27 Вал оговорка
28 Детали вал оговорки
30.09.2011 damir - добавил vcps.okpoprev во фрейм vcdnps.
26.10.2011 aigul - подправила удаление данных из vcps.info[3]
29.06.2012 damir - внедрено Т.З. № 1355, изменения в vcdnps.f.
10.07.2012 damir - перекомпиляция.
*/
def var v-dntypename as char.
def var v-nbcrckod as char.
def var v-sumdoccon as decimal.
def var v-rslctype as char format "x(4)".
def var v-rslcdate as date format "99/99/99".
def var v-rslcnum as char format "x(18)".
def buffer b-vcps for vcps.
def buffer b2-vcps for vcps.
def var msg-err as char.
def var v-comcod as char.
def var v-comsum as deci.
def var v-comcrc as char.
def var v-comdate as date.
def var v-comjh as char.
def var v-psreason as char no-undo.
def var v-sel as integer no-undo.
{vc-crosscurs.i}
/*Проверка правильности основ.оформ.доп.листа*/
function check-psreas returns char (p-psreas as char).
def var i as integer.
def var s as char.
def var l as logical.
def var v-psreason_int as char no-undo.
if v-psreason_int = "" then do:
for each codfr where codfr.codfr = 'vcpsreas' and codfr.code <> 'msc' no-lock:
v-psreason_int = v-psreason_int + string(integer(codfr.code)).
end.
end.
p-psreas = trim(p-psreas).
if p-psreas = "" then s = "*".
else do:
if substring(p-psreas, length(p-psreas), 1) = "," then
p-psreas = substring(p-psreas, length(p-psreas) - 1).
l = true.
do i = 1 to num-entries(p-psreas) :
s = entry(i, p-psreas).
if s = "" or (index(v-psreason_int,s) = 0) then do:
l = false.
if s = "" then s = "*".
leave.
end.
end.
if l then s = "".
end.
return s.
end.
function chk-dndate returns logical (p-value as date).
if p-value = ? then do:
msg-err = "Введите дату документа!". return false. end.
if p-value < vccontrs.ctdate then do:
msg-err = "Дата документа не может быть меньше даты контракта!". return false. end.
if vcps.dntype = "01" and p-value > vccontrs.lastdate and (vccontrs.cttype <> '1' or vccontrs.lastdate <> ?) then do:
msg-err = "Дата паспорта сделки не может быть больше последней даты контракта!". return false. end.
if can-find(b-vcps where b-vcps.contract = s-contract and
b-vcps.dntype = vcps.dntype and b-vcps.dnnum = vcps.dnnum and
b-vcps.dndate = p-value and b-vcps.ps <> vcps.ps no-lock) then do:
msg-err = "Уже есть документ с таким номером и датой по данному контракту!". return false. end.
/* DEM, FRF, ITL, DKK работали только до 07/01/02 */
find ncrc where ncrc.crc = vcps.ncrc no-lock no-error.
if avail ncrc then if ncrc.prefix <> "" and date(entry(2, ncrc.prefix)) <= p-value then do:
msg-err = "Нельзя пользоваться валютой " + ncrc.code + " после " + entry(2, ncrc.prefix) +
" - заменена " + entry(1, ncrc.prefix) + " !".
return false.
end.
return true.
end.
function chk-dnnum returns logical (p-value as char).
if p-value = "" then do:
msg-err = "Введите номер документа!". return false. end.
if can-find(b-vcps where b-vcps.contract = s-contract and
b-vcps.dntype = vcps.dntype and b-vcps.dnnum = p-value and
b-vcps.dndate = vcps.dndate and b-vcps.ps <> vcps.ps no-lock) then do:
msg-err = "Уже есть документ с таким номером и датой по данному контракту!". return false. end.
return true.
end.
function chk-crc returns logical (p-value as integer).
def var v-curs as deci.
find ncrc where ncrc.crc = p-value no-lock no-error.
if not avail ncrc then do:
msg-err = "Недопустимый код валюты!". return false. end.
/*
if p-value <> vccontrs.ncrc and lookup(ncrc.code, vccontrs.ctvalpl) = 0 then do:
msg-err = "Выбранная валюта не является валютой контракта и не входит в список валют платежа!".
return false.
end.
*/
/* DEM, FRF, ITL, DKK работали только до 07/01/02 */
find ncrc where ncrc.crc = p-value no-lock no-error.
if avail ncrc then if ncrc.prefix <> "" and date(entry(2, ncrc.prefix)) <= vcps.dndate then do:
msg-err = "Нельзя пользоваться валютой " + ncrc.code + " после " + entry(2, ncrc.prefix) +
" - заменена " + entry(1, ncrc.prefix) + " !".
return false.
end.
return true.
end.
function check-formrs returns char (p-formrs as char).
def var i as integer.
def var s as char.
def var l as logical.
p-formrs = trim(p-formrs).
if p-formrs = "" then s = "".
else do:
if substring(p-formrs, length(p-formrs), 1) = "," then
p-formrs = substring(p-formrs, length(p-formrs) - 1).
l = true.
do i = 1 to num-entries(p-formrs) :
s = entry(i, p-formrs).
if (s = "" or s = "msc" or
not can-find(codfr where codfr.codfr = "vcfpay" and codfr.code = s no-lock)) then do:
l = false. leave. end.
end.
if l then s = "".
end.
return s.
end.
function check-valpl returns char (p-valpl as char).
def var i as integer.
def var s as char.
def var l as logical.
p-valpl = trim(p-valpl).
if p-valpl = "" then s = "".
else do:
if substring(p-valpl, length(p-valpl), 1) = "," then
p-valpl = substring(p-valpl, length(p-valpl) - 1).
l = true.
do i = 1 to num-entries(p-valpl) :
s = entry(i, p-valpl).
if (s = "" or not (can-find(ncrc where ncrc.code = s no-lock))) then do:
l = false. leave. end.
end.
if l then s = "".
end.
return s.
end.
form
vcps.dntype colon 12 format "xx" validate(vcps.dntype <> "" and vcps.dntype <> "msc" and
can-find(codfr where codfr.codfr = "vcdoc" and codfr.code = vcps.dntype and
codfr.name[5] = "s" no-lock) and ((vcps.dntype <> "01") or
not can-find(b-vcps where b-vcps.contract = s-contract and b-vcps.dntype = "01"
and b-vcps.ps <> vcps.ps no-lock)),
"Неверный тип документа или паспорт сделки уже введен!")
v-dntypename format "x(15)" no-label
vcps.rdt label "РЕГ." colon 39 vcps.rwho no-label colon 50 skip
/*vcps.info[4] colon 12 label "ОСНОВ.ОФОРМ" format "x(5)" validate(check-psreas(vcps.info[4]) = "",
" Введен неверное основ.оформления доп.листа или не заполнена измененная информация" + replace(check-psreas(vcps.info[4]),'*','') + " !")
help " Код основ.оформления доп.листа по классификатору (F2 - помощь)"*/
vcps.cdt label "АКЦ." colon 39 vcps.cwho no-label colon 50 skip
v-dnnum colon 12 format "x(50)" label "НОМЕР"/* validate(chk-dnnum(vcps.dnnum), msg-err)*/ skip
vcps.dndate colon 12 validate(chk-dndate(vcps.dndate), msg-err)
vcps.lastdate colon 39 validate(vcps.lastdate = ? or vcps.lastdate >= vcps.dndate,
"Последняя дата не может быть меньше даты документа!") skip
vcps.ncrc colon 12 format ">>9" label "ВАЛЮТА" validate(chk-crc(vcps.ncrc), msg-err)
v-nbcrckod format "xxx" no-label
vcps.sum colon 39 validate(vcps.sum >= 0, "Сумма не может быть отрицательной!") skip
vcps.ctvalpl label "ВАЛ.ПЛ." colon 12 format "x(20)" validate(check-valpl(vcps.ctvalpl) = "",
" Введен неверный код валюты " + check-valpl(vcps.ctvalpl) + " !") skip
/*vcps.ctvalogr label "ВАЛЮТ.ОГОВ" colon 12 format "x(50)" skip*/
vcps.cursdoc-con label "К ВАЛ.КОН." colon 12 format ">>>>>>>>>9.9999<<"
validate(vcps.cursdoc-con > 0, "Курс не может быть нулевым!")
v-sumdoccon format ">>>,>>>,>>>,>>>,>>9.99" label "В ВАЛ.КОН" colon 39 skip
vcps.ctterm colon 12 format "999.99"
/*vcps.ctformrs colon 39 format "x(24)" validate(check-formrs(vcps.ctformrs) = "",
" Введен неверный код формы расчетов " + check-formrs(vcps.ctformrs) + " !") skip*/
/*vcps.rslc colon 12 label "РЕГ.СВ/ЛИЦ"*/
/*vcps.okpoprev colon 12 label "ОКПО пред." format "x(12)"*/ /*ОКПО предыдущего банка*/
v-rslctype no-label colon 25
v-rslcdate no-label colon 30 v-rslcnum no-label colon 39
vcps.dnnote[1] colon 12 format "x(20)" label "ОТ БАНКА"
vcps.dnnote[2] colon 42 format "x(20)" label "КЛИЕНТА" skip
/*vcps.dnnote[3] colon 12 format "x(50)" label "ОТ ТАМОЖНИ" skip*/
/*vcps.dnnote[4] colon 12 format "x(50)" label "ВАЛЮТ.ОГОВ" skip*/
/*vcps.dnnote[5]*/ v-note colon 12 format "x(50)" label "ОСОБЫЕ ОТМ" skip
v-note1 colon 12 format "x(50)" label "" skip
v-note2 colon 12 format "x(50)" label "" skip
v-note3 colon 12 format "x(50)" label "" skip
v-note4 colon 12 format "x(50)" label "" skip
v-note5 colon 12 format "x(50)" label "" skip
v-comcod colon 12 format "x(4)" label "КОМИССИЯ"
v-comjh colon 23 format "x(8)" label "TRX"
v-comdate colon 31 format "99/99/99" no-label
v-comsum colon 49 format "zzz,zz9.99" label "СУММА"
v-comcrc format "x(3)" no-label skip
with row 4 width 66 overlay side-label title "КОНТРАКТ : " + v-contrnum frame vcdnps.
{vc-summf.i}
def var v-sel1 as char.
def var v-del as char.
def var spn as char.
def var j as inte.
def var v-cont as inte.
def var v-psnum1 as char.
def var v-psreason1 as char.
def var i as inte.
def temp-table wrk-mt
field code as int format "99"
field name as char format "x(33)"
field choice as char format "x(2)".
do i = 1 to 18:
create wrk-mt.
assign wrk-mt.code = i.
if i = 1 then wrk-mt.name = "ОКПО банка".
if i = 2 then wrk-mt.name = "Наименование экспортера/импортера".
if i = 3 then wrk-mt.name = "Код ОКПО экспортера/импортера".
if i = 4 then wrk-mt.name = "Код РНН экспортера/импортера".
if i = 5 then wrk-mt.name = "ОПФ экспортера/импортера".
if i = 6 then wrk-mt.name = "Номер контракта".
if i = 7 then wrk-mt.name = "Дата контракта".
if i = 8 then wrk-mt.name = "Сумма контракта".
if i = 9 then wrk-mt.name = "Наименование нерезидента".
if i = 10 then wrk-mt.name = "Страна нерезидента".
if i = 11 then wrk-mt.name = "Сроки репатриации".
if i = 12 then wrk-mt.name = "Особые отметки".
if i = 13 then wrk-mt.name = "Валюта контракта".
find vcps where vcps.ps = s-ps no-lock no-error.
if avail vcps then do:
if vcps.dntype = "19" then do:
if i = 14 then wrk-mt.name = "Последняя дата".
if i = 15 then wrk-mt.name = "Валюта платежа".
if i = 16 then wrk-mt.name = "Код способа расчетов".
if i = 17 then wrk-mt.name = "Валютная оговорка".
if i = 18 then wrk-mt.name = "Детали валютной оговорки".
end.
end.
wrk-mt.choice = "".
end.
on help of vcps.ncrc,vcps.sum,vcps.ctterm in frame vcdnps do:
/*if s-check = "reason" then do:
if v-psreason = "" then do:
for each codfr where codfr.codfr = 'vcpsreas' and codfr.code <> 'msc' no-lock:
if v-psreason <> "" then v-psreason = v-psreason + " |".
v-psreason = v-psreason + string(codfr.code) + " " + codfr.name[1].
end.
end.
v-sel = 0.
run sel2 ("ВЫБЕРИТЕ ОСНОВАНИЕ ОФОРМЛЕНИЯ ДОП.ЛИСТА", v-psreason, output v-sel).
if v-sel <> 0 then do:
update vcps.info[4] = string(v-sel) with frame vcdnps.
displ vcps.info[4] with frame vcdnps.
end.
end.*/
if s-check = "changeF2" then do:
for each wrk-mt where wrk-mt.name <> "" no-lock break by wrk-mt.code:
if v-psreason1 <> "" then v-psreason1 = v-psreason1 + " |".
v-psreason1 = v-psreason1 + wrk-mt.name.
end.
v-sel1 = "".
v-cont = vccontrs.contract.
v-psnum1 = vcps.dnnum.
run sel_mt ("insert - выбор изменненной графы, delete - отменить выбор", v-psreason1, v-cont, v-psnum1, output v-sel1, output v-del).
if v-sel1 <> "" then do:
if lookup('1',v-sel1) > 0 then do:
if not lookup('11',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '11'.
else vcps.info[3] = '11'.
end.
end.
if lookup('2',v-sel1) > 0 then do:
if not lookup('12',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '12'.
else vcps.info[3] = '12'.
end.
end.
if lookup('3',v-sel1) > 0 then do:
if not lookup('13',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '13'.
else vcps.info[3] = '13'.
end.
end.
if lookup('4',v-sel1) > 0 then do:
if not lookup('14',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '14'.
else vcps.info[3] = '14'.
end.
end.
if lookup('5',v-sel1) > 0 then do:
if not lookup('15',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '15'.
else vcps.info[3] = '15'.
end.
end.
if lookup('6',v-sel1) > 0 then do:
if not lookup('16',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '16'.
else vcps.info[3] = '16'.
end.
end.
if lookup('7',v-sel1) > 0 then do:
if not lookup('17',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '17'.
else vcps.info[3] = '17'.
end.
end.
if lookup('8',v-sel1) > 0 then do:
if not lookup('18',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '18'.
else vcps.info[3] = '18'.
end.
end.
if lookup('9',v-sel1) > 0 then do:
if not lookup('19',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '19'.
else vcps.info[3] = '19'.
end.
end.
if lookup('10',v-sel1) > 0 then do:
if not lookup('20',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '20'.
else vcps.info[3] = '20'.
end.
end.
if lookup('11',v-sel1) > 0 then do:
if not lookup('21',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '21'.
else vcps.info[3] = '21'.
end.
end.
if lookup('12',v-sel1) > 0 then do:
if not lookup('22',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '22'.
else vcps.info[3] = '22'.
end.
end.
if lookup('13',v-sel1) > 0 then do:
if not lookup('23',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '23'.
else vcps.info[3] = '23'.
end.
end.
find vcps where vcps.ps = s-ps exclusive-lock no-error.
if avail vcps then do:
if vcps.dntype = "19" then do:
if lookup('14',v-sel1) > 0 then do:
if not lookup('24',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '24'.
else vcps.info[3] = '24'.
end.
end.
if lookup('15',v-sel1) > 0 then do:
if not lookup('25',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '25'.
else vcps.info[3] = '25'.
end.
end.
if lookup('16',v-sel1) > 0 then do:
if not lookup('26',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '26'.
else vcps.info[3] = '26'.
end.
end.
if lookup('17',v-sel1) > 0 then do:
if not lookup('27',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '27'.
else vcps.info[3] = '27'.
end.
end.
if lookup('18',v-sel1) > 0 then do:
if not lookup('28',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '28'.
else vcps.info[3] = '28'.
end.
end.
end.
else if vcps.dntype = "04" then do:
if lookup('14',v-sel1) > 0 then do:
if not lookup('28',vcps.info[3]) > 0 then do:
if vcps.info[3] <> "" then vcps.info[3] = vcps.info[3] + ',' + '28'.
else vcps.info[3] = '28'.
end.
end.
end.
end.
end.
if v-del <> "" then do:
find vcps where vcps.ps = s-ps exclusive-lock no-error.
if avail vcps then do:
if vcps.dntype = "19" then do:
if lookup('18',v-del) > 0 then do:
if lookup('28',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",28,",",").
vcps.info[3] = replace(vcps.info[3],"28,","").
vcps.info[3] = replace(vcps.info[3],"28","").
end.
end.
if lookup('17',v-del) > 0 then do:
if lookup('27',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",27,",",").
vcps.info[3] = replace(vcps.info[3],"27,","").
vcps.info[3] = replace(vcps.info[3],"27","").
end.
end.
if lookup('16',v-del) > 0 then do:
if lookup('26',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",26,",",").
vcps.info[3] = replace(vcps.info[3],"26,","").
vcps.info[3] = replace(vcps.info[3],"26","").
end.
end.
if lookup('15',v-del) > 0 then do:
if lookup('25',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",25,",",").
vcps.info[3] = replace(vcps.info[3],"25,","").
vcps.info[3] = replace(vcps.info[3],"25","").
end.
end.
if lookup('14',v-del) > 0 then do:
if lookup('24',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",24,",",").
vcps.info[3] = replace(vcps.info[3],"24,","").
vcps.info[3] = replace(vcps.info[3],"24","").
end.
end.
end.
else if vcps.dntype = "04" then do:
if lookup('14',v-del) > 0 then do:
if lookup('28',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",28,",",").
vcps.info[3] = replace(vcps.info[3],"28,","").
vcps.info[3] = replace(vcps.info[3],"28","").
end.
end.
end.
end.
if lookup('13',v-del) > 0 then do:
if lookup('23',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",23,",",").
vcps.info[3] = replace(vcps.info[3],"23,","").
vcps.info[3] = replace(vcps.info[3],"23","").
end.
end.
if lookup('12',v-del) > 0 then do:
if lookup('22',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",22,",",").
vcps.info[3] = replace(vcps.info[3],"22,","").
vcps.info[3] = replace(vcps.info[3],"22","").
end.
end.
if lookup('11',v-del) > 0 then do:
if lookup('21',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",21,",",").
vcps.info[3] = replace(vcps.info[3],"21,","").
vcps.info[3] = replace(vcps.info[3],"21","").
end.
end.
if lookup('10',v-del) > 0 then do:
if lookup('20',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",20,",",").
vcps.info[3] = replace(vcps.info[3],"20,","").
vcps.info[3] = replace(vcps.info[3],"20","").
end.
end.
if lookup('9',v-del) > 0 then do:
if lookup('19',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",19,",",").
vcps.info[3] = replace(vcps.info[3],"19,","").
vcps.info[3] = replace(vcps.info[3],"19","").
end.
end.
if lookup('8',v-del) > 0 then do:
if lookup('18',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",18,",",").
vcps.info[3] = replace(vcps.info[3],"18,","").
vcps.info[3] = replace(vcps.info[3],"18","").
end.
end.
if lookup('7',v-del) > 0 then do:
if lookup('17',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",17,",",").
vcps.info[3] = replace(vcps.info[3],"17,","").
vcps.info[3] = replace(vcps.info[3],"17","").
end.
end.
if lookup('6',v-del) > 0 then do:
if lookup('16',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",16,",",").
vcps.info[3] = replace(vcps.info[3],"16,","").
vcps.info[3] = replace(vcps.info[3],"16","").
end.
end.
if lookup('5',v-del) > 0 then do:
if lookup('15',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",15,",",").
vcps.info[3] = replace(vcps.info[3],"15,","").
vcps.info[3] = replace(vcps.info[3],"15","").
end.
end.
if lookup('4',v-del) > 0 then do:
if lookup('14',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",14,",",").
vcps.info[3] = replace(vcps.info[3],"14,","").
vcps.info[3] = replace(vcps.info[3],"14","").
end.
end.
if lookup('3',v-del) > 0 then do:
if lookup('13',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",13,",",").
vcps.info[3] = replace(vcps.info[3],"13,","").
vcps.info[3] = replace(vcps.info[3],"13","").
end.
end.
if lookup('2',v-del) > 0 then do:
if lookup('12',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",12,",",").
vcps.info[3] = replace(vcps.info[3],"12,","").
vcps.info[3] = replace(vcps.info[3],"12","").
end.
end.
if lookup('1',v-del) > 0 then do:
if lookup('11',vcps.info[3]) > 0 then do:
vcps.info[3] = replace(vcps.info[3],",11,",",").
vcps.info[3] = replace(vcps.info[3],"11,","").
vcps.info[3] = replace(vcps.info[3],"11","").
end.
end.
end.
end.
end.
|
* Copied from program counter2.f, written by Simon Richard.
*
* 2019
*
program detilt
implicit double precision (a-h,m,o-z)
parameter (nm=1000000)
parameter (xunit=100) ! length unit in kpc.
parameter (vunit=207.4) ! velocity unit in km/s.
parameter (tunit=0.471) ! time unit in Gyr.
parameter (munit=1.e+12) ! mass unit in M_sun.
double precision jjx, jjy, jjz
double precision Js, Jxs, Jys, Jzs
character filename *7, filename2 *9
data filename2 /'*******_*'/
* For star.
dimension xs(nm), ys(nm), zs(NM), vxs(NM), vys(NM), vzs(nm),
+ ms(nm), ms0s(NM), zHes(NM), zCs(NM), zNs(nm),
+ zOs(nm), zNes(NM), zMgs(NM), zSis(NM), zFes(nm),
+ zZs(nm), zg_p(NM), ts(NM), id(NM), flagfd(nm), age(nm),
+ rhop(nm), h(NM), rhosp(NM), up(NM), rp(NM), vph(nm),
+ vr(nm), thetap(nm)
integer flagfd
* For gas.
dimension xg(nm), yg(nm), zg(nm), vxg(nm), vyg(nm), vzg(nm),
+ mg(nm), rhog(nm), ung(nm), mHeg(nm), mCg(nm),
+ mNg(nm), mOg(nm), mNeg(nm), mMgg(nm), mSig(nm),
+ mFeg(nm), mZg(nm), idg(nm), flagfd_p(nm), hg(nm),
+ mug(nm), ndens(nm), tempg(nm), rpg(nm), divv(nm),
+ pp(nm), cs(nm), dt(nm),
+ vis(nm), vphg(nm), vrg(nm), rp3d(nm), as_p(nm),
+ vr3d(nm), peffp(nm), ts_p(nm), alpvir(nm), thetapg(nm),
+ flagc(nm), nnb(nm)
integer flagfd_p, flagc
double precision ndens
* For DM.
dimension xd(Nm), yd(Nm), zd(Nm), vxd(Nm), vyd(Nm), vzd(Nm),
+ md(Nm), pn(nm), dc(nm), vphd(nm), vrd(nm), rpd(nm),
+ rhod(nm), hd(nm)
integer pn
write(6,1500)
1500 format(/5x,'Enter dump number : ',$)
read(5,*) ndump
write(filename,1501) ndump
if(ndump.lt.100000) write(filename,1502) ndump
if(ndump.lt.10000) write(filename,1503) ndump
if(ndump.lt.1000) write(filename,1504) ndump
if(ndump.lt.100) write(filename,1505) ndump
if(ndump.lt.10) write(filename,1506) ndump
1501 format('s',i6)
1502 format('s0',i5)
1503 format('s00',i4)
1504 format('s000',i3)
1505 format('s0000',i2)
1506 format('s00000',i1)
open(unit=1,file=filename,status='old')
filename2(1:7)=filename
filename2(9:9)='1'
open(unit=11,file=filename2,status='unknown')
filename2(9:9)='2'
open(unit=12,file=filename2,status='unknown')
filename(1:1)='g'
open(unit=2,file=filename,status='old')
filename2(1:7)=filename
filename2(9:9)='1'
open(unit=21,file=filename2,status='unknown')
filename2(9:9)='2'
open(unit=22,file=filename2,status='unknown')
filename(1:1)='d'
open(unit=3,file=filename,status='old')
filename2(1:7)=filename
filename2(9:9)='1'
open(unit=31,file=filename2,status='unknown')
filename2(9:9)='2'
open(unit=32,file=filename2,status='unknown')
* Read data for stars.
do i=1,nm
read(1,153,end=80) xs(i), ys(i), zs(i), vxs(i), vys(i),
+ vzs(i), ms(i), ms0s(i), zHes(i), zCs(i),
+ zNs(i), zOs(i), zNes(i), zMgs(i),
+ zSis(i), zFes(i), zZs(i), zg_p(i), ts(i),
+ id(i), flagfd(i), age(i), rhop(i), h(i),
+ rhosp(i), up(i), rp(i), vph(i),
+ vr(i), thetap(i)
if(id(i).lt.128000) then
write(11,153) xs(i), ys(i), zs(i), vxs(i), vys(i),
+ vzs(i), ms(i), ms0s(i), zHes(i), zCs(i),
+ zNs(i), zOs(i), zNes(i), zMgs(i),
+ zSis(i), zFes(i), zZs(i), zg_p(i), ts(i),
+ id(i), flagfd(i), age(i), rhop(i), h(i),
+ rhosp(i), up(i), rp(i), vph(i),
+ vr(i), thetap(i)
else
write(12,153) xs(i), ys(i), zs(i), vxs(i), vys(i),
+ vzs(i), ms(i), ms0s(i), zHes(i), zCs(i),
+ zNs(i), zOs(i), zNes(i), zMgs(i),
+ zSis(i), zFes(i), zZs(i), zg_p(i), ts(i),
+ id(i), flagfd(i), age(i), rhop(i), h(i),
+ rhosp(i), up(i), rp(i), vph(i),
+ vr(i), thetap(i)
153 format(19(1pe13.5),2(i10),9(1pe13.5))
endif
enddo
80 close(unit=1)
close(unit=11)
close(unit=12)
* Read data for gas.
do i=1,nm
read(2,101,end=21) xg(i), yg(i), zg(i), vxg(i), vyg(i),
+ vzg(i), mg(i), rhog(i), ung(i),
+ mHeg(i), mCg(i), mNg(i), mOg(i),
+ mNeg(i), mMgg(i), mSig(i), mFeg(i),
+ mZg(i), idg(i), flagfd_p(i), hg(i),
+ mug(i), ndens(i), tempg(i), rpg(i),
+ divv(i), pp(i),
+ cs(i), dt(i), vis(i), vphg(i), vrg(i),
+ rp3d(i), as_p(i), vr3d(i), peffp(i),
+ ts_p(i), alpvir(i), thetapg(i),
+ flagc(i), nnb(i)
if(idg(i).lt.128000) then
write(21,101) xg(i), yg(i), zg(i), vxg(i), vyg(i),
+ vzg(i), mg(i), rhog(i), ung(i),
+ mHeg(i), mCg(i), mNg(i), mOg(i),
+ mNeg(i), mMgg(i), mSig(i), mFeg(i),
+ mZg(i), idg(i), flagfd_p(i), hg(i),
+ mug(i), ndens(i), tempg(i), rpg(i),
+ divv(i), pp(i),
+ cs(i), dt(i), vis(i), vphg(i), vrg(i),
+ rp3d(i), as_p(i), vr3d(i), peffp(i),
+ ts_p(i), alpvir(i), thetapg(i),
+ flagc(i), nnb(i)
else
write(22,101) xg(i), yg(i), zg(i), vxg(i), vyg(i),
+ vzg(i), mg(i), rhog(i), ung(i),
+ mHeg(i), mCg(i), mNg(i), mOg(i),
+ mNeg(i), mMgg(i), mSig(i), mFeg(i),
+ mZg(i), idg(i), flagfd_p(i), hg(i),
+ mug(i), ndens(i), tempg(i), rpg(i),
+ divv(i), pp(i),
+ cs(i), dt(i), vis(i), vphg(i), vrg(i),
+ rp3d(i), as_p(i), vr3d(i), peffp(i),
+ ts_p(i), alpvir(i), thetapg(i),
+ flagc(i), nnb(i)
endif
101 format(18(1pe13.5),2(i10),19(1pe13.5),2(i10))
enddo
21 close(unit=2)
close(unit=21)
close(unit=22)
* Read data for DM.
do i=1,nm
read(3,155,end=81) xd(i), yd(i), zd(i), vxd(i), vyd(i),
+ vzd(i), md(i), pn(i), dc(i), vphd(i),
+ vrd(i), rpd(i), rhod(i), hd(i)
if(pn(i).lt.320000) then
write(31,155) xd(i), yd(i), zd(i), vxd(i), vyd(i),
+ vzd(i), md(i), pn(i), dc(i), vphd(i),
+ vrd(i), rpd(i), rhod(i), hd(i)
else
write(32,155) xd(i), yd(i), zd(i), vxd(i), vyd(i),
+ vzd(i), md(i), pn(i), dc(i), vphd(i),
+ vrd(i), rpd(i), rhod(i), hd(i)
endif
155 format(7(1pe13.5),i10,6(1pe13.5))
enddo
81 close(unit=3)
close(unit=31)
close(unit=32)
stop
end
|
SUBROUTINE INTTLT(CFILEX,CFFX,KR,EXPKR)
c ********************************************************
c * OASES *
c * Ocean Acoustic and Seismic Exploration Synthetics *
c * Copyright (C) *
c * Henrik Schmidt *
c * Massachusetts Institute of Technology *
c * Cambridge, MA 02139 *
c ********************************************************
c
parameter (nwght=2048)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'comnrd.f'
INCLUDE 'combes.f'
LOGICAL UPMV
COMPLEX CFILEX(IR,MSUFT,ISROW,NOUT,2)
COMPLEX CFFX(NOUT,IR,NPLOTS,MSUFT,ISROW)
REAL KR(NPLOTS,MBMAXI,2)
COMPLEX EXPKR(NPLOTS,MBMAXI,2)
COMPLEX C1,C2,C3,C4
real wght(nwght)
c >>> dummy variables to force single precision trf file
complex*8 cdummy(npar)
real*4 adummy(2,npar)
c
C *** CHECK THAT ARRAY SIZES ARE SUFFICIENT
C
if (inttyp.eq.2) then
IF (4*IR*MSUFT*ISROW*NOUT.GT.ISIZE) THEN
STOP '>>> INTTLT: ISIZE TOO SMALL <<<'
END IF
IF (NPLOTS*MBMAXI.GT.NP/4) THEN
STOP '>>> INTTLT: NP TOO SMALL <<<'
END IF
else
IF (2*IR*MSUFT*ISROW*NOUT.GT.ISIZE) THEN
STOP '>>> INTTLT: ISIZE TOO SMALL <<<'
END IF
IF (NPLOTS*MBMAXI.GT.NPHALF) THEN
STOP '>>> INTTLT: NP TOO SMALL <<<'
END IF
end if
IF (NOUT*IR*NPLOTS*MSUFT*ISROW.GT.NP3) THEN
STOP '>>> INTTLT: NP TOO SMALL <<<'
END IF
c
c >>> For full Bessel integration, prepare weight array.
c >>> First 50% full Bessel. Last 50% Hanning weighted with
c >>> asymptotic Hankel function
c
if (inttyp.eq.2) then
dwght=(rkmax-brk_0)/(nwght-1)
onodwg=1e0/dwght
nwghth=nwght/2
do i=1,nwghth
wght(i)=1.0
wght(i+nwghth)=0.5*( 1e0 + cos( ((i-1)*pi)/(nwghth-1) ) )
end do
end if
NS=ICUT2-ICUT1+1
IF (ICDR.EQ.1) THEN
TERM=0.
ELSE
TERM=PI/4E0
END IF
CALL VCLR(CFILEX,1,4*IR*MSUFT*ISROW*NOUT)
CALL VCLR(CFFX,1,2*NOUT*IR*NPLOTS*MSUFT*ISROW)
UPMV=.FALSE.
IF (NPAR.gt.3) THEN
ICNT=0
DO 2 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
IF (I.EQ.3) THEN
IUPV=ICNT
ELSE IF (I.EQ.4) THEN
IUMV=ICNT
UPMV=.TRUE.
ELSE
END IF
END IF
2 CONTINUE
END IF
c write(6,*) 'INTGR3: offima=',offima
C *** REWIND KERNEL FILE
CALL RWDBUF(LUTGRN)
DO 100 JK=ICUT1,ICUT2
C *** POINTER TO SWITCHING BUFFERS
WN=WK0+(JK-1)*DLWVNO
if (ICDR.EQ.0) THEN
SQRWN=SQRT(abs(WN))
else
SQRWN=1E0
end if
C *** FILL INTO CURRENT BUFFER
ICNT=0
DO 40 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
CALL RDBUF(LUTGRN,CFILEX(1,1,1,ICNT,1),2*IR*MSUFT*ISROW)
C *** vsmul COMMENTED OUT FOR TESTING WITH V12 calint ONLY
if (icdr.eq.0) then
if (inttyp.eq.2) then
CALL VSMUL(CFILEX(1,1,1,ICNT,1),1,WN,
& CFILEX(1,1,1,ICNT,2),1,2*IR*MSUFT*ISROW)
end if
CALL VSMUL(CFILEX(1,1,1,ICNT,1),1,SQRWN,
& CFILEX(1,1,1,ICNT,1),1,2*IR*MSUFT*ISROW)
end if
cvd$ select(concur)
do 30 jrv=1,IR
c >>> receiver offset due to array tilt
rtlt=r1+ofstar(jrv)
c if (jk.eq.icut2) then
c write(6,*) 'jrv,rtlt=',jrv,rtlt
c end if
c rtlt=r1
C *** INTEGRATION FACTORS (FUNCTIONS OF RANGE ONLY)
IF (ICDR.EQ.0) THEN
c >>> Cylindrical geometry
if (INTTYP.EQ.2) then
CALL VMOV(DLWVNO,0,FAC(1+3*nplots),1,NPLOTS)
end if
do JR=1,NPLOTS
RANGEM=Rtlt+(JR-1)*DLRAN
abs_r=abs(rangem)
IF (abs_r.GT.1E-3) THEN
FAC(JR)= FNI5/SQRT(abs_r)
ELSE
FAC(JR)=DLWVNO
END IF
end do
ELSE
c >>> Plane geometry
CALL VMOV(FNI5,0,FAC,1,NPLOTS)
END IF
IF (.NOT.NFLAG) THEN
DO 6 JR=1,NPLOTS
RANGEM=Rtlt+(JR-1)*DLRAN
abs_r=abs(rangem)
eex=EXP(abs_r*OFFIMA)
c>>> other factor for negative k. oassp only (940613)
FAC(JR+nplots)=FAC(JR)*EXP(-abs_r*OFFIMA)
FAC(JR)=FAC(JR)*eex
if (inttyp.eq.2) then
FAC(JR+3*nplots)=FAC(JR+3*nplots)*eex
end if
6 CONTINUE
ELSE
DO 7 JR=1,NPLOTS
RANGEM=Rtlt+(JR-1)*DLRAN
FAC(JR+NPLOTS)=EXP(RANGEM*OFFIMA)
FAC(JR+2*NPLOTS)=1E0/FAC(JR+NPLOTS)
7 CONTINUE
END IF
if (INTTYP.EQ.2) then
C *** FULL BESSEL FUNCTION INTEGRATION
DO MB=1,MBMAXI
DO JR=1,NPLOTS
RANGEM=Rtlt+(JR-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
if (rkl.lt.brk_0) then
EXPKR(JR,MB,2)=0e0
else if (rkl.lt.rkmax) then
EXPKR(JR,MB,2)=
& RINTPL(BF(1,MB),brk_0,ONODRK,NRKMAX,RKL)
end if
end do
end do
if (debug) write(92,*) wn,real(expkr(nplots,1,2))
end if
do MB=1,MBMAXI
do jr=1,nplots
RANGEM=Rtlt+(JR-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
kr(jr,MB,1)=TERM+(MB+mbf_0-1)*PI/2E0-rkl
end do
end do
CALL CVEXP(KR(1,1,1),1,EXPKR(1,1,1),
& 2,NPLOTS*MBMAXI)
if (ICDR.EQ.0) THEN
SQRWN=SQRT(abs(WN))
do jr=1,nplots
RANGEM=Rtlt+(JR-1)*DLRAN
abs_r=abs(rangem)
IF (abs_r.LT.1E-3) THEN
if (mbf_0.gt.0) then
CALL CVFILL(CNUL,EXPKR(jr,1,1),2*NPLOTS,MBMAXI)
else
EXPKR(jr,1,1)=sqrwn
CALL CVFILL(CNUL,EXPKR(jr,2,1),2*NPLOTS,MBMAXI-1)
end if
END IF
end do
else if (NFLAG) then
MSIGN=-1
do MB=1,MBMAXI
MSIGN=-MSIGN
do JRH=1,NPLOTS
EXPKR(JRH,MB,1)=FAC(JRH+NPLOTS)*EXPKR(JRH,MB,1)
& +MSIGN*FAC(JRH+2*NPLOTS)*CONJG(EXPKR(JRH,MB,1))
end do
end do
END IF
DO 29 IS=1,ISROW
DO 29 M=1,MSUFT
MORD=M/2
IF (I.LT.3.or.i.ge.5) THEN
MINDX=MORD+1
FC=0.5
ELSE IF (I.EQ.3) THEN
MINDX=MORD + 2
FC=0.5
ELSE IF (MORD.EQ.0) THEN
MINDX=MORD+2
FC=-0.5
ELSE
MINDX=MORD
FC=0.5
END IF
if (nwvno.eq.1
& .or.(jk.gt.icut1.and.jk.lt.icut2)) fc=fc*2.0
c >>> Particle velocities in micrometer/second
if (i.ge.2.and.i.le.4) FC=1E6*FC
DO 29 JRH=1,NPLOTS
RANGEM=Rtlt+(JRH-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
if (rangem.lt.0.0.and.(mod(mord,2).eq.1)) then
fccr=-fc
else
fccr=fc
end if
if (INTTYP.EQ.2) then
if (rkl.lt.brk_0) then
CFFX(ICNT,JRV,JRH,M,IS)=cmplx(0e0,0e0)
awg=1.0
else if (rkl.lt.rkmax) then
cvd$ select(vector)
c>>> use opposite contour offset for negative k. oassp only.
awg=RINTPL(wght,brk_0,onodwg,nwght,RKL)
fccc=awg*fac(jrh+3*nplots)
CFFX(ICNT,JRV,JRH,M,IS)=CFFX(ICNT,JRV,JRH,M,IS)+
& fccr*fccc*CFILEX(JRV,M,IS,ICNT,2)*EXPKR(JRH,MINDX,2)
else
awg=0e0
end if
else
awg=0e0
end if
cvd$ select(vector)
c>>> use opposite contour offset for negative k. oassp only.
if (wn.lt.0) then
fccc=fac(jrh+nplots)
else
fccc=(1e0-awg)*fac(jrh)
end if
c For Filon multiply by sinc function in range
if (inttyp.eq.1.and.rangem.ne.0) then
fccc=fccc*(sin(0.5*dlwvno*rangem)/(0.5*dlwvno*rangem))**2
end if
CFFX(ICNT,JRV,JRH,M,IS)=CFFX(ICNT,JRV,JRH,M,IS)+
& fccr*fccc*CFILEX(JRV,M,IS,ICNT,1)*EXPKR(JRH,MINDX,1)
29 continue
30 CONTINUE
end if
40 CONTINUE
100 CONTINUE
c *** EXPANSION COEFFICIENTS FOR U AND V DECOUPLED
IF (UPMV) THEN
DO 200 IS=1,ISROW
DO 200 M=1,MSUFT
cvd$ select(concur)
DO 200 JRV=1,IR
rtlt=r1+ofstar(jrv)
cvd$ select(vector)
DO 200 JRH=1,NPLOTS
rangem=rtlt+(jrh-1)*dlran
C1= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)+CFFX(IUMV,JRV,JRH,M,IS))
C2= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)-CFFX(IUMV,JRV,JRH,M,IS))
if (rangem.lt.0.0) then
CFFX(IUPV,JRV,JRH,M,IS)=-C1
CFFX(IUMV,JRV,JRH,M,IS)=-C2
else
CFFX(IUPV,JRV,JRH,M,IS)=C1
CFFX(IUMV,JRV,JRH,M,IS)=C2
end if
200 CONTINUE
END IF
C *** WRITE TRANSFER FUNCTION FILE
DO 300 IS=1,ISROW
DO 300 M=1,MSUFT
DO 300 JRH=1,NPLOTS
DO 300 JRV=1,IR
if (double_trf) then
if (bintrf) then
WRITE(LUTTRF) (CFFX(I,JRV,JRH,M,IS),I=1,NOUT)
else
WRITE(LUTTRF,*) (real(CFFX(I,JRV,JRH,M,IS)),
& rimag(CFFX(I,JRV,JRH,M,IS)),I=1,NOUT)
end if
else
do i=1,nout
cdummy(i)=CFFX(I,JRV,JRH,M,IS)
end do
if (bintrf) then
WRITE(LUTTRF) (cdummy(i),I=1,NOUT)
else
WRITE(LUTTRF,*) (real(cdummy(i)),
& rimag(cdummy(i)),I=1,NOUT)
end if
end if
300 CONTINUE
RETURN
END
SUBROUTINE taupdgm(CFILEX,CFFX)
c ********************************************************
c * OASES *
c * Ocean Acoustic and Seismic Exploration Synthetics *
c * Copyright (C) *
c * Henrik Schmidt *
c * Massachusetts Institute of Technology *
c * Cambridge, MA 02139 *
c ********************************************************
c
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'combes.f'
LOGICAL UPMV
COMPLEX CFILEX(IR,MSUFT,ISROW,NOUT)
COMPLEX CFFX(NOUT,IR,NPLOTS,MSUFT,ISROW)
COMPLEX C1,C2,C3,C4
complex expkr(nbfmax)
c >>> dummy variables to force single precision trf file
complex*8 cdummy(npar)
real*4 adummy(2,npar)
c
C *** CHECK THAT ARRAY SIZES ARE SUFFICIENT
C
IF (IR*MSUFT*ISROW*NOUT.GT.ISIZE) THEN
STOP '>>> taupdgm: ISIZE TOO SMALL <<<'
END IF
IF (NOUT*IR*NPLOTS*MSUFT*ISROW.GT.NP3) THEN
STOP '>>> taupdgm: NP TOO SMALL <<<'
END IF
IF (NPLOTS*MBMAXI.GT.NPHALF) THEN
STOP '>>> taupdgm: NP TOO SMALL <<<'
END IF
IF (ICDR.EQ.1) THEN
TERM=0.
ELSE
TERM=PI/4E0
END IF
do 20 mb=1,mbmaxi
expkr(mb)=exp(ai*(term+(mb-1)*pi*0.5e0))
20 continue
UPMV=.FALSE.
IF (NPAR.gt.3) THEN
ICNT=0
DO 2 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
IF (I.EQ.3) THEN
IUPV=ICNT
ELSE IF (I.EQ.4) THEN
IUMV=ICNT
UPMV=.TRUE.
ELSE
END IF
END IF
2 CONTINUE
END IF
C *** REWIND KERNEL FILE
CALL RWDBUF(LUTGRN)
DO 100 JRH=1,nplots
C *** read kernels
ICNT=0
DO 40 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
CALL RDBUF(LUTGRN,CFILEX(1,1,1,ICNT),2*IR*MSUFT*ISROW)
CALL VSMUL(CFILEX(1,1,1,ICNT),1,fni5,
& CFILEX(1,1,1,ICNT),1,2*IR*MSUFT*ISROW)
DO 30 IS=1,ISROW
DO 30 M=1,MSUFT
MORD=M/2
IF (I.LT.3.or.i.ge.5) THEN
MINDX=MORD+1
FC=0.5
ELSE IF (I.EQ.3) THEN
MINDX=MORD + 2
FC=0.5
ELSE IF (MORD.EQ.0) THEN
MINDX=MORD+2
FC=-0.5
ELSE
MINDX=MORD
FC=0.5
END IF
if (nwvno.eq.1) fc=fc*2.0
c >>> Particle velocities in micrometer/second
if (i.ge.2.and.i.le.4) FC=1E6*FC
cvd$ select(concur)
DO 28 JRV=1,IR
CFFX(ICNT,JRV,JRH,M,IS)=FC*CFILEX(JRV,M,IS,ICNT)*
& expkr(mindx)
28 continue
30 continue
end if
40 CONTINUE
100 CONTINUE
c *** EXPANSION COEFFICIENTS FOR U AND V DECOUPLED
IF (UPMV) THEN
DO 200 IS=1,ISROW
DO 200 M=1,MSUFT
cvd$ select(concur)
DO 200 JRH=1,NPLOTS
cvd$ select(vector)
DO 200 JRV=1,IR
C1= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)+CFFX(IUMV,JRV,JRH,M,IS))
C2= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)-CFFX(IUMV,JRV,JRH,M,IS))
CFFX(IUPV,JRV,JRH,M,IS)=C1
CFFX(IUMV,JRV,JRH,M,IS)=C2
200 CONTINUE
END IF
C *** WRITE TRANSFER FUNCTION FILE
DO 300 IS=1,ISROW
DO 300 M=1,MSUFT
DO 300 JRH=1,NPLOTS
DO 300 JRV=1,IR
do i=1,nout
adummy(1,i)=1.0E6*real(CFFX(I,JRV,JRH,M,IS))
adummy(2,i)=1.0E6*rimag(CFFX(I,JRV,JRH,M,IS))
end do
if (bintrf) then
WRITE(LUTTRF) (adummy(1,i),adummy(2,i),I=1,NOUT)
else
WRITE(LUTTRF,*) (adummy(1,i),
& adummy(2,i),I=1,NOUT)
end if
300 CONTINUE
RETURN
END
SUBROUTINE INTGR3(CFILEX,CFFX,KR,EXPKR)
c ********************************************************
c * OASES *
c * Ocean Acoustic and Seismic Exploration Synthetics *
c * Copyright (C) *
c * Henrik Schmidt *
c * Massachusetts Institute of Technology *
c * Cambridge, MA 02139 *
c ********************************************************
c
parameter (nwght=2048)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'combes.f'
LOGICAL UPMV
COMPLEX CFILEX(IR,MSUFT,ISROW,NOUT,2)
COMPLEX CFFX(NOUT,IR,NPLOTS,MSUFT,ISROW)
REAL KR(NPLOTS,MBMAXI,2)
COMPLEX EXPKR(NPLOTS,MBMAXI,2)
COMPLEX C1,C2,C3,C4
real wght(nwght)
c >>> dummy variables to force single precision trf file
complex*8 cdummy(npar)
real*4 adummy(2,npar)
c
C *** CHECK THAT ARRAY SIZES ARE SUFFICIENT
C
if (inttyp.eq.2) then
IF (2*IR*MSUFT*ISROW*NOUT.GT.ISIZE) THEN
STOP '>>> INTGR3: ISIZE TOO SMALL <<<'
END IF
IF (2*NPLOTS*MBMAXI.GT.NP) THEN
STOP '>>> INTGR3: NP TOO SMALL <<<'
END IF
else
IF (2*IR*MSUFT*ISROW*NOUT.GT.ISIZE) THEN
STOP '>>> INTGR3: ISIZE TOO SMALL <<<'
END IF
IF (NPLOTS*MBMAXI.GT.NPHALF) THEN
STOP '>>> INTGR3: NP TOO SMALL <<<'
END IF
end if
IF (NOUT*IR*NPLOTS*MSUFT*ISROW.GT.NP3) THEN
STOP '>>> INTGR3: NP TOO SMALL <<<'
END IF
c
c >>> For full Bessel integration, prepare weight array.
c >>> First 50% full Bessel. Last 50% Hanning weighted with
c >>> asymptotic Hankel function
c
if (inttyp.eq.2) then
dwght=(rkmax-brk_0)/(nwght-1)
onodwg=1e0/dwght
nwghth=nwght/2
do i=1,nwghth
wght(i)=1.0
wght(i+nwghth)=0.5*( 1e0 + cos( ((i-1)*pi)/(nwghth-1) ) )
end do
end if
NS=ICUT2-ICUT1+1
IF (ICDR.EQ.1) THEN
TERM=0.
ELSE
TERM=PI/4E0
END IF
CALL VCLR(CFILEX,1,4*IR*MSUFT*ISROW*NOUT)
CALL VCLR(CFFX,1,2*NOUT*IR*NPLOTS*MSUFT*ISROW)
UPMV=.FALSE.
IF (NPAR.gt.3) THEN
ICNT=0
DO 2 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
IF (I.EQ.3) THEN
IUPV=ICNT
ELSE IF (I.EQ.4) THEN
IUMV=ICNT
UPMV=.TRUE.
ELSE
END IF
END IF
2 CONTINUE
END IF
C *** INTEGRATION FACTORS (FUNCTIONS OF RANGE ONLY)
IF (ICDR.EQ.0) THEN
c >>> Cylindrical geometry
if (INTTYP.EQ.2) then
CALL VMOV(DLWVNO,0,FAC(1+3*nplots),1,NPLOTS)
end if
do JR=1,NPLOTS
RANGEM=R1+(JR-1)*DLRAN
abs_r=abs(rangem)
IF (abs_r.GT.1E-3) THEN
FAC(JR)= FNI5/SQRT(abs_r)
ELSE
FAC(JR)=DLWVNO
END IF
end do
ELSE
c >>> Plane geometry
CALL VMOV(FNI5,0,FAC,1,NPLOTS)
END IF
IF (.NOT.NFLAG) THEN
DO 6 JR=1,NPLOTS
RANGEM=R1+(JR-1)*DLRAN
abs_r=abs(rangem)
eex=EXP(abs_r*OFFIMA)
if (inttyp.eq.2) then
FAC(JR+3*nplots)=FAC(JR+3*nplots)*eex
end if
FAC(JR)=FAC(JR)*eex
c>>> other factor for negative k. oassp only (940613)
FAC(JR+nplots)=FAC(JR)*EXP(-abs_r*OFFIMA)
6 CONTINUE
ELSE
DO 7 JR=1,NPLOTS
RANGEM=R1+(JR-1)*DLRAN
FAC(JR+NPLOTS)=EXP(RANGEM*OFFIMA)
FAC(JR+2*NPLOTS)=1E0/FAC(JR+NPLOTS)
7 CONTINUE
END IF
c write(6,*) 'INTGR3: offima=',offima
C *** REWIND KERNEL FILE
CALL RWDBUF(LUTGRN)
DO 100 JK=ICUT1,ICUT2
C *** POINTER TO SWITCHING BUFFERS
WN=WK0+(JK-1)*DLWVNO
SQRWN=1E0
if (INTTYP.EQ.2) then
C *** FULL BESSEL FUNCTION INTEGRATION
DO MB=1,MBMAXI
DO JR=1,NPLOTS
RANGEM=R1+(JR-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
if (rkl.lt.brk_0) then
EXPKR(JR,MB,2)=0e0
else if (rkl.lt.rkmax) then
EXPKR(JR,MB,2)=
& RINTPL(BF(1,MB),brk_0,ONODRK,NRKMAX,RKL)
end if
end do
end do
if (debug) write(92,*) wn,real(expkr(nplots,1,2))
end if
do MB=1,MBMAXI
do jr=1,nplots
RANGEM=R1+(JR-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
kr(jr,MB,1)=TERM+(MB+mbf_0-1)*PI/2E0-rkl
end do
end do
CALL CVEXP(KR(1,1,1),1,EXPKR(1,1,1),2,NPLOTS*MBMAXI)
if (ICDR.EQ.0) THEN
SQRWN=SQRT(abs(WN))
do jr=1,nplots
RANGEM=R1+(JR-1)*DLRAN
abs_r=abs(rangem)
IF (abs_r.LT.1E-3) THEN
if (mbf_0.gt.0) then
CALL CVFILL(CNUL,EXPKR(jr,1,1),2*NPLOTS,MBMAXI)
else
EXPKR(jr,1,1)=sqrwn
CALL CVFILL(CNUL,EXPKR(jr,2,1),2*NPLOTS,MBMAXI-1)
end if
END IF
end do
else if (NFLAG) then
MSIGN=-1
do MB=1,MBMAXI
MSIGN=-MSIGN
do JRH=1,NPLOTS
EXPKR(JRH,MB,1)=FAC(JRH+NPLOTS)*EXPKR(JRH,MB,1)
& +MSIGN*FAC(JRH+2*NPLOTS)*CONJG(EXPKR(JRH,MB,1))
end do
end do
END IF
C *** FILL INTO CURRENT BUFFER
ICNT=0
DO 40 I=1,NPAR
IF (IOUT(I).GT.0) THEN
ICNT=ICNT+1
CALL RDBUF(LUTGRN,CFILEX(1,1,1,ICNT,1),2*IR*MSUFT*ISROW)
C *** vsmul COMMENTED OUT FOR TESTING WITH V12 calint ONLY
if (icdr.eq.0) then
if (inttyp.eq.2) then
CALL VSMUL(CFILEX(1,1,1,ICNT,1),1,WN,
& CFILEX(1,1,1,ICNT,2),1,2*IR*MSUFT*ISROW)
end if
CALL VSMUL(CFILEX(1,1,1,ICNT,1),1,SQRWN,
& CFILEX(1,1,1,ICNT,1),1,2*IR*MSUFT*ISROW)
end if
DO 30 IS=1,ISROW
DO 30 M=1,MSUFT
MORD=M/2
IF (I.LT.3.or.i.ge.5) THEN
MINDX=MORD+1
FC=0.5
ELSE IF (I.EQ.3) THEN
MINDX=MORD + 2
FC=0.5
ELSE IF (MORD.EQ.0) THEN
MINDX=MORD+2
FC=-0.5
ELSE
MINDX=MORD
FC=0.5
END IF
if (nwvno.eq.1.or.(jk.gt.icut1.and.jk.lt.icut2)) fc=fc*2.0
c >>> Particle velocities in micrometer/second
if (i.ge.2.and.i.le.4) FC=1E6*FC
cvd$ select(concur)
DO 30 JRH=1,NPLOTS
RANGEM=R1+(JRH-1)*DLRAN
abs_r=abs(rangem)
RKL=WN*abs_r
if (rangem.lt.0.0.and.(mod(mord,2).eq.1)) then
fccr=-fc
else
fccr=fc
end if
if (INTTYP.EQ.2) then
if (rkl.lt.brk_0) then
do jrv=1,ir
CFFX(ICNT,JRV,JRH,M,IS)=cmplx(0e0,0e0)
end do
awg=1.0
else if (rkl.lt.rkmax) then
cvd$ select(vector)
do JRV=1,IR
c>>> use opposite contour offset for negative k. oassp only.
awg=RINTPL(wght,brk_0,onodwg,nwght,RKL)
fccc=awg*fac(jrh+3*nplots)
CFFX(ICNT,JRV,JRH,M,IS)=CFFX(ICNT,JRV,JRH,M,IS)+
& fccr*fccc*CFILEX(JRV,M,IS,ICNT,2)*EXPKR(JRH,MINDX,2)
end do
else
awg=0e0
end if
else
awg=0e0
end if
cvd$ select(vector)
do JRV=1,IR
c>>> use opposite contour offset for negative k. oassp only.
if (wn.lt.0) then
fccc=fac(jrh+nplots)
else
fccc=(1e0-awg)*fac(jrh)
end if
c For Filon multiply by sinc function in range
if (inttyp.eq.1.and.rangem.ne.0) then
fccc=fccc*(sin(0.5*dlwvno*rangem)/(0.5*dlwvno*rangem))**2
end if
CFFX(ICNT,JRV,JRH,M,IS)=CFFX(ICNT,JRV,JRH,M,IS)+
& fccr*fccc*CFILEX(JRV,M,IS,ICNT,1)*EXPKR(JRH,MINDX,1)
end do
30 CONTINUE
end if
40 CONTINUE
100 CONTINUE
c *** EXPANSION COEFFICIENTS FOR U AND V DECOUPLED
IF (UPMV) THEN
DO 200 IS=1,ISROW
DO 200 M=1,MSUFT
cvd$ select(concur)
DO 200 JRH=1,NPLOTS
rangem=r1+(jrh-1)*dlran
cvd$ select(vector)
DO 200 JRV=1,IR
C1= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)+CFFX(IUMV,JRV,JRH,M,IS))
C2= 0.5*(CFFX(IUPV,JRV,JRH,M,IS)-CFFX(IUMV,JRV,JRH,M,IS))
if (rangem.lt.0.0) then
CFFX(IUPV,JRV,JRH,M,IS)=-C1
CFFX(IUMV,JRV,JRH,M,IS)=-C2
else
CFFX(IUPV,JRV,JRH,M,IS)=C1
CFFX(IUMV,JRV,JRH,M,IS)=C2
end if
200 CONTINUE
END IF
C *** WRITE TRANSFER FUNCTION FILE
DO 300 IS=1,ISROW
DO 300 M=1,MSUFT
DO 300 JRH=1,NPLOTS
DO 300 JRV=1,IR
if (double_trf) then
if (bintrf) then
WRITE(LUTTRF) (CFFX(I,JRV,JRH,M,IS),I=1,NOUT)
else
WRITE(LUTTRF,*) (real(CFFX(I,JRV,JRH,M,IS)),
& rimag(CFFX(I,JRV,JRH,M,IS)),I=1,NOUT)
end if
else
do i=1,nout
cdummy(i)=CFFX(I,JRV,JRH,M,IS)
end do
if (bintrf) then
WRITE(LUTTRF) (cdummy(i),I=1,NOUT)
else
WRITE(LUTTRF,*) (real(cdummy(i)),
& rimag(cdummy(i)),I=1,NOUT)
end if
end if
300 CONTINUE
RETURN
END
SUBROUTINE MORDER
INCLUDE 'compar.f'
IF(SRCTYP.EQ.1.or.srctyp.eq.99) THEN
MSUFT=1
ELSEIF(SRCTYP.EQ.2) THEN
MSUFT=3
ELSEIF(SRCTYP.EQ.3) THEN
MSUFT=5
ELSEIF(SRCTYP.EQ.4) THEN
MSUFT=5
ELSEIF(SRCTYP.EQ.5 .OR. SRCTYP.EQ.6.or.srctyp.eq.7) THEN
MSUFT=5
ELSE
WRITE(6,*) ' UNKNOWN SOURCE TYPE '
STOP
ENDIF
MSUFT=MIN(MSUFT,MMAX)
C
MBMAX=MSUFT/2+1
MBMAXI=MBMAX+1
RETURN
END
SUBROUTINE TRFHEAD(trfext,TITLE,RD,RDLOW,R0,RSPACE,
& NX,LX,MX,DT,FREQS,SD)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'comnrd.f'
CHARACTER*(*) trfext
CHARACTER*8 FILEID
CHARACTER*80 TITLE,filenm,filtrf
CHARACTER SIGNN
INTEGER IPARM(12)
inquire(1,name=filenm)
ii=index(filenm,'.')
filtrf=Filenm(1:ii)//trfext
CMS OPEN(LUTTRF,FILE=filtrf,
CMS & STATUS='UNKNOWN',FORM='BINARY')
OPEN(LUTTRF,FILE=filtrf,
& STATUS='UNKNOWN',FORM='UNFORMATTED')
FILEID='PULSETRF'
WRITE(LUTTRF) FILEID
WRITE(LUTTRF) PROGNM
WRITE(LUTTRF) NOUT
ICNT=1
DO 10 I=1,NPAR
IF (IOUT(I).NE.0) THEN
IPARM(ICNT)=I
ICNT=ICNT+1
END IF
10 CONTINUE
WRITE(LUTTRF) (IPARM(J),J=1,NOUT)
WRITE(LUTTRF) TITLE
SIGNN='+'
WRITE(LUTTRF) SIGNN
WRITE(LUTTRF) FREQS
WRITE(LUTTRF) SD
WRITE(LUTTRF) RD,RDLOW,IR
IF (IR.LT.0) THEN
WRITE(LUTTRF) (RDC(L),L=1,ABS(IR))
END IF
WRITE(LUTTRF) R0,RSPACE,NPLOTS
WRITE(LUTTRF) NX,LX,MX,DT
WRITE(LUTTRF) ICDR
WRITE(LUTTRF) OMEGIM
C *** EXTRA FIELDS ADDED 891211 HS
WRITE(LUTTRF) MSUFT
write(6,*) 'trfhead: msuft=',msuft
WRITE(LUTTRF) ISROW
write(LUTTRF) inttyp
DO 300 I=1,2
WRITE(LUTTRF) IDUMMY
300 CONTINUE
DO 400 I=1,5
WRITE(LUTTRF) DUMMY
400 CONTINUE
RETURN
END
SUBROUTINE PLINTM(DLWVNL,WK0L,SD,RD,TITLE,M,XLEN,YLEN)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'complo.f'
DIMENSION YMAX(NPAR)
CHARACTER*80 TITLE
CHARACTER*6 OPTION(2),OPT2(6)
DATA OPT2 /'NINTGR','WINTGR','UINTGR','VINTGR','RINTGR',
& 'KINTGR'/
C
OPTION(1)=PROGNM
DO 2400 I=1,NPAR
IF (IOUT(I).GT.0) THEN
CALL CVMAX(CFF(1,I),2,YMAX(I),NWVNO)
END IF
2400 CONTINUE
C
C XAXIS DEFINITION
C
IPLOT1=MAX(1,ICUT1-100)
IPLOT2=MIN(NWVNO,ICUT2+100)
WKMIN=WK0L+(IPLOT1-1)*DLWVNL
NN=IPLOT2-IPLOT1+1
XMAX=(WK0L+(NWVNO-1)*DLWVNL)
XMIN=WK0L
CALL AUTOAX(XMIN,XMAX,XLEFT,XRIGHT,XINC,XDIV,NXDIF)
C
DO 2701 I=1,NPAR
IF (IOUT(I).EQ.0) GO TO 2701
IF (YMAX(I).LE.0) YMAX(I)=1E0
OPTION(1)=PROGNM
OPTION(2)=OPT2(I)
IPLOT1=MAX(1,ICUT1-100)
IPLOT2=MIN(NWVNO,ICUT2+100)
C
C
C YAXIS DEFINITION
C
YMIN=0.0
YMAX(I)=SQRT(YMAX(I))
CALL AUTOAX(YMIN,YMAX(I),YLO,YUP,YINC,YDIV,NYDIF)
IF(IPLOT1.EQ.2)IPLOT1=1
c *** labels
NLAB=4
WRITE(LAB(1),810) FREQ
WRITE(LAB(2),811) SD
WRITE(LAB(3),812) RD
WRITE(LAB(4),813) M
810 FORMAT('Freq:',F7.1,' Hz$')
811 FORMAT('SD:',F9.1,' m$')
812 FORMAT('RD:',F9.1,' m$')
813 FORMAT('M:',I10)
PTIT='INTEGRAND'
WRITE(XTXT,820) NXDIF
820 FORMAT('Horizontal wavenumber (10**',I3,')$')
WRITE(YTXT,821) NYDIF
821 FORMAT('Modulus (10**',I3,')$')
XTYP='LIN'
YTYP='LIN'
IGRID=0
NC=1
C *** WRITE PLP FILE
CALL PLPWRI(OPTION,PTIT,TITLE,NLAB,LAB,XLEN,YLEN,
& IGRID,XLEFT,XRIGHT,XINC,XDIV,XTXT,XTYP,
& YLO,YUP,YINC,YDIV,YTXT,YTYP,NC)
CALL CVMAGS(CFF(IPLOT1,I),2,CFFS(1),1,NN)
CALL VSQRT(CFFS(1),1,CFFS(1),1,NN)
CALL PLTWRI(NN,WKMIN,DLWVNL,0.,0.,CFFS(1),1,CFFS(1),1)
2701 CONTINUE
C
RETURN
C
END
SUBROUTINE MODES(IFI,NMMAX,NK,Kout,VKout)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
REAL Kout(NMMAX),VKout(NMMAX)
real k(100),vk(100)
C
CALL VCLR(K,1,100)
CALL VCLR(VK,1,100)
c CALL CVMAGS(CFF(1,IFI),2,FAC(NWVNO),-1,NWVNO)
c ANK=1.2
c CALL VCLR(FAC,1,NWVNO)
nnn=icut2-icut1+1
call vmax(arg(icut1),1,ammax,nnn)
CALL VMOV(ARG(ICUT1),1,FAC(nnn),-1,nnn)
ANK=3.0
CALL PKVAL(FAC,VK,nnn,K,100,ANK,-1)
NK=ANK
DO 10 I=1,NK
ki=nnn-K(I)+icut1
k(i)=ki
if (debug) then
wn=(wk0+(k(i)-1)*dlwvno)
write(6,*) '>>> MODES: k,wn,vk=',k(i),wn,arg(ki)
end if
10 continue
c
c >>> check that amplitudes of maxima are above tresshold 1%
c
i=2
20 if (i.gt.nk) go to 50
ik=k(i)
if (arg(ik).lt.ammax*0.01) then
do 25 j=i,nk-2
k(j)=k(j+2)
vk(j)=vk(j+2)
25 continue
nk=nk-2
else
i=i+2
end if
go to 20
50 continue
c if (debug) then
DO 70 I=2,NK,2
wn=(wk0+(k(i)-1)*dlwvno)
write(6,*) '>>> MODES: k,wn,Cp=',k(i),wn,
& 2*pi*freq/wn
70 continue
c end if
call vmov(k,1,kout,1,nk)
call vmov(vk,1,vkout,1,nk)
RETURN
END
SUBROUTINE EXTMDS(IC1,IC2)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
C
DO 20 I=1,npar
IF (IOUT(I).EQ.0) GO TO 20
IF (IC1.GT.1) CALL CVFILL(CMPLX(0.,0.),CFF(1,I),2,IC1)
IF (IC2.LT.NWVNO) CALL CVFILL(CNUL,CFF(IC2+1,I),2,NWVNO-IC2)
IPLOT1=NWVNO
IPLOT2=0
IF (IC1.LE.2.AND.IC2.GE.NWVNO) GO TO 20
CALL CHERMIT(CFF(1,I),NWVNO,IC1,IC2,DLWVNO,WK0,
1 IPLOT1,IPLOT2)
20 CONTINUE
RETURN
END
real function detmk(cak)
INCLUDE 'compar.f'
complex cak
WVNO=CAK
CALL INITS
CALL BUILD
CALL SOLVE
detmk=detmnt
return
end
SUBROUTINE IMPMOD(IFI,DLWVNL,DELFRQ,AKM,PHVEL,GRPVEL,NM)
INCLUDE 'compar.f'
INCLUDE 'comnla.f'
INCLUDE 'comnp.f'
DIMENSION AKM(1),PHVEL(1),GRPVEL(1)
COMPLEX CIN
COMPLEX CAK0,csave,dsave
EQUIVALENCE (CAK0,AK0)
CAK0=CMPLX(1E0,OFFIMA)
C
C
c DF=DELFRQ/5.
DF=Freq*0.01
FSAVE=FREQ
CSAVE=CSQ
DSAVE=DSQ
C
C
FREQ=FSAVE-DF
DSQ=2*PI*FREQ
CSQ=DSQ*DSQ
CALL PINIT2
DO 10 I=1,NM/2
DS=DLWVNL
AK0=AKM(2*I)
rinold=detmk(cak0)
if (debug) write(6,*) '>>> IMPMOD: 0,k,d=',l,ak0,rinold
do 8 l=1,10
3 ak0=ak0+ds
rin=detmk(cak0)
if (debug) write(6,*) '>>> IMPMOD: l,k,d=',l,ak0,rin
if (rin.ge.rinold) then
rinold=rin
go to 3
end if
phvel(i)=ak0-ds
rinold=rin
ds=-ds*0.5
8 continue
10 CONTINUE
C
C
FREQ=FSAVE+DF
DSQ=2*PI*FREQ
CSQ=DSQ*DSQ
CALL PINIT2
DO 20 I=1,NM/2
DS=-DLWVNL
AK0=AKM(2*I)
rinold=detmk(cak0)
if (debug) write(6,*) '>>> IMPMOD: 0,k,d=',l,ak0,rinold
do 18 l=1,10
13 ak0=ak0+ds
rin=detmk(cak0)
if (debug) write(6,*) '>>> IMPMOD: l,k,d=',l,ak0,rin
if (rin.ge.rinold) then
rinold=rin
go to 13
end if
grpvel(i)=ak0-ds
rinold=rin
ds=-ds*0.5
18 continue
ak0=grpvel(i)
IF ((AK0-PHVEL(I)).GT.1E-10) THEN
GRPVEL(I)=4E0*PI*DF/(AK0-PHVEL(I))
ELSE
GRPVEL(I)=1E6
END IF
PHVEL(I)=4E0*PI*FSAVE/(AK0+PHVEL(I))
20 CONTINUE
FREQ=FSAVE
DSQ=DSAVE
CSQ=CSAVE
RETURN
END
SUBROUTINE PLDISP(PHVEL,GRPVEL,NM,LX,MX,DELFRQ,
1 XLEN,YLEN,XLEFT,XRIGHT,XINC,
2 YDOWN,YUP,YINC,TITLE)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'complo.f'
DIMENSION PHVEL(1),GRPVEL(1),X(NP2)
CHARACTER*80 TITLE
CHARACTER*6 OPTION(2),OPT2
EQUIVALENCE (X(1),CFFS(1))
DATA OPTION /'FIPP ',' DISP '/
OPTION(1)=PROGNM
PTIT='DISPERSION CURVES'
NLAB=0
XTXT='Frequency (Hz)$'
YTXT='Velocity (m/s)$'
XTYP='LIN'
YTYP='LIN'
XDIV=1
YDIV=1
IGRID=1
NC=2*NM
C *** WRITE PLP FILE
CALL PLPWRI(OPTION,PTIT,TITLE,NLAB,LAB,XLEN,YLEN,
& IGRID,XLEFT,XRIGHT,XINC,XDIV,XTXT,XTYP,
& YDOWN,YUP,YINC,YDIV,YTXT,YTYP,NC)
DO 20 I=1,NM
LF=MX-LX+1
TMIN=(LX-1)*DELFRQ
DT=DELFRQ
C *** READ PHASE VELOCITIES
REWIND 22
JK=0
DO 1300 J=LX,MX
JK=JK+1
READ(22,*) FR,LNM
CALL VCLR(PHVEL,1,NM)
READ(22,*) (PHVEL(III),III=1,LNM)
X(JK)=PHVEL(I)
1300 CONTINUE
CALL PLTWRI(LF,TMIN,DT,0.,0.,X(1),1,X(1),1)
C *** READ GROUP VELOCITIES
REWIND 23
JK=0
DO 1400 J=LX,MX
JK=JK+1
READ(23,*) FR,LNM
CALL VCLR(GRPVEL,1,NM)
READ(23,*) (GRPVEL(III),III=1,LNM)
X(JK)=GRPVEL(I)
1400 CONTINUE
CALL PLTWRI(LF,TMIN,DT,0.,0.,X(1),1,X(1),1)
20 CONTINUE
RETURN
END
SUBROUTINE RDSTRF(FMIN,FMAX,NX,LX,MX,DT,dlfrqp)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
c INCLUDE 'compul.f'
LOGICAL BINFILE
COMMON /FILFRM/ BINFILE
character*1 signn
COMPLEX CARR(NP3)
EQUIVALENCE (CARR(1),CFF(1,1))
C *** STATEMENT FUNCTION FOR INDEXING CARR
INDEXC(IND1,IND2,IND3,IND4)=IND1
& +ls*((IND2-1)+NPLTS*((IND3-1)+NSIN*(IND4-1)))
C *** OPEN TRF-FILE AND READ HEADING
CALL READHEAD(ISTAT,nx,lxtrf,mxtrf,dt,nplts,nsin,msft,signn)
write(6,*)
write(6,*) '>>> Source TRF file header read'
write(6,*) ' ISTAT =', istat
write(6,*) ' LS = ', ls
write(6,*) ' NX = ', nx
write(6,*) ' LX = ', lxtrf
write(6,*) ' MX = ', mxtrf
write(6,*) ' DT = ', dt
write(6,*) ' NPLOT =', nplts
write(6,*) ' NSIN =', nsin
write(6,*) ' MSUFT =', msft
write(6,*) ' SIGN =', signn
C *** CHECK SIZE OF INPUT BUFFERS
NELM=NP3
IF ((ls*NPLTS*NSIN*MSFT).GT.NELM) THEN
WRITE(6,*) '>>> READTRF: ARRAY CFF TOO SMALL <<<'
CLOSE(15,STATUS='KEEP')
stop
END IF
NELM=ISIZE
IF ((NPLTS*NSIN*MSFT).GT.NELM) THEN
WRITE(6,*) '>>> READFMT: ARRAY CFILE TOO SMALL <<<'
CLOSE(15,STATUS='KEEP')
stop
END IF
if (msft.gt.1.or.nplts.gt.1) then
write(6,*) '>>> Source trf file may only contain <<<'
write(6,*) '>>> one vertical source array <<<'
CLOSE(15,STATUS='KEEP')
stop
end if
DLFRQP=1.0/REAL(DT*NX)
DOMEGA=8.0*ATAN(1.0)*DLFRQP
c OPTION(1)=PROGNM
LX=nint(FMIN/DLFRQP+1)
LX=MAX(LX,LXTRF,2)
MX=NINT(FMAX/DLFRQP+1)
MX=MIN(MX,MXTRF)
NUMFR=MX-LX+1
* Open asynchronous scratch file
NBLOCKS=0.1*MEMLFT()
CALL OPNBUF(81,2*NSIN,ls*NUMFR,NBLOCKS)
DO 35 K=LXTRF,MXTRF
do 40 M=1,MSFT
DO 40 I=1,NPLTS
DO 50 J=1,LS
IF (BINFILE) THEN
READ(15) (ARG(KK),FAC(KK),KK=1,NSIN)
ELSE
READ(15,*) (ARG(KK),FAC(KK),KK=1,NSIN)
END IF
DO 45 KK=1,NSIN
if (signn.eq.'-') then
cfile(KK) = cmplx(arg(kk),-fac(kk))
else
cfile(kk) = cmplx(arg(kk),fac(kk))
end if
45 CONTINUE
if (k.ge.lx.and.k.le.mx) then
CALL WRBUF(81,CFILE,2*NSIN)
end if
50 CONTINUE
40 CONTINUE
35 CONTINUE
CLOSE(15)
CALL ENFBUF(81)
call rwdbuf(81)
RETURN
END
SUBROUTINE READHEAD(ISTAT,nx,lxtrf,mxtrf,dt,nplts,nsin,msft,
& signn)
INCLUDE 'compar.f'
INCLUDE 'comnp.f'
INCLUDE 'comnrd.f'
c INCLUDE 'compul.f'
LOGICAL BINFILE
COMMON /FILFRM/ BINFILE
character*1 signn
CHARACTER*8 FILEID
character*80 titsou,filenm
character*6 progn
C *** STATEMENT FUNCTION FOR INDEXING CARR
INDEXC(IND1,IND2,IND3,IND4)=IND1
& +IR*((IND2-1)+NPLTS*((IND3-1)+NSIN*(IND4-1)))
ISTAT=0
BINFILE=.TRUE.
inquire(unit=1,name=filenm)
ll=index(filenm,'.')
filenm=filenm(1:ll)//'strf'
BINFILE=.FALSE.
OPEN(15,FILE=FILENm,STATUS='OLD',FORM='FORMATTED',ERR=995)
READ(15,20) FILEID
IF (FILEID.NE.'PULSETRF') THEN
ISTAT=2
WRITE(6,*) 'FORMATTED FILE'
RETURN
END IF
READ(15,20) PROGN
READ(15,*) NSIN
nstrf=nsin
READ(15,*) (isprm(J),J=1,NSIN)
READ(15,20) TITsou
READ(15,20) SIGNN
READ(15,*) FCTRF
READ(15,*) SDs
READ(15,*) sD,sDLOW,ls
IF (ls.GT.0) THEN
IF (ls.GT.NRD) THEN
WRITE(6,*) '>>> TOO MANY RECEIVERS IN FILE <<<'
ISTAT=3
RETURN
END IF
IF (ls.GT.1) THEN
sDSTEP=(sDLOW-sD)/FLOAT(ls-1)
ELSE
sdSTEP=1.0
ENDIF
DO 105 L=1,ls
sDC(L)=(L-1)*sDSTEP+sD
105 CONTINUE
ELSE
ls=ABS(ls)
READ(15,*) (sDC(L),L=1,ls)
END IF
READ(15,*) s0,sSPACE,NPLTS
READ(15,*)NX,LXTRF,MXTRF,DT
READ(15,*) ICDRIN
READ(15,*) OMEGI
C *** READ HEADER EXTENSION
READ(15,*) MSFT
READ(15,*) ISROW
READ(15,*) Idummy
DO 1300 I=1,2
READ(15,*) IDUMMY
1300 CONTINUE
DO 1400 I=1,5
READ(15,*) DUMMY
1400 CONTINUE
20 FORMAT(1X,A)
if (signn.eq.'-') then
omegim=-omegi
else
omegim=omegi
end if
RETURN
995 ISTAT=1
RETURN
END
|
C MEMBER PLOT21
C =====================================================================
C DESC -- THIS SUBROUTINE PLOTS THE HYDROGRAPH
C
C THIS SUBROUTINE WAS WRITTEN ORIGINALLY BY:
C DR. DANNY FREAD HRL APRIL 1978
C
C THIS SUBROUTINE WAS MODIFIED TO MEET VER. NO. 5 STANDARDS
C OF THE NWSRFS BY:
C JANICE LEWIS HRL NOVEMBER,1982 VERSION NO. 1
C =====================================================================
SUBROUTINE PLOT21(TII,QTC,LOQTC,STC,LOSTC,FS,FFS,KPL,KKP,FLDHT,
1NRT1,T1,KTIMI,KHR,KDA,KMO,KYR,ISTRT,INOW,STM,NTT,ST0,QT0,KU,GZERO)
C
INCLUDE 'common/fdbug'
INCLUDE 'common/ionum'
INCLUDE 'common/fnopr'
INCLUDE 'common/fpltab'
COMMON / M621 / KTIME,DHF,J1,KX
COMMON / SS21 / NCS,A,B,DB,R,DR,AT,BT,NCSS,P,DP,ZH,NP,NPEND
COMMON / KTT21/ IPLT,TMPR
C
DIMENSION TII(*),QTC(*),LOQTC(*),FS(*),FFS(*),NRT1(*)
DIMENSION STC(*),LOSTC(*),SCALE (11),ORD(101),SNAME(2),T1(*)
DIMENSION STM(*),ST0(*),QT0(*),KU(*)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcst_dwoper/RCS/plot21.f,v $
. $', '
.$Id: plot21.f,v 1.5 1999/08/11 19:51:23 page Exp $
. $' /
C ===================================================================
C
C
DATA DOT,BLANK,ASTER,PLUS/1H.,1H ,1H*,1H+/
DATA DOLAR,DASH,COLON/1H$,1H-,1H:/
DATA EXCLAM/1H!/
DATA SNAME/4HPLOT,4H21 /
C
C
CALL FPRBUG(SNAME,1,21,IBUG)
C
IDHF=DHF+0.0001
STMN=STM(J1)
IF(KPL.EQ.3.AND.NTT.EQ.1) STMN=STMN-GZERO
KTIMEE=KTIME
IF(NOPROT.EQ.1.OR.IPLHY.NE.1) GO TO 8000
C WRITE(6,995) KTIME,KHR,KDA,KMO,KYR,ISTRT,INOW
C 995 FORMAT(10X,'KTIME KHR KDA KMO KYR ISTRT INOW ='/10X,I5,4I4,
C 1 2I8)
C WRITE(6,998) (FS(I),I=1,KTIMEE)
C 998 FORMAT(2X,'FS=',10F12.2)
C WRITE(6,997) (FFS(I),I=1,KTIMEE)
C 997 FORMAT(1X,'FFS=',10F12.2)
MINN=0
T=0.
FMAX=-20000000.
FMIN=20000000.
ZE=0.
LKK=TMPR/DHF+0.0001
KME=KTIMEE*LKK
KTME=KTIMEE
IF(KME.GT.KTIMEE) KTME=KME
IF(KKP.NE.0) KTME=KTIMEE
ISPLT=KTME/4
C IF(LKK.LT.1) ISPLT=ISPLT+(DHF/TMPR-1.0)*ISPLT+0.0001
C IF(KKP.EQ.1) ISPLT=KTME/4
IDASH=1
KXJ1=LCAT21(KX,J1,NRT1)
LOST=LOSTC(KXJ1)-1
LOQT=LOQTC(KXJ1)-1
C WRITE(6,991) (STC(I+LOST),I=1,KTIME)
C 991 FORMAT(2X,'STC=',10F12.2)
C WRITE(6,992) (QTC(I+LOQT),I=1,KTIME)
C 992 FORMAT(1X,'QTC=',10F12.2)
KKI=1
KI=0
NKI=1
DO 40 K=1,KTIMEE
IK=0
IF (KKP.NE.1 .AND. TMPR.GE.DHF) THEN
IF (FS(K).GT.FMAX) FMAX=FS(K)
IF (FS(K).LT.FMIN) FMIN=FS(K)
ELSE
IF (KKP.NE.1 .AND. K.EQ.NKI) THEN
KI=KI+1
IF(KKP.NE.1) IK=IFMSNG(FFS(KI))
NKI=KI*DHF/TMPR+1.001
ENDIF
IF(FS(K).GT.FMAX) FMAX=FS(K)
IF (KKP.NE.1 .AND. IK.NE.1) THEN
IF(FFS(KI).GT.FMAX) FMAX=FFS(KI)
ENDIF
IF(FS(K).LT.FMIN) FMIN=FS(K)
IF (KKP.NE.1 .AND. IK.NE.1) THEN
IF(FFS(KI).LT.FMIN) FMIN=FFS(KI)
ENDIF
ENDIF
40 CONTINUE
IF(FMIN.LE.STMN.AND.NTT.EQ.1) MINN=1
IF(KU(J1).EQ.1.AND.KPL.EQ.2) MINN=0
IF(KU(J1).EQ.2.AND.KPL.NE.2) MINN=0
IF (KKP.NE.1 .AND. TMPR.GE.DHF) THEN
DO 45 K=1,KTME
IK=IFMSNG(FFS(K))
IF (IK .NE. 1) THEN
IF(FFS(K).GT.FMAX) FMAX=FFS(K)
IF(FFS(K).LT.FMIN) FMIN=FFS(K)
ENDIF
45 CONTINUE
ENDIF
RG=FMAX-FMIN
KG=0
IF(FMIN.GE.ZE.AND.FMAX.GE.ZE) KG=1
IF(FMIN.LE.ZE.AND.FMAX.LE.ZE) KG=1
I = 1
XP = 10.0
60 IF ((RG/XP).LE.10.0 .OR. I.GT.6) GOTO 70
XP = XP*10.0
I = I+1
GOTO 60
70 CONTINUE
MP=RG/XP+1.3
IRG=MP*XP
AIRG=IRG
DPL=IRG*0.01
IF (KG .GT. 0) THEN
IMIN=FMIN
IF(FMIN.LT.0.) IMIN=IMIN-1
FMIN=IMIN
ELSE
IMIN=FMIN-2.5
IMAX=IRG+IMIN
FMAX=IMAX
KK=(AIRG-FMAX)/AIRG*100.+0.1
KK=KK+1
FMIN=IMIN
ENDIF
DO 110 I=1,11
110 SCALE(I)=IMIN+(I-1)*DPL*10.
IF(KPL.EQ.1.OR.KPL.EQ.3) WRITE(IPR,260)SCALE
IF(KPL.EQ.2) WRITE(IPR,261)SCALE
KI=0
NKI=1
LKI=1
C
C DETERMINE INITIAL DAY AND HOUR
C
DTIM=TMPR
IF(KKP.NE.1.AND.TMPR.GE.DHF) DTIM=DHF
LTIM=DTIM+.0001
LDA=KDA
LHR=KHR-IDHF
IF (LTIM .GE. KHR) THEN
LDA=KDA-1
LHR=LHR+24
ENDIF
C
C DETERMINE THE CORRECT MONTH
C
LMO = KMO
CALL DDGCDM(KYR,LMO,KMX)
IT1=1
C
C PLOT THE MINIMUM ALLOWABLE POINT
C
IF (MINN .NE. 0) THEN
IF(KG.GT.0) LMN=(STMN-FMIN)/AIRG*100.+1.5
IF (KG .LE. 0) THEN
IF(STMN.LT.0.) LMN=KK-STMN/FMIN*KK
IF(STMN.GE.0.) LMN=KK+STMN/FMAX*(101-KK)
ENDIF
ORD(LMN)=COLON
ENDIF
C WRITE(6,9997) KKP,LKI,LDA,LHR,LTIM,LMO,KG,LMN
C9997 FORMAT(2X,'BEFORE DO 40 KKP LKI LDA LHR LTIM LMO KG LMN='/
C * 2X,' ',4I4,I5,3I4)
DO 240 K=1,KTIMEE
IK=0
IF(K.GT.1) T=TII(K-1)
IF(KKP.EQ.1) GO TO 112
IF(TMPR.GE.DHF) GO TO 111
IF(K.NE.NKI) GO TO 112
KI=KI+1
IF(KKP.NE.1) IK=IFMSNG(FFS(KI))
LKI=NKI
NKI=KI*DHF/TMPR+1.001
GO TO 112
111 KI=KI+1
IF(KKP.NE.1) IK=IFMSNG(FFS(KI))
IF(KI.GT.1) T=T1(KI-1)
112 HR=T
IF (K.NE.1 .OR. KI.NE.1) THEN
LHR=KHR-DHF+HR+0.0001
CC LHR=MOD(LHR,24)
LLHR = LHR - LHR/24 * 24
C WRITE(6,889) LLHR,LHR,KHR,DHF,HR
C 889 FORMAT(5X,'====== LLHR,LHR,KHR,DHF,HR=',3I5,2F10.2,1X,5(1H=))
LHR=LLHR
IF(LHR.LT.1) LHR=LHR+24
IF(LHR.LE.LTIM) LDA=LDA+1
ENDIF
C WRITE(6,888) LHR,KI,T,TMPR,DHF
C 888 FORMAT(5X,' LHR KI T TMPR DHF='/5X,
C 1 2I4,F10.2,2F10.7)
IF (KMX .LE. 0) CALL DDGCDM(KYR,LMO,KMX)
IF (LDA .GT. KMX) THEN
KMX=0
LDA=1
LMO=LMO+1
IF(LMO.GT.12) LMO=1
ENDIF
MINS=ISTRT+(K-1)*DTIM+0.0001
C
C WRITE(6,9998) KXJ1,ST0(KXJ1),QT0(KXJ1)
C9998 FORMAT(2X,'KXJ1=',I10,3X,'ST0=',F10.2,3X,'QT0=',F10.0)
IF (K .LE. 1) THEN
ST=ST0(KXJ1)
QT=QT0(KXJ1)
ELSE
IF (KKP .EQ. 0) THEN
ST=STC(K-1+LOST)
QT=QTC(K-1+LOQT)
ELSE
ST=TERP21(T,KTIMI,IT1,IT2,TII,STC,LOST)
QT=TERP21(T,KTIMI,IT1,IT2,TII,QTC,LOQT)
ENDIF
ENDIF
IF(KPL.EQ.3) ST=ST-GZERO
KFLDHT = (FLDHT-SCALE(1))/(SCALE(11)-SCALE(1))*101 + 1
C WRITE(6,996) ST,QT,K,LOST,LOQT,KKP
C 996 FORMAT(1X,' ST QT K LOST LOQT KKP='/1X,2F8.2,3I5,I4)
DO 120 I=2,100
120 ORD(I) = BLANK
DO 130 I=1,101,10
130 ORD(I) = DOT
C WRITE(6,9999) KKP,K,KI,KKI,LKI,LHR
C9999 FORMAT(2X,'AT LABEL 130 KKP,K,KI,KKI,LKI,LHR=',6I10)
IF (NP .LT. 1) THEN
IF(MINS.LT.INOW) IDASH=0
IF(MINS.GT.INOW)KKP=1
IF(KFLDHT.GE.1.AND.KFLDHT.LE.101) ORD(KFLDHT) = EXCLAM
IF (IDASH .EQ. 1) THEN
DO 135 N=1,101
ORD(N)=DASH
135 CONTINUE
IDASH=2
ENDIF
ENDIF
IF (KG .GT. 0) THEN
LS=(FS(K)-FMIN)/AIRG*100.+1.5
ORD(LS)=ASTER
IF(KKP.EQ.1) GO TO 235
IF(IK.NE.1) THEN
LA=(FFS(KI)-FMIN)/AIRG*100.+1.5
ORD(LA)=PLUS
ENDIF
CC IF(IK.EQ.1) ORD(LA)=BLANK
GO TO 230
ENDIF
ORD(KK)=DOLAR
IF (FS(K) .GE. 0.0) THEN
LS=FS(K)/FMAX*(101-KK)
LS=KK+LS
ORD(LS)=ASTER
ELSE
LS=FS(K)/FMIN*KK
LS=KK-LS
ORD(LS)=ASTER
ENDIF
IF (KKP .EQ. 1) GO TO 235
IF (FFS(KI) .GE. 0.0) THEN
IF(IK.NE.1) THEN
LA=FFS(KI)/FMAX*(101-KK)
LA=KK+LA
ORD(LA)=PLUS
ENDIF
CC IF(IK.EQ.1) ORD(LA)=BLANK
ELSE
IF(IK.NE.1) THEN
LA=FFS(KI)/FMIN*KK
LA=KK-LA
ORD(LA)=PLUS
ENDIF
CC IF(IK.EQ.1) ORD(LA)=BLANK
ENDIF
230 IF(TMPR.LT.DHF) GO TO 233
IF(KI.EQ.LKI) GO TO 232
ORD(LS)=BLANK
WRITE(IPR,272) LMO,LDA,LHR,ORD,FFS(KI)
IF(IDASH.EQ.0) IDASH=1
IF(KI.NE.KKI.AND.KI+1.NE.LKI) GO TO 111
IF(KI.NE.KKI) GO TO 240
T11=0.
IF(K.GT.1) T11=T1(KI-1)
WRITE(IPR,280) T11
GO TO 234
232 LKI=LKI+LKK
CC IF(KPL.EQ.3) ST=ST-GZERO
WRITE(IPR,275) LMO,LDA,LHR,ORD,QT,ST,FFS(KI)
C WRITE(IPR,999) ORD,QT,ST,FFS(KI)
C 999 FORMAT(1X,101A1,F7.3,1X,F7.2,1X,F7.2)
IF(IDASH.EQ.0) IDASH=1
IF(KI.NE.KKI.AND.KI+1.NE.LKI) GO TO 111
IF(KI.NE.KKI) GO TO 240
T11=0.
IF(K.GT.1) T11=T1(KI-1)
WRITE(IPR,280) T11
GO TO 234
233 IF(K.NE.LKI.OR.(KKP.NE.1.AND.IK.NE.1)) ORD(LA)=BLANK
IF(NP.EQ.0.AND.LKI.EQ.K) WRITE(IPR,270)LMO,LDA,LHR,ORD,
1 QT,ST,FFS(KI)
IF(NP.EQ.0.AND.LKI.NE.K) WRITE(IPR,270)LMO,LDA,LHR,ORD,
1 QT,ST
IF(NP.GE.1) WRITE(IPR,275) LMO,LDA,LHR,ORD,QT,FS(K),FFS(KI)
IF(IDASH.EQ.0) IDASH=1
IF(K.NE.KKI) GO TO 240
TIME=0.
IF(K.GT.1) TIME=T1(KI-1)
IF(K.NE.LKI) TIME=TIME+TMPR*(K-LKI)
WRITE(IPR,280) TIME
234 KKI=KKI+ISPLT
IF(KKI.GT.KTME) KKI=KTME
IF(TMPR.GE.DHF.AND.KI+1.NE.LKI) GO TO 111
GO TO 240
235 WRITE(IPR,270)LMO,LDA,LHR,ORD,QT,ST
IF (K .EQ. KKI) THEN
WRITE(IPR,280) T
KKI=KKI+ISPLT
IF(KKI.GT.KTME) KKI=KTME
ENDIF
240 CONTINUE
260 FORMAT(5H TIME,F5.0,10F10.0,' Q-FCST H-FCST H-OBS')
261 FORMAT(5H TIME,F5.0,10F10.0,' Q-FCST H-FCST Q-OBS')
270 FORMAT(1X,I2,1H/,I2,1H/,I2,101A1,F10.3,2(1X,F10.2))
272 FORMAT(1X,I2,1H/,I2,1H/,I2,101A1,16X,F10.2)
275 FORMAT(1X,I2,1H/,I2,1H/,I2,101A1,F10.3,2(1X,F10.2))
280 FORMAT(1H+,98X,F6.1,5H HRS.)
C
8000 IF(ITRACE.EQ.1) WRITE(IODBUG,9000) SNAME
9000 FORMAT(1H0,2H**,1X,2A4,8H EXITED.)
RETURN
END
|
! *****************
SUBROUTINE INISIM
! *****************
!
&(NPOIN1,TYPELE,INOP5,NGEO)
!
!***********************************************************************
! PROGICIEL : STBTEL V5.2 25/02/92 J.C. GALLAND
!***********************************************************************
!
! FONCTION : RECHERCHE LES NOMBRES TOTAUX DE NOEUDS ET D'ELEMENTS DU
! MAILLAGE, AINSI QUE LA LONGUEUR DU TABLEAU NOP5 DANS LE
! FICHIER GEOMETRIE DE SIMAIL
!
!-----------------------------------------------------------------------
! ARGUMENTS
! .________________.____.______________________________________________
! | NOM |MODE| ROLE
! |________________|____|______________________________________________
! | NPOIN1 |<-- | NOMBRE REEL DE POINTS DU MAILLAGE
! | TYPELE |<-- | TYPE D'ELEMENTS
! | IA |--> | TABLEAU DE TRAVAIL POUR LA LECTURE DE LA SD
! | INOP5 |<-- | DIMENSION DU TABLEAU NOP5 (CONTENANT LES IKLE)
! | | | DU FICHIER GEOMETRIE DE SIMAIL
! |________________|____|______________________________________________
! | COMMON: | |
! | GEO: | |
! | MESH |<-- | TYPE DES ELEMENTS DU MAILLAGE
! | NDP |<-- | NOMBRE DE NOEUDS PAR ELEMENTS
! | NPOIN |<-- | NOMBRE TOTAL DE NOEUDS DU MAILLAGE
! | NELEM |<-- | NOMBRE TOTAL D'ELEMENTS DU MAILLAGE
! | FICH: | |
! | NRES |--> | NUMERO DU CANAL DU FICHIER DE SERAFIN
! | NGEO |--> | NUMERO DU CANAL DU FICHIER MAILLEUR
! | NDYNAM |--> | NUMERO DU CANAL DU FICHIER DYNAM DE TELEMAC
! | NFO1 |--> | NUMERO DU CANAL DU FICHIER TRIANGLE TRIGRID
! |________________|____|______________________________________________
! MODE : -->(DONNEE NON MODIFIEE), <--(RESULTAT), <-->(DONNEE MODIFIEE)
!-----------------------------------------------------------------------
! APPELE PAR : HOMERE
! APPEL DE : -
!***********************************************************************
!
USE DECLARATIONS_SPECIAL
USE DECLARATIONS_STBTEL, ONLY: NELEM,MESH,NDP,NPOIN
!
IMPLICIT NONE
!
INTEGER, INTENT(INOUT) :: NPOIN1,INOP5
INTEGER, INTENT(IN) :: NGEO
CHARACTER(LEN=11), INTENT(INOUT) :: TYPELE
!
INTEGER IA(32),LONG,I,J,NTASD,MESHT,MESHQ
!
!=======================================================================
! INITIALISATION
!=======================================================================
!
REWIND NGEO
NPOIN = 0
NPOIN1 = 0
NELEM = 0
!
!=======================================================================
! LECTURE PARTIELLE DU 1ER ENREGISTREMENT DE LA SD
!=======================================================================
!
READ(NGEO,ERR=110,END=120) LONG,(IA(I),I=1,MIN(LONG,32))
!
!=======================================================================
! LECTURE PARTIELLE DU TABLEAU NOP0
! RECHERCHE DU NOMBRE DE TABLEAUX ASSOCIES, NTASD
!=======================================================================
!
READ(NGEO,ERR=110,END=120) LONG,(IA(I),I=1,32)
NTASD = IA(32)
!
!=======================================================================
! LECTURE DU TABLEAU NOP1 ET DES TABLEAUX ASSOCIES
!=======================================================================
!
IF (NTASD.GT.0) THEN
READ(NGEO,ERR=110,END=120) LONG,(IA(I),I=1,MIN(LONG,32))
DO I=1,NTASD
READ(NGEO,ERR=110,END=120) LONG,(IA(J),J=1,MIN(LONG,32))
ENDDO
ENDIF
!
!=======================================================================
! LECTURE DU TABLEAU NOP2
! LECTURE DU NOMBRE DE POINTS, DU NOMBRE D'ELEMENTS, DU TYPE D'ELEMENT
! ET DE LA LONGUEUR DU TABLEAU NOP5 (TABLEAU DES IKLE)
! AFFECTATION DES VALEURS LUES AUX VARIABLES CONCERNEES
!=======================================================================
!
READ(NGEO,ERR=110,END=120) LONG,(IA(I),I=1,MIN(LONG,32))
NPOIN1 = IA(15)
NELEM = IA(5)
MESHT = IA(8)
MESHQ = IA(9)
INOP5 = IA(26)
!
NPOIN = NPOIN1
!
!=======================================================================
! MISE DES VALEURS DE MESH AU STANDARD TELEMAC
!=======================================================================
!
IF (MESHQ.NE.0) THEN
MESH = 2
NDP = 4
TYPELE = 'QUADRANGLES'
ELSEIF (MESHT.NE.0) THEN
MESH = 3
NDP = 3
TYPELE = 'TRIANGLES '
ELSE
IF (LNG.EQ.1) WRITE(LU,100)
IF (LNG.EQ.2) WRITE(LU,3100)
CALL PLANTE(1)
STOP
ENDIF
!
GOTO 20
!
110 IF (LNG.EQ.1) WRITE(LU,1100)
IF (LNG.EQ.2) WRITE(LU,4100)
120 IF (LNG.EQ.1) WRITE(LU,1200)
IF (LNG.EQ.2) WRITE(LU,4200)
!
20 CONTINUE
!
!=======================================================================
! IMPRESSION DES RESULTATS
!=======================================================================
!
100 FORMAT(/,'*******************************************************'
& ,/,'INISIM : TELEMAC NE TRAITE PAS LES MAILLAGES COMPORTANT'
& ,/,' A LA FOIS DES TRIANGLES ET DES QUADRANGLES',
& /,'*******************************************************')
3100 FORMAT(/,'*************************************************'
& ,/,'INISIM : TELEMAC DOESN''T WORK WITH MESHES MIXING '
& ,/,' TRIANGLES AND QUADRILATERALS',
& /,'**************************************************')
1100 FORMAT(//,'**********************************************',/,
& 'INISIM : ERREUR A LA LECTURE DU FICHIER SIMAIL',/,
& '**********************************************',//)
4100 FORMAT(//,'*************************************',/,
& 'INISIM : ERROR IN READING FILE SIMAIL',/,
& '*************************************',//)
1200 FORMAT(//,'*****************************************',/,
& 'INISIM : FIN PREMATUREE DU FICHIER SIMAIL',/,
& '*****************************************',//)
4200 FORMAT(//,'*************************************************',/,
& 'INISIM : ATTEMPT TO READ AFTER END OF FILE SIMAIL',/,
& '*************************************************',//)
!
RETURN
END
|
DOUBLE PRECISION FUNCTION E01BHX(X1,X2,F1,F2,D1,D2,A,B,IERR)
C MARK 13 RELEASE. NAG COPYRIGHT 1988.
C
C ------------------------------------------------------------------
C
C Derived from PCHIP routine
C CHFIV: Cubic Hermite Function Integral Evaluator.
C
C Called by E01BHF to evaluate the integral of a single cubic (in
C Hermite form) over an arbitrary interval (A,B).
C
C ------------------------------------------------------------------
C
C Parameters:
C
C VALUE -- (output) value of the requested integral.
C
C X1,X2 -- (input) endpoints if interval of definition of cubic.
C (Must be distinct. Error return if not.)
C
C F1,F2 -- (input) function values at the ends of the interval.
C
C D1,D2 -- (input) derivative values at the ends of the interval.
C
C A,B -- (input) endpoints of interval of integration.
C
C IERR -- (output) error flag.
C IERR = 0 Normal return.
C IERR = 1 if X1 = X2.
C (Value has not been set if IERR = 1.)
C
C ------------------------------------------------------------------
C
C Programmed by: Fred N. Fritsch, FTS 532-4275,
C Mathematics and Statistics Division,
C Lawrence Livermore National Laboratory.
C
C ------------------------------------------------------------------
C .. Parameters ..
DOUBLE PRECISION HALF, TWO, THREE, FOUR, SIX
PARAMETER (HALF=0.5D0,TWO=2.0D0,
* THREE=3.0D0,FOUR=4.0D0,SIX=6.0D0)
C .. Scalar Arguments ..
DOUBLE PRECISION A, B, D1, D2, F1, F2, X1, X2
INTEGER IERR
C .. Local Scalars ..
DOUBLE PRECISION DTERM, FTERM, H, PHIA1, PHIA2,
* PHIB1, PHIB2, PSIA1, PSIA2,
* PSIB1, PSIB2, TA1, TA2, TB1, TB2,
* UA1, UA2, UB1, UB2
C .. Executable Statements ..
C Validity check input.
IF (X1.EQ.X2) THEN
C
C Error return.
IERR = 1
ELSE
IERR = 0
C Compute integral.
H = X2 - X1
TA1 = (A-X1)/H
TA2 = (X2-A)/H
TB1 = (B-X1)/H
TB2 = (X2-B)/H
C
UA1 = TA1**3
PHIA1 = UA1*(TWO-TA1)
PSIA1 = UA1*(THREE*TA1-FOUR)
UA2 = TA2**3
PHIA2 = UA2*(TWO-TA2)
PSIA2 = -UA2*(THREE*TA2-FOUR)
C
UB1 = TB1**3
PHIB1 = UB1*(TWO-TB1)
PSIB1 = UB1*(THREE*TB1-FOUR)
UB2 = TB2**3
PHIB2 = UB2*(TWO-TB2)
PSIB2 = -UB2*(THREE*TB2-FOUR)
C
FTERM = F1*(PHIA2-PHIB2) + F2*(PHIB1-PHIA1)
DTERM = (D1*(PSIA2-PSIB2)+D2*(PSIB1-PSIA1))*(H/SIX)
C Return value.
E01BHX = (HALF*H)*(FTERM+DTERM)
END IF
RETURN
END
|
************************************************************************
*
* Subroutine ESTLOAD Called by: Main program
*
* given the calibrated regression models developed in CALIBR,
* estimate loads
*
* local vars
* ----------
* PLOADAML individual AMLE load estimate (P is for 'population')
* PLOADLAD individual LAD load estimate (P is for 'population')
* PLOADMLE individual MLE load estimate (P is for 'population')
* XLEST explanatory variables for estimating mean load
*
************************************************************************
SUBROUTINE ESTLOAD(BCLAD,BESTMOD,CCMAX,CENSFLAG,CFACTOR,CFLOW,
& CUNITSTR,DECTIME2,DVNAME,EADDL,EDATE,EFLOW,
& EQSTAT,ETIME,LDOPT,LDOUT,LFACTOR,LQCENT,
& LUNITSTR,NADDL,NCENS,NCONST,NEXPL,NOBSC,NOBSCI,
& NOBSE,NPAR,NSEAS,PARAML,PARLAD,PARMLE,PERIOD2,
& PRTOPT,RVARMLE,SBEG,SEND,SEOPT,TRANS,WFLAG,
& XLCAL,YD,YLCAL,YLCAL2)
*
* dimensional parameters
*
INCLUDE 'fmodules.inc'
*
* subroutine arguments
*
LOGICAL WFLAG,CENSFLAG(*)
INTEGER*4 BESTMOD,LDOPT,LDOUT,NADDL,NCENS,NCONST,NEXPL,NOBSC,
& NOBSCI,NOBSE,NPAR,NSEAS,PRTOPT,SEOPT
INTEGER*4 ETIME(*)
DOUBLE PRECISION BCLAD,CCMAX,CFACTOR,LFACTOR,LQCENT,RVARMLE
DOUBLE PRECISION CFLOW(*),DECTIME2(*),EFLOW(*),EQSTAT(*),
& PARAML(*),PARLAD(*),PARMLE(*),PERIOD2(*),YD(*),
& YLCAL(*),YLCAL2(*)
DOUBLE PRECISION EADDL(NADDL,*),XLCAL(NOBSCI,*)
CHARACTER*(*) CUNITSTR,LUNITSTR
CHARACTER*4 SBEG(*),SEND(*)
CHARACTER*5 DVNAME(*),TRANS(*)
CHARACTER*8 EDATE(*)
*
* local vars
*
DOUBLE PRECISION PLOADAML(NOBSE),PLOADLAD(NOBSE),PLOADMLE(NOBSE)
DOUBLE PRECISION XLEST(NOBSE,MAXPARMS)
*
* output heading for estimated loads
*
CALL OUTHEAD(CFLOW,EDATE,EQSTAT,LUNITSTR,NOBSC,NOBSE,WFLAG,LDOUT)
*
* generate explanatory variables for the best model
*
CALL SETXL(BESTMOD,NOBSE,LQCENT,EADDL,EFLOW,DECTIME2,PERIOD2,
& XLEST,NOBSE,NEXPL,DVNAME,TRANS,NADDL)
*
* estimate loads using AMLE
*
CALL AMLLOAD(CENSFLAG,EDATE,LDOPT,LDOUT,LFACTOR,NOBSC,NOBSCI,
& NOBSE,NPAR,NSEAS,PARAML,PLOADAML,SBEG,SEND,SEOPT,
& XLCAL,XLEST,YD,YLCAL2)
*
* estimate loads using MLE
*
CALL MLELOAD(EDATE,LDOPT,LDOUT,LFACTOR,NOBSC,NOBSCI,NOBSE,NPAR,
& NSEAS,PARMLE,PLOADMLE,RVARMLE,SBEG,SEND,SEOPT,XLCAL,
& XLEST)
*
* estimate loads using LAD
*
IF (NCENS .EQ. 0)
& CALL LADLOAD(BCLAD,EDATE,LDOPT,LFACTOR,NOBSC,NOBSE,NPAR,NSEAS,
& PARLAD,SBEG,SEOPT,SEND,XLCAL,XLEST,YLCAL,PLOADLAD,
& NOBSCI,LDOUT)
*
* output summary statistics for estimated loads and concentrations
*
CALL OUTSUMM(CCMAX,CFACTOR,CUNITSTR,EFLOW,LFACTOR,LUNITSTR,NCENS,
& NOBSE,PLOADAML,PLOADLAD,PLOADMLE,LDOUT)
*
* if requested, output individual load estimates
*
IF (PRTOPT.EQ.1)
& CALL OUTIND(EDATE,EFLOW,ETIME,NCENS,NOBSE,PLOADAML,PLOADLAD,
& PLOADMLE,NCONST,LDOUT)
RETURN
END
|
SUBROUTINE DIFUVTX(US,US1,U,V,TT,OUX,OVX
_ ,MP1,MP2,MM1,MM2,DU,DV,DTT,J)
!
IMPLICIT NONE
!
! This subroutine is to calculate the tendency of the wind and the temperature:
! DU, DV, DTT
!
#include <PARADYN>
!
! The file PARA is to define the parameters related to the model resolution:
! NX is the grid number in longitude
! NY is the grid number in latitude
! NL is the number of vertical layers
!
REAL*8
_ U (NX,NL) ! input variable, U = u*sqrt(Ps)
_ ,US (NX,NL) ! input variable, US = u, zonal wind
_ ,US1(NX,NL) ! input variable, US = u, zonal wind
_ ,V (NX,NL) ! input variable, V = v*sqrt(Ps)
_ ,TT (NX,NL) ! input variable, TT=R*T'*Sqrt(Ps)/CB,
! where T'=T-TB, T is the temperatur,
! TBB is Temperature of the standard atmosphere
_ ,OUX ! input constant, OUX=1/(RAD*SINU*DX*MDJ),where,
! DX is the horizontal stepsize in zonal direction,
! MDJ is the leaping length of the central difference
! SINU is sin(theta) at intger grid j
_ ,OVX ! input constant, OUX=1/(RAD*SINV*DX*MDJ)
!
INTEGER
_ MM1(NX) ! input constant
_ ,MP1(NX) ! input constant
_ ,MM2(NX) ! input constant
_ ,MP2(NX) ! input constant
!
REAL*8
_ DU (NX,NL) ! output variables
_ ,DV (NX,NL) ! output variables
_ ,DTT(NX,NL) ! output variables
!
INTEGER I,J,K
INTEGER IM1,IP2,IP1,IM2,I1,J0,IM3,IP3
REAL*8 OUX2,OUX4,OVX4
C
C AS FOLLOWS, THE IMPROVED LEAP-FROG AND THE REGENERATION OF
C VARIABLES WILL BE FINISHED IN THE SAME CYCLES.
C
I1=NX-1
OUX2=OUX*0.5
OUX4=OUX*0.25
OVX4=OVX*0.25
C
C CALCULATING DU/DT, DV/DT AND DTT/DT.
C
IF(J.EQ.1) THEN
DO K=1,NL
DO I=2,I1
IP1=MP1(I)
IM1=MM1(I)
IP2=MP2(I)
IM2=MM2(I)
C
DTT(I,K)=0.0D0
DU (I,K)=0.0D0
DV (I,K)=-OVX4*(US1(IP2,K)*V(IP1,K)
& -US1(IM2,K)*V(IM1,K))
ENDDO
ENDDO
ELSE
DO K=1,NL
DO I=2,I1
IP1=MP1(I)
IM1=MM1(I)
IP2=MP2(I)
IM2=MM2(I)
DTT(I,K)=-OUX2*(US(IP2,K)*TT(IP1,K)-US(IM2,K)*TT(IM1,K))
DU (I,K)=-OUX4*((US(I,K)+US(IP1,K))*U(IP1,K)
& -(US(I,K)+US(IM1,K))*U(IM1,K))
DV (I,K)=-OVX4*((US1(IP2,K)+US(IP2,K))*V(IP1,K)
& -(US1(IM2,K)+US(IM2,K))*V(IM1,K))
ENDDO
ENDDO
ENDIF
!
DO K=1,NL
DTT(1,K)=DTT(I1,K)
DTT(NX,K)=DTT(2,K)
DU (1,K)=DU (I1,K)
DU (NX,K)=DU (2,K)
DV (1,K)=DV (I1,K)
DV (NX,K)=DV (2,K)
ENDDO
!
RETURN
END
|
C*****************************************************************
C HEISENBERG UNCERTAINITY PRINCIPLE 2 *
C*****************************************************************
SUBROUTINE HEISENBERG2
IMPLICIT DOUBLE PRECISION(A-H,O-Z)
REAL*8 M
H=6.62606931E-34
PI=3.14159268
M=9.109E-31
WRITE(*,5)
5 FORMAT(1X, 'ENTER THE UNCERTAINITY IN POSITION')
READ*, DELX
DELU=H/(4*PI*M*DELX)
WRITE(*,10) DELU
10 FORMAT(1X, 'THE UNCERTAINITY IN VELOCITY IS', E10.5)
RETURN
END
|
C$PROG TEXSAVLDF - Find and stores PAC-file records - from ldf-file
C
C ******************************************************************
C BY W.T. MILNER AT HRIBF - LAST MODIFIED 04/24/2002
C ******************************************************************
C
SUBROUTINE TEXSAVLDF(IERR)
C
IMPLICIT NONE
C
C ------------------------------------------------------------------
COMMON/LLL/ MSSG(28),NAMPROG(2),LOGUT,LOGUP,LISFLG,MSGF
INTEGER*4 MSSG,NAMPROG,LOGUT,LOGUP
CHARACTER*4 LISFLG,MSGF
CHARACTER*112 CMSSG
EQUIVALENCE (CMSSG,MSSG)
C ------------------------------------------------------------------
COMMON/ML02/ IWDRAW(20)
INTEGER*4 IWDRAW
C ------------------------------------------------------------------
COMMON/LM01/ LIN,KFI,LINO,LOU(3),KFO(3),LOUO(3),LTX,LML,LMLO,
& KMDS,LUCI,LUCO(3)
C
INTEGER*4 LIN, LOU, LTX,LML,
& LUCI,LUCO
C
CHARACTER*4 KFI,LINO, KFO, LOUO, LMLO
CHARACTER*4 KMDS
C ------------------------------------------------------------------
COMMON/LM05/ IBUF(16384)
INTEGER*4 IBUF
C ------------------------------------------------------------------
COMMON/LM20/ LUINF,LUOUF,INFOP,OUFOP
INTEGER*4 LUINF,LUOUF
CHARACTER*4 INFOP,OUFOP
C ------------------------------------------------------------------
COMMON/LM23/ INDIR(8192),OUDIR(8192),INTYP,OUTYP,INRECI,OURECI
INTEGER*4 INDIR, OUDIR, INRECI,OURECI
CHARACTER*4 INTYP,OUTYP
C ------------------------------------------------------------------
CHARACTER*4 STAT,KIND,FOUND
C
INTEGER*4 STRLEN,NXNB,LSNB
C
INTEGER*4 IERR,NEOF,JEOF,JEOFM,JREC,N
C
INTEGER*4 LINE(20),NREC,NUMBY,NFW,IA,IB,I,J,ISTAT,NDO
C
CHARACTER*80 CIWD,CLINE
C
EQUIVALENCE (CIWD,IWDRAW),(CLINE,LINE)
C
SAVE
C
C ------------------------------------------------------------------
C CREATE A FILE FOR STORAGE OF TEXT (PAC file)
C ------------------------------------------------------------------
C
IERR=0
C
CLOSE(UNIT=LTX)
IA=NXNB(IWDRAW,5,80)
IF(IA.LE.0) GO TO 900
IB=LSNB(IWDRAW,IA,80)
IF(IB.LE.0) GO TO 900
C
OPEN(UNIT = LTX,
& FILE = CIWD(IA:IB),
& STATUS = 'UNKNOWN',
& IOSTAT = ISTAT)
C
IF(ISTAT.NE.0) THEN
CALL IOFERR(ISTAT)
GO TO 910
ENDIF
C
C ------------------------------------------------------------------
C Logs/Displays auxillary records (non-data) from LDF-files
C ------------------------------------------------------------------
C
IERR=0 !RESET ERROR FLAG
STAT='GOOD' !RESET STATUS
NEOF=0 !RESET EOF-COUNTER
JEOF=0 !RESET CURRENT-FILE COUNTER
JREC=0 !RESET CURRENT-REC COUNTER
FOUND='NO ' !Reset found flag
C
50 IF(MSGF.NE.' ') GO TO 1100 !TST FOR STOP MESSAGE
IF(NEOF.LT.2) GO TO 70 !TST FOR DOUBLE-EOF
C
WRITE(CMSSG,55)JEOF !IF YES, SAY SO
CALL MESSLOG(LOGUT,LOGUP)
55 FORMAT('DOUBLE END-OF-FILE ENCOUNTERED AT FILE-MARK OFFSET',I6)
C
INRECI=INRECI-1
C
JEOFM=JEOF-1
WRITE(CMSSG,60)JEOFM,JEOF
60 FORMAT('WITH LUCK - I AM BETWEEN FILE-MARK OFFSETS',I5,' &',I6)
CALL MESSLOG(LOGUT,LOGUP)
GO TO 2000 !TAKE ERROR RETURN
C
70 INRECI=INRECI+1
NREC=INRECI
C
CALL LDFREAD(LUINF,NREC,IBUF,KIND,NFW,STAT)
C
NUMBY=4*NFW
C
IF(STAT.EQ.'GOOD') GO TO 80 !TST FOR GOOD STATUS
C
IF(STAT.EQ.'EOF ') THEN !TST FOR END-OF-FILE
NEOF=NEOF+1 !INC N-FILE COUNTER
JEOF=JEOF+1 !INC FILE-MARK COUNTER
JREC=0 !ZOT RECORD COUNTER
GO TO 50
ENDIF
GO TO 1120 !OTHERWISE, TAKE ERROR RETN
C
80 NEOF=0 !RESET EOF-COUNTER
JREC=JREC+1
C
IF(KIND.EQ.'PAC ') GO TO 300
C
IF(FOUND.EQ.'NO ') GO TO 50
C
GO TO 2100
C
C
300 FOUND='YES '
IB=0
NDO=NFW/20
DO 350 J=1,NDO
CLINE=' '
IA=IB+1
IB=IA+19
N=0
DO 310 I=IA,IB
N=N+1
LINE(N)=IBUF(I)
310 CONTINUE
WRITE(LTX, 315)CLINE(1:STRLEN(CLINE))
WRITE(LOGUT,320)CLINE(1:STRLEN(CLINE))
315 FORMAT(A)
320 FORMAT(1H ,A)
350 CONTINUE
GO TO 50
C
C ------------------------------------------------------------------
C ERROR RETURNS
C ------------------------------------------------------------------
C
900 WRITE(CMSSG,905)
905 FORMAT('SYNTAX ERROR IN FILENAME SPECIFICATION')
CALL MESSLOG(LOGUT,LOGUP)
GO TO 1200
C
910 WRITE(CMSSG,915)
915 FORMAT('ERROR OPENING TEX-FILE')
CALL MESSLOG(LOGUT,LOGUP)
GO TO 1200
C
1100 WRITE(CMSSG,1105)
1105 FORMAT('PROCESS INTERRUPTED VIA CTRL-C')
GO TO 1200
C
1120 WRITE(CMSSG,1125)STAT
1125 FORMAT('HEDLOC ERROR READING - STAT =',A4)
GO TO 1200
C
1200 CALL MESSLOG(LOGUT,LOGUP)
C
2000 IERR=1
C
2100 CLOSE(UNIT=LTX)
C
RETURN
END
|
* Copyright (c) Colorado School of Mines, 2010.
* All rights reserved.
c This program is for computing reflection angles. Suppose the
c two reflectors are horizontal. (Zhenyue Liu, 1991)
c eps: error control for Newton iteration.
c c1 & c2: velocities in the first layer and the second.
c h1 & h2: heights of the first and the second layers.
c xs: shot position
c x1: horizontal position of first outpoint in interfaces.
c nout: number of output points
c xd: spacing of output points
c out1: filename containing cosine of angle on the first interface.
c out2: filename containing cosine of angle on the second interface.
real eps, c1, c2, h1, h2, xs, xd, x1
parameter( eps=0.01, c1=5000, c2=6000, h1=1500, h2=1000,
$ nout=60, xs=1000, xd=80, x1=2000)
real cosb(nout)
open(1, file='out1', form='unformatted', status='new')
open(2, file='out2', form='unformatted', status='new')
c Compute cosine of angle on the first interface
do 10 i = 1, nout
cosb(i) = h1 / sqrt(h1**2 + (xs-x1)**2)
10 continue
write(1) (cosb(i), i=1, nout)
c Do Newton iterations for cosine of angle on the second interface,
c until tolerence met
b1 = 0.
20 b2 = asin(c2/c1*sin(b1))
f = h1 * tan(b1) + h2 * tan(b2) - x1 + xs
if (abs(f) .le. h1*eps) goto 30
df = h1 / cos(b1)**2 + h2 * cos(b1) / cos(b2)**3 * c2/c1
b1 = b1 - f / df
goto 20
c End Newton iterations
30 do 40 i = 1, nout
cosb(i) = cos(b2)
40 continue
write(2) (cosb(i), i=1, nout)
close(1)
close(2)
end
|
*
* $Id: doit_cd_scatters.F,v 1.3 2000/08/18 18:30:49 dpp Exp $
*
* $Log: doit_cd_scatters.F,v $
* Revision 1.3 2000/08/18 18:30:49 dpp
* -> fix zeroing of unused scatters
* -> add new TF scatters directly;
* would like to remove the old CD scatters
*
* Revision 1.2 1998/07/09 00:49:02 lyon
* seq/cdgeom -> cl3seq/cdgm3
*
* Revision 1.1.1.1 1998/02/06 19:11:44 dpp
* DOIT first release.
*
*
*
#include "sys/CLEO_machine.h"
#include "pilot.h"
*-- Author :
SUBROUTINE DOIT_CD_SCATTERS
#if defined(CLEO_TYPCHK)
IMPLICIT NONE
#endif
C. 10/04/89 by Steve Schaffner
C. put in scattering media information here (pending developments in CDGEOMCD)
#include "doit/duseq/tfindpar.inc"
#include "doit/duseq/tfgeomcd.inc"
#include "cl3seq/cdgm3/cdgeomcd.inc"
#include "doit/duseq/tfctlcde.inc"
INTEGER I
C Scattering media information
C RSCACD,XSCACD - Radius & thickness of scatterers
C (beam pipe = 1)
RSCACD(1) = 0.035
C Changed beam pipe radius to something smaller than SVX dimension
C THIS IS UGGLY BUT FOR TODAY... NUIMBERS WRONG ANYWAY... (A. Ryd)
IF (IDTOCD(ISVX1).GT.0) RSCACD(1)=0.015
XSCACD(1) = 0.0043
C (DR3 axial/stereo interface =2)
RSCACD(2) = 0.370
XSCACD(2) = 0.2
C RSCACD(3) is set to =0 so that MSCATF is not incremented for it in TFGMI1
RSCACD(3) = 0.00
XSCACD(3) = 0.02
IF(NSCATF.GE.4)THEN
DO 71 I=4,NSCATF
RSCACD(I) = 0.0
XSCACD(I) = 0.0
71 CONTINUE
ENDIF
C XSCCCD,RSCCCD - Radius and inverse rad.len. of continuous scatterers
XSCCCD(1) = 0.0094
XSCCCD(2) = 0.0069
RSCCCD(1) = 0.045
RSCCCD(2) = 0.166
IF(NSCCTF.GE.3)THEN
DO 73 I=3,NSCCTF
RSCCCD(I) = 0.0
XSCCCD(I) = 0.0
73 CONTINUE
ENDIF
C fill in the new TF scattering layer descriptions directly
C 1: all material up to the 4th layer of silicon
C at a radius between the 4th layer of silicon and the DR inner tube
C Count the beam pipe and the carbon as more layers of silicon
C Total is about 2% rl
ACTIV_SCAT(1)=.TRUE.
RAD_SCAT(1)= .11
R_LEN_SCAT(1)= 6.* .000300/.0936
C 2: 19% rl at the DR3 axial/stereo interface,
C make kink with no stiffness
ACTIV_SCAT(2)=.TRUE.
RAD_SCAT(2)= .37
R_LEN_SCAT(2)= .19
IF(M_SCAT.GE.3)THEN
DO 91 I=3,M_SCAT
ACTIV_SCAT(I)=.FALSE.
RAD_SCAT(I)= 9.
R_LEN_SCAT(I)= 0.
91 CONTINUE
ENDIF
RETURN
END
|
program simulation
implicit none
integer(kind=2),dimension(:,:),allocatable::phe
integer(kind=2),dimension(:,:,:),allocatable::alq
integer(kind=4),dimension(:),allocatable::chr,all,imc,imt,nmc
integer(kind=4),dimension(:),allocatable::listm,listmc,listq
integer(kind=4),dimension(:),allocatable::chrom,pos,listpot
integer(kind=4),dimension(:),allocatable::nmcum,listqc,ncuq,pere
integer(kind=4),dimension(:),allocatable::mere
real(kind=4), dimension(:), allocatable ::vq,effet,y,g
real(kind=8), dimension(:), allocatable ::freq
logical, dimension(:), allocatable :: typ
integer(kind=4),dimension(:),allocatable:: iani
character*100 fichqtl,fichtypq,ficped,namechr,namechrs,fichperf
character*100 fichfreq,fichchr,fichchrs
character*3500000 ligne
character*128 jour
logical finfich,tecrit
character*1 separateur,optmq,fi,fo
integer nqg,nqm,nqp,nq,ntyp,nm,nm1,nmax,nt,ntt,np,ipos,nc1,nchrom1
integer inmt,i,ia,j,jj,k,l,ng,irc,prc,mrc,nchrom,ichr,nqc,im,iq,nc
integer io
real vart,h2,pcqtl,ve,vg,rgauss,sdg,sdg1,sdg2,x,xx
real xmin,xmax,moy,st,minmaf,seed2
real v1g,v1m,v1p
intrinsic random_seed,random_number
call fdate(jour)
print *,jour
print *
print '(a)','****************************************************'
print '(a)','*** '
print '(a)','*** Simulation de performances a partir de typages '
print '(a)','*** v1 - 11/02/2020 '
print '(a)','*** '
print '(a)','****************************************************'
print *
c *** lecture des parametres ***
vart=100.
separateur=' '
print *,'Nb de gros, moyens, petits QTL '
read (5,*) nqg,nqm,nqp
print *,'Gros, moyens, petits : ',nqg,nqm,nqp
print *,'h2, part de variance genetique due aux QTL'
read (5,*) h2, pcqtl
print *,'h2 et part de variance des qtl : ',h2, pcqtl
print *,'Variances relatives des qtl gros moyens petits qtl'
read (5,*) v1g,v1m,v1p
print *,'Var relatives des Gros, moyens, petits :',v1g,v1m,v1p
print *,'Nombre de chromosomes (0 si un seul fichier)'
read (5,*) nchrom
print *,'Nombre de chromosomes : ',nchrom
nchrom1=nchrom
if (nchrom.eq.0) then
nchrom1=0; nchrom=1
end if
print *,'Fichier pedigree'
read (5,*) ficped
print *,'Fichier pedigree : ',trim(ficped)
print *,'Fichiers marqueurs en entree'
read (5,*) namechr
print *,'Fichier marqueur lu : ',trim(namechr)
print *,'Fichiers marqueurs en sortie (no si pas de sortie)'
read (5,*) namechrs
print *,'Fichier marqueur ecrit: ',trim(namechrs)
print *,'Fichier info sur les QTL'
read (5,*) fichqtl
print *,'Fichier QTL : ',trim(fichqtl)
print *,'Fichier genotypes QTL'
read (5,*) fichtypq
print *,'Fichier genot QTL : ',trim(fichtypq)
print *,'Fichier performances'
read (5,*) fichperf
print *,'Fichier Perf : ',trim(fichperf)
print *,'Fichier de frequences'
read (5,*) fichfreq
print *,'Fichier de frequences : ',trim(fichfreq)
minmaf=0.05
print *,'Limite de MAF pour les QTL ?'
read (5,*,iostat=io) minmaf
print *,'Limite de MAF pour les QTL : ',minmaf
if (minmaf.lt.0..or.minmaf.gt.0.5) stop 'Maf sup 0.5'
print *,'On garde les QTL dans le fichier marqueur ? (o/n)'
optmq='o'
read (5,*,iostat=io) optmq
if (optmq.ne.'n'.and.optmq.ne.'o') stop 'o ou n'
if (optmq.eq.'n') print *,'Les qtl sont elimines des marqueurs'
if (optmq.eq.'o') print *,'Les marqueurs incluent les qtl'
print *,'Format des fichiers de typages/phases input (P ou T) ?'
fi='P'
read (5,*,iostat=io) fi
if (fi.eq.'p') fi='P'; if (fi.eq.'t') fi='T';
print *,'Format en entree : ',fi
if (fi.ne.'P'.and.fi.ne.'T') stop 'format different de P et T'
print *,'Format des fichiers de typages/phases output (P ou T) ?'
fo='T'
read (5,*,iostat=io) fo
if (fo.eq.'p') fo='P'; if (fo.eq.'t') fo='T';
print *,'Format en entree : ',fo
if (fo.ne.'P'.and.fo.ne.'T') stop 'format different de P et T'
print *,'Seed ?'
read (5,*) seed2
print *,'Seed : ',seed2
c initialisation de la racine de tirage aleatoire
call init_random_seed(seed2)
c Faut il d'autres formats ?
if (namechrs.eq.'no'.and.fi.ne.fo) then
print *,'Pas de fichiers marqueurs demandes '
print *,'alors que les formats E/S sont differents ?'
stop
end if
if (namechrs.eq.'no'.and.optmq.eq.'n') then
print *,'Pas de fichiers marqueurs demandes '
print *,'alors que les qtl sont supprimes des marqueurs ?'
stop
end if
tecrit=.true.
if (namechrs.eq.'no') tecrit=.false.
if (fi.eq.fo.and.namechrs.ne.'no'.and.optmq.eq.'o') then
print *,'La reecriture des fichiers marqueurs est inutile'
print *,'Elle n est pas realisee'
tecrit=.false.
end if
c lecture du fichier pedigree pour verifier qu'il est correct (irc de 1 a n, parent<produit) et compter
ng=0
open (2,file=ficped,form='formatted')
do
read (2,*,iostat=io) irc,prc,mrc
if (io.ne.0) exit
ng=ng+1
if (ng.ne.irc) stop 'les individus non de 1 a n dans le pedigree'
if (prc.ge.irc) stop 'pere > individu'
if (mrc.ge.irc) stop 'mere > individu'
end do
close (2)
print *,'Nombre d individus dans le pedigree : ',ng
c y=phenotype, g=valeur genetique, typ=indicateur typé ou non
allocate (y(ng),g(ng),iani(ng),pere(ng),mere(ng),typ(ng))
y(:)=0. ; typ(:)=.false.
c 2eme lecture du fichier pedigree et stockage
open (2,file=ficped,form='formatted')
do i=1,ng
read (2,*) irc,prc,mrc
if (prc.lt.0) prc=0; if (mrc.lt.0) mrc=0
pere(i)=prc ; mere(i)=mrc
end do
close (2)
c variance des qtl
nq=nqg+nqm+nqp
print *,'Nombre de qtl : ', nq
if (v1p.le.0.) stop 'variance des petits qtl <= 0.'
c on rapporte les variances de qtl à celle des petits qtl
v1g=v1g/v1p
v1m=v1m/v1p
c xx variance expliquee par les qtl, en equivalent petits qtl
xx=nqg*v1g + nqm*v1m + nqp
x=vart*h2*pcqtl/xx ! part des petits qtl
c vq=variance de chaque qtl, chr=chrom du qtl, imc=position intra chrom, imt=position globale, effet=effet, all=allele a effet positif
allocate (vq(nq),chr(nq),imc(nq),imt(nq),effet(nq),all(nq))
do i=1, nqg; vq(i)=v1g*x; end do
do i=1, nqm; vq(nqp+i)=v1m*x; end do
do i=1, nqp; vq(nqp+nqm+i)=x; end do
c on calcule le nombre de marqueurs par chrom et les freq alleliques
c nmc = nb marq / chrom, nmcum = nb de marq cumules sur les chrom precedents, ncuq = ?
allocate (nmc(nchrom),nmcum(nchrom+1),ncuq(nchrom+1))
do i=1, nchrom; nmc(i)=0; end do
nm=0 ; ntyp=0 ; nmax=0
c lecture de la premiere ligne des typages pour compter le nb de marqueurs
DO ICHR = 1, nchrom
if (nchrom1.eq.0) then
fichchr=namechr
else
write(fichchr,'(a,i0)') trim(namechr),ichr ; ! cette ligne construit le nom du fichier pour le chrom ichr
end if
open(3,file=fichchr,form='formatted')
call lire_ligne(3,ligne,separateur,nc,finfich)
if (finfich) stop 'Le fichier de phenotypes est vide'
close(3)
call lecligne(ligne,nc) ; ! cette ligne compte le nombre de champs nc sur la ligne
if (fi.eq.'P') then
nc=nc-2
else
nc=(nc-1)/2
end if
if (nc.gt.nmax) nmax=nc
nmc(ichr)=nc
nmcum(ichr)=nm
nm=nm+nc
end do
print *,'Nombre total de marqueurs : ',nm
print *,'Nombre maxi de marqueurs par chromosome: ',nmax
nmcum(nchrom+1)=nm
c freq = frequences de l allele 2 par marqueur, phe = typages pour un animal et un chrom
allocate (freq(nm),phe(2,nmax))
freq(:)=0.
c exploration des fichiers de typages pour compter le nb d individus, remplir typ, et verifier qu ils sont coherents entre eux
DO ICHR = 1, nchrom
if (nchrom1.eq.0) then
fichchr=namechr
else
write(fichchr,'(a,i0)') trim(namechr),ichr ; ! cette ligne construit le nom du fichier pour le chrom ichr
end if
open(3,file=fichchr,form='formatted')
io=0 ; nt=0 ; ntyp=0
do while(io.eq.0)
read(3,*,iostat=io) irc
if (io.ne.0) exit
nt=nt+1
if (irc.gt.ng) stop 'Individu type absent de pedigree'
typ(irc)=.true.
end do
close (3)
if (ichr.eq.1) then
ntt=nt
else if (nt.ne.ntt) then
stop 'fichiers de typages non coherents'
end if
end do
print *, 'Nombre de lignes de typages : ',ntt
ntyp=nt
if (fi.eq.'P') then
ntyp=ntyp/2
print *, 'Nombre d individus types : ',ntyp
end if
c lecture fichiers de typages pour calculer les frequences
DO ICHR = 1, nchrom
if (nchrom1.eq.0) then
fichchr=namechr
else
write(fichchr,'(a,i0)') trim(namechr),ichr ; ! cette ligne construit le nom du fichier pour le chrom ichr
end if
open(3,file=fichchr,form='formatted')
io=0 ; nc=nmc(ichr) ; nm1=nmcum(ichr)
do ia=1, ntyp
if (fi.eq.'P') then
read(3,*) irc,i,(phe(1,j),j=1,nc)
if (i.ne.1) stop 'typages non phases'
read(3,*) irc,i,(phe(2,j),j=1,nc)
if (i.ne.2) stop 'typages non phases'
else
read(3,*) irc,((phe(i,j),i=1,2),j=1,nc)
end if
j=nm1
do i=1, nc
j=j + 1
if (phe(1,i).eq.2) freq(j)=freq(j)+1.
if (phe(2,i).eq.2) freq(j)=freq(j)+1.
end do
if (ichr.eq.1) iani(ia)=irc
end do
close(3)
END DO
c fin de calcul des frequences et sauvegarde dans fichfreq
do i=1, nm
freq(i)=freq(i)/dfloat(2*ntyp)
end do
open(9,file=fichfreq)
do i=1, nm
write(9,'(i6,f8.3)') i,freq(i)
end do
close(9)
c on determine les qtl parmi les marqueurs, puis ses caracteristiques
allocate(listq(nm),listm(nm))
listq(:)=0 ; listm(:)=0
c on determine les np marqueurs potentiels pour etre qtl, sur la base de la maf
allocate(listpot(nm),chrom(nm),pos(nm))
np=0 ; i=0
do ichr=1, nchrom
do ipos=1, nmc(ichr)
i=i+1
chrom(i)=ichr; pos(i)=ipos
if (freq(i).ge.minmaf.and.freq(i).le.(1.-minmaf)) then ;
np=np+1
listpot(np)=i ; ! listpot = liste des np marqueurs potentiels
end if
end do
end do
if (np.le.nq) stop 'moins de marqueurs potentiels que de qtl'
print *,'Nombre de marqueurs a MAF non extreme : ',np
! caracteristique des nq qtl : effet (> ou <0), all=allele a effet positif, chr=chromosome, imc=position intr chrom, imt=numero d ordre global du marq, vq=variance
! listq(num_marq)=num_qtl
c on choisit les qtl par tirage dans np possibilites, on stocke l info, en retire le marqueur de la liste, et on passe au suivant
do i=1, nq
c j=1+np*rand(x)
call random_number(x)
j=1 + np*x
if (j.lt.1.or.j.gt.np) stop 'erreur dans le tirage des qtl'
listq(listpot(j))=i
imt(i)=listpot(j)
iq=listpot(j)
do k=j+1, np
listpot(k-1)=listpot(k)
end do
np=np-1
chr(i)=chrom(iq)
imc(i)=pos(iq)
c tirage de l effet (positif)
effet(i)=.5*sqrt(vq(i)/(2.*freq(iq)*(1.-freq(iq))))
c tirage de l allele a effet positif
all(i)=1
call random_number(x)
if (x.gt.0.5)then
all(i)=2
effet(i)=-effet(i)
end if
end do
c sauvegarde des caracteristiques des QTL dans fichier fichqtl
open (4,file=fichqtl,form='formatted')
do i=1, nq
write (4,200) i,chr(i),imc(i),imt(i),vq(i),freq(imt(i)),effet(i)
200 format (I6,i3,2i7,3f12.5)
end do
close(4)
c mini maxi des effets
xmin=effet(1); xmax=xmin
do i=2, nq
if (effet(i).lt.xmin) xmin=effet(i)
if (effet(i).gt.xmax) xmax=effet(i)
end do
print *,'Effets mini / maxi : ',xmin, xmax
c liste des marqueurs non qtl - sert a preparer les fichiers de marqueurs sans qtl
if (optmq.eq.'n') then
j=0
do i=1, nm
if (listq(i).eq.0) then
j=j+1
listm(i)=j ; ! listm(1:nm) contient 0 pour les qtl, 1:nm-nq pour les marqueurs non qtl ?
end if
end do
else
do i=1, nm
listm(i)=i
end do
end if
c alq=alleles aux qtl, listqc contient le numero de qtl pour les qtl d un chromosome donné, listmc contient les marqueurs non qtl
allocate (alq(2,nq,ntyp),listqc(nq),listmc(nm))
c relecture des chromosomes pour traitement des typages
DO ICHR = 1, nchrom
if (nchrom1.eq.0) then
fichchr=namechr
fichchrs=namechrs
else
write(fichchr,'(a,i0)') trim(namechr),ichr ; ! cette ligne construit le nom du fichier pour le chrom ichr
write(fichchrs,'(a,i0)') trim(namechrs),ichr ; ! cette ligne construit le nom du fichier pour le chrom ichr
end if
print *,'lu : ', fichchr (1:len_trim(fichchr))
print *,'ecrit : ', fichchrs(1:len_trim(fichchrs))
c recherche de la liste des qtl sur le chromosome, stock de leur numéro dans listqc
nqc=0
do iq=1, nq
if (chr(iq).eq.ichr) then
nqc=nqc+1
listqc(nqc)=iq
end if
end do
c liste des marqueurs non qtl intra chromosome, pour svg
nc1=0
do i=nmcum(ichr)+1, nmcum(ichr+1)
if (listm(i).ne.0) then
nc1=nc1+1
listmc(nc1)=i-nmcum(ichr)
end if
end do
print *,'Chr',ichr,': ',nmc(ichr),' locus dont ', nqc,' qtl'
open(3,file=fichchr,form='formatted')
open(4,file=fichchrs,form='formatted')
c lecture proprement dite pour les ntyp animaux
nc=nmc(ichr) ; nm1=nmcum(ichr)
do ia=1, ntyp
if (fi.eq.'P') then
read(3,*) irc,i,(phe(1,j),j=1,nc)
read(3,*) irc,i,(phe(2,j),j=1,nc)
else
read(3,*) irc,((phe(i,j),i=1,2),j=1,nc)
end if
c traitement des qtl : ajout des effets a y
do im=1, nqc
iq=listqc(im)
c effets des qtl sur les performances
if (phe(1,imc(iq)).eq.1) then
y(irc)=y(irc)+effet(iq)
else
y(irc)=y(irc)-effet(iq)
end if
if (phe(2,imc(iq)).eq.1) then
y(irc)=y(irc)+effet(iq)
else
y(irc)=y(irc)-effet(iq)
end if
c stock des alleles qtl, dans l ordre des qtl. On les sauvegardera a la fin, apres trt de tous les chromosomes
alq(1,iq,ia)=phe(1,imc(iq))
alq(2,iq,ia)=phe(2,imc(iq))
end do
c reecriture des marqueurs si demande.
if (tecrit) then
if (fo.eq.'P') then
write (4,100) irc,1,(phe(1,listmc(k)),k=1,nc1)
write (4,100) irc,2,(phe(2,listmc(k)),k=1,nc1)
else
write (4,100) irc,((phe(i,listmc(k)),i=1,2),k=1,nc1)
end if
end if
end do
100 format (I7,65000i2)
close(3)
close(4)
END DO
c sauvegarde des typages qtl
open (4,file=fichtypq,form='formatted')
do i=1, ntyp
write (4,100) iani(i),((alq(k,j,i),k=1,2),j=1,nq)
end do
close(4)
c ajout de la valeur polygenique
vg=h2*vart*(1.-pcqtl) ! variance poly
sdg=sqrt(vg) ! ecart type poly
sdg1=sqrt(0.75*vg) ! ecart type poly si un parent connu
sdg2=sqrt(0.5*vg) ! ecart type poly si deux parents connus
ve=sqrt(vart*(1.-h2)) ! ecart type residuel
moy=0.; st=0.
do i=1, ng
call normal(x)
if (pere(i).eq.0.and.mere(i).eq.0) then
g(i)=x*sdg
else if (mere(i).eq.0) then
g(i)=0.5*g(pere(i)) + x*sdg1
else if (pere(i).eq.0) then
g(i)=0.5*g(mere(i)) + x*sdg1
else
g(i)=0.5*(g(pere(i))+g(mere(i))) + x*sdg2
end if
call normal(x)
y(i)=y(i)+g(i)+ x*ve
end do
c sauvegarde des performances
open (4,file=fichperf,form='formatted')
moy=0.; st=0.;
do i=1, ng
if (typ(i)) then
write (4,*) i,y(i)
moy=moy+y(i)
st=st+y(i)*y(i)
end if
end do
close(4)
if (ntyp.gt.0) moy=moy/ntyp
if (ntyp.gt.1) then
st=(st-ntyp*moy*moy)/(ntyp-1)
else
st=0.
end if
st=sqrt(st)
print *,'Moyenne des performances : ',moy
print *,'Ecart type : ',st
stop
end
c lecture de ligne ****************************************
SUBROUTINE lire_ligne(iunit,ligne,separ,nc,fin)
IMPLICIT none
integer nc,i,j,k,l,iunit,ll
character*3500000 ligne
character*1 separ
logical fin
fin=.false.
read(iunit,'(a3500000)',end=5) ligne
l=len_trim(ligne)
if (separ.eq.' ') return
if (ligne(l:l).eq.separ) then
ligne(l:l)=' '; l=l-1
end if
ll=l
do i=l-1,1,-1
if (ligne(i:i).eq.separ) then
if (ligne(i+1:i+1).eq.separ) then
ligne(i+2:ll+1)=ligne(i+1:ll)
ligne(i+1:i+1)='_'
ll=ll+1
end if
end if
end do
l=ll
nc=1
do i=1, l
if (ligne(i:i).eq.' ') then
c ligne(i:i)='_'
else if (ligne(i:i).eq.separ) then
ligne(i:i)=' '
nc=nc+1
end if
end do
return
5 fin=.true.
return
end
c **************************************************************************
subroutine lecligne(ligne,nc)
implicit none
character*3500000 ligne
integer i,j,k,l,nc
i=1
j=len_trim(ligne)
do while(ligne(i:i).eq.' '.and.i.lt.j)
i=i+1
end do
do while(ligne(j:j).eq.' '.and.j.gt.1)
j=j-1
end do
nc=0
do k=i,j-1
if (ligne(k:k).ne.' '.and.ligne(k+1:k+1).eq.' ')
* nc=nc+1
end do
nc=nc+1
return
end
c **************************************************************************
subroutine normal(x)
implicit none
real x,y
integer i,n
intrinsic random_number
n=12
x=0.
do i=1, n
call random_number(y)
x=x+y
end do
x=((x/float(n))-0.5)*12.
return
end
subroutine init_random_seed(seed1)
! one integer for seed in parameter file
! seed1 >0: initialized with seed1
integer :: a, b, clock
integer,dimension(:), allocatable :: seed
call random_seed(size = b)
allocate(seed(b))
do a=1,n
seed(i)=abs(seed1)+(a-1)
enddo
call random_seed(put = seed)
deallocate(seed)
end subroutine init_random_seed
|
SUBROUTINE EXTEND(ISUB)
*
*
* Size of (un)perturbed subsystem.
* --------------------------------
*
INCLUDE 'common6.h'
COMMON/CHAINC/ XC(3,NCMAX),UC(3,NCMAX),BODYC(NCMAX),ICH,
& LISTC(LMAX)
COMMON/CLUMP/ BODYS(NCMAX,5),T0S(5),TS(5),STEPS(5),RMAXS(5),
& NAMES(NCMAX,5),ISYS(5)
*
*
* Set global index for chain c.m. body.
NCM = NAMES(1,ISUB)
IF (ISYS(ISUB).GE.3) THEN
ICM = ICH
IF (NAME(ICH).EQ.0) GO TO 20
GO TO 12
END IF
*
* Find global index for c.m. body (unperturbed triple or quad).
DO 10 I = IFIRST,N
IF (NCM.EQ.NAME(I)) THEN
ICM = I
GO TO 20
END IF
10 CONTINUE
*
* Include safety procedure in case c.m. body not identified.
12 if(rank.eq.0) WRITE (6,15) ISUB, NCM
15 FORMAT (5X,'WARNING! SUBSYSTEM TERMINATION ISUB =',I3,
& ' NCM =',I5)
STEPS(ISUB) = 0.0D0
if(rank.eq.0) WRITE (6,60) ISUB, NCH, ICH, NAME(ICH)
60 FORMAT (' EXTEND: ISUB NCH ICH NAME(ICH) ',4I5)
GO TO 40
*
* Determine the largest perturbing force (M/R**3).
20 PMAX = 0.0
NNB = LIST(1,ICM)
DO 30 L = 2,NNB+1
J = LIST(L,ICM)
RIJ2 = (X(1,J) - X(1,ICM))**2 + (X(2,J) - X(2,ICM))**2 +
& (X(3,J) - X(3,ICM))**2
PIJ = BODY(J)/(RIJ2*SQRT(RIJ2))
IF (PIJ.GT.PMAX) THEN
PMAX = PIJ
END IF
30 CONTINUE
*
* Choose maximum of dominant perturber and all neighbours at boundary.
PMAX = MAX(PMAX,FLOAT(NNB)*BODYM/RS(ICM)**3)
*
* Specify maximum size of (un)perturbed system (limit of 100*GSTAR).
IF (ISYS(ISUB).LE.2) THEN
GSTAR = GMIN
ELSE
GSTAR = 0.01*GMAX
END IF
RMAXS(ISUB) = (100.0*GSTAR*BODY(ICM)/(2.0*PMAX))**0.3333
*
* Update time limit interval unless termination has been signalled.
IF (STEPS(ISUB).GT.0.0D0) THEN
STEPS(ISUB) = STEP(ICM)
ELSE
* Set phase indicator for termination (step reduction in STEPS).
IF (ISYS(ISUB).LE.2) IPHASE = 4
END IF
*
* if(rank.eq.0)
* &WRITE (6,35) ICM,NAME(ICM),RMAXS(ISUB),STEPS(ISUB),STEP(ICM)
* 35 FORMAT (' EXTEND: ICM NM RMAX STEPS STEP ',2I5,1P,3E10.2)
40 RETURN
*
END
|
!
! See the dyninst/COPYRIGHT file for copyright information.
!
! We provide the Paradyn Tools (below described as "Paradyn")
! on an AS IS basis, and do not warrant its validity or performance.
! We reserve the right to update, modify, or discontinue this
! software at any time. We shall have no obligation to supply such
! updates or modifications or any other form of support to you.
!
! By your use of Paradyn, you understand and agree that we (or any
! other person or entity with proprietary rights in Paradyn) are
! under no obligation to provide either maintenance services,
! update services, notices of latent defects, or correction of
! defects for Paradyn.
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 2.1 of the License, or (at your option) any later version.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public
! License along with this library; if not, write to the Free Software
! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
!
! libdyninst validation suite test #1
! author: Jon Beyer (6/1/01)
! derived from a previous test by Jeff Hollingsworth
!------------------------------------------------------------------------------
#define stop_process_ stop_process
#ifdef __GNUC__
#define AND iand
#define OR ior
#else
#define AND and
#define OR or
#endif
!------------------------------------------------------------------------------
SUBROUTINE test1_33_func1
#include "test1_33F_common.h"
passedTest = 1
END
!------------------------------------------------------------------------------
SUBROUTINE test1_33_func2 (x)
#include "test1_33F_common.h"
INTEGER x
print *, 'Hello'
if (x .eq. 1) then
print *, 'Goodbye.'
else
print *, 'See you.'
endif
print *, 'That"s all.'
END
!------------------------------------------------------------------------------
INTEGER FUNCTION test1_33_func3 (x)
INTEGER x
C INTRINSIC IEOR, IAND, IOR
if (x .eq. 1) then
print *, '1'
x = x + 10
elseif (x .eq. 2) then
print *, '2'
x = x -12
elseif (x .eq. 3) then
print *, '3'
x = x * 33
elseif (x .eq. 4) then
print *, '4'
x = x / 42
elseif (x .eq. 5) then
print *, '5'
x = mod (x, 57)
elseif (x .eq. 6) then
print *, '6'
x = mod (x, 2)
elseif (x .eq. 7) then
print *, '7'
x = mod (x, 3)
elseif (x .eq. 8) then
print *, '8'
x = mod (x, 4)
elseif (x .eq. 9) then
print *, '9'
x = mod (x, 5)
elseif (x .eq. 10) then
print *, '10'
x = mod (x, 6)
endif
print *, 'Exit'
test1_33_func3 = x
RETURN
END
!------------------------------------------------------------------------------
|
*
*
subroutine veloc(k,velave,smave)
*
* determine average velocity and mass of stars in the vicinity
* ------------------------------------------------------------
* of 'k' star
* -----------
*
*
include 'common.h'
*
real*8 velave,smave,v2
*
integer k,i,i1,i2,im,n,nspan,inum
*
*
velave = 0.0d0
smave = 0.0d0
n = nt
c nspan = int(1.5*nminzo/2.0)
c nspan = 10
nspan = 4
*
if(k.gt.nspan) then
i1 = k-nspan
i2 = k+nspan
*
if(i2.ge.n) then
i1 = n - 2*nspan - 1
i2 = n
endif
*
else
i1 = 1
i2 = 2*nspan + 1
endif
*
* compute average velocity and mass of stars from 2*nspan + 1 stars
*
20 inum = 0
do 10 i = i1,i2
im = iname(i)
inum = inum + 1
print*,'i,im,inum,vr,vt,sms=',i,im,inum,vr(im),vt(im),body(im)
v2 = vr(im)**2 + vt(im)**2
velave = velave + v2*body(im)
smave = smave + body(im)
10 continue
*
velave = velave/smave
smave = smave/float(inum)
*
return
end
*
*
|
PROGRAM EXER073F
INTEGER PESQ, I, A(10), B(10), ACHA
CHARACTER RESP*1
WRITE(*, "('Entre dez valores pares para a matriz <A>\n')")
DO 110, I = 1, 10
100 CONTINUE
READ(*, "(I2)") A(I)
IF (.NOT. MOD(A(I),2) .EQ. 0) THEN
GOTO 100
ENDIF
110 CONTINUE
DO 200, I = 1, 10
B(I) = A(I) * 4
200 CONTINUE
RESP = "S"
300 IF (RESP .EQ. "S" .OR. RESP .EQ. "s") THEN
WRITE(*, "('Entre um valor a ser pesquisado:')")
READ(*, "(I2)") PESQ
I = 1
ACHA = 0
400 IF (I .LE. 10 .AND. ACHA .EQ. 0) THEN
IF (PESQ .EQ. B(I)) THEN
ACHA = 1
ELSE
I = I + 1
ENDIF
GOTO 400
ENDIF
IF (ACHA .EQ. 1) THEN
WRITE(*, "(I2, ' foi localizado na posicao ', I2)") PESQ, I
ELSE
WRITE(*, "(I2, ' nao foi localizado')") PESQ
ENDIF
WRITE(*,"('\n\nContinua? [S]im / [N]ao + <Enter>:')")
READ(*, "(A1)") RESP
GOTO 300
ENDIF
END
|
*
* $Id: genbod.F 609 2010-03-31 10:16:45Z stroili $
*
* $Log: genbod.F,v $
* Revision 1.1.1.1 1996/03/22 16:42:49 mclareni
* Phtools
*
*
SUBROUTINE GENBOD
C SUBROUTINE TO GENERATE N-BODY EVENT
C ACCORDING TO FERMI LORENTZ-INVARIANT PHASE SPACE
C ADAPTED FROM FOWL (CERN W505) SEPT. 1974 BY F. JAMES
C EVENTS ARE GENERATED IN THEIR OWN CENTER-OF-MASS,
C BUT MAY BE TRANSFORMED TO ANY FRAME USING LOREN4
C
C INPUT TO SUBROUTINE IS THRU COMMON BLOCK GENIN
C NP=NUMBER OF OUTGOING PARTICLES (.LT. 19)
C TECM=TOTAL ENERGY IN CENTER-OF-MASS
C AMASS(I)=MASS OF ITH OUTGOING PARTICLE
C KGENEV=1 FOR CONSTANT CROSS SECTION
C 2 FOR FERMI ENERGY-DEPENDANCE
C
C OUTPUT FROM SUBROUTINE IS THRU COMMON BLOCK GENOUT
C PCM(1,I)=X-MOMENTUM IF ITH PARTICLE
C PCM(2,I)=Y-MOMENTUM IF ITH PARTICLE
C PCM(3,I)=Z-MOMENTUM IF ITH PARTICLE
C PCM(4,I)=ENERGY OF ITH PARTICLE
C PCM(5,I)=MOMENTUM OF ITH PARTICLE
C WT=WEIGHT OF EVENT
COMMON/GENIN / NP, TECM, AMASS(18), KGENEV
COMMON/GENOUT/ PCM(5,18) , WT
DIMENSION EMM(18)
DIMENSION RNO(50)
C-- PCM1 IS LINEAR EQUIV. OF PCM TO AVOID DOUBLE INDICES
DIMENSION EM(18),PD(18),EMS(18),SM(18),FFQ(18),PCM1(90)
EQUIVALENCE (NT,NP),(AMASS(1),EM(1)),(PCM1(1),PCM(1,1))
C FFQ(N)=PI * (TWOPI)**(N-2) / (N-2)FACTORIAL
DATA FFQ/0.,3.141592, 19.73921, 62.01255, 129.8788, 204.0131,
2 256.3704, 268.4705, 240.9780, 189.2637,
3 132.1308, 83.0202, 47.4210, 24.8295,
4 12.0006, 5.3858, 2.2560, 0.8859/
DATA KNT,TWOPI/0,6.2831853073/
#if defined(CERNLIB_CDC)
DATA KGENEV/ 2 /
#endif
C INITIALIZATION
KNT=KNT + 1
IF(KNT.GT.1) GOTO 100
WRITE(6,1160)
WRITE(6,1200) NP,TECM,(AMASS(JK),JK=1,NP)
100 CONTINUE
IF(NT.LT.2) GOTO 1001
IF(NT.GT.18) GOTO 1002
NTM1=NT-1
NTM2=NT-2
NTP1=NT+1
NTNM4=3*NT - 4
EMM(1)=EM(1)
TM=0.0
DO 200 I=1,NT
EMS(I)=EM(I)**2
TM=TM+EM(I)
200 SM(I)=TM
C CONSTANTS DEPENDING ON TECM
TECMTM=TECM-TM
IF(TECMTM.LE.0.0) GOTO 1000
EMM(NT)=TECM
IF(KGENEV.GT.1) GOTO 400
C CONSTANT CROSS SECTION AS FUNCTION OF TECM
EMMAX=TECMTM+EM(1)
EMMIN=0.0
WTMAX=1.0
DO 350 I=2,NT
EMMIN=EMMIN+EM(I-1)
EMMAX=EMMAX+EM(I)
350 WTMAX=WTMAX*PDK(EMMAX,EMMIN,EM(I))
WTMAXQ=1.0/WTMAX
GOTO 455
C-- FERMI ENERGY DEPENDENCE FOR CROSS SECTION
400 WTMAXQ=TECMTM**NTM2*FFQ(NT) / TECM
C CALCULATION OF WT BASED ON EFFECTIVE MASSES EMM
455 CONTINUE
C-- FILL RNO WITH 3*NT-4 RANDOM NUMBERS,
C-- OF WHICH THE FIRST NT-2 ARE ORDERED.
DO 457 I= 1, NTNM4
457 RNO(I)=RNDM(I)
IF(NTM2) 900,509,460
460 CONTINUE
CALL FLPSOR(RNO,NTM2)
DO 508 J=2,NTM1
508 EMM(J)=RNO(J-1)*(TECMTM)+SM(J)
509 WT=WTMAXQ
IR=NTM2
DO 530 I=1,NTM1
PD(I)=PDK(EMM(I+1),EMM(I),EM(I+1))
530 WT=WT*PD(I)
C-- COMPLETE SPECIFICATION OF EVENT (RAUBOLD-LYNCH METHOD)
PCM(1,1)=0.0
PCM(2,1)=PD(1)
PCM(3,1)=0.0
DO 570 I=2,NT
PCM(1,I)=0.0
PCM(2,I)=-PD(I-1)
PCM(3,I)=0.0
IR=IR+1
BANG=TWOPI*RNO(IR)
CB=COS(BANG)
SB=SIN(BANG)
IR=IR+1
C=2.0*RNO(IR)-1.0
S=SQRT(1.0-C*C)
IF(I.EQ.NT) GOTO 1567
ESYS=SQRT(PD(I)**2+EMM(I)**2)
BETA=PD(I)/ESYS
GAMA=ESYS/EMM(I)
DO 568 J=1,I
NDX=5*J - 5
AA= PCM1(NDX+1)**2 + PCM1(NDX+2)**2 + PCM1(NDX+3)**2
PCM1(NDX+5)=SQRT(AA)
PCM1(NDX+4)=SQRT(AA+EMS(J))
CALL ROTES2(C,S,CB,SB,PCM,J)
PSAVE=GAMA*(PCM(2,J)+BETA*PCM(4,J))
568 PCM(2,J)=PSAVE
GOTO 570
1567 DO 1568 J=1,I
AA=PCM(1,J)**2 + PCM(2,J)**2 + PCM(3,J)**2
PCM(5,J)=SQRT(AA)
PCM(4,J)=SQRT(AA+EMS(J))
CALL ROTES2(C,S,CB,SB,PCM,J)
1568 CONTINUE
570 CONTINUE
900 CONTINUE
RETURN
C ERROR RETURNS
1000 WRITE(6,1100)
GOTO 1050
1001 WRITE(6,1101)
GOTO 1050
1002 WRITE(6,1102)
1050 WRITE(6,1150) KNT
WRITE(6,1200) NP,TECM,(AMASS(JK),JK=1,NP)
STOP
1100 FORMAT(28H0 AVAILABLE ENERGY NEGATIVE )
1101 FORMAT(33H0 LESS THAN 2 OUTGOING PARTICLES )
1102 FORMAT(34H0 MORE THAN 18 OUTGOING PARTICLES )
1150 FORMAT(47H0 ABOVE ERROR DETECTED IN GENBOD AT CALL NUMBER,I7)
1160 FORMAT(34H0 FIRST CALL TO SUBROUTINE GENBOD )
1200 FORMAT(36H INPUT DATA TO GENBOD. NP= ,I6/
+ ,8H TECM=,E16.7,18H PARTICLE MASSES=,5E15.5/(42X,5E15.5)
+)
END
|
C @(#)ldptizon.f 20.9 3/29/99
C****************************************************************
C
C File: ldptizon.f
C
C Purpose: Routine to load PTI LTC Zone data from raw data file
C
c Return code: n = 0 : Success
c n = 1 : Error
c
C Author: Walt Powell Date: 21 May 1996
C Called by: load_pti.f
C
C****************************************************************
integer function ldptizon (xbuf, options, numver, error)
integer error, options(*), numver
character *(*) xbuf
include 'ipfinc/parametr.inc'
include 'ipfinc/prt.inc'
include 'ipfinc/pti_data.inc'
include 'ipfinc/blank.inc'
include 'ipfinc/arcntl.inc'
character word(20)*10, zonename*2
logical first, finished
integer ftn_atoi, ptihashz, fnd_ptiy, status
ldptizon = 0
error = 0
last = index (xbuf, '/') - 1
if (last .le. 0) last = lastch(xbuf)
call ptiscan (xbuf(1:last), word, nwrd, ',', ' ')
do i = nwrd+1, 2
word(i) = ' '
enddo
npti1 = ftn_atoi(word(1))
if (npti1 .eq. 0) then
ldptizon = 1
else
c
c Generate unique zonename if necessary
c
zonename = word(2)
status = fnd_ptiy (zonename)
finished = (status .eq. 0)
next = 48
do while (next .le. 90 .and. .not. finished)
zonename = zonename(1:1) // char(next)
status = fnd_ptiy (zonename)
if (status .eq. 0) then
finished = .true.
else if (next .eq. 57) then
next = 35
else if (next .ge. 35 .and. next .le. 37) then
next = next + 1
else if (next .eq. 38) then
next = 42
else if (next .eq. 42) then
next = 43
else if (next .eq. 43) then
next = 45
else if (next .eq. 45) then
next = 46
else if (next .eq. 46) then
next = 65
else
next = next + 1
endif
enddo
if (zonename .ne. word(2)(1:2)) then
write (errbuf(1), 10000) npti1, word(2), zonename
10000 format (' Duplicate zone name (1:2) on PTI Zone record (',
& i6, 1x, a, ') renamed to (', a, ')')
call prterx ('W',1)
endif
num = ptihashz (npti1, zonename)
if (num .le. 0) then
write (errbuf(1), 10010) npti1, zonename
10010 format (' Zone on PTI Zone record (',
& i6, 1x, a, ') could not be hashed.')
call prterx ('W',1)
error = 1
go to 900
endif
endif
900 continue
return
end
|
C MEMBER GLSPRT
C (from old member PPGLSPRT)
C
SUBROUTINE GLSPRT(NUMST, IREC, IGRID, IPCPN, ISPTR)
C
C.....THIS SUBROUTINE PRODUCES A SORTED LIST PRINTOUT OF THE
C.....PRECIPITATION DATA.
C
C.....ARGUMENTS ARE:
C
C.....NUMST - NUMBER OF STATIONS TO PRINT.
C.....IREC - ARRAY OF RECORD NUMBERS IN 'GENL' PARAMETER ARRAY WHERE
C..... STATION NAMES AND CALL LETTERS CAN BE OBTAINED.
C.....IGRID - ARRAY OF GRID POINT ADDRESSES.
C.....IPCPN - ARRAY OF PRECIPITATION DATA.
C.....ISPTR - ARRAY OF SORT POINTERS THAT DEFINE THE PRECIPITATION LIST
C..... SORTED IN DESCENDING NUMERICAL ORDER.
C
C
INTEGER*2 IREC(1), IGRID(1), IPCPN(1), ISPTR(1)
C
DIMENSION CLTR1(2), CLTR2(2), DESC1(5), DESC2(5), CLTR(2)
DIMENSION DESC(5), PGENL(100), IBLNK(2), ISID(2), SNAME(2)
C
INCLUDE 'common/where'
INCLUDE 'gcommon/gversn'
INCLUDE 'common/ionum'
INCLUDE 'gcommon/gdispl'
INCLUDE 'common/errdat'
INCLUDE 'gcommon/gdate'
INCLUDE 'common/pudbug'
INCLUDE 'gcommon/gopt'
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/fcst_maro/RCS/glsprt.f,v $
. $', '
.$Id: glsprt.f,v 1.1 1995/09/17 19:01:51 dws Exp $
. $' /
C ===================================================================
C
C
DATA NBLNK, IBLNK, GENL /1h , 2*4h , 4hGENL/
DATA SNAME /4hGLSP, 4hRT /
C
901 FORMAT(1H0, '*** GLSPRT ENTERED ***')
902 FORMAT(1H0, '*** EXIT GLSPRT ***')
903 FORMAT(1H1, 92X, 'TIME OF RUN ', 2A4, I2, ',', I5, ' - ', I2, ':',
* I2, 'Z')
904 FORMAT(1H0, 57X, 'NWSRFS VERSION 5.0', /, 52X, 'WGRFC FT. WORTH MA
*RO FUNCTION', /, 54X, '(VERSION ', F4.2, ' - ', A4, I4, ')', //,
* 29X, 'LISTING OF PRECIPITATION FROM DAILY PRECIPITATION FILE FOR
*', 2A4, 1X, I2, ',', I5)
905 FORMAT(48X, 'ONLY OBSERVED PRECIPITATION IS LISTED')
906 FORMAT(36X, 'ESTIMATIONS ARE LISTED...AND ARE FLAGGED WITH AN ASTE
*RISK (*)')
907 FORMAT(15X, 'GRID PRECIP NWS ID NAME', 27X, 'GRID NWS ID
* PRECIP NAME')
908 FORMAT(15X, I4, 2X, F6.2, A1, 3X, 2A4, 2X, 5A4, 11X, I4, 2X,
* 2A4, 2X, F6.2, A1, 3X, 5A4)
909 FORMAT(1H0, 14X, 'END OF OUTPUT...', I4, ' STATIONS LISTED ON THIS
* SUMMARY.')
910 FORMAT(1H0, 14X, 'LIST SORTED BY PRECIPITATION AMOUNT', 22X,
* 'LIST SORTED ALPHABETICALLY BY NAME')
911 FORMAT(1H0, '*** ERROR *** RPPREC ERROR IN GENERAL STATION PARAME
*TER ARRAY. ERROR CODE = ', I4)
912 FORMAT(46X, 'ZERO AMOUNTS ARE NOT INCLUDED IN THE LIST')
913 FORMAT(48X, 'ZERO AMOUNTS ARE INCLUDED IN THE LIST')
914 FORMAT(1X, 'FOR REC. # ', I4, ' OF PARAMETER ARRAY ', A4, ' ... ST
*ATUS CODE = ', I4)
C
INCLUDE 'gcommon/setwhere'
IF(IPTRCE .GE. 3) WRITE(IOPDBG,901)
IGBUG = IPBUG(GENL)
LGENL = 100
C
C.....PRINT OUT THE HEADING.
C
WRITE(IPR,903) NWKDAY, MONTH, NDATE, NYEAR, ICHRS, ICMINS
WRITE(IPR,904) VERNUM, NVMON, NVYR, IHYDAY, IHYMON, IHYDAT, IHYYR
IF(IPREST .EQ. 0) WRITE(IPR,905)
IF(IPREST .EQ. 1) WRITE(IPR,906)
IF(IPRZRO .EQ. 0) WRITE(IPR,912)
IF(IPRZRO .EQ. 1) WRITE(IPR,913)
WRITE(IPR,910)
WRITE(IPR,907)
C
C.....BEFORE PRINTING OUT THE PRECIP LIST...INITIALIZE COUNTER
C.....VARIABLES.
C
IP = 1
NSTA = 0
KP = 1
C
C.....NOW PRINT OUT THE PRECIPITATION LIST.
C
DO 130 NP = 1, NUMST
C
IPART = 1
C
C.....INITIALIZE THE PRINT LINE VARIABLES.
C
CALL GPLVIT(IPGRD1, IPGRD2, RAIN1, RAIN2, IFLAG1, IFLAG2, CLTR1,
* CLTR2, 2, DESC1, DESC2, 5)
C
C.....USE THE SORT POINTERS TO GET THE RECORD NUMBER TO READ FOR THOSE
C.....ENTRIES IN THE LIST SORTED BY PRECIPITATION AMOUNT.
C
20 IF(KP .GT. NUMST) GOTO 80
JP = ISPTR(KP)
NREC = IREC(JP)
JXRAIN = IPCPN(JP)
IF(JXRAIN .GT. 0) GOTO 28
IF(JXRAIN .EQ. 0) GOTO 25
IF(IPREST .EQ. 1) GOTO 28
GOTO 27
C
25 IF(IPRZRO .EQ. 1) GOTO 28
27 KP = KP + 1
GOTO 20
C
28 LP = KP
KP = KP + 1
ISID(1) = IBLNK(1)
ISID(2) = IBLNK(2)
GOTO 30
C
C.....READ THE GENERAL STATION PARAMETRIC ARRAY.
C
30 CALL RPPREC(ISID, GENL, NREC, LGENL, PGENL, NUMGEN, IPTRNX,
* ISTATC)
IF(IGBUG .EQ. 1) WRITE(IOPDBG,914) NREC, GENL, ISTATC
C
IF(ISTATC .EQ. 0) GOTO 32
IF(ISTATC .EQ. 3) GOTO 32
GOTO 40
C
C.....GET THE STATION DESCRIPTION AND ID...AND DUMP OUT THE PARAMETRIC
C.....DATA BEING?SEARCHED FOR IF SUCH IS DESIRED.
C
32 CALL GGENLD(IGBUG, PGENL, CLTR, DESC, KGRID)
C
IF(IPART .EQ. 1) GOTO 50
IF(IPART .EQ. 2) GOTO 90
C
40 CALL PSTRDC(ISTATC, GENL, ISID, NREC, LGENL, NUMGEN)
WRITE(IPR,911) ISTATC
IF(IPART .EQ. 2) GOTO 120
GOTO 80
C
C.....NOW FILL OUT THE LEFT SIDE OF THE PRINT LINE.
C
50 CALL GFPLDT(CLTR, CLTR1, 2, DESC, DESC1, 5, IPCPN(JP),
* RAIN1, IFLAG1, IGRID(JP), IPGRD1)
C
C.....NOW USE THE CURRENT LOOP COUNTER TO RETRIEVE THE ENTRY FOR THE
C.....ALPHABETICALLY SORTED LIST.
C
80 IPART = 2
C
82 IF(IP .GT. NUMST) GOTO 130
NREC = IREC(IP)
KXRAIN = IPCPN(IP)
IF(KXRAIN .GT. 0) GOTO 88
IF(KXRAIN .EQ. 0) GOTO 85
IF(IPREST .EQ. 1) GOTO 88
GOTO 87
C
85 IF(IPRZRO .EQ. 1) GOTO 88
87 IP = IP + 1
GOTO 82
C
88 MP = IP
IP = IP + 1
ISID(1) = IBLNK(1)
ISID(2) = IBLNK(2)
GOTO 30
C
C.....FILL OUT RIGHT HALF OF PRINT LINE.
C
90 CALL GFPLDT(CLTR, CLTR2, 2, DESC, DESC2, 5, IPCPN(MP),
* RAIN2, IFLAG2, IGRID(MP), IPGRD2)
C
C
C.....WRITE OUT THE LINE...AND UPDATE THE COUNT OF STATIONS LISTED.
C
120 WRITE(IPR,908) IPGRD1, RAIN1, IFLAG1, CLTR1, DESC1, IPGRD2,
* CLTR2, RAIN2, IFLAG2, DESC2
C
NSTA = NSTA + 1
C
130 CONTINUE
C
WRITE(IPR,909) NSTA
IF(IPTRCE .GE. 3) WRITE(IOPDBG,902)
C
RETURN
END
|
7 <--SHAPES
7 <--LINES
id1
2 <--TYPE
345 <--LEFT
64 <--TOP
70 <--WIDTH
30 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
START
id2
2 <--TYPE
341 <--LEFT
345 <--TOP
70 <--WIDTH
30 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
STOP
id3
91 <--TYPE
280 <--LEFT
110 <--TOP
196 <--WIDTH
40 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
INPUT
Bir sayż giriniz.
x
id4
92 <--TYPE
324 <--LEFT
187 <--TOP
112 <--WIDTH
50 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
IF_LESS_EQUAL
x
1
id5
91 <--TYPE
300 <--LEFT
274 <--TOP
156 <--WIDTH
40 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
OUTPUT
Sayi asaldir
x
id6
3 <--TYPE
582 <--LEFT
208 <--TOP
10 <--WIDTH
10 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
INTERSECTION
id7
3 <--TYPE
572 <--LEFT
125 <--TOP
10 <--WIDTH
10 <--HEIGHT
16777215 <--BACKCOLOR
0 <--BORDERCOLOR
0 <--BORDERCOLOR
-reserved 1-
-reserved 2-
INTERSECTION
---- LINES ---- from,to ----
id1,id3
reserved 1
id3,id4
reserved 1
id4,id5
reserved 1
EVET
id5,id2
reserved 1
id4,id6
reserved 1
HAYIR
id6,id7
reserved 1
id7,id3
reserved 1
|
! *****************
SUBROUTINE CGSQUA
! *****************
!
&(X,A,B,MESH, G,G0,P,K,H,AHPK,CFG,INFOGR)
!
!***********************************************************************
! BIEF V6P1 21/08/2010
!***********************************************************************
!
!brief SOLVES THE LINEAR SYSTEM A X = B
!+ USING THE SQUARED CONJUGATE GRADIENT METHOD.
!code
!+ ALGORITHM:
!+
!+ |
!+ | INITIALISATION
!+ | ---------------
!+ |
!+ | 0 N
!+ | X VECTOR IN R , APPROXIMATION OF THE SOLUTION
!+ |
!+ | 0 0
!+ | G = A X - B
!+ |
!+ | K0 = P0 = G0
!+ |
!+ |
!+ | ITERATIONS
!+ | ----------
!+ |
!+ | M 0
!+ | M ( K , G )
!+ | RO = ------------
!+ | M 0
!+ | (A P , G )
!+ |
!+ | M M M M
!+ | H = K - RO * A P
!+ |
!+ | M+1 M M M M
!+ | G = G - RO * A ( H + K )
!+ |
!+ | M+1 M M M M
!+ | X = X - RO * ( H + K )
!+ |
!+ | 0 M+1
!+ | ( G , G )
!+ | BETA = ------------
!+ | 0 M
!+ | ( G , G )
!+ |
!+ | M+1 M+1 M M M M
!+ | P = G + 2*BETA * H + BETA**2 * P
!+ |
!+ | M+1 M+1 M M
!+ | K = G + BETA * H
!+ |
!
!code
!+-----------------------------------------------------------------------
!+ PRECONDITIONING
!+ (ALSO SEE SOLV01)
!+-----------------------------------------------------------------------
!+ PRECON VALUE I MEANING
!+-----------------------------------------------------------------------
!+ 0 I NO PRECONDITIONING
!+ 2 I DIAGONAL PRECONDITIONING WITH THE MATRIX
!+ I DIAGONAL
!+ 3 I DIAGONAL PRECONDITIONING WITH THE CONDENSED
!+ I MATRIX
!+ 5 I OTHER
!+-----------------------------------------------------------------------
!code
!+ MEANING OF IELM :
!+
!+ TYPE OF ELEMENT NUMBER OF POINTS CODED IN THIS SUBROUTINE
!+
!+ 11 : P1 TRIANGLE 3 YES
!+ 12 : P2 TRIANGLE 6 YES
!+ 13 : P1-ISO P1 TRIANGLE 6 YES
!+ 14 : P2 TRIANGLE 7
!+ 21 : Q1 QUADRILATERAL 4 YES
!+ 22 : Q2 QUADRILATERAL 8
!+ 24 : Q2 QUADRILATERAL 9
!+ 31 : P1 TETRAHEDRON 4 YES
!+ 32 : P2 TETRAHEDRON 10
!+ 41 : MITHRIDATE PRISMS 6 YES
!
!history J-M HERVOUET (LNH) ; F LEPEINTRE (LNH)
!+ 24/04/97
!+ V5P1
!+
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 13/07/2010
!+ V6P0
!+ Translation of French comments within the FORTRAN sources into
!+ English comments
!
!history N.DURAND (HRW), S.E.BOURBAN (HRW)
!+ 21/08/2010
!+ V6P0
!+ Creation of DOXYGEN tags for automated documentation and
!+ cross-referencing of the FORTRAN sources
!
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!| A |-->| MATRIX OF THE SYSTEM
!| AHPK |<->| WORK STRUCTURE
!| B |-->| RIGHT-HAND SIDE OF SYSTEM
!| CFG |-->| CFG(1): STORAGE OF MATRIX
!| | | CFG(2): MATRIX VECTOR PRODUCT
!| G |<->| GRADIENT.
!| G0 |<->| INITIAL GRADIENT
!| H |<->| WORK STRUCTURE
!| INFOGR |-->| IF YES, INFORMATION PRINTED
!| K |<->| WORK STRUCTURE
!| MESH |-->| MESH STRUCTURE
!| P |<->| WORK STRUCTURE
!| X |<--| INITIAL VALUE, THEN SOLUTION
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
USE BIEF, EX_CGSQUA => CGSQUA
!
USE DECLARATIONS_SPECIAL
IMPLICIT NONE
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
TYPE(BIEF_OBJ) , INTENT(INOUT) :: X,G,G0,P,K,H,AHPK
TYPE(BIEF_OBJ) , INTENT(IN ) :: B
TYPE(BIEF_OBJ) , INTENT(IN) :: A
TYPE(SLVCFG) , INTENT(INOUT) :: CFG
LOGICAL , INTENT(IN) :: INFOGR
TYPE(BIEF_MESH) , INTENT(INOUT) :: MESH
!
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
!
DOUBLE PRECISION XL,RO,TESTL,RL,GMP1G0,BETA,GMG0,C
!
INTEGER M
!
LOGICAL RELAT
!
INTRINSIC SQRT
!
!-----------------------------------------------------------------------
!
! COMPUTES THE NORM OF THE SECOND MEMBER
!
XL = P_DOTS(B,B,MESH)
!
IF(XL.LT.1.D0) THEN
XL = 1.D0
RELAT = .FALSE.
ELSE
RELAT = .TRUE.
ENDIF
!
M = 0
!
! INITIALISES G : A X0 - B
!
CALL MATRBL( 'X=AY ',G,A,X,C, MESH)
!
CALL OS( 'X=X-Y ' , G , B , B , C )
!
! CHECKS THAT THE ACCURACY HAS NOT ALREADY BEEN REACHED
!
RL = P_DOTS(G,G,MESH)
!
IF(RL.LT.CFG%EPS**2*XL) THEN
TESTL = SQRT(RL/XL)
IF (INFOGR) THEN
IF(RELAT) THEN
IF (LNG.EQ.1) WRITE(LU,100) M,TESTL
IF (LNG.EQ.2) WRITE(LU,101) M,TESTL
ELSE
IF (LNG.EQ.1) WRITE(LU,200) M,TESTL
IF (LNG.EQ.2) WRITE(LU,201) M,TESTL
ENDIF
ENDIF
GOTO 1000
ENDIF
!
! INITIALISES G0 , P , AND K
!
CALL OS('X=Y ' , G0 , G , G , C )
CALL OS('X=Y ' , P , G , G , C )
CALL OS('X=Y ' , K , G , G , C )
!
M = 1
20 CONTINUE
!
! COMPUTES AP (IN H, RECOMPUTED LATER)
!
CALL MATRBL( 'X=AY ',H,A,P,C, MESH)
!
! COMPUTES RO
!
RO = P_DOTS(K,G0,MESH) / P_DOTS(H,G0,MESH)
!
! COMPUTES H+K (IN H, AP ALREADY BEING IN H)
!
CALL OS( 'X=CX ' , H , H , H , -RO )
CALL OS( 'X=X+CY ' , H , K , K , 2.D0 )
!
! M+1 M M M
! COMPUTES X = X - RO * (H+K) (H+K IN H)
!
CALL OS( 'X=X+CY ' , X , H , H , -RO )
!
! COMPUTES A(H+K) (HERE H+K IN H, A(H+K) IN AHPK)
!
CALL MATRBL( 'X=AY ',AHPK,A,H,C, MESH)
!
! M 0
! COMPUTES ( G , G )
!
GMG0 = P_DOTS(G,G0,MESH)
!
! COMPUTES GM
!
CALL OS( 'X=X+CY ' , G , AHPK , AHPK , -RO )
!
RL = P_DOTS(G,G,MESH)
IF (RL.GT.CFG%EPS**2*XL) THEN
IF (M.GE.CFG%NITMAX) THEN
TESTL=SQRT(RL/XL)
IF(RELAT) THEN
IF (LNG.EQ.1) WRITE(LU,102) M,TESTL
IF (LNG.EQ.2) WRITE(LU,103) M,TESTL
ELSE
IF (LNG.EQ.1) WRITE(LU,202) M,TESTL
IF (LNG.EQ.2) WRITE(LU,203) M,TESTL
ENDIF
GOTO 1000
ELSE
M = M + 1
ENDIF
ELSE
IF(INFOGR) THEN
TESTL=SQRT(RL/XL)
IF(RELAT) THEN
IF (LNG.EQ.1) WRITE(LU,100) M,TESTL
IF (LNG.EQ.2) WRITE(LU,101) M,TESTL
ELSE
IF (LNG.EQ.1) WRITE(LU,200) M,TESTL
IF (LNG.EQ.2) WRITE(LU,201) M,TESTL
ENDIF
ENDIF
GOTO 1000
ENDIF
!
! M+1 0
! COMPUTES ( G , G )
!
GMP1G0 = P_DOTS(G,G0,MESH)
!
! COMPUTES BETA
!
BETA = GMP1G0 / GMG0
!
! M
! COMPUTES H (H+K IN H)
!
CALL OS('X=X-Y ' , H , K , K , C )
!
! M+1
! COMPUTES P
!
CALL OS('X=CX ' , P , P , P , BETA**2 )
CALL OS('X=X+Y ' , P , G , G , C )
CALL OS('X=X+CY ' , P , H , H , 2*BETA )
!
! M+1
! COMPUTES K
!
CALL OS('X=Y ' , K , G , G , C )
CALL OS('X=X+CY ' , K , H , H , BETA )
!
GOTO 20
!
1000 RETURN
!
!-----------------------------------------------------------------------
!
! FORMATS
!
100 FORMAT(1X,'CGSQUA (BIEF) : ',1I8,' ITERATIONS',
& ' PRECISION RELATIVE: ',G16.7)
101 FORMAT(1X,'CGSQUA (BIEF) : ',1I8,' ITERATIONS',
& ' RELATIVE PRECISION: ',G16.7)
200 FORMAT(1X,'CGSQUA (BIEF) : ',1I8,' ITERATIONS',
& ' PRECISION ABSOLUE: ',G16.7)
201 FORMAT(1X,'CGSQUA (BIEF) : ',1I8,' ITERATIONS',
& ' ABSOLUTE PRECISION: ',G16.7)
102 FORMAT(1X,'CGSQUA (BIEF) : MAX D''ITERATIONS ATTEINT ',1I8,
& ' PRECISION RELATIVE: ',G16.7)
103 FORMAT(1X,'CGSQUA (BIEF) : EXCEEDING MAXIMUM ITERATIONS ',1I8,
& ' RELATIVE PRECISION: ',G16.7)
202 FORMAT(1X,'CGSQUA (BIEF) : MAX D''ITERATIONS ATTEINT ',1I8,
& ' PRECISION ABSOLUE: ',G16.7)
203 FORMAT(1X,'CGSQUA (BIEF) : EXCEEDING MAXIMUM ITERATIONS ',1I8,
& ' ABSOLUTE PRECISION:',G16.7)
!
!-----------------------------------------------------------------------
!
END
|
c This is needed to interface the F77 gprgid routine to C. The
c problem is that progid is character*(*) is cprgid, requiring that
c F77 hidden argument list is required.
subroutine cprgid(progid)
character*40 progid
call gprgid(progid)
return
end
integer function ffrdc(key,val)
character*80 key
character*80 val
integer frdc
ffrdc = frdc(key,val)
return
end
integer function ffrdbo(key,val)
character*80 key
integer val
integer frdboo
ffrdbo = frdboo(key,val)
return
end
integer function ffrdi(key,val)
character*80 key
integer val
integer frdi
ffrdi = frdi(key,val)
return
end
|
subroutine sopgrdtrc
$ ( H, lbuf, scr, lscr, wdens,
$ frc_sow,
$ g_dens, g_wdens, basis, geom, nproc, nat,
$ max_at_bf, oskel,
& frc_sox, frc_soy, frc_soz, densx, densy, densz)
c based on grad1_so in nwdft/sodft -gsk
c keep the parallel stuff. Sure why not?
C spin orbit potential gradient using effective densities from
c columbus
implicit none
#include "mafdecls.fh"
#include "global.fh"
#include "geom.fh"
#include "bas.fh"
#include "rtdb.fh"
#include "sym.fh"
C-------------------------parameters--------------------------------
integer lbuf, lscr,
$ g_dens(3), ! density matrix (summed if ROHF, UHF)
$ g_wdens, ! weighted density (Lagrangian)
$ basis, geom, nproc, nat, max_at_bf
double precision H, ! integral derivatives
$ scr,
$ densx, densy, densz, ! local density block
$ wdens, ! local weighted density block
$ frc_sow, frc_sox, frc_soy, frc_soz ! forces arrays
dimension H ( lbuf ),
$ frc_sow(3, nat), frc_sox(3, nat), frc_soy(3,nat),
$ frc_soz(3,nat), scr(lscr),
$ wdens(max_at_bf,max_at_bf),
$ densx(max_at_bf,max_at_bf), densy(max_at_bf,max_at_bf),
$ densz(max_at_bf,max_at_bf)
logical oskel ! symmetry?
C-------------------------local variables--------------------------
integer ijatom, next, iat1, iat2, iat3, ish1, ish2,
$ iab1f, iab1l, iab2f, iab2l, iac1f, iac1l, iac2f, iac2l,
$ if1, il1, if2, il2,
$ icart, ic, ip1, ip2
integer i, j
double precision crd1, crd2 ! atomic coordinates
dimension crd1(3), crd2(3)
integer idatom
dimension idatom(2)
double precision dE, dx, dy, dz, qfac, fact, q1, q2
logical status, pointforce
character*16 name
integer nxtask, task_size
external nxtask
cgk debug
character*2 deriv(3)
data deriv/'dx','dy','dz'/
cgk end
task_size = 1
status = rtdb_parallel(.true.) ! Broadcast reads to all processes
pointforce = geom_include_bqbq(geom)
call hf_print_set(1)
do j=1, nat
do i=1,3
frc_sox(i,j)=0d0
frc_soy(i,j)=0d0
frc_soz(i,j)=0d0
frc_sow(i,j)=0d0
enddo
enddo
cgk debug
* write(*,*)'gk: printing so blocks'
cgk end
ijatom = -1
next = nxtask(nproc,task_size)
do iat1=1, nat
do iat2 = 1, nat
ijatom = ijatom + 1
if ( ijatom .eq. next ) then
status = bas_ce2bfr(basis,iat1,iab1f,iab1l)
status = bas_ce2bfr(basis,iat2,iab2f,iab2l)
if (iab1f.le.0 .or. iab2f.le.0) goto 999
status = bas_ce2cnr(basis,iat1,iac1f,iac1l)
status = bas_ce2cnr(basis,iat2,iac2f,iac2l)
call ga_get (g_dens(1),
& iab1f,iab1l,iab2f,iab2l,densx,max_at_bf)
call ga_get (g_dens(2),
& iab1f,iab1l,iab2f,iab2l,densy,max_at_bf)
call ga_get (g_dens(3),
& iab1f,iab1l,iab2f,iab2l,densz,max_at_bf)
do ish1 = iac1f, iac1l
do ish2 = iac2f, iac2l
status = bas_cn2bfr(basis,ish1,if1,il1)
status = bas_cn2bfr(basis,ish2,if2,il2)
cgk debug
* write(*,'(a,2i4)')'gk: int block for shells, ', ish1, ish2
cgk end
call intd_1eso(basis,ish1,basis,ish2,lscr,scr,
& lbuf,H)
do iat3 = 1, nat
do icart = 1, 3
* call print_soblock(H,if1,il1,if2,il2,iat3,icart,1,
* & nat)
call trc_soblock(H,if1,il1,if2,il2,iat3,icart,1,
& nat,iab1f,iab2f,max_at_bf,frc_soz,densz)
* call print_soblock(H,if1,il1,if2,il2,iat3,icart,2,
* & nat)
call trc_soblock(H,if1,il1,if2,il2,iat3,icart,2,
& nat,iab1f,iab2f,max_at_bf,frc_soy,densy)
* call print_soblock(H,if1,il1,if2,il2,iat3,icart,3,
* & nat)
call trc_soblock(H,if1,il1,if2,il2,iat3,icart,3,
& nat,iab1f,iab2f,max_at_bf,frc_sox,densx)
enddo
enddo
enddo
enddo
999 continue
next = nxtask(nproc,task_size)
endif
enddo
enddo
* write(*,'("forces sow",9e13.5)')((frc_sow(i,j),i=1,3),j=1,nat)
* write(*,'("forces sox",9e13.5)')((frc_sox(i,j),i=1,3),j=1,nat)
* write(*,'("forces soy",9e13.5)')((frc_soy(i,j),i=1,3),j=1,nat)
* write(*,'("forces soz",9e13.5)')((frc_soz(i,j),i=1,3),j=1,nat)
next = nxtask(-nproc, task_size)
do j=1, nat
do i=1,3
* frc_sox(i,j)=0d0
* frc_soy(i,j)=0d0
* frc_soz(i,j)=0d0
frc_sow(i,j)=0d0
enddo
enddo
ijatom = -1
next = nxtask(nproc,task_size)
do 90, iat1 = 1, nat
do 80, iat2 = 1, iat1
ijatom = ijatom + 1
if ( ijatom .eq. next ) then
status = bas_ce2bfr(basis,iat1,iab1f,iab1l)
status = bas_ce2bfr(basis,iat2,iab2f,iab2l)
if (iab1f.le.0 .or. iab2f.le.0) then
c
c At least one center has no functions on it ... next atom
c
goto 1010
endif
if (oskel) then
if (.not. sym_atom_pair(geom, iat1, iat2, qfac))
$ goto 1010
else
qfac = 1.0d0
endif
status = bas_ce2cnr(basis,iat1,iac1f,iac1l)
status = bas_ce2cnr(basis,iat2,iac2f,iac2l)
call ga_get(g_wdens,
& iab1f,iab1l,iab2f,iab2l,wdens,max_at_bf)
* call ga_get (g_dens(1),
* & iab1f,iab1l,iab2f,iab2l,densx,max_at_bf)
* call ga_get (g_dens(2),
* & iab1f,iab1l,iab2f,iab2l,densy,max_at_bf)
* call ga_get (g_dens(3),
* & iab1f,iab1l,iab2f,iab2l,densz,max_at_bf)
do 70, ish1 = iac1f, iac1l
if ( iat1.eq.iat2 ) iac2l = ish1
do 60, ish2 = iac2f, iac2l
C shell block in atomic (D/Dw)-matrix block
status = bas_cn2bfr(basis,ish1,if1,il1)
if1 = if1 - iab1f + 1
il1 = il1 - iab1f + 1
status = bas_cn2bfr(basis,ish2,if2,il2)
if2 = if2 - iab2f + 1
il2 = il2 - iab2f + 1
C overlap derivatives
call intd_1eov(basis,ish1,basis,ish2,lscr,scr,
& lbuf,H,idatom)
C Dsow x S
if ( idatom(1) .ge. 1 ) then
C idatom(1).ge.0 <=> idatom(2).ge.0 (no check necessary)
ic = 1
do 28, icart = 1, 3
de = 0.D0
do 22, ip1 = if1, il1
do 20, ip2 = if2, il2
dE = dE + wdens(ip1,ip2) * H(ic)
ic = ic + 1
20 continue
22 continue
dE = dE * qfac
frc_sow(icart,idatom(1)) = frc_sow(icart,idatom(1))
$ - dE - dE
frc_sow(icart,idatom(2)) = frc_sow(icart,idatom(2))
$ + dE + dE
28 continue
endif
C 1el. so. derivatives
* call intd_1eso(basis,ish1,basis,ish2,lscr,scr,
* & lbuf,H)
C Dso x Hso
* ic=1
* do 150, iat3 = 1, nat
* do 140, icart = 1, 3
c z componet
cgk debug
* write(*,*)'gk: z so trace'
* write(*,2010)'deriv: ',iat3,deriv(icart)
2010 format(a,i1,x,a2)
cgk end
* dE = 0.D0
* do 131, ip1 = if1, il1
* do 128, ip2 = if2, il2
cgk debug
* write(*,2000)'i=',ip1+iab1f-1,' j=',ip2+iab2f-1,' den=',
* & densz(ip1,ip2),' gint=',H(ic)
2000 format(a,i3,a,i3,a,f20.10,a,f20.10)
cgk end
* dE = dE + densz(ip1,ip2)*H(ic)
* ic = ic + 1
*128 continue
*131 continue
* if ( iat1.ne.iat2 .or. ish1.ne.ish2 ) dE = dE + dE
* dE = dE * qfac
* frc_soz(icart,iat3) = frc_soz(icart,iat3) + dE
c y componet
cgk debug
* write(*,*)'gk: y so trace'
* write(*,2010)'deriv: ',iat3,deriv(icart)
cgk end
* dE = 0.D0
* do 230, ip1 = if1, il1
* do 231, ip2 = if2, il2
cgk debug
* write(*,2000)'i=',ip1+iab1f-1,' j=',ip2+iab2f-1,' den=',
* & densz(ip1,ip2),' gint=',H(ic)
cgk end
* dE = dE + densy(ip1,ip2)*H(ic)
* ic = ic + 1
*231 continue
*230 continue
* if ( iat1.ne.iat2 .or. ish1.ne.ish2 ) dE = dE + dE
* dE = dE * qfac
* frc_soy(icart,iat3) = frc_soy(icart,iat3) + dE
c x component
cgk debug
* write(*,*)'gk: x so trace'
* write(*,2010)'deriv: ',iat3,deriv(icart)
cgk end
* dE = 0.D0
* do 250, ip1 = if1, il1
* do 251, ip2 = if2, il2
cgk debug
* write(*,2000)'i=',ip1+iab1f-1,' j=',ip2+iab2f-1,' den=',
* & densz(ip1,ip2),' gint=',H(ic)
cgk end
* dE = dE + densx(ip1,ip2)*H(ic)
* ic = ic + 1
*251 continue
*250 continue
* if ( iat1.ne.iat2 .or. ish1.ne.ish2 ) dE = dE + dE
* dE = dE * qfac
* frc_sox(icart,iat3) = frc_sox(icart,iat3) + dE
*140 continue
*150 continue
60 continue
70 continue
1010 continue
next = nxtask(nproc,task_size)
endif
80 continue
90 continue
next = nxtask(-nproc,task_size)
write(*,'("forces sow",9e13.5)')((frc_sow(i,j),i=1,3),j=1,nat)
write(*,'("forces sox",9e13.5)')((frc_sox(i,j),i=1,3),j=1,nat)
write(*,'("forces soy",9e13.5)')((frc_soy(i,j),i=1,3),j=1,nat)
write(*,'("forces soz",9e13.5)')((frc_soz(i,j),i=1,3),j=1,nat)
return
end
|
SUBROUTINE FREEZE(IPAIR)
*
*
* Partial reflection of KS binary.
* --------------------------------
*
INCLUDE 'common6.h'
SAVE NKSREF
DATA NKSREF /0/
*
*
* Set c.m. & component indices and form semi-major axis.
ICM = N + IPAIR
I2 = 2*IPAIR
I1 = I2 - 1
SEMI = -0.5D0*BODY(ICM)/H(IPAIR)
*
* Define auxiliary quantities and obtain the eccentricity.
ZETA = 1.0 - R(IPAIR)/SEMI
PSI = TDOT2(IPAIR)/SQRT(BODY(ICM))
ECC = SQRT(ZETA**2 + PSI**2/SEMI)
*
* Skip reflection of hyperbolic orbit (just in case).
IF (ECC.GE.1.0) GO TO 100
*
* Determine the eccentric anomaly with respect to pericentre (0,PI).
THETA = ATAN2(ABS(PSI)/SQRT(SEMI),ZETA)
*
* Obtain total reflection time from Kepler's equation.
DT = 2.0D0*SEMI*SQRT(SEMI/BODY(ICM))*(THETA - ABS(PSI)/SQRT(SEMI))
*
* Specify regularized time (based on Baumgarte & Stielel, 1974).
DTU = -2.0D0*(H(IPAIR)*DT + TDOT2(IPAIR))/BODY(ICM)
*
* Skip reflection near pericentre.
IF (DTU.LT.4.0*DTAU(IPAIR)) GO TO 100
*
* Predict c.m. coordinates and resolve unreflected KS components.
CALL XVPRED(ICM,0)
*
* Specify transformation coefficients (Mikkola's proceure).
XC = ZETA/ECC
YS = 2.0D0*PSI/(ECC*SQRT(BODY(ICM)))
ZZ = BODY(ICM)/(4.0*SEMI)
R(IPAIR) = 0.0D0
*
* Generate analytical solutions for U & UDOT using old U & UDOT.
DO 10 K = 1,4
U(K,IPAIR) = U0(K,IPAIR)*XC - UDOT(K,IPAIR)*YS
UDOT(K,IPAIR) = U0(K,IPAIR)*YS*ZZ + UDOT(K,IPAIR)*XC
U0(K,IPAIR) = U(K,IPAIR)
R(IPAIR) = R(IPAIR) + U(K,IPAIR)**2
* Consistent R = U*U for stabilization procedure.
10 CONTINUE
*
* Copy significant perturbers for tidal correction (R-dependent).
CORR = 2.0 + 2.0*(SEMI - R(IPAIR))/(SEMI*(1.0 + ECC))
RCRIT2 = CMSEP2*(CORR*R(IPAIR))**2
NNB1 = LIST(1,I1) + 1
NP = 0
DO 20 L = 2,NNB1
J = LIST(L,I1)
RIJ2 = (X(1,ICM) - X(1,J))**2 + (X(2,ICM) - X(2,J))**2 +
& (X(3,ICM) - X(3,J))**2
IF (RIJ2.LT.RCRIT2) THEN
NP = NP + 1
JPERT(NP) = J
END IF
20 CONTINUE
*
* Ensure that at least one perturber is retained.
IF (NP.EQ.0) THEN
NP = 1
JPERT(NP) = LIST(2,I1)
END IF
*
* Reverse second time derivative and specify unperturbed motion.
TDOT2(IPAIR) = -TDOT2(IPAIR)
LIST(1,I1) = 0
*
* Set new step in physical units and increase counter.
STEP(I1) = DT
NKSREF = NKSREF + 1
*
* Check minimum two-body distance.
DMIN2 = MIN(DMIN2,SEMI*(1.0D0 - ECC))
*
* Obtain potential energy with respect to the components.
JLIST(1) = I1
JLIST(2) = I2
CALL NBPOT(2,NP,POT1)
*
* Transform to reflected coordinates and repeat the summation.
CALL KSRES(IPAIR,J1,J2,RIJ2)
CALL NBPOT(2,NP,POT2)
*
* Form correction factor due to the tidal potential.
VI2 = X0DOT(1,ICM)**2 + X0DOT(2,ICM)**2 + X0DOT(3,ICM)**2
CORR = 1.0 + 2.0*(POT2 - POT1)/(BODY(ICM)*VI2)
ETCORR = ETCORR + (POT2 - POT1)
IF (CORR.GT.0.0D0) THEN
CORR = SQRT(CORR)
ELSE
CORR = 0.0D0
END IF
*
* Modify the c.m. velocity.
DO 30 K = 1,3
X0DOT(K,ICM) = CORR*X0DOT(K,ICM)
30 CONTINUE
*
100 RETURN
*
END
|
C MODULE SURCDS
C-----------------------------------------------------------------------
C
C ROUTINE TO READ INPUT CARDS, CHECK FOR @INCLUDE AND WRITE TO FILE.
C
SUBROUTINE SURCDS (ISTAT)
C
CHARACTER*8 DDN,TYPMSG
CHARACTER*8 XFT/'FTXXF001'/
CHARACTER*8 SEQNUM/' '/
CHARACTER*8 XINCL/'@INCLUDE'/
CHARACTER*11 XNINCL/'@NOINCLUDES'/
CHARACTER*80 RECOLD,RECNEW
C
INCLUDE 'uiox'
INCLUDE 'udsatx'
INCLUDE 'scommon/sudbgx'
INCLUDE 'ufreex'
INCLUDE 'scommon/suoptx'
INCLUDE 'scommon/suerrx'
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/ppinit_util/RCS/surcds.f,v $
. $', '
.$Id: surcds.f,v 1.5 1999/07/07 11:20:47 page Exp $
. $' /
C ===================================================================
C
C
IF (ISTRCE.GT.0) THEN
WRITE (IOSDBG,110)
CALL SULINE (IOSDBG,1)
ENDIF
C
C SET DEBUG LEVEL
LDEBUG=ISBUG('SYS ')
C
ISTAT=0
C
ICKINC=1
C
IUCLOG=LP
C
C CHECK IF TEMPORARY FILE ALLOCATED
DDN=XFT
CALL UFXDDN (DDN,ICDTMP,IERR)
IF (IERR.EQ.0) GO TO 10
WRITE (LP,140) IERR
CALL SULINE (LP,1)
GO TO 20
10 IPRERR=0
CALL UDDST (DDN,IPRERR,IERR)
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*) 'DDN=',DDN,
* ' IERR=',IERR,
* ' IPRERR=',IPRERR
CALL SULINE (IOSDBG,1)
ENDIF
IF (IERR.EQ.0) GO TO 30
20 ISTAT=1
WRITE (LP,150) DDN
CALL SUWRNS (LP,2,-1)
GO TO 100
C
30 REWIND ICDTMP
C
C READ RECORD
40 READ (ICD,120,END=90) RECOLD
C
C CHECK FOR COMMENT FIELD
CALL UINDEX (RECOLD,LEN(RECOLD),'$',1,ICOLCM)
C
C CHECK FOR @INCLUDE COMMAND
CALL UINDEX (RECOLD,LEN(RECOLD),XINCL,LEN(XINCL),ICOLIN)
IF (ICOLIN.GT.0) THEN
IF (ICOLCM.EQ.0) GO TO 60
IF (ICOLCM.GT.ICOLIN) GO TO 60
GO TO 50
ENDIF
C
C CHECK FOR @NOINCLUDE COMMAND
CALL UINDEX (RECOLD,LEN(RECOLD),XNINCL,LEN(XNINCL),ICOLIN)
IF (ICOLIN.GT.0) THEN
IF (ICOLCM.EQ.0) ICKINC=0
IF (ICOLCM.GT.ICOLIN) ICKINC=0
GO TO 40
ENDIF
C
C WRITE TO TEMPORARY FILE
50 WRITE (ICDTMP,120) RECOLD
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*)
* ' ICDTMP=',ICDTMP,
* ' RECOLD=',RECOLD(1:LENSTR(RECOLD)),
* ' '
CALL SULINE (IOSDBG,1)
ENDIF
GO TO 40
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
60 IF (ICKINC.EQ.0) GO TO 40
C
C EXPAND INCLUDE
C
NSTLVL=0
C
C CHECK FOR 'INCLUDE' STATEMENT
70 ICKCOL=0
IPRERR=1
TYPMSG='ERROR'
CALL UINCLD (XINCL,RECOLD,ICKCOL,NSTLVL,RECNEW,LRECNEW,
* IPRERR,TYPMSG,LP,IERR)
IF (IERR.GT.0) GO TO 80
C
C CHECK IF END OF INPUT FROM 'INCLUDE' STATEMENT
IF (NSTLVL.EQ.-1) GO TO 80
C
IF (LDEBUG.GT.0) THEN
CALL ULINE (IOSDBG,1)
WRITE (IOSDBG,*)
* ' NSTLVL=',NSTLVL,
* ' RECNEW=',RECNEW,
* ' '
ENDIF
C
C CHECK IF ANY 'INCLUDE' STATEMENTS FOUND
IF (NSTLVL.GT.0) THEN
WRITE (ICDTMP,120) RECNEW
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*)
* ' ICDTMP=',ICDTMP,
* ' RECNEW=',RECNEW(1:LENSTR(RECNEW)),
* ' '
CALL SULINE (IOSDBG,1)
ENDIF
RECOLD=RECNEW
GO TO 70
ENDIF
C
80 IF (IOPCLG(1).EQ.1) THEN
WRITE (IUCLOG,130) XINCL,SEQNUM,ICMCDE
CALL SULINE (IUCLOG,1)
ENDIF
C
GO TO 40
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C RESET UNIT FROM WHICH RECORDS WILL BE READ
90 ICD=ICDTMP
REWIND ICD
C
100 IF (ISTRCE.GT.0) THEN
WRITE (IOSDBG,160)
CALL SULINE (IOSDBG,1)
ENDIF
C
RETURN
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
110 FORMAT (' *** ENTER SURCDS')
120 FORMAT (A80)
130 FORMAT (' COMMAND ',A,' FOUND AT INPUT LINE ',A,' EXECUTED. ',
* 'CONDITION CODE = ',I2)
140 FORMAT (' UFXDDN STATUS CODE=',I3)
150 FORMAT ('0*** WARNING - TEMPORARY FILE FOR INPUT CARD ',
* 'IS NOT ALLOCATED. DDNAME ',A,' IS MISSING. INCLUDES WILL ',
* 'NOT BE EXPANDED.')
160 FORMAT (' *** EXIT SURCDS')
C
END
|
IMPLICIT REAL (A-H,O-Z)
c This is set up to read in the coefficients from Slingo's paper
c and run the 2 stream with inputs effective radius and LWC.
c ***********************************
c DELTA EDDINGTON METHOD.
c ***********************************
c ***********************************
c The signs convention in this program
c is according to:
c Shettle and Weinman,
c J.A.S. Oct. 1970 pg1048
c It differs from Liou in the sign.
c The origin of the sign error is
c in the integration limits.
c i.e.
c Upward Flux=
c =pie*[Io(t)-.6666*I1(t)]
c Downward Flux=
c =pie*[Io(t)+.6666*I1(t)]
c Be careful.
c ***********************************
c ***********************************
OPEN(25,file='rtoutput',access='append')
a1=0.03094
a2=1.252
a3=0.000000790
a4=0.000000369
a5=0.844
a6=0.001558
print *, 'Enter the size from 5 to 50'
read *, REF
print *, 'Enter the angle 0.1 to 1'
read *, auo
aLWC=0.3
az=100.
akext2=aLWC*(a1+(a2/REF))
aw=1.00000-a3-a4*REF
ag=a5+a6*REF
at=akext2*az
agp=ag/(1.+ag)
awp=((1.-ag*ag)*aw)/(1.-aw*ag*ag)
atp=(1.-aw*ag*ag)*at
ak=(3.*(1.-awp)*(1.-awp*agp))**.5
aksqd=(3.*(1.-awp)*(1.-awp*agp))
ap=((3.*(1.-awp))/(1.-awp*agp))**.5
apsqd=((3.*(1.-awp))/(1.-awp*agp))
alp=(3.*awp*auo*(1.+agp*(1.-awp)))/(4.*(1.-aksqd*auo*auo))
bta=(3.*awp*(1.+3.*agp*auo*auo*(1.-awp)))/(4.*(1.-aksqd*auo*auo))
acon=2./3.
b1=1.+acon*ap
b2=1.-acon*ap
b3=alp+acon*bta
b4=alp-acon*bta
b5=exp(-1.*ak*atp)
b6=exp(ak*atp)
b7=exp((-1.*atp)/auo)
c2=(b1*b4*b7-b2*b3*b5)/(b1*b1*b6-b2*b2*b5)
c1=(b1*b3*b6-b2*b4*b7)/(b1*b1*b6-b2*b2*b5)
reflection=b2*c1+b1*c2-b4
transmission=b1*b5*c1+b2*b6*c2+(1.-b3)*b7
absorption=1.-reflection-transmission
c write(25,484) reflection,transmission,absorption,aLWC,REF,auo
write(25,*) REF,auo,reflection,transmission
c 484 format(3(1x,f8.6),1x,f6.2,1x,2(1x,f5.2))
stop
END
|
HANSARD REVISE * NUMERO 240
Le mardi 8 juin 1999
REPONSE DU GOUVERNEMENT A DES PETITIONS
COMITES DE LA CHAMBRE
LOI DE MISE EN OEUVRE DE L'ACCORD SUR LA
Presentation et premiere lecture
M. Svend J. Robinson
M. Svend J. Robinson
La prestation fiscale nationale pour enfants
M. Svend J. Robinson
M. Svend J. Robinson
Mme Karen Kraft Sloan
RELAIS POUR UN AMI
M. Jake E. Hoeppner
M. Gurbax Singh Malhi
LA JOURNEE COMMUNAUTAIRE ANNUELLE DE NETTOYAGE DANS PARKDALE
L'EXPLOITATION SEXUELLE DES ENFANTS
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
Le tres hon. Jean Chretien
L'hon. David M. Collenette
L'hon. Pierre S. Pettigrew
L'hon. Pierre S. Pettigrew
L'hon. Arthur C. Eggleton
L'hon. Arthur C. Eggleton
L'hon. David M. Collenette
Le tres hon. Jean Chretien
Mme Judy Wasylycia-Leis
L'hon. Arthur C. Eggleton
LA STRATEGIE NATIONALE DE SANTE EN MILIEU RURAL
L'hon. David M. Collenette
L'AVENIR POLITIQUE DU QUEBEC
M. Svend J. Robinson
L'hon. Arthur C. Eggleton
Le Sous-comite sur l'equite salariale pour les familles
LE DECES DE M. HUGH HANRAHAN
COMITES DE LA CHAMBRE
Environnement et developpement durable
BUDGET PRINCIPAL DES DEPENSES, 1999-2000
Approbation du credit no 1-Parlement
M. Jean-Paul Marchand
LE BUDGET PRINCIPAL DES DEPENSES, 1999-2000
Adoption du credit no 1-Parlement
Le projet de loi de credits-Decision de la Presidence
Jour designe-Le traite conclu avec les Nisga'as
Adoption de la motion modifiee
LE BUDGET PRINCIPAL DES DEPENSES POUR 1999-2000
Adoption du credit No 1-Parlement
Adoption de la motion no 1
Adoption du credit no 90-Patrimoine canadien
Adoption de la motion no 2
Adoption du credit no 1-Travaux publics et Services
Adoption de la motion no 3
Adoption du credit no 5-Travaux publics et Services
Adoption du credit no 10-Travaux publics et Services
Adoption du credit no 15-Travaux publics et Services
Adoption du credit no 25-Travaux publics et Services
Adoption du credit no 30-Travaux publics et Services
Adoption des motions nos 4, 5, 6, 7 et 8
HANSARD REVISE * NUMERO 240
Le mardi 8 juin 1999
La seance est ouverte a 10 heures.
REPONSE DU GOUVERNEMENT A DES PETITIONS
COMITES DE LA CHAMBRE
Mme Susan Whelan (Essex, Lib.):
LOI DE MISE EN OEUVRE DE L'ACCORD SUR LA STATION SPATIALE INTERNATIONALE CIVILE
M. Werner Schmidt (Kelowna, Ref.):
C'est une petition merveilleuse et je l'appuie a fond.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
Monsieur le President, j'ai deux petitions a presenter ce matin.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
M. Raymond Lavigne (Verdun-Saint-Henri, Lib.):
M. Randy White (Langley-Abbotsford, Ref.):
M. Clifford Lincoln (Lac-Saint-Louis, Lib.):
Monsieur le President, j'ai deux petitions a presenter.
M. Clifford Lincoln (Lac-Saint-Louis, Lib.):
M. Deepak Obhrai (Calgary-Est, Ref.):
Le president suppleant (M. McClelland):
Le depute de Peterborough a la parole.
LA PRESTATION FISCALE NATIONALE POUR ENFANTS
M. Peter Adams (Peterborough, Lib.):
M. Grant Hill (Macleod, Ref.):
M. Paul Szabo (Mississauga-Sud, Lib.):
M. Keith Martin (Esquimalt-Juan de Fuca, Ref.):
M. Grant McNally (Dewdney-Alouette, Ref.):
Monsieur le President, j'ai deux petitions concernant le meme sujet.
M. Garry Breitkreuz (Yorkton-Melville, Ref.):
Monsieur le President, j'ai ici un grand nombre de petitions a presenter.
Plus de 30 000 noms viennent s'ajouter aux plus de 100 000 deja presentes.
M. Jack Ramsay (Crowfoot, Ref.):
M. Garry Breitkreuz (Yorkton-Melville, Ref.):
Mme Bev Desjarlais (Churchill, NPD):
Question no 240- M. John Cummins:
M. Bob Wood (secretaire parlementaire du ministre des Anciens combattants, Lib.):
Monsieur le President, je suggere que les autres questions soient reservees.
Le president suppleant (M. McClelland):
Monsieur le President, j'invoque le Reglement.
Le president suppleant (M. McClelland):
Sauf votre respect, il ne s'agit pas d'un rappel au Reglement.
Sauf votre respect, c'en est un.
Le president suppleant (M. McClelland):
Sauf votre respect, ce n'est pas un rappel au Reglement.
Le president suppleant (M. McClelland):
La Chambre donne-t-elle son consentement unanime?
Le president suppleant (M. McClelland):
La question est reglee.
Le president suppleant (M. McClelland):
J'aimerais aussi signaler quelques manchettes recentes.
On a pu en lire beaucoup d'autres dernierement, un peu partout au Canada.
Les Canadiens reagissent-ils trop vivement ou ont-ils raison de s'inquieter?
Les tribunaux et le gouvernement liberal disent aux Canadiens qu'ils se trompent.
De nombreux Canadiens sont preoccupes par cette tendance.
Il y a deux exemples de jugements recents a ce sujet.
Les Canadiens observent cette tendance avec preoccupation.
Aujourd'hui, nous avons l'occasion d'interesser de nouveau les Canadiens au processus.
Commencons des aujourd'hui avec cette motion.
Passons a la deuxieme partie de la motion, selon laquelle:
Le Parti reformiste reclame depuis longtemps un plus grand niveau de responsabilite face au public.
Dans la cause Corbett c. Corbett, la cour a statue:
Le mariage fournit une saine base biologique a la procreation.
Tous les autres types de rapports sont techniquement incomplets.
On copie beaucoup plus facilement qu'on apprend.
Le meme principe s'applique egalement aux jeunes filles.
Pourquoi attendre que cela se produise?
Pourquoi continuer de laisser les tribunaux decider?
Utiliserions-nous la disposition de derogation pour defendre la definition actuelle du mariage?
Les liberaux semblent dire qu'ils n'y auront jamais recours.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
Le depute de Calgary-Centre souleve un certain nombre de questions.
Il parle d'engagement amoureux permanent.
Le depute dit qu'il y aura un jour une contestation judiciaire.
Monsieur le President, je sais gre au depute de sa question.
La motion d'aujourd'hui n'est dirigee contre personne.
Mme Libby Davies (Vancouver-Est, NPD):
S'ils reconnaissent le principe de l'egalite, de quelle autorite se reclament-ils?
Elle presume que j'ai dit que les couples maries sans enfant sont techniquement incomplets.
Ce n'est pas du tout ce que j'ai dit.
C'est une bien triste note a inscrire au dossier de son parti.
M. Gurmant Grewal (Surrey-Centre, Ref.):
Le mariage devrait etre reconnu.
Il est legitime pour le Parlement de fixer une orientation pour les grands enjeux sociaux.
Les tribunaux indiquent souvent qu'ils souhaitent obtenir l'avis du Parlement sur differents points.
Cette motion donne au Parlement l'occasion d'exprimer clairement sa volonte a ce sujet.
On ne doit pas faire taire les gens.
Ce sont eux que nous representons ici.
On devrait ecouter ces gens lorsqu'ils envoient des petitions a la Chambre.
Ils sont confiants que le gouvernement federal appuie cette definition.
La demographie du Canada a beaucoup evolue depuis la Confederation.
Les gens qui immigrent au Canada viennent desormais principalement d'Asie.
Je lui ai demande s'il aimerait avoir des enfants.
Il n'etait pas important d'avoir des enfants.
Il m'a remercie de lui avoir fait prendre conscience de cela.
Le projet de loi etendait aussi la liste des prestataires possibles.
Le projet de loi maintient cette disposition, ce qui est une bonne chose.
Il etend aussi les prestations dans une nouvelle direction.
Je voudrais proposer un amendement a la motion principale.
Le president suppleant (M. McClelland):
Le depute de Surrey-Centre invoque le Reglement.
Monsieur le President, je voudrais retirer cette proposition d'amendement et la remplacer.
M. Svend J. Robinson:
Monsieur le President, j'invoque le Reglement.
N'est-ce pas exact?
Le president suppleant (M. McClelland):
La Chambre etait saisie du premier amendement.
Le depute de Surrey-Centre a propose l'amendement au cours du debat.
C'est ce que nous ferons des maintenant.
M. Svend J. Robinson:
Monsieur le President, j'invoque le Reglement.
Il s'est ensuite assis et avait termine son intervention dans le cadre du debat.
Le president suppleant (M. McClelland):
Le depute de Burnaby-Douglas fait valoir un argument interessant.
Je vais consulter le greffier, et nous allons tirer les choses au clair.
Monsieur le President, j'invoque le Reglement.
Le president suppleant (M. McClelland):
Le depute de Burnaby-Douglas a tout a fait raison.
Nous allons maintenant examiner le premier amendement.
Je veux toutefois que tout soit clair.
Puis-je avoir des eclaircissements a cet egard?
Le president suppleant (M. McClelland):
Non, c'est inexact.
Elle va donc etre corrigee.
Il vaut mieux qu'elle le soit maintenant qu'a 10 heures ce soir.
Monsieur le President, de quel amendement s'agit-il?
Je n'en suis pas sur, pourriez-vous me le preciser?
Le president suppleant (M. McClelland):
Je pourrais lui retourner le premier amendement.
Je recapitule, pour le moment, le presidence n'a aucun amendement.
Monsieur le President, permettez-moi de rappeler les faits.
Mon collegue de Surrey-Centre etait en train de presenter un amendement.
Il n'existe pas d'autre amendement.
Le president suppleant (M. McClelland):
Nous allons verifier les bleus et nous prendrons le temps qu'il faudra.
La procedure normale veut qu'un amendement soit signe et presente a la presidence.
La motion n'est pas amendee.
Aucun amendement n'a ete remis a la presidence.
Monsieur le President, j'ai signe un amendement.
L'amendement a ete remis a la Presidence.
Le president suppleant (M. McClelland):
Le depute de Surrey-Centre dit qu'il a signe un amendement.
Apparemment l'amendement qu'il a signe a ete donne a la presidence.
Mme Bev Desjarlais (Churchill, NPD):
Monsieur le President, cela pourrait etre une question, mais aussi plutot un commentaire.
Je reconnais moi-meme la valeur du mariage.
Ce n'est certainement pas uniquement en raison de la definition du terme mariage.
Monsieur le President, je remercie la deputee de sa question.
Que signifie le terme famille?
Comment les familles naissent-elles?
C'est de la definition du mariage dont nous parlons ici aujourd'hui.
C'est l'une des raisons pour lesquelles je me suis installe au Canada.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
Il a dit que ces familles etaient en quelque sorte deficientes.
Monsieur le President, nous sommes en train de debattre de la definition du mariage.
De ce cote-ci de la Chambre, nous ne sommes contre personne et contre rien.
C'est la seule chose dont nous debattons aujourd'hui.
Mme Libby Davies (Vancouver-Est, NPD):
Monsieur le President, le depute a parle des immigrants venant au Canada.
Je suis ici pour representer mes electeurs.
L'hon. Anne McLellan (ministre de la Justice et procureur general du Canada, Lib.):
Comme il est dit dans la motion, le terme mariage est clairement defini en droit.
Les tribunaux ont confirme la constitutionnalite de cette definition.
Dans une decision majoritaire, la cour a statue ce qui suit:
Je ne pense pas que la Charte ait ce pouvoir.
Aucun pays du monde n'a legalise le mariage entre des personnes de meme sexe.
La majorite des jeunes prevoient encore se marier.
A ce point-ci, je voudrais proposer un amendement a la motion.
Monsieur le President, j'invoque le Reglement.
Le president suppleant (M. McClelland):
L'amendement est recevable et accepte.
Le debat porte sur l'amendement.
M. Gary Lunn (Saanich-Gulf Islands, Ref.):
Monsieur le President, je remercie la ministre de la Justice d'appuyer la motion.
Elle a pose quelques questions au cours de son intervention.
Je me suis endormi en songeant a cette question la nuit derniere.
Parfois, les choses s'enchainent tout naturellement.
La ministre de la Justice et moi reconnaissons que cela se produit invariablement.
Elle figure egalement dans le droit civil du Canada.
Si une clarification semble s'imposer, elle le sera.
Le president suppleant (M. McClelland):
Je peux toutefois le faire maintenant.
M. Peter Mancini (Sydney-Victoria, NPD):
Selon le professeur Hogg:
Nous, le gouvernement, avons l'autorite en matiere de mariage et de divorce.
Les provinces ont l'autorite en matiere de celebration.
C'est pour cela que j'ai presente l'amendement.
Nous ne nous arrogeons pas une autorite que nous n'avons pas.
Manifestement, nous ne pourrions pas le faire.
M. Michel Bellehumeur (Berthier-Montcalm, BQ):
Mais la tournure que prend le debat m'agace un peu.
J'ai l'impression que les reformistes veulent opposer deux concepts.
On semble vouloir faire un detournement de la discussion.
Les deputes pourront voter selon leur conscience sur ce sujet.
C'est tres important, compte tenu de ce que cette notion peut sous-entendre.
Je comprends qu'une decision semblable puisse enerver quelques reformistes.
Ils n'ont pas reinvente la roue.
Je pense qu'il y a eu une evolution.
Au Quebec, je pense qu'on est des chefs de file.
On voit qu'une evolution se fait.
On reflechit tranquillement sur cette question.
Je pense qu'il est trop tot.
Ils se demandent ou vont s'arreter leurs demandes.
Il est egalement legitime de se questionner la-dessus.
Il y a le mariage, il y a l'union, il y a les couples.
Il y a une evolution dans la definition du mot mariage dans un dictionnaire.
C'est donc dire que cette definition evolue.
Cela m'amene a l'autre point dont je veux parler.
Il y a donc une evolution dans cela aussi.
M. Paul Szabo (Mississauga-Sud, Lib.):
Elle porte sur le mot discrimination.
Nous avons sans aucun doute observe cela dans les jugements des tribunaux.
Dans le dictionnaire, la definition de la discrimination inclut divers elements.
Mais c'est vraiment une reponse tres personnelle.
M. Grant McNally (Dewdney-Alouette, Ref.):
Monsieur le President, j'ai une question tres directe a poser au depute du Bloc.
Je pense que le depute peut comprendre ce que cela veut dire.
Est-ce que le depute represente adequatement les electeurs de son comte?
Je ne reponds pas a cette question, mais je mets un gros point d'interrogation.
M. Peter Mancini (Sydney-Victoria, NPD):
J'estime qu'il est important.
Nous utilisons ici le mot mariage.
C'est l'engagement le plus personnel que l'on puisse faire.
Lorsqu'un ebeniste allie deux bois differents, on dit qu'il les marie.
Le terme est donc utilise pour differents objets.
Elle ne sera pas tres heureuse que j'en parle publiquement.
Il y a cinquante ans, elle a mis un anneau a son doigt.
Le mariage peut prendre toutes sortes de formes.
Je suis mariee a l'Angleterre.
Le mariage comporte de nombreuses connotations.
Il ne faut pas l'oublier, car nous traitons avec des mots.
Les mots sont importants a la Chambre.
Il y a des mots qui sont importants.
Nous avons eu des definitions du mariage et de ce qu'il signifie.
Cela merite des eclaircissements.
Je ne sais pas ce que cela veut dire.
Peut-on aller plus loin que cela?
Des eclaircissements s'imposent la-dessus.
L'etendue du pouvoir federal est en grande partie indeterminee.
J'ai pose la question a la ministre et elle est d'accord avec moi.
C'est la province qui a sanctionne le mariage.
Mais c'est le gouvernement federal qui sanctionne le divorce.
Je crois savoir que nous siegerons jusqu'a 6 h 30.
Il faut ensuite aller plus loin que la motion.
Le motionnaire et le comotionnaire en ont parle.
Je rappelle que je n'ai pas fait allusion a cela dans mon introduction.
Je pousserais meme le principe plus loin.
Voila pourquoi je juge que la motion dont nous sommes saisis est tres complexe.
M. Keith Martin (Esquimalt-Juan de Fuca, Ref.):
Monsieur le President, le Parti reformiste a presente un message de tolerance.
La tolerance sous-tend toute la motion que nous avons presentee aujourd'hui.
Je tiens a ce que ce soit bien clair.
J'ai represente bien des gens qui ont vecu un divorce difficile.
Les partenariats domestiques enregistres sont une bonne chose.
Je remercie le depute pour sa question.
Je crois que c'est une question importante.
Je n'ai aucune objection a cet egard.
M. Paul Szabo (Mississauga-Sud, Lib.):
J'aimerais avoir la reaction du depute a ce sujet.
Selon une publicite sur les cartes de credit, etre membre comporte des privileges.
La question fondamentale est la suivante.
Monsieur le President, la premiere partie de la question porte sur l'egalite.
Je ne crois pas que ce soit le cas du tout.
Je connais bon nombre d'homosexuels qui appuient les mariages heterosexuels.
Je sais que ce n'est pas ce qu'il a voulu dire.
Je crois que cela exige certaines precisions.
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
Cela m'offusque un peu.
Elle repete ce qui est dit dans le common law et le droit civil.
Je ne veux pas minimiser l'importance de cette question.
Personnellement, je ne le pense pas.
Je pense que les causes sont beaucoup plus profondes et beaucoup plus compliquees.
Je crois que c'est tout a fait vrai.
La motion ne demande rien de precis.
Elle ne reclame pas de modification a la loi actuelle, par exemple au Code criminel.
Elle ne propose pas de modifications de la Charte.
Elle ne traite pas d'un droit particulier plus que d'un autre.
Un jour on pourrait bien contester la definition constitutionnelle du mariage.
Elle presente une plus grande importance.
Nous avons la possibilite d'exprimer nos plaintes a l'egard du gouvernement du Canada.
C'est la un droit ancien que nous pouvons exercer en ce lieu.
Il existe des dissensions au sein du caucus du gouvernement.
Nous avons une possibilite d'interaction tres limitee au niveau des comites.
Je crois que nous devrions avoir des consultations.
Il y a deux enjeux tres differents et tres distincts en l'occurrence.
Je ne crois pas que l'une mene necessairement a l'autre.
Les tribunaux eux-memes ont rendu des decisions tres claires.
Cela ne risque pas d'arriver.
C'est une institution qui va demeurer tres forte et tres importante.
M. Gary Lunn (Saanich-Gulf Islands, Ref.):
Il nous impute des motifs caches et dit que cette question va nous diviser.
Pourtant, d'un autre cote, il soutient que la motion est importante.
Le depute ne peut pas jouer sur les deux tableaux.
Il parle d'emplois et de soins de sante.
Ce sont des questions que nous abordons tous les jours.
Personne ne pretend que ces questions ne sont pas importantes.
Le depute doit se brancher.
Le depute soutient que la motion ne permettra pas de fortifier l'institution du mariage.
Nous sommes tous deux avocats.
Que decide le depute?
Dans la plupart des cas, elles ont pour effet de le faire evoluer.
Mme Bev Desjarlais (Churchill, NPD):
Il se trouve que je suis d'accord avec lui.
J'ai ma propre opinion au sujet de l'institution du mariage.
Monsieur le President, je remercie la deputee de ses commentaires.
Ce n'est pas productif.
Il n'est jamais difficile de trouver des sujets pour exalter les passions.
C'est pourtant ce que nous devrions essayer de faire.
M. Gary Lunn (Saanich-Gulf Islands, Ref.):
Monsieur le President, c'est un honneur d'intervenir pour parler de cette importante question.
Apres avoir ecoute les quelques derniers orateurs, je tiens a lire ce qui suit:
Je ne vois pas comment on pourrait etre plus clair que cela.
Nous parlons de politique interessee.
Cela m'a tenu eveille longtemps hier soir.
Je suis alle dans les tribunaux en tant que membre du Barreau.
Les juges sont toujours en train de modeler les lois du pays.
Ces lois sont loin d'etre statiques.
Tres souvent, les avocats qui presentent une cause renvoient au hansard.
Cette decision a evidemment souleve aussitot un tolle a la grandeur du pays.
Le Parlement est le legislateur supreme au Canada.
C'est terriblement simple.
On ne saurait s'y tromper.
Certains deputes ont depose des petitions epaisses de plusieurs pouces.
Comment pourrait-on clarifier et simplifier la definition en cause?
Il n'y a pas d'autres solutions.
Il n'y a pas de programme secret, absolument aucun...
Votre nez s'allonge.
Cette simple allusion est ridicule.
Il y a un programme.
Je le dis sincerement, de tout coeur.
Il n'y a rien d'autre.
C'est d'ailleurs ce que demandent ces derniers.
Ils disent que c'est une question qui releve du Parlement.
Voila ce dont il est question dans ce debat, et rien d'autre.
J'espere que les deputes auront maintenant compris.
M. Paul Szabo (Mississauga-Sud, Lib.):
Le depute a tout a fait raison.
Le depute doit egalement connaitre les decisions recentes de la Cour supreme du Canada.
Ma question a trait a la discrimination.
Monsieur le President, je sais que la ministre de la Justice a presente un amendement.
Cela va de soi.
Voila pourquoi il n'en est pas fait mention dans notre motion originale.
C'est automatique, c'est une condition de base.
Il n'est pas necessaire de le preciser.
Le depute parle de discrimination, mais il n'y a la rien de discriminatoire.
Nous ne faisons que confirmer la definition du mariage.
Je n'ai rien contre cela.
Cela n'a rien a voir.
Il n'est pas question, en l'occurrence, d'orientation sexuelle.
Cette question concerne strictement la definition du mariage.
Personnellement, je ne veux faire aucune discrimination contre les homosexuels.
Je suis heureux de pouvoir le preciser.
M. Eric Lowther (Calgary-Centre, Ref.):
Monsieur le President, c'est tres evident.
Il y a cinq partis officiels a la Chambre.
Des deputes de chacun des partis ont presente des petitions sur cette question.
M. Monte Solberg (Medicine Hat, Ref.):
Monsieur le President, je suis heureux d'intervenir aujourd'hui sur cette question.
Des Canadiens communiquent chaque jour avec leur depute a ce sujet.
Des millions de Canadiens adherent actuellement a l'institution du mariage.
Ce n'est pas la une notion que les gens ne connaissent pas.
C'est une realite de la vie de tous les jours.
C'est exactement ce que nous faisons aujourd'hui.
Je felicite mon collegue de Calgary-Centre d'avoir vraiment insiste sur cette question.
A mon avis, c'est tres important.
Il nous faut le reconnaitre.
Et c'est precisement ce que nous faisons aujourd'hui.
Il s'agit d'une question importante.
Il convient d'en debattre au Parlement du Canada.
Je m'eleve contre les propos de la ministre de la Justice.
Je ferai simplement observer que les tribunaux sont tres imprevisibles.
Voila qui me preoccupe et qui preoccupe beaucoup d'autres Canadiens.
Cela les preoccupe et cela me preoccupe egalement en tant que representant de ces gens.
C'est la raison pour laquelle nous abordons la question aujourd'hui.
Combien de fois avons-nous debattu de choses totalement insensees en ce lieu?
De nombreuses fois a mon avis.
Je me rappelle la periode pre-referendaire de 1995.
Pour une raison ou une autre, cela meritait un debat.
Cela va gener certaines personnes.
Eh bien, tant pis.
Nous sommes elus pour faire ce travail.
Nous sommes bien payes pour le faire.
Voila ce que nous disons aujourd'hui.
Je veux revenir sur certaines des affirmations faites par des deputes neo-democrates.
J'ai du nouveau a annoncer a la deputee de Vancouver-Est.
Il ne s'agit pas de discrimination.
Il s'agit simplement d'une definition qui nous dit ce qui constitue un mariage.
Les couples homosexuels peuvent avoir leur propre type d'union.
Ils peuvent l'appeler comme ils l'entendent.
Il y a d'autres relations.
Les amities sont appelees des amities.
Il ne s'agit pas de la meme chose.
Cela ne veut pas dire qu'il y a de la discrimination.
Voila tout ce que cela veut dire.
Cela n'a rien a voir avec de la discrimination.
Je rejette cet argument car il s'agit d'une autre diversion.
Comment a reagi le depute de Burnaby-Douglas?
Il a dit qu'il s'agissait la d'une attaque epouvantable.
Il a soutenu qu'il y avait de la discrimination.
C'est un fait.
C'est tres clair.
C'est bien le cas, par definition.
Je le felicite de ses observations.
Ce role consiste a determiner qui peut contracter un mariage.
Il appartient au gouvernement federal de le faire.
Nous devons jouer notre role a cet egard.
Ces derniers ont d'ailleurs souvent demande au Parlement de le faire.
C'est precisement ce que nous proposons aujourd'hui.
C'est ce que je dis au depute de Sydney-Victoria.
Le depute parlait alors au nom de ses electeurs.
J'invite les deputes d'en face a voter en faveur de la motion.
M. Paul Szabo (Mississauga-Sud, Lib.):
Nous devons donc continuer de rappeler aux tribunaux les principes que defend le Parlement souverain.
On parle souvent dans la publicite des privileges et des droits des adherents.
C'est le dilemme et c'est la-dessus que le Parlement doit se pencher.
J'aimerais connaitre l'avis du depute.
Ce n'est pas aux tribunaux a determiner les coutumes du pays.
Il faut que cela vienne de la population.
Ces decisions devraient se prendre ici, a l'occasion d'un debat libre et ouvert.
Mon collegue a mentionne que le gouvernement appuiera la motion.
Je m'attends a ce que ces deputes independants prennent leurs propres decisions.
C'est ce qui se produirait normalement dans un Parlement libre.
J'espere que ce n'est pas le cas.
M. Charlie Penson (Peace River, Ref.):
Il a souligne la necessite de reaffirmer l'importance du mariage.
Les gens continuent de communiquer avec mon bureau de circonscription pour appuyer cette resolution...
Le president suppleant (M. McClelland):
Il me semble que ce soit un moment approprie pour interrompre.
Le depute de Medicine Hat a 30 secondes pour repondre.
Monsieur le President, je felicite mon collegue de Peace River.
C'est un vrai champion dans ce genre de dossier.
J'encourage les deputes des deux cotes de la Chambre a le faire aujourd'hui.
Cette condition est inherente a l'institution meme du mariage.
On trouve cette regle a l'article 365 du Code civil du Quebec.
Cela reflete egalement l'etat de la loi dans toutes les autres provinces canadiennes.
Je voudrais reagir aux observations des deputes de l'opposition.
C'est la vraie question qui se pose aujourd'hui.
Les reformistes cherchent constamment a marquer des points politiques en embrouillant les choses.
Il n'y a aucun probleme ici.
Je partagerai mon temps de parole avec le depute de Mississauga-Sud.
M. Rick Casson (Lethbridge, Ref.):
C'est de la basse politique.
Le fait est que les Canadiens sont preoccupes.
Monsieur le President, je suis aussi deputee et j'ai aussi recu des appels telephoniques.
Il arrive souvent que ces appels resultent du fait que les Canadiens sont mal informes.
Cela cree de la confusion.
Oui, les gens veulent connaitre la position du gouvernement.
Je ne dis pas que nous ne devrions pas avoir une definition du mariage.
Comme la ministre l'a dit, nous avons deja une definition du mariage.
La primaute du droit.
Le gouvernement n'a que du respect a l'egard des tribunaux.
Ce n'est cependant pas le cas de l'opposition officielle de Sa Majeste.
M. Eric Lowther (Calgary-Centre, Ref.):
Monsieur le President, je comprends la position de la deputee.
Je ne partage pas son opinion, mais je la comprends.
Voila ce que disait le juge.
Les tribunaux demandent a la Chambre de leur fournir des consignes dans ce domaine.
Nous n'en savons rien.
Je repete ce que la ministre a declare ce matin.
Le gouvernement n'a jamais eu l'intention de redefinir le mariage.
M. Charlie Penson (Peace River, Ref.):
Qu'en pense la deputee?
M. Paul Szabo (Mississauga-Sud, Lib.):
En fait, il s'agit d'une motion tres importante.
Elle se resume a quelques principes fondamentaux.
Pour beaucoup, cette ligne semble avoir trait au mariage.
Telle est la ligne dans le sable.
De par sa nature meme, la politique est discriminatoire.
Elle doit etre discriminatoire.
Par definition, par nature, les regles sont discriminatoires.
Cette affirmation a pour corollaire la question du contexte de la discrimination.
Plus tot j'ai parle de la definition de la discrimination.
Il y a d'autres acceptions.
Je vais en donner un ou deux exemples.
On y a droit quand on a 65 ans.
C'est de la discrimination fondee sur l'age.
C'est de la discrimination en faveur des personnes agees.
Pourquoi personne ne proteste disant que nous devrions tous etre traites de facon egale?
Ne devrions-nous pas tous etre egaux?
Et que dire des prestations d'invalidite?
C'est de la discrimination en faveur des personnes invalides.
Il existe plusieurs dispositions de ce genre relatives, par exemple, aux revenus de placements.
Un menage peut mettre ses revenus en commun.
Toutes ces mesures sont discriminatoires en faveur d'un groupe en particulier.
Il s'agit la d'une discrimination, mais en faveur de quelque chose.
A ce propos, je voudrais revenir en arriere.
Il s'agissait d'un avantage social.
Il ne s'agissait pas d'une deduction pour emploi.
Il y a egalement un debat a cet egard.
Il y a l'age d'admissibilite au credit d'impot non remboursable.
On y a droit lorsqu'on atteint 65 ans.
La liste est interminable.
Tout cela est prevu dans la Loi de l'impot sur le revenu.
Nous ne devrions pas parler uniquement de discrimination dans un contexte negatif.
Quelle valeur attachons-nous aux choses?
Mais l'egalite qu'ils reclament est celle des individus.
Ils veulent que les individus soient le plus bas denominateur commun.
Ne devrions-nous pas reserver a tous le meme traitement?
Ne devrions-nous pas nous en tenir au plus petit denominateur commun?
Ne devrions-nous pas simplement former une societe ordinaire?
Ne devrions-nous pas considerer que les relations n'existent pas dans nos lois?
Pourquoi ne disons-nous pas tout simplement que nous sommes tous des individus?
Dans une societe, il y a une synergie.
Certaines choses se produisent.
L'archeveque a parle de la famille.
Voila ce qu'est une famille.
Le cardinal a parle expressement de la famille.
Il a cite le pape Jean-Paul II:
Le role de la famille est particulier.
Cette discrimination a pour but de refleter nos valeurs.
Si nous ne faisions pas cela, notre societe serait terne.
La question dont nous sommes saisis concerne aussi les tribunaux.
Mme Bev Desjarlais (Churchill, NPD):
Monsieur le President, je me dois de relever l'idee du plus petit denominateur commun.
Les relations au sein de ces familles ne sont pas toujours parfaites.
Il faut parfois apporter des changements.
Il ne s'agit pas du seul mot mariage.
Ils sont d'avis que tout cela ne devrait pas avoir lieu.
Monsieur le President, je pense que la deputee a mal entendu.
J'attire l'attention de la deputee la-dessus.
C'est matiere a debat.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Ces resolutions ne sont pas la politique du gouvernement.
Elles sont prises comme conseils ou comme bases de discussion.
Elles ne lient pas le parti et le depute le sait tres bien.
Nous devons parler en faveur de quelque chose et pas contre quelque chose.
J'appuie les familles et je fais de la discrimination en leur faveur.
Mme Marlene Catterall (Ottawa-Ouest-Nepean, Lib.):
Je n'accepte pas la definition etroite que le depute donne de la famille.
Je n'ai pas donne une definition exclusive de la famille.
Ce ne sont pas des elucubrations.
Ce n'est pas une idee folle.
C'est un fait.
M. Chuck Strahl (Fraser Valley, Ref.):
Dans mon cas, je viens tout juste de celebrer mon 24e anniversaire de mariage.
Depuis mon mariage, la vie a ete assez belle.
Aujourd'hui, le theme du debat est:
Elle ne va pas a l'encontre de quoi que ce soit.
C'est ce que nous affirmons de nouveau aujourd'hui.
Quelqu'un a demande plus tot de definir ce qu'est la famille.
Une mere celibataire avec des enfants represente-t-elle une famille?
Qu'en serait-il si elle avait adopte deux enfants?
En est-il de meme dans le cas d'un pere celibataire?
Ce sont la des familles et nous le reconnaissons.
C'est un autre grand debat.
C'est ce dont il s'agit.
Pourquoi nous arreter a ce debat?
Ensuite, il faut permettre aux Canadiens de se faire entendre sur la question.
Le depute tient peut-etre a retirer ce mot de la Constitution.
Tant mieux pour lui s'il parvient a convaincre quelqu'un.
Nous ne devrions pas avoir peur de le faire.
Il avait epouse la femme de ses reves juste avant d'aller en Bosnie.
Ils s'etaient epouses au cours d'une ceremonie de mariage.
Il existait un certificat de mariage.
M. Janko Peric (Cambridge, Lib.):
Monsieur le President, j'ai ecoute attentivement l'excellent discours du depute.
Je suis marie depuis 29 ans.
Qui plus est, pour moi, en tant que catholique, le mariage est un sacrement.
Qu'en pense-t-il?
Monsieur le President, c'est une excellente question.
Ce dont parle le depute, bien sur, c'est d'un mariage religieux.
Ils contractent mariage dans la perspective traditionnelle de la foi qui de deux fait un.
La plupart des gens contractent mariage avec grand serieux et de maniere tres solennelle.
Il n'y a rien de plus stressant que l'echec d'un mariage.
Le president suppleant (M. McClelland):
C'etait difficile d'attirer votre attention, mais j'ai du vous interrompre.
M. Pat Martin (Winnipeg-Centre, NPD):
Ce soldat serait alors parti au loin et aurait saute sur une mine.
Monsieur le President, le depute a saisi l'idee de mon histoire.
Ils ne doivent pas prouver qu'ils couchent ensemble.
Ils ne doivent pas prouver qu'il s'agit d'un engagement a long terme.
Ils ne sont pas tenus d'avoir d'enfants.
Le depute a parle d'un cas hypothetique.
J'encourage le depute et son parti a la soulever.
Selon la definition du mariage, ces deux personnes sont un homme et une femme.
M. Maurice Vellacott (Wanuskewin, Ref.):
Mais pourquoi debattre d'une telle question?
Pourquoi consacrer du temps a discuter d'une chose qui semble aussi evidente?
Nous avons besoin d'une petite retrospective des evenements des derniers mois.
J'aimerais citer la ministre de la Justice a cet egard.
Dans une lettre datee du 24 avril 1998, elle a declare:
Il s'agit d'une question differente qui entre dans une categorie differente.
L'institution du mariage a beaucoup apporte a notre societe.
C'est un fait documente.
Pourquoi un mariage procure-t-il tous ces avantages?
Je veux tout simplement souligner ici que les gens s'engagent serieusement dans le mariage.
C'est la un grand avantage pour toute societe.
Il serait fou de vouloir faire disparaitre l'unicite de la relation matrimoniale.
C'est beaucoup plus qu'une simple forme d'expression.
On ne peut pas jouer avec l'institution du mariage.
Nous risquerions ainsi de tuer la poule aux oeufs d'or.
Modifier l'institution du mariage serait envoyer le mauvais message.
D'abord, ce serait envoyer le mauvais message aux jeunes.
Cet optimiste est benefique.
Il faut l'encourager.
C'est l'union d'un homme et d'une femme pour la vie.
C'est egalement l'union de deux personnes de sexe oppose.
Mme Judi Longfield (Whitby-Ajax, Lib.):
Bien franchement, je dirai sans aucune hesitation que j'appuie cette idee sans reserves.
Il y a d'autres facons de determiner qui peut recevoir les prestations de survivant.
Cela ne devalorise aucunement les autres types de relations.
Nous discutons ici de la definition juridique de mariage.
M. Sarkis Assadourian (Brampton-Centre, Lib.):
De nombreux Canadiens musulmans ont le droit d'epouser plus d'une femme.
C'est la loi.
Mme Bev Desjarlais (Churchill, NPD):
Toutefois, je crois que ce debat suscite d'autres questions.
La deputee pose une excellente question.
Le depute doit aborder cette question avant que nous prenions le vote.
C'est une question tres importante.
Je ne sais pas au juste ou il veut en venir.
Cette definition est conforme aux valeurs judeo-chretiennes qui sont les notres depuis longtemps.
M. John McKay (Scarborough-Est, Lib.):
Monsieur le President, je partagerai mon temps avec le depute de Wentworth-Burlington.
Il ne revient pas a la cour de le faire.
Par definition, les tribunaux n'ont pas un point de vue large.
Leur point de vue est donc etroit et specifique.
Le processus est assez ouvert et democratique.
Aucun tribunal ne peut jamais egaler l'etendue du processus parlementaire.
La deuxieme etape pose plus de problemes.
M. Grant McNally (Dewdney-Alouette, Ref.):
Comment peut-il justifier cela?
On se doit d'etre beaucoup plus precis dans l'utilisation de la langue.
Nous voulons que des mots donnes aient un sens precis dans une mesure legislative donnee.
M. Garry Breitkreuz (Yorkton-Melville, Ref.):
Il faut s'arreter avant qu'il ne soit trop tard.
Le proces s'est transforme en un debat theorique sur le mariage entre homosexuels.
L'aspect pecuniaire avait ete regle.
Voila pourquoi ce debat revet une si grande importance.
J'aimerais savoir si le depute a quelque chose a redire a mes observations.
L'article 1 concerne la definition du mariage.
La prochaine etape consiste a deconjugaliser la question.
Une fois que nous l'aurons fait, il n'y aura plus matiere a debat.
M. John Bryden (Wentworth-Burlington, Lib.):
Je commencerai par dire que je suis un depute.
Je ne suis pas lie par les decisions politiques d'un congres liberal.
Les reformistes sont peut-etre lies par les recommandations des congres politiques, mais pas moi.
Je n'ai aucune difficulte a dire que j'appuie la motion.
Nous avons envers ces Canadiens l'obligation de respecter leurs sentiments a ce sujet.
J'ai vote contre mon gouvernement sur ce sujet il y a plusieurs annees.
Le gouvernement a employe ce mot en se fondant sur des precedents judiciaires.
Nous allons maintenant passer aux declarations de deputes.
Mme Karen Kraft Sloan (York-Nord, Lib.):
M. Ken Epp (Elk Island, Ref.):
Monsieur le President, il s'agit d'une journee tres speciale a la Chambre.
Il existe d'autres facons de soutenir la famille.
J'aime beaucoup ma famille.
Nous devons reduire la dette et les impots.
M. Lynn Myers (Waterloo-Wellington, Lib.):
L'eau potable pure et les terres agricoles se font de plus en plus rares.
Le poisson est moins abondant dans les rivieres, les lacs et les oceans.
Ce sont notre ecosysteme et notre sante qui ecopent le plus.
Mme Carolyn Bennett (St. Paul's, Lib.):
La medecine a enormement progresse dans sa comprehension de la leucemie.
Je suis sure que nous aurons tres bientot les moyens de guerir la leucemie.
RELAIS POUR UN AMI
M. Lou Sekora (Port Moody-Coquitlam-Port Coquitlam, Lib.):
Ce qu'ont accompli les organisateurs et les participants est extraordinaire.
Plusieurs personnes qui ont participe a cette campagne ont survecu au cancer.
Felicitations a tous les organisateurs et a tous les participants.
M. Jake E. Hoeppner (Portage-Lisgar, Ref.):
Les agriculteurs canadiens ont droit eux a de simples discours politiques.
Le gouvernement ecoute-t-il?
Ils ont besoin de solutions, pas de promesses creuses.
M. Gurbax Singh Malhi (Bramalea-Gore-Malton-Springdale, Lib.):
Cette attaque de 1984 avait tue beaucoup d'innocents, hommes, femmes et enfants.
La liberte religieuse, qui est protegee ici au Canada, avait ete violee.
Mme Helene Alarie (Louis-Hebert, BQ):
M. Peter Adams (Peterborough, Lib.):
Mme Deborah Grey (Edmonton-Nord, Ref.):
La course a ete effrenee et le dernier droit, fort excitant.
Bravo aux Neo-Brunswickois qui ont fait preuve de courage politique hier.
Ils ont examine attentivement les plates-formes electorales, les partis, les chefs et les candidats.
C'est une facon de reorienter nos espoirs et notre energie vers de nouveaux objectifs.
Et il se dirige vers Ottawa.
Il secouera les banquettes ministerielles et le siege du pouvoir.
Tenez-vous bien, votre fin approche.
M. Bernard Patry (Pierrefonds-Dollard, Lib.):
M. Pat Martin (Winnipeg-Centre, NPD):
George Harris a saisi les tribunaux de cette affaire.
George Harris est un heros parce qu'il defend nos interets.
La deputee de Drummond a la parole.
Mme Pauline Picard (Drummond, BQ):
Mme Raymonde Folco (Laval-Ouest, Lib.):
Monsieur le President, deja, on voit des trous dans l'administration de Lucien Bouchard.
Celui-ci commence a ne pas aimer ce qu'il voit au Quebec.
Ce qui semble menace serait plutot le modele pequiste.
Il faut savoir faire la difference.
M. John Herron (Fundy-Royal, PC):
Monsieur le President, c'est un grand jour pour le Nouveau-Brunswick.
Cette election a redonne aux gens le droit a la democratie.
LA JOURNEE COMMUNAUTAIRE ANNUELLE DE NETTOYAGE DANS PARKDALE
Mme Sarmite Bulte (Parkdale-High Park, Lib.):
M. John Williams (St. Albert, Ref.):
Les contribuables n'ont pas seulement finance des films absurdes.
L'EXPLOITATION SEXUELLE DES ENFANTS
Mme Christiane Gagnon (Quebec, BQ):
M. Preston Manning (chef de l'opposition, Ref.):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, le chef de l'opposition pose une tres bonne question.
M. Preston Manning (chef de l'opposition, Ref.):
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Preston Manning (chef de l'opposition, Ref.):
Monsieur le President, 800 soldats canadiens sont en route pour l'ancienne Yougoslavie.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Mme Deborah Grey (Edmonton-Nord, Ref.):
Elle ne disparaitra pas.
Ou est le recu?
Le tres hon. Jean Chretien (premier ministre, Lib.):
C'est elle qui les gere.
Mme Deborah Grey (Edmonton-Nord, Ref.):
C'est clair comme de l'eau de roche.
L'arrogance liberale ne donnera rien.
Demandez donc a Camille Theriault et a Dalton McGuinty ce qu'ils en pensent.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Je le dis et je le repete, j'ai vendu ces parts.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Je lui demande bien simplement pourquoi il ne depose pas l'acte de vente.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, je repete encore la meme chose.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Donc, la decision lui revient.
La fiducie n'a rien a voir la-dedans.
Le tres hon. Jean Chretien (premier ministre, Lib.):
J'en laisse l'administration a la personne qui est en charge.
M. Michel Gauthier (Roberval, BQ):
Qu'il depose l'acte de vente, et cela va regler le probleme.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Je le repete: tous mes biens sont administres par un fiduciaire.
Je n'ai pas de droit de regard quant a l'administration.
M. Michel Gauthier (Roberval, BQ):
Si c'est le cas, qu'il nous le dise.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Il a regarde le dossier qui est gere par mon fiduciaire.
C'est une fiducie dans laquelle je n'ai aucun droit de regard.
Mme Alexa McDonough (Halifax, NPD):
Monsieur le President, ma question s'adresse au premier ministre.
Pourquoi le gouvernement fait-il adopter un autre budget du Senat sans examen public?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Il sera la tant que la Constitution ne sera pas modifiee.
Nous avons voulu modifier le Senat il y a quelques annees.
Nous avons donc le Senat qui nous a ete donne par le Parti reformiste.
Mme Alexa McDonough (Halifax, NPD):
Monsieur le President, beaucoup de Canadiens s'inscrivent en faux contre cette affirmation.
Le Senat du Canada n'a pas sa place dans une democratie moderne.
C'est une farce et un objet de honte.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Ils ont travaille a une telle modification pendant des mois, mais sans resultat.
Lorsque nous en avons eu la possibilite, nous avons vote sur une reforme du Senat.
M. Andre Bachand (Richmond-Arthabaska, PC):
Ma question s'adresse au premier ministre.
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Andre Bachand (Richmond-Arthabaska, PC):
Il y a une grande difference entre la demilitarisation et le desarmement.
Les troupes canadiennes seront parmi les premieres a entrer sur le territoire du Kosovo.
Quelles sont les regles d'engagement de l'armee canadienne?
J'aimerais que le premier ministre nous informe correctement sur cette question importante.
J'espere que le premier ministre pourra nous repondre clairement cette fois-ci.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, la resolution dit clairement ceci:
C'est le texte sur lequel tout le monde s'est entendu.
Mme Diane Ablonczy (Calgary-Nose Hill, Ref.):
La furie serait tout indiquee aujourd'hui.
Si ces actions ont ete vendues, ou est le recu?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Cette declaration de M. Wilson au comite est tres claire.
Mme Diane Ablonczy (Calgary-Nose Hill, Ref.):
Il serait peut-etre preferable de poser la question autrement:
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, je vais citer M. Wilson:
C'est tres clair.
J'ai confiance en lui.
Mon fonds fiduciaire gere mes biens.
Il s'agit d'une fiducie sans droit de regard.
Je fais seulement ce que l'on exige de moi.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Il nous dit que c'est dans les mains de la fiducie.
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, le fiduciaire est en charge de ces choses.
Les ministres, comme le premier ministre, dans ces circonstances, n'ont aucun droit de regard.
C'est une question d'administration des biens en dehors de la connaissance.
C'est fait pour tous les ministres, comme pour moi.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Cela n'a pas de sens.
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Randy White (Langley-Abbotsford, Ref.):
Il a dit qu'il etait au courant, qu'il etudiait la situation.
Mes sources affirment qu'aucune etude n'est en cours dans les penitenciers.
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
M. Randy White (Langley-Abbotsford, Ref.):
Je sais ce qui se passe depuis six ans.
Cela ne ressemble pas a un plan, mais a un faux-fuyant.
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
Je pensais qu'il avait decouvert ce phenomene la semaine derniere.
Je pourrais dire aux gens quoi faire.
M. Michel Gauthier (Roberval, BQ):
Le tres hon. Jean Chretien (premier ministre, Lib.):
Monsieur le President, pour ce qui est des interets, je les ai vendus.
M. Michel Gauthier (Roberval, BQ):
Mais personne n'a vu le debut du commencement d'un acte de vente.
Le tres hon. Jean Chretien (premier ministre, Lib.):
M. Jim Abbott (Kootenay-Columbia, Ref.):
Monsieur le President, il y a effectivement un probleme de drogues dans les prisons.
Voyons ce qui s'est passe, samedi dernier, au penitencier de Kingston.
C'est le dernier evenement a ce jour.
Il y en a eu beaucoup d'autres au fil des annees.
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
M. Jim Abbott (Kootenay-Columbia, Ref.):
N'est-ce pas extraordinaire, monsieur le President?
Il vient de commander une etude.
Pourquoi n'a-t-il pas de plan?
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
J'ai fait savoir qu'un taux de seulement 12 p. 100 etait trop eleve.
Nous avons l'intention de resoudre le probleme.
M. Gilles Duceppe (Laurier-Sainte-Marie, BQ):
Peut-il nous expliquer tous ces retournements?
Le tres hon. Jean Chretien (premier ministre, Lib.):
Il a dit clairement que les actions n'ont jamais ete retournees.
M. John Harvard (Charleswood St. James-Assiniboia, Lib.):
Monsieur le President, ma question s'adresse au ministre des Transports.
L'hon. David M. Collenette (ministre des Transports, Lib.):
M. Chuck Cadman (Surrey-Nord, Ref.):
Lorsqu'il est sorti, il etait heroinomane.
Ou est le plan du solliciteur general?
Qui est charge de son application?
Quand obtiendrons-nous des resultats?
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
M. Chuck Cadman (Surrey-Nord, Ref.):
Le probleme existe depuis des annees.
L'hon. Lawrence MacAulay (solliciteur general du Canada, Lib.):
Ce n'est pas encore assez.
Nous ferons encore plus.
Mme Michelle Dockrill (Bras d'Or-Cape Breton, NPD):
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines, Lib.):
Monsieur le President, je suis impatient de lire le rapport du sous-comite.
Mme Michelle Dockrill (Bras d'Or-Cape Breton, NPD):
Comme d'habitude, il a promis d'etudier le probleme.
L'hon. Pierre S. Pettigrew (ministre du Developpement des ressources humaines, Lib.):
Mme Elsie Wayne (Saint John, PC):
On nous a dit egalement que l'enonce des besoins est pret depuis plusieurs mois.
Ou se trouve l'enonce des besoins pour le remplacement des appareils Sea King?
L'hon. Arthur C. Eggleton (ministre de la Defense nationale, Lib.):
Mme Elsie Wayne (Saint John, PC):
Ils n'ont jamais obtenu de reponse franche.
Ou se trouve l'enonce des besoins pour le remplacement des Sea King?
L'hon. Arthur C. Eggleton (ministre de la Defense nationale, Lib.):
J'ai dit tres clairement que nous voulons remplacer ces helicopteres.
Nous attendons l'enonce des besoins.
Si nous pouvions le rendre public aujourd'hui ou demain, j'aimerais bien le faire.
Je serais tres heureux de le faire ici et maintenant.
Nous allons le rendre public aussi rapidement que nous le pourrons.
L'hon. Charles Caccia (Davenport, Lib.):
Monsieur le President, ma question s'adresse au ministre des Finances.
L'hon. Paul Martin (ministre des Finances, Lib.):
M. Lee Morrison (Cypress Hills-Grasslands, Ref.):
Il serait preferable de depersonnaliser les questions, dans la mesure du possible.
L'hon. David M. Collenette (ministre des Transports, Lib.):
Monsieur le President, le depute a mal compris les choses une fois de plus.
Dans l'ensemble, le systeme fonctionne bien.
Les personnes choisies sont parmi les plus competentes.
Elles ont ete choisies en consultation avec les utilisateurs.
M. Daniel Turp (Beauharnois-Salaberry, BQ):
Ma question s'adresse au premier ministre.
Le tres honorable premier ministre a la parole.
Le tres hon. Jean Chretien (premier ministre, Lib.):
C'est la sequence des evenements, tel que prevu dans l'accord.
L'honorable deputee de Winnipeg-Centre-Nord a la parole.
Mme Judy Wasylycia-Leis (Winnipeg-Centre-Nord, NPD):
L'hon. Allan Rock (ministre de la Sante, Lib.):
M. David Price (Compton-Stanstead, PC):
Il a parle a maintes reprises de desarmement.
L'hon. Arthur C. Eggleton (ministre de la Defense nationale, Lib.):
Monsieur le President, demilitarisation et desarmement ne sont pas incompatibles.
Les deux devront se produire.
Le desarmement de l'UCK se fera au cours des premieres etapes.
LA STRATEGIE NATIONALE DE SANTE EN MILIEU RURAL
M. Larry McCormick (Hastings-Frontenac-Lennox and Addington, Lib.):
L'hon. Allan Rock (ministre de la Sante, Lib.):
Je compte donner rapidement suite a la plupart d'entre elles.
Tout au long des prochains mois, nous consulterons directement les Canadiens sur leurs priorites.
M. Lee Morrison (Cypress Hills-Grasslands, Ref.):
La nouvelle Loi maritime du Canada etait censee depolitiser l'administration des ports au Canada.
L'hon. David M. Collenette (ministre des Transports, Lib.):
Nous avons nomme des gens charges de rapporter les preoccupations des usagers.
L'AVENIR POLITIQUE DU QUEBEC
M. Pierre Brien (Temiscamingue, BQ):
C'est contre la democratie et c'est contre le droit dans ce pays.
M. Svend J. Robinson (Burnaby-Douglas, NPD):
L'hon. Arthur C. Eggleton (ministre de la Defense nationale, Lib.):
M. Bill Casey (Cumberland-Colchester, PC):
Monsieur le President, ma question s'adresse au vice-premier ministre.
Cela fait 10 ans que cet edifice n'est pas occupe.
Aucun organisme gouvernemental n'en veut.
Le ceder a la ville serait un tres bon projet pour le millenaire.
Le ministre est-il pret a en approuver le transfert?
L'hon. Herb Gray (vice-premier ministre, Lib.):
Monsieur le President, je me ferai un plaisir d'etudier la question.
Je voudrais lui accorder tout de suite la parole.
M. Nick Discepola (Vaudreuil-Soulanges, Lib.):
Monsieur le President, je vous remercie de me fournir l'occasion de clarifier cette situation.
Pour en venir directement au fait, j'ai effectivement accorde une interview au Toronto Star .
J'estime n'avoir emis qu'une opinion personnelle.
Je l'ai bien dit au journaliste.
C'est ce que j'ai compris.
C'est exact, monsieur le President.
Elles etaient ouvertes au public.
Le rapport n'a meme pas ete adopte.
Cela ne s'est pas produit.
Le probleme ne semble pas vouloir disparaitre.
A mon avis, il incombe a la presidence d'intervenir.
Nous attendons son rapport.
Le rapport n'a pas ete agree.
C'est a la Chambre de le faire.
M. Yvan Loubier (Saint-Hyacinthe-Bagot, BQ):
J'ai soumis a votre gouverne de nombreux problemes.
C'est le comble du ridicule.
A un moment donne, il faut arreter de nous prendre pour des imbeciles.
M. Jim Abbott (Kootenay-Columbia, Ref.):
Je presume qu'il s'agit de 1998.
Cependant, je demande conseil.
L'hon. Don Boudria (leader du gouvernement a la Chambre des communes, Lib.):
Monsieur le President, selon le commentaire 495(3) du Beauchesne:
Je crois que c'est clair.
Je n'ai pas entendu le solliciteur general citer le document.
La parole est au chef du Parti reformiste.
LE DECES DE M. HUGH HANRAHAN
M. Preston Manning (chef de l'opposition, Ref.):
Hugh a ete depute de 1993 a 1997.
Il a grandi a Antigonish, en Nouvelle-Ecosse, dans une famille de cinq garcons.
Cette opinion me vient peut-etre du fait que je suis pere de cinq enfants.
L'hon. Anne McLellan (ministre de la Justice et procureur general du Canada, Lib.):
Il a fait tout son possible pour veiller a leur promotion.
Il s'est lance avec succes sur la scene federale.
Mme Monique Guay (Laurentides, BQ):
Tout a fait naturel, puisque l'enseignement etait une veritable passion pour Hugh.
Il remporta ses elections en 1993 dans le comte d'Edmonton-Strathcona.
C'est pour dire a quel point il aimait et respectait ses etudiants.
La perte d'un etre cher est toujours tres douloureuse a accepter.
M. John Solomon (Regina-Lumsden-Lake Centre, NPD):
M. Hanrahan a enseigne pendant 18 ans dans le reseau scolaire catholique d'Edmonton.
Il enseignait les sciences humaines, l'economie et la psychologie.
Il allait souvent en Nouvelle-Ecosse, et nous parlions de ses sejours la-bas.
J'ai partage avec lui sa reflexion tres serieuse sur la question.
M. Peter MacKay (Pictou-Antigonish-Guysborough, PC):
Il a toujours ete tres fier de ses ancetres ecossais et irlandais.
Il est maintenant rentre au bercail en Nouvelle-Ecosse.
Le pays en a tire un grand profit.
Il a servi les Canadiens de facon noble et digne.
Madame la Presidente, j'invoque le Reglement.
La presidente suppleante (Mme Thibeault):
Le depute demande le consentement unanime pour le depot d'une petition.
M. Paul Bonwick (Simcoe-Grey, Lib.):
La Chambre reprend l'etude de la motion et de l'amendement.
M. John Bryden (Wentworth-Burlington, Lib.):
C'est quelque chose que la nature ou Dieu nous a donne.
C'est une imperfection ou peut-etre meme une anomalie.
Deuxiemement, la loi devrait contenir une definition du conjoint.
Nous devrions ensuite creer une nouvelle definition qui ferait reference au partenaire a charge.
Une fois cela fait, les autres elements se mettront en place d'eux-memes.
Je le crois aussi.
Je pense que la solution est simple.
Mme Libby Davies (Vancouver-Est, NPD):
Les gens qui vivent ensemble peuvent se definir, s'identifier comme des conjoints.
Il peut s'agir d'une relation de fait entre un homme et une femme.
Il peut s'agir d'une relation entre deux personnes du meme sexe.
Or, c'est precisement l'objectif poursuivi par la motion dont nous sommes saisis.
Pour quelle raison faudrait-il agir de la sorte.
A qui cela fait-il peur?
Quel sera le prochain terme?
Va-t-on definir ensuite ce qu'est la famille?
Madame la Presidente, nous venons d'entendre un exemple de discours intolerant.
Il incombe aux deputes a la Chambre de definir les termes dans la loi.
C'est notre travail.
C'est ce que nous avons a faire ici.
J'en ai le droit.
J'ai ete elu par les gens de ma circonscriptions pour faire exactement cela.
Je ne puis faire cela.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Madame la Presidente, je felicite le depute de Wentworth-Burlington de ses paroles eloquentes.
M. Ken Epp (Elk Island, Ref.):
Pour moi, le mariage et la famille revetent une signification toute particuliere.
C'est probablement vrai.
Nous avons une tres solide relation familiale qui repose sur le mariage.
Pour moi, le mariage echappe en quelque sorte a toute definition.
Nous parlons de langage.
Nous savons tous que le langage evolue avec le temps.
J'ai moi-meme constate des changements dans la langue depuis ma jeunesse.
Nous avions une devise lorsque j'etais en huitieme annee.
Je m'en rappelle tres bien.
Notre recompense etait la fierte du travail bien fait.
Dans mon temps, cela signifiait etre joyeux et ne pas avoir de soucis.
Nous avons prononce des voeux.
Aujourd'hui, je voudrais partager avec vous cet aspect de la definition du mariage.
Je me souviens de mes grands-parents.
Ils sont morts depuis plusieurs annees.
Si Dieu le veut, nous celebrerons leur 65e anniversaire de mariage l'annee du millenaire.
C'est leur projet du millenaire.
Ils sont encore en tres bonne sante et nous nous en rejouissons.
Comme je l'ai dit, ma femme et moi accordons la meme signification au mariage.
Telle est la definition actuelle.
Je crois qu'ils n'ont pas l'intention de la modifier.
Pourquoi alors proposer cette motion?
C'est bien simple.
Songez au mot conjoint.
Les tribunaux commencent a modifier la signification de ce mot.
Mme Maud Debien (Laval-Est, BQ):
Ses exemples etaient tres pertinents.
J'ai une question a lui poser.
Madame la Presidente, nous ne parlons pas aujourd'hui des autres types de relation.
Il n'y a pas de doute qu'il en existe d'autres.
Je n'aime pas employer le mot dans ce contexte, mais c'est ainsi.
Je ne crois pas que nous parlions de l'autre sens, qui existe peut-etre.
On pourra en parler un autre jour.
Mme Marlene Catterall (Ottawa-Ouest-Nepean, Lib.):
Toutefois, tous les tribunaux nous disent qu'ils souhaitent que nous les guidions.
A moins que la cour ne s'exprime ont-ils dit.
Il y a des cas ou les tribunaux nous ont vraiment demande cela.
J'en ai plusieurs exemples ici.
Ils modifient la definition du terme conjoint.
Mme Diane Ablonczy (Calgary-Nose Hill, Ref.):
Bien sur, les conjoints font partie integrante du mariage.
Et d'ajouter: cet appel ne conteste pas la conception traditionnelle du mariage.
Des mesures ont ete prises dans plusieurs autres pays pour revoir la question.
En 1996, le Congres americain a adopte une loi concernant la defense du mariage.
Cette loi a fait deux choses.
Je voudrais simplement lire le texte des petitions qui ont ete deposees.
En fait, 84 deputes ont presente une meme petition:
Meme au sujet de cette exception, il y avait un juge qui faisait dissidence.
Devant une observation comme celle-la, nos concitoyens ont de quoi etre inquiets.
Ils se demandent ce qui va se produire.
S'il y a un doute, il faut le dissiper.
Diverses raisons expliquent pourquoi l'institution du mariage est si importante.
Dans le livre intitule It Takes Two:
The Family in Law and Finance , de Allen et Richards, on dit ce qui suit:
Le mariage est une institution efficace.
M. John Cannis (Scarborough-Centre, Lib.):
Je remercie les deputes qui ont participe.
Madame la Presidente, je suis d'accord avec le depute.
La motion ne revet aucun caractere sectaire.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
M. Steve Mahoney (Mississauga-Ouest, lib.):
Madame la Presidente, je suis heureux d'avoir la possibilite d'intervenir dans le debat.
Elles correspondent en general a cette description.
Je partagerai mon temps de parole avec le depute de Charleswood St. James-Assiniboia.
Je veux ajouter que l'information est claire.
On ne projette absolument pas de modifier la definition legale du mot mariage.
Rappelons les origines de la situation actuelle.
Les tribunes etaient remplies de gens extremement bouleverses.
Comment avez-vous vote?
J'ai vote contre.
Mais on ne devrait pas en acquerir davantage pour le meme motif.
Ce ne devrait pas etre un principe fonde sur une definition.
Il serait de plus impossible de determiner le niveau des cotisations qui devraient etre versees.
Je crois savoir que tout cela comporte bien des problemes.
C'est de cela qu'il s'agit ici.
Cela ne contribuait pas au debat de facon constructive et c'est certainement premature.
Qu'est-ce que tout cela signifie vraiment?
Appelons un chat un chat.
Je ne le crois pas.
Nous ne devons exercer aucune discrimination fondee sur l'orientation sexuelle.
La regle s'applique dans les deux sens.
Je suis en faveur de la famille.
M. Jack Ramsay (Crowfoot, Ref.):
Madame la Presidente, mon collegue a aborde plusieurs de mes preoccupations.
Je voudrais lui poser brievement une question.
Le depute pourrait-il nous dire ce qu'il en pense?
C'est pourquoi nous avons presente le projet de loi C-78.
J'ai vote en faveur et je le ferais encore.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Il a immediatement su comment esquiver ma question.
Je ne vais pas le laisser s'en tirer a si bon compte.
J'aimerais qu'il reponde a cette question.
Elles ne sont pas basees sur la sexualite, mais sur ce que ca couterait.
M. Grant Hill (Macleod, Ref.):
Madame la Presidente, je voudrais essayer de poser cette question encore une fois.
Dans son intervention, le depute a dit clairement qu'il etait contre cela.
M. John Harvard (Charleswood St. James-Assiniboia, Lib.):
Au bout du compte, nous parlons des droits des minorites.
Je n'ai aucune difficulte a appuyer l'institution du mariage.
Je considere que c'est un element essentiel de la base de notre societe.
Je connais de l'interieur l'institution du mariage.
Je me suis marie pour la premiere fois il y a plus de 39 ans.
J'ai la femme parfaite, la compagne parfaite.
Le mariage est extremement important.
En tant que parlementaires, nous devons appuyer et favoriser cette institution.
Il y a peut-etre les reformistes.
Est-ce que les tribunaux canadiens demandent que les parlementaires modifient la definition du mariage?
Je n'en ai pas l'impression.
Je n'ai rien remarque de la sorte.
Rien n'est plus loin de la verite.
Cela me rappelle le Parti reformiste et la question de la taxe sur les hydrocarbures.
Autant que je sache, ce n'est pas le Parti liberal.
Je ne connais personne au Parti liberal qui veule une taxe sur les hydrocarbures.
Je ne crois pas que les neo-democrates le soient, pas plus que les bloquistes.
Ils aiment semer la panique.
Ils font la meme chose dans ce dossier.
Nous mettons fin a ces pratiques discriminatoires.
Ils forment une immense majorite.
Un tel parti ne dirigera jamais le pays.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Je n'ai rien entendu de tel.
La motion proposee aujourd'hui est tres simple.
Je vais la lire officiellement.
Madame la Presidente, je me ferai un plaisir de repondre a ces accusations sans fondement.
Elle ne contient rien de particulierement choquant.
Tous les deputes appuient le mariage.
Le probleme n'est pas la.
Elle parle simplement de l'egalite de traitement en ce qui concerne les avantages sociaux.
La motion ne porte que la-dessus.
Ce n'est pas plus complique.
Madame la Presidente, nous en arrivons donc au fond de l'affaire.
Le depute dit que les tribunaux ont deja modifie la definition.
Voici le texte de la resolution:
Ce n'est pas le cas.
La meme chose vaut pour la motion du Parti liberal.
Elle n'exige pas la revision de la definition du mariage.
M. Jim Pankiw (Saskatoon-Humboldt, Ref.):
Je commencerai par lire la motion que nous etudions aujourd'hui a la Chambre.
La motion proposee par le Parti reformiste se lit comme suit:
Evidemment, cette motion a ete malheureusement rejetee par les liberaux.
Ces efforts ont egalement echoue.
Passons maintenant au NPD.
Alexa McDonough et le NPD du Canada.
En fait, c'est exactement ce qu'ils font a la Chambre des communes.
Je vous lis a nouveau la politique officielle du Parti liberal:
C'est la la philosophie du NPD et du Parti liberal.
Dans la section sur l'egalite, on lit:
Dans la section sur la famille, on lit ceci:
Des manchettes recentes relevees dans certains journaux nationaux viennent illustrer mon point de vue.
Le Ottawa Citizen titrait: Les partenaires de meme sexe sont des conjoints:
Le London Free Press publiait la manchette suivante: Redefinition de nos liens :
La motion dit a ce tribunal que la definition juridique du mariage demeurera inchangee.
Madame la Presidente, le depute a parle du congres du Parti liberal.
Le depute a parle du congres du Parti reformiste et de la definition d'egalite.
Le Parti reformiste tient des congres tous les deux ans.
La volonte de la majorite des membres du parti determine le contenu des politiques.
M. John Cannis (Scarborough-Centre, Lib.):
Les reformistes qui sont intervenus plus tot semblent souffrir de cecite.
Nous sommes ici aujourd'hui pour defendre ce point.
Jamais il n'a ete question de mariage dans l'affaire M. et H.
J'ai prete une oreille tres attentive aux propos qui ont ete tenus jusqu'ici.
Ils vont se rendre compte ce soir.
Je crois qu'ils se trompent de tactique.
C'est la tactique fondee sur la peur dont a parle plus tot le depute.
Madame la Presidente, je reprendrais le depute sur un point.
Il a affirme: Nous croyons dans la famille traditionnelle.
M. Werner Schmidt (Kelowna, Ref.):
C'est ce qu'affirme notre motion.
Je veux faire trois choses.
La question est importante.
Est-ce simplement par pur esprit partisan?
Est-ce pour des objectifs bassement politiques ou autres choses du genre?
Ce n'est rien de la sorte.
Nous nous influencons mutuellement a la Chambre.
Par la reaffirmation de la definition, nous voulons influencer les juges.
Comment se fait-il que nous avons besoin de ces definitions?
Il a aussi des connotations spirituelles.
J'avoue que je suis un homme marie.
Nous avons vecu de merveilleuses annees de vie commune.
Je veux faire un rappel historique pour montrer a quel point les definitions sont importantes.
Cela me vient du domaine de la science.
Nous y trouvons une suggestion tres importante.
C'est ce dont nous parlons ici aujourd'hui.
Cela semble un peu perdu dans ce debat.
C'est de cela qu'il s'agit.
Quel choix s'offre donc a nous, ici, aujourd'hui?
C'est le choix evident que nous avons a faire aujourd'hui.
Pourquoi est-il si important que le Parlement fasse ce choix et prenne cette decision?
Les juges parlent aussi de l'Assemblee legislative.
Pourquoi est-ce si important de faire un choix?
M. Rick Casson (Lethbridge, Ref.):
Nous arrivons a la fin du debat.
J'ai eu de la chance.
Je me suis marie en 1967 et je suis encore marie a la meme personne.
C'est ce dont nous parlons aujourd'hui.
C'est la base des familles fortes.
Monsieur le President, a mes yeux, la famille est la cellule fondamentale de la societe.
Quand les parents ont des discussions ou des disputes, les enfants peuvent en etre temoins.
Ils peuvent en prendre conscience.
Ils voient que des solutions sont possibles.
Qu'est-ce que le mariage a a voir avec la famille?
Peut-on faire intervenir d'autres definitions de la famille?
Mais le mariage est absolument crucial au depart.
C'est ma conviction.
Je voudrais passer a une autre partie du discours du depute.
Je le remercie d'avoir pose cette question.
Je pense que ce debat est fondamental et qu'il donne une orientation.
Je suis fier de pouvoir faire cela.
M. John Maloney (Erie-Lincoln, Lib.):
Je suis tres heureux ce pouvoir participer a ce debat.
Cette definition a toujours ete appropriee et nous a bien servis jusqu'a maintenant.
Elle est encore appropriee et nous sert bien encore aujourd'hui.
Elle continuera de le faire a l'avenir.
Il n'y a aucune exception, aucune reserve, aucune limite.
L'enonce est clair et concis.
Le mariage est l'union de deux personnes de sexe oppose.
Cette cause a constamment fait jurisprudence au Canada.
Oui, monsieur le President, les tribunaux aussi.
Les mariages entre personnes du meme sexe ne favorisent en rien la famille.
Ils sont l'antithese de la famille.
J'encourage tous les deputes a l'appuyer.
Mme Elinor Caplan (Thornhill, Lib.):
Monsieur le President, je suis heureuse de participer au debat d'aujourd'hui.
Elle m'a demande ce que cela avait a voir avec le mariage.
Je lui ai dit que cela n'avait rien a voir.
Voila le role des tribunaux.
Mais la solution doit etre constitutionnelle.
Tel est le role que nous, Canadiens, avons confie a nos tribunaux.
Cela est souvent decrit comme etant de l'activisme judiciaire.
Ce n'est pas le cas.
Nos juges sont tres conservateurs.
J'espere que le debat d'aujourd'hui n'embrouillera personne.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
La deputee a dit que le gouvernement n'a pas de politique en ce sens.
Voila pourquoi les reformistes proposent aujourd'hui cette motion.
Voila pourquoi certains ont qualifie cette motion de faux-fuyant.
J'ai siege dans l'opposition.
Je vois clairement dans le jeu des reformistes.
Ils s'opposent pour le plaisir de protester.
Les tribunaux n'ont pas modifie la definition du mariage.
Le gouvernement n'a pas l'intention de modifier la definition du mariage.
Nous veillerons plutot a ce que les Canadiens ne soient pas victimes de discrimination.
M. Eric Lowther (Calgary-Centre, Ref.):
De cette facon, les gens n'ont pas voix au chapitre.
C'est de cela qu'il s'agit aujourd'hui.
Le gouvernement ne veut pas faire une telle chose.
M. Grant Hill (Macleod, Ref.):
J'ai trouve tout a fait fascinant de suivre le debat actuel.
Voici quelques-uns des indices que je constate.
Faut-il y apporter des clarifications?
Je crois que oui.
Devons-nous reaffirmer la definition du mariage?
J'ai constate une redefinition du conjoint.
Qu'en pensent mes propres electeurs?
Ils ont dit souhaiter que l'on conserve la definition traditionnelle du mariage.
Je reponds par un oui retentissant.
Voyons a l'etranger si on a tente de redefinir le mariage ailleurs.
Il n'y avait pas du tout de quoi plaisanter.
On s'y est pris autrement que par activisme judiciaire.
Dans les deux cas, la population a rejete la redefinition du mariage.
On a donc renonce a le redefinir.
Cela me dit si la question est sur la table ou non.
J'ai affirme egalement que cette campagne prevoyait quatre etapes.
La seconde consistait a redefinir le terme de conjoint.
La troisieme avait trait a l'adoption.
Et la quatrieme visait a redefinir le mariage.
Je suis tres heureux a l'idee que nos vis-a-vis comptent l'appuyer.
J'aimerais pourtant entendre les explications de ceux qui ne pourront le faire.
M. Tom Wappel (Scarborough-Sud-Ouest, Lib.):
Je voudrais feliciter sincerement le depute qui a presente cette motion.
Je suis d'accord sur tout ce qu'a dit le dernier orateur.
Je pense qu'il est imperatif que la Chambre se prononce la-dessus.
Le depute souscrirait-il a ces deux declarations?
Mme Eleni Bakopanos (Ahuntsic, Lib.):
Le depute de Yorkton-Melville avait dit:
Il a dit cela le 2 mai 1996.
Mes electeurs desapprouvent totalement.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Le Parti liberal du Canada propose un changement.
C'est son affaire.
Il peut gouverner ses propres affaires comme il l'entend.
Ce sont des propos alarmistes, auraient-ils dit.
Nous pouvons nous y referer.
Un dialogue est une conversation a deux sens.
Ce n'est pas un monologue.
Je ne peux pas imaginer que cela puisse etre une motion sujette a controverse.
Je ne peux pas imaginer que le Parti liberal puisse proposer de l'abandonner.
Il faut que cela soit clair.
M. John Herron (Fundy-Royal, PC):
Le depute est-il d'avis que ce devrait toujours etre le cas?
Madame la Presidente, tout a fait et je remercie le depute de son intervention.
Le mariage a une signification tres profonde.
Il a une certaine signification objective.
Il est bien evident que c'est ce que signifie le terme mariage.
C'est la l'essence meme du mariage.
Mais il y a toujours une certaine realite dont il faut tenir compte.
Cette motion ne sert qu'a reaffirmer cette realite metaphysique fondamentale.
M. Jack Ramsay (Crowfoot, Ref.):
Je voudrais que le depute reponde a cela.
Madame la Presidente, le depute de Crowfoot a tout a fait raison.
M. Real Menard (Hochelaga-Maisonneuve, BQ):
Je suis d'accord avec le Parti reformiste que nous devons discuter de ces questions.
Je ne suis pas d'accord, bien sur, avec le positionnement propose.
La motion du Parti reformiste se lit comme suit:
On voit le caractere imperatif de la motion.
Ce n'est pas de cela dont on parle.
Je veux ici faire un peu d'histoire.
Je sais que j'ai toute votre attention et ca me rejouit.
Ce jugement fut le debut d'une jurisprudence tres abondante.
Le gouvernement a d'ailleurs modifie la loi et nous lui en sommes reconnaissants.
On a donc eu le jugement Haig.
Le Conseil du Tresor a modifie cette loi.
Nous aurions souhaite qu'il y ait un projet de loi omnibus.
On parle d'a peu pres 70 lois.
C'est ce contre quoi les deputes du Parti reformiste en ont.
Ils ont d'ailleurs depose une motion contre le jugement Rosenberg.
Que ceux qui sont d'accord avec moi applaudissent maintenant.
Je demande a la secretaire parlementaire de garder son calme.
Je sens un debordement possible dans lequel je n'entends pas m'engager.
Pourquoi est-ce que personne ne peut le dire?
Parce que ce n'est pas ecrit dans le rapport d'impot.
Donc, personne ne peut dire a combien se chiffre la population gaie.
Souventes fois, ils sont engages dans leur communaute.
Je dis que meme si on legalisait le mariage, je ne m'y engagerais pas.
Je veux dedier ces arguments aux deputes reformistes, et j'espere qu'ils seront attentifs.
Ils se sont voue mutuellement respect, fidelite, secours et assistance.
Ils ont fait vie commune sans interruption depuis le debut de leur union.
Pourquoi est-ce que je fais cette demonstration?
Les conditions de fond relevent du gouvernement federal et je terminerai la-dessus.
Madame la Presidente, j'invoque le Reglement.
La presidente suppleante (Mme Thibeault):
La Chambre est-elle d'accord?
COMITES DE LA CHAMBRE
Madame la Presidente, je propose:
ENVIRONNEMENT ET DEVELOPPEMENT DURABLE
Madame la Presidente, je propose:
Madame la Presidente, je propose:
La Chambre reprend l'etude de la motion et de l'amendement.
M. Jason Kenney (Calgary-Sud-Est, Ref.):
Je voudrais comprendre ce qu'ils entendent faire?
C'est a l'honneur du Parti reformiste de l'avoir propose.
Je ne crois pas que cela existe de droit divin.
Je crois que c'est aussi une intervention du legislateur.
Mais j'espere que, avec une elegance toute genereuse, les parlementaires vont rejeter cette motion.
M. Garry Breitkreuz (Yorkton-Melville, Ref.):
Je comprends que beaucoup d'autres personnes voudraient en presenter aussi.
Peut-etre faudra-t-il prolonger le debat.
Nous parlons de la famille, de la cellule fondamentale de la societe.
Il est necessaire d'en discuter et d'envoyer un signal clair aux tribunaux.
Une seule chose: ce qu'il en coute pour ramasser les morceaux.
Le echec du mariage est peut-etre la plus grande cause de problemes sociaux.
Autrement dit, nous parlons de la famille.
Nous parlons des enfants.
Je ne vois pas la rationalite de ses propos.
Mais c'est dans sa definition de la famille, il y a un probleme.
M. Tom Wappel (Scarborough-Sud-Ouest, Lib.):
Je sais qu'il a de serieuses reserves a cet egard.
Cela s'appelle l'evolution.
Pourtant, maintenant, cela existe.
Je pense que cela doit etre aussi...
La presidente suppleante (Mme Thibeault):
Je regrette de devoir interrompre l'honorable depute.
Le vote porte sur l'amendement.
Plait-il a la Chambre d'adopter l'amendement?
La presidente suppleante (Mme Thibeault):
Le prochain vote porte sur la motion principale modifiee.
Plait-il a la Chambre d'adopter la motion telle que modifiee?
La presidente suppleante (Mme Thibeault):
Que tous ceux qui sont en faveur veuillent bien dire oui.
La presidente suppleante (Mme Thibeault):
Que tous ceux qui sont contre veuillent bien dire non.
La presidente suppleante (Mme Thibeault):
A mon avis, les oui l'emportent.
Et plus de cinq deputes s'etant leves:
La presidente suppleante (Mme Thibeault):
Madame la Presidente, j'invoque le Reglement.
lorsque nous nous sommes prononces sur l'amendement, j'ai entendu deux ou trois non.
La presidente suppleante (Mme Thibeault):
Je crains ne pas avoir entendu de non.
BUDGET PRINCIPAL DES DEPENSES, 1999-2000
APPROBATION DU CREDIT NO 1-PARLEMENT
L'hon. Don Boudria (au nom du President du Conseil du Tresor) propose:
Entendons-nous tous sur une chose.
Par consequent, il doit disposer des ressources necessaires pour s'acquitter de ce role.
Mon parti a plaide en faveur de ces changements dans un passe recent.
Notre gouvernement a fait de la modernisation de la federation une de ses principales priorites.
On ne modifie pas le Senat en lui coupant les credits.
Voila la condition prealable.
Cela ne reduit pas les credits.
Voila la condition prealable pour y parvenir en vertu de notre Constitution.
Ils avaient beaucoup d'autres sujets en tete.
Evidemment, poser la question c'est y repondre.
Je viens d'en donner un exemple.
Cela non plus, il ne faut pas l'oublier.
C'est un eminent Canadien, qui a ete ministre de l'Agriculture pendant plusieurs annees.
C'est un parlementaire qui a trois ou quatre decennies d'experience.
Ce sont des gens de calibre.
Il y a egalement Frank Mahovlich, personnalite reconnue mondialement, qui est membre du Senat.
Je n'en ai nomme que quelques-uns.
Voila le genre de personne qui nous represente a l'autre endroit.
On ne doit pas l'oublier non plus.
Dieu sait comment ces commissions peuvent couter cher, je me souviens de quelques-unes.
Ils ont contribue beaucoup a ce processus et continueront a le faire.
La position du gouvernement sur la reforme du Senat est simple.
En attendant, notre gouvernement poursuit la meme politique, soit une politique de sens commun.
L'hon. Lorne Nystrom (Regina-Qu'Appelle, NPD):
Il a declare qu'il n'y avait pas de consensus au sujet du Senat.
Le sondage indique un partage a peu pres egal des tendances.
Il a egalement parle de la possibilite de donner des credits au Senat.
C'est 16,1 p. 100 en deux ans.
Aucun n'a ete augmente de 16,1 p. 100 en deux ans.
Tous les Canadiens s'entendent la-dessus.
Le depute a parle d'augmentations pour cette annee et l'annee derniere.
Il a etabli une comparaison entre les deux Chambres.
Je ne reviendrai pas sur ce vote.
Nous avons vote, ce qui est fait est fait.
Voila qui semble aller de soi.
Je sais bien que le NPD a un faible pour les syndicats.
Ils ont parfois des divergences.
C'est le cas ici.
Il peut en parler au syndicat.
C'est son droit le plus strict.
Je le lui ai explique a plusieurs reprises a la Chambre.
Sa premiere proposition visait a reformer le Senat.
Quelle est l'idee?
Certains changeraient le nombre des senateurs d'une juridiction.
Des gens en face veulent un Senat triple-e.
Ils ont le droit de penser ainsi.
Personnellement, je ne pense pas que ce soit approprie et equitable.
Il doit y avoir une autre solution.
Chaque province canadienne a sa propre solution.
Oui, je suis d'accord avec lui.
Je prefererais que la selection des senateurs se fasse autrement quand la Constitution sera modifiee.
Mais la n'est pas la question.
M. Rob Anders (Calgary-Ouest, Ref.):
Cela fait un total de trente-huit sieges.
Qu'est-ce qui a change depuis ces fameuses paroles du premier ministre?
Voici la premiere citation:
Moi [...] j'appuie la reforme du Senat.
Voici la deuxieme citation:
Il est indispensable de reformer le Senat.
Le Senat doit etre elu, efficace et equitable.
On la retrouve dans le hansard du 24 septembre 1991.
Voici la troisieme citation:
Le gouvernement federal fera qu'il [le Senat] soit elu d'ici a deux ans.
En tant que premier ministre, je peux prendre des mesures pour que cela arrive.
Voici la citation suivante:
Vous voulez un Senat triple E et c'est ce que je veux moi aussi.
C'est une declaration faite au Star de Toronto le 2 fevrier 1990.
En voici une autre:
On retrouve ce passage dans le hansard du 14 mai 1991.
Et cette autre declaration le 1 er fevrier 1997:
Voici une derniere declaration:
Toutes ces declarations ont ete faites par le premier ministre.
Je ne peux faire autrement, puisqu'il a cite le premier ministre.
Le premier ministre s'est montre tres franc.
Il est en faveur de la reforme du Senat.
Que faisaient le depute et ses collegues?
La presidente suppleante (Mme Thibeault):
M. John Solomon (Regina-Lumsden-Lake Centre, NPD):
A cette epoque, j'ai eu 39 p. 100 du vote populaire.
Combien de temps allons-nous continuer a verser cet argent a ces deux criminels?
Essentiellement, je ne suis pas en faveur d'abolir le Senat.
Mais l'abolir carrement, c'est autre chose.
Je serais contre ca.
Je le repete, je ne suis pas en faveur d'abolir le Senat.
Je voudrais qu'on l'ameliore.
C'est ce que veulent les Canadiens a mon avis.
Madame la Presidente, j'invoque le Reglement.
La presidente suppleante (Mme Thibeault):
Y a-t-il consentement unanime a cet effet?
M. John Williams (St. Albert, Ref.):
Madame la Presidente, je vais commencer mon discours.
Toutefois, maintenant qu'ils sont au pouvoir, ils ne font rien a ce sujet.
Il y a deux choses importantes a souligner relativement au Senat.
C'est pour cette raison que le Parti reformiste dit que les choses doivent changer.
C'est indeniablement un progres.
Nous savons quelle est la position du NPD.
Le progres peut etre d'une lenteur exasperante, mais c'est un progres.
Il faut reformer le Senat.
Le gouvernement pourrait donner l'elan a une reforme s'il le voulait.
Le Parti reformiste a dit qu'il fallait reformer le Senat.
Le gouvernement parle de la reforme du Senat.
Le NPD prone l'abolition du Senat.
Peut-etre ferons-nous des progres un jour.
J'ai rendu public un rapport sur le gaspillage aujourd'hui.
On peut le consulter sur Internet.
Jetons un coup d'oeil a certaines depenses de l'Office national du film.
Que renferme encore ce rapport?
L'imagination ne peut faire autrement que s'emballer un peu.
Le depute en demande plus.
Que penser de Frank the Wrabbit?
Il faut vraiment retenir notre imagination.
Ce film explique comment les lapins et les humains expriment et justifient leurs croyances.
Nous allons passer des lapins aux rats.
L'Office national du film a ete si enthousiaste qu'il a debourse 140 000 $.
Puis, nous en revenons a la pornographie.
Mon rapport sur le gaspillage se poursuit.
Il a dit que cela allait nous couter cher.
C'etait aussi simple que cela.
Est-ce une bonne affaire?
Cela va couter une fortune aux contribuables.
Les contribuables ont fini par payer 3 millions de dollars.
C'est a se demander si c'etait seulement legal.
Une seule succursale a accorde 30 de ces franchises et elles ont toutes mal tourne.
Nous payons la note.
Le verificateur general nous l'a dit en 1997 et nous le voyons aujourd'hui.
Il y a le cas des ordinateurs qui marchent.
Dans mon dernier rapport sur le gaspillage, j'ai parle des ordinateurs qui marchent.
On ne le rapporte meme pas a la police.
Nous en faisons les frais.
Les contribuables en font les frais.
Ils les volent carrement et gardent l'argent pour eux.
On ne peut plus continuer de tolerer cela.
Pourtant, les liberaux continuent de le faire.
On se demande ensuite pourquoi il faut toujours payer davantage a ce chapitre.
L'ouverture et la transparence sont des caracteristiques absolument fondamentales d'une saine democratie.
Tout doit donc rester confidentiel.
On y recommandait trois choses fondamentales.
Deuxiemement, avec quelle efficacite atteint-on les objectifs d'une politique gouvernementale donnee.
Lorsqu'elle est articulee, on peut la mesurer.
Toutefois, le gouvernement ne veut pas de mesure.
Il y a partout du gaspillage et de la mauvaise gestion.
On pourrait certes ameliorer la situation.
Peut-on atteindre les memes resultats en utilisant une facon differente?
Un changement exigerait un trop grand effort.
On ne veut pas adopter la reddition de comptes au gouvernement.
C'etait la defense du statu quo.
La reaction a la question des credits etait une defense du statu quo.
Le gouvernement a la responsabilite de gerer le pays.
L'hon. Lorne Nystrom (Regina-Qu'Appelle, NPD):
En theorie, l'idee est interessante.
La proposition a evidemment ete rejetee lors du referendum.
Le depute est un homme frugal qui se soucie du tresor public.
Nous consacrons environ 60 millions de dollars par annee au Senat existant.
Combien de temps allons-nous encore essayer de le reformer?
Cela fait penser au chien qui court apres sa queue.
Le depute de Sarnia le confirme.
Il y a environ un an, ce chiffre passait a 45 p. 100 environ.
Un autre parle d'une Chambre des provinces ou d'une Chambre de la confederation.
Le depute de Calgary penche peut-etre pour des pouvoirs differents et varies.
Il se pourrait qu'on n'arrive jamais a trouver ce consensus.
Combien de temps devons-nous attendre, monsieur le President?
M. John Herron (Fundy-Royal, PC):
Je crois que l'idee d'une Chambre haute elue est vouee a l'echec.
C'est un conservateur qui parle.
Monsieur le President, nous devons penser aux choses qui n'aboutiront pas.
M. Rob Anders (Calgary-Ouest, Ref.):
Monsieur le President, je veux lancer un defi a mon collegue.
Je ne veux pas rester trop vague.
Je l'ai eu!
Un bon point pour moi.
M. Roger Gallaway (Sarnia-Lambton, Lib.):
Il s'agit d'un debat sur les motions de credits.
On nous dit que le Senat est un organe legitime.
Du point de vue juridique, c'est absolument correct.
Aujourd'hui, le Senat du Canada est un organe legitime du point de vue juridique.
C'est la moitie du Parlement du Canada.
Les senateurs etaient plus instruits, plus mondains et plus ouverts sur l'exterieur.
En general, les senateurs etaient des gens favorises.
C'etait tres acceptable.
Toutefois, 132 ans plus tard, beaucoup de choses ont change au pays.
En 1867, nous n'avions pas de cour supreme.
Elle n'allait pas arriver avant le gouvernement d'Alexander Mackenzie dans les annees 1870.
Qu'avons-nous 132 ans plus tard?
Nous avons une Cour supreme qui a vu le jour en 1949.
Jusque la, nos appels etaient toujours renvoyes au Conseil prive en Grande-Bretagne.
Ce sont tous des controles exerces sur la Chambre des communes.
Le Senat ne travaille que 66 demi-journees par annee environ.
La legitimite politique les a laisses en plan.
Toutefois, ils se trouvent toujours dans un endroit qui leur confere une certaine legitimite juridique.
Ils sont sur place et ils ont un travail a accomplir.
Nous avons entendu parler de sondages aujourd'hui.
C'est une obligation legale.
Le budget du Senat contient huit rubriques, dont information et location.
Que signifie tout cela?
Je n'en ai pas la moindre idee.
Il est facile de dire que les senateurs font leur travail.
Il n'y a rien a redire a ce sujet.
Ils ont un travail a accomplir et ce mandat est inscrit dans notre Constitution.
Il a ete coule dans le beton en 1867.
Nous ne devrions pas considerer cela comme une proposition a prendre ou a laisser.
Ce n'est evidemment pas le cas.
La premiere recommande zero dollar pour le Senat.
La deuxieme propose zero dollar pour le Senat.
Qu'y a-t-il au Senat?
Nous pouvons tous comprendre cela et l'accepter.
Il est certain que les fonctionnaires n'ont touche aucune augmentation depuis des annees.
Mais il y a une chose qu'il importe de souligner.
C'est mon avis.
Tout ce que les Canadiens demandent, c'est que leurs institutions politiques soient raisonnables.
J'ai remarque que personne n'obtient ce genre d'augmentation.
Le Senat dit qu'il fait son travail.
Dans une certaine mesure, il a un travail a faire.
Certains representants des medias m'ont appris que cette manifestation inquietait le Senat.
Je ne sais pas.
Nous avons le droit, quant a nous, de nous prononcer sur les credits.
Nous pourrons defendre la these du changement a une autre occasion.
Toutefois cette instance se retranche derriere ses prerogatives institutionnelles pour resister au changement.
Je ne veux pas parler de changements profonds comme une reduction du nombre de senateurs.
Il ne saurait etre question de modifier le mandat prevu par la Constitution.
Le Senat nous dit que nous n'avons pas le choix.
Sans quoi il y aura greve.
M. John Solomon (Regina-Lumsden-Lake Centre, NPD):
Il pourrait repondre d'un signe de la tete.
Le depute n'a jamais entendu parler de M. Balfour.
Il etait un copain du premier ministre et est d'allegeance conservatrice.
M. Balfour vient de Regina, ma ville natale.
Monsieur le President, je remercie le depute neo-democrate de poser la question.
Je dois dire que je n'ai jamais entendu parler de cette personne.
Je n'ai pas l'habitude de parler des gens de l'autre endroit.
Je tiens a repondre de facon generale a la question du depute.
La Chambre des lords est identique a notre Senat au plan de la responsabilite.
Les lords ne sont payes que s'ils sont presents.
La remuneration est liee au rendement.
Je comprends que des membres de l'autre endroit croient representer aussi leur region.
Je suis du sud-ouest de l'Ontario.
Cela fait deux ans que le sud-ouest de l'Ontario a un senateur.
Je l'aime bien et tout cela.
M. Rob Anders (Calgary-Ouest, Ref.):
J'ai une question pour mon collegue.
Le Senat a-t-il des comptes a rendre aux contribuables?
Le Senat estime quant a lui qu'il n'en a pas.
A mon avis, le Senat n'a pas de comptes a rendre aux contribuables.
A qui les senateurs rendent-ils des comptes?
Je suis d'accord pour dire que le Senat n'est pas comptable aux contribuables.
Cela ne fait aucun doute.
Est-il comptable a la Chambre des communes?
Le Senat est-il comptable au premier ministre?
Je pense que la reponse est non, mais on pourrait en debattre.
Evidemment, ils etaient comptables aux autres premiers ministres, mais ils sont partis.
Je crois que ma position la-dessus est bien connue.
Monsieur le President, je voudrais poser une autre question au depute.
Le president suppleant (M. McClelland):
Monsieur le President, je comprends ce que le depute veut dire par sa question.
C'est beaucoup d'argent.
Ce sont les seules personnes auxquelles je peux penser.
L'hon. Lorne Nystrom (Regina-Qu'Appelle, NPD):
Monsieur le President, je veux dire quelques mots sur la motion a l'etude.
C'est environ la moitie de ce que le Senat depense en une annee.
Le Senat coute donc environ 60 millions de dollars par annee.
Par annee, et ce budget augmente presque chaque annee.
Le depute de Regina-Lumsden-Lake Centre juge que cela fait beaucoup d'argent.
On va depenser 60 millions de dollars.
Il n'a pas voulu.
Chaque ministere doit comparaitre devant le comite pertinent de la Chambre.
Je le vois malgre la distance qui nous separe.
Ses electeurs le surveillent en changeant de chaine ce soir.
Aucun senateur n'a justifie les depenses.
Ils n'agissent pas de la sorte.
Le depute de Sarnia-Lambton ne savait pas qui etait le senateur James Balfour.
Les electeurs peuvent tous appeler un senateur en faisant le 1-800-267-7362.
Est-ce que le depute de Regina-Lumsden-Lake Centre se souvient de ce numero?
Est-ce que le depute de Calgary se souvient de ce numero?
Voila ce que les Canadiens devraient faire ce soir et demain.
Decrocher le telephone et appeler le senateur de leur choix.
Voila ce que les gens devraient faire.
Il y a eu une petite manifestation a l'exterieur de la Chambre aujourd'hui.
Il n'y avait aucun depute du Parti conservateur.
Aucun d'entre eux ne s'est presente.
Leur caucus est domine par des senateurs.
Ils n'etaient pas au rendez-vous.
Il y a bon nombre de senateurs au sein de ce caucus.
Ils auraient pu manifester contre l'enorme ponction pratiquee par le Senat du Canada.
Environ 5 p. 100 appuie le Senat tel qu'il est.
Les autres souhaitent qu'il soit aboli, reforme, a tout le moins modifie.
On a essaye de le faire pendant des annees.
Voila 132 ans que le Senat existe.
En 1867, les gens elisaient la Chambre des roturiers.
Les gens etaient des roturiers.
Ce quelqu'un, c'etait la Chambre des lords ou le Senat.
Je crois que nous ne pourrons jamais reformer le Senat.
Il y a 130 000 habitants a l'Ile-du-Prince-Edouard.
Je crois que ca n'arrivera jamais.
Il faudrait faire disparaitre une bonne partie de ces pouvoirs.
Je pense egalement a la Cour supreme et aux juges federaux.
C'est une personne formidable.
Je n'ai rien contre lui.
Mais il n'aurait pas du etre nomme a ce poste.
Je crois egalement que nous devrions retirer d'autres pouvoirs au premier ministre.
Nous devrions egalement examiner cette question.
J'aimerais faire ce soir un dernier commentaire qui est un peu plus radical.
Un peu plus radical.
J'ai presente un projet de loi d'initiative parlementaire a ce sujet.
On donnerait ainsi une certaine representation regionale a l'institution centrale qu'est le Parlement.
Le taux de participation a chute au cours des 30 dernieres annees.
En 1968, 80 p. 100 des electeurs avaient vote.
Pourquoi gaspiller mon vote?
Les politiciens n'ecoutent pas.
Mon vote ne semble faire aucune difference.
Dans bien des cas, c'est tout a fait vrai.
Elles ont eu lieu en 1945, avec Mackenzie King, et en 1958, avec John Diefenbaker.
Il existe d'autres distorsions a la Chambre des communes.
Le Parti conservateur a obtenu 20 sieges et le Parti reformiste, 60 sieges.
Nous avons obtenu la meme proportion de votes que le Bloc quebecois.
Par consequent, la plupart des gens considerent que leur vote est gaspille.
La plupart des Canadiens ont vote pour des candidats perdants.
On pourrait voter neo-democrate dans le sud de l'Alberta, et les votes compteraient.
On pourrait voter reformiste a Terre-Neuve, et les votes compteraient.
On pourrait meme voter conservateur en Saskatchewan, et les votes compteraient.
Tous les autres regimes parlementaires ont cela, sauf celui du Canada.
Ce qu'il nous faut au Canada, c'est beaucoup de democratie.
Il faut laisser participer les gens.
Il faut laisser entendre la voix de la population.
Il faut laisser les gens dire ce qu'ils veulent au Canada.
C'est la voie que nous devrions suivre.
Est-ce que quelqu'un peut etre d'accord avec cela?
Pourquoi se sont-ils prononces comme cela?
Ce sont des conservateurs, mais il reste que ce sont 132 ans de statu quo.
Comment peuvent-ils se prononcer de cette facon, pour l'amour du ciel?
Je sais que le depute a fait campagne en faveur de David Orchard.
Nous avons serieusement besoin d'une reforme parlementaire et electorale.
M. Jean-Paul Marchand (Quebec-Est, BQ):
La reaction dans le comte a ete extremement virulente.
Le numero du Senat va peut-etre disparaitre bientot si les gens continuent d'appeler.
De cette facon, les senateurs seront encourages a prendre leur retraite.
Monsieur le President, je suis d'accord avec mon ami, le depute de Quebec-Est.
Nous avons besoin du consentement unanime pour beaucoup de choses.
Pour d'autres, ce sont les dispositions de l'article 42 qui s'appliquent.
Je suis donc d'accord avec l'honorable depute.
M. Gerald Keddy (South Shore, PC):
Monsieur le President, j'ai ecoute tres attentivement le depute de Regina-Qu'Appelle.
Il a fait valoir de bons arguments.
Il est incontestable que la population canadienne n'appuie pas un Senat non elu.
J'aimerais que le depute me donne son opinion la-dessus.
Donnons-nous un Senat elu.
Faisons quelque chose en ce sens.
Prenons une mesure progressive et positive.
J'appuie une reforme du Senat, mais je n'appuie pas son abolition.
C'est aussi simple que cela.
J'aimerais que le depute me donne son opinion la-dessus.
Monsieur le President, je ne sais pas vraiment ce que je pourrais dire de plus.
Pollara a fait un sondage ou ce pourcentage est legerement plus eleve.
Nous devrions unir nos efforts pour nous debarrasser du statu quo.
J'aimerais que nous ayons un vrai debat sur cette question.
A ce moment-la, je continuerais evidemment d'appuyer l'abolition du Senat.
Si le Senat est elu, il est legitime.
Il me semble que le Parti reformiste a toujours denonce cela.
M. John Williams (St. Albert, Ref.):
A la page 3, le paragraphe 6(2) du projet de loi est ainsi libelle:
Le president suppleant (M. McClelland):
LE BUDGET PRINCIPAL DES DEPENSES, 1999-2000
ADOPTION DU CREDIT NO 1-PARLEMENT
La Chambre reprend l'etude de la motion no 1.
M. Rick Borotsik (Brandon-Souris, PC):
Le Bloc ne sera jamais au pouvoir.
Pour ce qui est du Parti reformiste, nous ne savons pas ou il se trouve.
Ce serait mieux pour les Canadiens qu'ils ne reviennent pas a la Chambre.
Je voudrais aborder quelques points.
Nous devons etudier les credits de nombreux ministeres importants.
Mais nous preferons consacrer ce debat a casser du sucre sur le dos du Senat.
Monsieur le President, si les deputes ecoutaient, ils pourraient peut-etre apprendre quelque chose.
Mais nous n'allons pas entamer ce genre de debat.
J'ai un avantage, car mon parti compte certains membres qui siegent au Senat.
Monsieur le President, j'invoque le Reglement.
Je me demande si vous pourriez vous prononcer sur la pertinence de cette intervention.
Le president suppleant (M. McClelland):
Pas du tout, monsieur le President.
Ce dernier a fait un travail admirable.
Les senateurs ont ecoute le public canadien.
Le Senat a ete comptable au public canadien.
C'est le systeme des freins et contrepoids.
D'un trait de plume, le Parti reformiste abolirait le Senat.
Le Parti reformiste n'a pas de plans.
Le Senat doit-il etre reforme?
Evitons les inepties vitrioliques.
Voici quelques-unes des idees proposees dans l'accord de Charlottetown.
Cet accord visait precisement a restructurer le Senat.
Qui s'y est oppose?
C'est que les reformistes n'accordent guere d'importance a la question du gouvernement.
Voici ce que je pense du Senat.
Le Senat m'a aide a faire le travail que j'accomplis.
J'ai eu cette chance.
Ils sont tres accessibles et tres ouverts.
Demandez-leur leur opinion.
Il y a du bon et du mauvais dans l'une et l'autre Chambres.
Ou se retrouverait-on?
Veut-on que l'Ontario dirige le Canada?
Le Parti reformiste repete constamment que l'Ouest veut avoir son mot a dire.
Nous avons parle d'un Senat elu.
Ils preferent tout simplement appuyer sur le bouton.
J'ai etudie le systeme americain.
Je regarde le Senat americain qui est elu.
Ils n'avancent a rien.
Ils se nuisent mutuellement.
Ce n'est pas bon pour la democratie non plus.
Je ne suis pas convaincu de la valeur d'un Senat elu.
Je parlerai maintenant de la reforme que comportait l'accord de Charlottetown.
A un moment donne, un senateur etait nomme a vie.
Devrait-on limiter le mandat?
Personnellement, je pourrais appuyer une mesure limitant la duree de la nomination d'un senateur.
Rien de mal a ca.
Nous le faisons a la Chambre.
Nos indicateurs de performance et notre norme, ce sont les resultats des elections.
Le Senat devrait avoir de telles mesures et normes, lui aussi.
On a aussi dit que les senateurs ne faisaient rien.
Il fallait proteger le patrimoine canadien de toute urgence.
Nous allions nous assurer que nous ne reculerions pas devant les Americains.
C'etait une mesure legislative qui etait absolument necessaire.
Ou se trouve maintenant le projet de loi C-55?
Le gouvernement devra rendre des comptes a cet egard.
Il vise a enlever aux pensionnes l'argent de leurs pensions.
Le gouvernement sera oblige de rendre des comptes grace a ce systeme de contrepoids.
Qu'on me comprenne bien.
Ce n'est pas la bonne facon de proceder.
Parce que le Parti reformiste veut taper sur le Senat.
Voila tout ce qu'il veut faire.
Les Canadiens y perdent franchement quand ils sont representes par le Parti reformiste.
J'ai foi dans les electeurs.
Je crois que les electeurs prennent la bonne decision.
En l'occurrence, ils ont certes pris la bonne decision.
M. John Solomon (Regina-Lumsden-Lake Centre, NPD):
Je ne l'ai jamais rencontre.
La ville de Regina est pourtant une petite ville d'a peine 200 000 habitants.
L'un d'entre eux etait d'ailleurs Eric Berntson qui est maintenant devenu senateur.
Pour 50 millions de dollars, je n'ai certainement pas de scrupule a la conserver.
Cela ne veut pas dire qu'il faille maintenir le statu quo.
Au lieu de cela, il ont vote contre.
Ce serait fait maintenant.
M. Rob Anders (Calgary-Ouest, Ref.):
J'ai personnellement recueilli des petitions sur la reforme et sur l'election du Senat.
D'autres deputes ont recueilli des petitions sur la question de l'abolition du Senat.
Ils n'ont eu de reponse ni des senateurs ni du bureau du premier ministre.
Le depute a parle d'appeler les senateurs et le bureau du premier ministre.
Le depute neo-democrate a mentionne le numero.
Je demande au depute si...
Monsieur le President, j'invoque le Reglement.
Il est en train d'ecrire au dos de la note.
Le president suppleant (M. McClelland):
Le depute de South Shore a entierement raison.
J'aurais du l'arreter immediatement.
Monsieur le President, je m'excuse.
Il etait question du premier ministre aussi.
Le president suppleant (M. McClelland):
Que j'aie laisse faire le depute une fois, honte a moi.
Mais deux fois, non reellement, c'est trop.
Monsieur le President, je ne vois rien de profond dans ces commentaires.
En fait, les gens n'ont pas besoin de faire le 1-800.
Que va-t-il faire?
M. Ted McWhinney (Vancouver Quadra, Lib.):
Je cherche le qualificatif qui convient.
Monsieur le President, le Manitoba a deja le tiers des 20 % des sieges.
Nous avons actuellement sept senateurs.
Vous n'en avez que six.
C'est juste, excusez-moi.
Je cherchais celui de Regina.
Il m'a echappe.
Meme vous ne savez pas ou il en est.
Je ne le sais pas.
Je cherchais le septieme senateur.
Je peux dire tres honnetement au depute que ce serait evidemment une modification constitutionnelle necessaire.
Je suis pret a envisager tout ce qui peut nous assurer une meilleure representation.
M. Stephane Bergeron (Vercheres-Les-Patriotes, BQ):
Rappelons un peu le contexte qui a mene a sa creation.
M. Stephane Bergeron: ...vieillissante, c'est le moins qu'on puisse dire.
Il faut le faire.
Quel est le credit democratique d'une telle institution?
Ces gens passent par la colere, le desarroi et l'indignation.
Mais c'est l'institution elle-meme, de par sa nature propre, qui pose probleme.
Absolument toutes les legislatures provinciales se sont debarrassees de leur conseil legislatif.
Non, cela n'a absolument aucun rapport.
M. Ted McWhinney (Vancouver Quadra, Lib.):
Je donne un autre exemple.
M. Real Menard (Hochelaga-Maisonneuve, BQ):
Monsieur le President, je remercie mon collegue de Vercheres-Les-Patriotes pour son excellent expose.
En sa qualite de politocologue, il connait evidemment bien ces questions.
Monsieur le President, je remercie mon collegue de Hochelaga-Maisonneuve de sa question.
Je pense qu'il a bien situe le probleme.
Nous avons deja, au Quebec, le sentiment de payer pour une double structure.
Au Quebec, chaque senateur represente ce qu'on appelle un district senatorial.
Les choix qui sont faits par ce gouvernement sont totalement inacceptables.
M. Ted McWhinney (Vancouver Quadra, Lib.):
Cette definition etroite n'est pas le seul fait de nos vis-a-vis.
Nous avons, nous aussi, notre part des responsabilites a assumer.
Il se plaignait d'etre oblige de prendre sa retraite a cet age.
Seul le gouvernement federal dispose de ce pouvoir.
Il serait possible d'etendre la limite d'age.
A moins que nous n'adoptions la voie ultime de l'assemblee constituante.
Il n'y a pas de preuve en ce sens.
Nous devons revoir la relation entre le pouvoir executif et le pouvoir legislatif.
Mais ces aspects ont ete gravement negliges.
Il manque quelque chose, de toute evidence: une reflexion un peu plus globale.
Un corps legislatif ne devrait-il pas faire cela?
Il est parfaitement evident que la Chambre des communes ne peut pas le faire.
La cause de la reforme du Senat est interessante.
C'est une realite.
Je crois que les suggestions qui ont ete faites sont valables.
Allons-nous eviter ces grandes questions?
J'ai souleve la question.
Je pense que la prochaine generation de Canadiens aura rendez-vous avec la Constitution.
M. Real Menard (Hochelaga-Maisonneuve, BQ):
Monsieur le President, je remercie mon collegue pour son intervention.
Je sais qu'il s'interesse beaucoup a ces questions.
Je vais lui rappeler un bon souvenir.
Je m'explique mal comment nous pouvons nous interesser a reformer le mode du scrutin.
M. Rob Anders (Calgary-Ouest, Ref.):
Monsieur le President, je voudrais commencer ma question par une citation qui dit:
Je [...] suis en faveur de la reforme du Senat.
Ce doit etre un Senat qui sera elu, efficace et equitable.
En tant que premier ministre, je prendrai les mesures pour qu'il le devienne.
Je le demande au depute:
Qui pourrait bien etre cette personne?
Il y a lieu d'attribuer a Cesar ce qui revient a Cesar.
M. Rob Anders (Calgary-Ouest, Ref.):
Monsieur le President, je partagerai mon temps de parole avec le depute de Langley-Abbotsford.
Les senateurs sont obsedes, mais il faut que la verite eclate.
Je voulais que ces raisons paraissent au compte rendu parce que c'est tres important.
M. Randy White (Langley-Abbotsford, Ref.):
Je pense a certains cas qui sont survenus recemment a la Chambre des communes.
Dans sa grande sagesse, le gouvernement a ramene cet age a 14 ans.
Voyons d'autres choses qui se sont produites.
Apres avoir parle a certains senateurs, je crois que la reponse est probablement non.
Ce qui est arrive, c'est que le gouvernement a dit: Cela va se faire.
Voila le probleme que pose un Senat non elu qui n'est pas efficace.
C'est tout a fait deplace.
M. Randy White (Langley-Abbotsford, Ref.):
Que le premier ministre nous donne...
Qui etait ce depute?
Il est ici egalement.
C'etait la deputee de Beaver River.
Le fait est que bien des Canadiens ont vote contre ceci.
Oui, les problemes lies a la drogue sont tres serieux chez nous.
Le temps des etudes est passe depuis longtemps.
En Colombie-Britannique, on en compte 15 000.
Le rapport parle d'un montant de 1 057 933 $ consacre au Canadian Canoe Museum.
Ou se nichent les priorites du gouvernement?
Les deputes d'en face ne savent pas de quoi ils parlent.
Le president suppleant (M. McClelland):
Je dois maintenant interrompre le depute.
LE PROJET DE LOI DE CREDITS-DECISION DE LA PRESIDENCE
Cette mention est a la fois inutile et trompeuse.
Je remercie le depute de St. Albert pour sa vigilance.
Monsieur le President, j'invoque le Reglement.
JOUR DESIGNE-LE TRAITE CONCLU AVEC LES NISGA'AS
Le vote porte sur l'amendement.
(L'amendement, mis aux voix, est rejete.)
Je declare l'amendement rejete.
Est-on d'accord pour proceder de cette facon?
(La motion, mise aux voix, est rejetee.)
Je declare la motion rejetee.
La Chambre reprend l'etude de la motion.
Le vote porte sur la motion principale modifiee.
Plait-il a la Chambre d'adopter la motion?
Que tous ceux qui sont en faveur de la motion veuillent bien dire oui.
Que tous ceux qui sont contre veuillent bien dire non.
A mon avis, les oui l'emportent.
Et plus de cinq deputes s'etant leves:
(La motion, mise aux voix, est adoptee par le vote suivant:)
Je declare la motion modifiee adoptee.
LE BUDGET PRINCIPAL DES DEPENSES POUR 1999-2000
ADOPTION DU CREDIT NO 1-PARLEMENT
La Chambre reprend l'etude de la motion no 1.
Le vote porte sur la motion no 1.
Plait-il a la Chambre d'adopter la motion?
Que tous ceux qui sont en faveur de la motion veuillent bien dire oui.
Que tous ceux qui sont contre la motion veuillent bien dire non.
A mon avis, les non l'emportent.
Et plus de cinq deputes s'etant leves:
Monsieur le President, j'invoque le Reglement.
Nous faisons face a une situation quelque peu differente.
Dans l'affirmative, j'aimerais que ces personnes se levent immediatement.
(La motion no 1, mise aux voix, est adoptee.)
Je declare la motion adoptee.
Le vote suivant porte sur la motion no 2.
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
Plait-il a la Chambre d'adopter la motion?
La Chambre est-elle d'accord pour proceder de la sorte?
Monsieur le President, en depit de Bubbles Galore , nous votons contre la motion.
Monsieur le President, les deputes du Bloc quebecois s'opposent a cette motion.
Monsieur le President, les deputes progressistes-conservateurs s'opposent a cette motion.
Monsieur le President, je voterai en faveur de la motion.
Monsieur le President, je voterai en faveur de la motion.
M. Lawrence D. O'Brien:
Monsieur le President, je voterai en faveur de la motion.
Monsieur le President, je voterai en faveur de la motion.
(La motion no 2, mise aux voix, est adoptee.)
Je declare la motion adoptee.
La Chambre consent-elle a proceder de cette facon?
ADOPTION DU CREDIT NO 1-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX CANADA
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
Le vote porte sur la motion no 3.
Monsieur le President, les deputes du Parti reformiste presents votent contre cette motion.
Monsieur le President, les deputes du Bloc quebecois s'opposent a cette motion.
Monsieur le President, les deputes du NPD votent contre cette motion.
Monsieur le President, les deputes progressistes-conservateurs presents votent non sur cette motion.
Monsieur le President, au nom des residents de York-Sud-Weston, je vote oui.
(La motion no 3, mise aux voix, est adoptee.)
Je declare la motion adoptee.
Y a-t-il consentement pour proceder de cette facon?
ADOPTION DU CREDIT NO 5-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX CANADA
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
(La motion no 4, mise aux voix, est adoptee.)
ADOPTION DU CREDIT NO 10-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX CANADA
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
(La motion no 5, mise aux voix, est adoptee.)
ADOPTION DU CREDIT NO 15-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX CANADA
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
(La motion no 6, mise aux voix, est adoptee.)
ADOPTION DU CREDIT NO 25-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX CANADA
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
(La motion no 7, mise aux voix, est adoptee.)
ADOPTION DU CREDIT NO 30-TRAVAUX PUBLICS ET SERVICES GOUVERNEMENTAUX
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
(La motion no 8, mise aux voix, est adoptee.)
Je declare donc les motions nos 4, 5, 6, 7 et 8 adoptees.
L'hon. Marcel Masse (president du Conseil du Tresor, Lib.) propose:
La Chambre consent-elle a proceder de cette facon?
Monsieur le President, les deputes reformistes presents voteront non sur cette motion.
Monsieur le President, les deputes du Bloc quebecois votent non sur cette motion.
Monsieur le President, les deputes neo-democrates votent contre cette motion.
Monsieur le President, les deputes progressistes-conservateurs presents votent non sur cette motion.
(La motion, mise aux voix, est adoptee.)
Je declare la motion adoptee.
(La motion est adoptee et le projet de loi est lu pour la premiere fois.)
Plait-il a la Chambre d'adopter la motion?
Y a-t-il consentement unanime pour proceder de cette facon?
(La motion, mise aux voix, est adoptee.)
Je declare la motion adoptee.
Nous sommes maintenant en comite plenier sur le projet de loi C-86.
M. John Williams (St. Albert, Ref.):
L'article 2 est-il adopte?
(L'article 2 est adopte.)
L'article 3 est-il adopte?
(L'article 3 est adopte.)
L'article 4 est-il adopte?
(L'article 4 est adopte.)
L'article 5 est-il adopte?
(L'article 5 est adopte.)
L'article 6 est-il adopte?
(L'article 6 est adopte.)
L'article 7 est-il adopte?
(L'article 7 est adopte.)
L'annexe 1 est-elle adoptee?
(L'annexe 1 est adoptee.)
L'annexe 2 est-elle adoptee?
(L'annexe 2 est adoptee.)
L'article 1 est-il adopte?
(L'article 1 est adopte.)
Le preambule est-il adopte?
Le titre est-il adopte?
Plait-il a la Chambre d'adopter la motion?
Est-on d'accord pour proceder de cette facon?
Monsieur le President, les deputes reformistes presents votent contre.
Je vous fait remarquer que le depute de Calgary-Centre est absent.
Monsieur le President, les deputes du Bloc quebecois s'opposent a cette motion.
Monsieur le President, les deputes neo-democrates presents votent contre cette motion.
Monsieur le President, je vote en faveur de la motion.
(La motion, mise aux voix, est adoptee.)
Je declare la motion adoptee.
Y a-t-il consentement pour l'on procede de cette facon?
Que tous ceux qui sont en faveur de la motion veuillent bien dire oui.
Que tous ceux qui sont contre veuillent bien dire non.
A mon avis, les non l'emportent.
Et plus de cinq deputes s'etant leves:
(La motion, mise aux voix, est adoptee.)
Je declare la motion adoptee.
(Le projet de loi est lu pour la troisieme fois et adopte.)
(La seance est levee a 23 h 38.)
|
subroutine cosmo_fock(basis, g)
implicit none
#include "errquit.fh"
#include "cint1cache.fh"
#include "mafdecls.fh"
#include "global.fh"
#include "rtdb.fh"
#include "inp.fh"
#include "apiP.fh"
#include "bas.fh"
#include "cscfps.fh"
#include "sym.fh"
#include "geom.fh"
#include "schwarz.fh"
c
c Compute the desired type of integrals (kinetic, potential, overlap)
c and ADD them into the given global array.
c
c Oskel indicates that the skeleton (petite-list symmetry) matrix should be
c built ... requires that ibas = jbas.
c
c arguments
c
integer basis !< [Input] bra basis sets
integer g !< [Output] GA handle to array
integer g_loc
integer nao2
integer maxg_in, mscratch_in
c
integer me, nproc, icount,
& maxg, mscratch_2e2c, Nintegrals,
& ishp, ifirstp, ilastp, nshp,
& ishq, ifirstq, ilastq, nshq
integer lbuf, ibuf, lscr, iscr
integer geom
logical odoit
integer ishq1,ishq2,iat,jat,ishp1,ishp2
integer iptr,in0,in1,jn0,jn1,nbfa,nbfb
integer natoms
integer vecl
double precision q2
double precision threshold
double precision eri_est
integer i0,i1,j0,j1,ilo,ihi
integer iat1,iat2,jat1,jat2
integer adrc,ldc,j,g_2
integer mem_lef
double precision q1,qsym
integer ishq_2
integer ijatom
integer next
integer nxtask
external nxtask
double precision qmax
logical ocache_save
call ga_sync()
ocache_save = ocache
ocache = .false.
threshold = 1d-12
qmax = 1d0
me = ga_nodeid()
nproc = ga_nnodes()
if(.not.ga_duplicate(g,g_loc,'local g')) call
. errquit('int_1e_oldga0: dupl failed',0, GA_ERR)
call ga_zero(g_loc)
if (.not. bas_geom(basis, geom)) call errquit
$ ('int_1e_oldga0: basis corrupt?', 0, BASIS_ERR)
c
call int_mem_1e(maxg_in, mscratch_in)
mscratch_2e2c = mscratch_in
maxg = maxg_in
if (.not. geom_ncent(geom, natoms))
& call errquit('ga_get2eri: geom_ncent failed',73, GEOM_ERR)
if (.not. bas_nbf_ce_max(basis,vecl))
& call errquit('cosmo_fock: bas_nbf_ce failed',0,BASIS_ERR)
if (.not.MA_Push_Get(MT_Dbl,mscratch_2e2c,'scr',lscr,iscr))
& call errquit('ga_get2eri: cannot allocate scr',2, MA_ERR)
cold vecl=vecl*vecl*maxg
vecl=vecl*maxg
if (.not.MA_Push_Get(MT_Dbl,vecl,'buf',lbuf,ibuf))
& call errquit('ga_get2eri: cannot allocate buf',0, MA_ERR)
ijatom = -1
next = nxtask(nproc,1)
do iat=1,natoms
if (.not. bas_ce2cnr(basis, iat, ishp1, ishp2))
& call errquit('cosmo_fock: bas_cn2bfr',0,BASIS_ERR)
if (.not. bas_ce2bfr(basis, iat, in0, in1))
& call errquit('cosmo_fock: bas_cn2bfr',0,BASIS_ERR)
nbfa=in1-in0+1
do jat=1,iat
if (.not. bas_ce2cnr(basis, jat, ishq1, ishq2))
& call errquit('cosmo_fock:bas_cn2bfr',0,BASIS_ERR)
if (.not. bas_ce2bfr(basis, jat, jn0, jn1))
& call errquit('cosmo_fock: bas_cn2bfr',0,BASIS_ERR)
nbfb=jn1-jn0+1
ijatom = ijatom + 1
if (ijatom.eq.next) then
do ishp=ishp1,ishp2
if (.not. bas_cn2bfr(basis,ishp,ifirstp,ilastp))
& call errquit('ga_get2eri:_cn2bfr',0,BASIS_ERR)
nshp = ilastp - ifirstp + 1
call dcopy(nbfb*nshp, 0.0d0,0, dbl_mb(ibuf), 1)
iptr=ibuf
do ishq=ishq1,ishq2
if (.not. bas_cn2bfr(basis,ishq,ifirstq,ilastq))
& call errquit('cosmo_fock:bas_cn2bfr',0,BASIS_ERR)
nshq = ilastq - ifirstq + 1
nao2 = nshq*nshp
eri_est = schwarz_shell(ishp,ishq)
if (eri_est.gt.1.0d-12) then
Nintegrals=maxg
call int_1epot(basis,ishq,basis,ishp,mscratch_2e2c,
& Dbl_MB(iscr), Nintegrals,Dbl_MB(iptr))
if (iat.ne.jat) then
call dscal(nao2,2d0,dbl_mb(iptr),1)
endif
endif ! schwarz
iptr=iptr+nao2
enddo ! i shell loop
call ga_put(g_loc,ifirstp,ilastp,jn0,jn1,
& dbl_mb(ibuf),nshp)
c
enddo ! j shell loop
next = nxtask(nproc,1)
endif
enddo ! i loop
enddo ! j loop
call ga_sync()
next=nxtask(-nproc,1)
if (.not.ma_chop_stack(lscr))
$ call errquit('cosmo_fock: could not deallocate scr',0,MA_ERR)
call ga_symmetrize(g_loc)
ocache = ocache_save
call ga_dadd(1.0d0, g_loc, 1.0d0, g, g)
call ga_sync() ! So that no nasty races can result
if (.not. ga_destroy(g_loc)) call errquit('int_1e_oldga0: gad?',0,
& GA_ERR)
call ga_sync() ! So that no nasty races can result
end
|
C ( Last modified on Tue May 28 14:07:02 CDT 2002 )
PROGRAM IPOPTMA
C
C IPOPT CUTEr driver.
C D. Orban, adapted from Andreas Wachters CUTE driver.
C
IMPLICIT NONE
INTEGER IOUT
PARAMETER( IOUT = 6 )
#include "CUTE.INC"
INTEGER LRW, LIW
CTOY PARAMETER (LRW = 20000, LIW = 10000)
CMED PARAMETER (LRW = 10000000, LIW = 10000000)
CBIG PARAMETER (LRW = 30000000, LIW = 30000000)
C
INTEGER N, M, NLB, NUB
DOUBLE PRECISION X( CUTE_NMAX )
INTEGER ILB( CUTE_NMAX )
INTEGER IUB( CUTE_NMAX )
DOUBLE PRECISION BNDS_L( CUTE_NMAX )
DOUBLE PRECISION BNDS_U( CUTE_NMAX )
DOUBLE PRECISION V_L( CUTE_NMAX )
DOUBLE PRECISION V_U( CUTE_NMAX )
DOUBLE PRECISION LAM( CUTE_MMAX )
INTEGER IW( LIW )
DOUBLE PRECISION RW( LRW )
C
C Algorithmic Parameters (INITPARAMS)
C
INTEGER NARGS
DOUBLE PRECISION ARGS( 50 )
CHARACTER*20 CARGS( 50 )
INTEGER ITER
INTEGER IERR
INTEGER fevals, cevals
COMMON /EVALS/ fevals, cevals
REAL CALLS( 7 ), CPU( 2 )
CHARACTER*10 PNAME
CHARACTER*10 VNAMES( CUTE_NMAX ), GNAMES( CUTE_MMAX )
DOUBLE PRECISION FinalF, DummyG, cnrm
INTEGER IDAMAX
C
fevals = 0
cevals = 0
C
C Get problem dimensions and initialize
C
CALL CUTE_INIT(N, M, CUTE_NMAX, X, NLB, ILB, BNDS_L,
. NUB, IUB, BNDS_U)
C
C Get problem name.
C
CALL CNAMES( CUTE_N, CUTE_M, PNAME, VNAMES, GNAMES )
C
C Initialize parameters
C
NARGS = 0
CALL INITPARAMS(IERR, NARGS, ARGS, CARGS)
IF( IERR.NE.0 ) THEN
WRITE(*,*) 'Error initializing algorithmic parameters.'
WRITE(*,*) 'IERR = ',IERR
WRITE(*,*)
WRITE(*,*)
. 'You might want to check IPOPT.DAT (if you set QCNR>0)'
WRITE(*,*)
STOP
ENDIF
CALL IPOPT(N, X, M, NLB, ILB, BNDS_L, NUB, IUB, BNDS_U, V_L, V_U,
. LAM, LRW, RW, LIW, IW, ITER, IERR)
C
C Retrieve final value of objective function and constraints
C
CALL COFG( CUTE_N, CUTE_M, X, FinalF, CUTE_M, LAM )
if( CUTE_M.gt.0 ) then
cnrm = abs(LAM(IDAMAX( CUTE_M, LAM )))
else
cnrm = 0.d0
endif
C
C Display CUTEr statistics
C
CALL CREPRT( CALLS, CPU )
WRITE ( IOUT, 2000 ) PNAME, CUTE_N, CUTE_M, CALLS(1), CALLS(2),
. CALLS(3), CALLS(4), CALLS(5), CALLS(6), CALLS(7),
. IERR, FinalF, cnrm, CPU(1), CPU(2)
c
2000 FORMAT( /, 24('*'), ' CUTEr statistics ', 24('*') //
* ,' Code used : IPOPT', /
* ,' Problem : ', A10, /
* ,' # variables = ', I10 /
* ,' # constraints = ', I10 /
* ,' # objective functions = ', E15.7 /
* ,' # objective gradients = ', E15.7 /
* ,' # objective Hessians = ', E15.7 /
* ,' # Hessian-vector prdct = ', E15.7 /
* ,' # constraints functions = ', E15.7 /
* ,' # constraints gradients = ', E15.7 /
* ,' # constraints Hessians = ', E15.7 /
* ,' Exit code = ', I10 /
* ,' Final f = ', E23.15 /
* ,' Final ||c||_inf = ', E23.15 /
* ,' Set up time = ', 0P, F10.2, ' seconds' /
* ,' Solve time = ', 0P, F10.2, ' seconds' //
* ,66('*') / )
9999 CONTINUE
END
|
implicit double precision (a-h,o-z)
dimension zs1(2,10 000)
dimension zs2(2,10 000)
dimension zs3(2,10 000)
dimension zs4(2,10 000)
c
n1 = 120
c
pi = acos(-1.0d0)
dd = n1
dd = 2*pi/dd
do 1000 j=1,n1
t = dd*(j-1)
x = 2*cos(t)
y = sin(t)
zs1(1,j)=x
zs1(2,j)=y
1000 continue
c
n2 = 200
dd = n2
dd = 2*pi/dd
do 1100 j=1,n2
t = dd*(j-1)
x = 4+cos(t)
y = 5*sin(t)
zs2(1,j)=x
zs2(2,j)=y
1100 continue
c
n3 = 77
dd = n3
dd = 2*pi/dd
do 1200 j=1,n3
t = dd*(j-1)
x =-1+cos(t)
y =-5*sin(t)
zs3(1,j)=x
zs3(2,j)=y
1200 continue
c
n4 = 177
dd = n4
dd = 2*pi/dd
do 1300 j=1,n4
t = dd*(j-1)
x = 17*cos(t)
y = -7+sin(t)
zs4(1,j)=x
zs4(2,j)=y
1300 continue
iplot-point=1
call plot_points("Points on an ellipse.*",iplot,n1,zs1)
c
iplot=2
call plot_points2("Points on two ellipses*",iplot,n1,zs1,n2,zs2)
c
iplot=3
call plot_points3("Points on three ellipses*",iplot,n1,zs1,
- n2,zs2,n3,zs3)
c
iplot=4
call plot_points4("Points on four ellipses*",iplot,n1,zs1,
- n2,zs2,n3,zs3,n4,zs4)
c
c$$$ iout=3
c$$$ n = 5
c$$$c
c$$$ do 3000 i=1,n
c$$$c
c$$$ zs3(1,i) = i
c$$$ zs3(2,i) = i
c$$$c
c$$$ zs3(3,i) = i+1
c$$$ zs3(4,i) = i+1
c$$$ 3000 continue
c$$$c
c$$$ call plot_tikz_rectangles(iout,n,zs3)
end
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c This file contains code for generating primitive plots. The
c following subroutines produce GNUPLOT files:
c
c plot_points - plot a collection of points in the plane
c
c plot_points2 - plot two separate collections of points in the plane
c
c plot_points3 - plot three collections of points in the plane
c
c plot_points4 - plot four collections of points in the plane
c
c plot_points_on_curve - plot a curve with a collection of points
c lying on it
c
c The following subroutines produce TIKZ output suitable for
c producing publications:
c
c
c plot_tikz_rectangles - produce a plot displying a disjoint
c collection of rectangles in the plane
c
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine plot_tikz_rectangles(iout,n,zs)
implicit double precision (a-h,o-z)
dimension zs(4,n)
character*11 filename
c
c Produce a TIKZ file which generates a picture of a collection
c of rectanges in the plane.
c
c Input Parameters:
c
c iout - the name of the output file will be tikz${iout}.tex
c n - the number of rectangles
c zs - a (4,n) array each column of which gives the coordinates of
c a triangle.
c
c
0100 format("tikz",I3.3,".tex")
0200 format("\draw [fill=gray!50] (",E12.5,",",E12.5,") rectangle (",
- E12.5,",",E12.5, ");")
0300 format("\draw (",E12.5,",",E12.5,") rectangle (",
- E12.5,",",E12.5, ");")
c
iw = 20
write(filename,0100) iout
open(iw,FILE=filename)
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 1000 i=1,n
x1 = zs(1,i)
y1 = zs(2,i)
x2 = zs(3,i)
y2 = zs(4,i)
c
xmin = min(xmin,x1)
xmin = min(xmin,x2)
xmax = max(xmax,x1)
xmax = max(xmax,x2)
ymin = min(ymin,y1)
ymin = min(ymin,y2)
ymax = max(ymax,y1)
ymax = max(ymax,y2)
c
1000 continue
c
write(iw,*) "\begin{tikzpicture}"
write(iw,0300) xmin,ymin,xmax,ymax
do 1100 i=1,n
write(iw,0200) zs(1,i),zs(2,i),zs(3,i),zs(4,i)
1100 continue
c
write(iw,*) "\end{tikzpicture}"
end
subroutine plot_points(title,iplot,n,zs)
implicit double precision (a-h,o-z)
dimension zs(2,1)
character*1 title(1),AST
character*5 filename1
character*9 filename2
character*80 command
character*1 quote
c
data quote /'"'/, AST / '*' /
c
c Produce a plot showing a user-specified collection of points
c in the plane.
c
c Input Parameters:
c
c title - an asterisk terminated string to use as a title
c iplot - the filename of the GNU output file will be gn${iplot}
c n - number of points
c zs - a (2,n) array whose columns given the coordinates of the points
c to plot
c
c
1000 format("gn",I3.3)
1100 format("gn",I3.3,".dat")
1200 format((E12.5,2X,E12.5))
c
1300 format(" plot [",E12.5,":",E12.5,"] [",E12.5,":",E12.5," ] ",
1 '"',A9,'"'," with points pointtype 7 pointsize .25")
1400 format("gnuplot -persist ",A9)
1500 format(" set title ",'"',80A1,'"')
c
c Find the length of the title.
c
len = 0
do 2000 j=1,10 000
if (title(j) .eq. AST) goto 2100
len=len+1
2000 continue
2100 continue
c
c Open the data file, gn???.dat, and the GNUplot script file,
c gn???.
c
write(filename1,1000) iplot
write(filename2,1100) iplot
c
iw1=20
iw2=21
c
open(iw1,FILE=filename1)
open(iw2,FILE=filename2)
c
c Write the coordinates of the points to the data file and
c close it.
c
write(iw2,1200) (zs(1,j),zs(2,j),j=1,n)
close(iw2)
c
c Decide on the length of the axes.
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 2200 j=1,n
xmax = max(zs(1,j),xmax)
xmin = min(zs(1,j),xmin)
ymax = max(zs(2,j),ymax)
ymin = min(zs(2,j),ymin)
2200 continue
c
dlen = max((xmax-xmin),(ymax-ymin))
dlen = dlen*1.1d0
c
xmin = (xmax+xmin)/2-dlen/2
xmax = xmin+dlen
ymin = (ymax+ymin)/2-dlen/2
ymax = ymin+dlen
c
write(iw1,*) "set terminal qt"
write(iw1,*) "unset key"
c
if (len .gt. 0) then
write (iw1,1500) (title(j),j=1,len)
endif
c
write(iw1,1300) xmin,xmax,ymin,ymax,filename2
c
close(iw1)
c
end
subroutine plot_points2(title,iplot,n1,zs1,n2,zs2)
implicit double precision (a-h,o-z)
dimension zs1(2,1),zs2(2,1)
c
character*1 title(1),AST
character*5 filename1
c
character*9 filename2
character*10 filename3
c
character*80 command
character*1 quote
c
data quote /'"'/, AST / '*' /
c
c Produce a plot showing two user-specified collection of points
c in the plane.
c
c Input Parameters:
c
c title - an asterisk terminated string to use as a title
c iplot - the filename of the GNU output file will be gn${iplot}
c n? - number of points in the ?th collection
c zs? - a (2,n) array whose columns given the coordinates of the points
c in the ?th collection
c
1600 format("set style line 1 pointtype 7 ps .25 lc rgb ",'"',
- "red0",'"')
1700 format("set style line 2 pointtype 7 ps .25 lc rgb ",'"',
- "blue0",'"')
c
1000 format("gn",I3.3)
1100 format("gn",I3.3,".dat")
1150 format("gn",I3.3,".dat2")
c
1200 format((E12.5,2X,E12.5))
c
1300 format(" plot [",E12.5,":",E12.5,"] [",E12.5,":",E12.5," ] ",
- '"',A9,'"'," with points ls 1,",
- '"',A10,'"'," with points ls 2")
1400 format("gnuplot -persist ",A9)
1500 format(" set title ",'"',80A1,'"')
c
c Find the length of the title.
c
len = 0
do 2000 j=1,10 000
if (title(j) .eq. AST) goto 2100
len=len+1
2000 continue
2100 continue
c
c Open the data files, gn???.dat, and the GNUplot script file,
c gn???.
c
write(filename1,1000) iplot
write(filename2,1100) iplot
write(filename3,1150) iplot
c
iw1=20
iw2=21
iw3=22
c
open(iw1,FILE=filename1)
open(iw2,FILE=filename2)
open(iw3,FILE=filename3)
c
c Write the coordinates of the points to the data files and
c close them.
c
write(iw2,1200) (zs1(1,j),zs1(2,j),j=1,n1)
write(iw3,1200) (zs2(1,j),zs2(2,j),j=1,n2)
close(iw2)
close(iw3)
c
c Decide on the length of the axes.
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 2200 j=1,n1
xmax = max(zs1(1,j),xmax)
xmin = min(zs1(1,j),xmin)
ymax = max(zs1(2,j),ymax)
ymin = min(zs1(2,j),ymin)
2200 continue
c
do 2250 j=1,n2
xmax = max(zs2(1,j),xmax)
xmin = min(zs2(1,j),xmin)
ymax = max(zs2(2,j),ymax)
ymin = min(zs2(2,j),ymin)
2250 continue
c
dlen = max((xmax-xmin),(ymax-ymin))
dlen = dlen*1.1d0
c
xmin = (xmax+xmin)/2-dlen/2
xmax = xmin+dlen
ymin = (ymax+ymin)/2-dlen/2
ymax = ymin+dlen
c
write(iw1,*) "set terminal qt"
write(iw1,*) "unset key"
c
if (len .gt. 0) then
write (iw1,1500) (title(j),j=1,len)
endif
c
write(iw1,1600)
write(iw1,1700)
write(iw1,1300) xmin,xmax,ymin,ymax,filename2,filename3
close(iw1)
c
end
subroutine plot_points3(title,iplot,n1,zs1,n2,zs2,n3,zs3)
implicit double precision (a-h,o-z)
dimension zs1(2,1),zs2(2,1),zs3(2,1)
c
character*1 title(1),AST
character*5 filename1
c
character*9 filename2
character*10 filename3
character*10 filename4
c
character*80 command
character*1 quote
c
data quote /'"'/, AST / '*' /
c
c Produce a plot showing two user-specified collection of points
c in the plane.
c
c Input Parameters:
c
c title - an asterisk terminated string to use as a title
c iplot - the filename of the GNU output file will be gn${iplot}
c n? - number of points in the ?th collection
c zs? - a (2,n) array whose columns given the coordinates of the points
c in the ?th collection
c
1600 format("set style line 1 pointtype 7 ps .25 lc rgb ",'"',
- "red0",'"')
1700 format("set style line 2 pointtype 7 ps .25 lc rgb ",'"',
- "blue0",'"')
1800 format("set style line 3 pointtype 7 ps .25 lc rgb ",'"',
- "gray0",'"')
c
1000 format("gn",I3.3)
1100 format("gn",I3.3,".dat")
1150 format("gn",I3.3,".dat2")
1175 format("gn",I3.3,".dat3")
c
1200 format((E12.5,2X,E12.5))
c
1300 format(" plot [",E12.5,":",E12.5,"] [",E12.5,":",E12.5," ] ",
- '"',A9,'"'," with points ls 1, ",
- '"',A10,'"'," with points ls 2, ",
- '"',A10,'"'," with points ls 3")
1400 format("gnuplot -persist ",A9)
1500 format(" set title ",'"',80A1,'"')
c
c Find the length of the title.
c
len = 0
do 2000 j=1,10 000
if (title(j) .eq. AST) goto 2100
len=len+1
2000 continue
2100 continue
c
c Open the data files, gn???.dat, and the GNUplot script file,
c gn???.
c
write(filename1,1000) iplot
write(filename2,1100) iplot
write(filename3,1150) iplot
write(filename4,1175) iplot
c
iw1=20
iw2=21
iw3=22
iw4=23
c
open(iw1,FILE=filename1)
open(iw2,FILE=filename2)
open(iw3,FILE=filename3)
open(iw4,FILE=filename4)
c
c Write the coordinates of the points to the data files and
c close them.
c
write(iw2,1200) (zs1(1,j),zs1(2,j),j=1,n1)
write(iw3,1200) (zs2(1,j),zs2(2,j),j=1,n2)
write(iw4,1200) (zs3(1,j),zs3(2,j),j=1,n3)
c
close(iw2)
close(iw3)
close(iw4)
c
c Decide on the length of the axes.
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 2200 j=1,n1
xmax = max(zs1(1,j),xmax)
xmin = min(zs1(1,j),xmin)
ymax = max(zs1(2,j),ymax)
ymin = min(zs1(2,j),ymin)
2200 continue
c
do 2250 j=1,n2
xmax = max(zs2(1,j),xmax)
xmin = min(zs2(1,j),xmin)
ymax = max(zs2(2,j),ymax)
ymin = min(zs2(2,j),ymin)
2250 continue
c
do 2275 j=1,n3
xmax = max(zs3(1,j),xmax)
xmin = min(zs3(1,j),xmin)
ymax = max(zs3(2,j),ymax)
ymin = min(zs3(2,j),ymin)
2275 continue
c
c
dlen = max((xmax-xmin),(ymax-ymin))
dlen = dlen*1.1d0
c
xmin = (xmax+xmin)/2-dlen/2
xmax = xmin+dlen
ymin = (ymax+ymin)/2-dlen/2
ymax = ymin+dlen
c
write(iw1,*) "set terminal qt"
write(iw1,*) "unset key"
c
if (len .gt. 0) then
write (iw1,1500) (title(j),j=1,len)
endif
c
write(iw1,1600)
write(iw1,1700)
write(iw1,1800)
write(iw1,1300) xmin,xmax,ymin,ymax,filename2,filename3,
- filename4
close(iw1)
c
end
subroutine plot_points4(title,iplot,n1,zs1,n2,zs2,n3,zs3,
- n4,zs4)
implicit double precision (a-h,o-z)
dimension zs1(2,1),zs2(2,1),zs3(2,1),zs4(2,1)
c
character*1 title(1),AST
character*5 filename1
c
character*9 filename2
character*10 filename3
character*10 filename4
character*10 filename5
c
character*80 command
character*1 quote
c
data quote /'"'/, AST / '*' /
c
c Produce a plot showing two user-specified collection of points
c in the plane.
c
c Input Parameters:
c
c title - an asterisk terminated string to use as a title
c iplot - the filename of the GNU output file will be gn${iplot}
c n? - number of points in the ?th collection
c zs? - a (2,n) array whose columns given the coordinates of the points
c in the ?th collection
c
1600 format("set style line 1 pointtype 7 ps .5 lc rgb ",'"',
- "red0",'"')
1700 format("set style line 2 pointtype 7 ps .5 lc rgb ",'"',
- "blue0",'"')
1800 format("set style line 3 pointtype 7 ps .5 lc rgb ",'"',
- "gray0",'"')
1900 format("set style line 4 pointtype 7 ps .5 lc rgb ",'"',
- "green0",'"')
c
1000 format("gn",I3.3)
1100 format("gn",I3.3,".dat")
1150 format("gn",I3.3,".dat2")
1175 format("gn",I3.3,".dat3")
1190 format("gn",I3.3,".dat4")
c
1200 format((E12.5,2X,E12.5))
c
1300 format(" plot [",E12.5,":",E12.5,"] [",E12.5,":",E12.5," ] ",
- '"',A9,'"'," with points ls 1,",
- '"',A10,'"'," with points ls 2,",
- '"',A10,'"'," with points ls 3,",
- '"',A10,'"'," with points ls 4")
1400 format("gnuplot -persist ",A9)
1500 format(" set title ",'"',80A1,'"')
c
c Find the length of the title.
c
len = 0
do 2000 j=1,10 000
if (title(j) .eq. AST) goto 2100
len=len+1
2000 continue
2100 continue
c
c Open the data files, gn???.dat, and the GNUplot script file,
c gn???.
c
write(filename1,1000) iplot
write(filename2,1100) iplot
write(filename3,1150) iplot
write(filename4,1175) iplot
write(filename5,1190) iplot
c
iw1=20
iw2=21
iw3=22
iw4=23
iw5=24
c
open(iw1,FILE=filename1)
open(iw2,FILE=filename2)
open(iw3,FILE=filename3)
open(iw4,FILE=filename4)
open(iw5,FILE=filename5)
c
c Write the coordinates of the points to the data files and
c close them.
c
write(iw2,1200) (zs1(1,j),zs1(2,j),j=1,n1)
write(iw3,1200) (zs2(1,j),zs2(2,j),j=1,n2)
write(iw4,1200) (zs3(1,j),zs3(2,j),j=1,n3)
write(iw5,1200) (zs4(1,j),zs4(2,j),j=1,n4)
c
close(iw2)
close(iw3)
close(iw4)
close(iw5)
c
c Decide on the length of the axes.
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 2200 j=1,n1
xmax = max(zs1(1,j),xmax)
xmin = min(zs1(1,j),xmin)
ymax = max(zs1(2,j),ymax)
ymin = min(zs1(2,j),ymin)
2200 continue
c
do 2250 j=1,n2
xmax = max(zs2(1,j),xmax)
xmin = min(zs2(1,j),xmin)
ymax = max(zs2(2,j),ymax)
ymin = min(zs2(2,j),ymin)
2250 continue
c
do 2275 j=1,n3
xmax = max(zs3(1,j),xmax)
xmin = min(zs3(1,j),xmin)
ymax = max(zs3(2,j),ymax)
ymin = min(zs3(2,j),ymin)
2275 continue
c
do 2290 j=1,n4
xmax = max(zs4(1,j),xmax)
xmin = min(zs4(1,j),xmin)
ymax = max(zs4(2,j),ymax)
ymin = min(zs4(2,j),ymin)
2290 continue
c
dlen = max((xmax-xmin),(ymax-ymin))
dlen = dlen*1.1d0
c
xmin = (xmax+xmin)/2-dlen/2
xmax = xmin+dlen
ymin = (ymax+ymin)/2-dlen/2
ymax = ymin+dlen
c
write(iw1,*) "set terminal qt"
write(iw1,*) "unset key"
c
if (len .gt. 0) then
write (iw1,1500) (title(j),j=1,len)
endif
c
write(iw1,1600)
write(iw1,1700)
write(iw1,1800)
write(iw1,1900)
write(iw1,1300) xmin,xmax,ymin,ymax,filename2,filename3,
- filename4,filename5
close(iw1)
c
end
subroutine plot_points_on_curve(title,iplot,n,zs,m,zscurve)
implicit double precision (a-h,o-z)
dimension zs(2,1),zscurve(2,1)
character*1 title(1),AST
character*5 filename1
character*9 filename2
character*10 filename3
character*80 command
character*1 quote
c
c Plot a collection of points lying on a curve.
c
data quote /'"'/, AST / '*' /
c
c
c
c Input Parameters:
c
c Output Parameters:
c
c
1000 format("gn",I3.3)
1100 format("gn",I3.3,".dat")
1150 format("gn",I3.3,".dat2")
1200 format((E12.5,2X,E12.5))
c
1300 format(" plot [",E12.5,":",E12.5,"] [",E12.5,":",E12.5," ] ",
- '"',A10,'"'," with lines ls 1,",
- '"',A9,'"'," with points ls 2")
1400 format("gnuplot -persist ",A9)
1500 format(" set title ",'"',80A1,'"')
c
1600 format("set style line 1 lt 1 lw 1 lc rgb ",'"',"gray90",'"')
1700 format("set style line 2 pointtype 7 ps .5 lc rgb ",'"',
- "gray0",'"')
c
c
c Find the length of the title.
c
len = 0
do 2000 j=1,10 000
if (title(j) .eq. AST) goto 2100
len=len+1
2000 continue
2100 continue
c
c Open the data file, gn???.dat, and the GNUplot script file,
c gn???.
c
write(filename1,1000) iplot
write(filename2,1100) iplot
write(filename3,1150) iplot
c
iw1=20
iw2=21
iw3=22
c
open(iw1,FILE=filename1)
open(iw2,FILE=filename2)
open(iw3,FILE=filename3)
c
c Write the coordinates of the points to the data files.
c
write(iw2,1200) (zs(1,j),zs(2,j),j=1,n)
close(iw2)
c
write(iw3,1200) (zscurve(1,j),zscurve(2,j),j=1,m)
close(iw3)
c
c Decide on the length of the axes.
c
xmin = 1d50
xmax =-1d50
ymin = 1d50
ymax =-1d50
c
do 2200 j=1,n
xmax = max(zs(1,j),xmax)
xmin = min(zs(1,j),xmin)
ymax = max(zs(2,j),ymax)
ymin = min(zs(2,j),ymin)
2200 continue
c
do 2250 j=1,m
xmax = max(zscurve(1,j),xmax)
xmin = min(zscurve(1,j),xmin)
ymax = max(zscurve(2,j),ymax)
ymin = min(zscurve(2,j),ymin)
2250 continue
c
dlen = max((xmax-xmin),(ymax-ymin))
dlen = dlen*1.1d0
c
xmin = (xmax+xmin)/2-dlen/2
xmax = xmin+dlen
ymin = (ymax+ymin)/2-dlen/2
ymax = ymin+dlen
c
write(iw1,*) "set terminal qt"
write(iw1,*) "unset key"
c
if (len .gt. 0) then
write (iw1,1500) (title(j),j=1,len)
endif
c
write(iw1,1600)
write(iw1,1700)
write(iw1,1300) xmin,xmax,ymin,ymax,filename3,filename2
c
close(iw1)
c
end
|
double precision function pot(rhf1,r,rhf2, ReadDataOnly)
c given one point in distance coordinates (bohr), this routine returns the
c value of the HSW potential (hartree), or, optionally (see comments below)
c the value of the SW1 potential (hartree).
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c This is a spin-orbit corrected version of the SW1 potential energy surface, c
c by B. Hartke, K. Stark and H.-J. Werner. c
c The SW1 potential without S.O.-correction has been published in: c
c K. Stark and H.-J. Werner, J.Chem.Phys. 104 (1996) 6515. c
c For work using both surfaces, see: c
c B. Hartke and H.-J. Werner, Chem.Phys.Lett. 280 (1997) 430. c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
implicit double precision(a-h,o-z)
parameter (np=40)
dimension x(np),y(np),z(np),en(np,np,np)
dimension rr(3),fin(4)
data amuau,evau,aukcal/1822.88734d0,27.211608d0,627.5095d0/
data ifirst/-1/
save ifirst,pi,raddeg,nx,ny,nz,x,y,z,en,esocut,rsolim,rrsolm
Logical ReadDataOnly
Include 'hswdata.inc'
c
c on first call of this subroutine, initialize the SW1 potential routine
c and the spline interpolation for the S.O. correction
c
if (ifirst.eq.-1) then
call inifit
call prepar(nx,ny,nz,x,y,z,en)
open(unit=83,file=DataDir(1:DataDirLength)//'/so.param',
$ status='old')
read(83,*)esocut
read(83,*)rsolim
read(83,*)rrsolm
close(83)
esocut=esocut/aukcal
pi=acos(-1.0d0)
raddeg=180.d0/pi
ifirst=0
end if
If(ReadDataOnly) Return
c call sw1 potential routine
call sw1(rhf1,r,rhf2,v)
c
c convert point to F + H_2 Jacobi coordinates, for convenience
rsmall=r
rbig=sqrt(0.5d0*(rhf1*rhf1+rhf2*rhf2-0.5d0*r*r))
thn=(rbig*rbig+0.25d0*r*r-rhf1*rhf1)/rbig/r
c depending on the computer, the above may result in abs(thn) being slightly
c larger than 1.0, due to rounding errors; hence correct for that:
if (abs(thn).ge.1.d0) then
thn=sign(1.d0,thn)
end if
thn=acos(thn)
c check if point is in F+H2 valley; criteria:
c (1) energy is larger than some cutoff value esocut (this is the most
c convenient way to exclude the HF+H valley)
c (2) the H-H distance ( = r ) is smaller than some limit rsolim
c (3) the F-H2 distance ( = R ) is larger than some limit rrsolm
if (v.gt.esocut.and.r.lt.rsolim.and.rbig.gt.rrsolm) then
c point is in F+H2 valley, so add spline-interpolated S.O.-correction
c (note: the S.O. correction is given in F+H2 Jacobi coordinates, with
c the angle not in radians but in degree!).
rr(1)=rbig
rr(2)=r
rr(3)=thn*raddeg
c First take care of points outside the actual x,y,z-grid of S.O.-data:
c if point is outside interpolation grid, "project it back" onto the
c border of the interpolation grid (this corresponds to extending the
c interpolation grid with constant function values in all directions):
if (rr(1).lt.x(1)) rr(1)=x(1)
if (rr(1).gt.x(nx)) rr(1)=x(nx)
if (rr(2).lt.y(1)) rr(2)=y(1)
if (rr(2).gt.y(ny)) rr(2)=y(ny)
c since z is actually gamma (or theta) here, we complement the given
c z- (or gamma-) range of 0--90 to 0--180 (note: this is already the full
c coordinate range, no extension necessary here!) by setting z=180-gamma for
c gamma-values > 90.
if (rr(3).gt.90.d0) rr(3)=180.d0-rr(3)
c do the spline interpolation to this point:
call naturl(rr,0,fin)
socorr=fin(1)
c if you want derivatives, just call the spline routine again:
c call naturl(rr,3,fin)
c fin(2),fin(3),fin(4) now contain the x,y,z-derivatives of the S.O.correction
else
c point is outside F+H2 valley, hence spin-orbit correction should be zero:
socorr=0.d0
end if
c add in the asymptotic value of the spin-orbit correction, in order to
c shift the bottom of the asymptotic F+H2 valley to zero again, just
c to make life easier...
pot=v+socorr+0.0006
c in order to get the SW1 potential, just omit the S.O. correction and shift
c pot=v
c in that case, you can also comment out all the above parts relating to
c computation of the "socorr" value (spline interpolation, etc.)
return
end
c------------------------------------------------------------------------
subroutine inifit
implicit real*8(a-h,o-z)
parameter(nmx=200)
common/cparm/ a(nmx),p(nmx),ma,np
common/cint/ ix(nmx),iy(nmx),iz(nmx),mmax
include 'hswdata.inc'
open(1,file=DataDir(1:DataDirLength)//'/three.param',status='old')
i=1
rewind 1
10 read(1,*,end=100) nparm,ix(i),iy(i),iz(i),a(i)
i=i+1
goto 10
100 ma=i-1
close(1)
m=ix(ma-6)
mmax=m+1
open(1,file=DataDir(1:DataDirLength)//'/two.param',status='old')
i=1
rewind 1
11 read(1,*,end=111)p(i)
i=i+1
goto 11
111 np=i-1
close(1)
return
end
subroutine sw1(x,y,z,v)
implicit real*8(a-h,o-z)
parameter(nmx=200)
common/cparm/ a(nmx),p(nmx),ma,np
common/cint/ ix(nmx),iy(nmx),iz(nmx),mmax
dimension xex(0:mmax),xey(0:mmax),xez(0:mmax)
c
c.... calculates potential of the Stark-Werner surface for F+H2
c.... initializing the non-linear parameters
c.... x,y,z are the internal coordinates of F-H1-H2 :
c.... x = r(F-H1) y= r(H1-H2) z= r(F-H2)
c
b1 = a(ma-5)
b2 = a(ma-4)
b3 = a(ma-3)
x0 = a(ma-2)
y0 = a(ma-1)
z0 = a(ma)
fit = 0.0d0
xexpon = b1*(x-x0)
yexpon = b2*(y-y0)
zexpon = b3*(z-z0)
exponx=dexp(-xexpon)
expony=dexp(-yexpon)
exponz=dexp(-zexpon)
fex = x*exponx
fey = y*expony
fez = z*exponz
xex(0)=1
xey(0)=1
xez(0)=1
xex(1)=fex
xey(1)=fey
xez(1)=fez
do m=2,mmax-1
xex(m)=xex(m-1)*fex
xey(m)=xey(m-1)*fey
xez(m)=xez(m-1)*fez
enddo
c
c.... Aguado-Paniagua-Fit for the threebody-terms
c.... Method seems to be a bit confusing
c.... But this type of programming was chosen to avoid
c.... terms like x**b(i)*y**c(j)*z**d(k), which
c.... cost much more CPU-time !
c
do 1010 i=1,ma-6
fit=fit+xex(ix(i))*xey(iy(i))*xez(iz(i))*a(i)
1010 continue
c
c.... Two-Body-Potential : Extended-Rydberg-Functional
c
xr = x-p(3)
yr = y-p(9)
zr = z-p(3)
xr2=xr*xr
xr3=xr2*xr
yr2=yr*yr
yr3=yr2*yr
zr2=zr*zr
zr3=zr2*zr
fx = dexp(-p(2)*xr)
fy = dexp(-p(8)*yr)
fz = dexp(-p(2)*zr)
ux = -p(1)*(1.0d0+p(2)*xr+p(4)*xr2+p(5)*xr3)
uy = -p(7)*(1.0d0+p(8)*yr+p(10)*yr2+p(11)*yr3)
uz = -p(1)*(1.0d0+p(2)*zr+p(4)*zr2+p(5)*zr3)
xval=ux*fx+p(6)
yval=uy*fy+p(12)
zval=uz*fz+p(6)
c
c... Resulting Potential in atomic untis
c
v=fit+xval+yval+zval
return
end
|
FUNCTION G2T_HCA (g2t_track_h, g2t_track ,
> g2t_emc_hit_h, g2t_emc_hit )
IMPLICIT NONE
#include "g2t_emc.inc"
#include "genhit.h"
#include "atlsim/gentit.inc"
+cde,gcunit.
INTEGER G2T_HCA,G2R_GET_HIT,Iprin/0/,Idigi,i,isys, khit
logical Local/.true./
*
CHARACTER *4 myhit/'HCAL'/
*
G2T_HCA=STAFCV_OK
if (g2t_emc_hit_h.maxlen.le.0) return
i=0
g2t_emc_hit_h.nok = 0
DO isys=1,7 """ Loop over all sensitive fibers """
" STAR implementation HcalGeo, HcalGeo1 "
IF (isys==1) { call G2R_GET_SYS ('HCAL','HCEL',Iprin,Idigi) }
IF (isys==2) { call G2R_GET_SYS ('HCAL','HCES',Iprin,Idigi) }
IF (isys==3) { call G2R_GET_SYS ('HCAL','FPSC',Iprin,Idigi) }
" Test beam implementation, HcalGeoF "
IF (isys==4) { call G2R_GET_SYS ('HCAL','BBCF',Iprin,Idigi) } ! Front scint paddle
IF (isys==5) { call G2R_GET_SYS ('HCAL','BBCB',Iprin,Idigi) } ! Back scint paddle
if (isys==6) { call G2R_GET_SYS ('HCAL','LEDG',Iprin,Idigi) } ! Lead glass
"For Preshower HcalGeo"
if (isys==7) { call G2R_GET_SYS ('HCAL','HSTP',Iprin,Idigi) } ! preshower
if (Iprin.lt.0) {
cycle " Next iteration of the loop "
}
Local = Idigi.ge.2
Do While (G2R_GET_HIT('hca') .eq. 0)
i=i+1
g2t_emc_hit_h.nok = i
g2t_emc_hit(i).id = i
g2t_emc_hit(i).de = 0 ! Use attenuated hcal value
g2t_emc_hit(i).track_p = trac
g2t_emc_hit(i).volume_id = volume
g2t_emc_hit(i).x = xx(1)
g2t_emc_hit(i).y = xx(2)
g2t_emc_hit(i).z = xx(3)
if isys .lt. 3 { """Attenuated hit for HCA"""
do khit=1,15
IF (chit(khit)=myhit) {
g2t_emc_hit(i).de = hits(khit);
break;
}
enddo
}
if isys .eq. 3 { """Unattenuated hit for preshower"""
g2t_emc_hit(i).de = elos
}
if isys .eq. 4 { """Scintillator paddle """
g2t_emc_hit(i).de = elos
}
if isys .eq. 5 { """Scintillator paddle """
g2t_emc_hit(i).de = elos
}
if isys .eq. 6 { """Unattenuated hit for pbglass"""
g2t_emc_hit(i).de = elos
}
if isys .eq. 7 { """2014 preshower"""
g2t_emc_hit(i).de = hits(khit);
}
* <W> i,trac,volume,hits(khit);( 'g2t_hca: ', I4, I4, I8, F8.4);
*
* add to track linked list
*
* g2t_emc_hit(i).next_tr_hit_p = g2t_track(trac).hit_emc_p
g2t_track(trac).hit_hca_p = i
g2t_track(trac).n_hca_hit = g2t_track(trac).n_hca_hit + 1
enddo """Loop over hits"""
enddo """Loop over fiber types"""
RETURN
END
|
C MODULE SFPE
C-----------------------------------------------------------------------
C
C ROUTINE TO DEFINE STATION POTENTIAL EVAPORATION PARAMETERS.
C
SUBROUTINE SFPE (LARRAY,ARRAY,DISP,TDISP,IRUNCK,
* PRPARM,PRNOTE,UNITS,NFLD,
* STAID,DESCRP,STATE,STALOC,NBRSTA,
* IFSTAN,
* NPPE,
* NSTERR,NSTWRN,IWRITE,LPPE,ISTAT)
C
CHARACTER*4 DISP,TDISP,PRNOTE,PRPARM,UNITS,TYPE,WDISP
PARAMETER (MOPTN=4)
CHARACTER*8 OPTN(MOPTN)
* /'CF ',' ',' ',' '/
CHARACTER*20 CHAR/' '/,CHK/' '/
C
DIMENSION ARRAY(LARRAY)
DIMENSION UNUSED(2)
C
C STAN PARAMETER ARRAYS
INCLUDE 'scommon/dimstan'
C
C PE PARAMETER ARRAYS
INCLUDE 'scommon/dimpe'
C
INCLUDE 'uio'
INCLUDE 'scommon/sudbgx'
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/ppinit_define/RCS/sfpe.f,v $
. $', '
.$Id: sfpe.f,v 1.3 1998/04/07 15:08:58 page Exp $
. $' /
C ===================================================================
C
C
C FOURIER SERIES COEFFICIENTS FOR STATION PE PARAMETERS
DIMENSION A0(131),A1(131),A2(131),A3(131),B1(131),B2(131)
DATA A0/622.22,621.03,619.83,618.62,617.40,616.17,
1 614.93,613.69,612.45,611.21,609.97,608.71,607.46,
1 606.20,604.95,603.69,602.41,601.13,599.85,598.57,597.29,595.99,
2 594.70,593.40,592.11,590.81,589.49,588.17,586.85,585.53,584.21,
3 582.87,581.54,580.20,578.87,577.53,576.17,574.81,573.45,572.09,
4 570.73,569.35,567.98,566.60,565.23,563.85,562.45,561.05,559.65,
5 558.25,556.85,555.43,554.02,552.60,551.19,549.77,548.33,546.89,
6 545.45,544.01,542.57,541.12,539.66,538.21,536.75,535.30,533.82,
7 532.34,530.86,529.38,527.90,526.41,525.92,523.42,521.93,520.44,
8 518.92,517.40,515.89,514.37,512.85,511.32,509.79,508.25,506.72,
9 505.19,503.63,502.07,500.52,498.96,497.40,495.82,404.25,492.67,
1 491.10,489.52,487.92,486.32,484.73,483.13,481.53,479.91,478.30,
2 476.69,475.07,473.45,471.81,470.18,468.54,466.91,465.27,463.61,
3 461.96,460.30,458.65,456.99,455.31,453.64,451.96,450.29,448.61,
4 446.92,445.22,443.53,441.83,440.14,438.42,436.70,434.98,433.27,
5 431.55/
DATA A1/-140.87,-142.27,-143.67,-145.06,-146.45,
1 -147.83,-149.21,-150.58,-151.96,-153.33,-154.71,-156.08,
1 -157.44,-158.81,-160.18,-161.55,-162.91,-164.27,-165.62,-166.97,
2 -168.33,-169.67,-171.02,-172.36,-173.71,-175.05,-176.38,-177.72,
3 -179.05,-180.39,-181.72,-183.04,-184.37,-185.69,-187.02,-188.34,
4 -189.65,-190.97,-192.28,-193.60,-194.91,-196.21,-197.51,-198.82,
5 -200.12,-201.42,-202.59,-203.77,-204.94,-206.12,-207.29,-208.69,
6 -210.09,-211.49,-212.89,-214.29,-215.56,-216.83,-218.11,-219.38,
7 -220.65,-221.91,-223.17,-224.44,-225.70,-226.96,-228.21,-229.46,
8 -230.72,-231.97,-233.22,-234.46,-235.70,-236.95,-238.19,-239.43,
9 -240.66,-241.89,-243.13,-244.36,-245.59,-246.81,-248.03,-249.25,
1 -250.47,-251.69,-252.90,-254.11,-255.32,-256.53,-257.74,-258.94,
2 -260.14,-261.34,-262.54,-263.74,-264.93,-266.12,-267.32,-268.51,
3 -269.70,-270.88,-272.06,-273.24,-274.42,-275.60,-276.77,-277.94,
4 -279.11,-280.78,-281.45,-282.61,-283.77,-284.93,-286.09,-287.25,
5 -288.40,-289.55,-290.69,-291.84,-292.99,-293.56,-294.70,-295.84,
6 -296.97,-298.68,-299.81,-300.94,-302.06,-303.19,-304.32/
DATA A2/-26.57,-26.73,-26.87,-26.99,-27.09,
1 -27.17,-27.23,-27.30,-27.36,-27.43,-27.49,-27.53,-27.57,
1 -27.61,-27.65,-27.69,-27.70,-27.72,-27.74,-27.76,-27.78,-27.77,
2 -27.76,-27.76,-27.75,-27.74,-27.71,-27.67,-27.64,-27.60,-27.57,
3 -27.51,-27.46,-27.40,-27.35,-27.29,-27.21,-27.13,-27.05,-26.97,
4 -26.89,-26.79,-26.68,-26.58,-26.47,-26.37,-26.24,-26.11,-25.98,
5 -25.85,-25.72,-25.57,-25.42,-25.26,-25.11,-24.96,-24.78,-24.60,
6 -24.42,-24.24,-24.07,-23.81,-23.67,-23.47,-23.27,-23.07,-22.85,
8 -20.43,-20.15,-19.88,-19.60,-19.33,-19.03,-18.73,-18.43,-18.13,
7 -22.62,-22.40,-22.17,-21.95,-21.70,-21.45,-21.20,-20.95,-20.70,
9 -17.83,-17.51,-17.19,-16.86,-16.54,-16.22,-15.87,-15.53,-15.18,
1 -14.84,-14.49,-14.12,-13.75,-13.37,-13.00,-12.63,-12.26,-11.89,
2 -11.51,-11.14,-10.65,-10.23,- 9.60,- 9.39,- 8.97,- 8.55,- 8.11,
3 - 7.66,- 7.22,- 6.77,- 6.33,- 5.86,- 5.39,- 4.92,- 4.45,- 3.98,
4 - 3.49,- 2.99,- 2.50,- 2.00,- 1.51,- 1.43,- 1.34,- 1.25,- 1.17,
5 - 1.08/
DATA A3/-3.37,-3.33,-3.29,-3.25,-3.21,
1-3.17,-3.13,-3.09,-3.05,-3.01,-2.97,-2.93,-2.89,-2.86,
1-2.82,-2.78,-2.74,-2.71,-2.67,-2.64,-2.60,-2.57,-2.53,-2.50,-2.46,
2-2.43,-2.40,-2.37,-2.34,-2.31,-2.28,-2.25,-2.22,-2.20,-2.17,-2.14,
3-2.12,-2.09,-2.07,-2.04,-2.02,-2.00,-1.98,-1.95,-1.93,-1.91,-1.89,
4-1.87,-1.85,-1.83,-1.81,-1.79,-1.77,-1.75,-1.73,-1.72,-1.70,-1.69,
5-1.67,-1.66,-1.64,-1.63,-1.62,-1.61,-1.60,-1.59,-1.58,-1.57,-1.57,
6-1.56,-1.55,-1.54,-1.54,-1.53,-1.53,-1.52,-1.52,-1.52,-1.51,-1.51,
7-1.51,-1.51,-1.51,-1.51,-1.51,-1.51,-1.51,-1.51,-1.52,-1.52,-1.52,
8-1.52,-1.53,-1.53,-1.54,-1.54,-1.55,-1.55,-1.56,-1.56,-1.57,-1.58,
9-1.59,-1.61,-1.62,-1.63,-1.64,-1.66,-1.68,-1.69,-1.71,-1.73,-1.75,
1-1.76,-1.78,-1.80,-1.82,-1.84,-1.86,-1.88,-1.90,-1.92,-1.94,-1.97,
2-1.99,-2.01,-2.03,-2.06,-2.08,-2.11,-2.13/
DATA B1/11.58,11.64,11.70,11.75,11.80,
111.84,11.88,11.92,11.96,12.00,12.04,12.08,12.11,12.15,
112.18,12.22,12.25,12.28,12.32,12.35,12.38,12.41,12.44,12.47,12.50,
212.53,12.56,12.59,12.61,12.64,12.67,12.70,12.72,12.75,12.77,12.80,
312.82,12.85,12.87,12.90,12.92,12.94,12.96,12.99,13.01,13.03,13.05,
413.07,13.09,13.11,13.13,13.15,13.17,13.18,13.20,13.22,13.24,13.25,
513.27,13.28,13.30,13.31,13.32,13.34,13.35,13.36,13.37,13.38,13.38,
613.39,13.40,13.40,13.41,13.41,13.42,13.42,13.42,13.42,13.42,13.42,
713.42,13.42,13.42,13.41,13.41,13.41,13.41,13.40,13.40,13.39,13.39,
813.38,13.38,13.37,13.37,13.36,13.35,13.34,13.34,13.33,13.32,13.31,
913.30,13.29,13.28,13.27,13.26,13.25,13.23,13.22,13.21,13.20,13.18,
113.17,13.15,13.14,13.13,13.11,13.10,13.08,13.07,13.06,13.04,13.03,
213.01,13.00,12.98,12.97,12.95,12.94,12.92/
DATA B2/2.87,2.68,2.50,2.33,2.17,
12.02,1.88,1.73,1.59,1.44,1.30,1.17,1.04,0.90,0.77,0.64,
10.52,0.39,0.24,0.14,0.02,-0.10,-0.21,-0.33,-0.44,-0.56,-0.67,
2-0.78,-0.88,-0.99,-1.10,-1.20,-1.30,-1.40,-1.50,-1.60,-1.69,-1.78,
3-1.87,-1.96,-2.05,-2.13,-2.21,-2.29,-2.37,-2.45,-2.52,-2.59,-2.66,
4-2.73,-2.80,-2.86,-2.92,-2.98,-3.04,-3.10,-3.15,-3.20,-3.25,-3.30,
5-3.35,-3.40,-3.44,-3.49,-3.53,-3.58,-3.62,-3.66,-3.69,-3.73,-3.77,
6-3.80,-3.83,-3.86,-3.89,-3.92,-3.94,-3.96,-3.99,-4.01,-4.03,-4.04,
7-4.06,-4.07,-4.09,-4.10,-4.11,-4.11,-4.12,-4.12,-4.13,-4.13,-4.13,
8-4.12,-4.12,-4.12,-4.11,-4.10,-4.09,-4.08,-4.07,-4.05,-4.03,-4.02,
9-4.00,-3.98,-3.95,-3.93,-3.90,-3.88,-3.85,-3.82,-3.78,-3.75,-3.71,
1-3.68,-3.64,-3.60,-3.55,-3.51,-3.47,-3.44,-3.40,-3.37,-3.33,-3.30,
2-3.27,-3.25,-3.22,-3.20,-3.17/
C
C
C
IF (ISTRCE.GT.0) THEN
WRITE (IOSDBG,740)
CALL SULINE (IOSDBG,1)
ENDIF
C
C SET DEBUG LEVEL
LDEBUG=ISBUG('PE ')
C
ISTAT=0
C
LCHAR=LEN(CHAR)/4
LCHK=LEN(CHK)/4
C
TDISP=DISP
C
C SET VALUE FOR MISSING PARAMETER
UNSD=-999.
UNDEF=-997.
C
NUMERR=0
NUMWRN=0
ILPFND=0
IRPFND=0
ISTRT=-1
NUMFLD=0
MINFLD=4
MAXFLD=5
INWIND=0
NOPFLD=0
NXTFLD=0
NPIFLD=0
NPCFLD=NFLD
IENDIN=0
C
IOFLD1=0
C
PFACT=UNDEF
STALAT=UNDEF
DO 10 I=1,6
10 PECOEF(I)=UNDEF
DO 20 I=1,12
PESUM(I)=0.
NPESUM(I)=0
20 CONTINUE
JPESUM=0
NUMCF=0
PECOR=1.
C
C CHECK NUMBER OF LINES LEFT ON PAGE
IF (ISLEFT(5).GT.0) CALL SUPAGE
C
C PRINT CARD
CALL SUPCRD
C
C PRINT HEADER LINE
WRITE (LP,750)
CALL SULINE (LP,2)
WRITE (LP,760)
CALL SULINE (LP,2)
C
IF (LDEBUG.GT.0) THEN
C PRINT OPTIONS
WRITE (LP,810) DISP,PRPARM,PRNOTE,UNITS
CALL SULINE (LP,2)
ENDIF
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHECK IF PREPROCESSOR PARAMETRIC DATA BASE ALLOCATED
IDPPP=1
CALL SUDALC (0,0,0,0,IDPPP,0,0,0,0,0,NUMERR,IERR)
IF (IERR.NE.0) THEN
WRITE (LP,820)
CALL SUERRS (LP,2,NUMERR)
ENDIF
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHECK STATION IDENTIFIER
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*) 'STAID=',STAID
CALL SULINE (IOSDBG,1)
ENDIF
IF (STAID.EQ.'????????') THEN
WRITE (LP,800)
CALL SUERRS (LP,2,NUMERR)
ENDIF
C
C STORE CURRENT ATTRIBUTES
TDESCRP=DESCRP
TSTATE=STATE
TNBRSTA=NBRSTA
C
C READ STATION PE PARAMETERS
IPRERR=0
IPTR=0
INCLUDE 'scommon/callsrpe'
IF (IERR.EQ.0) THEN
C RESET ATTRIBUTES
DESCRP=TDESCRP
STATE=TSTATE
NBRSTA=TNBRSTA
IF (LDEBUG.GT.0) THEN
IPRNT=1
INCLUDE 'scommon/callsppe'
ENDIF
ENDIF
C
C STATION EXIST AND DISP IS NEW
IF (IERR.EQ.0.AND.TDISP.EQ.'NEW') THEN
WRITE (LP,780) STAID
CALL SULINE (LP,2)
TDISP='OLD'
GO TO 90
ENDIF
C
C STATION DOES NOT EXIST AND DISP IS OLD
IF (IERR.GT.0.AND.TDISP.EQ.'OLD') THEN
WRITE (LP,790) STAID
CALL SUWRNS (LP,2,NUMWRN)
TDISP='NEW'
ENDIF
C
90 NPPE=IPTR
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHECK FIELDS FOR DEFINE STATION PE OPTIONS
100 IF (INWIND.EQ.0) GO TO 110
INULL=1
GO TO 160
110 INULL=0
NULREP=0
CALL UFIELD (NFLD,ISTRT,LENGTH,ITYPE,NREP,INTEGR,REAL,LCHAR,CHAR,
* LLPAR,LRPAR,LASK,LATSGN,LAMPS,LEQUAL,IERR)
IF (NFLD.NE.-1) GO TO 120
IENDIN=1
GO TO 220
120 IF (LDEBUG.GT.0) THEN
CALL UPRFLD (NFLD,ISTRT,LENGTH,ITYPE,NREP,INTEGR,REAL,LCHAR,
* CHAR,LLPAR,LRPAR,LASK,LATSGN,LAMPS,LEQUAL,IERR)
ENDIF
C
C CHECK FOR NULL FIELD
IF (IERR.NE.1) GO TO 140
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,910) NFLD
CALL SULINE (IOSDBG,1)
ENDIF
IF (TDISP.EQ.'NEW') GO TO 130
NUMFLD=NUMFLD+1
IF (NFLD.EQ.1) CALL SUPCRD
GO TO 100
130 INULL=1
GO TO 260
C
140 IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*) 'CHAR=',CHAR
CALL SULINE (IOSDBG,1)
ENDIF
C
IF (NXTFLD.GT.0) GO TO 160
C
C CHECK FOR PAIRED PARENTHESES
IF (ILPFND.GT.0.AND.IRPFND.EQ.0) GO TO 150
GO TO 160
150 WRITE (LP,920) NPIFLD,NPCFLD
CALL SULINE (LP,2)
ILPFND=0
IRPFND=0
C
C CHECK IF DISP IS NEW AND ALL FIELDS FOUND
160 IF (INWIND.EQ.0) GO TO 170
IF (NUMFLD.NE.MINFLD) GO TO 250
INWIND=0
IF (IENDIN.EQ.1) GO TO 660
GO TO 100
C
C CHECK FOR REPEATED NULL FIELD
170 IF (CHAR.EQ.',,'.OR.CHAR.EQ.'NULL') THEN
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,*) 'NREP=',NREP
CALL SULINE (IOSDBG,1)
ENDIF
IF (NREP.GT.0.AND.NREP+NUMFLD.LE.MINFLD) GO TO 180
WRITE (LP,880) NREP,NUMFLD,MINFLD
CALL SUERRS (LP,2,NUMERR)
NREP=MAXFLD-NUMFLD
180 NULREP=NREP
INWIND=1
INULL=1
GO TO 250
ENDIF
C
C CHECK FOR COMMAND
IF (LATSGN.EQ.1) THEN
IENDIN=1
GO TO 220
ENDIF
C
C CHECK FOR PARENTHESIS IN FIELD
IF (CHAR.EQ.'('.AND.LENGTH.EQ.1) GO TO 250
IF (CHAR.EQ.')'.AND.LENGTH.EQ.1) GO TO 250
IF (LLPAR.GT.0) CALL UFPACK (LCHK,CHK,ISTRT,1,LLPAR-1,IERR)
IF (LLPAR.EQ.0) CALL UFPACK (LCHK,CHK,ISTRT,1,LENGTH,IERR)
C
C CHECK FOR END OF INPUT
IF (CHK.EQ.'/') GO TO 220
C
C IF FIRST FIELD, CONTENTS HAS BEEN CHECKED FOR KEYWORD
IF (NUMFLD.EQ.0) GO TO 250
IF (CHAR.EQ.'PE') GO TO 250
C
C CHECK FOR KEYWORD
CALL SUIDCK ('DEFN',CHK,NFLD,0,IKEYWD,IERR)
IF (IERR.NE.2) GO TO 250
220 IF (NUMFLD.LT.MINFLD) THEN
INWIND=1
IENDIN=1
IF (PRNOTE.EQ.'YES') THEN
WRITE (LP,950)
CALL SULINE (LP,2)
ENDIF
GO TO 100
ENDIF
IF (ILPFND.GT.0.AND.IRPFND.EQ.0) THEN
WRITE (LP,920) NPIFLD,NPCFLD
CALL SULINE (LP,2)
ILPFND=0
IRPFND=0
ENDIF
GO TO 660
C
C PRINT CARD
250 IF (NFLD.EQ.1.AND.NUMFLD.GT.0.AND.INWIND.EQ.0) CALL SUPCRD
C
260 IF (NUMFLD+1.LE.MINFLD) GO TO 320
C
C CHECK FOR OPTIONAL FIELDS
IF (NUMFLD.GT.MAXFLD) GO TO 310
IF (NOPFLD.GT.0.AND.CHAR.EQ.'('.AND.LENGTH.EQ.1) GO TO 320
IF (NOPFLD.GT.0.AND.CHAR.EQ.')'.AND.LENGTH.EQ.1) GO TO 320
DO 270 IOPTN=1,MOPTN
IF (CHK.EQ.OPTN(IOPTN)) GO TO 280
270 CONTINUE
IF (NXTFLD.GT.0) GO TO 320
WRITE (LP,830) NUMFLD,NFLD,CHAR
CALL SUERRS (LP,2,NUMERR)
GO TO 100
280 NOPFLD=0
NXTFLD=0
IF (ILPFND.GT.0.AND.IRPFND.EQ.0) THEN
WRITE (LP,930) NPIFLD,NPCFLD
CALL SULINE (LP,2)
ILPFND=0
IRPFND=0
ENDIF
GO TO (490),IOPTN
WRITE (LP,1000) IOPTN
CALL SUERRS (LP,2,NUMERR)
GO TO 100
C
310 WRITE (LP,860) NUMFLD,MAXFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 100
C
320 IF (LLPAR.GT.0) ILPFND=1
IF (LLPAR.GT.0) IRPFND=0
IF (LRPAR.GT.0) IRPFND=1
C
C CHECK IF FIELD WITH MORE THAN ONE POSSIBLE PARAMETER
IF (NOPFLD.GT.0) GO TO (490),NOPFLD
C
C CHECK IF MAXIMUM NUMBER OF FIELDS EXPECTED EXCEEDED
330 NUMFLD=NUMFLD+1
IF (TDISP.EQ.'OLD'.AND.INULL.EQ.1) GO TO 100
C
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,770) NUMFLD,MINFLD,MAXFLD,NUMERR
CALL SULINE (IOSDBG,1)
ENDIF
C
GO TO (340,370,410,450),NUMFLD
WRITE (LP,840) CHAR
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHECK PARAMETER TYPE
340 IF (CHK.EQ.'PE') GO TO 350
WRITE (LP,850) 'PE',NFLD,CHK(1:LENSTR(CHK))
CALL SUERRS (LP,2,NUMERR)
GO TO 100
350 TYPE=CHK
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,890) TYPE
CALL SULINE (IOSDBG,1)
ENDIF
C
C CHECK IF UNITS SPECIFIED
IF (LLPAR.EQ.0) GO TO 100
IEND=LRPAR-1
IF (LRPAR.GT.0) GO TO 360
WRITE (LP,920) NUMFLD,NFLD
CALL SULINE (LP,2)
LRPAR=LENGTH-1
360 CALL UFPACK (LCHK,CHK,ISTRT,LLPAR+1,IEND,IERR)
WRITE (LP,900) CHK(1:LENSTR(CHK)),NFLD
CALL SULINE (LP,2)
GO TO 100
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C ANNEMOMETER HEIGHT
C
C CHECK FOR NULL FIELD
370 IF (INULL.EQ.1) THEN
WRITE (LP,960) NUMFLD,NPCFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
ENDIF
C
C CHECK FOR NON-CHARACTER DATA
IF (ITYPE.NE.2) GO TO 390
WRITE (LP,990) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C CHECK IF VALID VALUE
390 IF (REAL.GT.-100..AND.REAL.LT.1000.) GO TO 400
WRITE (LP,1020) REAL
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C SET ANNEMOMETER HEIGHT
400 ANEMHT=REAL
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,1130) ANEMHT
CALL SULINE (IOSDBG,1)
ENDIF
GO TO 640
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C B3 PARAMETER
C
C CHECK FOR NULL FIELD
410 IF (INULL.EQ.1) THEN
WRITE (LP,960) NUMFLD,NPCFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
ENDIF
C
C CHECK IF NON-CHARACTER DATA
IF (ITYPE.NE.2) GO TO 430
WRITE (LP,990) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C CHECK FOR VALID VALUE
430 IF (REAL.GT.-100..AND.REAL.LT.1000.) GO TO 440
WRITE (LP,1010) REAL
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C SET B3 PARAMETER
440 PEB3=REAL
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,1120) PEB3
CALL SULINE (IOSDBG,1)
ENDIF
GO TO 640
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C PRIMARY TYPE OF RADIATION DATA AVAILABLE
C
C CHECK IF NULL FIELD
450 IF (INULL.EQ.1) THEN
CHAR='SKY'
IF (PRNOTE.EQ.'YES') THEN
WRITE (LP,980) NUMFLD,NPCFLD,CHAR(1:LENSTR(CHAR))
CALL SULINE (LP,2)
ENDIF
GO TO 470
ENDIF
C
C CHECK IF CHARACTER DATA
IF (ITYPE.NE.2) THEN
WRITE (LP,990) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
ENDIF
C
C CHECK FOR VALID VALUE
470 IF (CHAR.EQ.'SKY'.OR.
* CHAR.EQ.'SUN'.OR.
* CHAR.EQ.'RAD') GO TO 480
WRITE (LP,1030) NUMFLD,NFLD,CHAR(1:LENSTR(CHAR))
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
480 ITYRAD=0
IF (CHAR.EQ.'SKY') ITYRAD=1
IF (CHAR.EQ.'SUN') ITYRAD=2
IF (CHAR.EQ.'RAD') ITYRAD=3
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,1140) ITYRAD,CHAR(1:LENSTR(CHAR))
CALL SULINE (IOSDBG,1)
ENDIF
GO TO 640
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CORRECTION FACTORS
C
C CHECK WHICH FIELD TO BE PROCESSED
490 NGOTO=NXTFLD+1
GO TO (500,560),NGOTO
C
C CHECK IF OPTIONAL FIELD PRECIOUSLY PROCESSED
500 IF (IOFLD1.EQ.0) GO TO 510
WRITE (LP,1060)
CALL SUWRNS (LP,2,NUMWRN)
NUMCF=0
C
510 IOFLD1=1
C
C CHECK FOR NULL FIELD
IF (INULL.EQ.0) GO TO 520
WRITE (LP,970) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C CHECK FOR CHARACTER DATA
520 IF (ITYPE.EQ.2) GO TO 530
WRITE (LP,990) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C CHECK FOR PARENTHESES IN FIELD
530 IF (CHAR.NE.')') GO TO 540
NOPFLD=0
NXTFLD=0
WRITE (LP,1070) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
540 IF (LLPAR.EQ.0) CHK=CHAR
IF (LLPAR.GT.0) CALL SUBSTR (CHAR,1,LLPAR-1,CHK,1)
IF (CHK.EQ.'CF') GO TO 550
WRITE (LP,1080) CHK(1:LENSTR(CHK)),NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
550 NOPFLD=1
NXTFLD=1
IF (LLPAR.EQ.0.OR.LLPAR.EQ.LENGTH) GO TO 640
C
C CHECK FOR SPECIAL CHARACTERS
560 IF (CHAR.EQ.'('.AND.LENGTH.EQ.1) GO TO 640
IF (ITYPE.NE.2) GO TO 580
IF (LRPAR.NE.1) GO TO 570
IF (NUMCF.GT.0) GO TO 640
WRITE (LP,1090)
CALL SUERRS (LP,2,NUMERR)
NOPFLD=0
NXTFLD=0
GO TO 640
570 IF (LRPAR.EQ.0.OR.LRPAR.EQ.LENGTH) GO TO 580
WRITE (LP,990) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
NXTFLD=1
GO TO 640
580 IF (LLPAR.EQ.0) IBEG=1
IF (LLPAR.GT.0) IBEG=LLPAR+1
IF (LASK.GT.0) IBEG=LASK+1
IEND=LENGTH
IF (LRPAR.EQ.0) GO TO 590
IEND=LRPAR-1
NOPFLD=0
NXTFLD=0
590 CALL UFRLFX (TPECOR,ISTRT,IBEG,IEND,0,IERR)
IF (IERR.NE.0) THEN
WRITE (LP,1040) NFLD
CALL SUERRS (LP,2,NUMERR)
ENDIF
C
C CHECK FOR MAXIMUM CORRECTION FACTORS
600 NUMCF=NUMCF+1
IF (NUMCF.LE.2) GO TO 610
WRITE (LP,1050) NUMFLD,NFLD
CALL SUERRS (LP,2,NUMERR)
GO TO 640
C
C CHECK IF GREATER THAN ZERO
610 IF (TPECOR.GT.-100..AND.TPECOR.LT.1000.) GO TO 620
WRITE (LP,1100) NUMCF,TPECOR
CALL SUERRS (LP,2,NUMERR)
NXTFLD=1
GO TO 640
C
C SET CORRECTION FACTOR
620 PECOR=TPECOR
IF (LDEBUG.GT.0) THEN
WRITE (IOSDBG,1150) NUMCF,PECOR
CALL SULINE (IOSDBG,1)
ENDIF
C
C CHECK FOR REPEATED VALUES
IF (NREP.LE.1) GO TO 630
NREP=NREP-1
GO TO 600
C
630 NXTFLD=1
IF (LRPAR.EQ.0) GO TO 640
NOPFLD=0
NXTFLD=0
GO TO 640
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHECK FOR REPEATED NULL FIELDS
640 IF (NULREP.EQ.0) GO TO 650
NULREP=NULREP-1
IF (NULREP.NE.0) GO TO 330
INWIND=0
C
650 NPIFLD=NUMFLD
NPCFLD=NFLD
C
C CHECK FOR END OF INPUT
IF (INWIND.EQ.1) GO TO 100
IF (IENDIN.EQ.1) GO TO 660
GO TO 100
C
C CHECK NUMBER OF FIELDS PROCESSED
660 IF (NUMFLD.GE.2) GO TO 670
WRITE (LP,1240)
CALL SUWRNS (LP,2,NUMWRN)
GO TO 730
C
C COMPUTE P FACTOR
670 PFACT=0.474-0.00246*ANEMHT+8.44E-6*ANEMHT**2
C
C CHECK IF STATION LATITUDE DEFINED
IF (STALOC(1).EQ.UNDEF) THEN
WRITE (LP,1170)
CALL SUERRS (LP,2,NUMERR)
GO TO 690
ENDIF
C
C SET STATION LATITUDE
STALAT=STALOC(1)
C
C DETERMINE FOURIER SERIES COEFFICIENTS
IPOINT=((STALAT-23.8)/2.)*10+0.5
IF (IPOINT.GE.1.AND.IPOINT.LE.131) GO TO 680
WRITE (LP,1160) IPOINT
CALL SUERRS (LP,2,NUMERR)
GO TO 690
680 PECOEF(1)=A0(IPOINT)
PECOEF(2)=A1(IPOINT)
PECOEF(3)=A2(IPOINT)
PECOEF(4)=A3(IPOINT)
PECOEF(5)=B1(IPOINT)
PECOEF(6)=B2(IPOINT)
C
690 IF (UNITS.EQ.'METR') GO TO 700
C
C CONVERT PARAMETERS TO REQUIRED UNITS
CALL UDUCNV ('FT ','M ',1,1,ANEMHT,ANEMHT,IERR)
IF (IERR.NE.0) THEN
WRITE (LP,1180) IERR
CALL SUERRS (LP,2,NUMERR)
ENDIF
C
C CHECK IF RUNCHECK OPTION SET
700 IF (IRUNCK.EQ.1) THEN
WRITE (LP,1190) STAID
CALL SULINE (LP,2)
GO TO 730
ENDIF
C
C CHECK IF ERRORS ENCOUNTERED
IF (NUMERR.GT.0) THEN
IF (IRUNCK.EQ.0) THEN
WRITE (LP,1200) STAID,NUMERR
CALL SULINE (LP,2)
IRUNCK=1
ELSE
WRITE (LP,1210) STAID,NUMERR
CALL SULINE (LP,2)
ENDIF
ISTAT=1
GO TO 730
ENDIF
C
C CHECK IF STATION GENERAL PARAMETERS DEFINED
IF (IFSTAN.EQ.0.OR.IFSTAN.EQ.1) GO TO 710
IF (DISP.EQ.'NEW') THEN
WRITE (LP,1220) STAID
CALL SUWRNS (LP,2,NUMWRN)
ENDIF
IF (DISP.EQ.'NEW') THEN
WRITE (LP,1230) STAID
CALL SUWRNS (LP,2,NUMWRN)
ENDIF
ISTAT=1
GO TO 730
C
C WRITE PE PARAMETERS
710 IVPE=1
WDISP=TDISP
INCLUDE 'scommon/callswpe'
IF (IERR.NE.0) THEN
ISTAT=1
GO TO 730
ENDIF
C
IF (IWRITE.EQ.0.OR.PRPARM.EQ.'NO') GO TO 730
C
C READ PE PARAMETERS
IPTR=0
IPRERR=1
INCLUDE 'scommon/callsrpe'
IF (IERR.GT.0) GO TO 730
C
C PRINT PE PARAMETERS
IPRNT=1
INCLUDE 'scommon/callsppe'
C
730 NSTERR=NSTERR+NUMERR
NSTWRN=NSTWRN+NUMWRN
C
IF (ISTRCE.GT.0) THEN
WRITE (IOSDBG,1250) ISTAT
CALL SULINE (IOSDBG,1)
ENDIF
C
RETURN
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
740 FORMAT (' *** ENTER SFPE')
750 FORMAT (' ')
760 FORMAT ('0*--> DEFINE STATION PE PARAMETERS')
770 FORMAT (' NUMFLD=',I2,3X,'MINFLD=',I2,3X,'MAXFLD=',I2,3X,
* 'NUMERR=',I2)
780 FORMAT ('0*** NOTE - DISPOSITION OF NEW WAS SPECIFIED ',
* 'FOR STATION ',A,' BUT PE PARAMETERS ALREADY EXIST.')
790 FORMAT ('0*** WARNING - PE PARAMETERS FOR STATION ',A,
* ' DO NOT EXIST. DISP ASSUMED TO BE NEW FOR THIS DATA GROUP.')
800 FORMAT ('0*** ERROR - STATION IDENTIFIER NOT SPECIFIED. ',
* 'CHECK FOR MISSING OR INCOMPLETE ''STAN'' INPUT.')
810 FORMAT (' DEFINE OPTIONS IN EFFECT : ',
* 'DISP=',A,3X,
* 'PRNTPARM=',A,3X,
* 'PRNTNOTE=',A,3X,
* 'UNITS=',A)
820 FORMAT ('0*** ERROR - PREPROCESSOR PARAMETRIC DATA BASE FILES ',
* 'ARE NOT ALLOCATED. INPUT DATA WILL BE CHECKED FOR ERRORS.')
830 FORMAT ('0*** ERROR - INVALID DEFINE PE STATION OPTION ',
* 'IN INPUT FIELD ',I2,' (CARD FIELD ',I2,') : ',A)
840 FORMAT ('0*** ERROR - PROCESSING OPTION : ',A)
850 FORMAT ('0*** ERROR - IN SFPE - THE CHARACTERS ''',A,
* ''' WERE EXPECTED IN FIELD ',I2,' BUT ''',A,''' WERE FOUND.')
860 FORMAT ('0*** ERROR - FIELD ',I2,' EXCEEDS MAXIMUM ALLOWABLE ',
* 'FIELDS (',I2,').')
880 FORMAT ('0*** ERROR - ',I3,' IS AN INVALID NUMBER OF NULL ',
* 'TO BE REPEATED. CURRENT FIELD IS ',I2,'. MAXIMUM REQUIRED ',
* 'FIELDS ALLOWED IS ',I2,'.')
890 FORMAT (' PARAMETER TYPE IS ',A)
900 FORMAT ('0*** NOTE - UNITS CODE (',A,') FOUND IN CARD FIELD ',
* I2,' NOT USED FOR DEFINING PE PARAMETERS.')
910 FORMAT (' BLANK STRING FOUND IN FIELD ',I2)
920 FORMAT ('0*** NOTE - RIGHT PARENTHESES ASSUMED IN INPUT FIELD ',
* I2,' (CARD FIELD ' ,I2,').')
930 FORMAT ('0*** NOTE - RIGHT PARENTHESES ASSUMED IN INPUT FIELD ',
* I2,'+ (CARD FIELD ' ,I2,').')
950 FORMAT ('0*** NOTE - REMAINING STATION PE PARAMETERS WILL ',
* 'BE SET TO DEFAULT VALUES.')
960 FORMAT ('0*** ERROR - NO VALUE FOUND FOR REQUIRED INPUT FIELD ',
* I2,' (CARD FIELD ',I2,'+).')
970 FORMAT ('0*** ERROR - NO VALUE FOUND FOR OPTIONAL INPUT FIELD ',
* I2,' (CARD FIELD ',I2,'+).')
980 FORMAT ('0*** NOTE - NO VALUE FOUND FOR REQUIRED INPUT FIELD ',
* I2,' (CARD FIELD ',I2,'). DEFAULT VALUE (',A,
* ') WILL BE USED.')
990 FORMAT ('0*** ERROR - NON-CHARACTER DATA EXPECTED IN INPUT ',
* 'FIELD ',I2,' (CARD FIELD ',I2,').')
1000 FORMAT ('0*** ERROR - PROCESSING DEFINE STATION PE OPTION ',
* 'NUMBER ',I2,'.')
1010 FORMAT ('0*** ERROR - B3 PARAMETER MUST BE GREATER ',
* 'THAN -100 AND LESS THAN 1000. VALUE INPUT IS ',F9.2,'.')
1020 FORMAT ('0*** ERROR - ANNEMOMETER HEIGHT MUST BE GREATER ',
* 'THAN -100 AND LESS THAN 1000. VALUE INPUT IS ',F9.2,'.')
1030 FORMAT ('0*** ERROR - INVALID POTENTIAL EVAPORATION AVAILABLE ',
* 'OPTION IN INPUT FIELD ',I2,' (CARD FIELD ',I2,') : ',A)
1040 FORMAT ('0*** ERROR - INVALID CHARACTER FOUND IN ',
* 'CARD FIELD ',I2,'.')
1050 FORMAT ('0*** ERROR - MAXIMUM NUMBER OF CORRECTION FACTORS ',
* '(2) EXCEEDED IN INPUT FIELD ',I2,'+ (CARD FIELD ',I2,').')
1060 FORMAT ('0*** WARNING - POTENTIAL EVAPORATION CORRECTION ',
* 'FACTORS HAVE ALREADY BEEN DEFINED.')
1070 FORMAT ('0*** ERROR - NO POTENTIAL EVAPORATION CORRECTION ',
* 'FACTORS FOUND IN INPUT FIELD ',I2,' (CARD FIELD ',I2,').')
1080 FORMAT ('0*** ERROR - PROCESSING POTENTIAL EVAPORATION ',
* 'CORRECTION FACTOR INDICATOR (',A,') IN INPUT FIELD ',I2,
* ' (CARD FIELD ',I2,').')
1090 FORMAT ('0*** ERROR - NO POTENTIAL EVAPORATION CORRECTION ',
* 'FACTORS FOUND.')
1100 FORMAT ('0*** ERROR - PE CORRECTION FACTOR ',I2,' MUST BE ',
* 'GREATER THAN -100 AND LESS THAN 1000. VALUE INPUT IS ',
* F9.2,'.')
1120 FORMAT (' B3 PARAMETER SET TO : ',F9.2)
1130 FORMAT (' ANNEMOMETER HEIGHT SET TO : ',F9.2)
1140 FORMAT (' TYPE OF RADIATION DATA AVAILABLE INDICATOR SET TO : ',
* I6,2X,'(',A,')')
1150 FORMAT (' CORRECTION FACTOR ',I1,' SET TO : ',F9.2)
1160 FORMAT ('0*** ERROR - FOURIER SERIES COEFFICIENTS CANNOT BE ',
* 'COMPUTED BECAUSE OF BAD ARRAY POINTER. IPOINT=',I2,'.')
1170 FORMAT ('0*** ERROR - FOURIER SERIES COEFFICIENTS CANNOT BE ',
* 'COMPUTED BECAUSE STATION LATITUDE NOT DEFINED.')
1180 FORMAT ('0*** ERROR - CONVERTING PARAMETERS. UDUCNV STATUS ',
* 'CODE=',I2)
1190 FORMAT ('0*** NOTE - PE PARAMETERS FOR STATION ',A,
* ' NOT WRITTEN BECAUSE RUNCHECK OPTION IS SET.')
1200 FORMAT ('0*** NOTE - PE PARAMETERS FOR STATION ',A,
* ' NOT WRITTEN BECAUSE ',I2,' ERRORS ENCOUNTERED. ',
* 'RUNCHECK OPTION SET FOR THIS STATION.')
1210 FORMAT ('0*** NOTE - PE PARAMETERS FOR STATION ',A,
* ' NOT WRITTEN BECAUSE ',I2,' ERRORS ENCOUNTERED.')
1220 FORMAT ('0*** WARNING - PE PARAMETERS FOR STATION ',A,
* ' NOT WRITTEN BECAUSE STAN PARAMETERS NOT SUCCESSFULLY ',
* 'DEFINED.')
1230 FORMAT ('0*** WARNING - PE PARAMETERS FOR STATION ',A,
* ' NOT WRITTEN BECAUSE STAN PARAMETERS NOT SUCCESSFULLY ',
* 'REDEFINED.')
1240 FORMAT ('0*** WARNING - NO PE PARAMETER VALUES FOUND.')
1250 FORMAT (' *** EXIT SFPE - ISTAT=',I2)
C
END
|
program joinf10
IMPLICIT none
integer i,j,k,i1,ii,ich,jj,kk
double precision a,b,pieni
character*20 title1,title2
character*8192 ch
dimension a(1000,60),b(1000,60)
open(11,form='formatted',status='unknown')
pieni=1d-38
i=1
1 continue
read(22,*,end=2) (a(i,j), j=1,60)
if(abs(a(i,3)).gt.pieni) i=i+1
goto 1
2 k=1
3 continue
read(23,*,end=100) (b(k,j), j=1,60)
if(abs(b(k,3)).gt.pieni) k=k+1
goto 3
100 continue
i=i-1
k=k-1
ii=1
kk=1
if(i.eq.0.and.k.eq.0) then
goto 999
else if(i.eq.0.and.k.ne.0) then
do 4 i1=1,k
write(ch,*) (b(i1,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 700
enddo
700 write(11,'(a)') ch(:ich)
4 continue
else if(i.ne.0.and.k.eq.0) then
do 5 i1=1,i
write(ch,*) (a(i1,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 701
enddo
701 write(11,'(a)') ch(:ich)
5 continue
else
6 continue
if(a(ii,7).le.b(kk,7)) then
write(ch,*) (a(ii,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 702
enddo
702 write(11,'(a)') ch(:ich)
ii=ii+1
else
write(ch,*) (b(kk,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 703
enddo
703 write(11,'(a)') ch(:ich)
kk=kk+1
endif
if(ii.gt.i.and.kk.gt.k) then
goto 999
else if(ii.gt.i.and.kk.le.k) then
do 7 jj=kk,k
write(ch,*) (b(jj,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 704
enddo
704 write(11,'(a)') ch(:ich)
7 continue
goto 999
else if(ii.le.i.and.kk.gt.k) then
do 8 jj=ii,i
write(ch,*) (a(jj,j), j=1,60)
do ich=8192,1,-1
if(ch(ich:ich).ne.' ') goto 705
enddo
705 write(11,'(a)') ch(:ich)
8 continue
goto 999
else
goto 6
endif
endif
999 continue
close(11)
stop
end
|
c$Id:$
subroutine pblenda1(i,i1,i2,is,iside,isd,flsd)
c * * F E A P * * A Finite Element Analysis Program
c.... Copyright (c) 1984-2014: Regents of the University of California
c All rights reserved
c-----[--.----+----.----+----.-----------------------------------------]
c Modification log Date (dd/mm/year)
c Original version 01/11/2006
c-----[--.----+----.----+----.-----------------------------------------]
c Purpose: Find side number for 2-d blend.
c Inputs:
c is(isd,*) - Blending side supernode lists
c iblend(*) - Blending functions parameters/sides
c isd - Dimension for sides array
c Outputs:
c iside(4) - Side connection numbers for face
c flsd - false if no new side needed
c-----[--.----+----.----+----.-----------------------------------------]
implicit none
include 'cblend.h'
logical flsd
integer i,i1,i2,i3,i4, j,k, isd
integer is(isd,*),iside(*)
save
c Check each side
do j = 1,numsd
i3 = is(1,j)
if(i3.eq.0 .or. i3.eq.1 .or.i3.eq.3) then
k = 3
elseif(i3.eq.2) then
do i4 = 3,isd
if(is(i4,j).ne.0) then
k = i4
endif
end do ! i4
endif
if((i1.eq.is(2,j) .and. i2.eq.is(k,j)) .or.
& (i1.eq.is(k,j) .and. i2.eq.is(2,j))) then
iside(i) = j
flsd = .false.
return
endif
end do ! j
flsd = .true.
end
|
c -- $Id: genctl.F,v 1.2 2001/07/03 21:29:18 bill Exp $
c -- $Source: /usr/local/portgcm/src/cvsroot/genesis.2.2/Agcm/genctl.F,v $
c -- $Name: $
C
C ***************************** GENCTL ********************************
C
c=========================
#if ! defined ( coupogcm )
c=========================
PROGRAM GENCTL
C ---------------------------------------------------------------------
C
CL MAIN PROGRAM FOR THE GENESIS GCM
C
C ---------------------------------------------------------------------
#include <PARAMS.h>
C----------------------------------------------------------------------
#include <COMLUN.h>
C----------------------------------------------------------------------
#include <COMTIM.h>
C----------------------------------------------------------------------
LOGICAL IFEXIST
C----------------------------------------------------------------------
C Initialize model
#if defined ( aixsummary )
! - initialize for summary call (echos resource use) at end:
c call start()
#endif
c Set floating-point exception handler for sun (solaris)
#if defined (sun)
external hand1, hand2, hand3
ier = ieee_handler ('set', 'division', hand1)
ier = ieee_handler ('set', 'overflow', hand2)
ier = ieee_handler ('set', 'invalid', hand3)
#endif
c Delete stub file that will signify normal end (not abend)
open (188, file='okend', status='unknown')
close (188, status='delete')
CALL BASIC
IER = FLUSH (NOUT)
C Step through the run
DO 100 IS = NRSTRT, NSTOP
NSTEP = IS
CALL LINEMS
c Check for external stop signal
inquire (file='STOP', exist=ifexist)
if (ifexist) then
write(nout,*) '------------------------------------'
write(nout,*) '*** Stopping: file STOP detected ***'
write(nout,*) '------------------------------------'
open (99, file='STOP', status='old')
close (99, status='delete')
call endrun (0)
endif
100 CONTINUE
#if defined ( aixsummary )
! - initialize for summary call (echos resource use) at end:
! - call summary to echo resource use:
call summary()
#endif
WRITE (NOUT,200)
200 FORMAT(/' --------------------------------'
* /' ******* END OF MODEL RUN *******'
* /' --------------------------------'/)
c create stub file to signify normal end of run:
open (188, file='okend', status='new')
close (188)
CALL ENDRUN (0)
END
c=====
#endif
c=====
C
C ***************************** LINEMS ********************************
C
SUBROUTINE LINEMS
C----------------------------------------------------------------------
C
CL CONTROL PHYSICS, DYNAMICS, HISTORY, REGEN/RESTART,
CL THROUGH ONE TIME STEP
C
C----------------------------------------------------------------------
#include <PARAMS.h>
C----------------------------------------------------------------------
#include <COMBUD.h>
C----------------------------------------------------------------------
#include <COMCON.h>
C----------------------------------------------------------------------
#include <COMDRY.h>
C----------------------------------------------------------------------
#include <COMDYR.h>
C----------------------------------------------------------------------
#include <COMFLG.h>
C----------------------------------------------------------------------
#include <COMHED.h>
C----------------------------------------------------------------------
#include <COMHIS.h>
C----------------------------------------------------------------------
#include <COMHIX.h>
C----------------------------------------------------------------------
#include <COMHIY.h>
C----------------------------------------------------------------------
#include <COMIMP.h>
C----------------------------------------------------------------------
#include <COMLUN.h>
C----------------------------------------------------------------------
#include <COML10.h>
C----------------------------------------------------------------------
#include <COML30.h>
C----------------------------------------------------------------------
#include <COML50.h>
C----------------------------------------------------------------------
#include <COMMAP.h>
C----------------------------------------------------------------------
#include <COMMP2.h>
C----------------------------------------------------------------------
#include <COMMUN.h>
C----------------------------------------------------------------------
#include <COMSDT.h>
C----------------------------------------------------------------------
#include <COMTIM.h>
C----------------------------------------------------------------------
#include <CRDCTL.h>
C----------------------------------------------------------------------
c Local arrays to enable use of sigma-hybrid coords
c (prognostic u,v,t on sigma, prognostic q and tracers on hybrid):
c yu_eta = eastward velocity on hybrid coords (time n)
c yv_eta = northward velocity on hybrid coords (time n)
c yt_eta = temperature on hybrid coords (time n)
c yq_sig = specific humidity on sigma coords (time n)
c ypm = pressures at mid-layer points on hybrid coords (time n)
c ypl = pressures at layer interfaces on hybrid coords (time n)
c ypthicm= layer pressure-thicknesses on hybrid coords (time n-1)
c ypthic = layer pressure-thicknesses on hybrid coords (time n)
c ypthicp= layer pressure-thicknesses on hybrid coords (time n+1)
c ypmcap = ypm**cappa on hybrid coords (time n)
c yplcap = ypl**cappa on hybrid coords (time n)
c wslt = first d[ln(ps)]/dt, then etadot or sigdot (time n)
DIMENSION
* YU_ETA(NLON,NOREC,NLEV), YV_ETA(NLON,NOREC,NLEV),
* YT_ETA(NLON,NOREC,NLEV), YQ_SIG(NLON,NOREC,NLEV),
* YPM(NLON,NOREC,NLEV), YPL(NLON,NOREC,NLEVP),
* YPTHICM(NLON,NOREC,NLEV), YPTHIC(NLON,NOREC,NLEV),
* YPTHICP(NLON,NOREC,NLEV),
* YPMCAP(NLON,NOREC,NLEV), YPLCAP(NLON,NOREC,NLEVP),
* WSLT(NLON,NOREC,NLEV)
c For slt global mass-adjustment fixer (traglob)
DIMENSION
* TROLD(NLON,NOREC,NLEV,NTRACE), YPTHICOLD(NLON,NOREC,NLEV)
#ifdef isotrac
dimension trold_o(nlon,norec,nlev,3), trold_h(nlon,norec,nlev,3)
#endif
DIMENSION WORKH(NLON,NOREC)
CHARACTER CMD*200, CNAME*96, DNAME*96, CONCAT*96
LOGICAL TESTHIST
parameter (pi=3.14159265358979)
C----------------------------------------------------------------------
C
CL CALCULATE CURRENT DATE AND SECONDS, CALENDAR VARIABLES
C
CALL NUTIME (MCDATE, MCSEC, MBDATE, NSTEP, DTIME, 0)
CALL CALDYI (JYEAR, JMNTH, JDAY, CALDAY, CALSEC, ISTEPY,
* MCDATE, MCSEC, MBDATE, DTIME)
C
CL SET HISTORY FLAGS: FAHIST(ACCUMULATION), FWHIST(WRITE),
CL FSAVE(SAVE), FNEXF(NEXT FILE). TEST ON ISTEPY, THE
CL TIMESTEP WITHIN CURRENT 365-DAY YEAR.
C
FAHIST = .FALSE.
FWHIST = .FALSE.
FSAVE = .FALSE.
FNEXF = .FALSE.
C
DO 130 I=1,NHISTN
IF (NHIST(I,1).LE.NHIST(I,2)) THEN
IF (ISTEPY.GE.NHIST(I,1) .AND. ISTEPY.LE.NHIST(I,2))
* FAHIST = .TRUE.
ELSE
IF (ISTEPY.GE.NHIST(I,1) .OR. ISTEPY.LE.NHIST(I,2))
* FAHIST = .TRUE.
ENDIF
IF (ISTEPY.EQ.NHIST(I,2)) FWHIST = .TRUE.
IF (HISTLAST .AND. NSTEP.EQ.NSTOP) FWHIST = .TRUE.
130 CONTINUE
C
DO 132 I=1,NSAVEN
IF (ISTEPY.EQ.NSAVE(I)) FSAVE = .TRUE.
132 CONTINUE
C
DO 134 I=1,NNEXFN
IF (ISTEPY.EQ.NNEXF(I)) FNEXF = .TRUE.
134 CONTINUE
C
CL LAST TIMESTEP OR NEXT-FILE AUTOMATICALLY FORCES FSAVE
C
IF (NSTEP.EQ.NSTOP .OR. FNEXF) FSAVE = .TRUE.
C
CL INITIALIZE VARIOUS GRID ARRAYS FOR SIGETA/SLT SUBRS
C
IF (NSTEP.EQ.NRSTRT) CALL SLTINI (ALONG,ALATG,SIG,SIGKMH,HYBTYPE)
c Apply first-timestep perturbation test if requested
if (nstep.eq.nrstrt .and. perturb.ne.0.) then
#if defined ( aix )
call random_seed()
#elif defined ( cray )
zdum = ranset(12345)
#elif defined ( sgi )
call srand(12345)
#elif defined ( sun )
zdum = rand(12345)
#elif defined ( linux )
zdum = 0
call random_seed()
#else
write (*,*) 'Error (linems, ran1): unrecognized machine type'
call endrun (-1)
#endif
write (nout,138) perturb
138 format (/'*** Applying air-temperature perturbations',
* ' *(1 +/- ran*', e15.5,' )' )
do jk=1,nlev
do jj=1,norec
do ji=1,nlon
#if defined ( aix )
call random_number(zran)
#elif defined ( cray )
zran = ranf()
#elif defined ( sgi )
zran = rand(0)
#elif defined ( sun )
zran = rand(0)
#elif defined ( linux )
call random_number(zran)
#else
write(*,*) 'Error (linems,ran2):unrecognized machine type'
call endrun (-1)
#endif
zz = 1. + perturb*(2.*(zran-0.5))
c zz = 1. + perturb * sin(2.*3.1415927*(ji+jj+jk)/20.)
ytm1(ji,jj,jk) = ytm1(ji,jj,jk) * zz
yt(ji,jj,jk) = yt(ji,jj,jk) * zz
enddo
enddo
enddo
endif
C
CL TIME FILTER PART 1. STORE (1-2*EPS)*Y... + EPS*Y...M1
CL IN TEMPORARY FILE TO BE READ BY TIME FILTER PART 2.
CL DO BEFORE PHYS, WHICH CHANGES YQM1.
C
CALL TIMESM (YUM1, YU,
#ifdef isotrac
* yqm1_o, yq_o, yqm1_h, yq_h, rtrqm1,rtrq,
#endif
* 1)
C
CL SET YPSM1 AND YPS. YPSM1(TIME N-1) IS NEEDED FOR
CL PHYS (BUDGETS), SLT. YPS (TIME N) IS
CL NEEDED IN SIGETA, PHYS(VDIF),OMCALC, DYN(STATS), SLT.
C
DO 140 JJ = 1,NOREC
DO 142 JI = 1,NLON
YPS(JI,JJ) = EXP (YLPS(JI,JJ))
YPSM1(JI,JJ) = EXP (YLPSM1(JI,JJ))
142 CONTINUE
140 CONTINUE
c Calculate VOMEGA = d[p]/dt at time n on sigma coords
c (for etadot and for spectral)
CALL OMCALC
CALL PUTHIS (VOMEGA, 35)
c Calculate WSLT = d[ln(ps)]/dt at time n on sigma coords
CALL LPSDOT (YU, YV, YD, YDPSL, YDPSM, DSIGMA, WSLT)
call prinverv (wslt, 'd[ln(ps)]/dt * sigma(jk)')
call prinverv (vomega, 'omega / ps')
c Convert WSLT to d[eta]/dt (if hybrid coords used) or to
c d[sig]/dt (if sigma coords used). In either case, WSLT is still
c on sigma grid.
CALL ETADOT (WSLT, VOMEGA, YPS, SIG, HYBTYPE)
CALL PUTHIS (WSLT, 36)
if (hybtype.eq.0) then
call prinverv (wslt, 'sigdot')
else
call prinverv (wslt, 'etadot')
endif
c Interpolate U,V,T to eta grid for phys and slt, WSLT to eta grid
c for slt, Q to sigma grid for vdif and spectral, all at time n.
c (Y*_ETA,WSLT,YQ_SIG,YPM, YPTHIC* are local arrays in linems.)
c (If hybrid-slt not used, SIGETA merely copies 1st array to 2nd.)
#if defined ( omp )
!$OMP PARALLEL DO DEFAULT (NONE)
!$OMP* shared (yu, yu_eta, yps, hybtype,
!$OMP* yv, yv_eta,
!$OMP* yt, yt_eta,
!$OMP* wslt,
!$OMP* yq, yq_sig)
!$OMP* private (jj)
!$OMP* schedule(dynamic,2)
#endif
DO 300 JJ=1,NOREC
CALL SIGETA (YU, YU_ETA, JJ, NOREC, YPS, JJ, 1, 1, HYBTYPE)
#ifdef omp
CALL SIGETA (YV, YV_ETA, JJ, NOREC, YPS, JJ, 1, 1, HYBTYPE)
CALL SIGETA (YT, YT_ETA, JJ, NOREC, YPS, JJ, 1, 1, HYBTYPE)
CALL SIGETA (WSLT, WSLT, JJ, NOREC, YPS, JJ, 1, 1, HYBTYPE)
#else
CALL SIGETA (YV, YV_ETA, JJ, NOREC, YPS, JJ, 1, 0, HYBTYPE)
CALL SIGETA (YT, YT_ETA, JJ, NOREC, YPS, JJ, 1, 0, HYBTYPE)
CALL SIGETA (WSLT, WSLT, JJ, NOREC, YPS, JJ, 1, 0, HYBTYPE)
#endif
CALL SIGETA (YQ, YQ_SIG, JJ, NOREC, YPS, JJ, -1, 1, HYBTYPE)
300 CONTINUE
c Calculate mid-pt pressures (YPM), etc, (including layer
c pressure-thicknesses YPTHIC) on eta grid at time n, for phys
c and slt. If hybrid coords not used, YPM to YPLCAP are just set
c to appropriate sigma-grid values.
CALL ETAPRES (YPS, SIG, SIGKMH, YPM, YPL, YPTHIC, YPMCAP, YPLCAP,
* CAPPA, HYBTYPE)
c write(*,*)
c do 8880 k=1,nlev
c zmin = 1.e20
c zmax = -1.e20
c do 8881 j=1,norec
c do 8881 i=1,nlon
c zmin = min (zmin, ypm(i,j,k))
c zmax = max (zmax, ypm(i,j,k))
c8881 continue
c write(*,8882) k, zmin, zmax, zmax-zmin
c8882 format(' k=',i3,' zmin=',f15.6,' zmax=',f15.6,' delt=',f15.6)
c8880 continue
c write(*,*)
c Also call stripped-down etapres_a with YPSM1, for YPTHICM
c at time n-1 (used for budget and slt global conservation)
CALL ETAPRES_A (YPSM1, SIG, SIGKMH, YPTHICM, HYBTYPE)
c Call column and surface "physics"
call pringlob (ypthicm, ypthic, 'prephys')
#ifdef isotrac
call prout_i (ypthicm, ypthic, 'prePHYS ')
#endif
CALL PHYS (YUM1, YVM1, YTM1, YQM1,
* YU, YV, YT, YQ,
* YU_ETA, YV_ETA, YT_ETA, YQ_SIG,
* YLWC_C, YLWC_A, YLWC_S,
* FPLUMT, FPLUMQ, FPLUMU, FPLUMV,
* TRACER, TRAFLUX,YPM, YPL, YPTHIC, YPMCAP,
* YFI
#ifdef isotrac
* ,yqm1_o, yqm1_h, yq_o, yq_h, ylwc_c_o, ylwc_c_h,
* ylwc_a_o, ylwc_a_h, ylwc_s_o, ylwc_s_h,
* fplumq_o, fplumq_h,
* rtrqm1, rtrq, rtrfq
#endif
* )
#ifdef isotrac
call prout_i (ypthic , ypthic, 'postPHYS ')
#endif
call pringlob (ypthicm, ypthic, 'postphys')
C
CL SAVE PRE-ADVECTION FIELDS FOR LATER GLOBAL MASS
CL ADJUSTMENT FOR TRACERS (TRAGLOB)
C
CALL SCOPY (NLON*NOREC*NLEV*NTRACE, TRACER, 1, TROLD, 1)
CALL SCOPY (NLON*NOREC*NLEV, YPTHIC, 1, YPTHICOLD, 1)
#ifdef isotrac
call scopy (nlon*norec*nlev, ylwc_c_o, 1, trold_o(1,1,1,1),1)
call scopy (nlon*norec*nlev, ylwc_c_h, 1, trold_h(1,1,1,1),1)
call scopy (nlon*norec*nlev, ylwc_a_o, 1, trold_o(1,1,1,2),1)
call scopy (nlon*norec*nlev, ylwc_a_h, 1, trold_h(1,1,1,2),1)
call scopy (nlon*norec*nlev, ylwc_s_o, 1, trold_o(1,1,1,3),1)
call scopy (nlon*norec*nlev, ylwc_s_h, 1, trold_h(1,1,1,3),1)
#endif
C
CL TWO DELTA-T LEAPFROG TIMESTEP AND HORIZONTAL DIFFUSION
CL FROM N-1 TO N+1 (PUTS N+1 VALUES IN COML30 (Y*),
CL DESTROYS COML10 (Y*M1))
C
call pringlob (ypthicm, ypthic, 'prespec')
c zke = 0.
c zak = 0.
c zps = 0.
c zas = 0.
c do jj=1,norec
c do ji=1,nlon
c do jk=1,nlev
c zwei = sqrt(cs(jj)) * dsigma(jk)
c zke = zke + (yu(ji,jj,jk)**2 + yv(ji,jj,jk)**2)*zwei
c zak = zak + zwei
c enddo
c zwei = sqrt(cs(jj)) * dsigma(jk)
c zps = zps + exp(ylps(ji,jj))*zwei
c zas = zas + zwei
c enddo
c enddo
c write (6,'(/a,i5,2f15.5)')
c * 'luna: before dyn: nstep, zke, zps=',
c * nstep, sqrt(zke/zak), zps/zas
CALL DYN (YQ_SIG)
c zke = 0.
c zak = 0.
c zps = 0.
c zas = 0.
c do jj=1,norec
c do ji=1,nlon
c do jk=1,nlev
c zwei = sqrt(cs(jj)) * dsigma(jk)
c zke = zke + (yu(ji,jj,jk)**2 + yv(ji,jj,jk)**2)*zwei
c zak = zak + zwei
c enddo
c zwei = sqrt(cs(jj)) * dsigma(jk)
c zps = zps + exp(ylps(ji,jj))*zwei
c zas = zas + zwei
c enddo
c enddo
c write (6,'(a,i5,2f15.5)')
c * 'luna: after dyn: nstep, zke, zps=',
c * nstep, sqrt(zke/zak), zps/zas
c Impose upper limit (namelist) on air temperatures
if (hotlimit.ne.-999.) then
do k=1,nlev
do j=1,norec
do i=1,nlon
yt(i,j,k) = min (yt(i,j,k), tmelt+hotlimit)
enddo
enddo
enddo
endif
C
CL LOCALLY CORRECT SURFACE PRESSURE DUE TO THIS TIMESTEP'S
CL NET WATER-MASS FLUX, RESET YLPS AND YPS, AND CALCULATE
CL YPTHICP FOR TIME N+1 (FOR SLT GLOBAL CONSERVATION AND
CL DRY MASS ADJUST)
C
DO 400 JJ=1,NOREC
DO 402 JI=1,NLON
YPS(JI,JJ) = EXP (YLPS(JI,JJ))
YPS(JI,JJ) = YPS(JI,JJ)
* - ( FRAINC(JI,JJ) + FSNOWC(JI,JJ)
* + FRAINS(JI,JJ) + FSNOWS(JI,JJ) - YQFLX(JI,JJ) )
* * GRAVIT * TWODT
YLPS(JI,JJ) = LOG (YPS(JI,JJ))
402 CONTINUE
400 CONTINUE
CALL ETAPRES_A (YPS, SIG, SIGKMH, YPTHICP, HYBTYPE)
C
CL SLT ADVECTION FOR YQM1 -> YQ (LEAPFROG, TIME N-1 TO N+1)
CL AND FOR TRACERS INCLUDING LIQUID WATER AMOUNTS AND
CL FLUX RESERVOIRS (NON-LEAPFROG, TIME N-1 TO N)
C
C Convert flux reservoirs from total-for-layer to per-kg
C (fplum* are equivalenced to tracers). Only advect t-reservoir,
C since advecting q-reservoir causes blowup, and physical
C justification for advecting u,v-reservoirs is unclear.
C (q,u,v reservoirs are tracer #s 5-7).
C
DO 420 JK=1,NLEV
DO 422 JJ=1,NOREC
DO 424 JI=1,NLON
ZM = YPTHIC(JI,JJ,JK)/GRAVIT
FPLUMT(JI,JJ,JK) = FPLUMT(JI,JJ,JK) / ZM
c FPLUMQ(JI,JJ,JK) = FPLUMQ(JI,JJ,JK) / ZM
c FPLUMU(JI,JJ,JK) = FPLUMU(JI,JJ,JK) / ZM
c FPLUMV(JI,JJ,JK) = FPLUMV(JI,JJ,JK) / ZM
424 CONTINUE
422 CONTINUE
420 CONTINUE
c
CALL SLTHYB (W, SIG, SIGKMH, DSIGMA,
* GRAVIT, REARTH, TWODT,
* YU_ETA, YV_ETA, WSLT, WSLTSAV,
* PRIESTQ, STRATTIME, STRATFLAG, SMOLAR,
* YPTHICM, YPTHICP,
* YQM1, YQ, TRACER, NTRACE, NTRACA,
* ALONSAV, ALATSAV, SIGSAV,
* TOTQO, TOTQN, TOTQA
#ifdef isotrac
* ,yqm1_o, yq_o, yqm1_h, yq_h, ylwc_c_o, ylwc_c_h,
* ylwc_a_o, ylwc_a_h, ylwc_s_o, ylwc_s_h,
* rtrqm1, rtrq, nrtr
#endif
* )
C
C Convert flux reservoirs back to layer totals
C
DO 430 JK=1,NLEV
DO 432 JJ=1,NOREC
DO 434 JI=1,NLON
ZM = YPTHICP(JI,JJ,JK)/GRAVIT
FPLUMT(JI,JJ,JK) = FPLUMT(JI,JJ,JK) * ZM
c FPLUMQ(JI,JJ,JK) = FPLUMQ(JI,JJ,JK) * ZM
c FPLUMU(JI,JJ,JK) = FPLUMU(JI,JJ,JK) * ZM
c FPLUMV(JI,JJ,JK) = FPLUMV(JI,JJ,JK) * ZM
434 CONTINUE
432 CONTINUE
430 CONTINUE
c write variables needed by slt to a file for offline driver
c call sltoff (nstep, dtime, mcdate, calday, hybtype,
c * along, alatg, cosbud, sig, sigkmh, dsigma,
c * gravit, rearth, twodt,
c * yu_eta, yv_eta, wslt, wsltsav,
c * yps, ypm, ypl, ypthicm, ypthic, ypthicp,
c * albsud, albsui, solsud, solsui, cosq,
c * yt_eta, yqm1, yq,
c * ylwc_c, ylwc_a, ylwc_s)
C
C Save slt advection rate to history file
C
IF (TESTHIST(53,1)) THEN
DO 500 JK = 1,NLEV
DO 502 JJ = 1,NOREC
DO 504 JI = 1,NLON
HISTMP(JI,JJ,JK) = (YQ(JI,JJ,JK)-YQM1(JI,JJ,JK)) / TWODT
504 CONTINUE
502 CONTINUE
500 CONTINUE
CALL PUTHIS (HISTMP, 53)
ENDIF
C
C Increment budget slt conservative adjustment for q
C
DWFIX = DWFIX + 0.5* (TOTQA-TOTQN)
DWFIXA = DWFIXA + 0.5*ABS(TOTQA-TOTQN)
c write(*,520) nstep, totqo, totqn, totqa, (totqa-totqn)/totqn
c 520 format('nstep=',i8, ' totqo=',f14.8,' totqn=',f14.8,
c * ' totqa=',f14.8,' frac=',f14.8)
C
CL DO DRY MASS ADJUSTMENT FOR TIME N+1 (RESETS YPS AND YLPS)
C
C Compute global atmospheric mass (tmass,qmass are local vars)
TMASS = 0.
DO 800 JJ=1,NOREC
ZWEI = COSBUD(JJ)/NLON
DO 802 JI=1,NLON
TMASS = TMASS + ZWEI*YPS(JI,JJ)/GRAVIT
802 CONTINUE
800 CONTINUE
C Compute global mass of water vapor (including reservoir fplumq)
c and cloud liquid water
QMASS = 0.
DO 810 JK=1,NLEV
DO 812 JJ=1,NOREC
ZWEI = COSBUD(JJ)/NLON
DO 814 JI=1,NLON
ZH2O = YQ(JI,JJ,JK)
* + YLWC_C(JI,JJ,JK) + YLWC_A(JI,JJ,JK) +YLWC_S(JI,JJ,JK)
QMASS = QMASS + ZWEI*(YPTHICP(JI,JJ,JK)/GRAVIT)*ZH2O
* + ZWEI*FPLUMQ(JI,JJ,JK)
814 CONTINUE
812 CONTINUE
810 CONTINUE
C Impose a globally uniform surface pressure correction to restore
C dry mass to drymass (in Pa, set in topini), and reset ylps,ypthicp
c for time n+1.
ZADD = DRYMASS - (TMASS-QMASS)*GRAVIT
DO 820 JJ=1,NOREC
DO 822 JI=1,NLON
YPS(JI,JJ) = YPS(JI,JJ) + ZADD
YLPS(JI,JJ) = LOG (YPS(JI,JJ))
c To avoid roundoff error in global mass fixer for tracers:
YPS(JI,JJ) = EXP (YLPS(JI,JJ))
822 CONTINUE
820 CONTINUE
CALL ETAPRES_A (YPS, SIG, SIGKMH, YPTHICP, HYBTYPE)
C Accumulate dry-mass correction (in units of Pa) for budget
DMASS = DMASS + 0.5*ZADD
DMASSA = DMASSA + 0.5*ABS(ZADD)
c write(6,901) nstep, tmass*gravit, qmass*gravit, zadd
c 901 format('nstep=',i4,' tmass=',f16.6,' qmass=',f16.6,' zadd=',f16.6)
C
CL DO SECOND PART OF TIME FILTER, AND STORE COMPLETED
CL FILTER FOR TIME N IN COML10
C
CALL TIMESM (YUM1, YU,
#ifdef isotrac
* yqm1_o, yq_o, yqm1_h, yq_h, rtrqm1,rtrq,
#endif
* 2)
C
CL RESET YPSM1,YPTHIC FOR TIME N (FOR PUTHIS, BUDGET)
C
DO 940 JJ = 1,NOREC
DO 942 JI = 1,NLON
YPSM1(JI,JJ) = EXP (YLPSM1(JI,JJ))
942 CONTINUE
940 CONTINUE
CALL ETAPRES_A (YPSM1, SIG, SIGKMH, YPTHIC, HYBTYPE)
call pringlob (ypthic, ypthicp, 'postfilt')
C
CL GLOBAL MASS ADJUSTMENT FOR TRACERS, "+/-" METHOD.
CL (1 TO 3 ARE CLOUD LIQUID WATER, 5-7 ARE FLUX RESERVOIRS
CL FOR T,Q,U,V; NTRACA+1 TO NTRACE ARE PASSIVE
CL TRACERS). DON'T DO FOR Q,U,V RESERVOIRS (SINCE NOT
CL TRANSPORTED...SEE CALL TO SLTHYB ABOVE).
CL FOR EXACT CONSERVATION, RELATE TRACER TO YPTHICP (YLPS)
CL AT TIME N+1, WHICH WILL BE YPTHIC (YLPS) AT TIME N FOR
CL THE NEXT TIMESTEP (UNTIL DYN),COPIED ABOVE TO YPTHICOLD.
C
DO N=1,NTRACE
IF (N.LE.4 .OR. N.GE.NTRACA+1)
* CALL TRAGLOB (TRACER(1,1,1,N), TROLD(1,1,1,N),
* YPTHICP, YPTHICOLD,
* TOTTO(N), TOTTN(N), TOTTA(N), W, GRAVIT, N)
ENDDO
c nz = min (ntraca+1, ntrace)
c write(*,950) nstep, totto(nz), tottn(nz), totta(nz),
c * (totta(nz)-tottn(nz))/tottn(nz)
c 950 format('nstep=',i8,' totto=',f14.8,' tottn=',f14.8,
c * ' totta=',f14.8,' frac=',f14.8)
#ifdef isotrac
c Global mass adjustment for isotope cloud liquid water by
c "+/-" method (traglob) and ratios extrema fixing (traglo_i)
call traglob (ylwc_c_o, trold_o(1,1,1,1),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_c, trold(1,1,1,1), ylwc_c_o, trold_o(1,1,1,1),
* ypthicp, w, gravit, tot)
call traglob (ylwc_c_h, trold_h(1,1,1,1),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_c, trold(1,1,1,1), ylwc_c_h, trold_h(1,1,1,1),
* ypthicp, w, gravit, tot)
call traglob (ylwc_a_o, trold_o(1,1,1,2),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_a, trold(1,1,1,2), ylwc_a_o, trold_o(1,1,1,2),
* ypthicp, w, gravit, tot)
call traglob (ylwc_a_h, trold_h(1,1,1,2),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_a, trold(1,1,1,2), ylwc_a_h, trold_h(1,1,1,2),
* ypthicp, w, gravit, tot)
call traglob (ylwc_s_o, trold_o(1,1,1,3),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_s, trold(1,1,1,3), ylwc_s_o, trold_o(1,1,1,3),
* ypthicp, w, gravit, tot)
call traglob (ylwc_s_h, trold_h(1,1,1,3),
* ypthicp, ypthicold, dum1, dum2, tot, w, gravit, 0)
call traglo_i(ylwc_s, trold(1,1,1,3), ylwc_s_h, trold_h(1,1,1,3),
* ypthicp, w, gravit, tot)
call prout_i (ypthic, ypthicp, 'FINAL ')
#endif
C
CL SAVE SURFACE TOPOGRAPHY: TRUNCATED (YFI/GRAVIT, COML10),
CL AND DELTA TRUNC_MINUS_UNTRUNC (USING TOPOGUN, COMMUN)
C
IF (TESTHIST(1,1) .OR. TESTHIST(10,1)) THEN
DO 990 JJ=1,NOREC
DO 992 JI=1,NLON
HISTMP(JI,JJ,1) = YFI(JI,JJ)/GRAVIT
HISTMP(JI,JJ,2) = TOPOGUN(JI,JJ)
992 CONTINUE
990 CONTINUE
CALL PUTHIS (HISTMP(1,1,1), 1)
CALL PUTHIS (HISTMP(1,1,2), 10)
ENDIF
C
CL SAVE 200,500,850 mb GEOPOTENTIALS FOR TIME N (COML10)
C
IF (TESTHIST(20,1) .OR. TESTHIST(21,1) .OR. TESTHIST(22,1)) THEN
c Compute 3-D geopotential on sigma surfaces (see Mod. Proc.
c User's Guide pg.I-72, and CCM1 Descrip.eq.(3.b.11). Matrix G
c in commap is set in setcom, already multiplied by RAIR.
DO 1000 JK=1,NLEV
DO 1002 JJ=1,NOREC
DO 1004 JI=1,NLON
HISTMP(JI,JJ,JK) = YFI(JI,JJ)/GRAVIT
1004 CONTINUE
1002 CONTINUE
KOFF = NLEV*(JK-1)
DO 1006 JL=1,NLEV
ZHYD = G(JL+KOFF) / GRAVIT
DO 1007 JJ=1,NOREC
DO 1008 JI=1,NLON
c Use t on sigma, q on eta coords (spatial error!)
ZTV = YTM1(JI,JJ,JL)*(1+ZVIR*YQM1(JI,JJ,JL))
c Or use unfiltered yq_sig (time error!)
c ZTV = YTM1(JI,JJ,JL)*(1+ZVIR*YQ_SIG(JI,JJ,JL))
HISTMP(JI,JJ,JK) = HISTMP(JI,JJ,JK) + ZHYD*ZTV
1008 CONTINUE
1007 CONTINUE
1006 CONTINUE
1000 CONTINUE
c Vertically interpolate to requested pressure surfaces
c and write to history file
DO 1010 N=20,22
IF (TESTHIST(N,1)) THEN
IF (N.EQ.20) ZGEO = 200*1.E2
IF (N.EQ.21) ZGEO = 500*1.E2
IF (N.EQ.22) ZGEO = 850*1.E2
ZFAC = LOG(SIG(NLEV)) / LOG(SIG(NLEV-1)/SIG(NLEV))
ZLAPSE = 6.5E-3
c ZLAPSE = 10.E-3
ZPOW = GRAVIT / (RAIR*ZLAPSE)
DO 1012 JJ=1,NOREC
DO 1014 JI=1,NLON
ZSIG = ZGEO/YPSM1(JI,JJ)
DO 1016 JK=2,NLEV
IF (SIG(JK).GE.ZSIG) THEN
JKM = JK-1
JKP = JK
ZWEI = (SIG(JKP)-ZSIG) / (SIG(JKP)-SIG(JKM))
WORKH(JI,JJ) = ZWEI *HISTMP(JI,JJ,JKM)
* + (1.-ZWEI)*HISTMP(JI,JJ,JKP)
GOTO 1014
ENDIF
1016 CONTINUE
c Requested pressure level is below lowest model level,
c so interpolate between there and sea-level-pressure
c sigma value (where geopotential=0). For slp, use same
c extrapolation formula as used for slp history field.
ZTS = YTM1(JI,JJ,NLEV)
* + ZFAC*(YTM1(JI,JJ,NLEV)-YTM1(JI,JJ,NLEV-1))
ZTS = MAX (YTM1(JI,JJ,NLEV-1), ZTS)
ZSLS = (1. + ZLAPSE*YFI(JI,JJ)/(ZTS*GRAVIT))**ZPOW
ZWEI = (ZSLS-ZSIG) / (ZSLS-SIG(NLEV))
WORKH(JI,JJ) = ZWEI * HISTMP(JI,JJ,NLEV)
1014 CONTINUE
1012 CONTINUE
CALL PUTHIS (WORKH, N)
ENDIF
1010 CONTINUE
ENDIF
C
CL SAVE FILTERED FIELDS FOR TIME N (COML10)
C
CALL PUTHIS (YPSM1, 2)
CALL PUTHIS (YTM1, 3)
CALL PUTHIS (YTM1, 66)
CALL PUTHIS (YTM1(1,1,NLEV), 43)
CALL PUTHIS (YUM1, 4)
CALL PUTHIS (YVM1, 5)
CALL PUTHIS (YQM1, 6)
#ifdef isotrac
call puthis (yqm1_o, 69)
call puthis (yqm1_h, 70)
#ifdef isotracreg
do it=1,nrtr
call puthis (rtrq(1,1,1,it), 100 + it)
enddo
#endif
#endif
C
CL SAVE 3-D WIND SPEED FOR TIME N
C
IF (TESTHIST(60,1)) THEN
DO 1020 JJ=1,NOREC
DO 1022 JI=1,NLON
HISTMP(JI,JJ,1) = SQRT ( YUM1(JI,JJ,NLEV)**2
* + YVM1(JI,JJ,NLEV)**2)
1022 CONTINUE
1020 CONTINUE
CALL PUTHIS (HISTMP, 60)
ENDIF
C
CL SAVE VARIOUS 3-D DYNAMICAL FLUXES FOR TIME N
CL (U*V, W*U, W*T, W*VORTICITY, W*POTENTIAL VORTICITY)
C
if (testhist(90,1)) then
do jk=1,nlev
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,jk) = yum1(ji,jj,jk) * yvm1(ji,jj,jk)
enddo
enddo
enddo
call puthis (histmp, 90)
endif
if (testhist(91,1)) then
do jk=1,nlev
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,jk) = vomega(ji,jj,jk) * yum1(ji,jj,jk)
enddo
enddo
enddo
call puthis (histmp, 91)
endif
if (testhist(92,1)) then
do jk=1,nlev
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,jk) = vomega(ji,jj,jk) * ytm1(ji,jj,jk)
enddo
enddo
enddo
call puthis (histmp, 92)
endif
if (testhist(93,1) .or. testhist(94,1)) then
do jk=1,nlev
jkp = min (jk+1,nlev)
jkm = max (jk-1,1)
do jj=1,norec
jjp = min (jj+1,norec)
jjm = max (jj-1,1)
zslat = sin(alatg(jj))
zslatp = sin(alatg(jjp))
zslatm = sin(alatg(jjm))
zclat = cos(alatg(jj))
zclatp = cos(alatg(jjp))
zclatm = cos(alatg(jjm))
zdx = zclat*rearth*(2.*pi/nlon)
do ji=1,nlon
jip = mod (ji, nlon) + 1
jim = mod (ji+nlon-2,nlon) + 1
c vomega * vorticity (planetary + relative):
zvo = 2.*omega*zslat
* + (yvm1(jip,jj,jk) - yvm1(jim,jj,jk))
* / (2.*zdx)
* - (yum1(ji,jjp,jk)*zclatp - yum1(ji,jjm,jk)*zclatm)
* / (rearth*(zslatp-zslatm))
histmp(ji,jj,jk) = vomega(ji,jj,jk) * zvo
if (testhist(94,1)) then
c vomega * potential vorticity (=g*vorticity*|dtheta/dp|):
zpm = sig(jkm)*ypsm1(ji,jj)
zpp = sig(jkp)*ypsm1(ji,jj)
zthetm = ytm1(ji,jj,jkm) * ((1.e5/zpm)**(rair/cpair))
zthetp = ytm1(ji,jj,jkp) * ((1.e5/zpp)**(rair/cpair))
zdtdp = abs ((zthetp-zthetm)/(zpp-zpm))
histmp2(ji,jj,jk) = vomega(ji,jj,jk) * gravit*zvo*zdtdp
endif
enddo
enddo
enddo
call puthis (histmp, 93)
if (testhist(94,1)) call puthis (histmp2, 94)
endif
C
CL COMPUTE AND SAVE HISTORY SEA-LEVEL PRESSURE
CL (SEE MODULAR PROCESSOR USER'S GUIDE PROC02, PG.I-76).
C
IF (TESTHIST(58,1)) THEN
ZFAC = LOG(SIG(NLEV)) / LOG(SIG(NLEV-1)/SIG(NLEV))
ZLAPSE = 6.5E-3
c ZLAPSE = 10.E-3
ZPOW = GRAVIT / (RAIR*ZLAPSE)
DO 1030 JJ=1,NOREC
DO 1032 JI=1,NLON
ZTS = YTM1(JI,JJ,NLEV)
* + ZFAC*(YTM1(JI,JJ,NLEV)-YTM1(JI,JJ,NLEV-1))
ZTS = MAX (YTM1(JI,JJ,NLEV-1), ZTS)
HISTMP(JI,JJ,1)= YPSM1(JI,JJ)
* * (1. + ZLAPSE*YFI(JI,JJ)/(ZTS*GRAVIT))**ZPOW
1032 CONTINUE
1030 CONTINUE
CALL PUTHIS (HISTMP, 58)
ENDIF
C
CL SAVE 3-D AND VERTICALLY INTEGRATED TRACER FIELDS
CL (NOT FOR #1-3, WHICH ARE LIQUID WATER CONTENTS,
CL OR #4-7, WHICH ARE FLUX RESERVOIRS;
CL NTRACA=7 SET IN COMMONS).
C
c 3-D tracer history:
c cosmogenic isotopes history saves done in subr cosmog
#ifndef cosmog
IF (NTRACA.LT.NTRACE) THEN
DO 1040 N=1,MIN(NTRACE-NTRACA,40)
CALL PUTHIS (TRACER(1,1,1,NTRACA+N), IHTRACE+N-1)
IF (TESTHIST(IHTRACE+40+N-1, 1)) THEN
CALL ZERO (HISTMP(1,1,1), NLON*NOREC)
DO 1042 JK=1,NLEV
DO 1044 JJ=1,NOREC
DO 1046 JI=1,NLON
HISTMP(JI,JJ,1)= HISTMP(JI,JJ,1)
* + TRACER(JI,JJ,JK,NTRACA+N)*YPTHICP(JI,JJ,JK)/GRAVIT
1046 CONTINUE
1044 CONTINUE
1042 CONTINUE
CALL PUTHIS (HISTMP(1,1,1), IHTRACE+40+N-1)
ENDIF
1040 CONTINUE
ENDIF
#endif
C
CL COMPUTE MIN AND MAX TEMPERATURES FOR PRINTOUT
C
CALL THILO
C
CL INITIALIAZE BUDGET IF PREVIOUS BUDGET NOT AVAILABLE
CL FROM RESTART FILE (EG, COLD/INITIAL STARTS, EARLIER
CL RESTART-FILE VERSION, CHANGED LATITUDE RESOL,...),
CL OR FOR RESTARTS WITH A BUDGET DONE AT END OF PREVIOUS
CL RUN (IN CASE MODEL CHANGED BY NAMELIST).
CL DO ALSO AFTER SECOND TIMESTEP OF ANY RUN IN WHICH THE
CL TOTAL ATMOS DRY MASS MAY HAVE BEEN CHANGED FROM THE
CL PREVIOUS RUN DUE TO DIFFERENT TOPOGRAPHY IN TOPINI
CL (IE, AFTER BOTH LEAPFROG YPS's HAVE HAD DRY-MASS
CL CORRECTION).
CL ELSE COMPUTE CURRENT BUDGET, PRINTOUT AND RESET, EVERY
CL BUDFREQ SECS (FOR FILTERED TIME N) OR LAST STEP OF RUN.
C
IF( (NSTEP.EQ.NRSTRT .AND. (NBUDGPRE.EQ.0 .OR.
* ABS((NSTEP-1)*DTIME-BTIME0).LT.DTTOL))
* .OR.
* (NSTEP.EQ.NRSTRT+1 .AND. ABS(DRYMASS-DRYMASSIN).GT.0.1)
* ) THEN
c Compute current state
CALL BUDCLC (NSTEP*DTIME, YPTHIC, YPTHICP)
c Zero accumulators and set old budget state vars to current
CALL BUDINA
ELSE
N = MAX ( NINT(BUDFREQ/DTIME), 1 )
IF (MOD(NSTEP,N).EQ.0 .OR. NSTEP.EQ.NSTOP) THEN
c Compute current state
CALL BUDCLC (NSTEP*DTIME, YPTHIC, YPTHICP)
c Print budget
CALL BUDPRN (NOUT)
c Zero accumulators and set old budget state vars to current
CALL BUDINA
ENDIF
ENDIF
C
CL CALL USER-DEFINED SUBROUTINE(S)
C
C CALL USERDEF0 (NSTEP, NRSTRT, NSTOP, ISTEPY, DTIME, NUSER0)
C CALL USERDEF1 (NSTEP, NRSTRT, NSTOP, ISTEPY, DTIME, NUSER1)
C CALL USERDEF2 (NSTEP, NUSER2)
C
CL PRINT OUT CURRENT TIME
C
CALL SHOWTIME
C
CL WRITE AGCM FIELDS TO REGIONAL-MODEL FILES
C
CALL REGWRITE
C
CL WRITE AGCM FIELDS TO STORM-TRACK HISTORY FILES
C
CALL STORMWRITE
C
CL PROCESSING FOR HISTORY AND RESTART FILES.
C
CL INITIALIZE NSTEPH TO "UNSET", THEN SET NSTEPH TO MARK
CL BEGINNING OF CURRENT HISTORY ACCUMULATION PERIOD
C
IF (NSTEP.EQ.NRSTRT) NSTEPH = -1
IF (FAHIST.AND.NSTEPH.EQ.-1) NSTEPH = NSTEP
C
CL INCREMENT HISTORY WRITE COUNTER, WRITE TO HISTORY FILE,
CL RESET RECORD NUMBER OFFSET, AND UNSET NSTEPH, IF ANY
CL DATA RECORDS WRITTEN THIS RUN.
C
IF (FWHIST .AND. NULDAT.GT.0) THEN
CALL WRITH
CALL HISSET (0)
NSTEPH = -1
ENDIF
C
CL SAVE AND NEXT-FILE FOR HISTORY AND RESTART FILES.
C
C--------------------
IF (FSAVE) THEN
C--------------------
C
CL FLUSH OUTPUT BUFFER (BEFORE LARGE FILE-WRITE DELAYS)
C
IER = FLUSH (NOUT)
C
C SAVE HISTORY FILE TO MSS, IF NON-EMPTY AND ANY DATA
CL RECORDS REQUESTED THIS RUN.
C
IF (NUOFF.GT.0 .AND. NULDAT.GT.0) THEN
C
CALL CLOSEF (NDATA)
CALL DISPOSEF (MSNAMHIS(IFILE), MSPATH)
IF (NSTEP.LT.NSTOP)
* CALL OPENF (NDATA, MSNAMHIS(IFILE), MSPATH, -1, 0)
cname = msnamhis(ifile)
if (hisnet) then
c append '.nc' to name if not already there
lnl = lenchr(cname)
if (cname(lnl-2:lnl).ne.'.nc' .and.
* cname(lnl-2:lnl).ne.'.NC') cname(lnl+1:) = '.nc'
endif
IF (.NOT.HISNET) WRITE (NOUT,1450)
IF ( HISNET) WRITE (NOUT,1451)
WRITE (NOUT,1452)
* NSTEP, ISTEPY*DTIME/86400., NSTEP*DTIME/86400.,
* MSPATH(1:LENCHR(MSPATH)), CNAME(1:LENCHR(CNAME)), NWRIT
1450 FORMAT(/' ----------------------------------------------'
* /' ********** AGCM HISTORY FILE OUTPUT **********')
1451 FORMAT(/' ----------------------------------------------'
* /' ***** AGCM HISTORY FILE OUTPUT (NetCDF) ******')
1452 FORMAT( ' ----------------------------------------------'
* /' timestep = ',i10
* /' calendar days = ',f10.3
* /' elapsed days = ',f10.3
* /' agcm history file = ',a,a
* /' agcm history writes = ',i10
* /' ----------------------------------------------')
#ifdef mss
IF (MSPATH.EQ.' ') WRITE (NOUT,1453)
1453 FORMAT( ' * File NOT saved to MSS (MSPATH is blank!) *'
* /' ----------------------------------------------')
#endif
WRITE (NOUT,*)
C
ENDIF
C
C IF NEXT-FILE, START NEW HISTORY FILE AND INCREMENT IFILE
C NB: IF LAST TIMESTEP IS A NEXT-FILE, IFILEPRE POINTS TO
C THE FILES JUST SAVED, IFILE POINTS TO NEXT FILES, AND
C NUOFF IS 0. THESE VARIABLES ARE WRITTEN TO RESTART FILE.
C
IFILEPRE = IFILE
C
IFENOUGH = 1
IF (FNEXF) THEN
IFILE = IFILE + 1
CALL HISSET (1)
C Open new local history file, unless last timestep
IF (NSTEP.LT.NSTOP) THEN
CALL CLOSEF (NDATA)
CALL OPENF (NDATA, MSNAMHIS(IFILE), MSPATH, 1, NUSIZ)
c If "not enough filenames entered" , fatal error, but
c wait till restart file written below before stopping
IF (IFILE.GT.NFILE) IFENOUGH = 0
ENDIF
ENDIF
C
C WRITE RESTART FILE AND DISPOSE TO MSS
C
CALL WSDS (MSNAMRES(IFILEPRE), MSPATH)
C
C DISPOSE SECONDARY RESTART-FILE COPY IF REQUESTED
C
IF (MSNAMRE2.NE.' ') THEN
c#####
c Either:
CALL WSDS (MSNAMRE2, MSPATH)
c#####
c Or:
#ifdef mss
c cname = msnamres(ifilepre)
c lenc = lenchr(cname)
c dname = msnamre2
c lend = lenchr(dname)
#else
c cname = concat (mspath, msnamres(ifilepre), lenc)
c dname = concat (mspath, msnamre2, lend)
#endif
c cmd = 'cp '// cname(1:lenc) //' '// dname(1:lend)
c ier = ishell (cmd(1:lenchr(cmd)))
c if (ier.ne.0) then
c write(nout,1458) cname(1:lenc), dname(1:lend), ier
c1458 format
c * (/' *** Error in LINEMS (copying secondary restart file):'
c * /' Primary restart file name = ',a
c * /' Secondary restart file name = ',a
c * /' ishell error code = ',i8)
c call endrun (-1)
c endif
c
c call disposef (dname, mspath)
c#####
ENDIF
WRITE (NOUT,1460)
* NSTEP, ISTEPY*DTIME/86400., NSTEP*DTIME/86400.,
* MSPATH(1:LENCHR(MSPATH)), MSNAMRES(IFILEPRE),
* VERSRES, IFILEPRE, FNEXF
1460 FORMAT(
* /' ----------------------------------------------'
* /' ************* RESTART FILE OUTPUT ************'
* /' ----------------------------------------------'
* /' timestep = ',i10
* /' calendar days = ',f10.3
* /' elapsed days = ',f10.3
* /' restart file = ',a,a
* /' restart file version number = ',f10.2
* /' filename list # = ',i10
* /' filename list # incremented (T/F) = ',l10
* /' ----------------------------------------------')
IF (MSNAMRE2.NE.' ')
* WRITE (NOUT,1461) MSPATH(1:LENCHR(MSPATH)), MSNAMRE2
1461 FORMAT(
* ' secondary copy = ',a,a
* /' ----------------------------------------------')
C
#ifdef mss
IF (MSPATH.EQ.' ') WRITE (NOUT,1462)
1462 FORMAT( ' * File NOT saved to MSS (MSPATH is blank!) *'
* /' ----------------------------------------------')
#endif
C
WRITE (NOUT,*)
C
C Stop if "not enough filenames" fatal error detected above
IF (IFENOUGH.EQ.0) THEN
WRITE(NOUT,*) '*** Not enough filenames input to',
* ' complete this run. Stop in LINEMS.'
CALL ENDRUN (-1)
ENDIF
C
C----------
ENDIF
C----------
C
CL FLUSH OUTPUT BUFFER AT END OF EACH DAY
C
N = MAX (NINT(1.*86400./DTIME), 1)
IF (MOD(NSTEP,N).EQ.0) IER = FLUSH (NOUT)
C
RETURN
END
C
C ***************************** PHYS **********************************
C
SUBROUTINE PHYS (YUM1, YVM1, YTM1, YQM1,
* YU, YV, YT, YQ,
* YU_ETA, YV_ETA, YT_ETA, YQ_SIG,
* YLWC_C, YLWC_A, YLWC_S,
* FPLUMT, FPLUMQ, FPLUMU, FPLUMV,
* TRACER, TRAFLUX,YPM, YPL, YPTHIC, YPMCAP,
* YFI
#ifdef isotrac
* ,yqm1_o, yqm1_h, yq_o, yq_h, ylwc_c_o, ylwc_c_h,
* ylwc_a_o, ylwc_a_h, ylwc_s_o, ylwc_s_h,
* fplumq_o, fplumq_h,
* rtrqm1, rtrq, rtrfq
#endif
* )
C----------------------------------------------------------------------
C
CL DRIVER FOR "VERTICAL PHYSICS" ROUTINES. Y* ARE PASSED FROM
CL LINEMS (NOT VIA COML30) TO ALLOW USE OF MIXED SIGMA-HYBRID COORDS)
CL
CL Y[U,V,T]M1 ARE ON SIGMA GRID (TIME N-1),
CL YQM1 IS ON HYBRID GRID (IF USED) (TIME N-1),
CL Y[U,V,T], YQ_SIG ARE ON SIGMA GRID (TIME N),
CL Y[U,V,T]_ETA, YQ, YP* ARE ON HYBRID GRID (IF USED) (TIME N)
CL YLWC_[C,A,S],TRACER ARE ON HYBRID GRID (IF USED) (NON-LEAPFROG)
CL FPLUM* ARE ON HYBRID GRID (IF USED) (NON-LEAPFROG)
C
C----------------------------------------------------------------------
#include <PARAMS.h>
C---------------------------------------------------------------------
#include <COMBUD.h>
C---------------------------------------------------------------------
#include <COMCON.h>
C----------------------------------------------------------------------
#include <COMDIF.h>
C---------------------------------------------------------------------
#include <COMDYR.h>
C---------------------------------------------------------------------
#include <COMFLG.h>
C---------------------------------------------------------------------
#include <COMHED.h>
C---------------------------------------------------------------------
#include <COMHIS.h>
C---------------------------------------------------------------------
#include <COMHIX.h>
C---------------------------------------------------------------------
#include <COMHIY.h>
C---------------------------------------------------------------------
#include <COMIMP.h>
C---------------------------------------------------------------------
#include <COMINI.h>
C---------------------------------------------------------------------
#include <COMLUN.h>
C---------------------------------------------------------------------
#include <COMMAP.h>
C---------------------------------------------------------------------
#include <COMMP2.h>
C ---------------------------------------------------------------------
#include <COMMUN.h>
C---------------------------------------------------------------------
#include <COMSDT.h>
C---------------------------------------------------------------------
#include <COMTIM.h>
C---------------------------------------------------------------------
#include <CRDCTL.h>
C---------------------------------------------------------------------
#include <LGASES.h>
C---------------------------------------------------------------------
DIMENSION
* YUM1(NLON,NOREC,NLEV), YVM1(NLON,NOREC,NLEV),
* YTM1(NLON,NOREC,NLEV), YQM1(NLON,NOREC,NLEV),
* YU(NLON,NOREC,NLEV), YV(NLON,NOREC,NLEV),
* YT(NLON,NOREC,NLEV), YQ(NLON,NOREC,NLEV),
* YU_ETA(NLON,NOREC,NLEV), YV_ETA(NLON,NOREC,NLEV),
* YT_ETA(NLON,NOREC,NLEV), YQ_SIG(NLON,NOREC,NLEV),
* YLWC_C(NLON,NOREC,NLEV), YLWC_A(NLON,NOREC,NLEV),
* YLWC_S(NLON,NOREC,NLEV),
* FPLUMT(NLON,NOREC,NLEV), FPLUMQ(NLON,NOREC,NLEV),
* FPLUMU(NLON,NOREC,NLEV), FPLUMV(NLON,NOREC,NLEV),
* TRACER(NLON,NOREC,NLEV,NTRACE), TRAFLUX(NLON,NOREC,NTRACB),
* YPM(NLON,NOREC,NLEV), YPL(NLON,NOREC,NLEVP),
* YPTHIC(NLON,NOREC,NLEV),
* YPMCAP(NLON,NOREC,NLEV),
* YFI(NLON,NOREC)
#ifdef isotrac
dimension
* yqm1_o(nlon,norec,nlev), yqm1_h(nlon,norec,nlev),
* yq_o(nlon,norec,nlev), yq_h(nlon,norec,nlev),
* ylwc_c_o(nlon,norec,nlev), ylwc_c_h(nlon,norec,nlev),
* ylwc_a_o(nlon,norec,nlev), ylwc_a_h(nlon,norec,nlev),
* ylwc_s_o(nlon,norec,nlev), ylwc_s_h(nlon,norec,nlev),
* fplumq_o(nlon,norec,nlev), fplumq_h(nlon,norec,nlev),
* rtrqm1(nlon,norec,nlev,nrtr), rtrq(nlon,norec,nlev,nrtr),
* rtrfq (nlon,norec,nlev,nrtr)
#endif
DIMENSION
* YCLD(NLON,NOREC,NLEV), YCLWP(NLON,NOREC,NLEV),
* TOTCLD(NLON,NOREC), TOTCLDC(NLON,NOREC),
* TOTCLDA(NLON,NOREC), TOTCLDS(NLON,NOREC),
* TOTLWC(NLON,NOREC),
* ZR(NLON), ZS(NLON), ZL(NLON), ZE(NLON), ZP(NLON),
* YRELHUM(NLON,NOREC,NLEV)
DIMENSION
* PLUMEPREC(NLON,NOREC,NLEV),
* HEIMIN(NLON,NOREC), HEIMAX(NLON,NOREC)
c save since (i) convad-plume not called every timestep, and
c (ii) history pbl heights are local 03:00,15:00 (was daily min/max)
SAVE PLUMEPREC, HEIMIN, HEIMAX
#ifdef isotrac
dimension
* plumepr_o(nlon,norec,nlev) ,plumepr_h(nlon,norec,nlev),
* plumepr_t(nlon,norec,nlev,nrtr)
save plumepr_o ,plumepr_h, plumepr_t
#endif
#if defined (tropicheat)
logical firsttrop
data firsttrop /.true./
dimension weitrop(nlev)
save weitrop, firsttrop
#endif
DIMENSION WORKH(NLON,NOREC)
LOGICAL TESTHIST, FSAVE_LEAF
C---------------------------------------------------------------------
C
CL SET FLAGS FOR WHETHER TO DO SOLAR AND IR COMPUTATIONS
CL (IRAD*,FRAD* ARE IN CRDCTL)
C
FRADLW = MOD(NSTEP-1,IRADLW ).EQ.0 .OR. NSTEP.EQ.NRSTRT
FRADLWA = MOD(NSTEP-1,IRADLWA).EQ.0 .OR. NSTEP.EQ.NRSTRT
FRADLW = FRADLW .OR. FRADLWA
FRADSW = MOD(NSTEP-1,IRADSW ).EQ.0 .OR. NSTEP.EQ.NRSTRT
C
CL INITIALIZE VEG/SNOW/SOIL/OCEAN AT (RE)START.
CL (MUST CALL INISURF AND VEGDAT BEFORE ALBLSX CALLED
CL FROM RADCTL.) ALSO CALL SIZECHK TO CHECK SIZES OF
CL HISTORY FILES VS MSS LIMIT.
C
IF (NSTEP.EQ.NRSTRT) THEN
CALL INIFUD (NIN, NOUT, TIMOLSX, BUDFREQ, 1)
CALL INISURF
* (NLON, NOREC, ALATG, W, 2, DTIME,
* YTSIN, YOROOCN, YOROLAND, YOROICE,
* DELEVTYPE,YFI, VEGTYPE, EVEDELTA, DSBIOME,
* WISCVEG, PHOTOTYPE,TAUBIOME, DYNAIBIS, ASYNIBIS,
* SOILTEX, DEPTHML, DEPTHLAKE,DEPTHICE,DEPTHSNO,
* OCEANTYPE,DYNAMICE, PRESCOUV, SHOWMAPS,
* LONOLSX, LATOLSX, NSREST, NSREST_ISOT,
* NNEXFN, NRSTRT, NSTOP,
* NHISI, NDHIS, HISTLAST)
CALL SIZECHK
ENDIF
C
CL SET VEGETATION DATA ON 1st TIMESTEP OF (RE)START AND
CL ONCE A DAY THEREAFTER. MOD(NSTEP,N).EQ.1 COINCIDES
CL WITH NSTEP.EQ.NRSTRT AFTER A RESTART IF PREVIOUS RUN
CL LENGTH WAS A WHOLE NUMBER OF DAYS, SO THAT RESTART
CL OR NOT WON'T AFFECT RESULTS.
CL
CL ISTEPY_LEAF, FSAVE_LEAF ARE LOCAL VARS; FSAVE_LEAF
CL (= IF GENESIS SAVE THIS TIMESTEP) IS PASSED TO
CL VEGDAT_EVE TO CONTROL EVE/LEAF RESTART-FILE USE.
C
N = NINT(86400./DTIME)
IF (NSTEP.EQ.NRSTRT .OR. MOD(NSTEP,N).EQ.1) THEN
C
ISTEPY_LEAF = NINT((CALSEC + 86400. - DTIME)/DTIME)
FSAVE_LEAF = .FALSE.
DO 100 I=1,NSAVEN
IF (ISTEPY_LEAF.EQ.NSAVE(I)) FSAVE_LEAF = .TRUE.
100 CONTINUE
DO 110 I=1,NNEXFN
IF (ISTEPY_LEAF.EQ.NNEXF(I)) FSAVE_LEAF = .TRUE.
110 CONTINUE
IF (NSTEP+N.GT.NSTOP) FSAVE_LEAF = .TRUE.
C
CALL VEGDAT (JYEAR, JMNTH, JDAY, FSAVE_LEAF, TRIASSIC,
* NSREST_IBIS, HORRESLSX(1),HORRESLSX(2), TYPERESIN,
* SHOWMAPS, CO2PPV*1.E6)
C
ENDIF
C
CL COMPUTE CLOUD AMOUNTS (YCLD,TOTCLD) AND LIQUID WATER
CL PATH (YCLWP) FOR RADCTL,CONVAD,SURFCTL.
C
#if defined ( omp )
!$OMP PARALLEL DO DEFAULT (NONE)
!$OMP* shared (yt_eta, yq, ylwc_c, ylwc_a, ylwc_s,
!$OMP* totcld, totcldc, totclda, totclds, totlwc,
!$OMP* wplume0, wplume1, ypm, ypthic, ycld, yclwp, yrelhum)
!$OMP* private (jj)
!$OMP* schedule(dynamic,2)
#endif
C
DO 150 JJ=1,NOREC
CALL CLDCMP (YT_ETA, YQ, YLWC_C, YLWC_A, YLWC_S,
* TOTCLD, TOTCLDC, TOTCLDA, TOTCLDS, TOTLWC,
* WPLUME0, WPLUME1, YPM, YPTHIC, YCLD, YCLWP,YRELHUM,
* JJ)
150 CONTINUE
C
CL WRITE CLOUD DIAGNOSTICS
C
IF (NSTEP.GT.NRSTRT) CALL CLDDIAGO (NOUT)
C
CL SAVE CLOUD HISTORY FIELDS
CALL PUTHIS (YCLD, 29)
CALL PUTHIS (YRELHUM, 61)
CALL PUTHIS (TOTCLD, 44)
CALL PUTHIS (TOTCLDC, 45)
CALL PUTHIS (TOTCLDA, 46)
CALL PUTHIS (TOTCLDS, 47)
CALL PUTHIS (TOTLWC, 62)
C
CL DO RADIATION COMPUTATIONS
C
if (fradlw .or. fradsw) then
call radctl (
c input:
* yt_eta, yq, yrelhum, ypm, ypl, ypthic,
* ycld, yclwp, yps,
* cosq, fraq, albsud, albsui, firems,
* yoroocn, yoroland, yoroice,
c output:
* yqrs, hfrsa, hsabtp, hsabat, hclrss, hclrst,
* hsolin, solsud, solsui, hfrsac,
* yqrl, firabs, sldflx, hfrla, hfirtp, hclrls, hclrlt
#if defined (LKAEROSOL)
* ,sfcirrad
#endif
* )
endif
C
CL STORE NET RADIATIVE HEATING RATE IN YT2 (HERE IN
CL UNITS OF FLUX CONVERGENCE PER LAYER, W M-2...
CL CONVERTED TO DEG K/S AT START OF DYN). MUST BE
CL DONE EVERY TIMESTEP (NOT IN RADCTL) SINCE YT2
CL IS CHANGED IN VDIF AND SPECTRAL SUBRS.
C
#if defined (tropicheat)
c .005, .013, .033, .064, .099, .139,
c .189, .251, .325, .409, .501, .598,
c .695, .787, .866, .929, .970, .993
if (firsttrop) then
zsiga = .15
zsigb = .5
zsigc = .75
zweitot = 0.
do k=1,nlev
if (sig(k).lt.zsigb) then
zz = (sig(k)-zsigb)/(zsigb-zsiga)
else
zz = (sig(k)-zsigb)/(zsigc-zsigb)
endif
weitrop(k) = max (0., 1. - zz**2) * dsigma(k)
zweitot = zweitot + weitrop(k)
enddo
do k=1,nlev
weitrop(k) = weitrop(k) / zweitot
enddo
zweitot = 0.
do k=1,nlev
write (6,*) 'k, weitrop= ',k, weitrop(k)
zweitot = zweitot + weitrop(k)
enddo
write (6,*) ' sum = ',zweitot
endif
ztropicheatp = 75. ! W/m2 total column
ztropicheatm = ztropicheatp*90./270. ! compensate, 0 zonal mean
zghp = 0.
zghm = 0.
zgap = 0.
zgam = 0.
#endif
DO 200 JK=1,NLEV
DO 202 JJ=1,NOREC
DO 204 JI=1,NLON
YT2(JI,JJ,JK) = (YQRS(JI,JJ,JK) - YQRS(JI,JJ,JK+1))
* + (YQRL(JI,JJ,JK) - YQRL(JI,JJ,JK+1))
#if defined (tropicheat)
zwei = 0.5*w(jj)/nlon
zlat = alatg(jj)* 180./3.1415927
zlon = along(ji)* 180./3.1415927
if (zlon.gt.180.) zlon = zlon - 360.
if (zlat.ge.-10. .and. zlat.le.10.) then
c if (zlon.ge. 170. .or. zlon.le.-100.) then ! 90d
if (zlon.ge. -90. .and. zlon.le. 0.) then ! 90e
yt2(ji,jj,jk) = yt2(ji,jj,jk) + ztropicheatp*weitrop(jk)
zghp = zghp + ztropicheatp*weitrop(jk)*zwei
zgap = zgap + weitrop(jk)*zwei
else
yt2(ji,jj,jk) = yt2(ji,jj,jk) - ztropicheatm*weitrop(jk)
zghm = zghm - ztropicheatm*weitrop(jk)*zwei
zgam = zgam + weitrop(jk)*zwei
endif
endif
#endif
204 CONTINUE
202 CONTINUE
200 CONTINUE
#if defined (tropicheat)
if (firsttrop) then
write (nout,'(3(a,f9.5))')
* ' tropicheat: zghp=',zghp/zgap,
* ' zghm=',zghm/zgam,
* ' zght=',(zghp+zghm)/(zgap+zgam)
ier = flush(nout)
firsttrop = .false.
endif
#endif
#ifdef isotrac
c Zero isotopic liquid water contents corresponding to liquid water
c contents zeroed above in CLDCMP when lower than 1e-10
do jk=1,nlev
do jj=1,norec
do ji=1,nlon
if (ylwc_c(ji,jj,jk).eq.0.) then
ylwc_c_o(ji,jj,jk) = 0.
ylwc_c_h(ji,jj,jk) = 0.
endif
if (ylwc_a(ji,jj,jk).eq.0.) then
ylwc_a_o(ji,jj,jk) = 0.
ylwc_a_h(ji,jj,jk) = 0.
endif
if (ylwc_s(ji,jj,jk).eq.0.) then
ylwc_s_o(ji,jj,jk) = 0.
ylwc_s_h(ji,jj,jk) = 0.
endif
enddo
enddo
enddo
#endif
C
CL STEP VEG/SNOW/SOIL/OCEAN MODELS THRU ONE AGCM STEP
CL (USING LAST TIMESTEP'S PRECIP)
C
IACCUM = 0
CALL SURFCTL
* (NSTEP, DTIME, FRADSW,
* COSQ, SOLSUD, SOLSUI, FIRABS,
* YU_ETA(1,1,NLEV), YV_ETA(1,1,NLEV),
* YT_ETA(1,1,NLEV), YQ(1,1,NLEV),
* FRAINC, FSNOWC, FRAINS, FSNOWS, STOCHPR, YPS, TOTCLD,
* FIREMS, YTFLX, YQFLX, YUFLX, YVFLX,
* SIG(NLEV),SIGKMH(NLEV),
* OMEGA, SEQSST,
* DYNAMICE, DYNAMHEM,
* QFACTOR, QNORWEG, QICES, QICEN, QLIMIT,
* CO2PPV*1.E6, HOTLIMIT,
* NSREST, NSREST_IBIS,VERSRESIN,FSAVE, FNEXF, ISTEPY,
* NRSTRT, NSTOP,
* MBDATE, MCDATE, MCSEC, JYEAR, JMNTH, JDAY,
* RUNTITLE, SHOWMAPS,
* BASEDATE, ENDDATE, NSAVE, NHISI, NDHIS
#ifdef isotrac
* ,yq_o(1,1,nlev), yq_h(1,1,nlev), frainc_o, frainc_h,
* fsnowc_o, fsnowc_h, frains_o, frains_h, fsnows_o, fsnows_h,
* yqflx_o, yqflx_h
#endif
* )
C
CL CONVERT SENSIB, VAP AND WIND STRESS FLUXES FROM LSX'S
CL DOWNWARD FLUXES TO UPWARD
C
DO 320 JJ=1,NOREC
DO 322 JI=1,NLON
YTFLX(JI,JJ) = -YTFLX(JI,JJ)
YQFLX(JI,JJ) = -YQFLX(JI,JJ)
YUFLX(JI,JJ) = -YUFLX(JI,JJ)
YVFLX(JI,JJ) = -YVFLX(JI,JJ)
#ifdef isotrac
yqflx_o(ji,jj) = -yqflx_o(ji,jj)
yqflx_h(ji,jj) = -yqflx_h(ji,jj)
#endif
322 CONTINUE
320 CONTINUE
#ifdef isotracreg
do it=1,nrtr
do jj=1,norec
do ji=1,nlon
rtrfv(ji,jj,it) = yqflx(ji,jj)*
* cvmgt( cvmgt(1.,0.,nint(sourc_i(ji,jj)).eq.it),
* rtrq(ji,jj,nlev,it)/yq(ji,jj,nlev),
* yqflx(ji,jj).ge.0. )
enddo
enddo
enddo
#endif
C
CL OVERALL LOOP OVER LATITUDE FOR CONVECTION AND
CL VERTICAL DIFFUSION. (BETTER TO COMBINE INTO ONE LOOP
CL FOR PARALLELIZATION).
C
CL INITIALIZE HISTORY PBL HEIGHTS
C
C For daily min,max pbl heights:
C IF (NSTEP.EQ.NRSTRT .OR. MOD(NSTEP,NINT(86400./DTIME)).EQ.1) THEN
C CALL RESETR (HEIMIN, NLON*NOREC, 1.E20)
C CALL RESETR (HEIMAX, NLON*NOREC, -1.E20)
C ENDIF
C For 03:00, 15:00 pbl heights:
IF (NSTEP.EQ.NRSTRT) THEN
CALL ZERO (HEIMIN, NLON*NOREC)
CALL ZERO (HEIMAX, NLON*NOREC)
ENDIF
C
CL ZERO SURFACE PRECIP RATES, AND PRECIP FALL RATE
CL FOR COSMOGENIC ISOTOPES (ACCUMULATED BY CONVAD-REEVAP)
C
CALL ZERO (FRAINS, NLON*NOREC)
CALL ZERO (FSNOWS, NLON*NOREC)
CALL ZERO (FRAINC, NLON*NOREC)
CALL ZERO (FSNOWC, NLON*NOREC)
#ifdef isotrac
call zero (frains_o, nlon*norec)
call zero (frains_h, nlon*norec)
call zero (fsnows_o, nlon*norec)
call zero (fsnows_h, nlon*norec)
call zero (frainc_o, nlon*norec)
call zero (frainc_h, nlon*norec)
call zero (fsnowc_o, nlon*norec)
call zero (fsnowc_h, nlon*norec)
#endif
#ifdef isotracreg
call zero (rtrprs, nlon*norec*nrtr)
call zero (rtrpss, nlon*norec*nrtr)
call zero (rtrprc, nlon*norec*nrtr)
call zero (rtrpsc, nlon*norec*nrtr)
#endif
#ifdef cosmog
CALL ZERO (PRECFLX, NLON*NOREC*NLEVP)
#endif
C
c Horizontally diffuse heat reservoir fplumt slightly, in an
c attempt to reduce intense stationary blobs of precip in ITCZ.
c Second param is diffusion coeff (m s-2; 1.e4 ok, 1.e6 blows)
c call difgrid (fplumt, 1.e4, dtime)
C
#if defined ( omp )
#ifndef isotrac
!$OMP PARALLEL DO DEFAULT (NONE)
!$OMP* shared (yu_eta, yv_eta, yt_eta, yq,
!$OMP* ylwc_c, ylwc_a, ylwc_s, ycld,
!$OMP* fplumt, fplumq, fplumu, fplumv,
!$OMP* tracer, traflux, ypm, ypthic, ypmcap,
!$OMP* plumeprec, heimin, heimax,
!$OMP* yum1, yu, yvm1, yv, ytm1, yt, yq_sig,
!$OMP* yqm1,
!$OMP* yps, yfu, yfv, yt2)
!$OMP* private (jj)
!$OMP* schedule(dynamic,2)
#else
!$OMP PARALLEL DO DEFAULT (NONE)
!$OMP* shared (yu_eta, yv_eta, yt_eta, yq,
!$OMP* ylwc_c, ylwc_a, ylwc_s, ycld,
!$OMP* fplumt, fplumq, fplumu, fplumv,
!$OMP* tracer, traflux, ypm, ypthic, ypmcap,
!$OMP* plumeprec, heimin, heimax,
!$OMP* yum1, yu, yvm1, yv, ytm1, yt, yq_sig,
!$OMP* yqm1,
!$OMP* yps, yfu, yfv, yt2,
!$OMP* yq_o, yq_h, ylwc_c_o, ylwc_c_h, ylwc_a_o,
!$OMP* ylwc_a_h, ylwc_s_o, ylwc_s_h, fplumq_o, fplumq_h,
!$OMP* plumepr_o, plumepr_h,
!$OMP* rtrq, rtrfq, plumepr_t,
!$OMP* yqm1_o, yqm1_h,
!$OMP* rtrqm1)
!$OMP* private (jj)
!$OMP* schedule(dynamic,2)
#endif
#endif
C
C======================
DO 400 JJ=1,NOREC
C======================
C
CL LOCAL SATURATION ADJUSTMENT, VERTICAL CONVECTION
CL (PBL AND FREE), AND REEVAPORATION OF PRECIP. ADDS
CL FLUX CONVERGENCES TO RESERVOIRS FPLUM[U,V,T,Q,TRA].
CL STEPS CLOUD LIQUID WATER CONTENTS THRU THIS TIMESTEP,
CL AND SAVES PRECIP FOR NEXT TIMESTEP'S CALL TO SURFCTL.
C
CALL CONVAD (YU_ETA, YV_ETA, YT_ETA, YQ,
* YLWC_C, YLWC_A, YLWC_S, YCLD,
* FPLUMT, FPLUMQ, FPLUMU, FPLUMV,
* TRACER, TRAFLUX, YPM, YPTHIC, YPMCAP,
* PLUMEPREC, HEIMIN, HEIMAX, JJ
#ifdef isotrac
* ,yq_o, yq_h, ylwc_c_o, ylwc_c_h, ylwc_a_o,
* ylwc_a_h, ylwc_s_o, ylwc_s_h, fplumq_o, fplumq_h,
* plumepr_o, plumepr_h,
* rtrq, rtrfq, plumepr_t
#endif
* )
C
CL "BACKGROUND" VERTICAL DIFFUSION. USES UP SOME OF
CL THE REVERVOIRS FPLUM[U,V,T,Q] (CONVERTING THE
CL USAGE FOR U,V,T FROM ETA TO SIGMA COORDS). STORES
CL U,V,T TENDENCIES IN YT2,YFU,YFV, AND CHANGES YQM1
CL AND TRACER FIELDS. VDIF_SIG DOES U,V,T ON SIGMA
CL COORDS AND VDIF_ETA DOES Q,TRACERS ON ETA COORDS.
C
CALL VDIF_SIG (YUM1, YU, YVM1, YV, YTM1, YT, YQ_SIG,
* FPLUMU, FPLUMV, FPLUMT, JJ)
C
CALL VDIF_ETA (YQM1, YQ, YU_ETA, YV_ETA, YT_ETA, FPLUMQ, TRACER,
* YPM, YPTHIC, YPMCAP, JJ
#ifdef isotrac
* ,yqm1_o, yqm1_h, yq_o, yq_h, fplumq_o, fplumq_h,
* ylwc_c_o, ylwc_c_h, ylwc_a_o, ylwc_a_h,
* ylwc_s_o, ylwc_s_h,
* rtrqm1, rtrq, rtrfq
#endif
* )
C
CL GRAVITY WAVE DRAG (FOR U AND V)
C
CALL GWD (YU, YV, YT, YPS, YFU, YFV, YT2, JJ)
C
C=============
400 CONTINUE
C=============
C
CL STEP TRACER SOURCES AND SINKS FOR #NTRACA+1 TO #NTRACE,
CL AND PRINT TRACER DIAGNOSTICS AT TIME N.
CL (NOT TRACERS #1-3, WHICH ARE LIQUID WATER CONTENTS,
CL OR TRACERS #4-7, WHICH ARE FLUX RESERVOIRS;
CL NTRACA=7 SET IN COMMONS)
C
#ifdef cosmog
CALL COSMOG (TRACER, YT_ETA, YQ, YPM, YPTHIC, PRECFLX)
#else
CALL TRABUDG (TRACER, YPTHIC)
#endif
C
C SAVE 03:00 AND 15:00 (WAS DAILY MIN,MAX) PBL HEIGHTS
C ONCE EACH DAY (SET BY CONVAD-PLUME)
C
C IF (MOD(NSTEP,NINT(86400./DTIME)).EQ.0) THEN
CALL PUTHIS (HEIMIN, 63)
CALL PUTHIS (HEIMAX, 64)
C ENDIF
C
C WRITE GRAVITY WAVE DRAG DIAGNOSTICS
C
CALL GWDO (NOUT)
C
C SAVE LAND-OCEAN ORO-LIKE MASK AVERAGED TO AGCM GRID
C (0=OCEAN/SEAICE, 1=LAND, 2=ICESHEET),ROUNDED TO INTS
C
DO 8000 JJ=1,NOREC
DO 8002 JI=1,NLON
IF (YOROOCN(JI,JJ).GE.0.5) THEN
HISTMP(JI,JJ,1) = 0.
ELSE
IF (YOROLAND(JI,JJ).GE.YOROICE(JI,JJ)) THEN
HISTMP(JI,JJ,1) = 1.
ELSE
HISTMP(JI,JJ,1) = 2.
ENDIF
ENDIF
8002 CONTINUE
8000 CONTINUE
CALL PUTHIS (HISTMP, 11)
C
CL SAVE NET SW+LW DOWNWARD FLUX AT SURFACE (W M-2),
CL 3-D SW,LW,DOWN-UP FLUXES AT INTERFACES (W M-2),
CL 3-D CLOUD LIQUID WATER CONTENTS
C
CALL PUTHIS (SLDFLX, 39)
CALL PUTHIS (YQRS, 40)
CALL PUTHIS (YQRL, 41)
C
CL INCREMENT BUDGET NET RADIATIVE HEATING (W M-2)
C
DO 8020 JK=1,NLEV
DO 8022 JJ=1,NOREC
ZWEI = DTIME/NLON
DO 8024 JI=1,NLON
DHRADS(JJ) = DHRADS(JJ)
* + (YQRS(JI,JJ,JK)-YQRS(JI,JJ,JK+1))*ZWEI
DHRADL(JJ) = DHRADL(JJ)
* + (YQRL(JI,JJ,JK)-YQRL(JI,JJ,JK+1))*ZWEI
8024 CONTINUE
8022 CONTINUE
8020 CONTINUE
C
CL SAVE 3-D CLOUD LIQUID WATER CONTENTS
C
IF (TESTHIST(59,1)) THEN
DO 8030 JK=1,NLEV
DO 8032 JJ=1,NOREC
DO 8034 JI=1,NLON
HISTMP(JI,JJ,JK) =
* YLWC_C(JI,JJ,JK) + YLWC_A(JI,JJ,JK) + YLWC_S(JI,JJ,JK)
8034 CONTINUE
8032 CONTINUE
8030 CONTINUE
CALL PUTHIS (HISTMP, 59)
ENDIF
C
CALL PUTHIS (YLWC_C, 54)
CALL PUTHIS (YLWC_A, 55)
CALL PUTHIS (YLWC_S, 57)
#ifdef isotrac
call puthis (ylwc_c_o, 71)
call puthis (ylwc_c_h, 72)
call puthis (ylwc_a_o, 73)
call puthis (ylwc_a_h, 74)
call puthis (ylwc_s_o, 75)
call puthis (ylwc_s_h, 76)
#endif
C
CL SAVE VISIBLE AND NEAR-IR SOLAR FLUXES AT SURFACE.
C
IF (TESTHIST(50,1) .OR. TESTHIST(51,1) .OR. TESTHIST(52,1) .OR.
* TESTHIST(56,1)) THEN
DO 810 JJ=1,NOREC
DO 812 JI=1,NLON
C Visible absorbed (direct and diffuse combined)
ZAV = (1.-ALBSUD(JI,JJ,1))*SOLSUD(JI,JJ,1)
* + (1.-ALBSUI(JI,JJ,1))*SOLSUI(JI,JJ,1)
C Visible incident (direct and diffuse combined)
ZIV = SOLSUD(JI,JJ,1) + SOLSUI(JI,JJ,1)
C Near-ir absorbed (direct and diffuse combined)
ZAN = (1.-ALBSUD(JI,JJ,2))*SOLSUD(JI,JJ,2)
* + (1.-ALBSUI(JI,JJ,2))*SOLSUI(JI,JJ,2)
C Near-ir incident (direct and diffuse combined)
ZIN = SOLSUD(JI,JJ,2) + SOLSUI(JI,JJ,2)
HISTMP(JI,JJ,1) = ZAV
HISTMP(JI,JJ,2) = ZIV
HISTMP(JI,JJ,3) = ZAN
HISTMP(JI,JJ,4) = ZIN
812 CONTINUE
810 CONTINUE
CALL PUTHIS (HISTMP(1,1,1), 50)
CALL PUTHIS (HISTMP(1,1,2), 51)
CALL PUTHIS (HISTMP(1,1,3), 52)
CALL PUTHIS (HISTMP(1,1,4), 56)
ENDIF
#if defined (LKAEROSOL)
call puthis (sfcirrad, 67)
#endif
C
CL SAVE OTHER RADIATION QUANTITIES, STORED IN H* ARRAYS
C
CALL PUTHIS (HFRSA, 24)
CALL PUTHIS (HSABTP, 27)
CALL PUTHIS (HSABAT, 28)
CALL PUTHIS (HCLRSS, 34)
CALL PUTHIS (HCLRST, 32)
CALL PUTHIS (HSOLIN, 42)
C
CALL PUTHIS (FIRABS, 23)
CALL PUTHIS (HFRLA, 25)
CALL PUTHIS (HFIRTP, 26)
CALL PUTHIS (HCLRLS, 33)
CALL PUTHIS (HCLRLT, 31)
C
CALL PUTHIS (HFRSAC, 65)
c----
c Dump long-wave heating rates, toa and sfc fluxes (used to
c diagnose new ir code with other trace gases)
c write(6,8880) 'yqrl',
c *((jj,jk,(yqrl(ji,jj,jk)*86400,ji=1,nlon,4),jj=1,norec),jk=1,nlevp)
c write(6,8880) 'hfirtp',
c * (jj,0,(hfirtp(ji,jj),ji=1,nlon,4),jj=1,norec)
c write(6,8880) 'hfrla',
c * (jj,0,(hfrla(ji,jj),ji=1,nlon,4),jj=1,norec)
c8880 format(//a,':'/(2i4,19f10.6))
c
c write(6,8881)
c8881 format(//'Zonal: yqrl:')
c do 8882 jk=1,nlevp
c do 8882 jj=1,norec
c zzyqrl = 0.
c do 8883 ji=1,nlon
c zzyqrl = zzyqrl + yqrl(ji,jj,jk)*86400.
c8883 continue
c zzyqrl = zzyqrl/nlon
c write(6,8884) jj,jk,zzyqrl
c8884 format(2i4,f20.10)
c8882 continue
c
c write(6,8885)
c8885 format(//'Zonal: hfirtp frla:')
c do 8886 jj=1,norec
c zzfirtp = 0.
c zzfrla = 0.
c do 8887 ji=1,nlon
c zzfirtp = zzfirtp + hfirtp(ji,jj)
c zzfrla = zzfrla + hfrla(ji,jj)
c8887 continue
c zzfirtp = zzfirtp/nlon
c zzfrla = zzfrla/nlon
c write(6,8888) jj,zzfirtp, zzfrla
c8888 format(i4,2f20.10)
c8886 continue
c----
C
CL ACCUMULATE RADIATION AT TOP OF MODEL FOR BUDGETS.
CL ACCOUNT FOR "ABOVE-MODEL" ABSORBTION HSABAT IN
CL DSOLRF (FOR PLANETARY ALBEDO), BUT NOT IN DRADTP
CL (FOR MODEL ENERGY BUDGET). ALSO ACCUMULATE BUDGET
CL LOWEST-LEVEL TEMPS AND TOTAL CLOUDINESS.
C
DO 830 JJ=1,NOREC
ZZ = DTIME/NLON
DO 832 JI=1,NLON
DSOLIN(JJ) = DSOLIN(JJ) + HSOLIN(JI,JJ)*ZZ
DSOLRF(JJ) = DSOLRF(JJ)
* +(HSOLIN(JI,JJ)-HSABAT(JI,JJ)-HSABTP(JI,JJ))*ZZ
DFIRTP(JJ) = DFIRTP(JJ) + HFIRTP(JI,JJ)*ZZ
DRADTP(JJ) = DRADTP(JJ) + (HSABTP(JI,JJ)-HFIRTP(JI,JJ))*ZZ
DTAIR(JJ) = DTAIR(JJ) + YT(JI,JJ,NLEV)*ZZ
DTOTCLD(JJ)= DTOTCLD(JJ) + TOTCLD(JI,JJ)*ZZ
832 CONTINUE
830 CONTINUE
C
CL SAVE SURFACE-FLUX HISTORY VARIABLES (STORE AS:
CL SENSIBLE HEAT UPWARD, EVAPORATION UPWARD AS ~W/M2,
CL WIND STRESSES DOWNWARD (SAME SIGN AS WIND SPEED))
C
CALL PUTHIS (YTFLX, 16)
IF (TESTHIST(17,1) .OR. TESTHIST(18,1) .OR. TESTHIST(19,1) .OR.
* TESTHIST(37,1) .OR. TESTHIST(38,1)) THEN
DO 900 JJ=1,NOREC
DO 902 JI=1,NLON
HISTMP(JI,JJ,1) = YQFLX(JI,JJ) * LATVAP
HISTMP(JI,JJ,2) = -YU(JI,JJ,NLEV)*YUFLX(JI,JJ)
HISTMP(JI,JJ,3) = -YV(JI,JJ,NLEV)*YVFLX(JI,JJ)
HISTMP(JI,JJ,4) = -YUFLX(JI,JJ)
HISTMP(JI,JJ,5) = -YVFLX(JI,JJ)
902 CONTINUE
900 CONTINUE
CALL PUTHIS (HISTMP(1,1,1), 17)
CALL PUTHIS (HISTMP(1,1,2), 18)
CALL PUTHIS (HISTMP(1,1,3), 19)
CALL PUTHIS (HISTMP(1,1,4), 37)
CALL PUTHIS (HISTMP(1,1,5), 38)
ENDIF
#ifdef isotrac
if (testhist(77,1) .or. testhist(78,1)) then
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,1) = yqflx_o(ji,jj) * latvap
histmp(ji,jj,2) = yqflx_h(ji,jj) * latvap
enddo
enddo
call puthis (histmp(1,1,1), 77)
call puthis (histmp(1,1,2), 78)
endif
#endif
C
CL SAVE NEW (TIME N) STRATIFORM AND CONVECTIVE PRECIP,
CL RAINFALL, SNOWFALL, PRECIP. CONVERT TO M/S.
C
IF (TESTHIST(12,1) .OR. TESTHIST(13,1) .OR. TESTHIST(14,1) .OR.
* TESTHIST(15,1) .OR. TESTHIST(30,1)) THEN
DO 1000 JJ=1,NOREC
DO 1002 JI=1,NLON
HISTMP(JI,JJ,1) = (FRAINS(JI,JJ)+FSNOWS(JI,JJ))/RHOH2O
HISTMP(JI,JJ,2) = (FRAINC(JI,JJ)+FSNOWC(JI,JJ))/RHOH2O
HISTMP(JI,JJ,3) = (FRAINC(JI,JJ)+FRAINS(JI,JJ))/RHOH2O
HISTMP(JI,JJ,4) = (FSNOWC(JI,JJ)+FSNOWS(JI,JJ))/RHOH2O
HISTMP(JI,JJ,5) = HISTMP(JI,JJ,1) + HISTMP(JI,JJ,2)
1002 CONTINUE
1000 CONTINUE
CALL PUTHIS (HISTMP(1,1,1), 12)
CALL PUTHIS (HISTMP(1,1,2), 13)
CALL PUTHIS (HISTMP(1,1,3), 14)
CALL PUTHIS (HISTMP(1,1,4), 15)
CALL PUTHIS (HISTMP(1,1,5), 30)
ENDIF
#ifdef isotrac
if (testhist(79,1) .or. testhist(80,1) .or. testhist(81,1) .or.
* testhist(82,1) .or. testhist(83,1) .or. testhist(84,1) .or.
* testhist(85,1) .or. testhist(86,1)
* ) then
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,1) = (frains_o(ji,jj)+fsnows_o(ji,jj))/rhoh2o
histmp(ji,jj,2) = (frains_h(ji,jj)+fsnows_h(ji,jj))/rhoh2o
histmp(ji,jj,3) = (frainc_o(ji,jj)+fsnowc_o(ji,jj))/rhoh2o
histmp(ji,jj,4) = (frainc_h(ji,jj)+fsnowc_h(ji,jj))/rhoh2o
histmp(ji,jj,5) = (frainc_o(ji,jj)+frains_o(ji,jj))/rhoh2o
histmp(ji,jj,6) = (frainc_h(ji,jj)+frains_h(ji,jj))/rhoh2o
histmp(ji,jj,7) = (fsnowc_o(ji,jj)+fsnows_o(ji,jj))/rhoh2o
histmp(ji,jj,8) = (fsnowc_h(ji,jj)+fsnows_h(ji,jj))/rhoh2o
enddo
enddo
call puthis (histmp(1,1,1), 79)
call puthis (histmp(1,1,2), 80)
call puthis (histmp(1,1,3), 81)
call puthis (histmp(1,1,4), 82)
call puthis (histmp(1,1,5), 83)
call puthis (histmp(1,1,6), 84)
call puthis (histmp(1,1,7), 85)
call puthis (histmp(1,1,8), 86)
endif
#endif
#ifdef isotracreg
do it=1,nrtr
if (testhist(100+nrtr+it,1)) then
do jj=1,norec
do ji=1,nlon
histmp(ji,jj,1) = (rtrprc(ji,jj,it)+rtrprs(ji,jj,it)+
* rtrpsc(ji,jj,it)+rtrpss(ji,jj,it))/rhoh2o
enddo
enddo
call puthis (histmp(1,1,1), 100 + nrtr + it)
endif
enddo
#endif
CL COMPLETE BUDGET CALCULATIONS
DO 1200 JJ=1,NOREC
DO 1202 JI=1,NLON
ZR(JI) = - (1.-ALBSUD(JI,JJ,1))*SOLSUD(JI,JJ,1)
* - (1.-ALBSUI(JI,JJ,1))*SOLSUI(JI,JJ,1)
* - (1.-ALBSUD(JI,JJ,2))*SOLSUD(JI,JJ,2)
* - (1.-ALBSUI(JI,JJ,2))*SOLSUI(JI,JJ,2)
* + HFRLA(JI,JJ)
C ZR(JI) = - HFRSA(JI,JJ)
C * - FIRABS(JI,JJ) + FIREMS(JI,JJ)
ZS(JI) = YTFLX(JI,JJ)
ZL(JI) = YQFLX(JI,JJ)
* *((YT_ETA(JI,JJ,NLEV)-TMELT)*CPWV + LATSUB)
* - (FRAINC(JI,JJ)+FRAINS(JI,JJ))
* *((MAX(YT_ETA(JI,JJ,NLEV),TMELT)-TMELT)*CH2O+LATICE)
* - (FSNOWC(JI,JJ)+FSNOWS(JI,JJ))
* *((MIN(YT_ETA(JI,JJ,NLEV),TMELT)-TMELT)*CICE)
ZE(JI) = YQFLX(JI,JJ)
ZP(JI) = FRAINC(JI,JJ) + FSNOWC(JI,JJ)
* + FRAINS(JI,JJ) + FSNOWS(JI,JJ)
1202 CONTINUE
DRFLUX(JJ) = DRFLUX(JJ) + SSUM(NLON,ZR,1)*DTIME/NLON
DSFLUX(JJ) = DSFLUX(JJ) + SSUM(NLON,ZS,1)*DTIME/NLON
DLFLUX(JJ) = DLFLUX(JJ) + SSUM(NLON,ZL,1)*DTIME/NLON
DEFLUX(JJ) = DEFLUX(JJ) + SSUM(NLON,ZE,1)*DTIME/NLON
DPFLUX(JJ) = DPFLUX(JJ) + SSUM(NLON,ZP,1)*DTIME/NLON
1200 CONTINUE
C
RETURN
END
C
C ***************************** TIMESM ********************************
C
subroutine timesm (arrm1, arr,
#ifdef isotrac
* arrm1_o, arr_o, arrm1_h, arr_h, arrm1_t, arr_t,
#endif
* iflag)
c----------------------------------------------------------------------
c
cl If iflag eq 1, stores first part of time filter
cl (1-2*eps)*arr (time n) + eps*arrm1 (time n-1) in
cl storage, i.e., array filtarr
cl
cl If iflag ne 1, retrieves first part, adds eps*arr(time n+1)
cl and stores in arrm1.
cl
cl (arrm1 corresponds to yum1 in coml10, arr to yu in coml30.)
c
c----------------------------------------------------------------------
#include <PARAMS.h>
c----------------------------------------------------------------------
#include <COMLUN.h>
c----------------------------------------------------------------------
#include <COMSDT.h>
c----------------------------------------------------------------------
#include <COMTIM.h>
c----------------------------------------------------------------------
parameter (ntimfilt = (6*nlev + 1)*nlon*norec)
dimension arrm1(ntimfilt), arr(ntimfilt)
#ifdef isotrac
parameter (n_i = nlev*nlon*norec)
parameter (n_t = nlev*nlon*norec*nrtr)
dimension arrm1_o(n_i), arr_o(n_i), arrm1_h(n_i), arr_h(n_i),
* arrm1_t(n_t), arr_t(n_t)
#endif
c filtarr is storage array.
c Put in a common, not local saved array, to avoid
c enlarging the size of the executable file.
common /cfiltarc/ filtarr(ntimfilt)
#ifdef isotrac
common /cfilt_i/ filt_o(n_i), filt_h(n_i)
common /cfilt_t/ filt_t(n_t)
#endif
c----------------------------------------------------------------------
c-------------------------
if (iflag.eq.1) then
c-------------------------
c First part of time filter: put in storage
do 100 i=1,ntimfilt
filtarr(i) = (1.-2.*eps)*arr(i) + eps*arrm1(i)
100 continue
#ifdef isotrac
do 110 i=1,n_i
filt_o(i) = (1.-2.*eps)*arr_o(i)+eps*arrm1_o(i)
filt_h(i) = (1.-2.*eps)*arr_h(i)+eps*arrm1_h(i)
110 continue
do i=1,n_t
filt_t(i) = (1.-2.*eps)*arr_t(i)+eps*arrm1_t(i)
enddo
#endif
c---------
else
c---------
c Second part of time filter:get from storage, put into coml10
do 200 i=1,ntimfilt
arrm1(i) = filtarr(i) + eps*arr(i)
200 continue
#ifdef isotrac
do 210 i=1,n_i
arrm1_o(i)=filt_o(i) + eps*arr_o(i)
arrm1_h(i)=filt_h(i) + eps*arr_h(i)
210 continue
do i=1,n_t
arrm1_t(i) = filt_t(i) + eps*arr_t(i)
enddo
#endif
c----------
endif
c----------
return
end
C
C ***************************** TRABUDG *******************************
C
SUBROUTINE TRABUDG (TRACER, YPTHIC)
C----------------------------------------------------------------------
C
CL (i) STEP TRACER FIELDS DUE TO SOURCES AND SINKS
CL (ii) CALCULATE AND PRINT TRACER DIAGNOSTICS
C
C----------------------------------------------------------------------
#include <PARAMS.h>
C----------------------------------------------------------------------
#include <COMBUD.h>
C----------------------------------------------------------------------
#include <COMCON.h>
C----------------------------------------------------------------------
#include <COMLUN.h>
C----------------------------------------------------------------------
#include <COMMAP.h>
C----------------------------------------------------------------------
#include <COMTIM.h>
C----------------------------------------------------------------------
dimension
* tracer(nlon,norec,nlev,ntrace),
* ypthic(nlon,norec,nlev)
C----------------------------------------------------------------------
dimension
* gz(nlev,ntrace), gtrop(ntrace), gstrat(ntrace), gtot(ntrace),
* zmasz(nlev),
* gmax(nlev,ntrace)
logical firstwrite, printracer
save firstwrite, printracer
data firstwrite, printracer /.true., .true./
c sigpaus = tropopause for purposes of tropos/stratos diagnostics
dimension sigpaus(norec)
c sigsink = sigma level below which tracers are zeroed
save sigsink
c data sigsink /.400/
data sigsink /99.999/
C----------------------------------------------------------------------
c Only print tracer diagnostics if # true tracers (ntracb) >= 2
c (Even if want no true tracers, ntracb must = 1 for code)
if (ntracb.lt.2) return
c Zero all tracers below sigma = sigsink ("tropospheric sink")
do 50 n=ntraca+1,ntrace
do 52 jk=1,nlev
if(sig(jk).ge.sigsink) call zero (tracer(1,1,jk,n),nlon*norec)
52 continue
50 continue
c---------------------------
c Diagnostics section:
c---------------------------
if (.not. printracer) return
c Only compute and write diagnostics at day boundaries
if ( mod(nstep,nint(1.*86400./dtime)).ne.0 .and.
* nstep.ne.nrstrt ) return
c Calculate atmos-mass amounts
call zero (zmasz, nlev)
zmastot = 0.
zmastrop = 0.
zmastrat = 0.
do 150 jk=1,nlev
do 152 jj=1,norec
sigpaus(jj) = .100*cs(jj) + .280*(1.-cs(jj))
zwei = cosbud(jj)/nlon
do 154 ji=1,nlon
zdm = (ypthic(ji,jj,jk)/gravit) * zwei
zmasz(jk) = zmasz(jk) + zdm
zmastot = zmastot + zdm
if (sig(jk).le.sigpaus(jj)) then
zmastrat = zmastrat + zdm
else
zmastrop = zmastrop + zdm
endif
154 continue
152 continue
150 continue
c Calculate tracer amounts
do 200 n=ntraca+1,ntrace
call zero (gz(1,n), nlev)
gtot(n) = 0.
gtrop(n) = 0.
gstrat(n) = 0.
do 210 jk=1,nlev
do 212 jj=1,norec
zwei = cosbud(jj)/nlon
do 214 ji=1,nlon
zdtrac = tracer(ji,jj,jk,n)*(ypthic(ji,jj,jk)/gravit)*zwei
gz(jk,n) = gz(jk,n) + zdtrac
gtot(n) = gtot(n) + zdtrac
if (sig(jk).ge.0.200) then
gtrop(n) = gtrop(n) + zdtrac
else
gstrat(n) = gstrat(n) + zdtrac
endif
214 continue
212 continue
210 continue
do 220 jk=1,nlev
gz(jk,n) = gz(jk,n) / zmasz(jk)
220 continue
gtot(n) = gtot(n) / zmastot
gtrop(n) = gtrop(n) / zmastrop
gstrat(n) = gstrat(n) / zmastrat
200 continue
c Write diagnostics (up to 3 tracers only) to files
c fort.71,72,73, and max values to files fort.74,75,76.
k1 = 9
k2 = 1
k3 = -1
do 700 nt = 1, min (3, ntrace-ntraca)
n = ntraca + nt
c Layer-mean concentrations:
iu = 70 + nt
if (firstwrite)
* write(iu,702) sigsink, sigpaus(1), sigpaus(norec/2),
* nt, (sig(jk),jk=k1,k2,k3)
702 format('tracer',5x,'sigsink=',f6.3,5x,'sigpaus(po/eq)=',2f7.3
* /i6
* /' calday',' runday',
* ' trop',' strat',' total',9f9.3/)
write(iu,704) istepy*dtime/86400., nstep*dtime/86400.,
* gtrop(n),gstrat(n),gtot(n),(gz(jk,n),jk=k1,k2,k3)
704 format(2f7.2, 3f10.7, 9f9.5)
ier = flush(iu)
c Layer-maximum concentrations:
ium = 73 + nt
do 712 jk=1,nlev
gmax(jk,n) = -999.
do 714 jj=1,norec
do 716 ji=1,nlon
gmax(jk,n) = max (gmax(jk,n), tracer(ji,jj,jk,n))
716 continue
714 continue
712 continue
if (firstwrite)
* write(ium,718) sigsink, sigpaus(1), sigpaus(norec/2),
* nt,(sig(jk),jk=k1,k2,k3)
718 format('tracer (max)',5x,'sigsink=',f6.3,5x,'sigpaus(po/eq)=',
* 2f7.3
* /i6
* /' calday',' runday',' tottra',' totatm',
* 9f9.3/)
write(ium,719) istepy*dtime/86400., nstep*dtime/86400.,
* gtot(n)*zmastot, zmastot,(gmax(jk,n),jk=k1,k2,k3)
719 format(2f7.2, f12.6, f12.5, 9f9.5)
ier = flush(ium)
700 continue
firstwrite = .false.
return
end
c
c **********************************************************************
c
#ifdef cosmog
subroutine cosmog (tracer, yt, yq, ypm, ypthic, precflx)
c----------------------------------------------------------------------
c
c If first timestep:
c Reads 10-Be production rates (starbe) vs. latitude (alatbe)
c and vertical column (azbe, g/cm2), for 6 different combinations
c of geomagnetic field and solar force field, from file allbe.dat.
c Vertical coordinate is mass of atmos column from TOA.
c Units of starbe on this file are "stars per g.sec".
c The 6 combinations, in order on the file, are:
c (0.5,300), (0.5,600), (1,300), (1,600), (5,300), (5,600),
c where the 1st value is geomagnetic field strength relative to
c today, and the 2nd value is the solar force field parameter
c (solar min/max).
c
c Steps 10-Be tracer amounts (# 10-Be atoms/kg of air, ntraca+1 to
c ntraca+6) through one timestep. Does same for 7-Be tracers
c (ntraca+7 to ntraca+12), which have 2* yield (atoms per star)
c and radioactive half life of 53.0 days.
c
c----------------------------------------------------------------------
#include <PARAMS.h>
c----------------------------------------------------------------------
#include <COMBUD.h>
c----------------------------------------------------------------------
#include <COMCON.h>
c----------------------------------------------------------------------
#include <COMHIS.h>
c----------------------------------------------------------------------
#include <COMHIX.h>
c----------------------------------------------------------------------
#include <COMLUN.h>
c----------------------------------------------------------------------
#include <COMMAP.h>
c----------------------------------------------------------------------
#include <COMTIM.h>
c----------------------------------------------------------------------
dimension
* tracer(nlon,norec,nlev,ntrace),
* yt(nlon,norec,nlev), yq(nlon,norec,nlev),
* ypm(nlon,norec,nlev), ypthic(nlon,norec,nlev),
* precflx(nlon,norec,nlevp)
c For input from file allbe.dat (nb: ncasebe must = ntracb/2):
parameter (nlatbe=11, nlevbe=16, ncasebe=6)
dimension
* starbe(nlatbe,nlevbe,ncasebe), alatbe(nlatbe), azbe(nlevbe)
character*80 chead
c Production rates on agcm latitude grid and fine vertical grid
parameter (nfine=1200, zfine=1.2e5)
dimension jbe(norec), wjbe(norec), kbe(nfine), wkbe(nfine)
save jbe, wjbe, kbe, wkbe, starbe
dimension
* zrho(nlon), zdz(nlon), kfine(nlon)
dimension
* gz(nlev,ntrace), gtrop(ntrace), gstrat(ntrace), gtot(ntrace),
* gflux(ntrace), zmasz(nlev)
logical first, firstprint
save first, firstprint, zareatot
data first, firstprint /.true., .true./
c sigpaus = tropopause for purposes of tropos/stratos diagnostics
dimension sigpaus(norec)
parameter (pi = 3.14159265358979)
c--------------------
if (first) then
c--------------------
if (ncasebe .ne. ntracb/2) then
write (nout,100) ncasebe, ntracb
100 format(/'*** Error (cosmog): ncasebe must equal 1/2 * ntracb'
* /' ncasebe=',i4,' ntracb=',i4)
call endrun (-1)
endif
c Read starbe, alatbe and azbe from data file allbe.dat
write (nout,200)
200 format(/'Reading 10-Be production rate data file allbe.dat...')
iu = 90
open (iu, file='allbe.dat', status='old')
do nc=1,ncasebe
read (iu,205) chead, (alatbe(j),j=1,nlatbe)
205 format(/a//9x,11(1x,f11.1))
write (nout,210) chead(1:lenchr(chead))
210 format(' ',a)
do k=1,nlevbe
read (iu,215) azbe(k), (starbe(j,k,nc),j=1,nlatbe)
215 format(f7.2,2x,11(1x,e11.5))
enddo
enddo
close (iu)
c Calculate index and weights from agcm's alatg into alatbe
do j=1,norec
zlat = alatg(j)*180./pi
zlat = max (alatbe(1)+.0001, min (alatbe(nlatbe)-.0001, zlat))
do jj=2,nlatbe
if (zlat.le.alatbe(jj)) then
jbe(j) = jj-1
wjbe(j) = (alatbe(jj)-zlat)/(alatbe(jj)-alatbe(jj-1))
goto 300
endif
enddo
300 continue
enddo
c Calculate index and weights from nfine evenly spaced values
c from 0 to zfine (Pa) into azbe (g/cm2). At each timestep,
c index, from current levels to the nfine grid will
c be set below (kfine), then kbe(kfine) will be used into azbe.
do k=1,nfine
zlev = ((k-.5)/nfine)*zfine * 0.1/gravit ! Pa to g/cm2
zlev = max (azbe(1)+.0001, min (azbe(nlevbe)-.0001, zlev))
do kk=2,nlevbe
if (zlev.le.azbe(kk)) then
kbe(k) = kk-1
wkbe(k) = (azbe(kk)-zlev)/(azbe(kk)-azbe(kk-1))
goto 400
endif
enddo
400 continue
enddo
first = .false.
c----------
endif
c----------
c Overall loops over level and latitude
c==================
do j=1,norec
do k=1,nlev
c==================
km1 = max (k-1,1)
do i=1,nlon
zrho(i) = ypm(i,j,k) / (rair*(1.+zvir*yq(i,j,k))*yt(i,j,k))
zdz(i) = ypthic(i,j,k) / (zrho(i)*gravit)
kfine(i) = nfine*(ypm(i,j,k)/zfine) + 1.0001
kfine(i) = max (1, min (nfine, kfine(i)))
enddo
c Loop over 10-Be and 7-Be tracers
c (combined into one loop since starbe's are same for each)
c-------------------------
do nc=1,ntracb/2
c-------------------------
n10 = ntraca + nc ! 10-Be
n7 = ntraca + ntracb/2 + nc ! 7-Be
c Step tracer amounts due to production (zprod) and wet
c deposition (precflx). Change units of starbe from
c "stars per g.sec" to "10-Be atoms/kg/s", where
c 1000 = g/kg and .0075 = # 10-Be atoms per star.
c Multiply precflx terms by wet scavenging ratio = 100
c = [10-Be concentration in precip / 10-Be conc. in air]
c Do both for 10-Be, and for 7-Be with 2 * yield factor
c and a half life of 53.0 days.
zfac7 = 1. - exp(-log(2.)*dtime/(53.0*86400.))
do i=1,nlon
kf = kfine(i)
zstar =
* wjbe(j) * wkbe(kf) *starbe(jbe(j) ,kbe(kf) ,nc)
* + (1.-wjbe(j))* wkbe(kf) *starbe(jbe(j)+1,kbe(kf) ,nc)
* + wjbe(j) *(1.-wkbe(kf))*starbe(jbe(j) ,kbe(kf)+1,nc)
* + (1.-wjbe(j))*(1.-wkbe(kf))*starbe(jbe(j)+1,kbe(kf)+1,nc)
ctest zstar = 0.
c10-Be:
tracer(i,j,k,n10) = tracer(i,j,k,n10)
* + dtime * ( zstar * 1000. * .0075
* + ( tracer(i,j,km1,n10)*precflx(i,j,k)
* - tracer(i,j,k,n10)*precflx(i,j,k+1)
* ) * 100. / (ypthic(i,j,k)/gravit)
* )
c 7-Be:
tracer(i,j,k,n7) = tracer(i,j,k,n7)
* + dtime * ( zstar * 1000. * .0075 * 2.
* + ( tracer(i,j,km1,n7)*precflx(i,j,k)
* - tracer(i,j,k, n7)*precflx(i,j,k+1)
* ) * 100. / (ypthic(i,j,k)/gravit)
* )
* - zfac7 * tracer(i,j,k,n7)
enddo
c Step tracer amounts due to dry deposition (lowest level
c only), assuming dry deposition velocity = .002 m/s.
c Also store net surface flux (# atoms/m2/s) for history.
if (k.eq.nlev) then
do i=1,nlon
tracer(i,j,k,n10) = tracer(i,j,k,n10)
* - dtime * tracer(i,j,k,n10) *.002/zdz(i)
tracer(i,j,k,n7) = tracer(i,j,k,n7)
* - dtime * tracer(i,j,k,n7) *.002/zdz(i)
histmp(i,j,nc) =
* tracer(i,j,k,n10) * ( precflx(i,j,k+1)*100.
* + zrho(i)*.002 )
histmp(i,j,nc+ntracb/2)=
* tracer(i,j,k,n7) * ( precflx(i,j,k+1)*100.
* + zrho(i)*.002 )
enddo
endif
c--------------
enddo
c--------------
c============
enddo
enddo
c============
c Save history fields
do nc = 1,ntracb
n = ntraca + nc
call puthis (tracer(1,1,1,n), ihtrace+nc-1)
call puthis (histmp(1,1,nc), ihtrace+40+nc-1)
enddo
c Remainder is for writing diagnostics to scratch files.
c Only compute and write diagnostics at day boundaries
if ( mod(nstep,nint(1.*86400./dtime)).ne.0 .and.
* nstep.ne.nrstrt ) return
c Calculate atmos-mass amounts
call zero (zmasz, nlev)
zmastot = 0.
zmastrop = 0.
zmastrat = 0.
zareatot = 0.
do jj=1,norec
sigpaus(jj) = .100*cs(jj) + .280*(1.-cs(jj))
zwei = cosbud(jj)/nlon
do jk=1,nlev
do ji=1,nlon
zdm = (ypthic(ji,jj,jk)/gravit) * zwei
zmasz(jk) = zmasz(jk) + zdm
zmastot = zmastot + zdm
if (sig(jk).le.sigpaus(jj)) then
zmastrat = zmastrat + zdm
else
zmastrop = zmastrop + zdm
endif
enddo
enddo
zareatot = zareatot + cosbud(jj)
enddo
c Calculate tracer amounts and surface tracer flux
do nc = 1, ntracb
n = ntraca + nc
call zero (gz(1,n), nlev)
gtot(n) = 0.
gtrop(n) = 0.
gstrat(n) = 0.
gflux(n) = 0.
do jj=1,norec
zwei = cosbud(jj)/nlon
do jk=1,nlev
do ji=1,nlon
zdtrac = tracer(ji,jj,jk,n)*(ypthic(ji,jj,jk)/gravit)*zwei
gz(jk,n) = gz(jk,n) + zdtrac
gtot(n) = gtot(n) + zdtrac
if (sig(jk).ge.0.200) then
gtrop(n) = gtrop(n) + zdtrac
else
gstrat(n) = gstrat(n) + zdtrac
endif
enddo
enddo
do ji=1,nlon
gflux(n) = gflux(n) + histmp(ji,jj,nc)*zwei
enddo
enddo
do jk=1,nlev
gz(jk,n) = gz(jk,n) / zmasz(jk)
enddo
gtot(n) = gtot(n) / zmastot
gtrop(n) = gtrop(n) / zmastrop
gstrat(n) = gstrat(n) / zmastrat
gflux(n) = gflux(n) / zareatot
enddo
c Write diagnostics to files to files fort.[71-76] for 10-Be,
c and to fort.[81-86} for 7-Be
c
k1 = 9
k2 = 1
k3 = -1
c-------------------
do iloop = 1,2 ! loop #1 for 10-Be, #2 for 7-Be
c-------------------
noffn = (iloop-1)*(ntracb/2)
noffiu = (iloop-1)*10
do nh = 1, ntracb/2
nc = noffn + nh
n = ntraca + noffn + nh
iu = 70 + noffiu + nh
if (firstprint) then
ih = ihtrace + nc - 1
write(iu,702)
* nc, cindex(1,ih), cindex(2,ih), sigpaus(1),sigpaus(norec/2),
* (sig(jk),jk=k1,k2,k3)
702 format(
* ' tracer=',i3,' (',a,2x,a,') sigpaus(po/eq)=',2f7.3
* /' calday',' runday',
* ' trop',' strat',' total',' sfcflx', 9f9.3/)
endif
write(iu,704) istepy*dtime/86400., nstep*dtime/86400.,
* nint(gtrop(n)), nint(gstrat(n)), nint(gtot(n)),
* gflux(n), (nint(gz(jk,n)),jk=k1,k2,k3)
704 format(2f7.2, 3i9, f9.2, 9i9)
ier = flush(iu)
enddo
c----------
enddo
c----------
firstprint = .false.
return
end
#endif
C
C **************************** PRINGLOB ********************************
C
subroutine pringlob (ypthicm, ypthic, clabel)
c Computes and prints out global mean atmospheric budget quantites,
c similar to BUDCLC (but intended for diagnostics within timesteps).
C----------------------------------------------------------------------
#include <PARAMS.h>
C----------------------------------------------------------------------
#include <COMBUD.h>
C----------------------------------------------------------------------
#include <COMCON.h>
C----------------------------------------------------------------------
#include <COMDYR.h>
C----------------------------------------------------------------------
#include <COMFLG.h>
C----------------------------------------------------------------------
#include <COMLUN.h>
C----------------------------------------------------------------------
#include <COML10.h>
C----------------------------------------------------------------------
#include <COML30.h>
C----------------------------------------------------------------------
#include <COML50.h>
C----------------------------------------------------------------------
#include <COMMAP.h>
C----------------------------------------------------------------------
#include <COMMUN.h>
C----------------------------------------------------------------------
#include <COMTIM.h>
C----------------------------------------------------------------------
dimension ypthicm(nlon,norec,nlev), ypthic(nlon,norec,nlev)
C----------------------------------------------------------------------
character clabel*(*), cerr*8
logical zprint
data zvapre1,zvapre,zheatpre1,ztotpre1,zplutpre,zpluqpre,
* zyt2pre,instepre /7*0., 0/
data zprint /.false./
C----------------------------------------------------------------------
if (.not. zprint) return
zmass1= 0.
zvap1 = 0.
zheat1= 0.
zke1= 0.
zpot1= 0.
zplut = 0.
zpluq = 0.
zmass = 0.
zvap = 0.
zheat = 0.
zplut = 0.
zke = 0.
zpot = 0.
zyt2 = 0.
zprec = 0.
zevap = 0.
zdiab = 0.
do 100 jk = 1,nlev
do 102 jj = 1,norec
zwei = cosbud(jj)/nlon
do 104 ji = 1,nlon
zlwc = ylwc_c(ji,jj,jk)+ylwc_a(ji,jj,jk)+ylwc_s(ji,jj,jk)
zm1= exp(ylpsm1(ji,jj))*dsigma(jk)/gravit
zq1= yqm1(ji,jj,jk)
zt1= ytm1(ji,jj,jk)
zu1= yum1(ji,jj,jk) + fplumu(ji,jj,jk)/zm1
zv1= yvm1(ji,jj,jk) + fplumv(ji,jj,jk)/zm1
zm = exp(ylps(ji,jj))*dsigma(jk)/gravit
zq = yq(ji,jj,jk)
zt = yt(ji,jj,jk)
zu = yu(ji,jj,jk) + fplumu(ji,jj,jk)/zm
zv = yv(ji,jj,jk) + fplumv(ji,jj,jk)/zm
if (hybtype.eq.0) then
zme1= zm1
zme = zm
else
zme1= ypthicm(ji,jj,jk)/gravit
zme = ypthic(ji,jj,jk)/gravit
endif
zmass1= zmass1+ zwei*zm1
zvap1 = zvap1 + zwei*(zq1+zlwc)*zme1
zheat1= zheat1 + zwei
* * ( (1-zq1)*cpair*zt1*zm1
* + zq1*(cpwv*(zt1-tmelt)+latsub)*zme1
* + zlwc*latice*zme1 )
zke1 = zke1 + zwei*0.5*(zu1**2+zv1**2)*zm1
zpluq = zpluq + zwei*fplumq(ji,jj,jk)
zplut = zplut + zwei
* * ( fplumt(ji,jj,jk)
* + fplumq(ji,jj,jk)*(cpwv*(zt1-tmelt)+latsub) )
zmass = zmass + zwei*zm
zvap = zvap + zwei*(zq+zlwc)*zme
zheat = zheat + zwei
* * ( (1.-zq)*cpair*zt*zm
* + zq*(cpwv*(zt -tmelt)+latsub)*zme
* + zlwc*latice*zme )
zke= zke + zwei*0.5*(zu**2+zv**2)*zm
if (nstep.gt.nrstrt) then
c Subtract frictional heating from yt2: this was added to
c yt2 in vdif, but cancels in *total* energy budget
zyt2 = zyt2 + zwei * yt2(ji,jj,jk)
* - zwei * zm *( -yfu(ji,jj,jk)*yu(ji,jj,jk)
* -yfv(ji,jj,jk)*yv(ji,jj,jk) )
zdiab = zdiab + zwei*( yqrs(ji,jj,jk)-yqrs(ji,jj,jk+1)
* +yqrl(ji,jj,jk)-yqrl(ji,jj,jk+1) )
endif
104 continue
102 continue
100 continue
do 110 jj = 1,norec
zwei = cosbud(jj)/nlon
do 112 ji=1,nlon
zpot1= zpot1+ zwei * exp(ylpsm1(ji,jj))*yfi(ji,jj) / gravit
zpot = zpot + zwei * exp(ylps(ji,jj)) *yfi(ji,jj) / gravit
if (nstep.gt.nrstrt) then
zprec = zprec + zwei * ( frainc(ji,jj)+fsnowc(ji,jj)
* +frains(ji,jj)+fsnows(ji,jj))
zevap = zevap + zwei * yqflx(ji,jj)
zdiab = zdiab + zwei *
* ( ytflx(ji,jj)
* + yqflx(ji,jj)
* *((yt(ji,jj,nlev)-tmelt)*cpwv + latsub)
* - (frainc(ji,jj)+frains(ji,jj))
* *((max(yt(ji,jj,nlev),tmelt)-tmelt)*ch2o+latice)
* - (fsnowc(ji,jj)+fsnows(ji,jj))
* *((min(yt(ji,jj,nlev),tmelt)-tmelt)*cice)
* )
endif
112 continue
110 continue
z1= zmass1*cpair
z = zmass *cpair
ztot1= zheat1+ zke1+ zpot1
ztot = zheat + zke + zpot
if (clabel.eq.'postphys') then
write(cerr,'(f8.4)')
* ((zvap1-zvapre1)/twodt + (zpluq-zpluqpre)/dtime + (zprec-zevap))
* * 86400.
c write(cerr,'(f8.4)')
c * (zheat1-zheatpre1)/twodt + (zplut-zplutpre)/dtime + zyt2 - zdiab
else if (clabel.eq.'postspec') then
write(cerr,'(f8.4)') (ztot-ztotpre1)/twodt - zyt2pre
else
cerr = ' '
endif
if (instepre.ne.nstep) write (*,8000) nstep
write(*,8002)
* clabel(1:8),
* zvap1, zvap, (zheat1+zpot1)/z1, (zheat+zpot)/z,
* zke1/z1, zke/z, ztot1/z1, ztot/z,
* zyt2, zprec*dtime, zevap*dtime,
* cerr
8000 format(/'ns=',i6,
* ' zvap1 zvap zheat1 zheat',
* ' zke1 zke ztot1 ztot',
* ' zyt2 zprec zevap',
* ' err')
8002 format(a8,':', 11f9.4, a)
zvapre1 = zvap1
zvapre = zvap
zheatpre1 = zheat1
zpluqpre = zpluq
zplutpre = zplut
zheatpre1 = zheat1
ztotpre1 = ztot1
zyt2pre = zyt2
instepre = nstep
return
end
C
C **************************** PRINVERV ********************************
C
subroutine prinverv (field, clabel)
c Prints out mean and standard deviation of a 3-D field at
c individual levels.
c field = 3-D field
c clabel = field name
C----------------------------------------------------------------------
#include <PARAMS.h>
C----------------------------------------------------------------------
#include <COMBUD.h>
C----------------------------------------------------------------------
#include <COMCON.h>
C----------------------------------------------------------------------
#include <COMLUN.h>
C----------------------------------------------------------------------
#include <COMMAP.h>
C----------------------------------------------------------------------
#include <COMMUN.h>
C----------------------------------------------------------------------
#include <COMTIM.h>
C----------------------------------------------------------------------
dimension field(nlon,norec,nlev)
character clabel*(*)
dimension zav(nlev), zsd(nlev), zfac(nlev)
logical zprint
data zprint, izstepre /.false., 0/
C----------------------------------------------------------------------
if (.not. zprint) return
n = max (nint(0.25*86400./dtime), 1)
if (mod(nstep,n).ne.0) return
c Compute means
do 100 jk = 1,nlev
zav(jk) = 0.
do 102 jj = 1,norec
zwei = cosbud(jj)/nlon
do 104 ji = 1,nlon
zav(jk) = zav(jk) + field(ji,jj,jk)*zwei
104 continue
102 continue
c Compute standard deviations
zsd(jk) = 0.
do 112 jj = 1,norec
zwei = cosbud(jj)/nlon
do 114 ji = 1,nlon
zsd(jk) = zsd(jk) + ((field(ji,jj,jk)-zav(jk))**2)*zwei
114 continue
112 continue
zsd(jk) = sqrt(zsd(jk))
100 continue
c Printout
do 700 jk=1,nlev
if (clabel(1:12).eq.'d[ln(ps)]/dt') then
zfac(jk) = .864e5 * sig(jk)
else if (clabel(1:5).eq.'omega') then
zfac(jk) = .864e5 / 1.e5
else
zfac(jk) = .864e5
endif
700 continue
if (nstep.ne.izstepre) then
write(nout,705) nstep, (sig(jk),jk=1,12)
705 format(80('-')/'nstep=',i6/12f11.3)
izstepre = nstep
endif
write(nout,710)
* clabel,
* (zfac(jk)*zav(jk), jk=1,12),
* (zfac(jk)*zsd(jk), jk=1,12),
* (dsigma(jk)/(zfac(jk)*zsd(jk)), jk=1,12)
710 format(
* 'field=',a,' mean,sd,dsigma/sd for k=1-12:'
* /12f11.5
* /12f11.5
* /12f11.5 )
return
end
c
c ***************************** equilr_i ******************************
c
c#ifdef isotrac
cc subroutine equilr_i (T, qv, qv_o, qv_h, R_o, R_h)
cc
cc Used to get isotopic ratios in isotopic equilibrium with the vapor
cc Input: T temperature
cc qv, qv_o, qv_h water vapor specific humidities
cc Output: R_o, R_h equilibrium isotopic ratio
cc---------
c#include <COMCON.h> ! smoj_*
c#include <COMFLG.h> ! t_r_i
c#include <PARA_I.h> ! av*_*()
cc---------
cc
c if (T.ge.t_r_i) then
c a_o = avl_o(T)
c a_h = avl_h(T)
c else
c a_o = avi_o(T)
c a_h = avi_h(T)
c endif
cc
c if (qv.ne.0.) then
c R_o = a_o*qv_o/qv
c R_h = a_h*qv_h/qv
cc else
cc R_o = 0.96*smoj_o
cc R_h = 0.69*smoj_h
c endif
cc
c return
c end
c#endif
c
c ***************************** prout_i *******************************
c
c>>>>>>>>>>>>>
#ifdef isotrac
c>>>>>>>>>>>>>
subroutine prout_i (ypthicm, ypthic, titre)
#include <PARAMS.h>
#include <COMBUD.h>
#include <COMCON.h>
#include <COMLUN.h>
#include <COML10.h>
#include <COML30.h>
#include <COML50.h>
#include <COMMUN.h>
#include <COMTIM.h>
dimension ypthicm(nlon,norec,nlev), ypthic(nlon,norec,nlev),
~ c(nrtr), zvap1_t(nrtr), zvap_t(nrtr), zpluq_t(nrtr),
~ zprec_t(nrtr), zevap_t(nrtr)
character titre*10
if (pii_i.eq.0 .or. pjj_i.eq.0) return
iup = 80 ! logical unit nb for isotopes point print out
iub = 81 ! logical unit nb for isotopes budget print out
iut = 84 ! logical unit nb for tracers point print out
iug = 98 ! logical unit nb for tracers budget print out
ii = pii_i ! longitude indice
jj = pjj_i ! latitude indice
c pdn_i ! output every pdn_i timesteps
c if (nstep.eq.nrstrt) then
if (nstep.eq.nrstrt .and. titre.eq.'prePHYS ') then
open (iup, form='formatted', status='unknown', file='pnt_iso')
open (iut, form='formatted', status='unknown', file='pnt_tra')
open (iub, form='formatted', status='unknown', file='bud_iso')
open (iug, form='formatted', status='unknown', file='bud_tra')
write (iub,'(a)') '^^Step ^Title^^^^ ^^^M-1(vap+liq) '//
~ '^^^^^M(vap+liq) ^^^^^^^^^^^^^Fv ^^^^^^^^^^^M(P) ^^^^^^^^^^^M(E)'
write (iug,'(a)') '^^Step ^Title^^^^ ^^^M-1(vap+liq) '//
~ '^^^^^M(vap+liq) ^^^^^^^^^^^^^Fv ^^^^^^^^^^^M(P) ^^^^^^^^^^^M(E)'
endif
1 format('### [',i2,',',i2,'] # ',a10,' # Step ',i6,' ###')
2 format (i6,1x,a10, 5(1x,g15.8))
3 format (6x,1x,a10, 5(1x,g15.8))
4 format (6x,1x,' t',i2,':',5(1x,g15.8))
c YQ<0 or YQM1 or TRACER>=1.01 or TRACER<=0.01 TRAP
c5 format (i6,a10,'>yq',a2,'(',i2,2(',',i2),')=',g15.8,
c ~ '>c(',i2,')=',f7.2,'%')
c write (85,*) 'step ',nstep
c#ifdef isotracreg
c do i=1,nlon
c do j=1,norec
c do k=1,nlev
c if (yq (i,j,k).ne.0.) then
c do it=1,nrtr
c ct = rtrq (i,j,k,it)/yq (i,j,k)
c if (yq (i,j,k).lt.0. .or. ct.le.-0.01 .or. ct.ge.1.01)
c ~ write (85,5) nstep,titre,' ',i,j,k,yq (i,j,k),it,ct*100.
c enddo
c endif
c if (yqm1(i,j,k).ne.0.) then
c do it=1,nrtr
c ct = rtrqm1(i,j,k,it)/yqm1(i,j,k)
c if (yqm1(i,j,k).lt.0. .or. ct.le.-0.01 .or. ct.ge.1.01)
c ~ write (85,5) nstep,titre,'m1',i,j,k,yqm1(i,j,k),it,ct*100.
c enddo
c endif
c enddo
c enddo
c enddo
c#endif
if (nstep.ne.nrstrt.and.mod(nstep,pdn_i).ne.0) return
c ISOTOPES POINT PRINT OUT
write (iup,1) ii,jj,titre,nstep
write (iup,'(a194)')
~ '^k ^^^^^^^^^^^^^yq ^^^d18O ^^^^d2H ^^^^^^^^^^^yqm1 ^^^d18O '//
~ '^^^^d2H ^^^^^^^^^fplumq ^^^d18O ^^^^d2H ^^^^^^^^^ylwc_c '//
~ '^^^d18O ^^^^d2H ^^^^^^^^^ylwc_a ^^^d18O ^^^^d2H '//
~ '^^^^^^^^^ylwc_s ^^^d18O ^^^^d2H'
do 10 k=1,nlev
if (yq (ii,jj,k).ne.0.) then
doyq = 1e3*(yq _o(ii,jj,k)/yq (ii,jj,k)/smoj_o-1.)
ddyq = 1e3*(yq _h(ii,jj,k)/yq (ii,jj,k)/smoj_h-1.)
else
doyq = -999.99
ddyq = -999.99
endif
if (yqm1 (ii,jj,k).ne.0.) then
doy1 = 1e3*(yqm1 _o(ii,jj,k)/yqm1 (ii,jj,k)/smoj_o-1.)
ddy1 = 1e3*(yqm1 _h(ii,jj,k)/yqm1 (ii,jj,k)/smoj_h-1.)
else
doy1 = -999.99
ddy1 = -999.99
endif
if (fplumq(ii,jj,k).ne.0.) then
dofq = 1e3*(fplumq_o(ii,jj,k)/fplumq(ii,jj,k)/smoj_o-1.)
ddfq = 1e3*(fplumq_h(ii,jj,k)/fplumq(ii,jj,k)/smoj_h-1.)
else
dofq = -999.99
ddfq = -999.99
endif
if (ylwc_c(ii,jj,k).ne.0.) then
dolc = 1e3*(ylwc_c_o(ii,jj,k)/ylwc_c(ii,jj,k)/smoj_o-1.)
ddlc = 1e3*(ylwc_c_h(ii,jj,k)/ylwc_c(ii,jj,k)/smoj_h-1.)
else
dolc = -999.99
ddlc = -999.99
endif
if (ylwc_a(ii,jj,k).ne.0.) then
dola = 1e3*(ylwc_a_o(ii,jj,k)/ylwc_a(ii,jj,k)/smoj_o-1.)
ddla = 1e3*(ylwc_a_h(ii,jj,k)/ylwc_a(ii,jj,k)/smoj_h-1.)
else
dola = -999.99
ddla = -999.99
endif
if (ylwc_s(ii,jj,k).ne.0.) then
dols = 1e3*(ylwc_s_o(ii,jj,k)/ylwc_s(ii,jj,k)/smoj_o-1.)
ddls = 1e3*(ylwc_s_h(ii,jj,k)/ylwc_s(ii,jj,k)/smoj_h-1.)
else
dols = -999.99
ddls = -999.99
endif
write (iup,'(i2,6(1x,g15.8,2(1x,f7.2)))')
~ k, yq (ii,jj,k), doyq, ddyq, yqm1 (ii,jj,k), doy1, ddy1,
~ fplumq(ii,jj,k), dofq, ddfq, ylwc_c(ii,jj,k), dolc, ddlc,
~ ylwc_a(ii,jj,k), dola, ddla, ylwc_s(ii,jj,k), dols, ddls
10 continue
c TRACERS POINT PRINT OUT
#ifdef isotracreg
write (iut,1) ii,jj,titre,nstep
write (iut,'(a13,$)') '^k ^^^^^^^^yq'
do it=1,nrtr
write (iut,'(a3,i2,a2,$)') ' c(',it,')%'
enddo
write (iut,'(a11,$)') ' ^^^^fplumq'
do it=1,nrtr
write (iut,'(a3,i2,a2,$)') ' c(',it,')%'
enddo
write (iut,'()')
do k=1,nlev
write (iut,'(i2,1x,g10.4,$)') k, yq (ii,jj,k)
do it=1,nrtr
if (yq (ii,jj,k).ne.0.) then
c(it) = 100.*rtrq (ii,jj,k,it)/yq (ii,jj,k)
else
c(it) = -99.99
endif
write (iut,'(1x,f6.2,$)') c(it)
enddo
write (iut,'(1x,g10.4,$)') fplumq(ii,jj,k)
do it=1,nrtr
if (fplumq(ii,jj,k).ne.0.) then
c(it) = 100.*rtrfq(ii,jj,k,it)/fplumq(ii,jj,k)
else
c(it) = -99.99
endif
write (iut,'(1x,f6.2,$)') c(it)
enddo
write (iut,'()')
enddo
if (titre.eq.'postPHYS ') then
write (iut,'(a13,$)') ' ^^^^^^^^^P'
do it=1,nrtr
write (iut,'(a3,i2,a2,$)') ' c(',it,')%'
enddo
write (iut,'()')
p = frainc(ii,jj)+frains(ii,jj)+fsnowc(ii,jj)+fsnows(ii,jj)
write (iut,'(3x,g10.4,$)') p
do it=1,nrtr
if (p.ne.0.) then
c(it) = 100.*(rtrprc(ii,jj,it)+rtrprs(ii,jj,it)+
~ rtrpsc(ii,jj,it)+rtrpss(ii,jj,it))/p
else
c(it) = -99.99
endif
write (iut,'(1x,f6.2,$)') c(it)
enddo
write (iut,'()')
endif
#endif
c ISOTOPES & TRACERS BUDGET PRINT OUT
zvap1 = 0.
zvap1_o = 0.
zvap1_h = 0.
zvap = 0.
zvap_o = 0.
zvap_h = 0.
zpluq = 0.
zpluq_o = 0.
zpluq_h = 0.
zprec = 0.
zprec_o = 0.
zprec_h = 0.
zevap = 0.
zevap_o = 0.
zevap_h = 0.
#ifdef isotracreg
do it=1,nrtr
zvap1_t(it) = 0.
zvap_t(it) = 0.
zpluq_t(it) = 0.
zprec_t(it) = 0.
zevap_t(it) = 0.
enddo
#endif
do 100 k = 1,nlev
do 102 j = 1,norec
zwei = cosbud(j)/nlon
do 104 i = 1,nlon
zme1 = ypthicm(i,j,k)/gravit
zme = ypthic(i,j,k) /gravit
zlwc = ylwc_c(i,j,k) +ylwc_a(i,j,k)+
~ ylwc_s(i,j,k)
zlwc_o = ylwc_c_o(i,j,k)+ylwc_a_o(i,j,k)+
~ ylwc_s_o(i,j,k)
zlwc_h = ylwc_c_h(i,j,k)+ylwc_a_h(i,j,k)+
~ ylwc_s_h(i,j,k)
zvap1 = zvap1 + zwei*(yqm1(i,j,k) +zlwc) *zme1
zvap1_o= zvap1_o+ zwei*(yqm1_o(i,j,k)+zlwc_o)*zme1
zvap1_h= zvap1_h+ zwei*(yqm1_h(i,j,k)+zlwc_h)*zme1
zvap = zvap + zwei*(yq(i,j,k) +zlwc) *zme
zvap_o = zvap_o + zwei*(yq_o(i,j,k) +zlwc_o)*zme
zvap_h = zvap_h + zwei*(yq_h(i,j,k) +zlwc_h)*zme
zpluq = zpluq + zwei*fplumq(i,j,k)
zpluq_o= zpluq_o+ zwei*fplumq_o(i,j,k)
zpluq_h= zpluq_h+ zwei*fplumq_h(i,j,k)
if ((k.eq.nlev).and.(nstep.gt.nrstrt)) then
zprec = zprec + zwei*(frainc(i,j) +fsnowc(i,j)
~ +frains(i,j) +fsnows(i,j))
zprec_o= zprec_o+ zwei*(frainc_o(i,j)+fsnowc_o(i,j)
~ +frains_o(i,j)+fsnows_o(i,j))
zprec_h= zprec_h+ zwei*(frainc_h(i,j)+fsnowc_h(i,j)
~ +frains_h(i,j)+fsnows_h(i,j))
zevap = zevap + zwei*yqflx(i,j)
zevap_o= zevap_o+ zwei*yqflx_o(i,j)
zevap_h= zevap_h+ zwei*yqflx_h(i,j)
endif
104 continue
102 continue
100 continue
#ifdef isotracreg
do it=1,nrtr
do k = 1,nlev
do j = 1,norec
zwei = cosbud(j)/nlon
do i = 1,nlon
zme1 = ypthicm(i,j,k)/gravit
zme = ypthic(i,j,k) /gravit
zlwc = ylwc_c(i,j,k) +ylwc_a(i,j,k)+
~ ylwc_s(i,j,k)
if (yqm1(i,j,k).ne.0.) zvap1_t(it) = zvap1_t(it)+
~ zwei*rtrqm1(i,j,k,it)*(1.+zlwc/yqm1(i,j,k))*zme1
if (yq(i,j,k) .ne.0.) zvap_t(it) = zvap_t(it) +
~ zwei*rtrq(i,j,k,it) *(1.+zlwc/yq(i,j,k)) *zme
zpluq_t(it) = zpluq_t(it)+zwei*rtrfq(i,j,k,it)
if ((k.eq.nlev).and.(nstep.gt.nrstrt)) then
zprec_t(it) = zprec_t(it)+zwei*
~ (rtrprs(i,j,it)+rtrprc(i,j,it)
~ +rtrpss(i,j,it)+rtrpsc(i,j,it))
zevap_t(it) = zevap_t(it)+zwei*rtrfv(i,j,it)
endif
enddo
enddo
enddo
enddo
#endif
write (iub,2) nstep,titre,
~ zvap1, zvap, zpluq, zprec, zevap
write (iub,3) ' 18-O:',
~ zvap1_o, zvap_o, zpluq_o, zprec_o, zevap_o
write (iub,3) ' 2-H:',
~ zvap1_h, zvap_h, zpluq_h, zprec_h, zevap_h
write (iug,2) nstep,titre,
~ zvap1, zvap, zpluq, zprec, zevap
#ifdef isotracreg
do it=1,nrtr
write (iug,4) it,
~ zvap1_t(it),zvap_t(it),zpluq_t(it),zprec_t(it),zevap_t(it)
enddo
#endif
c ii = flush(iup) ! ### for debug ... ###
c ii = flush(iub) ! ### for debug ... ###
c ii = flush(iut) ! ### for debug ... ###
c ii = flush(iug) ! ### for debug ... ###
c ii = flush(85 ) ! ### for debug ... ###
return
end
c>>>>>
#endif
c>>>>>
c
c ***************************** hand1,2,3 *****************************
c
#ifdef sun
integer function hand1()
write (6,*) '*** STOP (exception: division) in hand1'
hand1 = 0.
call endrun (-1)
end
integer function hand2()
write (6,*) '*** STOP (exception: overflow) in hand2'
hand2 = 0.
call endrun (-1)
end
integer function hand3()
write (6,*) '*** STOP (exception: invalid) in hand3'
hand3 = 0.
call endrun (-1)
end
#endif
|
SUBROUTINE BMATCH(B,NX,NY)
IMPLICIT NONE
C
C_TITLE BMATCH - Match image regions off of spherical datum with datum img
C
#include "clinom_aepar.inc"
#include "clinom_datum.inc"
#include "clinom_ops.inc"
C_ARGS TYPE VARIABLE I/O DESCRIPTION
INTEGER*4 NX,NY !I Sample, line dimensions
REAL*4 B(NX,NY) !B Image array
C
C_DESC Used to avoid doing PC near the limbs or off the disk for a
C spherical datum model. Pixels with a distance from the
C disk center greater than RMASK2 times the disk radius are
C set to the local datum brightness. (For the routine to work,
C B must be scaled to the photometric function and BMAX defined
C already.)
C
C_CALLS PBDER (CLINOM.OLB)
C
C_HIST 28-Aug-90 Randolph Kirk U.S.G.S. Flagstaff Original Version
C 24-Jun-02 RLK Allow for aspect ratio
C
C_PAUSE
INTEGER*4 I,J ! Loop counters
REAL*4 X,Y ! Coordinates relative to sphere center
REAL*4 X2,Y2 ! Squares of X, Y
REAL*4 RM22 ! Squared distance from sphere center
C to pixel center beyond which we match
REAL*4 BE ! Model brightness of datum in pixel
REAL*4 DB1,DB2 ! Derivatives of model brightness (not
C used)
IF (DATUMTYP.NE.2) RETURN ! Applies only to spherical datum
IF (RMASK2.LE.0.0) RETURN
RM22=R0*R0*RMASK2*RMASK2
DO J=1,NY
Y=REAL(J)-Y0
Y2=Y*Y
DO I=1,NX
C X=REAL(I)-X0
X=(REAL(I)-X0)*ASPECT
X2=X*X
IF (X2+Y2.GT.RM22) THEN
CALL PBDER(I,J,0.0,0.0,BE,DB1,DB2,0)
B(I,J)=BE
END IF
ENDDO
ENDDO
NOPS=NOPS+4*NX*NY+2*NY
RETURN
END
|
!This uses integer and character variables
program convert
implicit none
integer :: pounds, pence, total
character :: name*30
print *, 'What is your name?'
read *, name
print *, 'Hi ',name,'! Enter number of pound and pence'\
'please'
read *, pounds, pence
total = 100 * pounds + pence
print *, 'the total money is pence is ',total
end program convert
|
SUBROUTINE HDPLOT (GPLST,NMAX,MAXSF,IOPCOR,IB)
C
IMPLICIT INTEGER (A-Z)
LOGICAL DEBUG
INTEGER GPLST(1),NAME(2),ISYS(100),PTRS(29)
REAL DV,PSI,PHI,THETA,SCF,P,X(20),Y(20),Z(20)
COMMON /BLANK / NGP,NSIL,NSETS,SKP1(7),
1 SKP2(2),ELSET,SKP22(7),
2 MERR,IDUM(3),NSCR1,NSCR2,NSCR3
COMMON /SYSTEM/ SKPS,IOUT
COMMON /PLTSCR/ NNN,G(3)
COMMON /HDREC / NOFSUR,NS,ELID,LID,NPERS,P(3,13)
COMMON /ZZZZZZ/ RZ(1)
COMMON /HDPTRS/ XDUM,XCC,XASOLV,YASOLV,ZASOLV,X1SKT,Y1SKT,Z1SKT,
1 ZCOEF1,ZCOEF,ICOUNT,IRCT,X21,Y21,Z21,IIA,XE,YE,
2 XU,YU,XI,YI,ZI,DI,IBEG,IEND,ICT,ICCT,WORK
COMMON /HDSC / SCF,PSI,PHI,THETA,MNE,DV,MNP,ICORE
COMMON /PLOTHD/ USED
EQUIVALENCE (ISYS(1),SKPS), (PTRS(1),XDUM)
DATA NAME / 4HHDPL,4HOT /
DATA DEBUG / .FALSE. /
C
C CALL SSWTCH (47,J)
C IF (J .EQ. 1) DEBUG = .TRUE.
C
C SET MNE EQUAL TO THE MAXIMUM NUMBER OF EDGES IN ANY ONE POLYGON.
C
MNE = NMAX
C
C MNP=MNE+2+2*NHOLES WHERE NHOLES IS THE NUMBER OF HOLES,IF ANY
C
NHOLES = 0
MNP = MNE + 2 + 2*NHOLES
C
C SET DISTANCE FROM VIEWER, AND SET SCALING FACTOR = 1 UNITS/INCH
C
DV = 99999.
SCF = 1.00
C
C SET MAX. LINES OF INTERSECTION ALLOWED IN HDSOLV (DIMEN. OF XCC)
C
LINTC = 800
IF (ISYS(85) .NE. 0) LINTC = ISYS(85)
C
C DEFINE EULERIAN ANGLES IN DEGREES.
C
PSI = 0.
PHI = 0.
THETA = 0.
C
C INITIALIZE ARRAY POINTERS IN OPEN CORE SPACE (USED, SET BY PLOT,
C IS NO. OF WORDS ALREADY IN USE)
C
XDUM = 1
XCC = XDUM + USED
XASOLV= XCC + LINTC
YASOLV= XASOLV+ 50
ZASOLV= YASOLV+ 50
X1SKT = ZASOLV+ 50
Y1SKT = X1SKT + 160
Z1SKT = Y1SKT + 160
ZCOEF1= Z1SKT + 160
ZCOEF = ZCOEF1+ 150
ICOUNT= ZCOEF + 150
IRCT = ICOUNT+ 150
X21 = IRCT + 100
Y21 = X21 + 200
Z21 = Y21 + 200
IIA = Z21 + 200
XE = IIA + 200
YE = XE + 150
XU = YE + 150
YU = XU + 150
IBEG = YU + 150
IEND = IBEG + 100
ICT = IEND + 100
ICCT = ICT + 100
XI = ICCT + 100
ICORE = (25+5*MNE+4*MNP)*(MAXSF+1)
J = (IOPCOR-ICORE-XI)/5
YI = XI + J
ZI = YI + J
DI = ZI + J
WORK = DI + J
IF (DEBUG .OR. J.LT.300) WRITE (IOUT,55) NMAX,MAXSF,ICORE,USED,
1 LINTC,IOPCOR,IB,NSETS,J,PTRS
IF (J .GE. 300) GO TO 5
J = 300*5 + XI + ICORE - IOPCOR
CALL MESAGE (-8,J,NAME)
C
5 CALL GOPEN (NSCR2,GPLST(IB),0)
CALL LINE (0.,0.,0.,0.,1,-1)
10 CONTINUE
CALL READ (*25,*25,NSCR2,NOFSUR,44,0,M)
NPS = NPERS
DO 20 I = 1,NPS
X(I) = P(1,I)
Y(I) = P(2,I)
Z(I) = P(3,I)
20 CONTINUE
IF (DEBUG) WRITE (IOUT,65)
1 NOFSUR,NS,ELID,LID,NPS,(X(N),Y(N),Z(N),N=1,NPS)
NC = 0
CALL HDSKET (X,Y,Z,NPS,NC)
GO TO 10
25 CALL CLOSE (NSCR2,1)
NC = 1
CALL HDSKET (X,Y,Z,NPS,NC)
IF (NC .EQ. 0) GO TO 40
WRITE (IOUT,30) NC,ICORE,DV
30 FORMAT (22H CODE FOR HIDDEN ERROR,I3,6H ICORE,I9,3H DV,F15.5)
40 CALL LINE (0.,0.,0.,0.,1,+1)
IF (DEBUG) WRITE (IOUT,60)
RETURN
C
55 FORMAT (1X,10HIN HDPLOT ,9I8, /,(5X,15I8))
60 FORMAT (1X,10HOUT HDPLOT)
65 FORMAT (1X,5I10/(1X,3G20.4))
END
|
SUBROUTINE SINGLE(X, COUNT, AVE, SD, XMIN, XMAX, SSQ)
C
IMPLICIT NONE
C
REAL*8 COUNT,AVE,X,SD,XMIN,XMAX,SSQ
C
IF(COUNT.EQ.0.) THEN
AVE=0.
SD=0.
XMIN=1.0D08
XMAX=-1.0D08
SSQ=0.
ENDIF
COUNT=COUNT+1.
AVE=AVE+(X-AVE)/COUNT
IF(COUNT.NE.1.) SSQ=SSQ+COUNT*(X-AVE)**2/(COUNT-1.)
SD=(SSQ/COUNT)**0.5
IF(XMIN.GT.X) XMIN=X
IF(XMAX.LT.X) XMAX=X
RETURN
END
|
C MODULE HPOPTG
C-----------------------------------------------------------------------
C ROUTINE: HPOPTG
C VERSION: 1.0.0
C DATE: 9-3-81
C AUTHOR: JIM ERLANDSON
C DATA SCIENCES INC
C***********************************************************************
C DESCRIPTION:
C
C GENERAL PRINT ROUTINE FOR NAMED OPTION RECORDS
C***********************************************************************
C ARGUMENT LIST:
C
C NAME TYPE I/O DIM DESCRIPTION
C
C KBUF I I ? INPUT BUFFER CONTAINING RECORD
C***********************************************************************
SUBROUTINE HPOPTG (KBUF,IWORK,LWORK)
C
INCLUDE 'udebug'
INCLUDE 'uio'
INCLUDE 'udatas'
INCLUDE 'hclcommon/hwords'
INCLUDE 'hclcommon/hword2'
INCLUDE 'hclcommon/hindx'
INCLUDE 'hclcommon/hunits'
C
DIMENSION KBUF(*)
DIMENSION IWORK(LWORK)
DIMENSION NONAME(2),NOTNAM(2),INDBUF(4)
DIMENSION IFPRCP(2)
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/ofs/src/db_hclrw/RCS/hpoptg.f,v $
. $', '
.$Id: hpoptg.f,v 1.2 1998/07/06 11:33:46 page Exp $
. $' /
C ===================================================================
C
C
DATA IFPRCP/4HFUTP,4HRECP/
C
IF (IHCLTR.GT.0) WRITE (IOGDB,140)
C
CALL UMEMOV (KBUF(4),NONAME,2)
NOPASS=KBUF(6)
IF (NOPASS.EQ.IBLNK) NOPASS=LNONE
NONUM=KBUF(2)
C
CALL ULINE (LP,2)
WRITE (LP,150)
CALL ULINE (LP,2)
WRITE (LP,160) NONAME,NOPASS,NONUM
C
J=0
C
10 NOWRDS=KBUF(7+J)
IF (NOWRDS.EQ.0) GO TO 120
IF (NOWRDS.GT.0) GO TO 20
IREC=HINDEX(2,4)-NOWRDS-1
IF (IREC.LT.3005.OR.IREC.GT.4004) GO TO 110
CALL UREADT (KINDXL,IREC,INDBUF,ISTAT)
IF (ISTAT.NE.0) GO TO 110
CALL UMEMOV (INDBUF,NOTNAM,2)
CALL ULINE (LP,2)
WRITE (LP,170) LINCLD,NOTNAM
J=J+1
GO TO 100
C
C WRITE THE TECHNIQUE
20 NKIND=KBUF(8+J)
IF (NKIND.EQ.0) GO TO 90
C
C GET TECH NAME FROM APPROPRIATE INDEX
ISUB=3
IXUNIT=KINDXL
IF (NKIND.GT.0) GO TO 30
ISUB=7
IXUNIT=KINDXG
NKIND=-NKIND
30 IREC=HINDEX(2,ISUB)+NKIND-1
IF (IREC.LT.HINDEX(2,ISUB).OR.IREC.GT.HINDEX(1,ISUB)) GO TO 110
CALL UREADT (IXUNIT,IREC,INDBUF,ISTAT)
IF (ISTAT.NE.0) GO TO 110
CALL UMEMOV (INDBUF,NOTNAM,2)
C
C SET VALUE OF GROUP IDENTIFIER IF THERE ARE IDS
IDFLAG=0
IF (KBUF(10+J).NE.0) IDFLAG=1
C
C SET DEFAULT VALUE OF TECHNIQUE
NOTVAL=KBUF(9+J)
CALL UCMPAR (NOTNAM,IFPRCP,2,IMATCH)
IF (IMATCH.EQ.0) THEN
IF (NOTVAL.EQ.-1) THEN
NOTVAL=LYES
GO TO 40
ENDIF
ENDIF
IF (NOTVAL.LT.0.OR.NOTVAL.GT.1) GO TO 50
IF (NOTVAL.EQ.0) NOTVAL=LNO
IF (NOTVAL.EQ.1) NOTVAL=LYES
40 CALL ULINE (LP,2)
WRITE (LP,180) NOTNAM,NOTVAL
GO TO 60
50 CALL ULINE (LP,2)
WRITE (LP,190) NOTNAM,NOTVAL
C
C WRITE ANY IDENTIFIERS
60 IF (IDFLAG.EQ.0) GO TO 70
CALL HPRIDS (KBUF(10+J),IPOINT,1)
IPOINT=IPOINT+9+J
GO TO 80
C
70 IPOINT=11+J
C
C WRITE ANY ARGUMENTS
80 NONARS=KBUF(IPOINT)
J=J+NOWRDS+1
IF (NONARS.EQ.0) GO TO 100
ITYPE=3
IF (IXUNIT.EQ.KINDXG) ITYPE=-3
CALL HPRARS (KBUF(IPOINT),INDBUF(3),ITYPE,IWORK,LWORK)
GO TO 100
C
C WRITE ANY MODS
90 CALL HPRMOD (KBUF(9+J))
C
J=J+NOWRDS+1
C
100 GO TO 10
C
110 CALL ULINE (LP,2)
WRITE (LP,200) IREC
GO TO 130
C
120 IF (IHCLDB.GT.0) WRITE (IOGDB,210)
C
130 RETURN
C
C-----------------------------------------------------------------------
C
140 FORMAT (' ENTER HPOPTG')
150 FORMAT ('0',132('-'))
160 FORMAT ('0',
* 'NAMED OPTION = ',2A4,3X,
* 'PASSWORD = ',A4,3X,
* 'INTERNAL NAMED OPTION NUMBER = ',I4)
170 FORMAT ('0',13X,4A4)
180 FORMAT ('0',13X,'TECHNIQUE = ',2A4,' VALUE = ',A4)
190 FORMAT ('0',13X,'TECHNIQUE = ',2A4,' VALUE = ',I7)
200 FORMAT ('0**ERROR** IN HPOPTG - SYSTEM ERROR. IREC=',I6)
210 FORMAT (' EXIT HPOPTG')
C
END
|
#include "preproc.h"
c ******************************************************************
c * MCCCS - Towhee: A Monte Carlo molecular simulation program *
c * Copyright (C) 2005-2014 Marcus G. Martin *
c * see the file license.gpl for the full license information *
c * *
c * This program is free software; you can redistribute it and/or *
c * modify it under the terms of the GNU General Public License *
c * as published by the Free Software Foundation; either version 2 *
c * of the License, or (at your option) any later version. *
c * *
c * This program is distributed in the hope that it will be useful,*
c * but WITHOUT ANY WARRANTY; without even the implied warranty of *
c * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
c * GNU General Public License for more details. *
c * *
c * You should have received a copy of the GNU General Public *
c * License along with this program; if not, write to the Free *
c * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,*
c * MA 02111-1307, USA. *
c ******************************************************************
subroutine twh_fftele1987(lfailure,ntypes,nbondtypes,nangletypes
& ,nbitypes)
c ******************************************************************
c * sets up all of the force field parameters for the tele1987 *
c * forcefield *
c * *
c * originally written 02-09-2005 by M.G. Martin *
c * last modified 07-21-2014 by M.G. Martin *
c ******************************************************************
implicit none
#define FUNCTION_GETNBTYPE
#include "functions.h"
c --- variables passed to/from the subroutine
logical lfailure
integer ntypes,nbondtypes,nangletypes,nbitypes
c --- local variables
integer ii,type
character*(FFNAMELEN) ffname
integer nvslocal,nbslocal
character*(FFNAMELEN) vnlocal
dimension vnlocal(MAXSAMEV,MAXVNAME)
character*(FFNAMELEN) bnlocal
dimension bnlocal(MAXSAMEB,MAXBNAME)
double precision vclocal
dimension vclocal(MINVIBCOEFF:MAXVIBCOEFF)
double precision bclocal
dimension bclocal(MINBENDCOEFF:MAXBENDCOEFF)
double precision nbclocal
dimension nbclocal(MINNBCOEFF:MAXNBCOEFF)
double precision masslocal
character*2 elelocal
character*5 bplocal
character*(FFNAMELEN) nbnlocal,canlocal,cbnlocal,ctnlocal
double precision qbivlocal
character*(FFNAMELEN) qbinlocal
dimension qbinlocal(2)
ffname = 'Tele1987'
call twh_classical_potential(GLB_SET,'Lennard-Jones')
call twh_classical_mixrule(GLB_SET,'LB or Geometric')
type = 0
c reference
c O. Teleman; B. Jonsson; S. Engstrom;
c "A molecular dynamics simulation of a water model with
c intramolecular degrees of freedom", Mol. Phys. 60 193-203 (1987)
c (O) oxygen
type = type + 1
ii = twh_getnbtype(type,type)
nbclocal(1) = 3.166d0
nbclocal(2) = (0.65017)*CON_KJTOK
nbclocal(3) = 0.0d0
nbclocal(4) = 0.0d0
masslocal = 15.999d0
elelocal = ' O'
bplocal = 'sp3'
call twh_set_nbcoeff(ii,nbclocal)
call twh_mass(GLB_SET,type,masslocal)
call twh_elementname(GLB_SET,type,elelocal)
call twh_bondpatt(GLB_SET,type,bplocal)
call twh_nbff(GLB_SET,type,ffname)
nbnlocal = 'O'
cbnlocal = nbnlocal
canlocal = nbnlocal
ctnlocal = nbnlocal
call twh_set_names(type,nbnlocal,cbnlocal,canlocal,ctnlocal)
c (H) hydrogen
type = type + 1
ii = twh_getnbtype(type,type)
nbclocal(1) = 0.0d0
nbclocal(2) = 0.0d0
nbclocal(3) = 0.0d0
nbclocal(4) = 0.0d0
masslocal = 1.0079d0
elelocal = ' H'
bplocal = 's'
call twh_set_nbcoeff(ii,nbclocal)
call twh_mass(GLB_SET,type,masslocal)
call twh_elementname(GLB_SET,type,elelocal)
call twh_bondpatt(GLB_SET,type,bplocal)
call twh_nbff(GLB_SET,type,ffname)
nbnlocal ='H'
cbnlocal = nbnlocal
canlocal = nbnlocal
ctnlocal = nbnlocal
call twh_set_names(type,nbnlocal,cbnlocal,canlocal,ctnlocal)
ntypes = type
call twh_ffcheck(lfailure,0,type)
if ( lfailure ) return
c ******************************************************************
c * harmonic bond length *
c ******************************************************************
type = type + 1
call twh_vibstyle(GLB_SET,type,BOND_STYLE_HARMONIC)
vclocal(0) = 1.0d0
vclocal(1) = (4637.0d0)*(0.5d0)*CON_KJTOK
call twh_set_vibcoeffs(type,vclocal)
call twh_vibff(GLB_SET,type,ffname)
nvslocal = 1
vnlocal(1,1) = 'O'
vnlocal(1,2) = 'H'
call twh_set_vibnames(type,nvslocal,vnlocal)
nbondtypes = type
call twh_ffcheck(lfailure,1,type)
if ( lfailure ) return
c ******************************************************************
c * harmonic angles *
c ******************************************************************
type = type + 1
call twh_anglestyle(GLB_SET,type,ANG_STYLE_HARMONIC)
bclocal(0) = 109.47d0
bclocal(1) = (383.0d0)*(0.5d0)*CON_KJTOK
call twh_set_bencoeff(type,bclocal)
call twh_bendff(GLB_SET,type,ffname)
nbslocal = 1
bnlocal(1,1) = 'H'
bnlocal(1,2) = 'O'
bnlocal(1,3) = 'H'
call twh_set_bendnames(type,nbslocal,bnlocal)
nangletypes = type
call twh_ffcheck(lfailure,2,type)
if ( lfailure ) return
c ******************************************************************
c * bond increments *
c ******************************************************************
type = type + 1
call twh_qbiff(GLB_SET,type,ffname)
qbivlocal = 0.41d0
call twh_qbivalue(GLB_SET,type,qbivlocal)
c H - O in water
qbinlocal(1) = 'H'
qbinlocal(2) = 'O'
call twh_set_qbinames(type,qbinlocal)
nbitypes = type
call twh_ffcheck(lfailure,6,type)
if ( lfailure ) return
return
end
|
subroutine OpenMe(input)
integer nmax, u
character*7,input
parameter (nmax=30, u=20)
real x(nmax), y(nmax)
open (u, FILE=input, STATUS='OLD')
read(u,*) n
if (n.GT.nmax) then
write(*,*) 'Error: n = ', n, 'is larger than nmax =', nmax
goto 9999
endif
do 10 i= 1, n
read(u,100) x(i), y(i)
10 enddo
100 format (3(F10.4))
close (u)
9999 stop
end
PROGRAM ReadingStuff
integer x(), y()
call OpenMe('dat.dat')
PRINT*,integer(x(1),x(2),x(3))
END PROGRAM |
function tpqcd(rxy)
implicit double precision(a-y)
integer i,itot
integer ibt,iphi,nbt,nphi,ik,nk
include 'ion.f'
include 'pi.f'
include 'rho0.f'
itot=10000
rzmax=5d0*rzg
hz=rzmax/dble(itot)
nk=200
nbt=200
nphi=20
b0=2d0
rzmax=10d0*dsqrt(b0)
tbtmin=b0*dexp(-rzmax**2/b0)
tbtmax=b0
htbt=(tbtmax-tbtmin)/dble(nbt)
c$$$ hbt=rzmax/dble(nbt)
c$$$ hphi=2d0*pi/dble(nphi)
c$$$
c$$$ sum=0d0
c$$$ sumn=0d0
c$$$
c$$$ ktmax=2d0
c$$$ hk=ktmax/dble(nk)
c$$$
c$$$ do ibt=1,nbt
c$$$ do iphi=1,nphi
c$$$
c$$$ phi=hphi*(dble(iphi)-0.5d0)
c$$$ bt=hbt*(dble(ibt)-0.5d0)
c$$$
c$$$ btx=bt*dcos(phi)
c$$$ bty=bt*dsin(phi)
c$$$
c$$$ btdif=(rxy-btx)**2+bty**2
c$$$
c$$$ wt=rhoxyint(1,dsqrt(btdif))+rhoxyint(2,dsqrt(btdif))
c$$$ wt=wt*dexp(-bt**2/b0/4d0)
c$$$ wt=wt/(4d0*pi*b0)
c$$$ wt=wt*bt*hbt*hphi
c$$$
c$$$ sum=sum+wt
c$$$
c$$$ enddo
c$$$ enddo
c$$$
c$$$ tpqcd=sum
tpqcd=rhoxyint(1,rxy)+rhoxyint(2,rxy)
return
end
|
/* newlon.f
* MODULE
Название Программного Модуля
* DESCRIPTION
Назначение программы, описание процедур и функций
* RUN
Способ вызова программы, описание параметров, примеры вызова
* CALLER
Список процедур, вызывающих этот файл
* SCRIPT
Список скриптов, вызывающих этот файл
* INHERIT
Список вызываемых процедур
* MENU
Перечень пунктов Меню Прагмы
* AUTHOR
31/12/99 pragma
* CHANGES
*/
/* newlon.f
*/
form vvgl colon 20 label " AIZD G/G# " gl.des no-label colon 35 skip
lon.lon colon 20 label " AIZD# "
lon.grp colon 47 label " GRP " skip
lon.cif colon 20 label " KIF# " cif.sname no-label colon 35 skip
lon.loncat colon 20 label " KATEGOR. "
loncat.des no-label colon 35 skip
lon.opnamt colon 20 label " SUMMA "
lon.lcr colon 47 label " AKR# " skip
lon.rdt colon 20 label " REG-DAT. " " --- " at 32
lon.duedt colon 47 label " MKS-DAT."
validate(lon.duedt gt lon.rdt,"K¶®D. IEVЁ№AN")
vterm colon 67 label " TERM " skip
lon.base colon 20 label " PRC-LIKM " lon.prem colon 35 no-label skip
vvint colon 20 label " PRC-№ODIEN"
vint colon 53 label " PRC-MЁNBEIG" skip
lon.ptype colon 20 label " MAKS…JM "
help "1.SKDN 2.OFCL-PRB 3.PNC UZ KONT 4.DFB 5.P…RBD(SKDN-PNT) 6.IOF"
s-gl colon 20 label " MAKS…JM G/G# " sgldes colon 35 no-label skip
s-acc colon 20 label " KONT# "
lon.cam[3] colon 47 label " PAKALP MAKS " format "$zz,zz9.99" skip
lon.apr colon 20 label " APSTIPRN "
lon.gua colon 47 label " NODRO№. " skip
s-jh colon 20 label " KONTROL NR. " skip
with width 80 row 3 side-label centered title " LOAN ISSUE "
overlay frame lon.
|
c$Id:$
subroutine dlfac( au, al, jp, ilim )
c * * F E A P * * A Finite Element Analysis Program
c.... Copyright (c) 1984-2014: Regents of the University of California
c All rights reserved
c-----[--.----+----.----+----.-----------------------------------------]
c Modification log Date (dd/mm/year)
c Original version 01/11/2006
c-----[--.----+----.----+----.-----------------------------------------]
c Purpose: Reduce a single column using compact elimination
c Inputs:
c au(*) - Unreduced column in upper part of A
c al(*) - Unreduced row in lower part of A
c jp(*) - Pointer array to end of row/columns
c ilim - Length of reductions
c Outputs:
c au(*) - Reduced column in upper part of A
c al(*) - Reduced row in lower part of A
c-----[--.----+----.----+----.-----------------------------------------]
implicit none
integer i, ic, ilim, jp(*)
real*8 au(*), al(*), dot
save
do i = 2,ilim
ic = min(jp(i)-jp(i-1), i-1)
au(i) = au(i) - dot(al(jp(i)+1-ic),au(i-ic),ic)
end do ! i
end
|
C$Procedure PODDGD ( Pod, duplicate group, double precision )
SUBROUTINE PODDGD ( POD )
IMPLICIT NONE
C$ Abstract
C
C Begin a new group within a pod, containing the same elements
C as the active group.
C
C$ Disclaimer
C
C THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
C CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
C GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
C ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
C PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
C TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
C WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
C PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
C SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
C SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
C
C IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
C BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
C LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
C INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
C REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
C REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
C
C RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
C THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
C CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
C ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
C
C$ Required_Reading
C
C PODS
C
C$ Keywords
C
C ARRAYS
C CELLS
C PODS
C
C$ Declarations
INTEGER LBCELL
PARAMETER ( LBCELL = -5 )
DOUBLE PRECISION POD ( LBCELL : * )
C$ Brief_I/O
C
C Variable I/O Description
C -------- --- --------------------------------------------------
C POD I,O Pod.
C
C$ Detailed_Input
C
C POD on input, is an arbitrary pod.
C
C$ Detailed_Output
C
C POD on output, is the same pod, in which the active
C group has been sealed, and a new active group
C (containing the same elements as the previous group)
C begun.
C
C$ Parameters
C
C None.
C
C$ Exceptions
C
C 1) If POD does not have sufficient free space to create
C the new group, the pod is not changed, and the error
C SPICE(TOOMANYPEAS) is signalled. (If the active group
C contains no elements, there must be sufficient free
C space for the new group to contain at least one element.)
C
C$ Files
C
C None.
C
C$ Particulars
C
C There are two ways to create a new group within a pod.
C PODBG (begin group) seals the current contents of the pod,
C and creates a new active group containing no elements.
C PODDG (duplicate group) also seals the current contents
C of the pod, but places a copy of the previous active
C group into the new active group.
C
C In both cases, the active group and all previous groups are
C unavailable so long as the new group exists.
C
C The active group of a pod may be removed by any of the
C following routines: PODEG (end group), PODCG (close group),
C or PODRG (replace group).
C
C$ Examples
C
C Let the active group of POD be located in elements 21
C through 40. Then following the call
C
C CALL PODBGD ( POD )
C
C the active group is located in elements 42 through 41.
C In other words, element 41 has been appropriated by the
C pod itself, and the active group is empty.
C
C However, following the call
C
C CALL PODDG ( POD )
C
C the active group is located in elements 42 through 61,
C and contains the same elements as the previous active
C group.
C
C$ Restrictions
C
C 1) In any pod, only the active group should be accessed,
C and its location should always be determined by PODBE
C or PODON. Never assume that the active group begins
C at POD(1).
C
C$ Literature_References
C
C None.
C
C$ Author_and_Institution
C
C W.L. Taber (JPL)
C I.M. Underwood (JPL)
C
C$ Version
C
C- Beta Version 1.0.0, 15-JUL-1989 (WLT) (IMU)
C
C
C-&
C
C SPICELIB functions
C
LOGICAL RETURN
INTEGER CARDD
INTEGER SIZED
C
C Local parameters
C
INTEGER CRDLOC
PARAMETER ( CRDLOC = 0 )
INTEGER GRPOFF
PARAMETER ( GRPOFF = -2 )
C
C Local variables
C
INTEGER HAVE
INTEGER NEED
INTEGER NUMBER
INTEGER OFFSET
C
C Standard SPICE error handling.
C
IF ( RETURN () ) THEN
RETURN
ELSE
CALL CHKIN ( 'PODDGD' )
END IF
C
C How many spaces are needed? One for bookkeeping, and one for
C each of the elements in the active group. (If there are no
C elements, then one for future use.)
C
CALL PODOND ( POD, OFFSET, NUMBER )
HAVE = SIZED ( POD )
NEED = CARDD ( POD ) + 1 + MAX ( 1, NUMBER )
IF ( HAVE .LT. NEED ) THEN
CALL SIGERR ( 'SPICE(TOOMANYPEAS)' )
CALL CHKOUT ( 'PODDGD' )
RETURN
END IF
C
C Go ahead and create a new (empty) group.
C
CALL PODBGD ( POD )
C
C Append the old group (still in the same place) to the pod.
C (Somewhat incestuous, but practical.) Kids, don't try this
C at home: you aren't supposed to know that existing groups
C arent't changed by the addition of new ones.
C
CALL PODAED ( POD(OFFSET+1), NUMBER, POD )
CALL CHKOUT ( 'PODDGD' )
RETURN
END
|
C MODULE LOOKNSET
C-----------------------------------------------------------------------
C PROGRAM LOOKNSET CAN BE USED TO PRINT AND/OR CHANGE RECORDS IN A
C DAIO DATASET.
C-----------------------------------------------------------------------
C
SUBROUTINE LOOKNSET
C
CHARACTER*4 XOPT,XPRIN
CHARACTER*1 XBLNK,XYES,XANS
INTEGER*4 I4BUF(8190)
INTEGER*2 I2BUF(16380)
LOGICAL*1 L1WORD
LOGICAL*1 L1BUF(32760)
LOGICAL*1 DSN(44)
REAL R4BUF(8190),R2BUF(8190),R1BUF(8190)
EQUIVALENCE (I4BUF(1),R4BUF(1)),(I2BUF(1),R2BUF(1)),
. (L1BUF(1),R1BUF(1))
C
CHARACTER*32 FILNAM
CHARACTER*128 NEWN
INTEGER LRECLX,LBLKSX,IC,JU
CHARACTER*4 KEYX
C
INCLUDE 'uiox'
C
C ================================= RCS keyword statements ==========
CHARACTER*68 RCSKW1,RCSKW2
DATA RCSKW1,RCSKW2 / '
.$Source: /fs/hseb/ob72/rfc/util/src/looknset/RCS/looknset.f,v $
. $', '
.$Id: looknset.f,v 1.4 2004/07/23 14:36:38 dsa Exp $
. $' /
C ===================================================================
C
DATA XPRIN,XBLNK,XYES / 'PRIN', ' ', 'Y' /
C
C
C Subroutine ARGVER outputs the version/date info and exits the
C program if the first command line argument is "-version"
C
CALL ARGVER()
C
LP2=ICDPUN
IF( LP2 .EQ. LP ) LP2 = 0
LWORD1=0
LWORD2=0
INDCLB=0
NPRTRK=0
C
C PRINT PAGE HEADER
CALL USETO1 ('NOPAGNUM',IERR)
CALL UPAGE (LP)
CALL USETO1 ('NOPAGHDR',IERR)
C
30 CALL UPFNIN(ICD,LP,FILNAM,JU,KEYX)
IF( FILNAM.EQ.'QUIT' .OR. FILNAM.EQ.'quit' ) GO TO 330
IF( FILNAM.EQ.'END' .OR. FILNAM.EQ.'end' ) GO TO 330
IF( FILNAM.EQ.'Q' .OR. FILNAM.EQ.'q' ) GO TO 330
CALL UPFNCU(KEYX,FILNAM,JU,NEWN,NUNIT,LRECLX,LBLKSX,IC)
IF( IC .NE. 0 ) GO TO 30
IF( NEWN.EQ.' ' .AND. NUNIT.LE.0 ) GO TO 30
CALL KKTRIM(NEWN,IBEG,IEND)
WRITE(LP,32) NEWN(IBEG:IEND),NUNIT
32 FORMAT(' File to be accessed is: ',A,' on unit:',I3/)
C
CALL UDOPEN(NUNIT,6,NEWN,LRECL,ISTAT)
IF( ISTAT .NE. 0) THEN
WRITE(LP,'('' WARNING, Cannot open desired file'')')
GO TO 30
ENDIF
LRECL = 4*LRECL
C
C READ WORD LENGTH
60 WRITE (LP,420)
READ (ICD,*) ILENTH
IF (ILENTH .EQ. -1) GOTO 30
IF (ILENTH .EQ. -2) THEN
WRITE(LP,72)
72 FORMAT(/' On the PRIME, need to re-execute LOOKNSET with new',
$ ' file level.'/)
GO TO 60
ENDIF
IF (ILENTH .EQ. -3) THEN
WRITE (LP,470)
READ (ICD,*) LWORD1,LWORD2
WRITE (LP,480) LWORD1,LWORD2
GO TO 60
ENDIF
IF (ILENTH .EQ. -4) THEN
WRITE (LP,490)
INDCLB=1
GO TO 60
ENDIF
IF (ILENTH .EQ. -5) THEN
WRITE (LP,500)
LWORD1=0
LWORD2=0
INDCLB=0
GO TO 60
ENDIF
IF (ILENTH .EQ. -6) THEN
WRITE (LP,380) FILNAM,NUNIT
380 FORMAT(' File to be accessed is: ',A,' on unit:',I4/)
WRITE (LP,390) NRECS
GO TO 60
ENDIF
IF (ILENTH.EQ.0) GO TO 330
IF (ILENTH.EQ.4) NWORDS=LRECL/4
IF (ILENTH.EQ.2) NWORDS=LRECL/2
IF (ILENTH.EQ.1) NWORDS=LRECL
C
C READ SIZE FOR PRINT FORMAT
WRITE (LP,530)
READ (ICD,*) ISIZE
C
C READ OPTION TO PROCESS AS REAL OR INTEGER
140 WRITE (LP,610)
READ (ICD,*) IOPT
IF (IOPT.LT.1.OR.IOPT.GT.5) GO TO 140
C
C READ PRINT OPTION
150 WRITE (LP,620)
WRITE (LP,630)
READ (ICD,'(A)') XOPT
C
C READ RECORD NUMBER
160 WRITE (LP,560)
READ (ICD,*) NREC
IF (NREC.EQ.0) GO TO 60
IF (NREC .EQ. -1) THEN
CALL UCLOSL ()
WRITE (LP,510) NUNIT
GO TO 160
ENDIF
IF (NREC.EQ.-2) GO TO 150
C
C CHECK NWSRFS CALIBRATION DATASET OPTION
IF (INDCLB .NE. 0) THEN
C
C CALCULATE BLOCK NUMBER FOR RECORD SPECIFIED
NPRREC=31
NPACK=LBLOCK/4/NPRREC
NBLK=(NREC+(NPACK-1))/NPACK
C
C CALCULATE FIRST AND LAST WORDS IN RECORD
LWORD1=(NREC-((NBLK-1)*NPACK)-1)*NPRREC+1
LWORD2=LWORD1+(NPRREC-1)
NREC=NBLK
IF (NREC.EQ.0) NREC=1
WRITE (LP,520) NREC
WRITE (LP,480) LWORD1,LWORD2
ENDIF
C
IF (ILENTH.EQ.4) CALL UREADT (NUNIT,NREC,I4BUF,IERR)
IF (ILENTH.EQ.2) CALL UREADT (NUNIT,NREC,I2BUF,IERR)
IF (ILENTH.EQ.1) CALL UREADT (NUNIT,NREC,L1BUF,IERR)
IF (IERR .NE. 0) THEN
WRITE (LP,580) IERR
IF (NPRTRK .NE. 0) THEN
ITRK=(NREC/(LBLOCK/LRECL*NPRTRK))+1
WRITE (LP,590) ITRK,DSN
ENDIF
WRITE (LP,600)
READ (ICD,'(A)') XANS
IF (XANS.EQ.XBLNK) GO TO 160
IF (XANS.EQ.XYES) GO TO 220
GO TO 160
ENDIF
WRITE (LP,570) NREC,NUNIT
C
C CHECK PRINT OPTION
220 IF (XOPT .EQ. XPRIN) THEN
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C PRINT VALUES IN RECORD
C
C READ FIRST AND LAST WORD TO BE PRINTED
230 WRITE (LP,660)
READ (ICD,*) NWORD1,NWORD2
IF (NWORD1.EQ.0) GO TO 160
NWORD1=1
NWORD2=NWORDS
IF (LWORD1.GT.0) NWORD1=LWORD1
IF (LWORD2.GT.0) NWORD2=LWORD2
IF (NWORD1.LE.NWORD2) GO TO 240
WRITE (LP,640) NWORD1,NWORD2,NWORD2
NWORD1=NWORD2
240 IF (NWORD2.LE.NWORDS) GO TO 250
WRITE (LP,650) NWORD2,NWORDS,NWORDS
NWORD2=NWORDS
250 CALL PRTVAL (LP,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
IF (LP2.GT.0)
* CALL PRTVAL (LP2,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
GO TO 230
ENDIF
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
C CHANGE VALUES IN RECORD
ICHNGE=0
270 WRITE (LP,670)
IF ((IOPT.EQ.1.OR.IOPT.EQ.2).AND.ILENTH.NE.1)
* READ (ICD,*) IPOS,IWORD
IF ((IOPT.EQ.1.OR.IOPT.EQ.2).AND.ILENTH.EQ.1)
* READ (ICD,*) IPOS,L1WORD
IF (IOPT.EQ.3.OR.IOPT.EQ.4) READ (ICD,*) IPOS,WORD
IF (IPOS.EQ.0) GO TO 300
IF (IPOS.GT.0) GO TO 280
NWORD1=1
NWORD2=NWORDS
IF (LWORD1.GT.0) NWORD1=LWORD1
IF (LWORD2.GT.0) NWORD2=LWORD2
CALL PRTVAL (LP,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
IF (LP2.GT.0)
* CALL PRTVAL (LP2,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
GO TO 270
280 IF (IPOS.GE.1.AND.IPOS.LE.NWORDS) GO TO 290
WRITE (LP,680) LRECL
GO TO 270
290 LPOS=IPOS+LWORD1
IF (LWORD1.GT.0) LPOS=LPOS-1
IF ((IOPT.EQ.1.OR.IOPT.EQ.2).AND.ILENTH.EQ.4)
* I4BUF(LPOS)=IWORD
IF ((IOPT.EQ.1.OR.IOPT.EQ.2).AND.ILENTH.EQ.2)
* I2BUF(LPOS)=IWORD
IF ((IOPT.EQ.1.OR.IOPT.EQ.2).AND.ILENTH.EQ.1)
* L1BUF(LPOS)=L1WORD
IF ((IOPT.EQ.3.OR.IOPT.EQ.4).AND.ILENTH.EQ.4)
* CALL PUTVAL (WORD,I4BUF(LPOS))
IF ((IOPT.EQ.3.OR.IOPT.EQ.4).AND.ILENTH.EQ.2)
* CALL PUTVAL (WORD,I2BUF(LPOS))
IF ((IOPT.EQ.3.OR.IOPT.EQ.4).AND.ILENTH.EQ.1)
* CALL PUTVAL (WORD,L1BUF(LPOS))
ICHNGE=1
GO TO 270
C
C CHECK IF OKAY TO WRITE RECORD
300 WRITE (LP,690)
READ (ICD,*) IANS
C
IF (IANS .LT. 0) THEN
NWORD1=1
NWORD2=NWORDS
IF (LWORD1.GT.0) NWORD1=LWORD1
IF (LWORD2.GT.0) NWORD2=LWORD2
CALL PRTVAL (LP,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
IF (LP2.GT.0)
* CALL PRTVAL (LP2,NREC,IOPT,ISIZE,ILENTH,I4BUF,I2BUF,L1BUF,
* NWORD1,NWORD2,R4BUF,R2BUF,R1BUF)
GO TO 300
ELSEIF (IANS .EQ. 1) THEN
IF (ILENTH.EQ.4) CALL UWRITT (NUNIT,NREC,I4BUF,IERR)
IF (ILENTH.EQ.2) CALL UWRITT (NUNIT,NREC,I2BUF,IERR)
IF (ILENTH.EQ.1) CALL UWRITT (NUNIT,NREC,L1BUF,IERR)
IF (IERR.GT.0) WRITE (LP,710) IERR
IF (IERR.EQ.0) WRITE (LP,720) NREC,NUNIT
ELSE
IF (ICHNGE .NE. 0) THEN
WRITE (LP,700)
READ (ICD,*) IANS
IF (IANS .NE. 0) THEN
IF (ILENTH.EQ.4) CALL UWRITT (NUNIT,NREC,I4BUF,IERR)
IF (ILENTH.EQ.2) CALL UWRITT (NUNIT,NREC,I2BUF,IERR)
IF (ILENTH.EQ.1) CALL UWRITT (NUNIT,NREC,L1BUF,IERR)
IF (IERR.GT.0) WRITE (LP,710) IERR
IF (IERR.EQ.0) WRITE (LP,720) NREC,NUNIT
ENDIF
ENDIF
ENDIF
GO TO 160
C
C CLOSE UNIT
330 CALL UCLOSL
C
WRITE (LP,730)
IF (LP2.GT.0) WRITE (LP2,730)
C
IF( ICD .NE. 1 ) CALL UPCLOS(ICD,' ',ISTAT)
IF( LP .NE. 1 ) CALL UPCLOS(LP,' ',ISTAT)
IF( ICDPUN .NE. 1 ) CALL UPCLOS(ICDPUN,' ',ISTAT)
C
STOP
C
C- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
390 FORMAT (' *** NOTE - NUMBER OF LOGICAL RECORDS IN DATASET IS ',
* I6,'.')
420 FORMAT (' ENTER 0 TO END EXECUTION,' /
* 7X,' 1 FOR I*1, ',
* '2 FOR I*2, ',
* '4 FOR I*4 RECORDS,' /
* 7X,'-1 FOR NEW INPUT UNIT,' /
* 7X,'-2 FOR NEW DATASET ON SAME VOLUME,' /
* 7X,'-3 TO SPECIFY DEFAULT WORD RANGE,' /
* 7X,'-4 IF PROCESSING NWSRFS CALIBRATION DATASET,' /
* 7X,'-5 TO RESET OPTIONS, OR' /
* 7X,'-6 TO PRINT DATASET NAME AND ATTRIBUTES')
470 FORMAT (' ENTER NUMBER OF FIRST AND LAST WORDS TO BE PRINTED')
480 FORMAT (' *** NOTE - DEFAULT WORD RANGE FOR PRINTING IS ',I5,
* ' THRU ',I5,'.')
490 FORMAT (' *** NOTE - NWSRFS CALIBRATION DATASET OPTION SET.')
500 FORMAT (' *** NOTE - NWSRFS CALIBRATION DATASET AND ',
* 'FIRST AND LAST WORDS TO BE PROCESSED OPTIONS RESET.')
510 FORMAT (' UNIT ',I3,' SUCCESSFULLY CLOSED')
520 FORMAT (' *** NOTE - RECORD NUMBER SET TO ',I6,'.')
530 FORMAT (' ENTER 1 FOR PRINT IN I5 OR F5, 2 FOR I10 OR F10')
560 FORMAT (' ENTER 0 TO END,' /
* 7X,'-1 TO CLOSE FILE,' /
* 7X,'-2 TO CHANGE PRINT OPTION, OR' /
* 7X,'RECORD NUMBER')
570 FORMAT (' RECORD ',I6,' SUCCESSFULLY READ FROM UNIT ',I3)
580 FORMAT ('0*** ERROR - DAIO READ ERROR : IERR=',I6)
590 FORMAT ('0*** NOTE - DAIO READ ERROR OCCURRED IN TRACK ',I4,
* ' OF DATASET ',44A1)
600 FORMAT (' OKAY TO CONTINUE (<RETURN> FOR NO)')
610 FORMAT (' ENTER 1 FOR INTEGER,' /
* 7X,'2 FOR INTEGER OR CHARACTER ',
* '(ENTER CHARACTER DATA IN QUOTES),' /
* 7X,'3 FOR REAL, OR' /
* 7X,'4 FOR REAL OR CHARACTER ',
* '(ENTER CHARACTER DATA IN QUOTES)' /
* 7X,'5 FOR INTEGER AND REAL')
620 FORMAT (' ENTER ''PRINT'' TO ONLY PRINT RECORDS ',
* 'OR <RETURN> TO CHANGE RECORDS')
630 FORMAT (' ?')
640 FORMAT ('0*** WARNING - FIRST WORD TO BE PROCESSED (',I4,
* ') EXCEEDS LAST WORD TO BE PROCESSED (',I4,
* '). FIRST WORD SET TO ',I4,'.')
650 FORMAT ('0*** WARNING - LAST WORD TO BE PROCESSED (',I4,
* ') EXCEEDS MAXIMUM WORDS IN RECORD (',I4,
* '). LAST WORD SET TO ',I4,'.')
660 FORMAT (' ENTER FIRST AND LAST WORD POSITION, ',
* '''-1 0'' FOR ALL OR ',
* '''0 0'' TO END PRINTING')
670 FORMAT (' ENTER WORD POSITION AND NEW VALUE, ' /
* 7X,'''-1 0'' TO PRINT OR ' /
* 7X,'''0 0'' TO END CHANGES')
680 FORMAT (' *** ERROR - INVALID WORD POSITION. LRECL IS ',I5,'.')
690 FORMAT (' ENTER 0 FOR NEW RECORD, ' /
* 7X,'-1 TO PRINT, ' /
* 7X,' 1 TO WRITE RECORD OR,' /
* 7X,' 2 FOR SAME RECORD')
700 FORMAT ('0*** WARNING - RECORD WAS CHANGED BUT WAS NOT WRITTEN.' /
* ' ENTER 0 TO CONTINUE OR ' /
* 7X,'1 TO WRITE RECORD')
710 FORMAT ('0*** ERROR - DAIO WRITE ERROR : IERR=',I6)
720 FORMAT (' RECORD ',I6,' SUCCESSFULLY WRITTEN TO UNIT ',I3)
730 FORMAT ('0- PROCESSING COMPLETED -')
C
END
|
ccc generates rho meson invariant mass distribution according to modified BW
subroutine bwalp(mout,jalp)
implicit double precision(a-y)
include 'mres.f'
include 'mpip.f'
include 'gax.f'
include 'pi.f'
ccccc calculate width
width=gax**2*malp**3/64d0/pi
width=0.5d0
ccccc
mminr=mres-10d0*width
mmaxr=mres+10d0*width
almin=datan(-(mres**2-mminr**2)/width/mres)
almax=datan(-(mres**2-mmaxr**2)/width/mres)
norm=almax-almin
rm1=ran2()
al1=almin+(almax-almin)*rm1
mout=dsqrt(dtan(al1)*mres*width+mres**2)
jalp=almax-almin
jalp=jalp*width*mres
jalp=jalp*(1d0+dtan(al1)**2)
cccccc up to this point just change of variables
ccccc
ccccc now BW
jalp=jalp*mout*width/norm
jalp=jalp/((mres**2-mout**2)**2+mout**2*
& width**2)
return
end
|
double complex mom_dec(3,4), hel_dec(3,4), hel_t(1:4), mom_t(1:4)
double complex zero, ne
double complex test_ctm(3,4), test_ctz(3,4),
&test_v(3,4), test_r(3,4)
double precision mt,en,mb,ms,mw, Cf, nc,setalpha, GS
double precision pii,alphas,el, Gw
double precision Qqu,qqd
C parameter(Gw =1.474419561548971d0)
C parameter(el =0.3028619040941380d0)
C parameter(alphaS=0.13d0)
parameter(pii=3.141592653589793d0)
parameter(ne=(0d0,1d0))
parameter(zero=(0d0,0d0))
C parameter(qqu= 0.6666666666666666d0)
C parameter(qqd=-0.3333333333333333d0)
C parameter(CF = 1.3333333333333333d0)
C parameter (nc =3.d0)
integer eve, i_eve, c_eve
common/kinem/ mom_dec, hel_dec, hel_t, mom_t
COMMON /mass_color/mt, mb, Mw,setalpha
common/count/ eve, i_eve,c_eve
common/testus/test_ctm, test_ctz, test_v, test_r
common/parameters/Qqd, Qqu, alphas, el, Gw, CF, nc, GS
|
** Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
** See https://llvm.org/LICENSE.txt for license information.
** SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
* Adjustable arrays and ENTRY statements.
C NONSTANDARD:
C Use of character constants to initialize numeric variable.
parameter(n = 4)
integer rslts(n), expect(n)
character*4 c(3, 2), d(4, 3)
equivalence (c(2, 1), rslts(3)), (d(1, 1), rslts(4))
call sub1(rslts, 100, 10)
call trash
call e1(11, 12, rslts(2))
call sub2(c, 3, 2)
call trash
call e2(d, 3, 4)
c --- check results:
data expect / 10, 11, 'abcd', 'x ' /
call check(rslts, expect, n)
end
ccccccccccccccccccccccccccccccccc
subroutine sub1(a, n, m)
entry e1(m, n, a)
integer a(m:n)
save i
data i / 10 /
a(i) = i
i = i + 1
end
ccccccccccccccccccccccccc
subroutine sub2(a, n, m)
character*(*) a(n, m)
a(n-1, m-1) = 'abcdjksdhfkasdjfalfd'
return
entry e2(a, m, n)
a(1, 1) = 'x'
end
subroutine trash()
integer stk(20)
do 10 i = 1, 20
stk(i) = -100
10 continue
end
|
SUBROUTINE IHEXSD (TYPE,SHP,DSHP,JACOB,DETJ,EID,XI,ETA,ZETA,BXYZ)
C
C DOUBLE PRECISION VERSION
C
C ISOPARAMETRIC UTILITY ROUTINE. THIS ROUTINE WILL COMPUTE
C VALUES OF THE SHAPE FUNCTIONS, THEIR DERIVATIVES WITH RESPECT TO
C XI,ETA, AND ZETA, THE JACOBIAN MATRIX INVERSE, AND ITS DETERMINANT
C
C TYPE = 1 IHEX1
C TYPE = 2 IHEX2
C TYPE = 3 IHEX3
C
C SHP = VALUES OF SHAPE FUNCTIONS
C DSHP = DERIVATIVES OF SHAPE FUNCTIONS W.R.T. XI, ETA, ZETA
C JACOB = JACOBIAN MATRIX INVERSE
C DETJ = DETERMINANT OF JACOBIAN MATRIX
C XI, ETA, ZETA = ELEMENT COORDINATES AT WHICH THESE COMPUTATIONS
C TAKE PLACE
C BXYZ = BASIC SYSTEM COORDINATES FOR GRID POINTS
C
C LOCAL VARIABLES
C X,Y,Z = CONSTANTS FOR EACH SHAPE FUNCTION
C NGP = NUMBER OF SHAPE FUNCTIONS, ALSO NUMBER OF GRID POINTS
C
INTEGER TYPE ,EID ,OP
REAL BXYZ(3,8)
DOUBLE PRECISION SHP(8) ,DSHP(3,8) ,JACOB(3,3) ,
1 DETJ ,XI ,ETA ,ZETA ,
2 X ,Y ,Z ,QXI ,
3 QETA ,QZETA ,QXYZ ,WORK(3,3)
CHARACTER UFM*23
COMMON /XMSSG / UFM
COMMON /SYSTEM/ SYSBUF ,OP
C
NGP = 12*TYPE - 4
Y =-1.0
Z =-1.0
GO TO (100,200,310), TYPE
C
C LINEAR ELEMENT IHEX1
C
100 DO 110 J = 1,2
IF (J .EQ. 2) Z = 1.0
X =-1.0
Y =-1.0
DO 110 I = 1,4
IF (I .EQ. 3) Y = 1.0
IF (I .EQ. 2) X = 1.0
IF (I .EQ. 4) X =-1.0
K = I + (J-1)*4
QXI = 1.0 + XI*X
QETA = 1.0 + ETA*Y
QZETA = 1.0 + ZETA*Z
SHP(K) = QXI*QETA*QZETA/8.0
DSHP(1,K) = X*QETA*QZETA/8.0
DSHP(2,K) = Y*QXI*QZETA/8.0
DSHP(3,K) = Z*QXI*QETA/8.0
110 CONTINUE
GO TO 430
C
C QUADRATIC ELEMENT IHEX2
C
200 D = 1.0
X = 0.0
DO 300 I = 1,20
C 1 2 3 4 5 6 7 8 9 10
GO TO (220,210,210,230,230,220,220,240,250,210,
1 230,220,250,210,210,230,230,220,220,240), I
210 X = X + D
GO TO 260
220 X = X - D
GO TO 260
230 Y = Y + D
GO TO 260
240 Y = Y - D
GO TO 260
250 Z = Z + 1.0
Y =-1.0
D = 3.0-D
260 IF (X .EQ. 0.0) GO TO 270
IF (Y .EQ. 0.0) GO TO 280
IF (Z .EQ. 0.0) GO TO 290
C
C CORNER POINT
C
QXI = 1.0 + X*XI
QETA = 1.0 + Y*ETA
QZETA = 1.0 + Z*ZETA
QXYZ = X*XI + Y*ETA + Z*ZETA
SHP(I)= QXI*QETA*QZETA*(QXYZ-2.0)/8.0
DSHP(1,I) = X*QETA*QZETA*(X*XI+QXYZ-1.0)/8.0
DSHP(2,I) = Y*QXI*QZETA*(Y*ETA+QXYZ-1.0)/8.0
DSHP(3,I) = Z*QXI*QETA*(Z*ZETA+QXYZ-1.0)/8.0
GO TO 300
C
C MID-EDGE POINT, X=0.0
C
270 QXI = 1.0 - XI**2
QETA = 1.0 + Y*ETA
QZETA = 1.0 + Z*ZETA
SHP(I)= QXI*QETA*QZETA/4.0
DSHP(1,I) =-XI*QETA*QZETA/2.0
DSHP(2,I) = QXI*QZETA*Y/4.0
DSHP(3,I) = QXI*QETA*Z/4.0
GO TO 300
C
C MID-EDGE POINT, Y=0.0
C
280 QXI = 1.0 + X*XI
QETA = 1.0 - ETA**2
QZETA = 1.0 + Z*ZETA
SHP(I)= QETA*QXI*QZETA/4.0
DSHP(1,I) = QETA*QZETA*X/4.0
DSHP(2,I) =-ETA*QZETA*QXI/2.0
DSHP(3,I) = QETA*QXI*Z/4.0
GO TO 300
C
C MID-EDGE POINT, Z=0.0
C
290 QXI = 1.0 + X*XI
QETA = 1.0 + Y*ETA
QZETA = 1.0 - ZETA**2
SHP(I)= QZETA*QXI*QETA/4.0
DSHP(1,I) = QZETA*QETA*X/4.0
DSHP(2,I) = QZETA*QXI*Y/4.0
DSHP(3,I) =-ZETA*QXI*QETA/2.0
300 CONTINUE
GO TO 430
C
C CUBIC ELEMENT IHEX3
C
310 D = 2.0/3.0
X =-1.0/3.0
DO 420 I = 1,32
C 1 2 3 4 5 6 7 8 9 10
GO TO (320,330,330,330,340,340,340,320,320,320,
2 350,350,360,330,340,320,360,330,340,320,
3 360,330,330,330,340,340,340,320,320,320,
4 350,350),I
320 X = X - D
GO TO 370
330 X = X + D
GO TO 370
340 Y = Y + D
GO TO 370
350 Y = Y - D
GO TO 370
360 Y =-1.0
Z = Z + 2.0/3.0
IF (Z .GT. -1.0) D = 2.0
IF (Z .GT. 0.4) D = 2.0/3.0
370 IF (DABS(X) .LT. 0.4) GO TO 390
IF (DABS(Y) .LT. 0.4) GO TO 400
IF (DABS(Z) .LT. 0.4) GO TO 410
C
C CORNER POINT
C
QXI = 1.0 + X*XI
QETA = 1.0 + Y*ETA
QZETA = 1.0 + Z*ZETA
QXYZ = XI**2+ETA**2+ZETA**2 - 19.0/9.0
SHP(I)= 9.0*QXI*QETA*QZETA*QXYZ/64.0
DSHP(1,I) = 9.0*QETA*QZETA*(X*(2.0*XI**2+QXYZ)+2.0*XI)/64.0
DSHP(2,I) = 9.0*QXI*QZETA*(Y*(2.0*ETA**2+QXYZ)+2.0*ETA)/64.0
DSHP(3,I) = 9.0*QXI*QETA*(Z*(2.0*ZETA**2+QXYZ)+2.0*ZETA)/64.0
GO TO 420
C
C MID-EDGE POINT, X = + OR - 1/3
C
390 QXI = 9.0*(1.0-XI**2)*(1.0+9.0*X*XI)/64.0
QETA = 1.0 + Y*ETA
QZETA = 1.0 + Z*ZETA
QXYZ = 9.0*(-2.0*XI+9.0*X-27.0*XI*X*XI)/64.0
SHP(I)= QXI*QETA*QZETA
DSHP(1,I) = QETA*QZETA*QXYZ
DSHP(2,I) = QXI*QZETA*Y
DSHP(3,I) = QXI*QETA*Z
GO TO 420
C
C MID-EDGE POINT Y = + OR - 1/3
C
400 QXI = 1.0 + X*XI
QETA = 9.0*(1.0-ETA**2)*(1.0+9.0*ETA*Y)/64.0
QZETA = 1.0 + Z*ZETA
QXYZ = 9.0*(-2.0*ETA+9.0*Y-27.0*ETA*Y*ETA)/64.0
SHP(I)= QETA*QXI*QZETA
DSHP(1,I) = QETA*QZETA*X
DSHP(2,I) = QXI*QZETA*QXYZ
DSHP(3,I) = QETA*QXI*Z
GO TO 420
C
C MID-EDGE POINTS Z = + OR - 1/3
C
410 QXI = 1.0 + X*XI
QETA = 1.0 + Y*ETA
QZETA = 9.0*(1.0-ZETA**2)*(1.0+9.0*Z*ZETA)/64.0
QXYZ = 9.0*(-2.0*ZETA+9.0*Z-27.0*Z*ZETA**2)/64.0
SHP(I)= QZETA*QXI*QETA
DSHP(1,I) = QZETA*QETA*X
DSHP(2,I) = QZETA*QXI*Y
DSHP(3,I) = QXI*QETA*QXYZ
420 CONTINUE
C
C COMPUTE JACOBIAN MATRIX
C
430 DO 440 I = 1,3
DO 440 J = 1,3
JACOB(I,J) = 0.0
DO 440 K = 1,NGP
JACOB(I,J) = JACOB(I,J) + DSHP(I,K)*DBLE(BXYZ(J,K))
440 CONTINUE
C
C COMPUTE INVERSE AND DETERMINANT OF JACOBIAN MATRIX
C
WORK(1,1) = JACOB(2,2)*JACOB(3,3) - JACOB(2,3)*JACOB(3,2)
WORK(2,1) = JACOB(2,3)*JACOB(3,1) - JACOB(2,1)*JACOB(3,3)
WORK(3,1) = JACOB(2,1)*JACOB(3,2) - JACOB(2,2)*JACOB(3,1)
WORK(1,2) = JACOB(1,3)*JACOB(3,2) - JACOB(1,2)*JACOB(3,3)
WORK(2,2) = JACOB(1,1)*JACOB(3,3) - JACOB(1,3)*JACOB(3,1)
WORK(3,2) = JACOB(1,2)*JACOB(3,1) - JACOB(1,1)*JACOB(3,2)
WORK(1,3) = JACOB(1,2)*JACOB(2,3) - JACOB(1,3)*JACOB(2,2)
WORK(2,3) = JACOB(1,3)*JACOB(2,1) - JACOB(1,1)*JACOB(2,3)
WORK(3,3) = JACOB(1,1)*JACOB(2,2) - JACOB(1,2)*JACOB(2,1)
DETJ = 0.0
DO 450 I = 1,3
DETJ = DETJ + JACOB(I,2)*WORK(2,I)
450 CONTINUE
IF (DETJ .EQ. 0.0) GO TO 470
DO 460 I = 1,3
DO 460 J = 1,3
JACOB(I,J) = WORK(I,J)/DETJ
460 CONTINUE
RETURN
C
C JACOBIAN MATRIX WAS SINGULAR.
C
470 WRITE (OP,480) UFM,EID
480 FORMAT (A23,' 3306, SINGULAR JACOBIAN MATRIX FOR ISOPARAMETRIC ',
1 'ELEMENT NO.',I9)
RETURN
END
|
character name*12,a1*12,a2*5
xnd=0.9
open(unit=1,file=
$"/work/03946/hetdex/hdr1/calib/fwhm_and_fluxes_better.txt",
$ status='old')
read(1,*)
read *,name
fwhm=1.8
open(unit=11,file='normexp.out',status='unknown')
do i=1,10000
c read(1,*,end=666) a1,x2,i3,x4,x5,x6,x7,x8,x9
read(1,*,end=666) a1,a2,x2,x2mf,x2mb,i3,x4,x5,x6,x7,x8,x9
if(a1.eq.name) then
if(x2mf.gt.0.8.and.x2mf.lt.5.) then
fwhm=x2mf
else
fwhm=1.7
endif
c fwhm=x2
i1good=0
i2good=0
if(abs(x4-1.).lt.xnd.and.abs(x5-1.).lt.xnd.and.
$ abs(x6-1.).lt.xnd) i1good=1
if(abs(x7-1.).lt.xnd.and.abs(x8-1.).lt.xnd.and.
$ abs(x9-1.).lt.xnd) i2good=1
if(x4.eq.1.0) i1good=0
if(x7.eq.1.0) i2good=0
if(i1good.eq.1.and.i2good.eq.1) then
xn1=(x4+x7)/2.
xn2=(x5+x8)/2.
xn3=(x6+x9)/2.
endif
if(i1good.eq.1.and.i2good.eq.0) then
xn1=x4
xn2=x5
xn3=x6
endif
if(i1good.eq.0.and.i2good.eq.1) then
xn1=x7
xn2=x8
xn3=x9
endif
if(i1good.eq.0.and.i2good.eq.0) then
xn1=1.0
xn2=1.0
xn3=1.0
write(*,1102) "Nothing worked here: ",x4,x5,x6,x7,x8,x9
endif
xfwn=x2
xn1n=xn1
xn2n=xn2
xn3n=xn3
goto 667
endif
enddo
666 continue
xfwn=1.8
xn1n=1.
xn2n=1.
xn3n=1.
667 continue
open(unit=2,file="norm.dat",status='old',err=333)
read(2,*,end=333) xn1n,xn2n,xn3n
print *,xn1n,xn2n,xn3n
333 continue
write(11,1101) "exp01",xfwn,xn1n
write(11,1101) "exp02",xfwn,xn2n
write(11,1101) "exp03",xfwn,xn3n
close(1)
close(2)
close(11)
c- check if virus fwhm is good:
open(unit=11,file='fwhm.out',status='old',err=334)
read(11,*) fwhmv
if(fwhmv.gt.1.2.and.fwhmv.lt.3.5) fwhm=fwhmv
334 continue
close(11)
open(unit=11,file='fwhm.use',status='unknown')
write(11,*) fwhm
close(11)
1101 format(a12,2(1x,f7.3))
1102 format(a20,6(1x,f6.2))
end
|
#if defined obc_north || defined obc_south
subroutine cobc (joff, j, is, ie)
use arrays_2d
use memory_window
use sbc_info
use sbc_ocean
c
c=======================================================================
c compute tracers at "tau+1" for rows 2 and/or jmt-1
c using open boundary conditions as in Stevens (1990).
c
c
c input:
c j = boundary row in the MW
c joff = offset relating "j" in the MW to latitude "jrow"
c => jrow=j+joff = boundary latitude (2 or jmt-1)
c is = starting longitude index in the MW
c ie = ending longitude index in the MW
c
c
c Reference: Stevens, D.P., 1990: On open boundary condidtions for
c three dimensional primitive equation ocean circulation
c models, Geophys. Astrophys. Fluid Dynamics, 51, 103-133
c
c author: Arne Biastoch e-mail: abiastoch@ifm.uni-kiel.de
c based on a version for MOM 1 by Rene Redler
c=======================================================================
c
# include "param.h"
# ifndef obc_north_anywhere
parameter (istrt=2, iend=imt-1)
# endif
# include "accel.h"
# include "cobc.h"
# include "coord.h"
# include "emode.h"
# include "grdvar.h"
# include "hmixc.h"
# ifdef isoneutralmix
# include "isopyc.h"
# endif
# include "mw.h"
# include "scalar.h"
# include "switch.h"
# include "vmixc.h"
dimension twodt(km)
dimension ADV_Ty_obc(imt,km)
# include "fdift.h"
#ifdef partial_cell
c
c additional statement functions for obc
c (same as for interior but for tau)
c
T_i_obc(i,k,j,n,ip) = t(i+ip,max(1,k-1),j,n,tau) - dhwe(i,k-1,j)
& *(t(i+ip,max(1,k-1),j,n,tau) - t(i+ip,k,j,n,tau))
& /dhwt(i+ip,k-1,j)
T_j_obc(i,k,j,n,jp) = t(i,max(1,k-1),j+jp,n,tau) - dhwn(i,k-1,j)
& *(t(i,max(1,k-1),j+jp,n,tau) - t(i,k,j+jp,n,tau))
& /dhwt(i,k-1,j+jp)
#else
T_i_obc(i,k,j,n,ip) = t(i+ip,k,j,n,tau)
T_j_obc(i,k,j,n,jp) = t(i,k,j+jp,n,tau)
#endif
# ifdef timing
call tic ('ocean', 'cobc')
# endif
c
c-----------------------------------------------------------------------
c limit the longitude indices based on those from the argument list
c Note: this is currently bypassed. istrt and iend are set as
c parameters to optimize performance
c-----------------------------------------------------------------------
c
jrow = j + joff
c
# ifdef obc_south
c
if (jrow .eq. 2) then
# ifdef obc_north_anywhere
istrt = 2
iend = imt-1
# endif
c
c-----------------------------------------------------------------------
c 1) compute the advective velocity "vad"
c at the north face of the T cells
c
c 2) compute phase velocity at the southern boundary: c1s
c-----------------------------------------------------------------------
c
var = -dyu(jrow+1)/dtts
c
do k=1,km
do i=2,imtm1
c
vad(i,k) = (u(i,k,j,2,tau)*dxt(i)+u(i-1,k,j,2,tau)
& *dxt(i-1))/(dxt(i)+dxt(i-1))*tmask(i,k,j)
if (vad(i,k) .gt. c0) vad(i,k) = c0
c
do m=1,nt
var1(i,k,m) = t(i,k,j+2,m,taum1)-t(i,k,j+1,m,taum1)
if (var1(i,k,m) .eq. c0) then
c1s(i,k,m) = var
else
c1s(i,k,m) = var*(t(i,k,j+1,m,tau)-t(i,k,j+1,m,taum1))
& /var1(i,k,m)*tmask(i,k,j)
if (c1s(i,k,m) .gt. c0) c1s(i,k,m) = c0
if (c1s(i,k,m) .lt. var) c1s(i,k,m) = var
endif
enddo
c
enddo
# ifdef cyclic
vad( 1,k) = vad(imtm1,k)
vad(imt,k) = vad( 2,k)
do m=1,nt
c1s( 1,k,m) = c1s(imtm1,k,m)
c1s(imt,k,m) = c1s( 2,k,m)
enddo
# else
vad(imt,k) = c0
vad( 1,k) = c0
# endif
enddo
endif
# endif
c
# ifdef obc_north
c
# ifdef obc_north_anywhere
if (jrow .eq. jobcn) then
istrt = iobcns
iend = iobcne
# else
if (jrow .eq. jmtm1) then
# endif
c
c-----------------------------------------------------------------------
c 1) compute the advective velocity "vad"
c at the south face of the T cells
c
c 2) compute phase velocity at the northern boundary: c1n
c (var1 is calculated in subroutine tracer because of
c running out of bounds)
c-----------------------------------------------------------------------
c
var = dyu(jrow-1)/dtts
c
do k=1,km
do i=2,imtm1
c
vad(i,k) = (u(i,k,j-1,2,tau)*dxt(i)+u(i-1,k,j-1,2,tau)
& *dxt(i-1))/(dxt(i)+dxt(i-1))*tmask(i,k,j)
if (vad(i,k) .lt. c0) vad(i,k) = c0
c
do m=1,nt
if (var1(i,k,m) .eq. c0) then
c1n(i,k,m) = var
else
c1n(i,k,m) = -var*(t(i,k,j-1,m,tau)-t(i,k,j-1,m,taum1))
& /var1(i,k,m)*tmask(i,k,j)
if (c1n(i,k,m) .lt. c0) c1n(i,k,m) = c0
if (c1n(i,k,m) .gt. var) c1n(i,k,m) = var
endif
enddo
c
enddo
# ifdef cyclic
vad( 1,k) = vad(imtm1,k)
vad(imt,k) = vad( 2,k)
do m=1,nt
c1n( 1,k,m) = c1n(imtm1,k,m)
c1n(imt,k,m) = c1n( 2,k,m)
enddo
# else
vad(imt,k) = c0
vad( 1,k) = c0
# endif
enddo
c
endif
# endif
c
c
do n=1,nt
c
c-----------------------------------------------------------------------
c diffusive flux across eastern face of T cells
c (use constant horizontal diffusion)
c-----------------------------------------------------------------------
c
#ifdef tracer_horz_mix_const
ah_csu_dyur = diff_cnt*csu_dyur(jrow)
#endif
c
do k=1,kbot
do i=istrt-1,iend
c
c only Laplacian diffusion
c
diff_fe(i,k,j) = (T_i_obc(i,k,j,n,1)
& -T_i_obc(i,k,j,n,0))
#ifdef tracer_horz_mix_const
& *ah_cstdxur(i,j)
#endif
#ifdef tracer_horz_mix_var
& *diff_cet(i,k,j)*cstdxur(i,j)
#endif
#if defined partial_cell
& *dhte(i,k,j)
#endif
c
do jj=j-1,j
jjrow = jj + joff
jp1 = min(jjrow+1,jmt-1)-joff
diff_fn(i,k,jj) = (T_j_obc(i,k,jj,n,1)
& -T_j_obc(i,k,jj,n,0))
#ifdef tracer_horz_mix_const
& *ah_csu_dyur
#endif
#ifdef tracer_horz_mix_var
& *diff_cnt(i,k,jj)*csu_dyur(jjrow)
#endif
#if defined partial_cell
& *dhtn(i,k,jj)
#endif
enddo
enddo
enddo
c
c-----------------------------------------------------------------------
c diffusive flux across bottom face of T cells
c use constant vertical diffusion
c-----------------------------------------------------------------------
c
nt2 = min(n,nsmix)
do k=1,kbot-1
do i=istrt,iend
diff_fb(i,k,j) = diff_cbt(i,k,j,nt2)*dz_wtr(i,k,j)*
& (t(i,k,j,n,tau) - t(i,k+1,j,n,tau))
enddo
enddo
c
c for vertical diffusion of tracers:
c set k=0 elements to reflect surface tracer flux.
c set bottom level "kz" to reflect insulation condition.
c for vertical advection of tracers:
c set k=0 elements of vertical advection array to the rigid
c lid condition (w(0) = 0). also assume w(km)=0. If "kz" <
c "km" and there is a bottom slope, w(kz) may be non zero.
c
do i=istrt,iend
kb = kmt(i,jrow)
diff_fb(i,0,j) = stf(i,j,n)
diff_fb(i,kb,j) = btf(i,j,n)
enddo
c
c
c-----------------------------------------------------------------------
c calculate meridional diffusion and advection of tracers
c-----------------------------------------------------------------------
c
# ifdef obc_south
c
if (jrow .eq. 2) then
c
c radiation condition at the southern wall
c and meridional diffusion (del**2) of tracer
c
do k=1,km
do i=istrt,iend
ADV_Ty_obc(i,k) = -(c1s(i,k,n)+vad(i,k))
& *(t(i,k,j+1,n,tau)-t(i,k,j,n,tau))/dyu(jrow)
enddo
enddo
endif
# endif
# ifdef obc_north
c
# ifdef obc_north_anywhere
if (jrow .eq. jobcn) then
# else
if (jrow .eq. jmtm1) then
# endif
c
c radiation condition at the northern wall
c and meridional diffusion (del**2) of tracer
c
do k=1,km
do i=istrt,iend
ADV_Ty_obc(i,k) = -(c1n(i,k,n)+vad(i,k))
& *(t(i,k,j,n,tau)-t(i,k,j-1,n,tau))/dyu(jrow-1)
enddo
enddo
endif
# endif
c
c-----------------------------------------------------------------------
c construct tracer source terms here
c force n/s wall to observed values
c-----------------------------------------------------------------------
c
do k=1,km
do i=istrt,iend
source(i,k,j) = c0
enddo
enddo
c
# ifndef orlanski
call obcsponge1 (j, jrow, istrt, iend, n, t(1,1,1,1,tau),
& vad, source)
# endif
c
c-----------------------------------------------------------------------
c calculate the new tracer quantities allowing for implicit
c treatment of vertical diffusion
c-----------------------------------------------------------------------
c
do k=1,km
twodt(k) = dtts*dtxcel(k)
do i=istrt,iend
t(i,k,j,n,taup1) = t(i,k,j,n,tau) + twodt(k)*
& (DIFF_Tx(i,k,j) + DIFF_Tz(i,k,j)
& + DIFF_Ty(i,k,j)
& + ADV_Ty_obc(i,k)
& + source(i,k,j)
& )*tmask(i,k,j)
#ifdef trace_obc
# include "cobc_trace.inc"
#endif
enddo
enddo
c
#if defined implicitvmix || defined isoneutralmix
c
c not tested!
c-----------------------------------------------------------------------
c add dT/dt component due to implicit vertical diffusion
c-----------------------------------------------------------------------
c
call ivdift (joff, j, j, istrt, iend, n, twodt)
#endif
c
call setbcx (t(1,1,j,n,taup1), imt, km)
c
c-----------------------------------------------------------------------
c construct diagnostics associated with tracer "n"
c-----------------------------------------------------------------------
c
call diagt1 (joff, j, j, istrt, iend, n, twodt)
c
c-----------------------------------------------------------------------
c end of tracer component "n" loop
c-----------------------------------------------------------------------
c
enddo
c
c-----------------------------------------------------------------------
c construct diagnostics (for total dT/dt)
c-----------------------------------------------------------------------
c
idiag = 1
call diagt2 (joff, j, j, istrt, iend, idiag)
c
#if !defined simple_sbc && !defined smhi_sbc
c
c-----------------------------------------------------------------------
c if needed, construct the Atmos S.B.C.(surface boundary conditions)
c averaged over this segment
c eg: SST and possibly SSS
c-----------------------------------------------------------------------
c
isst = index_of_sbc ('sst')
isss = index_of_sbc ('sss')
if (isst .ne. 0 .or. isss .ne. 0) then
tlev = tau
if (euler2) tlev = taum1
call asbct (joff, js, je, istrt, iend, isst, isss
&, t(1,1,1,1,tlev))
endif
#endif
c
#ifdef trace_indices
write (stdout,'(2x,3(a,i4))')
& "=> In cobc: j=",j," joff=",joff," jrow=",j+joff
# endif
# ifdef timing
call toc ('ocean', 'cobc')
# endif
return
end
# ifndef orlanski
subroutine obcsponge1 ( j, jrow, is, ie, n, tm1, vad, source)
c
c=======================================================================
c newtonian damping variables for obc regions. damp to prescribed
c values if there are inflow conditions. data must be prepared
c using the "mkobc" routines included in the programs for working
c with the MOM dataset.
c
c input:
c j = open boundary row in the MW
c jrow = (2,jmtm1) open boundary row
c is = starting longitude index in the MW
c ie = ending longitude index in the MW
c n = (1,2) = (T,S) tracer component
c tm1 = tracer at "tau"
c vad = advective vel. for tracers at open walls
c ==> restore to boundary values for inflow conditions
c
c output:
c source = newtonian damping term
c
c author: Arne Biastoch e-mail: abiastoch@ifm.uni-kiel.de
c=======================================================================
c
use xobc_mod
# include "param.h"
# include "iounit.h"
# include "obc_data.h"
# include "switch.h"
# include "tmngr.h"
c
dimension source(imt,km,2:jmw-1)
dimension tm1(imt,km,jmw,nt)
dimension vad(imt,km)
c
# ifdef timing
call tic ('cobc', 'obc sponge1')
# endif
if (n .eq. 1 .and. is .eq. 2) then
c
c-----------------------------------------------------------------------
c decide whether to read sponge data or not
c-----------------------------------------------------------------------
c
begtim = position_within_data (model_time, obc_start_time
&, obc_end_time, .true.)
methodobc = 3
call timeinterp (begtim, indxob1, tobc1, obc1dpm, 12, .true.
&, methodobc, inextdobc1, iprevdobc1, wprevobc1,
& readob1, inextobc1, iprevobc1)
c
c read in the next data record from disk when needed
c
if (readob1) then
call getunit (ionew4, 'obc1.ud', opt_obc1)
read (ionew4, rec=inextdobc1) obctnext, spdpmn, im, kk, jm
# ifdef obc_south
&, obcs,(((obbuf_south(i,k,nn,inextobc1),i=1,imt),k=1,km),nn=1,2)
# endif
# ifdef obc_north
&, obcn,(((obbuf_north(i,k,nn,inextobc1),i=1,imt),k=1,km),nn=1,2)
# endif
write (stdout,'(/a,i3,a,i2,a,i2,a,g14.7,1x,a/)')
& '=> read obc1 record =',inextdobc1,' into buffer =',inextobc1
&, ' method #',methodobc,' at day =', begtim, stamp
call relunit (ionew4)
endif
endif
if (n .le. 2) then
c
c-----------------------------------------------------------------------
c construct newtonian damping term using obc data
c-----------------------------------------------------------------------
c
# ifdef obc_south
if (jrow .eq. 2 .and. obcs .ne. c0) then
tnext = c1-wprevobc1
do k=1,km
do i=is,ie
if (vad(i,k) .eq. 0.) then
data = tnext *obbuf_south(i,k,n,inextobc1)
& + wprevobc1*obbuf_south(i,k,n,iprevobc1)
source(i,k,j) = source(i,k,j) -
& obcs*(tm1(i,k,j,n) - data)
endif
enddo
enddo
endif
# endif
c
# ifdef obc_north
# ifdef obc_north_anywhere
if (jrow .eq. jobcn .and. obcn .ne. c0) then
# else
if (jrow .eq. jmtm1 .and. obcn .ne. c0) then
# endif
tnext = c1-wprevobc1
do k=1,km
do i=is,ie
if (vad(i,k) .eq. 0.) then
data = tnext *obbuf_north(i,k,n,inextobc1)
& + wprevobc1*obbuf_north(i,k,n,iprevobc1)
source(i,k,j) = source(i,k,j) -
& obcn*(tm1(i,k,j,n) - data)
endif
enddo
enddo
endif
# endif
endif
# ifdef timing
call toc ('cobc', 'obc sponge1')
# endif
return
end
# endif
c
#else
subroutine cobc (joff, j, is, ie)
return
end
#endif
|
subroutine ewald3_neu
x (ilst,engcpe,vircpe,alpha,epsq,nexatm,
x lexatm,chge,xdf,ydf,zdf,fxx,fyy,fzz,stress)
c
c***********************************************************************
c
c dl_poly subroutine for calculating coulombic forces in a
c periodic system using ewald's method
c based on charge group decomposition strategy
c
c parallel replicated data version (part 3)
c
c copyright - daresbury laboratory 1992
c author - w. smith dec 1992.
c stress stensor added t.forester may 1994
c charge group version - t.forester june 1996
c
c wl
c 2000/01/18 14:05:36
c 1.3
c Exp
c
c***********************************************************************
c
#include "dl_params.inc"
dimension xdf(mxxdf),ydf(mxxdf),zdf(mxxdf)
dimension fxx(mxatms),fyy(mxatms),fzz(mxatms)
dimension nexatm(msatms),lexatm(msatms,mxexcl)
dimension chge(mxatms)
dimension stress(9)
data a1,a2,a3/0.254829592d0,-0.284496736d0,1.421413741d0/
data a4,a5,pp/-1.453152027d0,1.061405429d0,0.3275911d0/
data rr3/0.333333333333d0/,r10/0.1d0/,r42/0.02380952381d0/
data r216/4.62962962963d-3/
#ifdef VAMPIR
call VTBEGIN(104, ierr)
#endif
c
c initialise potential energy and virial
engcpe=0.d0
vircpe=0.d0
c
c start of primary loop for forces evaluation
k = 0
m = -1
do mm=1,nexatm(ilst),2
m = m+2
c
c atomic index and charge product
iatm=lexatm(ilst,m)
jatm=lexatm(ilst,m+1)
chgprd=chge(iatm)*chge(jatm)/epsq*r4pie0
c
c calculate interatomic distance
k = k+1
rsq=xdf(k)**2+ydf(k)**2+zdf(k)**2
rrr = sqrt(rsq)
alpr=rrr*alpha
alpr2=alpr*alpr
c
c calculate error function and derivative
if(alpr.lt.1.d-2)then
erfr=2.d0*chgprd*(alpha/sqrpi)*
x (1.d0+alpr2*(-rr3+alpr2*(r10+alpr2*(-r42+alpr2*r216))))
egamma=-4.d0*chgprd*(alpha**3/sqrpi)*
x (rr3+alpr2*(-2.d0*r10+alpr2*(3.d0*r42-4.d0*alpr2*r216)))
else
tt=1.d0/(1.d0+pp*alpha*rrr)
exp1=exp(-(alpha*rrr)**2)
erfr =(1.d0-tt*(a1+tt*(a2+tt*(a3+tt*(a4+tt*a5))))*exp1)*
x chgprd/rrr
egamma = -(erfr-2.d0*chgprd*(alpha/sqrpi)*exp1)/rsq
endif
c
c calculate potential energy and virial
engcpe = engcpe-erfr
vircpe = vircpe - egamma*rsq
c
c calculate forces
fx = egamma*xdf(k)
fy = egamma*ydf(k)
fz = egamma*zdf(k)
fxx(iatm) = fxx(iatm) + fx
fyy(iatm) = fyy(iatm) + fy
fzz(iatm) = fzz(iatm) + fz
fxx(jatm) = fxx(jatm) - fx
fyy(jatm) = fyy(jatm) - fy
fzz(jatm) = fzz(jatm) - fz
#ifdef STRESS
c
c calculate stress tensor
stress(1) = stress(1)+ xdf(k)*fx
stress(2) = stress(2)+ xdf(k)*fy
stress(3) = stress(3)+ xdf(k)*fz
stress(5) = stress(5)+ ydf(k)*fy
stress(6) = stress(6)+ ydf(k)*fz
stress(9) = stress(9)+ zdf(k)*fz
#endif
enddo
#ifdef STRESS
c
c complete stress tensor
stress(4) = stress(2)
stress(7) = stress(3)
stress(8) = stress(6)
#endif
#ifdef VAMPIR
call VTEND(104, ierr)
#endif
return
end
|
SUBROUTINE newcondens(ngrid,nlayer,nq,ptimestep,
$ pcapcal,pplay,pplev,ptsrf,pt,
$ pphi,pdt,pdu,pdv,pdtsrf,pu,pv,pq,pdq,
$ piceco2,psolaralb,pemisurf,
$ pdtc,pdtsrfc,pdpsrf,pduc,pdvc,pdqc,
$ fluxsurf_sw,zls)
IMPLICIT NONE
c=======================================================================
c subject:
c --------
c Condensation/sublimation of CO2 ice on the ground and in the
c atmosphere
c (Scheme described in Forget et al., Icarus, 1998)
c
c author: Francois Forget 1994-1996
c ------
c
c input:
c -----
c ngrid nombre de points de verticales
c (toutes les boucles de la physique sont au
c moins vectorisees sur ngrid)
c nlayer nombre de couches
c pplay(ngrid,nlayer) Pressure levels
c pplev(ngrid,nlayer+1) Pressure levels
c pt(ngrid,nlayer) temperature (en K)
c ptsrf(ngrid) temperature de surface
c
c \
c pdt(ngrid,nlayermx) \ derivee temporelle physique avant condensation
c / ou sublimation pour pt,ptsrf
c pdtsrf(ngrid) /
c
c output:
c -------
c
c pdpsrf(ngrid) \ derivee temporelle physique (contribution de
c pdtc(ngrid,nlayermx) / la condensation ou sublimation) pour Ps,pt,ptsrf
c pdtsrfc(ngrid) /
c
c Entree/sortie
c -------------
c
c piceco2(ngrid) : quantite de glace co2 au sol (kg/m2)
c psolaralb(ngrid,2) : albedo au sol
c pemisurf(ngrid) : emissivite du sol
c
c=======================================================================
c
c 0. Declarations :
c ------------------
c
#include "dimensions.h"
#include "dimphys.h"
#include "comcstfi.h"
#include "surfdat.h"
#include "comgeomfi.h"
#include "comvert.h"
#include "paramet.h"
#include "callkeys.h"
#include "tracer.h"
c-----------------------------------------------------------------------
c Arguments :
c ---------
INTEGER ngrid, nlayer, nq
REAL ptimestep
REAL pplay(ngrid,nlayer),pplev(ngrid,nlayer+1)
REAL pcapcal(ngrid)
REAL pt(ngrid,nlayer)
REAL ptsrf(ngrid)
REAL pphi(ngrid,nlayer)
REAL pdt(ngrid,nlayer),pdtsrf(ngrid),pdtc(ngrid,nlayer)
REAL pdtsrfc(ngrid),pdpsrf(ngrid)
REAL piceco2(ngrid),psolaralb(ngrid,2),pemisurf(ngrid)
REAL pu(ngrid,nlayer) , pv(ngrid,nlayer)
REAL pdu(ngrid,nlayer) , pdv(ngrid,nlayer)
REAL pduc(ngrid,nlayer) , pdvc(ngrid,nlayer)
REAL pq(ngridmx,nlayer,nq),pdq(ngrid,nlayer,nq)
REAL pdqc(ngrid,nlayer,nq)
REAL fluxsurf_sw(ngrid,2) ! added to calculate flux dependent albedo
real zls ! solar longitude (rad)
c
c Local variables :
c -----------------
c variables used for albedo parametrization
c --------------------------------------------
INTEGER i,j
REAL Fluxmean(jjp1)
INTEGER l,ig,iq,icap,nmix
LOGICAL transparency, fluxdependent
c flag transparency if you want to make the co2ice semi-transparent
PARAMETER(transparency=.true.)
c flag fluxdependent if you want the co2ice albedo to be dependent on
c the incident solar flux
PARAMETER(fluxdependent=.false.)
REAL slopy,alpha,constA,constB,constT,albediceF_new(ngridmx)
REAL zt(ngridmx,nlayermx)
REAL zcpi
REAL ztcond (ngridmx,nlayermx+1)
REAL ztcondsol(ngridmx)
REAL zdiceco2(ngridmx)
REAL zcondicea(ngridmx,nlayermx)
REAL zcondices(ngridmx)
REAL zfallice(ngridmx,nlayermx+1) , zfallheat
REAL zmflux(nlayermx+1)
REAL zu(nlayermx),zv(nlayermx)
REAL zq(nlayermx,nqmx),zq1(nlayermx)
REAL ztsrf(ngridmx)
REAL ztc(nlayermx), ztm(nlayermx+1)
REAL zum(nlayermx+1) , zvm(nlayermx+1)
REAL zqm(nlayermx+1,nqmx),zqm1(nlayermx+1)
REAL masse(nlayermx),w(nlayermx+1)
REAL Sm(nlayermx),Smq(nlayermx,nqmx),mixmas,qmix
LOGICAL condsub(ngridmx)
c variable speciale diagnostique
real tconda1(ngridmx,nlayermx)
real tconda2(ngridmx,nlayermx)
c REAL zdiceco2a(ngridmx) ! for diagnostic only
real zdtsig (ngridmx,nlayermx)
real zdt (ngridmx,nlayermx)
real vmr_co2(ngridmx,nlayermx) ! co2 volume mixing ratio
! improved_ztcond flag: If set to .true. (AND running with a 'co2' tracer)
! then condensation temperature is computed using partial pressure of CO2
logical,parameter :: improved_ztcond=.true.
! Bound co2 (tracer) values...
logical,parameter :: bound_qco2=.false.
real,parameter :: qco2max=1.1
real,parameter :: qco2mini=0.1
real :: zqco2
c local saved variables
integer ico2
real qco2min,qco2,mmean
save ico2,qco2min
REAL emisref(ngridmx)
REAL latcond,tcond1mb
REAL acond,bcond,ccond,cpice
! REAL albediceF(ngridmx)
SAVE emisref
SAVE latcond,acond,bcond,ccond,cpice
! SAVE albediceF
real m_co2, m_noco2, A , B
save A, B, m_co2, m_noco2
LOGICAL firstcall !,firstcall2
SAVE firstcall !,firstcall2
! REAL SSUM
! EXTERNAL SSUM
DATA latcond,tcond1mb/5.9e5,136.27/
DATA cpice /1000./
DATA firstcall/.true./
! DATA firstcall2/.true./
integer flag
c----------------------------------------------------------------------
c Initialisation
c --------------
c
IF (firstcall) THEN
bcond=1./tcond1mb
ccond=cpp/(g*latcond)
acond=r/latcond
firstcall=.false.
write(*,*) 'Newcondens: improved_ztcond=',improved_ztcond
write(*,*) 'Newcondens: bound_qco2=',bound_qco2
PRINT*,'In newcondens:Tcond(P=1mb)=',tcond1mb,' Lcond=',latcond
PRINT*,'acond,bcond,ccond',acond,bcond,ccond
ico2=0
if (tracer) then
c Prepare Special treatment if one of the tracer is CO2 gas
do iq=1,nqmx
if (noms(iq).eq."co2") then
ico2=iq
m_co2 = 44.01E-3 ! CO2 molecular mass (kg/mol)
m_noco2 = 33.37E-3 ! Non condensible mol mass (kg/mol)
c Compute A and B coefficient use to compute
c mean molecular mass Mair defined by
c 1/Mair = q(ico2)/m_co2 + (1-q(ico2))/m_noco2
c 1/Mair = A*q(ico2) + B
A =(1/m_co2 - 1/m_noco2)
B=1/m_noco2
endif
enddo
c minimum CO2 mix. ratio below which mixing occur with layer above:
qco2min =0.75
end if
ENDIF
zcpi=1./cpp
c
c======================================================================
c Calcul of CO2 condensation sublimation
c ============================================================
c
c Used variable :
c piceco2(ngrid) : amount of co2 ice on the ground (kg/m2)
c zcondicea(ngrid,l): condensation rate in layer l (kg/m2/s)
c zcondices(ngrid): condensation rate on the ground (kg/m2/s)
c zfallice(ngrid,l):amount of ice falling from layer l (kg/m2/s)
c
c pdtc(ngrid,nlayermx) : dT/dt due to cond/sub
c
c
c Tendencies set to 0 (except pdtc)
c -------------------------------------
DO l=1,nlayer
DO ig=1,ngrid
zcondicea(ig,l) = 0.
zfallice(ig,l) = 0.
pduc(ig,l) = 0
pdvc(ig,l) = 0
END DO
END DO
DO iq=1,nqmx
DO l=1,nlayer
DO ig=1,ngrid
pdqc(ig,l,iq) = 0
END DO
END DO
END DO
DO ig=1,ngrid
zfallice(ig,nlayer+1) = 0.
zcondices(ig) = 0.
pdtsrfc(ig) = 0.
pdpsrf(ig) = 0.
condsub(ig) = .false.
zdiceco2(ig) = 0.
ENDDO
zfallheat=0
c *************************
c ATMOSPHERIC CONDENSATION
c *************************
c Compute CO2 Volume mixing ratio
c -------------------------------
if (improved_ztcond.and.(ico2.ne.0)) then
DO l=1,nlayer
DO ig=1,ngrid
qco2=pq(ig,l,ico2)+pdq(ig,l,ico2)*ptimestep
c Mean air molecular mass = 1/(q(ico2)/m_co2 + (1-q(ico2))/m_noco2)
mmean=1/(A*qco2 +B)
vmr_co2(ig,l) = qco2*mmean/m_co2
ENDDO
ENDDO
else
DO l=1,nlayer
DO ig=1,ngrid
vmr_co2(ig,l)=0.95
ENDDO
ENDDO
end if
c forecast of atmospheric temperature zt and frost temperature ztcond
c --------------------------------------------------------------------
DO l=1,nlayer
DO ig=1,ngrid
zt(ig,l)=pt(ig,l)+ pdt(ig,l)*ptimestep
! ztcond(ig,l)=1./(bcond-acond*log(.0095*pplay(ig,l)))
ztcond(ig,l)=
& 1./(bcond-acond*log(.01*vmr_co2(ig,l)*pplay(ig,l)))
if (pplay(ig,l).lt.1e-4) ztcond(ig,l)=0.0 !mars Monica
ENDDO
ENDDO
ztcond(:,nlayer+1)=ztcond(:,nlayer)
c Condensation/sublimation in the atmosphere
c ------------------------------------------
c (calcul of zcondicea , zfallice and pdtc)
c
DO l=nlayer , 1, -1
DO ig=1,ngrid
pdtc(ig,l)=0.
IF((zt(ig,l).LT.ztcond(ig,l)).or.(zfallice(ig,l+1).gt.0))THEN
condsub(ig)=.true.
IF (zfallice(ig,l+1).gt.0) then
zfallheat=zfallice(ig,l+1)*
& (pphi(ig,l+1)-pphi(ig,l) +
& cpice*(ztcond(ig,l+1)-ztcond(ig,l)))/latcond
ELSE
zfallheat=0.
ENDIF
pdtc(ig,l)=(ztcond(ig,l) - zt(ig,l))/ptimestep
zcondicea(ig,l)=(pplev(ig,l)-pplev(ig,l+1))
& *ccond*pdtc(ig,l)- zfallheat
c Case when the ice from above sublimes entirely
c """""""""""""""""""""""""""""""""""""""""""""""
IF (zfallice(ig,l+1).lt.- zcondicea(ig,l)) then
pdtc(ig,l)=(-zfallice(ig,l+1)+zfallheat)/
& (ccond*(pplev(ig,l)-pplev(ig,l+1)))
zcondicea(ig,l)= -zfallice(ig,l+1)
END IF
zfallice(ig,l) = zcondicea(ig,l)+zfallice(ig,l+1)
END IF
ENDDO
ENDDO
c *************************
c SURFACE CONDENSATION
c *************************
c forecast of ground temperature ztsrf and frost temperature ztcondsol
c --------------------------------------------------------------------
DO ig=1,ngrid
ztcondsol(ig)=
& 1./(bcond-acond*log(.01*vmr_co2(ig,1)*pplev(ig,1)))
ztsrf(ig) = ptsrf(ig) + pdtsrf(ig)*ptimestep
ENDDO
c
c Condensation/sublimation on the ground
c --------------------------------------
c (calcul of zcondices , pdtsrfc)
c
DO ig=1,ngrid
IF(ig.GT.ngrid/2+1) THEN
icap=2
ELSE
icap=1
ENDIF
c
c Loop on where we have condensation/ sublimation
IF ((ztsrf(ig) .LT. ztcondsol(ig)) .OR. ! ground cond
$ (zfallice(ig,1).NE.0.) .OR. ! falling snow
$ ((ztsrf(ig) .GT. ztcondsol(ig)) .AND. ! ground sublim.
$ ((piceco2(ig)+zfallice(ig,1)*ptimestep) .NE. 0.))) THEN
condsub(ig) = .true.
IF (zfallice(ig,1).gt.0) then
zfallheat=zfallice(ig,1)*
& (pphi(ig,1)- phisfi(ig) +
& cpice*(ztcond(ig,1)-ztcondsol(ig)))/(latcond*ptimestep)
ELSE
zfallheat=0.
ENDIF
c condensation or partial sublimation of CO2 ice
c """""""""""""""""""""""""""""""""""""""""""""""
zcondices(ig)=pcapcal(ig)*(ztcondsol(ig)-ztsrf(ig))
& /(latcond*ptimestep) - zfallheat
pdtsrfc(ig) = (ztcondsol(ig) - ztsrf(ig))/ptimestep
c If the entire CO_2 ice layer sublimes
c """"""""""""""""""""""""""""""""""""""""""""""""""""
c (including what has just condensed in the atmosphere)
IF((piceco2(ig)/ptimestep+zfallice(ig,1)).LE.
& -zcondices(ig))THEN
zcondices(ig) = -piceco2(ig)/ptimestep - zfallice(ig,1)
pdtsrfc(ig)=(latcond/pcapcal(ig))*
& (zcondices(ig)+zfallheat)
END IF
c Changing CO2 ice amount and pressure :
c """"""""""""""""""""""""""""""""""""
zdiceco2(ig) = zcondices(ig) + zfallice(ig,1)
piceco2(ig) = piceco2(ig) + zdiceco2(ig)*ptimestep
pdpsrf(ig) = -zdiceco2(ig)*g
IF(ABS(pdpsrf(ig)*ptimestep).GT.pplev(ig,1)) THEN
PRINT*,'STOP in condens'
PRINT*,'condensing more than total mass'
PRINT*,'Grid point ',ig
PRINT*,'Ps = ',pplev(ig,1)
PRINT*,'d Ps = ',pdpsrf(ig)
STOP
ENDIF
END IF ! if there is condensation/sublimmation
ENDDO ! of DO ig=1,ngrid
c ********************************************************************
c Surface albedo and emissivity of the surface below the snow (emisref)
c ********************************************************************
c Prepare the case where albedo varies with insolation:
c ----------------------------------------------------
! if (fluxdependent) then
!
c Calcul du flux moyen (zonal mean)
! do j=1,jjp1
! Fluxmean(j)=0
! do i=1,iim
! ig=1+(j-2)*iim +i
! if(j.eq.1) ig=1
! if(j.eq.jjp1) ig=ngrid
! Fluxmean(j)=Fluxmean(j)+fluxsurf_sw(ig,1)
! $ +fluxsurf_sw(ig,2)
! enddo
! Fluxmean(j)=Fluxmean(j)/float(iim)
! enddo
!
c const A and B used to calculate the albedo which depends on solar flux
c albedice=constA+constB*Flux
c constT = time step to calculate the solar flux when flux decreases
! constA=0.26
c constA=0.33
c constA=0.186
! constB=0.00187
! constT=10
! endif ! of if (fluxdependent)
! Check that amont of CO2 ice is not problematic
DO ig=1,ngrid
if(.not.piceco2(ig).ge.0.) THEN
if(piceco2(ig).le.-5.e-8) print*,
$ 'WARNING newcondens piceco2(',ig,')=', piceco2(ig)
piceco2(ig)=0.
endif
ENDDO
! Set albedo and emissivity of the surface
! ----------------------------------------
CALL albedocaps(zls,ngrid,piceco2,psolaralb,emisref)
c Calcul de l'albedo
c ------------------
! do ig =1,ngrid
! IF(ig.GT.ngrid/2+1) THEN
! icap=2
! ELSE
! icap=1
! ENDIF
! IF(firstcall2) THEN
! albediceF(ig)=albedice(icap)
! ENDIF
c if there is still co2ice ccccccccccccccccccccccc
! if (piceco2(ig).gt.0) then
! emisref(ig) = emisice(icap)
c if flux dependent albedo is used
c --------------------------------
! if (fluxdependent) then
! j=INT((ig-2)/iim)+2
! if(ig.eq.1) j=1
! if(ig.eq.ngrid) j=jjp1
c albediceF_new(ig)=MIN(constA+constB*Fluxmean(j),
c $ constA+constB*250)
! albediceF_new(ig)=constA+constB*Fluxmean(j)
! if (albediceF(ig).gt.albediceF_new(ig)) then
! albediceF(ig)=albediceF(ig)+ ptimestep/(daysec*
! $ constT)*(albediceF_new(ig)-albediceF(ig))
! else
! albediceF(ig)=albediceF_new(ig)
! endif
c if part of the ice is transparent
c slopy = pente de la droite: alpha = y*co2ice/1620
c pour une valeur superieur a une epaisseur de glace donnee
c ici, epaisseur limite = 10cm
! if (transparency) then
! slopy=1/(1620*0.10)
! alpha=MIN(slopy*piceco2(ig),1.)
! psolaralb(ig,1) = alpha*albediceF(ig)
! $ +(1-alpha)*albedodat(ig)
! psolaralb(ig,2) = psolaralb(ig,1)
! else
! psolaralb(ig,1) = albediceF(ig)
! psolaralb(ig,2) = psolaralb(ig,1)
! endif
! else
c transparency set to true and fluxdependent set to false
! if (transparency) then
! slopy=1/(1620*0.10)
! alpha=MIN(slopy*piceco2(ig),1.)
! psolaralb(ig,1) = alpha*albedice(icap)
! $ +(1-alpha)*albedodat(ig)
! psolaralb(ig,2) = psolaralb(ig,1)
! else
c simplest case: transparency and flux dependent set to false
! psolaralb(ig,1) = albedice(icap)
! psolaralb(ig,2) = albedice(icap)
! endif
! endif
c no more co2ice, albedo = ground albedo
! else
! psolaralb(ig,1) = albedodat(ig)
! psolaralb(ig,2) = albedodat(ig)
! emisref(ig) = emissiv
! pemisurf(ig) = emissiv
! endif
! end do ! end of the ig loop
! set pemisurf() to emissiv when there is bare surface (needed for co2snow)
DO ig=1,ngrid
if (piceco2(ig).eq.0) then
pemisurf(ig)=emissiv
endif
ENDDO
! firstcall2=.false.
c ***************************************************************
c Correction to account for redistribution between sigma or hybrid
c layers when changing surface pressure (and warming/cooling
c of the CO2 currently changing phase).
c *************************************************************
DO ig=1,ngrid
if (condsub(ig)) then
do l=1,nlayer
ztc(l) =zt(ig,l) +pdtc(ig,l) *ptimestep
zu(l) =pu(ig,l) +pdu( ig,l) *ptimestep
zv(l) =pv(ig,l) +pdv( ig,l) *ptimestep
do iq=1,nqmx
zq(l,iq)=pq(ig,l,iq)+pdq(ig,l,iq)*ptimestep
enddo
end do
c Mass fluxes through the sigma levels (kg.m-2.s-1) (>0 when up)
c """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
zmflux(1) = -zcondices(ig)
DO l=1,nlayer
zmflux(l+1) = zmflux(l) -zcondicea(ig,l)
& + (bp(l)-bp(l+1))*(zfallice(ig,1)-zmflux(1))
c zmflux set to 0 if very low to avoid: top layer is disappearing in v1ld
if (abs(zmflux(l+1)).lt.1E-13.OR.bp(l+1).eq.0.) zmflux(l+1)=0.
END DO
c Mass of each layer
c ------------------
DO l=1,nlayer
masse(l)=(pplev(ig,l) - pplev(ig,l+1))/g
END DO
c Corresponding fluxes for T,U,V,Q
c """"""""""""""""""""""""""""""""
c averaging operator for TRANSPORT
c """"""""""""""""""""""""""""""""
c Value transfert at the surface interface when condensation
c sublimation:
ztm(1) = ztsrf(ig) + pdtsrfc(ig)*ptimestep
zum(1) = 0
zvm(1) = 0
do iq=1,nqmx
zqm(1,iq)=0. ! most tracer do not condense !
enddo
c Special case if one of the tracer is CO2 gas
if (ico2.ne.0) zqm(1,ico2)=1. ! flux is 100% CO2
c Van Leer scheme:
DO l=1,nlayer+1
w(l)=-zmflux(l)*ptimestep
END DO
call vl1d(ztc,2.,masse,w,ztm)
call vl1d(zu ,2.,masse,w,zum)
call vl1d(zv ,2.,masse,w,zvm)
do iq=1,nqmx
do l=1,nlayer
zq1(l)=zq(l,iq)
enddo
zqm1(1)=zqm(1,iq)
call vl1d(zq1,2.,masse,w,zqm1)
do l=2,nlayer
zq( l,iq)=zq1(l)
zqm(l,iq)=zqm1(l)
enddo
enddo
c Surface condensation affects low winds
if (zmflux(1).lt.0) then
zum(1)= zu(1) * (w(1)/masse(1))
zvm(1)= zv(1) * (w(1)/masse(1))
if (w(1).gt.masse(1)) then ! ensure numerical stability
zum(1)= (zu(1)-zum(2))*masse(1)/w(1) + zum(2)
zvm(1)= (zv(1)-zvm(2))*masse(1)/w(1) + zvm(2)
end if
end if
ztm(nlayer+1)= ztc(nlayer) ! should not be used, but...
zum(nlayer+1)= zu(nlayer) ! should not be used, but...
zvm(nlayer+1)= zv(nlayer) ! should not be used, but...
do iq=1,nqmx
zqm(nlayer+1,iq)= zq(nlayer,iq)
enddo
#ifdef MESOSCALE
!!!! AS: This part must be commented in the mesoscale model
!!!! AS: ... to avoid instabilities.
!!!! AS: you have to compile with -DMESOSCALE to do so
#else
c Tendencies on T, U, V, Q
c """"""""""""""""""""""""
DO l=1,nlayer
c Tendencies on T
zdtsig(ig,l) = (1/masse(l)) *
& ( zmflux(l)*(ztm(l) - ztc(l))
& - zmflux(l+1)*(ztm(l+1) - ztc(l))
& + zcondicea(ig,l)*(ztcond(ig,l)-ztc(l)) )
pdtc(ig,l) = pdtc(ig,l) + zdtsig(ig,l)
c Tendencies on U
pduc(ig,l) = (1/masse(l)) *
& ( zmflux(l)*(zum(l) - zu(l))
& - zmflux(l+1)*(zum(l+1) - zu(l)) )
c Tendencies on V
pdvc(ig,l) = (1/masse(l)) *
& ( zmflux(l)*(zvm(l) - zv(l))
& - zmflux(l+1)*(zvm(l+1) - zv(l)) )
END DO
#endif
c Tendencies on Q
do iq=1,nqmx
! if (noms(iq).eq.'co2') then
if (iq.eq.ico2) then
c SPECIAL Case when the tracer IS CO2 :
DO l=1,nlayer
pdqc(ig,l,iq)= (1/masse(l)) *
& ( zmflux(l)*(zqm(l,iq) - zq(l,iq))
& - zmflux(l+1)*(zqm(l+1,iq) - zq(l,iq))
& + zcondicea(ig,l)*(zq(l,iq)-1.) )
END DO
else
DO l=1,nlayer
pdqc(ig,l,iq)= (1/masse(l)) *
& ( zmflux(l)*(zqm(l,iq) - zq(l,iq))
& - zmflux(l+1)*(zqm(l+1,iq) - zq(l,iq))
& + zcondicea(ig,l)*zq(l,iq) )
END DO
end if
enddo
c --------------------------------------------------------
c Roughly Simulate Molecular mixing when CO2 is too depleted by
c Surface condensation (mixing starts if qco2 < qco2min )
c FF 06/2004
c WARNING : this is now done in convadj, better (FF 02/2005)
c --------------------------------------------------------
flag=0 ! now done in convadj : must be =0
if (flag.eq.1) then
if(ico2.gt.0) then ! relevant only if one tracer is CO2
if(pq(ig,1,ico2)+(pdq(ig,1,ico2)+pdqc(ig,1,ico2))*ptimestep
& .lt.qco2min) then
do iq=1,nqmx
zq(1,iq)=pq(ig,1,iq)
& +(pdq(ig,1,iq)+pdqc(ig,1,iq))*ptimestep
Smq(1,iq) = masse(1)*zq(1,iq)
end do
Sm(1) = masse(1)
do l =2,nlayermx
do iq=1,nqmx
zq(l,iq)=pq(ig,l,iq)
& +(pdq(ig,l,iq)+pdqc(ig,l,iq))*ptimestep
smq(l,iq) = smq(l-1,iq) + masse(l)*zq(l,iq)
end do
sm(l) = sm(l-1) + masse(l)
if(zq(l,ico2).gt.qco2min) then
c mixmas: mass of atmosphere that must be mixed to reach qco2min
mixmas = (sm(l-1)*zq(l,ico2)-Smq(l-1,ico2))
& /(zq(l,ico2)-qco2min)
if((mixmas.le.sm(l)))then
c OK if mixed mass less than mass of layers affected
nmix=l ! number of layer affected by mixing
goto 99
end if
end if
end do
99 continue
do iq=1,nqmx
qmix=zq(nmix,iq)
& +(Smq(nmix-1,iq)-zq(nmix,iq)*Sm(nmix-1))/mixmas
do l=1,nmix-1
pdqc(ig,l,iq)=
& (qmix-pq(ig,l,iq))/ptimestep - pdq(ig,l,iq)
end do
c layer only partly mixed :
pdqc(ig,nmix,iq)=(
& qmix+(Sm(nmix)-mixmas)*(zq(nmix,iq)-qmix)/masse(nmix)
& -pq(ig,nmix,iq))/ptimestep -pdq(ig,nmix,iq)
end do
end if
end if
endif ! (flag.eq.1)
end if ! if (condsub)
END DO ! loop on ig
c ***************************************************************
c CO2 snow / clouds scheme
c ***************************************************************
call co2snow(ngrid,nlayer,ptimestep,emisref,condsub,pplev,
& zcondicea,zcondices,zfallice,pemisurf)
c ***************************************************************
c Ecriture des diagnostiques
c ***************************************************************
c DO l=1,nlayer
c DO ig=1,ngrid
c Taux de cond en kg.m-2.pa-1.s-1
c tconda1(ig,l)=zcondicea(ig,l)/(pplev(ig,l)-pplev(ig,l+1))
c Taux de cond en kg.m-3.s-1
c tconda2(ig,l)=tconda1(ig,l)*pplay(ig,l)*g/(r*pt(ig,l))
c END DO
c END DO
c call WRITEDIAGFI(ngridmx,'tconda1',
c &'Taux de condensation CO2 atmospherique /Pa',
c & 'kg.m-2.Pa-1.s-1',3,tconda1)
c call WRITEDIAGFI(ngridmx,'tconda2',
c &'Taux de condensation CO2 atmospherique /m',
c & 'kg.m-3.s-1',3,tconda2)
! output falling co2 ice in 1st layer:
! call WRITEDIAGFI(ngridmx,'fallice',
! &'Precipitation of co2 ice',
! & 'kg.m-2.s-1',2,zfallice(1,1))
!! Specific stuff to bound co2 tracer values ....
if (bound_qco2.and.(ico2.ne.0)) then
do ig=1,ngridmx
do l=1,nlayermx
zqco2=pq(ig,l,ico2)
& +(pdq(ig,l,ico2)+pdqc(ig,l,ico2))*ptimestep
if (zqco2.gt.qco2max) then
! correct pdqc:
pdqc(ig,l,ico2)=((qco2max-pq(ig,l,ico2))/ptimestep)
& -pdq(ig,l,ico2)
write(*,*) "newcondens: adapting pdqc(ig,l,ico2)",
& " so that co2 conc. does not exceed",qco2max
write(*,*) " ig:",ig," l:",l
endif ! of if (zqco2.gt.qco2max)
if (zqco2.lt.qco2mini) then
! correct pdqc:
pdqc(ig,l,ico2)=((qco2mini-pq(ig,l,ico2))/ptimestep)
& -pdq(ig,l,ico2)
write(*,*) "newcondens: adapting pdqc(ig,l,ico2)",
& " so that co2 conc. is not less than",qco2mini
write(*,*) " ig:",ig," l:",l
endif ! of if (zqco2.lt.qco2mini)
end do
enddo
endif ! of if (bound_qco2.and.(ico2.ne.0)) then
return
end
c *****************************************************************
SUBROUTINE vl1d(q,pente_max,masse,w,qm)
c
c
c Operateur de moyenne inter-couche pour calcul de transport type
c Van-Leer " pseudo amont " dans la verticale
c q,w sont des arguments d'entree pour le s-pg ....
c masse : masse de la couche Dp/g
c w : masse d'atm ``transferee'' a chaque pas de temps (kg.m-2)
c pente_max = 2 conseillee
c
c
c --------------------------------------------------------------------
IMPLICIT NONE
#include "dimensions.h"
c
c
c
c Arguments:
c ----------
real masse(llm),pente_max
REAL q(llm),qm(llm+1)
REAL w(llm+1)
c
c Local
c ---------
c
INTEGER l
c
real dzq(llm),dzqw(llm),adzqw(llm),dzqmax
real sigw, Mtot, MQtot
integer m
c integer ismax,ismin
c On oriente tout dans le sens de la pression
c W > 0 WHEN DOWN !!!!!!!!!!!!!
do l=2,llm
dzqw(l)=q(l-1)-q(l)
adzqw(l)=abs(dzqw(l))
enddo
do l=2,llm-1
if(dzqw(l)*dzqw(l+1).gt.0.) then
dzq(l)=0.5*(dzqw(l)+dzqw(l+1))
else
dzq(l)=0.
endif
dzqmax=pente_max*min(adzqw(l),adzqw(l+1))
dzq(l)=sign(min(abs(dzq(l)),dzqmax),dzq(l))
enddo
dzq(1)=0.
dzq(llm)=0.
do l = 1,llm-1
c Regular scheme (transfered mass < layer mass)
c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(w(l+1).gt.0. .and. w(l+1).le.masse(l+1)) then
sigw=w(l+1)/masse(l+1)
qm(l+1)=(q(l+1)+0.5*(1.-sigw)*dzq(l+1))
else if(w(l+1).le.0. .and. -w(l+1).le.masse(l)) then
sigw=w(l+1)/masse(l)
qm(l+1)=(q(l)-0.5*(1.+sigw)*dzq(l))
c Extended scheme (transfered mass > layer mass)
c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else if(w(l+1).gt.0.) then
m=l+1
Mtot = masse(m)
MQtot = masse(m)*q(m)
do while ((m.lt.llm).and.(w(l+1).gt.(Mtot+masse(m+1))))
m=m+1
Mtot = Mtot + masse(m)
MQtot = MQtot + masse(m)*q(m)
end do
if (m.lt.llm) then
sigw=(w(l+1)-Mtot)/masse(m+1)
qm(l+1)= (1/w(l+1))*(MQtot + (w(l+1)-Mtot)*
& (q(m+1)+0.5*(1.-sigw)*dzq(m+1)) )
else
w(l+1) = Mtot
qm(l+1) = Mqtot / Mtot
write(*,*) 'top layer is disapearing !'
stop
end if
else ! if(w(l+1).lt.0)
m = l-1
Mtot = masse(m+1)
MQtot = masse(m+1)*q(m+1)
if (m.gt.0) then ! because some compilers will have problems
! evaluating masse(0)
do while ((m.gt.0).and.(-w(l+1).gt.(Mtot+masse(m))))
m=m-1
Mtot = Mtot + masse(m+1)
MQtot = MQtot + masse(m+1)*q(m+1)
if (m.eq.0) exit
end do
endif
if (m.gt.0) then
sigw=(w(l+1)+Mtot)/masse(m)
qm(l+1)= (-1/w(l+1))*(MQtot + (-w(l+1)-Mtot)*
& (q(m)-0.5*(1.+sigw)*dzq(m)) )
else
qm(l+1)= (-1/w(l+1))*(MQtot + (-w(l+1)-Mtot)*qm(1))
end if
end if
enddo
c boundary conditions (not used in newcondens !!)
c qm(llm+1)=0.
c if(w(1).gt.0.) then
c qm(1)=q(1)
c else
c qm(1)=0.
c end if
return
end
|
C$Procedure PODAED ( Pod, append elements, double precision )
SUBROUTINE PODAED ( ELEMS, N, POD )
IMPLICIT NONE
C$ Abstract
C
C Append elements to the active group of a pod.
C
C$ Disclaimer
C
C THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
C CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
C GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
C ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
C PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
C TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
C WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
C PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
C SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
C SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
C
C IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
C BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
C LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
C INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
C REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
C REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
C
C RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
C THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
C CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
C ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
C
C$ Required_Reading
C
C PODS
C
C$ Keywords
C
C ARRAY
C CELLS
C PODS
C
C$ Declarations
INTEGER LBCELL
PARAMETER ( LBCELL = -5 )
DOUBLE PRECISION ELEMS ( * )
INTEGER N
DOUBLE PRECISION POD ( LBCELL : * )
C$ Brief_I/O
C
C Variable I/O Description
C -------- --- --------------------------------------------------
C ELEMS I New elements.
C N I Number of new elements.
C POD I,O Pod.
C
C$ Detailed_Input
C
C ELEMS contains elements to be appended to the active group
C of POD.
C
C N is the number of elements in ELEMS.
C
C POD on input, is a pod.
C
C$ Detailed_Output
C
C POD on output, is the same pod, the active group of
C which ends with the new elements.
C
C$ Parameters
C
C None.
C
C$ Exceptions
C$
C 1) If N is not positive, the pod is not changed.
C
C 2) If there is insufficient room in the pod to append all
C ofthe new elements, the pod is not changed, and the error
C SPICE(TOOMANYPEAS) is signalled.
C
C$ Files
C
C None.
C
C$ Particulars
C
C This is a slightly more general version of APPND, which appends
C a single item to a cell or to the active group of a pod. PODAE
C allows you to append several items with a single subroutine call.
C
C$ Examples
C
C Elements can be appended to a POD by hand,
C
C END = CARDD ( POD )
C
C DO I = 1, N
C POD(END+I) = ELEMS(I)
C END DO
C
C CALL SCARDD ( END + N, POD )
C
C However, this is tedious, and it gets worse when you have to
C check for possible overflow. PODAE accomplishes the same thing,
C
C CALL PODAED ( ELEMS, N, POD )
C
C more simply, and with error-handling built in.
C
C$ Restrictions
C
C 1) In any pod, only the active group should be accessed,
C and its location should always be determined by PODBE
C or PODON. Never assume that the active group begins
C at POD(1).
C
C$ Literature_References
C
C None.
C
C$ Author_and_Institution
C
C W.L. Taber (JPL)
C I.M. Underwood (JPL)
C
C$ Version
C
C- SUPPORT Version 1.1.0, 24-DEC-2001 (NJB)
C
C Bug fix: END is now intialized before use in
C constructing error message.
C
C- Beta Version 1.0.0, 15-JUL-1989 (WLT) (IMU)
C
C
C-&
C
C SPICELIB functions
C
INTEGER CARDD
INTEGER SIZED
LOGICAL RETURN
C
C Local Variables
C
INTEGER END
INTEGER I
C
C Standard SPICE error handling.
C
IF ( RETURN () ) THEN
RETURN
ELSE
CALL CHKIN ( 'PODAED' )
END IF
C
C We can't append a non-positive number of items.
C
IF ( N .LT. 1 ) THEN
CALL CHKOUT ( 'PODAED' )
RETURN
END IF
C
C First see if there is room in the pod to append N elements.
C If not, bail out.
C
END = CARDD ( POD )
IF ( SIZED( POD ) .LT. ( END + N ) ) THEN
CALL SETMSG ( 'Cannot fit # elements into # spaces.' )
CALL ERRINT ( '#', N )
CALL ERRINT ( '#', SIZED(POD) - END )
CALL SIGERR ( 'SPICE(TOOMANYPEAS)' )
C
C There is ample room, so we find out where the end of the
C active group is and simply loop through the individual
C copies of ELEMS, adjusting the cardinality afterwards.
C (Just like in $Examples, above.)
C
ELSE
DO I = 1, N
POD(END+I) = ELEMS(I)
END DO
CALL SCARDD ( END + N, POD )
END IF
CALL CHKOUT ( 'PODAED' )
RETURN
END
|
subroutine tetwt4x_dev(omg,q, eband1,eband2,
i qbas,ginv,efermi,
i ntetf, nqbzw, nband,nqbz,
i nctot,ecore, idtetf,qbzw,ib1bz, chipm,
o wgt,nwgt,
i iq,isp1,isp2,nqibz) ! new input for mtett
use keyvalue
C- Obtain weights for Dielectric function by tetrahedron method.
Ci omg = omega in Hartree unit! complex! omg might be 1d-8 or so
Ci to choose the correct log branch for intvvc and so on.
Ci q = q-vector in x(q,iw) 2*pi*q(1:3)/alat is the true q.
Ci qbas = base reciprocal lattice vectors
Ci ginv = inverse of qbas s. indxrk.f
Ci efermi = Fermi level in Rydberg
Ci eband1 = eigenvalues for k
Ci eband2 = eigenvalues for q+k
Ci ecore = eigenvalues for core
Ci ,where k runs in the Full 1st BZ, not only in IBZ.
Ci idtetf,qbzw,ib1bz = outputs from TETFBZF, which should be called before calling tetwt4.
Ci nctot = the number of core
Ci nband = total number of bands
Ci nqbz = number of k-points in the 1st BZ
Ci n1,n2,n3= divisions along base reciprocal lattice vectors
Co wgt : integration weight for the Lindhard function. complex. wgt(band indexfor k, band indexfor q+k,k)
Co nwgt: the number of non-zero weights for each k.
C-----------------------------------
Cr ek = eigenvalues at k-points in the 1st BZ
Cr ekq = eigenvalues at k+q, k in the 1st BZ
C
Cr
Cr See J.Rath&A.J.Freeman PRB11(6) p.2109(1975).
Cr
Crr The numbering of band index is not unique due to degeneracy.
Crr It affects how to choose tetrahedron. As a result, it affect on
Crr the integration weight, and it might break the crystal symmetry.
Crr So I add symmetrization at the last in this routine so as to recover the symmetry.
Cr
Cr subroutine lindtet3 is the main part to calculate
Cr the microcell integral, \int dk1 dk2 dk3 f(e(k)) (1-f(e(q+k)))/ (omg- e(q+k) + e(k) ),
Cr where e(q+k) is unoccupied, e(k) is occupied,
Cr and f(E) denote the Fermi distribution funciton. Only for T=0.
Cr omg is complex. omg could be 1d-8 or so to choose the correct log branch.
Cr
Cr Their algorism requires rather tedious classifications due to the input eigenvalues.
Cr So I am afraid that the smoothness might be not fine.
Cr There are some room to improve this routine, mainly in intttvc,
Cr which is the core part of the tetrahedron method.
Cr The parameters eps and so on in the funtion intttvc might not be optimum.
Cr These parameters (and classification) are necessary to avoid to give out of range argumets.
Cr e.g., to avoid denominators in intv4c divergent.
c takao kotani Aug 2000.
c
c I improved intttvc to intttvc2. It sould be a bit better but
c I am not completely sure whetehre there are no numerically dengerous case or not.
c takao kotani Apr 2002
implicit none
c---in out -------------------------------
integer(4) :: ntetf, nqbzw,nband,nqbz,nctot,
& idtetf(0:3,ntetf),ib1bz(nqbzw), nwgt(nqbz)
real(8) :: q(3),
& eband1(nband,nqbz), eband2(nband,nqbz),
& qbas(3,3),ginv(3,3),efermi,
& ecore(nctot), qbzw(3,nqbzw)
complex(8):: omg, wgt(nband+nctot,nband,nqbz)
c----------------------------------
integer(4):: ntet, itet,ic, ib,jb
real(8) :: ek(nband,0:3), ekq(nband,0:3),
& qk(3),qkm(3),qbz(3) !,qbzm(3) !,rk(3,nqbz)
C- For tetrahedra
integer(4):: kk(0:3),kq(0:3),kr(0:3),i ,j
real(8) :: det33 ,
& kvec(3,0:3), ea(0:3), eb(0:3) ,x(0:3),am(3,3)
complex(8):: wtt(0:3,3)
c
integer(4):: noccx_kxx, noccx_k, noccx_kq, noccx1
real(8),parameter:: eps=0d0 !1d-12 ! cutoff check to determine cancellation.
logical ::prt=.false.
real(8) :: ek_(nband+nctot,0:3), ekq_(nband+nctot,0:3),voltot,volt
c
integer(4):: irnk1, nrank1, irnk2, nrank2,nibib,kx,nrankc,
& ires((nband+nctot)**2), iof1,iof2,
& ini1(nband+nctot),ied1(nband+nctot), ixi1,ixi2,ixe1,ixe2,
& ini2(nband+nctot),ied2(nband+nctot)
real(8):: ekqxx(nband+nctot),summ
c real(8):: ekxx1(nband+nctot,nqbz),ekxx2(nband+nctot,nqbz)
complex(8):: wmean,wttx,a1,a2,wgtA,wgtB
integer(4):: kqxx(nqbz), ik,ibx,nbnc,nb1
logical :: ipr=.false.
real(8),parameter:: pii=3.1415926535897932d0
integer:: idim,ivec !,ixc
logical :: chipm
complex(8),allocatable:: wgt1(:,:)
c-devided tet
integer(4):: nmtet,nqbzwm,nqbzm,ntetfm
integer(4),allocatable:: idtetfm(:,:,:),ib1bzm(:)!,index_qbzm(:,:,:)
real(8),allocatable:: qbzm(:,:),qbzwm(:,:)
real(8),allocatable:: ekxx1(:,:),ekxx2(:,:)
integer(4)::kkm(0:3),kvecm(1:3, 0:3),ifeig,ifmtet,nqnumm,kqxxm,kqxxm2
& ,n,nsp,nband_x,kp,im !,n_index_qbzm
real(8),allocatable:: ekzz1(:,:),ekzz2(:,:),eigtet(:,:,:),wtet(:,:,:)
real(8)::qdummy(3)
integer(4)::iq,nqibz,mtet(3), iqx,ispx, ix1,iy1,iz1,verbose,iqindx
logical ::mtett !,readgwinput
real(8):: scissors_x0
logical :: testsemif,chkwrt=.false.,iwarn=.true.
integer(4):: isp1,isp2
c-----------------------------------------------------------------------
if(verbose()>=80) chkwrt=.true.
ipr=chkwrt
if(ipr) write(6,*) ' tetwt4x_dev: '
voltot = abs(det33(qbas))
ntet = ntetf !6*n1*n2*n3
*poption noparallel
wgt = 0d0
c
c isp1=isp
c isp2=isp
c if(ixc==22.or.ixc==23) then
c if(isp==1) isp2=2
c if(isp==2) isp2=1
c endif
c--------------------------------------------------------------------
c call cputid (0)
c write(6,*) ' *** q=',q(1:3)
c write(6,*) ' qbas ='; write(6,"(3f10.5)")(qbas(1:3,i),i=1,3)
c write(6,*) ' vol tot =',voltot
c write(6,*) ' vol of tet =',det33(qbas)/(n1*n2*n3*6)
c write(6,*) ' efermi=',efermi
c write(6,*) ' nctot nband =',nctot,nband
c write(6,*) ' nqbz =',nqbz
c do i=1,nctot
c write(6,"(' ecore=',i3,f10.5)")i, ecore(i)
c enddo
c--- devided-tetrahedron method.
mtet=(/1,1,1/)
c if(readgwinput())
call getkeyvalue("GWinput","multitet",mtet,3,default=(/1,1,1/))
if(sum(abs(mtet))/=3) then
mtett=.true.
if(sum(abs(mtet))>3) then
write(6,*) ' we use devided-tetrahedron scheme mtet=',mtet
elseif(sum(mtet)/=6) then
Cstop2rx 2013.08.09 kino stop ' now only mtet 2 2 2 is allowed '
call rx( ' now only mtet 2 2 2 is allowed ')
endif
else
mtett=.false.
endif
if(mtett) then
ifmtet=501
open (ifmtet, file='mtet',form='unformatted')
read(ifmtet) nmtet,nqbzwm,nqbzm,ntetfm !,n_index_qbzm
allocate(
& idtetfm(0:3,nmtet,ntetf), qbzwm(3,nqbzwm),
! Index for tetrahedron; qbzmw(idtetfm) gives extended q vector.
& ib1bzm(nqbzwm), qbzm(3,nqbzm) !,index_qbzm(n_index_qbzm,n_index_qbzm,n_index_qbzm)
! qbzm(1:3,ib1bz(iq)) gives q vector within the 1st bz.
& , wtet(0:3,nmtet,ntetf) )
read(ifmtet) idtetfm,ib1bzm,qbzm,qbzwm, wtet !,index_qbzm
cccccccccccccccccccccccccccccccccccccccc
c do ix1=1,n_index_qbzm
c do iy1=1,n_index_qbzm
c do iz1=1,n_index_qbzm
c write(6,"(' ix iy iz=',3i5,' index=',i5)")ix1,iy1,iz1,index_qbzm(ix1,iy1,iz1)
c enddo
c enddo
c enddo
c stop 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx test xxxxxxxxxxx'
ccccccccccccccccccccccccccccccccccccccc
close(ifmtet)
ifeig=501
open (ifeig,file='eigmtet',form='unformatted')
read(ifeig) nband_x,nqnumm,nsp
write(6,*)'readin eigmtet ', nband_x,nqnumm,nsp
if(nband_x /=nband ) then
Cstop2rx 2013.08.09 kino stop 'tetwt5: nband_x /=nband'
call rx( 'tetwt5: nband_x /=nband')
endif
allocate( eigtet(nband,nqnumm,nsp) )
do iqx=1,nqnumm
do ispx=1,nsp
read (ifeig) eigtet(1:nband,iqx,ispx)
if(verbose()>50) write(6,"('iq=',i3,' eig(1:5)=',5f10.4)")iqx,eigtet(1:5,iqx,ispx)
enddo
enddo
close(ifeig)
else
nmtet = 1
nqbzwm= nqbzw
nqbzm = nqbz
allocate(
& idtetfm(0:3,nmtet,ntetf), qbzwm(3,nqbzwm),
& ib1bzm(nqbzwm), qbzm(3,nqbzm), wtet(0:3,nmtet,ntetf) )
idtetfm(:,1,:)=idtetf
qbzwm =qbzw
ib1bzm=ib1bz
wtet=0.25d0
endif
c---------------------------------------------------------
allocate( wgt1(nband+nctot,nband) )
nbnc = nband+nctot
nb1 = nband+1
allocate( ekxx1(nband+nctot,nqbz),ekxx2(nband+nctot,nqbz))
do kx = 1, nqbz
ekxx1( 1:nband, kx) = eband1(1:nband,kx)
ekxx2( 1:nband, kx) = eband2(1:nband,kx)
ekxx1( nband+1: nband+nctot, kx) = ecore(1:nctot)
ekxx2( nband+1: nband+nctot, kx) = ecore(1:nctot)
enddo
! eigenvalues at q and q+k ---------------------------------------
! ekzz1 for q
! ekzz2 for q+k.
allocate( ekzz1(nband+nctot,nqbzm),ekzz2(nband+nctot,nqbzm))
if(mtett) then
do kx = 1, nqbzm
ekzz1( 1:nband, kx) = eigtet(1:nband,kx,isp1)
ekzz1( nband+1: nband+nctot, kx) = ecore(1:nctot)
ekzz2( nband+1: nband+nctot, kx) = ecore(1:nctot)
enddo
if(iq<=nqibz) then
do kx = 1, nqbzm
! q(1:3)+qbzm(1:3,kx) ----> kqxxm
c write(6,*)' xxx3 ginv=',ginv
c write(6,*)' q+qbzm= ', q(1:3) + qbzm(1:3,kx)
c call fbz2 ( q(1:3) + qbzm(1:3,kx),
c i ginv ,index_qbzm,n_index_qbzm,qbzm,nqbzm,
c o qdummy,kqxxm)
cc--------
c call iqindx2(q(1:3)+qbzm(1:3,kx),ginv,qbzm,nqbzm,kqxxm, qdummy)
c write(6,*) 'kqxxm2 kqxxm=',kqxxm2,kqxxm
kqxxm = iqindx(q(1:3)+qbzm(1:3,kx),ginv,qbzm,nqbzm)
ekzz2(1:nband, kx) = eigtet(1:nband,kqxxm,isp2) !ekzz1(1:nband, kqxxm)
enddo
else
do kx = 1, nqbzm
kp = nqbzm *(iq - nqibz) + kx
ekzz2(1:nband, kx)= eigtet(1:nband,kp,isp2)
enddo
endif
else
ekzz1=ekxx1
ekzz2=ekxx2
endif
c--- 2004dec
if(scissors_x0()/=0d0) then
call addsciss(scissors_x0(),efermi,(nband+nctot)*nqbzm,
o ekzz1)
call addsciss(scissors_x0(),efermi,(nband+nctot)*nqbzm,
o ekzz2)
endif
C- Check
c volt = 0d0
c do itet = 1, ntet
c kvec(1:3,0:3) = qbzw (1:3, idtetf(0:3,itet) )
c do i = 1,3
c kvec(1:3,i) = kvec(1:3,i) - kvec(1:3,0)
c enddo
c volt = volt + abs(det33(kvec(1:3,1:3))/6d0)
c enddo
c if(abs(volt-voltot)>1d-10) stop ' tetwt: abs(volt-voltot)>1d-10'
C- Check
volt = 0d0
do itet = 1, ntetf
do im = 1, nmtet
kvec(1:3,0:3) = qbzwm (1:3, idtetfm(0:3,im,itet) )
do i = 1,3
kvec(1:3,i) = kvec(1:3,i) - kvec(1:3,0)
enddo
volt = volt + abs(det33(kvec(1:3,1:3))/6d0)
c write(6,"('itet im vol=',2i5,d13.5)") itet,im,abs(det33(kvec(1:3,1:3))/6d0)
enddo
enddo
c write(6,*)' xxx4 volt voltot=',volt,voltot
Cstop2rx 2013.08.09 kino if(abs(volt-voltot)>1d-10) stop ' tetwt: abs(volt-voltot)>1d-10'
if(abs(volt-voltot)>1d-10) call rx( ' tetwt: abs(volt-voltot)>1d-10')
c endif
C- kqxx(kx) ekxx
c do kx = 1, nqbz
c qk (1:3) = rk(1:3,kx) + q(1:3)
c qkm (1:3) = -qk(1:3) ! qkm = -k-q
c call fbz (qk, n1,n2,n3,qbas,ginv,indexk,
c o qbz, kqxx(kx) )
c write(1212,*) kx, kqxx(kx)
c write(6,*)' ekkdf chk=',
c & sum(ekxx1( 1:nband, kqxx(kx)) - ekxx2( 1:nband, kx)),
c & sum(ekxx1( 1:nband, kx))
c enddo
ccccccccc
c do kx = 1, nqbz
c call rwdd1 (ifev, kx, nband, ekxx(1:nband, kx))
c ekxx1(nband+1: nband+nctot, kx) = ecore(1:nctot)
c enddo
C- Loop over tetrahedron
*poption parallel
*poption psum(wgt( nband+nctot,nband,nqbz ) )
*poption tlocal( kk,kvec,kq,ek,ek_,ekq,ekq_ )
*poption tlocal( wttx,x, wgt1 )
*poption indep ( omg ,efermi )
do 1000 itet = 1, ntet
kk (0:3) = ib1bz( idtetf(0:3,itet) ) ! k
do 1100 im=1,nmtet
kkm (0:3) = ib1bzm( idtetfm(0:3,im,itet) ) ! k
kvec(1:3, 0:3) = qbzwm ( 1:3, idtetfm(0:3,im,itet) )
ek ( 1:nband, 0:3) = ekzz1( 1:nband, kkm(0:3)) ! k
ek_ ( 1:nband+nctot, 0:3) = ekzz1( 1:nband+nctot, kkm(0:3)) ! k
ekq ( 1:nband, 0:3) = ekzz2( 1:nband, kkm(0:3)) ! k+q
ekq_( 1:nband+nctot, 0:3) = ekzz2( 1:nband+nctot, kkm(0:3)) ! k+q
noccx_k = noccx1 (ek ,4,nband, efermi) !the highest number of occupied states (HNOS)
noccx_kq = noccx1 (ekq ,4,nband, efermi)
C*poption parallel
C*poption indep ( wgt,omg,kvec,ek_ ,ekq_)
C*poption tlocal( wttx,x )
c----------
do ibx = 1, noccx_k + nctot ! occupied
do jb = 1, nband ! unoccupied
c if(prt) write(6,*) '****** ib jb=',ib,jb
if(ibx <= noccx_k ) then
ib = ibx
else
ib = ibx - noccx_k + nband
endif
c$$$ccccccccccccccccccccccccccccccccccccccccccccccccc
c$$$ if(ib==4.and.jb==4.and.itet==2) then
c$$$ goto 1820
c$$$ endif
c$$$ wgt1(ib,jb) = 0d0
c$$$ cycle
c$$$ 1820 continue
c$$$ write(6,*)' test itet ib jb=',itet,ib,jb
c$$$cccccccccccccccccccccccccccccccccccccccccccccccccc
c----------
c do ib = 1, nband + nctot ! occupied
c do jb = 1, nband ! unoccupied
c if(prt) write(6,*) '****** ib jb=',ib,jb
c if( .not.(ib <= noccx_k .or. ib >= nband+1)) cycle
c----------
x(0:3) = .5d0*(ek_ (ib, 0:3) - ekq_(jb, 0:3)) ! + omg !Denominator. unit in Hartree.
ccccccccccccccccc
c if(testsemif().and.ibx==1) then
c! x(0:3) = -0.5d0*3.7d0 !test for Na
c x(0:3) = -0.5d0*1.14d0 !test for K
c endif
ccccccccccccccccc
if( sum(abs(x(0:3)+omg))<1d-8 ) cycle
if(chkwrt) then
write(6,"('### Goto lindtet3: itet ib jb Ef='
& ,i8,2i5,d12.4,' ###')" ) itet,ib,jb,efermi
write(6,"(' ek_ - Ef= ',4f10.3)") ek_ (ib, 0:3)-efermi
write(6,"(' ekq_- Ef= ',4f10.3)") ekq_ (jb, 0:3)-efermi
write(6,"(' -x(a.u.)= ',4f10.3)") -x(0:3)
endif
cccccccccccccccccccc
c omg= 0.150d0/2d0+ (0d0,1d-8)
ccccccccccccccccccc
c 1818 continue
ccccccccccccccccccccc
c if(chkwrt) then
c omg= omg+0.0001d0
c endif
cccccccccccccccccccc
if(chipm.and.isp1==2) then
wgtA=0d0
else
call lindtet3(omg,kvec,ek_(ib, 0:3),ekq_(jb, 0:3),
& x,efermi,wttx) ! kvec(1:3, 0:3), ea(0:3), x(0:3)
wgtA = wttx/4d0/voltot
endif
if(chipm.and.isp1==1) then
wgtB = 0d0
elseif(abs(omg)<1d-10.and.(.not.chipm)) then ! in the static case.
wgtB = wgtA
else
call lindtet3(-omg,kvec,ek_(ib, 0:3),ekq_(jb, 0:3),
& x,efermi,wttx)
wgtB = wttx/4d0/voltot
endif
wgt1(ib,jb) = wgtA + wgtB
if(chkwrt) then
write(6,"('ttt',3i4,f10.5,d12.4)") itet,ib,jb,dreal(omg),-dimag(wttx/pii)
c endif
c if(dreal(omg)>0.20d0/2d0) goto 1819
c goto 1818
c 1819 continue
c if(itet==ntetf) then
c write(6,*)' tetwt5: itet==ntetf'
c stop 'test end'
c endif
endif
c--- check for too large wttx -------------
#ifndef COMMENTOUTfor_PARALLEL
c write(6,"(' ib jb itet= ',3i5,' wgt= ',4d13.6)")
c & ib,jb,itet, wgt1(ib,jb)-wgt2,wgt2
if((abs(wgtA)>1d0.or.abs(wgtB)>1d0)
& .and.omg/=1d30.and.iwarn) then
write(6,*)' --- tetwt4: WARN! large tetrahedron weigt. ',
& ' The denominator omg+x for lindtet3 is rather large. ',
& ' This warn does not mean bug or fail of the calculation. ',
& ' But you may have to check the convergence for num of k. ',
& ' Or you could try another real-axis energy mesh!'
write(6,"(' ib jb itet= ',3i5,' wgt= ',4d13.6)")
& ib,jb,itet, wgtA,wgtB
write(6,*) ' 1 goto lindtet3 ef= ',efermi
write(6,*) ' omg=',omg
write(6,*) (kvec(1:3,i),i=0,3)
write(6,"('x =',4d23.16)") x (0:3)
write(6,"('ek_ =',4d23.16)") ek_ (ib, 0:3)
write(6,"('ekq_ =',4d23.16)") ekq_ (jb, 0:3)
write(6,*)' tetwt4: abs(wttx/4d0/voltot)>1d0 too large ?' !It seems too large
write(6,"('------- we omit this WARN hereafter! -------')")
iwarn=.false.
endif
#endif
c-----------
enddo
enddo
wgt(1:noccx_k,:,kk(0))= wgt(1:noccx_k,:,kk(0))+ wgt1(1:noccx_k,:)* 4*wtet(0,im,itet)
wgt(nb1:nbnc,: ,kk(0))= wgt(nb1:nbnc,: ,kk(0))+ wgt1(nb1:nbnc, :)* 4*wtet(0,im,itet)
wgt(1:noccx_k,:,kk(1))= wgt(1:noccx_k,:,kk(1))+ wgt1(1:noccx_k,:)* 4*wtet(1,im,itet)
wgt(nb1:nbnc,: ,kk(1))= wgt(nb1:nbnc,: ,kk(1))+ wgt1(nb1:nbnc, :)* 4*wtet(1,im,itet)
wgt(1:noccx_k,:,kk(2))= wgt(1:noccx_k,:,kk(2))+ wgt1(1:noccx_k,:)* 4*wtet(2,im,itet)
wgt(nb1:nbnc,: ,kk(2))= wgt(nb1:nbnc,: ,kk(2))+ wgt1(nb1:nbnc, :)* 4*wtet(2,im,itet)
wgt(1:noccx_k,:,kk(3))= wgt(1:noccx_k,:,kk(3))+ wgt1(1:noccx_k,:)* 4*wtet(3,im,itet)
wgt(nb1:nbnc,: ,kk(3))= wgt(nb1:nbnc,: ,kk(3))+ wgt1(nb1:nbnc, :)* 4*wtet(3,im,itet)
ccccccccccccccccccccccccccc
c write(6,*)' itet=',itet, sum(abs(wgt1)),' xxx=',sum(abs(wgt))
c write(6,*)' itet=',itet, noccx_k,nb1,nbnc,kk
cccccccccccccccccccccccccc
1100 continue
1000 continue
C- Symmetrization of wgt. ! We need special cares for degenerate cases.
*poption parallel
*poption indep( ekxx1,ekxx2,ekxx1, nband ,ipr, ecore, nctot ,wgt)
*poption tlocal( nrank1, ini1,ied1, nrank2, ini2,ied2, nrankc )
do kx = 1, nqbz ! ipr = .false.; if(ipr) write(6,*)' kx =',kx
call chkdgn( ekxx1(:,kx), nband, nrank1, ini1,ied1,0 ,ipr)
call chkdgn( ekxx2(:,kx), nband, nrank2, ini2,ied2,0 ,ipr)
nrankc = 0
if(nctot/=0) then
call chkdgn(ecore, nctot,
& nrankc, ini1(nrank1+1), ied1(nrank1+1), nband,ipr)
endif
c if(ipr) write(6,*)' kx nrank =',kx,nrank1,nrank2,nrankc
do irnk1 = 1, nrank1 + nrankc
do irnk2 = 1, nrank2
ixi1 = ini1(irnk1); ixe1 = ied1(irnk1)
ixi2 = ini2(irnk2); ixe2 = ied2(irnk2)
wmean = sum( wgt(ixi1:ixe1,ixi2:ixe2, kx ) )
& / ((ixe1-ixi1+1)*(ixe2-ixi2+1) )
wgt(ixi1:ixe1,ixi2:ixe2, kx ) = wmean
enddo
enddo
enddo
c
do ik =1, nqbz
nwgt(ik) = 0
do i =1, nband+nctot
do j =1, nband
Cstop2rx 2013.08.09 kino if(abs(wgt(i,j,ik) )>0d0 .and. j>nband) stop 'tetwt4: bug ?' ! bug checker
if(abs(wgt(i,j,ik) )>0d0 .and. j>nband) call rx( 'tetwt4: bug ?')
if(abs(wgt(i,j,ik) )>eps ) then
nwgt(ik) = nwgt(ik)+1
cc write(56,"(3i4,2d13.6)") i,j,ik, wgt(i,j,ik)
c if(abs(wgt(i,j,ik) )>0.1d0 )
c & write(6,"(' k i ik=',3i4,' wgt= ',2d13.6)")
c & i,j,ik, wgt(i,j,ik)
endif
enddo
enddo !; write(6,*)' ik=',ik,' num of nonzero wgt=',nwgt(ik)
enddo
c write(6,*)' max num of nonzero wgt(k)=',maxval(nwgt)
c write(6,*)' tot num of nonzero wgt =',sum(nwgt)
c write(6,*)' sum of wgt =',sum(wgt)
c write(6,*)' tetwt4: end '; call cputid (0)
write(6,"(' tetwt4_dev: omega maxval(nwgt(1:nqbz)) sum(nwgt)=',2f8.4,2i7
& ,' sum(wgt)=',2d13.6)") omg*2d0,maxval(nwgt),sum(nwgt),sum(wgt)
end
c----------------------------------------------------------------------
SUBROUTINE TETFBZF(icase,qbas, N1,N2,N3, rk,nqbz, IDTET,qbzw,ib1bz)
C- Finds tetrahedra in all 1st BZ. takao mod. from tertirr
C ----------------------------------------------------------------------
Ci Inputs:
Ci qb,n1,n2,n3,ipq, output from BZMESH;
Ci nq, no. of irreducible k-points;
Co Outputs:
Co ntet, No. of different tetrahedra
Co idtet(1-4,i), Identifies the i'th tetrahedron in terms of the four
Co idtet(0,i), no. of tetrahedra of the i'th kind
Cm Memory:
Cm No large internal storage; heap not accessed.
cr This require subroutine CCUTUP (lmto-3).
C ----------------------------------------------------------------------
IMPLICIT none
integer(4):: n1,n2,n3, indexkw(0:n1,0:n2,0:n3),nqbz,kount,
& indexk(0:n1-1,0:n2-1,0:n3-1),
& i,i1,i2,i3,j1,j2,j3, IPQ(N1,N2,N3),
. IBTR(3,3),KCUT(3,4,6),IMC(0:1,0:1,0:1),
. idtet(4, 6*n1*n2*n3),iq(4),
& ntet,k1,k2,k3,itet,ic
& ,ib1bz((n1+1)*(n2+1)*(n3+1)) ,icase
real(8) :: QB(3,3),QB1(3,3), qbas(3,3), rk(3,nqbz) ,qbzx(3)
& , qbzw(3,(n1+1)*(n2+1)*(n3+1)),hf
real(8),parameter :: epss = 1d-12
logical,save ::chk=.true.
c------------------------------------------------------------------
hf=0d0
if(icase==2) hf=0.5d0
QB(1:3,1) = QBAS(1:3,1)/N1
QB(1:3,2) = QBAS(1:3,2)/N2
QB(1:3,3) = QBAS(1:3,3)/N3
C- index for k in 1st BZ. See genqbz in BZ.FOR.
kount = 0
do i1 = 1,n1
do i2 = 1,n2
do i3 = 1,n3
kount = kount + 1
indexk(i1-1,i2-1,i3-1) = kount
c for check
if(chk) then
qbzx(1:3)= qb(1:3,1)*(i1-1+hf) +qb(1:3,2)*(i2-1+hf) +qb(1:3,3)*(i3-1+hf)
ccccccccccccccccccccc
c write(6,"(3d26.18)") rk(1:3,kount)
c write(6,"(3d26.18)") qbzx(1:3)
c write(6,*)
ccccccccccccccccccccc
if( sum(abs(rk(1:3,kount)-qbzx(1:3)) ) > epss )
Cstop2rx 2013.08.09 kino & stop 'tetfbzf: rk /= qbzx'
& call rx( 'tetfbzf: rk /= qbzx')
endif
end do
end do
end do
chk=.false.
Cstop2rx 2013.08.09 kino if (kount /= n1*n2*n3) stop ' kount: wrong no. k-points'
if (kount /= n1*n2*n3) call rx( ' kount: wrong no. k-points')
Cstop2rx 2013.08.09 kino if (nqbz /= n1*n2*n3) stop ' kount: wrong no. k-points'
if (nqbz /= n1*n2*n3) call rx( ' kount: wrong no. k-points')
cccccccccccccccccccccccccccc
c DO j1 = 0,n1-1
c DO j2 = 0,n2-1
c DO j3 = 0,n3-1
c write(6,"(' j1j2j3=',3i4,' ix=',i6)") J1,J2,J3,indexk(J1,J2,J3)
c enddo
c enddo
c enddo
c write(6,*)
cccccccccccccccccccccccccccc
kount = 0
do i1 = 1,n1+1
do i2 = 1,n2+1
do i3 = 1,n3+1
kount = kount + 1
indexkw(i1-1,i2-1,i3-1) = kount
qbzw(1:3,kount) =
& qb(1:3,1)*(i1-1+hf) + qb(1:3,2)*(i2-1+hf) + qb(1:3,3)*(i3-1+hf)
ib1bz(kount) = indexk(mod(i1-1,n1), mod(i2-1,n2), mod(i3-1,n3))
end do
end do
end do
c
CALL CCUTUP(QB,QB1,IBTR,KCUT) !This is from LMTO-3
ntet = 0
C ----- START LOOPING OVER MICROCELLS ---------
DO 20 I3 = 1, N3
DO 20 I2 = 1, N2
DO 20 I1 = 1, N1
C ----- SET UP IDENTIFIERS AT 8 CORNERS OF MICROCELL ------
c write(6,*)
DO 1 K1 = 0, 1
J1 = I1 -1 + K1
DO 1 K2 = 0, 1
J2 = I2 -1 + K2
DO 1 K3 = 0, 1
J3 = I3 -1 + K3
IMC(K1,K2,K3) = indexkw(J1,J2,J3)
cccccccccccccc
c write(6,"(' k1k2k3=',3i4,' ix=',i6,' ii=',2i6)")J1,J2,J3
c & ,indexkw(J1,J2,J3), ib1bz(indexkw(J1,J2,J3))
c & ,indexk(mod(j1,n1), mod(j2,n2), mod(j3,n3))
cccccccccccccc
1 continue
C ----- LOOP OVER TETRAHEDRA --------------
DO 10 ITET = 1, 6
DO 2 IC = 1, 4
K1 = KCUT(1,IC,ITET)
K2 = KCUT(2,IC,ITET)
K3 = KCUT(3,IC,ITET)
IQ(IC) = IMC(K1,K2,K3)
2 continue
ntet=ntet+1
do i = 1, 4
idtet(i,ntet) = iq(i)
enddo
10 CONTINUE
20 CONTINUE
write(6, "(1x,'TETFBZF: ',2i8 )") ntet, 6*n1*n2*n3
END
c-------------------
subroutine chkdgn(ene,ndat, nrank,ixini,ixend,iof,ipr)
implicit none
integer(4) :: ndat,i,ix, ixini(ndat),ixend(ndat),nrank,iof
real(8) :: ene(ndat), epsx=1d-4
logical ipr
if(ipr) write(6,*) 'chgdgn: ndat=',ndat
if(ndat<1) then
nrank =0
return
endif
ixini(1) = 1
if(ndat==1) then
ixend(1) = 1
nrank=1
return
endif
i = 1
*poption noparallel
do ix = 2, ndat
if( abs(ene(ix)-ene(ix-1)) >epsx ) then
ixend(i) = ix-1
i = i + 1
ixini(i) = ixend(i-1)+1
if(ix==ndat) then
ixend(i)=ix
endif
elseif(ix==ndat) then
ixend(i) = ndat
endif
enddo
c
nrank = i
*poption noparallel
do i =1,nrank
ixini(i) = ixini(i)+iof
ixend(i) = ixend(i)+iof
enddo
c-check write
if(ipr) then
write(6,*)' nrank=',nrank
do i = 1, ndat
write(6,"(' i ',i3,' ene=',d15.7)") i,ene(i)
enddo
print *
do i = 1, nrank
write(6,"(' i ',2i3,' e=',d15.7)")
& ixini(i),ixend(i),ene(ixini(i)-iof)
enddo
endif
end
c-------------------------------------------------------------------
subroutine lindtet3( omg, kvec, ea, eb, x, efermi, ! input
o wttx) ! output
C- Calculate the integral of \int dk1 dk2 dk3 f(ea)(1-f(eb))/x
C f(E) denote the Fermi distribution funciton. Only for T=0.
C Tetrahedon is specified by values at 4 corners; kvec(1:3, 1:4), ea(1:4), eb(1:4), x(1:4)
Cr This code is based on J.Rath&A.J.Freeman PRB11(6) p.2109(1975).
C---------------------------------------------------------------------------------
implicit none
integer(4) :: ieaord(1:4),i,isig,n,itmp,ix
real(8) :: kvec(1:3, 1:4), x(1:4), ea(1:4),
& kk(3,1:4),xx(1:4),ee(1:4), am(3,3), eb(1:4),ebf(1:4),ebfKx(1:4),
& vcell,efermi,etest , Kx(1:3,4),xKx(4)
complex(8) :: omg, wttx,inttetra3
integer(4):: verbose
logical :: debug=.false.
c-------------------------------
debug=.false.
if(verbose()>=110) debug=.true.
if(debug) then
write(996,*)' lindtet3: *****************************'
write(996,"(' i=',i3,' x ea eb =',3f10.5)")
& (i, x(i), ea(i)-efermi, eb(i)-efermi,i=4,1,-1)
endif
ccccccccc
#ifdef EXPAND_SORTEA
n=4
isig = 1
*poption noparallel
do i = 1,n
ieaord(i) = i
enddo
*poption noparallel
do ix= 2,n
*poption noparallel
do i=ix,2,-1
if( ea(ieaord(i-1)) >ea(ieaord(i) ) ) then
C#ifdef EXPAND_ISWAP
itmp = ieaord(i-1)
ieaord(i-1) = ieaord(i)
ieaord(i) = itmp
C#else
C call iswap (ieaord(i-1),ieaord(i))
C#endif
isig= -isig
cycle
endif
exit
enddo
enddo
ieaord(1:4) = ieaord(4:1:-1)
#else
call sortea( ea,ieaord, 4 ,isig); ieaord(1:4) = ieaord(4:1:-1)
#endif
! the order E_4,E_3,E_2,E_1 This suits for Rath&Freeman.
kk(1:3,1:4) = kvec(1:3,ieaord(1:4))
! 4 corners denoted by kvec(:,1:4), ee(1:4), and xx(1:4)
ee (1:4) = ea (ieaord(1:4)) - efermi
xx (1:4) = x (ieaord(1:4))
ebf(1:4) = eb (ieaord(1:4)) - efermi
ccccccccccccc
if(debug) then
write(996,"(' i iea=',2i4)") (i,ieaord(i),i=1,4)
write(996,"(' i=',i3,' xx ee ebf =',3f10.5,' kk=',3f10.5)")
& (i,xx(i),ee(i),ebf(i),kk(1:3,i),i=4,1,-1)
endif
ccccccccccccc
if( 0d0<=ee(4) ) then
wttx = (0d0,0d0)
elseif( ee(4) < 0d0 .and. 0d0<= ee(3) ) then !!! Fig 1.
if(debug) write(996,*) 'lindtet3: fig 1 xxx'
call midk3(kk,ee,xx,ebf, 4,2, Kx(1,1),xKx(1),ebfKx(1))
!K1 -> Kx(:,1), x(K1) -> xkx(1). K1 is on the like k4---k2.
call midk3(kk,ee,xx,ebf, 4,1, Kx(1,2),xKx(2),ebfKx(2)) !K2
call midk3(kk,ee,xx,ebf, 4,3, Kx(1,3),xKx(3),ebfKx(3)) !K3
wttx = inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/4,10,20,30/) ) ! k4,K1,K2,K3
elseif( ee(3) < 0d0 .and. 0d0<= ee(2) ) then !!! Fig 2.
if(debug) write(996,*) 'lindtet3: fig 2 xxx'
call midk3(kk,ee,xx,ebf, 4,2, Kx(1,1),xKx(1),ebfKx(1)) !K1
call midk3(kk,ee,xx,ebf, 4,1, Kx(1,2),xKx(2),ebfKx(2)) !K2
call midk3(kk,ee,xx,ebf, 3,1, Kx(1,3),xKx(3),ebfKx(3)) !K3
call midk3(kk,ee,xx,ebf, 3,2, Kx(1,4),xKx(4),ebfKx(4)) !K4
ccccccccccc
c write(6,*)'xxxx inttetra='
c & ,inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/4, 3,10,20/)) ! k4,k3,K1,K2
c write(6,*) omg,kk,xx,ebf
c write(6,*) ' Kx=',Kx,xKx,ebfKx
c write(6,*)'xxxx inttetra='
c & ,inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/3,20,30,10/)) ! k3,K2,K3,K1
c write(6,*) omg,kk,xx,ebf
c write(6,*) ' Kx=',Kx,xKx,ebfKx
c write(6,*)'xxxx inttetra='
c & ,inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/3,10,30,40/)) ! k3,K1,K3,K4
c write(6,*) omg,kk,xx,ebf
c write(6,*) ' Kx=',Kx,xKx,ebfKx
c stop ' ***************** end test ttt *****************'
ccccccccccc
wttx = inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/4, 3,10,20/)) ! k4,k3,K1,K2
& + inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/3,20,30,10/)) ! k3,K2,K3,K1
& + inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/3,10,30,40/)) ! k3,K1,K3,K4
elseif( ee(2) < 0d0 .and. 0d0<= ee(1) ) then !!! Fig 3.
if(debug) write(6,*) 'lindtet3: fig 3 xxx'
call midk3(kk,ee,xx,ebf, 1,4, Kx(1,1),xKx(1),ebfKx(1)) !K1
call midk3(kk,ee,xx,ebf, 1,2, Kx(1,2),xKx(2),ebfKx(2)) !K2
call midk3(kk,ee,xx,ebf, 1,3, Kx(1,3),xKx(3),ebfKx(3)) !K3
wttx = inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/3, 4,30, 2/)) ! k3,k4,K3,k2
& + inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/4,10,20,30/)) ! k4,K1,K2,K3
& + inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfKx,(/4, 2,20,30/)) ! k4,k2,K2,K3
cccccccccc test fulled cccccccccccccccccccccccccccccccccccc
cc & + inttetra(kk,xx,Kx,xKx, (/1, 10,20,30/) ) ! test fulling
cc write(6,*)' fulled test'
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
else
if(debug) write(996,*) 'lindtet3: fig 4 xxx'
wttx = inttetra3(omg,kk,xx,ebf,Kx,xKx,ebfkx,(/1,2,3,4/)) ! k1,k2,k3,k4
endif
end
c-----------------------------------
subroutine midk3(kk,ee,xx,yy,i,j, kout,xout,yout)
C- Calculate x and k(3) at the Fermi energy on the like k(i)---k(j).
implicit none
integer(4):: i,j
real(8) :: kk(3,1:4),xx(1:4),yy(1:4),ee(1:4), kout(3)
& ,xout,yout,ratio
ratio = ee(i)/(ee(i)-ee(j))
xout = xx(i) + ratio * (xx(j)-xx(i))
yout = yy(i) + ratio * (yy(j)-yy(i))
kout(1:3) = kk(1:3,i) + ratio * (kk(1:3,j)-kk(1:3,i))
end
c-----------------------------------
complex(8) function
& inttetra3(omg,kk_,xx_,ebf,Kx_,xKx_,ebfKx,itetx)
C calculate tetrahedron integral Eq.(16).
C the four corners and denoted by itetx.
Ci kk (k1-k4) and xx (value of denominator)
Ci Kx (K1-K4) and xkx
Cr The four corners are selected from 8 points. It is specified by itetx.
implicit none
integer(4):: itetx(4),ix,i,ieaord(4),isig,n,itmp
real(8) :: kk_(3,1:4),xx_(1:4),Kx_(3,1:4),xKx_(1:4),
!!!!!!!!!!!!!!!!! !BUGFIX ----> kx xkx ___>kx_,xkx_ 1999 mar
& kk(3,1:4),xx(1:4),ebf(1:4),ebfin(1:4)
& ,Kx(3,1:4),xKx(1:4),ebfKx(1:4),ee(4)
& ,kin(3,4), xin(4)
complex(8) :: omg,wttx,inttetrac
logical :: debug=.false.
c--- kk xin ebfin ---
do i = 1,4
if( itetx(i) < 10 ) then ! kk (k1-k4 in Paper)
ix = itetx(i)
xin( i) = xx_( ix)
ebfin(i) = ebf(ix)
kin(1:3,i) = kk_(1:3,ix)
else ! Kx (K1-K4 in Paper)
ix = itetx(i)/10
xin( i) = xKx_( ix)
ebfin(i) = ebfKx(ix)
kin(1:3,i) = Kx_ (1:3,ix)
endif
enddo
c write(6,*) ' ebf =', ebf
c write(6,*) ' ebfkx=', ebfkx
c write(6,"(' i=',i3,' xin ebfin =',2f10.5,' kin=',3f10.5)")
c & (i,xin(i),ebfin(i),kin(1:3,i),i=4,1,-1)
c ee decendent order ee(4)>ee(3)>ee(2)>ee(1)
#ifdef EXPAND_SORTEA
n = 4
isig = 1
*poption noparallel
do i = 1,n
ieaord(i) = i
enddo
*poption noparallel
do ix= 2,n
*poption noparallel
do i=ix,2,-1
if( ebfin(ieaord(i-1)) >ebfin(ieaord(i) ) ) then
C#ifdef EXPAND_ISWAP
itmp = ieaord(i-1)
ieaord(i-1) = ieaord(i)
ieaord(i) = itmp
C#else
C call iswap (ieaord(i-1),ieaord(i))
C#endif
isig= -isig
cycle
endif
exit
enddo
enddo
#else
call sortea( ebfin,ieaord, 4 ,isig) ! the order E_4,E_3,E_2,E_1 This suits for Rath&Freeman.
#endif
kk(1:3,1:4) = kin (1:3,ieaord(1:4)) ! 4 corners denoted by kvec(:,1:4), ee(1:4), and xx(1:4)
ee( 1:4) = ebfin( ieaord(1:4))
xx( 1:4) = xin ( ieaord(1:4))
cccc
if(debug) then
write(996,*)' inttetra3: ***** '
write(996,"(' i=',i3,' xx ee =',2f10.5,' kk=',3f10.5)")
& (i,xx(i),ee(i),kk(1:3,i),i=4,1,-1)
endif
cccc
if( 0d0>=ee(4) ) then
wttx = (0d0,0d0)
elseif( ee(4) > 0d0 .and. 0d0>= ee(3) ) then !!! Fig 1.
if(debug) write(996,*)' intterra3: fig1'
call midk(kk,ee,xx, 4,2, Kx(1,1),xKx(1)) !K1 -> Kx(:,1), x(K1) -> xkx(1). K1 is on the like k4---k2.
call midk(kk,ee,xx, 4,1, Kx(1,2),xKx(2)) !K2
call midk(kk,ee,xx, 4,3, Kx(1,3),xKx(3)) !K3
wttx = inttetrac(omg,kk,xx,Kx,xKx, (/4,10,20,30/)) ! k4,K1,K2,K3
elseif( ee(3) > 0d0 .and. 0d0>= ee(2) ) then !!! Fig 2.
if(debug) write(996,*)' intterra3: fig2'
call midk(kk,ee,xx, 4,2, Kx(1,1),xKx(1)) !K1
call midk(kk,ee,xx, 4,1, Kx(1,2),xKx(2)) !K2
call midk(kk,ee,xx, 3,1, Kx(1,3),xKx(3)) !K3
call midk(kk,ee,xx, 3,2, Kx(1,4),xKx(4)) !K4
wttx = inttetrac(omg,kk,xx,Kx,xKx, (/4, 3,10,20/)) ! k4,k3,K1,K2
& + inttetrac(omg,kk,xx,Kx,xKx, (/3,20,30,10/)) ! k3,K2,K3,K1
& + inttetrac(omg,kk,xx,Kx,xKx, (/3,10,30,40/)) ! k3,K1,K3,K4
elseif( ee(2) > 0d0 .and. 0d0>= ee(1) ) then !!! Fig 3.
if(debug) write(996,*)' intterra3: fig3'
call midk(kk,ee,xx, 1,4, Kx(1,1),xKx(1)) !K1
call midk(kk,ee,xx, 1,2, Kx(1,2),xKx(2)) !K2
call midk(kk,ee,xx, 1,3, Kx(1,3),xKx(3)) !K3
wttx = inttetrac(omg,kk,xx,Kx,xKx, (/3, 4,30, 2/)) ! k3,k4,K3,k2
& + inttetrac(omg,kk,xx,Kx,xKx, (/4,10,20,30/)) ! k4,K1,K2,K3
& + inttetrac(omg,kk,xx,Kx,xKx, (/4, 2,20,30/)) ! k4,k2,K2,K3
else
wttx = inttetrac(omg,kk,xx,Kx,xKx, (/1,2,3,4/) ) ! k1,k2,k3,k4
if(debug) write(996,*)' intterra3: fig4'
endif
inttetra3 = wttx
end
c-----------------------------------
complex(8) function inttetrac(omg,kk,xx, Kx,xKx,itetx)
C calculate tetrahedron integral Eq.(16).
C the four corners and denoted by itetx.
Ci kk (k1-k4) and xx (value of denominator)
Ci Kx (K1-K4) and xkx
Cr The four corners are selected from 8 points. It is specified by itetx.
implicit none
integer(4):: itetx(4),ix,i
real(8) :: kk(3,1:4),xx(1:4), Kx(3,1:4),xKx(1:4), am(3,3)
& ,kin(3,4), xin(4), det33, intttvv, intttv,intvv,work
complex(8) :: omg,intttvc2,aaa
logical:: debug=.false.
c
if(omg==1d30.or. omg==-1d30) then
inttetrac = 1d0 !this mode is only for cont the non-zero pairs, occu and unocc
return
endif
do i = 1,4
if( itetx(i) < 10 ) then ! kk (k1-k4 in Paper)
ix = itetx(i)
xin( i) = xx( ix)
kin(1:3,i) = kk(1:3,ix)
else ! Kx (K1-K4 in Paper)
ix = itetx(i)/10
xin( i) = xKx( ix)
kin(1:3,i) = Kx (1:3,ix)
endif
enddo
do i = 1,3
am(1:3,i) = kin(1:3,i) - kin(1:3,4)
enddo
inttetrac = intttvc2(omg,xin) * abs(det33(am)/6d0) ! \omega (volume of tetrahedra) = abs(det33(am)/6d0) See Eq. (17).
cccccccccccccccccccccccccc
if(debug) then
write(996,"(' omg abs(det33(am)/6d0) =',2d13.5,3x,4d13.5)")
& omg,abs(det33(am)/6d0)
write(996,"(' xin =',4d13.5)") xin
write(996,"(' inttetrac =',4d13.5)") inttetrac
write(996,*)
endif
ccccccccccccccccccccccccccccc
end
c------------------------------------------------------
complex(8) function intttvc2(omg,v)
C- Tetrahedron integral. Eq.(16). (except volume factor).
Ci v(1:4) + omg : denominator for integration.
Ci includ imaginary part
implicit none
complex(8) :: vvvc,intvvc,intv4c,intv3c,intv2c
integer(4) :: ieaord(1:4),i,isig,idif(3),idf,ix,n,itmp
real(8) :: v(4),VV(4),v1,v2,v3,v4,d1,d2,d3,
& vvd,vvas,vvv,diffc
& ,aaa2,e1,e2,e3,e4,f0,f1,f3,ee
logical ::debug=.false.
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c real(8),parameter :: eps = 1d-4 ! Judge coincidence.
real(8),parameter :: eps = 1d-3 ! Judge coincidence. Safer
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
complex(8) omg
#ifdef EXPAND_SORTEA
n=4
isig = 1
*poption noparallel
do i = 1,n
ieaord(i) = i
enddo
*poption noparallel
do ix= 2,n
*poption noparallel
do i=ix,2,-1
if( v(ieaord(i-1)) > v(ieaord(i) ) ) then
C#ifdef EXPAND_ISWAP
itmp = ieaord(i-1)
ieaord(i-1) = ieaord(i)
ieaord(i) = itmp
C#else
C call iswap (ieaord(i-1),ieaord(i))
C#endif
isig= -isig
cycle
endif
exit
enddo
enddo
VV(1:4) = V(ieaord(1:4)) !vv is ordered
#else
call sortea( v,ieaord,4,isig); VV(1:4) = V(ieaord(1:4)) !vv is ordered
#endif
vvas = sum(abs(vv(1:4))) ! ;write(6,*)'vvas=',vvas
diffc= max(eps,eps*vvas)
idf = 0
do i = 1,3
if( abs( VV(i)-VV(i+1) ) < diffc ) idf= idf+10**(3-i)
enddo
if(debug) then
write(996,"(' xxx vv=',4d23.15,' idf= ',i3)")
& vv(1),vv(2),vv(3),vv(4),idf
endif
c if( abs( VV(1)-VV(4) ) < eps2*vvas+1d-4) idf = 111
if( idf==111 ) then !2002 apr
VVVC = (VV(1)+VV(2)+VV(3)+VV(4))/4
vv(1) = vvvc -.5d0*diffc
vv(2) = vvvc -.5d0*diffc
vv(3) = vvvc +.5d0*diffc
vv(4) = vvvc +.5d0*diffc
idf = 101
elseif(idf==011) then
vv(4)= vv(3)+diffc
idf = 010
elseif(idf==110) then
vv(1)=vv(2) -diffc
idf = 010
endif
if(debug) then
write(996,"(' yyy vv=',4d23.15,' idf= ',i3)")
& vv(1),vv(2),vv(3),vv(4),idf
endif
! Possible values of idf are denoted by ijk, where i,j and k can be 0 or 1.
! 1 means corresponding vv are the same.
intttvc2 = (0d0,0d0)
if( idf== 000 ) then
intttvc2 = intvvc(omg,vv)
elseif(idf== 100 ) then
VVV = (VV(1)+VV(2))/2
V3 = VV(3)
V4 = VV(4)
intttvc2 = intv4c(omg,vvv,v3,v4)
elseif(idf== 010 ) then
VVV = (VV(2)+VV(3))/2
V3 = VV(1)
V4 = VV(4)
intttvc2 = intv4c(omg,vvv,v3,v4)
elseif(idf== 001 ) then
VVV = (VV(3)+VV(4))/2
V3 = VV(1)
V4 = VV(2)
intttvc2 = intv4c(omg,vvv,v3,v4)
elseif(idf== 101 ) then
VVV = (VV(1)+VV(2))/2
VVd = (VV(3)+VV(4))/2
intttvc2 = intv3c(omg,vvv,vvd)
else
Cstop2rx 2013.08.09 kino stop 'intttvc2: idf wrong...'
call rx( 'intttvc2: idf wrong...')
c elseif(idf== 110 ) then
c VVV = (VV(1)+VV(2)+VV(3))/3
c V4 = VV(4)
c if( abs(vvv+omg)>eps3 ) intttvc2 = intv2c(omg,VVV,v4)
c elseif(idf== 011 ) then
c VVV = (VV(2)+VV(3)+VV(4))/3
c V4 = VV(1)
c if( abs(vvv+omg)>eps3 ) intttvc2 = intv2c(omg,VVV,v4)
c elseif(idf== 111 ) then
c VVVC = (VV(1)+VV(2)+VV(3)+VV(4))/4 + omg
c if( abs(vvvc)>eps3 ) intttvc2 = 1d0/vvvc
endif
end
c-----------------------------------
complex(8) function intvvc(omg,vv)
implicit none
complex(8):: omg,v1c,v2c,v3c,v4c,intvvcc
real(8) :: vv(4),v1,v2,v3,v4,d1,d2,d3
V1=VV(1); V2=VV(2); V3=VV(3); V4=VV(4)
if(v1 ==0) v1 =1d-15
if(v2 ==0) v2 =1d-15
if(v3 ==0) v3 =1d-15
if(v4 ==0) v4 =1d-15
D1 = (V1-V4)*(V1-V2)*(V1-V3)
D2 = (V2-V4)*(V2-V3)*(V2-V1)
D3 = (V3-V4)*(V3-V1)*(V3-V2)
v1c = V1+omg
v2c = V2+omg
v3c = V3+omg
v4c = V4+omg
intvvcc = V1c**2/D1*log(V1c/V4c) ! Rath&Freeman Eq.(17)
& + V2c**2/D2*log(V2c/V4c)
& + V3c**2/D3*log(V3c/V4c)
intvvc = 3*intvvcc
end
c------------
complex(8) function intv4c(omg,v,v3,v4) !case (iv) at page 2113.
implicit none
complex(8):: omg,v3c,v4c,vc,intv4cc,xfun,x3,x4,dxfun
real(8) :: v,v3,v4
if(v ==0) v =1d-15
if(v3==0) v3=1d-15
if(v4==0) v4=1d-15
v3c = V3+omg
v4c = V4+omg
vc = V +omg
c ---case4
x3 = ( V -V3 )/V3c
x4 = ( V -V4 )/V4c
intv4c = 3d0* ( xfun(x3) - xfun(x4) )/(v3-v4)
c write(996,"('intv4c: case4 x3',2d13.5)") x3
c write(996,"(' x4',2d13.5)") x4
c--- case1
cc write(996,"('intv4c: case1'))")
c intv4cc= V3c**2/(v3-v)**2/(v3-v4)*log(V3c/Vc)
c & + V4c**2/(v4-v)**2/(v4-v3)*log(V4c/Vc)
c & + Vc/(v3-v)/(v4-v)
c intv4c = 3*intv4cc
c--- case2
c write(996,"('intv4c: case2'))")
c intv4cc= 1d0/(v3-v4) * (
c & 1d0/(v3-v) * ( V3c**2* log(V3c/Vc)/(v3-v) - Vc )
c & - 1d0/(v4-v) * ( V4c**2* log(V4c/Vc)/(v4-v) - Vc )
c & )
c intv4c = 3*intv4cc
c---case3
c write(996,"('intv4c: case3'))")
c intv4c= 3d0/(v3-v4) * (
c & V3c**2/(v3-v)**2 * (log(V3c/Vc) -1d0 + vc/v3c)
c & - V4c**2/(v4-v)**2 * (log(V4c/Vc) -1d0 + vc/v4c)
c & )
c return
ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c write(996,"('intv4c-1:', 2d13.5))")
c & 1d0/(v3-v4) *( 1d0/(v3-v) * ( V3c**2* log(V3c/Vc)/(v3-v) - Vc))
c write(996,"('intv4c-2:', 2d13.5))")
c & 1d0/(v3-v4) *( 1d0/(v4-v) * ( V4c**2* log(V4c/Vc)/(v4-v) - Vc))
c write(996,"('intv4c:', 2d13.5))")
c & V4c**2/(v4-v)**2/(v4-v3)*log(V4c/Vc)
c write(996,"('intv4c:', 2d13.5))")
c & Vc/(v3-v)/(v4-v)
cccccccccccccccccccccccccccccccccccccccccccccdddddddd
end
c----------------------------
complex(8) function xfun(x)
complex(8) :: x,y,a
if(abs(x)<1d-1) then
a = -x
xfun = 0d0
do n = 20,3,-1
xfun = xfun*a +1d0/n !honar procedure
enddo
xfun = xfun*a
else
xfun= ( (1d0-x/2d0)*x - log(1d0+x) )/x**2
endif
end
c------------
complex(8) function intv3c(omg,v,vd)
implicit none
complex(8):: omg,vc,vdc,intv3cc,x,xfun2
& ,intv3cx,intv3cy,xfun3
real(8) :: v,vd
c integer(4),save :: ic=0
if(v ==0) v =1d-15
if(vd==0) vd=1d-15
c-case2 numerically better
vc = V +omg
vdc = Vd+omg
x = vdc/vc -1d0
intv3c = 3*vc*xfun2(x)/(v-vd)**2
c-case1
c vc = V +omg
c vdc = Vd+omg
c intv3cc = (2*vc*vdc/(v-vd)*log(vdc/vc) + (vc+vdc))
c & /(v-vd)**2
c intv3c = 3*intv3cc
cccccccccccccccccccccccccccccccccccccccccccccccccc
c ic=ic+1
c intv3cy = 3*vc*xfun3(x)/(v-vd)**2
c write(996,"('3',i7,2d12.4,2f10.5))") ic,omg,v,vd
c write(996,"('3',i7,2d16.8))") ic,intv3c
c write(996,"(8x,2d16.8))") intv3cx
c write(996,"(8x,2d16.8))") intv3cy
c write(996,*)
cccccccccccccccccccccccccccccccccccccccccccccccccc
end
c------------
c complex(8) function xfun3(x)
c complex(8) x
c xfun3 = x + 2 - 2*(1+x)*log(1+x)/ x
c end
c------------
complex(8) function xfun2(x)
complex(8) x,a,xxx,xxx1,xxx2
if(abs(x)<1d-1) then
a = -x
xfun2 = 0d0
do n = 20,3,-1
xfun2 = xfun2*a +1d0/n !honar procedure
enddo
xfun2 = (-xfun2* 2*(1+x) +1d0 )* x**2
else
xfun2 = x + 2 - 2*(1+x)*log(1+x)/ x
endif
end
c------------
complex(8) function intv2c(omg,v,v4)
implicit none
complex(8):: omg,vc,v4c,intv2cc
real(8) :: v,v4
if(v ==0) v =1d-15
if(v4==0) v4=1d-15
vc = V +omg
v4c = V4+omg
intv2cc = v4c**2/(v-v4)**3* log(vc/v4c)
& + (1.5d0*v4c**2 + .5d0*vc**2 - 2*vc*v4c) /(v-v4)**3
intv2c = 3*intv2cc
end
c--------------------------------------
real(8) function det33(am)
implicit none
real(8),intent(in) :: am(3,3)
det33= am(1,1)*am(2,2)*am(3,3)
& -am(1,1)*am(3,2)*am(2,3)
& -am(2,1)*am(1,2)*am(3,3)
& +am(2,1)*am(3,2)*am(1,3)
& +am(3,1)*am(1,2)*am(2,3)
& -am(3,1)*am(2,2)*am(1,3)
end
c--------------------------------------
subroutine midk(kk,ee,xx,i,j, kout,xout)
C- Calculate x and k(3) at the Fermi energy on the like k(i)---k(j).
real(8) :: kk(3,1:4),xx(1:4),ee(1:4), kout(3),xout
ratio = ee(i)/(ee(i)-ee(j))
xout = xx(i) + ratio * (xx(j)-xx(i))
kout(1:3) = kk(1:3,i) + ratio * (kk(1:3,j)-kk(1:3,i))
end
c---------------------------------------------------------------
subroutine rsvwwk(wgt, nqbz,nband,nctot,nbnbx,
o n1b,n2b,wwk,noccxv,nbnb)
C- Convert wgt to wwk
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix
integer(4) :: n1b(nbnbx,nqbz),n2b(nbnbx,nqbz),noccxv,nbnb(nqbz)
complex(8) :: wgt(nband+nctot,nband,nqbz), wwk(nbnbx,nqbz)
cccccccccccccccccccccc
c cutoff for tetrahedron weight!
real(8),parameter :: eps = 0d0
cccccccccccccccccccccc
wwk = 0d0
noccxv = 0
do kx = 1, nqbz
ix = 0
do ib = 1, nband + nctot
do jb = 1, nband
if( abs(wgt(ib,jb,kx)) >eps) then
ix = ix+1
n1b(ix, kx) = ib
n2b(ix, kx) = jb
wwk(ix, kx) = wgt(ib,jb,kx)
if( ib<=nband .and. ib>noccxv ) noccxv =ib
endif
enddo
enddo
nbnb(kx) = ix
enddo
write(6,*) ' rsvwwk: kx nbnbmax=',kx, maxval(nbnb)
end
c---------------------------------------------------------------
subroutine rsvwwk2(wgt, nqbz,nband,nctot,nbnbx, n1b0,n2b0,nbnb0,
o n1b,n2b,wwk,noccxv,nbnb)
C- Convert wgt to wwk
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix
integer(4) :: n1b(nbnbx,nqbz),n2b(nbnbx,nqbz),noccxv,nbnb(nqbz)
complex(8) :: wgt(nband+nctot,nband,nqbz), wwk(nbnbx,nqbz),wtot
c
integer(4) :: n1b0(nbnbx,nqbz),n2b0(nbnbx,nqbz),nbnb0(nqbz),ibib
complex(8),allocatable ::wgt0(:,:,:)
allocate(wgt0(nband+nctot,nband,nqbz))
wgt0=wgt
wwk = 0d0
noccxv = 0
do kx = 1,nqbz
nbnb(kx) = nbnb0(kx)
ix=0
do ibib = 1,nbnb0(kx)
ix = ix+1
ib = n1b0(ibib,kx)
jb = n2b0(ibib,kx)
n1b(ix, kx) = ib
n2b(ix, kx) = jb
wwk(ix, kx) = wgt(ib,jb,kx)
wgt0(ib,jb,kx) = 0d0
if( ib<=nband .and. ib>noccxv ) noccxv =ib
enddo
enddo
if( sum(abs(wgt0)) > 1d-10) then
write(6,*)' rsvwwk2: sum(abs(wgt0))>0 the set n1b n2b at iw==1 is
& not enough to reserve wwk.
& If you calculate from omega=0. it could be a problem.
& You might start rather large omega.
& This problem is because inttetra3 could give complete zero
& for small omega. Also the symmetrization could generate zero.'
& ,sum(abs(wgt0))
Cstop2rx 2013.08.09 kino stop 'rsvwwk2: sum(abs(wgt0))'
call rx( 'rsvwwk2: sum(abs(wgt0))')
endif
end
c---------------------------------------------------------------
subroutine rsvwwk0(wgt, nqbz,nband,nctot,nbnbx,
o n1b,n2b,noccxv,nbnb)
C- get (n1b n2b) corresponding to non-zero wgt.
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix
integer(4) :: n1b(nbnbx,nqbz),n2b(nbnbx,nqbz),noccxv,nbnb(nqbz)
complex(8) :: wgt(nband+nctot,nband,nqbz)
c
noccxv = 0
do kx = 1, nqbz
ix = 0
do ib = 1, nband + nctot
do jb = 1, nband
if( abs(wgt(ib,jb,kx)) /=0d0 ) then
ix = ix+1
n1b(ix, kx) = ib
n2b(ix, kx) = jb
if( ib<=nband .and. ib>noccxv ) noccxv =ib
endif
enddo
enddo
nbnb(kx) = ix
enddo
write(6,*) ' rsvwwk: kx nbnbmax=',kx, maxval(nbnb)
end
c---------------------------------------------------------------
subroutine rsvwwk00_4(jpm,iwgt, nqbz,nband,nctot,ncc,nbnbx, !feb2006 ncc added
o n1b,n2b,noccxv,nbnb)
C- get (n1b n2b) corresponding to non-zero wgt.
implicit none
integer(4) :: jpm,nband, nctot, ncc, nqbz,nbnbx ,ib,jb, kx,ix
integer(4) :: n1b(nbnbx,nqbz),n2b(nbnbx,nqbz),noccxv,nbnb(nqbz)
logical :: iwgt(nband+nctot,nband+ncc,nqbz)
noccxv = 0
do kx = 1, nqbz
ix = 0
do ib = 1, nband + nctot
do jb = 1, nband + ncc
if( iwgt(ib,jb,kx)) then
ix = ix+1
n1b(ix, kx) = ib
n2b(ix, kx) = jb
if(jpm==1.and. ib<=nband .and. ib>noccxv ) noccxv =ib
if(jpm==2.and. jb<=nband .and. jb>noccxv ) noccxv =jb
endif
enddo
enddo
nbnb(kx) = ix
enddo
write(6,*) ' rsvwwk: kx nbnbmax=',kx, maxval(nbnb)
end
c---------------------------------------------------------------
subroutine rsvwwk00(iwgt, nqbz,nband,nctot,nbnbx,
o n1b,n2b,noccxv,nbnb)
C- get (n1b n2b) corresponding to non-zero wgt.
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix
integer(4) :: n1b(nbnbx,nqbz),n2b(nbnbx,nqbz),noccxv,nbnb(nqbz)
logical :: iwgt(nband+nctot,nband,nqbz)
noccxv = 0
do kx = 1, nqbz
ix = 0
do ib = 1, nband + nctot
do jb = 1, nband
if( iwgt(ib,jb,kx)) then
ix = ix+1
n1b(ix, kx) = ib
n2b(ix, kx) = jb
if( ib<=nband .and. ib>noccxv ) noccxv =ib
endif
enddo
enddo
nbnb(kx) = ix
enddo
write(6,*) ' rsvwwk: kx nbnbmax=',kx, maxval(nbnb)
end
c---------------------------------------------------------------
c---------------------------------------------------------------
subroutine rsvwwk4(wgt, nqbz,nband,nctot,nbnbx, n1b0,n2b0,nbnb0,
o wwk)
C- Convert wgt to wwk
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix
complex(8) :: wgt(nband+nctot,nband,nqbz), wwk(nbnbx,nqbz),wtot
integer(4) :: n1b0(nbnbx,nqbz),n2b0(nbnbx,nqbz),nbnb0(nqbz),ibib
complex(8),allocatable ::wgt0(:,:,:)
allocate(wgt0(nband+nctot,nband,nqbz))
wwk = 0d0
wgt0= wgt
do kx = 1,nqbz
ix = 0
do ibib = 1,nbnb0(kx)
ix = ix+1
ib = n1b0(ibib,kx)
jb = n2b0(ibib,kx)
wwk(ix, kx) = wgt(ib,jb,kx)
wgt0(ib,jb,kx) = 0d0
enddo
enddo
c write(6,*)' rsvwwk4: sum(abs(wgt0))=',sum(abs(wgt0))
cccccccccccccccccccccccccccccccccc
c write(6,*) 'xxxxxxxxxxxxxx nqbz nbnb0', nqbz,nbnb0
c do kx = 1,nqbz
c do ibib = 1,nbnb0(kx)
c ib = n1b0(ibib,kx)
c jb = n2b0(ibib,kx)
c write(6,"(' kx ib jb =',3i4,2d13.5)") kx,ib,jb,wgt0(ib,jb,kx)
c enddo
c enddo
ccccccccccccccccccccccccccccccccccc
if( sum(abs(wgt0))/=0d0 ) then
write(6,*)' rsvwwk4: sum(abs(wgt0))/=0d0 the set n1b n2b is',
& ' not enough to reserve wwk. ',sum(abs(wgt0))
do kx = 1,nqbz
do ib=1,nband+nctot
do jb=1,nband
if(wgt0(ib,jb,kx) /= 0d0) then
write(6,"(' ib jb kx=',3i5,2d14.6)") ib,jb,kx,wgt0(ib,jb,kx)
endif
enddo
enddo
enddo
Cstop2rx 2013.08.09 kino stop 'rsvwwk4: sum(abs(wgt0))'
call rx( 'rsvwwk4: sum(abs(wgt0))')
endif
deallocate(wgt0)
end
subroutine rsvwwk4_w(wgt, nqbz,nband,nctot,nbnbx, n1b0,n2b0,nbnb0,
i ifwwk)
C- Convert wgt to wwk
implicit none
integer(4) :: nband, nctot, nqbz, nbnbx ,ib,jb, kx,ix ,ifwwk
complex(8) :: wgt(nband+nctot,nband,nqbz), wtot
integer(4) :: n1b0(nbnbx,nqbz),n2b0(nbnbx,nqbz),nbnb0(nqbz),ibib
complex(8),allocatable ::wgt0(:,:,:),wwk(:,:)
c allocate(wgt0(nband+nctot,nband,nqbz))
allocate(wwk(nbnbx,nqbz))
wwk = 0d0
c wgt0= wgt
do kx = 1,nqbz
ix = 0
do ibib = 1,nbnb0(kx)
ix = ix+1
ib = n1b0(ibib,kx)
jb = n2b0(ibib,kx)
wwk(ix, kx) = wgt(ib,jb,kx)
c wgt0(ib,jb,kx) = 0d0
enddo
enddo
c write(6,*)' rsvwwk4: sum(abs(wgt0))=',sum(abs(wgt0))
c if( sum(abs(wgt0))/=0d0 ) then
c write(6,*)' rsvwwk4: sum(abs(wgt0))/=0d0 the set n1b n2b is
c & not enough to reserve wwk. ',sum(abs(wgt0))
c stop 'rsvwwk4: sum(abs(wgt0))'
c endif
c deallocate(wgt0)
write(ifwwk) wwk
deallocate(wwk)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.