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