65 '$Id: CRTM_Atmosphere.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 67 INTEGER,
PARAMETER ::
ml = 256
133 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_Atmosphere_AddLayers' 136 INTEGER :: i, j, k, n
150 msg =
'Error assigning Atmosphere structure with NO extra layers' 161 msg =
'Error determining extra layer count' 171 msg =
'Error allocating iAtm internal structure' 179 iatm%pl, iatm%tl, iatm%al, &
180 model=atm_in%Climatology )
185 CALL interp_lpoly( atm_in%Level_Pressure(0), iatm%pl(n-1:n), iatm%ilpoly )
186 iatm%plint_save = atm_in%Level_Pressure(0)
187 iatm%pln_save = iatm%pl(n)
188 iatm%pl(n) = iatm%plint_save
189 CALL interp_linear( iatm%ilpoly, iatm%tl(n-1:n), iatm%tlint_save )
190 iatm%tln_save = iatm%tl(n)
191 iatm%tl(n) = iatm%tlint_save
192 DO j = 1, atm_in%n_Absorbers
193 CALL interp_linear( iatm%ilpoly, iatm%al(n-1:n,j), iatm%alint_save(j) )
194 iatm%aln_save(j) = iatm%al(n,j)
195 iatm%al(n,j) = iatm%alint_save(j)
200 CALL layer_p(iatm%pl(k-1:k), iatm%p(k))
201 CALL layer_x(iatm%tl(k-1:k), iatm%t(k))
203 DO j = 1, atm_in%n_Absorbers
205 CALL layer_x(iatm%al(k-1:k,j), iatm%a(k,j))
212 CALL interp_lpoly( iatm%p(n), atm_in%Pressure(1:2), iatm%elpoly )
213 CALL shift_profile( iatm%elpoly, atm_in%Temperature(1:2), iatm%t )
214 DO j = 1, atm_in%n_Absorbers
215 CALL shift_profile( iatm%elpoly, atm_in%Absorber(1:2,j), iatm%a(:,j) )
229 msg =
'Error copying Atmosphere structure with extra layers' 241 atm_out%Level_Pressure(0:n) = iatm%pl
242 atm_out%Pressure(1:n) = iatm%p
243 atm_out%Temperature(1:n) = iatm%t
244 DO j = 1, atm_out%n_Absorbers
245 atm_out%Absorber(1:n,j) = iatm%a(:,j)
248 IF ( atm_in%n_Clouds > 0 )
THEN 249 DO i = 1, atm_in%n_Clouds
250 atm_out%Cloud(i)%Effective_Radius(1:n) =
zero 251 atm_out%Cloud(i)%Effective_Variance(1:n) =
zero 252 atm_out%Cloud(i)%Water_Content(1:n) =
zero 256 IF ( atm_in%n_Aerosols > 0 )
THEN 257 DO i = 1, atm_in%n_Aerosols
258 atm_out%Aerosol(i)%Effective_Radius(1:n) =
zero 259 atm_out%Aerosol(i)%Concentration(1:n) =
zero 322 Atm_In , & ! FWD Input
323 Atm_In_TL , & ! TL Input
333 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_Atmosphere_AddLayers_TL' 346 atm_out_tl = atm_in_tl
349 msg =
'Error assigning Atmosphere structure with NO extra layers' 360 msg =
'Error determining extra layer count' 371 msg =
'Error copying Atmosphere structure with extra layers' 432 Atm_In , & ! FWD Input
433 Atm_Out_AD, & ! AD Input
443 CHARACTER(*),
PARAMETER :: routine_name =
'CRTM_Atmosphere_AddLayers_AD' 446 INTEGER :: i, j, n, no, nt
460 atm_in_ad = atm_in_ad + atm_out_ad
470 msg =
'Error determining extra layer count' 478 no = atm_in_ad%n_Layers
481 IF ( atm_in_ad%n_Aerosols > 0 )
THEN 482 DO i = 1, atm_in_ad%n_Aerosols
483 atm_in_ad%Aerosol(i)%Concentration(1:no) = atm_in_ad%Aerosol(i)%Concentration(1:no) + &
484 atm_out_ad%Aerosol(i)%Concentration(n+1:nt)
485 atm_in_ad%Aerosol(i)%Effective_Radius(1:no) = atm_in_ad%Aerosol(i)%Effective_Radius(1:no) + &
486 atm_out_ad%Aerosol(i)%Effective_Radius(n+1:nt)
487 atm_in_ad%Aerosol(i)%Type = atm_out_ad%Aerosol(i)%Type
491 IF ( atm_in_ad%n_Clouds > 0 )
THEN 492 DO i = 1, atm_in_ad%n_Clouds
493 atm_in_ad%Cloud(i)%Water_Content(1:no) = atm_in_ad%Cloud(i)%Water_Content(1:no) + &
494 atm_out_ad%Cloud(i)%Water_Content(n+1:nt)
495 atm_in_ad%Cloud(i)%Effective_Variance(1:no) = atm_in_ad%Cloud(i)%Effective_Variance(1:no) + &
496 atm_out_ad%Cloud(i)%Effective_Variance(n+1:nt)
497 atm_in_ad%Cloud(i)%Effective_Radius(1:no) = atm_in_ad%Cloud(i)%Effective_Radius(1:no) + &
498 atm_out_ad%Cloud(i)%Effective_Radius(n+1:nt)
499 atm_in_ad%Cloud(i)%Type = atm_out_ad%Cloud(i)%Type
503 DO j = 1, atm_in_ad%n_Absorbers
504 atm_in_ad%Absorber(1:no,j) = atm_in_ad%Absorber(1:no,j) + atm_out_ad%Absorber(n+1:nt,j)
507 atm_in_ad%Temperature(1:no) = atm_in_ad%Temperature(1:no) + atm_out_ad%Temperature(n+1:nt)
509 atm_in_ad%Pressure(1:no) = atm_in_ad%Pressure(1:no) + atm_out_ad%Pressure(n+1:nt)
510 atm_in_ad%Level_Pressure(0:no) = atm_in_ad%Level_Pressure(0:no) + atm_out_ad%Level_Pressure(n:nt)
538 SUBROUTINE layer_p( p, p_layer )
539 REAL(fp),
INTENT(IN) :: p(2)
540 REAL(fp),
INTENT(OUT) :: p_layer
541 p_layer = (p(2)-p(1))/log(p(2)/p(1))
546 SUBROUTINE layer_x( x, x_layer )
547 REAL(fp),
INTENT(IN) :: x(2)
548 REAL(fp),
INTENT(OUT) :: x_layer
555 REAL(fp),
INTENT(IN) :: p_int
556 REAL(fp),
INTENT(IN) :: p(2)
557 REAL(fp),
INTENT(OUT) :: lpoly
558 lpoly = (log(p_int)-log(p(1))) / (log(p(2))-log(p(1)))
564 REAL(fp),
INTENT(IN) :: lpoly
565 REAL(fp),
INTENT(IN) :: x(2)
566 REAL(fp),
INTENT(OUT) :: x_int
567 x_int = (x(2)-x(1))*lpoly + x(1)
573 REAL(fp),
INTENT(IN) :: lpoly
574 REAL(fp),
INTENT(IN) :: x_toa(2)
575 REAL(fp),
INTENT(IN OUT) :: x_shifted(:)
577 REAL(fp) :: x_int, dx
580 dx = x_int - x_shifted(n)
581 x_shifted = x_shifted + dx
subroutine layer_p(p, p_layer)
elemental type(crtm_atmosphere_type) function, public crtm_atmosphere_addlayercopy(atm, n_Added_Layers)
integer, parameter, public failure
integer function extra_layers(Atm)
integer, parameter, public set
real(fp), parameter, public zero
integer, parameter, public warning
subroutine interp_lpoly(p_int, p, lpoly)
integer function, public crtm_atmosphere_addlayers_tl(Atm_In, Atm_In_TL, Atm_Out_TL)
elemental logical function, public iatm_associated(self)
integer, parameter, public fp
elemental subroutine, public iatm_create(self, n_Layers, n_Absorbers)
subroutine interp_linear(lpoly, x, x_int)
real(fp), parameter, public toa_pressure
real(fp), parameter, public minimum_absorber_amount
elemental subroutine, public crtm_atmosphere_create(Atm, n_Layers, n_Absorbers, n_Clouds, n_Aerosols)
real(fp), parameter, public one
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer function, public crtm_atmosphere_addlayers_ad(Atm_In, Atm_Out_AD, Atm_In_AD)
subroutine shift_profile(lpoly, x_toa, x_shifted)
elemental subroutine, public iatm_destroy(self)
real(fp), parameter, public point_5
subroutine layer_x(x, x_layer)
character(*), parameter module_rcs_id
elemental logical function, public crtm_atmosphere_associated(Atm)
integer function, public crtm_atmosphere_addlayers(Atm_In, Atm_Out)
real(fp), dimension(0:n_model_layers), parameter, public model_level_pressure
elemental subroutine, public crtm_atmosphere_zero(Atmosphere)
integer, parameter, public success
subroutine, public crtm_get_model_profile(absorber_id, p, t, a, Model)