source: LMDZ5/branches/LMDZ6_rc0/libf/cosp/cosp_isccp_simulator.F90 @ 5452

Last change on this file since 5452 was 1910, checked in by Laurent Fairhead, 11 years ago

Merged trunk changes r1860:1909 into testing branch

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 4.1 KB
Line 
1! (c) British Crown Copyright 2008, the Met Office.
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without modification, are permitted
5! provided that the following conditions are met:
6!
7!     * Redistributions of source code must retain the above copyright notice, this list
8!       of conditions and the following disclaimer.
9!     * Redistributions in binary form must reproduce the above copyright notice, this list
10!       of conditions and the following disclaimer in the documentation and/or other materials
11!       provided with the distribution.
12!     * Neither the name of the Met Office nor the names of its contributors may be used
13!       to endorse or promote products derived from this software without specific prior written
14!       permission.
15!
16! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
17! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
23! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25MODULE MOD_COSP_ISCCP_SIMULATOR
26  USE MOD_COSP_CONSTANTS
27  USE MOD_COSP_TYPES
28  IMPLICIT NONE
29
30CONTAINS
31
32
33!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34!-------------- SUBROUTINE COSP_ISCCP_SIMULATOR -----------------
35!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36SUBROUTINE COSP_ISCCP_SIMULATOR(gbx,sgx,y)
37 
38  ! Arguments
39  type(cosp_gridbox),intent(in) :: gbx  ! Gridbox info
40  type(cosp_subgrid),intent(in) :: sgx  ! Subgridbox info
41  type(cosp_isccp),intent(inout) :: y   ! ISCCP simulator output
42 
43  ! Local variables
44  integer :: i,Nlevels,Npoints
45  real :: pfull(gbx%Npoints, gbx%Nlevels)
46  real :: phalf(gbx%Npoints, gbx%Nlevels + 1)
47  real :: qv(gbx%Npoints, gbx%Nlevels)
48  real :: cc(gbx%Npoints, gbx%Nlevels)
49  real :: conv(gbx%Npoints, gbx%Nlevels)
50  real :: dtau_s(gbx%Npoints, gbx%Nlevels)
51  real :: dtau_c(gbx%Npoints, gbx%Nlevels)
52  real :: at(gbx%Npoints, gbx%Nlevels)
53  real :: dem_s(gbx%Npoints, gbx%Nlevels)
54  real :: dem_c(gbx%Npoints, gbx%Nlevels)
55  real :: frac_out(gbx%Npoints, gbx%Ncolumns, gbx%Nlevels)
56  integer :: sunlit(gbx%Npoints)
57 
58  Nlevels = gbx%Nlevels
59  Npoints = gbx%Npoints
60  ! Flip inputs. Levels from TOA to surface
61  pfull  = gbx%p(:,Nlevels:1:-1)
62  phalf(:,1)         = 0.0 ! Top level
63  phalf(:,2:Nlevels+1) = gbx%ph(:,Nlevels:1:-1)
64  qv     = gbx%sh(:,Nlevels:1:-1)
65  cc     = 0.999999*gbx%tca(:,Nlevels:1:-1)
66  conv   = 0.999999*gbx%cca(:,Nlevels:1:-1)
67  dtau_s = gbx%dtau_s(:,Nlevels:1:-1)
68  dtau_c = gbx%dtau_c(:,Nlevels:1:-1)
69  at     = gbx%T(:,Nlevels:1:-1)
70  dem_s  = gbx%dem_s(:,Nlevels:1:-1)
71  dem_c  = gbx%dem_c(:,Nlevels:1:-1)
72  frac_out(1:Npoints,:,1:Nlevels) = sgx%frac_out(1:Npoints,:,Nlevels:1:-1)
73  sunlit = int(gbx%sunlit)
74  call icarus(0,0,gbx%npoints,sunlit,gbx%nlevels,gbx%ncolumns, &
75            pfull,phalf,qv,cc,conv,dtau_s,dtau_c, &
76            gbx%isccp_top_height,gbx%isccp_top_height_direction, &
77            gbx%isccp_overlap,frac_out, &
78            gbx%skt,gbx%isccp_emsfc_lw,at,dem_s,dem_c,y%fq_isccp,y%totalcldarea, &
79            y%meanptop,y%meantaucld,y%meanalbedocld, &
80            y%meantb,y%meantbclr,y%boxtau,y%boxptop)
81
82  ! Flip outputs. Levels from surface to TOA
83  ! --- (npoints,tau=7,pressure=7)
84  y%fq_isccp(:,:,:) = y%fq_isccp(:,:,7:1:-1)
85     
86  ! Change boxptop from hPa to Pa. This avoids using UDUNITS in CMOR
87!  y%boxptop = y%boxptop*100.0
88 
89  ! Check if there is any value slightly greater than 1
90  where ((y%totalcldarea > 1.0-1.e-5) .and. (y%totalcldarea < 1.0+1.e-5))
91    y%totalcldarea = 1.0
92  endwhere
93             
94END SUBROUTINE COSP_ISCCP_SIMULATOR
95
96END MODULE MOD_COSP_ISCCP_SIMULATOR
Note: See TracBrowser for help on using the repository browser.