1 | SUBROUTINE load_ksi(ksive) |
---|
2 | |
---|
3 | use dimphy |
---|
4 | IMPLICIT none |
---|
5 | |
---|
6 | #include "YOMCST.h" |
---|
7 | #include "comcstVE.h" |
---|
8 | C |
---|
9 | C ------------------------------------------------------------------ |
---|
10 | C |
---|
11 | C PURPOSE. |
---|
12 | C -------- |
---|
13 | C |
---|
14 | c This routine loads the longwave matrix of factors Ksi |
---|
15 | c |
---|
16 | c The Ksi matrixes have been computed by Vincent Eymet |
---|
17 | C |
---|
18 | C AUTHOR. |
---|
19 | C ------- |
---|
20 | C Sebastien Lebonnois |
---|
21 | C |
---|
22 | C MODIFICATIONS. |
---|
23 | C -------------- |
---|
24 | C |
---|
25 | c New ksi matrix: possibility of different cloud model fct of lat 05/2014 |
---|
26 | C ------------------------------------------------------------------ |
---|
27 | C |
---|
28 | C* ARGUMENTS: |
---|
29 | C |
---|
30 | c inputs |
---|
31 | real psurf(klon) ! Surface pressure |
---|
32 | c outputs |
---|
33 | real ksive(0:klev+1,0:klev+1,nnuve,nbmat) ! ksi matrixes in Vincent's file |
---|
34 | |
---|
35 | c local variables |
---|
36 | integer i,j,isza,ips,band,pve,sve,nlve |
---|
37 | integer lat,Nb,m,mat |
---|
38 | character*9 tmp1 |
---|
39 | character*100 file |
---|
40 | CHARACTER*2 str2 |
---|
41 | real lambda(nnuve) ! wavelenght in table (mu->m, middle of interval) |
---|
42 | real lambdamin(nnuve),lambdamax(nnuve) ! in microns |
---|
43 | real dlambda ! in microns |
---|
44 | |
---|
45 | nlve = klev |
---|
46 | |
---|
47 | c ------------------------ |
---|
48 | c Loading the ksi file |
---|
49 | c ------------------------ |
---|
50 | |
---|
51 | file = "ksi_global.txt" |
---|
52 | open(10,file=file) |
---|
53 | |
---|
54 | read(10,*) |
---|
55 | read(10,*) nlatve |
---|
56 | read(10,*) |
---|
57 | |
---|
58 | write(*,*) 'This is subroutine load_ksi' |
---|
59 | write(*,*) 'Nb of lat bands:',nlatve |
---|
60 | |
---|
61 | do lat=1,nlatve |
---|
62 | read(10,*) !line for lat range |
---|
63 | read(10,*) indexve(lat) |
---|
64 | read(10,*) nbpsve(lat) |
---|
65 | read(10,*) |
---|
66 | read(10,*) nbszave(lat) |
---|
67 | read(10,*) |
---|
68 | |
---|
69 | do isza=1,nbszave(lat) |
---|
70 | do ips=1,nbpsve(lat) |
---|
71 | |
---|
72 | read(10,*) (tmp1,j=1,3),mat !line for matrix number |
---|
73 | read(10,*) (tmp1,j=1,2),pve |
---|
74 | psurfve(ips,lat) = pve*1.e5 ! pve in bar, psurfve in Pa |
---|
75 | read(10,*) (tmp1,j=1,3),sve |
---|
76 | szave(isza,lat) = cos(sve*RPI/180.) ! conversion in mu0 |
---|
77 | read(10,*) |
---|
78 | read(10,*) m,Nb |
---|
79 | if (m.ne.nlve) then |
---|
80 | write(*,*) 'This is subroutine load_ksi' |
---|
81 | print*,'Dimension problem between ksi.txt and nlve' |
---|
82 | print*,'N levels = ',m,nlve |
---|
83 | stop |
---|
84 | endif |
---|
85 | if (Nb.ne.nnuve) then |
---|
86 | write(*,*) 'This is subroutine load_ksi' |
---|
87 | print*,'Dimension problem between ksi.txt and nnuve' |
---|
88 | print*,'N freq = ',Nb,nnuve |
---|
89 | stop |
---|
90 | endif |
---|
91 | c Now reading ksi matrix index "mat" |
---|
92 | write(str2,'(i2.2)') m+2 |
---|
93 | do band=1,Nb |
---|
94 | read(10,*) lambdamin(band),lambdamax(band) |
---|
95 | do i=0,m+1 |
---|
96 | read(10,'('//str2//'e17.9)') (ksive(i,j,band,mat),j=0,m+1) ! no unit |
---|
97 | enddo ! i |
---|
98 | enddo ! band |
---|
99 | c print*,"Matrice ",mat," lue" |
---|
100 | c print*," psurf=",psurfve(ips,lat)," bars" |
---|
101 | if (mat+1.gt.nbmat) then |
---|
102 | write(*,*) 'This is subroutine load_ksi' |
---|
103 | print*,'Dimension problem between ksi.txt and nbmat' |
---|
104 | print*,'(max number of matrixes)' |
---|
105 | print*,'nbmat (in comcstVE.h) should be raised' |
---|
106 | stop |
---|
107 | endif |
---|
108 | |
---|
109 | enddo ! ips |
---|
110 | enddo ! isza |
---|
111 | enddo ! lat |
---|
112 | |
---|
113 | write(*,*) 'Total nb of matrixes:',mat |
---|
114 | |
---|
115 | close(10) |
---|
116 | |
---|
117 | c central wavelength and wavelength width |
---|
118 | do band=1,nnuve |
---|
119 | lambda(band)=(lambdamin(band)+lambdamax(band))/2.*1.e-6 ! in m |
---|
120 | dlambda =(lambdamax(band)-lambdamin(band)) ! in microns |
---|
121 | c print*,band,lambdamin(band),dlambda,lambdamax(band) |
---|
122 | |
---|
123 | c sign convention for ksi, |
---|
124 | c and taking into account the wavelength width (in microns): |
---|
125 | do mat=1,nbmat |
---|
126 | do i=0,nlve+1 |
---|
127 | do j=0,nlve+1 |
---|
128 | ksive(i,j,band,mat) = +ksive(i,j,band,mat)*dlambda ! in µm |
---|
129 | enddo |
---|
130 | enddo |
---|
131 | enddo |
---|
132 | c computing coeff al and bl for Planck luminance |
---|
133 | al(band) = 2.*RHPLA*RCLUM*RCLUM/(lambda(band))**5. |
---|
134 | c in W/m²/m |
---|
135 | c We need W/m²/µm : |
---|
136 | . * 1.e-6 |
---|
137 | bl(band) = RHPLA*RCLUM/(RKBOL*lambda(band)) |
---|
138 | enddo |
---|
139 | |
---|
140 | print*,"LOAD_KSI OK" |
---|
141 | |
---|
142 | return |
---|
143 | end |
---|
144 | |
---|