Changeset 3504 for trunk/LMDZ.PLUTO/libf/phypluto/setspi.F90
- Timestamp:
- Nov 8, 2024, 10:57:14 AM (13 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/phypluto/setspi.F90
r3184 r3504 2 2 3 3 !================================================================== 4 ! 4 ! 5 5 ! Purpose 6 6 ! ------- 7 7 ! Set up spectral intervals and Planck function in the longwave. 8 ! 8 ! 9 9 ! Authors 10 ! ------- 10 ! ------- 11 11 ! Adapted from setspi in the NASA Ames radiative code by 12 12 ! Robin Wordsworth (2009). 13 ! 13 ! 14 14 ! Called by 15 15 ! --------- 16 16 ! callcorrk.F 17 ! 17 ! 18 18 ! Calls 19 19 ! ----- 20 20 ! none 21 ! 21 ! 22 22 !================================================================== 23 23 … … 26 26 use datafile_mod, only: datadir 27 27 use comcstfi_mod, only: pi 28 use mod_phys_lmdz_para, only : is_master 28 29 29 30 implicit none … … 42 43 real*8 :: c1 = 3.741832D-16 ! W m^-2 43 44 real*8 :: c2 = 1.438786D-2 ! m K 44 45 45 46 real*8 :: lastband(2), plancksum 46 47 … … 75 76 write(temp1,'(i2.2)') L_NSPECTI 76 77 !file_id='/corrk_data/' // corrkdir(1:LEN_TRIM(corrkdir)) // '/narrowbands_IR.in' 77 file_id='/corrk_data/'//trim(adjustl(banddir))//'/narrowbands_IR.in' 78 file_id='/corrk_data/'//trim(adjustl(banddir))//'/narrowbands_IR.in' 78 79 file_path=TRIM(datadir)//TRIM(file_id) 79 80 … … 81 82 inquire(FILE=file_path,EXIST=file_ok) 82 83 if(.not.file_ok) then 83 write(*,*)'The file ',TRIM(file_path) 84 write(*,*)'was not found by setspi.F90, exiting.' 85 write(*,*)'Check that your path to datagcm:',trim(datadir) 86 write(*,*)' is correct. You can change it in callphys.def with:' 87 write(*,*)' datadir = /absolute/path/to/datagcm' 88 write(*,*)'Also check that the corrkdir you chose in callphys.def exists.' 89 call abort 90 endif 91 92 !$OMP MASTER 84 if (is_master) then 85 write(*,*)'The file ',TRIM(file_path) 86 write(*,*)'was not found by setspi.F90, exiting.' 87 write(*,*)'Check that your path to datagcm:',trim(datadir) 88 write(*,*)' is correct. You can change it in callphys.def with:' 89 write(*,*)' datadir = /absolute/path/to/datagcm' 90 write(*,*)'Also check that the corrkdir you chose in callphys.def exists.' 91 endif 92 call abort_physic("setspi", "File not found by setspi", 1) 93 endif 94 95 !$OMP MASTER 93 96 nb=0 94 97 ierr=0 95 ! check that the file contains the right number of bands 98 ! check that the file contains the right number of bands 96 99 open(131,file=file_path,form='formatted') 97 100 read(131,*,iostat=ierr) file_entries … … 103 106 close(131) 104 107 105 write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model ' 106 write(*,*) ' there are ',nb, 'entries in ',TRIM(file_path) 108 if (is_master) then 109 write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model ' 110 write(*,*) ' there are ',nb, 'entries in ',TRIM(file_path) 111 endif 107 112 if(nb.ne.L_NSPECTI) then 108 write(*,*) 'MISMATCH !! I stop here' 109 call abort 113 call abort_physic("setspi",'MISMATCH !! I stop here',1) 110 114 endif 111 115 112 116 ! load and display the data 113 117 open(111,file=file_path,form='formatted') 114 read(111,*) 118 read(111,*) 115 119 do M=1,L_NSPECTI-1 116 120 read(111,*) BWNI(M) … … 123 127 !$OMP BARRIER 124 128 125 print*,'' 126 print*,'setspi: IR band limits:' 127 do M=1,L_NSPECTI+1 128 print*,m,'-->',BWNI(M),' cm^-1' 129 end do 130 131 ! Set up mean wavenumbers and wavenumber deltas. Units of 129 if (is_master)then 130 print*,'' 131 print*,'setspi: IR band limits:' 132 do M=1,L_NSPECTI+1 133 print*,m,'-->',BWNI(M),' cm^-1' 134 end do 135 endif 136 137 ! Set up mean wavenumbers and wavenumber deltas. Units of 132 138 ! wavenumbers is cm^(-1); units of wavelengths is microns. 133 139 … … 136 142 DWNI(M) = BWNI(M+1)-BWNI(M) 137 143 WAVEI(M) = 1.0D+4/WNOI(M) 138 BLAMI(M) = 0.01D0/BWNI(M) 144 BLAMI(M) = 0.01D0/BWNI(M) 139 145 end do 140 146 BLAMI(M) = 0.01D0/BWNI(M) … … 147 153 ! original planck.f; W m^-2 wavenumber^-1, where wavenumber is in CM^-1. 148 154 149 print*,'' 150 print*,'setspi: Current Planck integration range:' 151 print*,'T = ',dble(NTstart)/NTfac, ' to ',dble(NTstop)/NTfac,' K.' 155 if (is_master)then 156 print*,'' 157 print*,'setspi: Current Planck integration range:' 158 print*,'T = ',dble(NTstart)/NTfac, ' to ',dble(NTstop)/NTfac,' K.' 159 endif 152 160 153 161 IF(.NOT.ALLOCATED(planckir)) ALLOCATE(planckir(L_NSPECTI,NTstop-NTstart+1)) … … 159 167 bma = (b-a)/2.0D0 160 168 ! if (nw .eq. 25) then !LT debug 161 ! print*, "a = ",a 162 ! print*, "b= ",b 163 ! print*,"bpa = ",bpa 169 ! print*, "a = ",a 170 ! print*, "b= ",b 171 ! print*,"bpa = ",bpa 164 172 ! print*, "bma = ",bma 165 173 ! endif … … 170 178 y = bma*x(mm)+bpa 171 179 !to avoid floating overflow when T is low and optical wavelength 172 if ((c2/(y*T)) .lt. 700.0D0) then 180 if ((c2/(y*T)) .lt. 700.0D0) then 173 181 ans = ans + w(mm)*c1/(y**5*(exp(c2/(y*T))-1.0D0)) 174 else 182 else 175 183 ans = ans +0.0D0 176 184 endif … … 179 187 end do 180 188 end do 181 189 182 190 ! force planck=sigma*eps*T^4 for each temperature in array 183 191 if(forceEC)then 184 print*,'setspi: Force F=sigma*eps*T^4 for all values of T!'192 if (is_master) print*,'setspi: Force F=sigma*eps*T^4 for all values of T!' 185 193 do nt=NTstart,NTstop 186 194 plancksum=0.0D0 187 195 T=dble(NT)/NTfac 188 196 189 197 do NW=1,L_NSPECTI 190 198 plancksum=plancksum+ & … … 207 215 plancksum=plancksum+planckir(NW,nt-NTstart+1)*DWNI(NW)*pi 208 216 end do 209 print*,'setspi: At lower limit:' 210 print*,'in model sig*T^4 = ',plancksum,' W m^-2' 211 print*,'actual sig*T^4 = ',sigma*(dble(nt)/NTfac)**4,' W m^-2' 212 217 if (is_master) then 218 print*,'setspi: At lower limit:' 219 print*,'in model sig*T^4 = ',plancksum,' W m^-2' 220 print*,'actual sig*T^4 = ',sigma*(dble(nt)/NTfac)**4,' W m^-2' 221 endif 213 222 ! check energy conservation at upper temperature boundary 214 223 plancksum=0.0D0 … … 217 226 plancksum=plancksum+planckir(NW,nt-NTstart+1)*DWNI(NW)*pi 218 227 end do 219 print*,'setspi: At upper limit:' 220 print*,'in model sig*T^4 = ',plancksum,' W m^-2' 221 print*,'actual sig*T^4 = ',sigma*(dble(nt)/NTfac)**4,' W m^-2' 222 print*,'' 228 if (is_master) then 229 print*,'setspi: At upper limit:' 230 print*,'in model sig*T^4 = ',plancksum,' W m^-2' 231 print*,'actual sig*T^4 = ',sigma*(dble(nt)/NTfac)**4,' W m^-2' 232 print*,'' 233 endif 223 234 endif 224 235
Note: See TracChangeset
for help on using the changeset viewer.