[1262] | 1 | ! (c) British Crown Copyright 2008, the Met Office. |
---|
| 2 | |
---|
| 3 | ! All rights reserved. |
---|
| 4 | ! |
---|
| 5 | ! Redistribution and use in source and binary forms, with or without modification, are permitted |
---|
| 6 | ! provided that the following conditions are met: |
---|
| 7 | ! |
---|
| 8 | ! * Redistributions of source code must retain the above copyright notice, this list |
---|
| 9 | ! of conditions and the following disclaimer. |
---|
| 10 | ! * Redistributions in binary form must reproduce the above copyright notice, this list |
---|
| 11 | ! of conditions and the following disclaimer in the documentation and/or other materials |
---|
| 12 | ! provided with the distribution. |
---|
| 13 | ! * Neither the name of the Met Office nor the names of its contributors may be used |
---|
| 14 | ! to endorse or promote products derived from this software without specific prior written |
---|
| 15 | ! permission. |
---|
| 16 | ! |
---|
| 17 | ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR |
---|
| 18 | ! IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
---|
| 19 | ! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 20 | ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
| 21 | ! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 22 | ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
---|
| 23 | ! IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
---|
| 24 | ! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 25 | |
---|
| 26 | ! |
---|
| 27 | ! History: |
---|
| 28 | ! Jul 2007 - A. Bodas-Salcedo - Initial version |
---|
| 29 | ! |
---|
| 30 | ! |
---|
| 31 | |
---|
| 32 | MODULE MOD_COSP_SIMULATOR |
---|
| 33 | USE MOD_COSP_TYPES |
---|
| 34 | USE MOD_COSP_RADAR |
---|
| 35 | USE MOD_COSP_LIDAR |
---|
| 36 | USE MOD_COSP_ISCCP_SIMULATOR |
---|
| 37 | USE MOD_COSP_MISR_SIMULATOR |
---|
| 38 | USE MOD_COSP_STATS |
---|
| 39 | IMPLICIT NONE |
---|
| 40 | |
---|
| 41 | CONTAINS |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 45 | !--------------------- SUBROUTINE COSP_SIMULATOR ------------------ |
---|
| 46 | !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 47 | SUBROUTINE COSP_SIMULATOR(gbx,sgx,sghydro,cfg,vgrid,sgradar,sglidar,isccp,misr,stradar,stlidar) |
---|
| 48 | |
---|
| 49 | ! Arguments |
---|
| 50 | type(cosp_gridbox),intent(in) :: gbx ! Grid-box inputs |
---|
| 51 | type(cosp_subgrid),intent(in) :: sgx ! Subgrid inputs |
---|
| 52 | type(cosp_sghydro),intent(in) :: sghydro ! Subgrid info for hydrometeors |
---|
| 53 | type(cosp_config),intent(in) :: cfg ! Configuration options |
---|
| 54 | type(cosp_vgrid),intent(in) :: vgrid ! Information on vertical grid of stats |
---|
| 55 | type(cosp_sgradar),intent(inout) :: sgradar ! Output from radar simulator |
---|
| 56 | type(cosp_sglidar),intent(inout) :: sglidar ! Output from lidar simulator |
---|
| 57 | type(cosp_isccp),intent(inout) :: isccp ! Output from ISCCP simulator |
---|
| 58 | type(cosp_misr),intent(inout) :: misr ! Output from MISR simulator |
---|
| 59 | type(cosp_radarstats),intent(inout) :: stradar ! Summary statistics from radar simulator |
---|
| 60 | type(cosp_lidarstats),intent(inout) :: stlidar ! Summary statistics from lidar simulator |
---|
| 61 | ! Local variables |
---|
| 62 | ! ***Timing variables (to be deleted in final version) |
---|
| 63 | integer :: t0,t1,count_rate,count_max |
---|
| 64 | |
---|
| 65 | !+++++++++ Radar model ++++++++++ |
---|
| 66 | if (cfg%Lradar_sim) then |
---|
| 67 | call system_clock(t0,count_rate,count_max) |
---|
| 68 | call cosp_radar(gbx,sgx,sghydro,sgradar) |
---|
| 69 | call system_clock(t1,count_rate,count_max) |
---|
| 70 | print *, '%%%%%% Radar:', (t1-t0)*1.0/count_rate, ' s' |
---|
| 71 | else |
---|
| 72 | print *, '%%%%%% Radar not used' |
---|
| 73 | endif |
---|
| 74 | |
---|
| 75 | !+++++++++ Lidar model ++++++++++ |
---|
| 76 | if (cfg%Llidar_sim) then |
---|
| 77 | call system_clock(t0,count_rate,count_max) |
---|
| 78 | call cosp_lidar(gbx,sgx,sghydro,sglidar) |
---|
| 79 | call system_clock(t1,count_rate,count_max) |
---|
| 80 | print *, '%%%%%% Lidar:', (t1-t0)*1.0/count_rate, ' s' |
---|
| 81 | else |
---|
| 82 | print *, '%%%%%% Lidar not used' |
---|
| 83 | endif |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | !+++++++++ ISCCP simulator ++++++++++ |
---|
| 87 | if (cfg%Lisccp_sim) then |
---|
| 88 | call system_clock(t0,count_rate,count_max) |
---|
| 89 | call cosp_isccp_simulator(gbx,sgx,isccp) |
---|
| 90 | call system_clock(t1,count_rate,count_max) |
---|
| 91 | print *, '%%%%%% ISCCP:', (t1-t0)*1.0/count_rate, ' s' |
---|
| 92 | else |
---|
| 93 | print *, '%%%%%% ISCCP not used' |
---|
| 94 | endif |
---|
| 95 | |
---|
| 96 | !+++++++++ MISR simulator ++++++++++ |
---|
| 97 | if (cfg%Lmisr_sim) then |
---|
| 98 | call system_clock(t0,count_rate,count_max) |
---|
| 99 | call cosp_misr_simulator(gbx,sgx,misr) |
---|
| 100 | call system_clock(t1,count_rate,count_max) |
---|
| 101 | print *, '%%%%%% MISR:', (t1-t0)*1.0/count_rate, ' s' |
---|
| 102 | else |
---|
| 103 | print *, '%%%%%% MISR not used' |
---|
| 104 | endif |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | !+++++++++++ Summary statistics +++++++++++ |
---|
| 108 | ! write(*,*) 'Stats:' |
---|
| 109 | ! read(*,*) c |
---|
| 110 | if (cfg%Lstats) then |
---|
| 111 | call system_clock(t0,count_rate,count_max) |
---|
| 112 | call cosp_stats(gbx,sgx,cfg,sgradar,sglidar,vgrid,stradar,stlidar) |
---|
| 113 | call system_clock(t1,count_rate,count_max) |
---|
| 114 | print *, '%%%%%% Stats:', (t1-t0)*1.0/count_rate, ' s' |
---|
| 115 | endif |
---|
| 116 | !+++++++++++ change of units after computation of statistics +++++++++++ |
---|
| 117 | if (cfg%Llidar_sim) then |
---|
| 118 | where((sglidar%beta_tot > 0.0) .and. (sglidar%beta_tot /= R_UNDEF)) |
---|
| 119 | sglidar%beta_tot = log10(sglidar%beta_tot) |
---|
| 120 | elsewhere |
---|
| 121 | sglidar%beta_tot = R_UNDEF |
---|
| 122 | end where |
---|
| 123 | endif |
---|
| 124 | |
---|
| 125 | END SUBROUTINE COSP_SIMULATOR |
---|
| 126 | |
---|
| 127 | END MODULE MOD_COSP_SIMULATOR |
---|