Ignore:
Timestamp:
Jan 11, 2021, 11:24:08 PM (4 years ago)
Author:
lguez
Message:

Sync latest trunk changes to Ocean_skin

Location:
LMDZ6/branches/Ocean_skin
Files:
1 deleted
106 edited
9 copied

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Ocean_skin

  • LMDZ6/branches/Ocean_skin/DefLists/CMIP6_ping_atmos.xml

    r3605 r3798  
    155155   <field id="CMIP6_loadss"        field_ref="loadss"           /> <!-- P1 (kg m-2) atmosphere_mass_content_of_seasalt_dry_aerosol : Load of Seasalt -->
    156156   <field id="CMIP6_longitude"     field_ref="dummy_not_provided"         /> <!-- P1 (degrees_east) longitude : Longitude -->
     157   <!--field id="CMIP6_lwsffluxaero"  field_ref="sollwad"         --> <!-- P2 (W m-2) longwave__flux__due_to_volcanic_aerosols_at_the_surface : downwelling longwave  flux  due to volcanic aerosols at the surface to be diagnosed through double radiation call with ok_volcan=y-->
    157158   <field id="CMIP6_lwsffluxaero"  field_ref="dummy_not_provided"         /> <!-- P2 (W m-2) longwave__flux__due_to_volcanic_aerosols_at_the_surface : downwelling longwave  flux  due to volcanic aerosols at the surface to be diagnosed through double radiation call -->
    158159   <field id="CMIP6_lwsrfasdust"   field_ref="dummy_not_provided"         /> <!-- P1 (W m-2) surface_instantaneous_longwave_forcing_due_to_dust : All-sky Surface Longwave radiative flux due to Dust -->
     
    161162   <field id="CMIP6_lwtoacsaer"    field_ref="toplwad0"         /> <!-- P1 (W m-2) toa_instantaneous_longwave_forcing : Clear-Sky LW-RF Aerosols at TOA -->
    162163   <field id="CMIP6_lwtoacsdust"   field_ref="dummy_not_provided"         /> <!-- P1 (W m-2) toa_instantaneous_longwave_forcing_due_to_dust_in_clearsky : Clear-sky TOA Longwave radiative flux due to Dust -->
     164   <!-- field id="CMIP6_lwtoafluxaerocs" field_ref="toplwad0"       --> <!-- P1 (W m-2) longwave_flux_due_to_volcanic_aerosols_at_TOA_under_clear_sky : downwelling longwave flux due to volcanic aerosols at TOA under clear sky to be diagnosed through double radiation call with ok_volcan=y -->
    163165   <field id="CMIP6_lwtoafluxaerocs" field_ref="dummy_not_provided"       /> <!-- P1 (W m-2) longwave_flux_due_to_volcanic_aerosols_at_TOA_under_clear_sky : downwelling longwave flux due to volcanic aerosols at TOA under clear sky to be diagnosed through double radiation call -->
    164166   <field id="CMIP6_mc"            field_ref="mc"               /> <!-- P1 (kg m-2 s-1) atmosphere_net_upward_convective_mass_flux : The net mass flux should represent the difference between the updraft and downdraft components.  The flux is computed as the mass divided by the area of the grid cell. -->
     
    282284   <field id="CMIP6_snwc"          field_ref="dummy_not_provided"         /> <!-- P1 (kg m-2) canopy_snow_amount : canopy_snow_amount -->
    283285   <field id="CMIP6_solbnd"        field_ref="solbnd"         />  <!-- P1 (W m-2) solar_irradiance : Top-of-Atmosphere Solar Insolation for each band -->
     286   <!-- field id="CMIP6_swsffluxaero"  field_ref="solswad"         --> <!-- P2 (W m-2) shortwave__flux_due_to_volcanic_aerosols_at__the_surface : downwelling shortwave  flux due to volcanic aerosols at  the surface to be diagnosed through double radiation call with ok_volcan=y-->
    284287   <field id="CMIP6_swsffluxaero"  field_ref="dummy_not_provided"         /> <!-- P2 (W m-2) shortwave__flux_due_to_volcanic_aerosols_at__the_surface : downwelling shortwave  flux due to volcanic aerosols at  the surface to be diagnosed through double radiation call -->
    285288   <field id="CMIP6_swsrfasdust"   field_ref="dummy_not_provided"         /> <!-- P1 (W m-2) tendency_of_all_sky_surface_shortwave_flux_due_to_dust_ambient_aerosol_particles : All-sky Surface Shortwave radiative flux due to Dust -->
     
    287290   <field id="CMIP6_swtoaasdust"   field_ref="dummy_not_provided"         /> <!-- P1 (W m-2) toa_instantaneous_shortwave_forcing : all sky sw-rf dust at toa -->
    288291   <field id="CMIP6_swtoacsdust"   field_ref="dummy_not_provided"         /> <!-- P1 (W m-2) toa_instantaneous_shortwave_forcing : clear sky sw-rf dust at toa -->
     292   <!-- field id="CMIP6_swtoafluxaerocs" field_ref="topswad0"       --> <!-- P1 (W m-2) shortwave_flux_due_to_volcanic_aerosols_at_TOA_under_clear_sky : downwelling shortwave flux due to volcanic aerosols at TOA under clear sky to be diagnosed through double radiation call with ok_volcan=y-->
    289293   <field id="CMIP6_swtoafluxaerocs" field_ref="dummy_not_provided"       /> <!-- P1 (W m-2) shortwave_flux_due_to_volcanic_aerosols_at_TOA_under_clear_sky : downwelling shortwave flux due to volcanic aerosols at TOA under clear sky to be diagnosed through double radiation call -->
    290294   <field id="CMIP6_sza"           field_ref="sza"              /> <!-- P1 (degree) solar_zenith_angle : solar zenith angle -->
  • LMDZ6/branches/Ocean_skin/DefLists/config_AMIP.def

    r3673 r3798  
    4646#
    4747### ok_ade=y/n   flag Aerosol direct effect
    48 ok_ade= y
     48ok_ade= n
    4949### ok_aie=y/n   flag Aerosol indirect effect
    50 ok_aie= y
     50ok_aie= n
    5151### aer_type =   Aerosol variation type : actuel / preind / scenario / annuel
    5252aer_type=annuel
     
    5555###  flag_aerosol = type of coupled aerosol, if aerosol offline
    5656###  0 => no aerosol, 1 => sulfate only, 2 => bc only, 3 => pom only, 4 => seasalt only, 5 => dust only, 6 => all aerosol
    57 flag_aerosol= 6
     57flag_aerosol= 0
    5858### ok_cdnc=y/n   Cloud droplet number concentration
    59 ok_cdnc= y
     59ok_cdnc= n
    6060# ok_alw=y flag pour activer l effet LW des poussieres
    6161ok_alw=y
     
    7171#
    7272# Aerosols stratospheriques utilises par defaut
    73 flag_aerosol_strat=2
     73flag_aerosol_strat=0
    7474# COSP
    75 ok_cosp= y
     75ok_cosp= n
  • LMDZ6/branches/Ocean_skin/DefLists/context_lmdz.xml

    r3673 r3798  
    1010              Each file contains the list of variables and their output levels -->
    1111
    12   <file_definition src="./file_def_histday_lmdz.xml"/>
    13   <file_definition src="./file_def_histhf_lmdz.xml"/>
    14   <file_definition src="./file_def_histins_lmdz.xml"/>
    15   <file_definition src="./file_def_histLES_lmdz.xml"/>
    16   <file_definition src="./file_def_histmth_lmdz.xml"/>
    17   <file_definition src="./file_def_histstn_lmdz.xml"/>
    18   <file_definition src="./file_def_histmthNMC_lmdz.xml"/>
    19   <file_definition src="./file_def_histdayNMC_lmdz.xml"/>
    20   <file_definition src="./file_def_histhfNMC_lmdz.xml"/>
    21   <file_definition src="./file_def_histmthCOSP_lmdz.xml"/>
    22   <file_definition src="./file_def_histdayCOSP_lmdz.xml"/>
    23   <file_definition src="./file_def_histhfCOSP_lmdz.xml"/> 
    24   <file_definition src="./file_def_histstrataer_lmdz.xml"/>
    25   <file_definition src="./file_def_histdaystrataer_lmdz.xml"/>
     12  <file_definition src="./histday_ave_2d.xml"/>
     13  <file_definition src="./histday_ave_3d.xml"/>
     14  <file_definition src="./histday_max.xml"/>
     15  <file_definition src="./histday_min.xml"/>
     16  <file_definition src="./histhf_ave.xml"/>
     17  <file_definition src="./histhf_ins.xml"/>
     18  <file_definition src="./histmth.xml"/>
    2619
    2720  <!-- Define domains and groups of domains -->
     
    7366        <reduce_domain operation="average" direction="iDir" />
    7467    </axis>
    75     <axis id="spectband" standard_name="Sensor Band Central Radiation Wavenumber" unit="m-1">
    76     </axis>
    77     <axis id="axis_lat" standard_name="Latitude axis">
    78         <reduce_domain operation="average" direction="iDir" />
    79     </axis>
    8068
    8169<!-- Cosp axis definitions-->
  • LMDZ6/branches/Ocean_skin/DefLists/context_lmdz_sans_cosp.xml

    r3605 r3798  
    7171    <axis id="axis_lat" standard_name="Latitude axis">
    7272      <reduce_domain operation="average" direction="iDir" />
    73     </axis>
    74     <axis id="spectband" standard_name="Sensor Band Central Radiation Wavenumber" unit="m-1">
    75     </axis>
    76     <axis id="axis_lat" standard_name="Latitude axis">
    77            <reduce_domain operation="average" direction="iDir" />
    7873    </axis>
    7974  </axis_definition>
  • LMDZ6/branches/Ocean_skin/DefLists/cospv2_input_nl.txt

    r3605 r3798  
    11! (c) British Crown Copyright 2008, the Met Office.
    22! All rights reserved.
    3 ! 
    4 ! Redistribution and use in source and binary forms, with or without modification, are permitted 
     3!
     4! Redistribution and use in source and binary forms, with or without modification, are permitted
    55! provided that the following conditions are met:
    6 ! 
    7 !     * Redistributions of source code must retain the above copyright notice, this list 
     6!
     7!     * Redistributions of source code must retain the above copyright notice, this list
    88!       of conditions and the following disclaimer.
    99!     * 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 
     10!       of conditions and the following disclaimer in the documentation and/or other materials
    1111!       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 
     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
    1414!       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 
     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
    2323! OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424
     
    2626! Namelist that sets up the main COSP options
    2727&COSP_INPUT
    28   NPOINTS_IT=10000,! Max number of gridpoints to be processed in one iteration
     28!  NPOINTS=153,! Number of gridpoints 153,27840,7081,6912
     29  NPOINTS_IT=5000,! Max number of gridpoints to be processed in one iteration
    2930  NCOLUMNS=20,  ! Number of subcolumns
    30   USE_VGRID=.true., ! Use fixed vertical grid for outputs? (if .true. then you need to define number of levels with Nlr)
    31   NLR=40,       ! Number of levels in statistical outputs (only used if USE_VGRID=.true.)
    32   CSAT_VGRID=.true., ! CloudSat vertical grid? (if .true. then the CloudSat standard grid is used for the outputs.
     31!  NLEVELS=38,   ! Number of model levels
     32  USE_VGRID_IN=.true., ! Use fixed vertical grid for outputs? (if .true. then you need to define number of levels with Nlr)
     33!  NLVGRID=40,       ! Number of levels in statistical outputs (only used if USE_VGRID=.true.)
     34  CSAT_VGRID_IN=.true., ! CloudSat vertical grid? (if .true. then the CloudSat standard grid is used for the outputs.
    3335                     !  USE_VGRID needs also be .true.)
     36!  DINPUT='./',  ! Directory where the input files are located. Useful when processing multiple files.
     37                ! Leave blank ('') if you are using the full path in FINPUT.
     38!  FINPUT='../data/inputs/UKMO/cosp_input_um.nc', ! List input NetCDF files
     39!  FOUTPUT='../data/outputs/UKMO/cosp2_output_um.nc',
    3440  !----------------------------------------------------------------------------------
    3541  !--------------- Inputs related to radar simulations
    3642  !----------------------------------------------------------------------------------
    37   RADAR_FREQ=94.0, ! CloudSat radar frequency (GHz)
     43  cloudsat_RADAR_FREQ=94.0, ! CloudSat radar frequency (GHz)
    3844  SURFACE_RADAR=0, ! surface=1, spaceborne=0
    39   use_mie_tables=0,! use a precomputed lookup table? yes=1,no=0
    40   use_gas_abs=1,   ! include gaseous absorption? yes=1,no=0
    41   do_ray=0,        ! calculate/output Rayleigh refl=1, not=0
    42   melt_lay=0,      ! melting layer model off=0, on=1
    43   k2=-1,           ! |K|^2, -1=use frequency dependent default
    44   use_reff=.true., ! True if you want effective radius to be used by radar simulator (always used by lidar)
    45   use_precipitation_fluxes=.true.,  ! True if precipitation fluxes are input to the algorithm
     45  cloudsat_use_gas_abs=1,   ! include gaseous absorption? yes=1,no=0
     46  cloudsat_do_ray=0,        ! calculate/output Rayleigh refl=1, not=0
     47  cloudsat_k2=-1,           ! |K|^2, -1=use frequency dependent default
     48  use_precipitation_fluxes=.true.,  ! True if precipitation fluxes are input to the algorithm
     49  cloudsat_micro_scheme='MMF_v3_single_moment', !'MMF_v3.5_two_moment'
    4650  !----------------------------------------------------------------------------------
    4751  !---------------- Inputs related to lidar simulations
    4852  !----------------------------------------------------------------------------------
    49   Nprmts_max_hydro=12, ! Max number of parameters for hydrometeor size distributions
    50   Naero=1,             ! Number of aerosol species (Not used)
    51   Nprmts_max_aero=1,   ! Max number of parameters for aerosol size distributions (Not used)
    5253  lidar_ice_type=0,    ! Ice particle shape in lidar calculations (0=ice-spheres ; 1=ice-non-spherical)
    53   OVERLAP=3,   !  overlap type: 1=max, 2=rand, 3=max/rand
     54  OVERLAP=3,           !  overlap assumption used by scops: 1=max, 2=rand, 3=max/rand
    5455  !----------------------------------------------------------------------------------
    5556  !---------------- Inputs related to ISCCP simulator
     
    7576                                 ! determined cloud-top temperature
    7677                                 ! 2 = find the *highest* altitude (lowest pressure) level
    77                                  ! with interpolated temperature equal to the radiance
    78                                  ! determined cloud-top temperature
     78                                 ! with interpolated temperature equal to the radiance
     79                                 ! determined cloud-top temperature. This is the
     80                                 ! default value since V4.0 of the ISCCP simulator.
    7981                                 ! ONLY APPLICABLE IF top_height EQUALS 1 or 3
    80                                  ! 1 = default setting, and matches all versions of
    81                                  ! ISCCP simulator with versions numbers 3.5.1 and lower
    82                                  ! 2 = experimental setting 
    8382  !----------------------------------------------------------------------------------
    8483  !-------------- RTTOV inputs
    8584  !----------------------------------------------------------------------------------
    86   Platform=1,    ! satellite platform
    87   Satellite=15,  ! satellite
    88   Instrument=0,  ! instrument
    89   Nchannels=8,   ! Number of channels to be computed
    90   Channels=1,3,5,6,8,10,11,13,        ! Channel numbers (please be sure that you supply Nchannels)
    91   Surfem=0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,  ! Surface emissivity (please be sure that you supply Nchannels)
    92   ZenAng=50.0, ! Satellite Zenith Angle
     85  rttov_Platform=1,    ! satellite platform
     86  rttov_Satellite=15,  ! satellite
     87  rttov_Instrument=5,  ! instrument
     88  rttov_Nchannels=3,   ! Number of channels to be computed
     89  rttov_Channels=1,2,3,        ! Channel numbers (please be sure that you supply Nchannels)
     90  rttov_Surfem=0.0,0.0,0.0,  ! Surface emissivity (please be sure that you supply Nchannels)
     91  rttov_ZenAng=50.0, ! Satellite Zenith Angle
    9392  CO2=5.241e-04, ! Mixing ratios of trace gases
    9493  CH4=9.139e-07,
     
    9695  CO=2.098e-07
    9796/
    98 
    99 
  • LMDZ6/branches/Ocean_skin/DefLists/field_def_lmdz.xml

    r3673 r3798  
    22<field_definition level="1" prec="4" operation="average" freq_op="1ts" enabled=".true." default_value="9.96921e+36">
    33   
    4 <!--    <field_group id="fields_1D" grid_ref="vertical">  -->
    5 <!--        <field id="Ap"   long_name="Hybrid coordinate: pressure part"    unit="Pa" />  -->
    6 <!--        <field id="Bp"   long_name="Hybrid coordinate: sigma part"    unit="-" />  -->
    7 <!--        <field id="Alt"  long_name="Pseudo-altitude (for an 8km scale height)"    unit="km" />  -->
    8 <!--    </field_group>  -->
    9 
    104    <field_group id="remap_expr" level="_reset_" prec="_reset_" operation="_reset_" freq_op="_reset_" enabled="_reset_" default_value="_reset_">
    115      <field_group id="remap_1ts" />
     
    1711      <field_group id="remap_1mo" />
    1812    </field_group>
    19    
    2013   
    2114    <field_group id="coordinates" grid_ref="grid_glo">
     
    5750        <field id="t2m_oce"    long_name="Temp 2m oce"    unit="K" />
    5851        <field id="t2m_sic"    long_name="Temp 2m sic"    unit="K" />
     52        <field id="t2m_probsup25"   field_ref="t2m" long_name="Prob. t2m exceeds 25 degC" unit="-"> t2m &gt; 298.15 </field>
     53        <field id="t2m_probsup28"   field_ref="t2m" long_name="Prob. t2m exceeds 28 degC" unit="-"> t2m &gt; 301.15 </field>
     54        <field id="t2m_probsup30"   field_ref="t2m" long_name="Prob. t2m exceeds 30 degC" unit="-"> t2m &gt; 303.15 </field>
    5955        <field id="gusts"    long_name="surface gustiness"    unit="m2/s2" />
    6056        <field id="wind10m"    long_name="10-m wind speed"      unit="m/s" />
    6157        <field id="wind10max"  long_name="10m wind speed max"   unit="m/s" operation="maximum"/>
     58        <field id="wind100m"   long_name="100-m wind speed"      unit="m/s" />
     59        <field id="woncfr"   long_name="Onshore Wind Capacity factor"      unit="kW/kW_installed" />
     60        <field id="wofcfr"   long_name="Offshore Wind Capacity factor"     unit="kW/kW_installed" />
    6261        <field id="sfcWindmax" field_ref="wind10m" operation="maximum" />
    6362        <field id="sicf"    long_name="Sea-ice fraction"        unit="-" />
     
    137136        <field id="SWdnSFCclr"    long_name="SWdn clear sky at surface"    unit="W/m2" />
    138137        <field id="SWdnSFCcleanclr"    long_name="SWdn clean (no aerosol) clear sky at surface"    unit="W/m2" />
     138        <field id="fdiffSWdnSFC"    long_name="Fraction of diffuse SWdn at surface"    unit="-" />
    139139        <field id="LWupSFC"    long_name="Upwd. IR rad. at surface"    unit="W/m2" />
    140140        <field id="LWupSFCclr"    long_name="CS Upwd. IR rad. at surface"    unit="W/m2" />
     
    439439        <field id="cldnvi"    long_name="Column Integrated Cloud Droplet Number"    unit="m-2" />
    440440        <field id="lcc"    long_name="Cloud liquid fraction at top of cloud"    unit="1" />
     441        <field id="lcc_limit"          field_ref="lcc" > lcc /= 0 ? lcc : 1e-15  </field>
    441442        <field id="wvapp"    long_name="-"    unit="-" />
    442443        <field id="albe_ter"    long_name="Albedo VIS surf. ter"    unit="-" />
     
    515516        <field id="flx_co2_ff"     long_name="CO2 flux from ff"               unit="kg CO2/m2/s" />    <!-- Added OB -->
    516517        <field id="flx_co2_bb"     long_name="CO2 flux from bb"               unit="kg CO2/m2/s" />    <!-- Added OB -->
     518        <field id="delta_SST" long_name="ocean-air interface temperature minus bulk SST" unit="K" detect_missing_value=".true." />
     519        <field id="delta_sal"
     520               long_name="ocean-air interface salinity minus bulk salinity"
     521               unit="ppt" detect_missing_value=".true." />
     522        <field id="dS_ns" long_name="delta salinity near surface" unit="ppt" detect_missing_value=".true." />
     523        <field id="dT_ns" long_name="sub-skin temperature minus foundation temperature" unit="K" detect_missing_value=".true." />
     524        <field id="dTer"               long_name="interface temperature minus sub-skin temperature"            unit="K" detect_missing_value=".true." />
     525        <field id="dSer"
     526               long_name="salinity variation in the diffusive microlayer"
     527               unit="ppt" detect_missing_value=".true." />
     528        <field id="tkt" long_name="thickness of thermal microlayer"            unit="m"                detect_missing_value=".true." />
     529        <field id="tks" long_name="thickness of salinity microlayer"           unit="m"                detect_missing_value=".true." />
     530        <field id="taur" long_name="momentum flux due to rain"         unit="Pa"               detect_missing_value=".true." />
     531        <field id="SSS" long_name="bulk sea-surface salinity" unit="ppt" detect_missing_value=".true." />
    517532    </field_group>
    518533
    519534    <field_group id="fields_3D" grid_ref="grid_glo_presnivs" >
    520535        <field id="tke"    long_name="TKE"    unit="m2/s2" />
     536        <field id="tke_dissip" long_name="TKE DISSIPATION" unit="m2/s3" />
    521537        <field id="tke_ter"    long_name="Max Turb. Kinetic Energy ter"    unit="m2/s2" />
    522538        <field id="tke_lic"    long_name="Max Turb. Kinetic Energy lic"    unit="m2/s2" />
     
    578594        <field id="rneblsvol" long_name="LS Cloud fraction by volume"    unit="-" />
    579595        <field id="rhum"    long_name="Relative humidity"    unit="-" />
     596        <field id="rhl" long_name="Relative humidity wrt liquid" unit="%" />
     597        <field id="rhi" long_name="Relative humidity wrt ice" unit="%" />
    580598        <field id="ozone"    long_name="Ozone mole fraction"    unit="-" />
    581599        <field id="ozone_daylight"    long_name="Daylight ozone mole fraction"    unit="-" />
     
    856874    </field_group>
    857875
    858     <field_group operation="average" freq_offset="0ts" freq_op="3h">  <!-- ----------------------------COSP------------------------ -->
    859 
    860     <field_group id="fields_COSP_CALIPSO_2D" grid_ref="grid_glo" freq_offset="0ts" freq_op="3h">
    861       <field id="cllcalipso"    long_name="Lidar Low-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    862       <field id="clhcalipso"    long_name="Lidar Hight-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    863       <field id="clmcalipso"    long_name="Lidar Mid-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    864       <field id="cltcalipso"    long_name="Lidar Total Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    865       <field id="pcllcalipso"   long_name="Lidar Low-level Cloud Fraction"   unit="%"  detect_missing_value=".true." > cllcalipso*100 </field>
    866       <field id="pclhcalipso"   long_name="Lidar Hight-level Cloud Fraction"   unit="%"  detect_missing_value=".true." > clhcalipso*100 </field>
    867       <field id="pclmcalipso"   long_name="Lidar Mid-level Cloud Fraction"   unit="%"  detect_missing_value=".true." > clmcalipso*100 </field>
    868       <field id="pcltcalipso"   long_name="Lidar Total Cloud Fraction"   unit="%" detect_missing_value=".true." > cltcalipso*100 </field>
    869       <field id="cllcalipsoice"   long_name="Lidar Ice-Phase Low-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    870       <field id="clhcalipsoice"   long_name="Lidar Ice-Phase Hight-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    871       <field id="clmcalipsoice"   long_name="Lidar Ice-Phase Mid-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    872       <field id="cltcalipsoice"   long_name="Lidar Ice-Phase Total Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    873       <field id="cllcalipsoliq"   long_name="Lidar Liq-Phase Low-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    874       <field id="clhcalipsoliq"   long_name="Lidar Liq-Phase Hight-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    875       <field id="clmcalipsoliq"   long_name="Lidar Liq-Phase Mid-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    876       <field id="cltcalipsoliq"   long_name="Lidar Liq-Phase Total Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    877       <field id="cllcalipsoun"    long_name="Lidar Undefined-Phase Low-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    878       <field id="clhcalipsoun"    long_name="Lidar Undefined-Phase Hight-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    879       <field id="clmcalipsoun"    long_name="Lidar Undefined-Phase Mid-level Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    880       <field id="cltcalipsoun"    long_name="Lidar Undefined-Phase Total Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    881       <field id="clopaquecalipso"  long_name="Lidar Opaque Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    882       <field id="clthincalipso"    long_name="Lidar Thin Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    883       <field id="clzopaquecalipso" long_name="Lidar mean altitude of opacity"   unit="m"  detect_missing_value=".true." />
    884     </field_group> 
    885     <field_group id="fields_COSP_CALIPSO_3D_height" grid_ref="grid_glo_height" freq_offset="0ts" freq_op="3h">
    886       <field id="clcalipso"  long_name="Lidar Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    887       <field id="pclcalipso" long_name="Lidar Cloud Fraction (532 nm)" unit="%" detect_missing_value=".true." > clcalipso*100 </field>
    888       <field id="clcalipsoice"    long_name="Lidar Ice-Phase Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    889       <field id="clcalipsoliq"    long_name="Lidar Liq-Phase Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    890       <field id="clcalipsoun"    long_name="Lidar Undefined-Phase Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    891       <field id="clcalipsoopaque"  long_name="Lidar Opaque Cloud profile Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    892       <field id="clcalipsothin"    long_name="Lidar Thin Cloud profile Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    893       <field id="clcalipsozopaque" long_name="Lidar z_opaque Fraction (532 nm)" unit="1"  detect_missing_value=".true." />
    894       <field id="clcalipsoopacity" long_name="Lidar opacity Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    895       <field id="proftemp"         long_name="Temperature profile (40 lev)" unit="K" detect_missing_value=".true." />
    896     </field_group>
    897     <field_group id="fields_COSP_CALIPSO_3D_heightmlev" grid_ref="grid_glo_heightmlev" freq_offset="0ts" freq_op="3h">
    898       <field id="beta_mol532" long_name="Lidar Molecular Backscatter (532 nm)" unit="m-1 sr-1" detect_missing_value=".true." />
    899     </field_group>
    900     <field_group id="fields_COSP_CALIPSO_3D_temp" grid_ref="grid_glo_temp" freq_offset="0ts" freq_op="3h">
    901       <field id="clcalipsotmp"    long_name="Lidar Cloud Fraction (532 nm)" unit="%"  detect_missing_value=".true." />
    902       <field id="clcalipsotmpliq" long_name="Lidar Liq-Phase Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    903       <field id="clcalipsotmpice" long_name="Lidar Ice-Phase Cloud Fraction (532 nm)" unit="1" detect_missing_value=".true." />
    904       <field id="clcalipsotmpun"  long_name="Undefined-Phase Total Cloud Fraction"   unit="1"  detect_missing_value=".true." />
    905     </field_group>
    906    <field_group id="fields_COSP_CALIPSO_3D_sza" grid_ref="grid_glo_sza" freq_offset="0ts" freq_op="3h">
    907      <field id="parasol_refl"  long_name="PARASOL-like mono-directional reflectance" unit="1" detect_missing_value=".true." />
    908       <field id="parasol_crefl"  long_name="PARASOL-like mono-directional reflectance (integral)" unit="1" detect_missing_value=".true." />
    909       <field id="Ncrefl"  long_name="Nb for PARASOL-like mono-directional reflectance" unit="1" detect_missing_value=".true." />
    910     </field_group>
    911       <field id="cfad_lidarsr532" long_name="Lidar Scattering Ratio CFAD (532 nm)" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dsrbin"  detect_missing_value=".true." />
    912       <field id="atb532" long_name="Lidar Attenuated Total Backscatter (532 nm)" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dcol"  detect_missing_value=".true." />
    913       <field id="profSR" long_name="Scattering Ratio profiles" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dcol2"  detect_missing_value=".true." />
    914 
    915     <field_group id="fields_COSP_CLOUDSAT_2D" grid_ref="grid_glo" freq_offset="0ts" freq_op="3h">
    916       <field id="cltlidarradar" long_name="Lidar and Radar Total Cloud Fraction" unit="1"  detect_missing_value=".true." />
    917     </field_group>
    918     <field_group id="fields_COSP_CLOUDSAT_3D" grid_ref="grid_glo_height" freq_offset="0ts" freq_op="3h">
    919       <field id="clcalipso2"  long_name="CALIPSO Cloud Fraction Undetected by CloudSat" unit="1" detect_missing_value=".true." />
    920     </field_group>
    921       <field id="dbze94" long_name="CloudSat Radar Reflectivity" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dcol"  detect_missing_value=".true." />
    922       <field id="cfadDbze94" long_name="CloudSat Radar Reflectivity CFAD" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Ddbze"  detect_missing_value=".true." />
    923 
    924     <field_group id="fields_COSP_ISCCP_2D" grid_ref="grid_glo" freq_offset="0ts" freq_op="3h">
    925       <field id="sunlit" long_name="1 for day points, 0 for nightime" unit="1"  detect_missing_value=".true." />
    926       <field id="tclisccp" long_name="Total Cloud Fraction as Calculated by the ISCCP Simulator" unit="1"  detect_missing_value=".true." />
    927       <field id="ctpisccp" long_name="Mean Cloud Top Pressure as Calculated by the ISCCP Simulator" unit="Pa"  detect_missing_value=".true." />
    928       <field id="tauisccp" long_name="Optical Depth as Calculated by the ISCCP Simulator" unit="1"  detect_missing_value=".true." />
    929       <field id="albisccp" long_name="Mean Cloud Albedo as Calculated by the ISCCP Simulator" unit="1"  detect_missing_value=".true." />
    930       <field id="meantbisccp" long_name="Mean all-sky 10.5 micron brightness temperature as calculated by the ISCCP Simulator" unit="K"  detect_missing_value=".true." />
    931       <field id="meantbclrisccp" long_name="Mean clear-sky 10.5 micron brightness temperature as calculated by the ISCCP Simulator" unit="K"  detect_missing_value=".true." />
    932     </field_group>
    933     <field_group id="fields_COSP_ISCCP_3D" grid_ref="grid_glo_column" freq_offset="0ts" freq_op="3h">
    934       <field id="boxtauisccp" long_name="Optical Depth in Each Column as Calculated by the ISCCP Simulator" unit="1" detect_missing_value=".true." />
    935       <field id="boxptopisccp" long_name="Cloud Top Pressure in Each Column as Calculated by the ISCCP Simulator" unit="Pa" detect_missing_value=".true." />
    936     </field_group>
    937       <field id="clisccp2" long_name="Cloud Fraction as Calculated by the ISCCP Simulator" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dtau"  detect_missing_value=".true." />
    938 
    939     <field_group id="fields_COSP_MISR" freq_offset="0ts" freq_op="3h">
    940       <field id="clMISR" long_name="Cloud Fraction as Calculated by the MISR Simulator" unit="1" grid_ref="grid4Dmisr"  detect_missing_value=".true." />
    941     </field_group>
    942 
    943     <field_group id="fields_COSP_MODIS" grid_ref="grid_glo" freq_offset="0ts"  freq_op="3h">
    944       <field id="cllmodis" long_name="MODIS Low-level Cloud Fraction" unit="1"  detect_missing_value=".true." />
    945       <field id="clmmodis" long_name="MODIS Mid-level Cloud Fraction" unit="1"  detect_missing_value=".true." />
    946       <field id="clhmodis" long_name="MODIS Hight-level Cloud Fraction" unit="1"  detect_missing_value=".true." />
    947       <field id="cltmodis" long_name="MODIS Total Cloud Fraction" unit="1"  detect_missing_value=".true." />
    948       <field id="clwmodis" long_name="MODIS Cloud Fraction water mean" unit="1"  detect_missing_value=".true." />
    949       <field id="climodis" long_name="MODIS Cloud Fraction ice mean" unit="1"  detect_missing_value=".true." />
    950       <field id="tautmodis" long_name="MODIS Optical_Thickness_Total_Mean" unit="1"  detect_missing_value=".true." />
    951       <field id="tauwmodis" long_name="MODIS Optical_Thickness_Water_Mean" unit="1"  detect_missing_value=".true." />
    952       <field id="tauimodis" long_name="MODIS Optical_Thickness_Ice_Mean" unit="1"  detect_missing_value=".true." />
    953       <field id="tautlogmodis" long_name="MODIS Optical_Thickness_Total_logMean" unit="1"  detect_missing_value=".true." />
    954       <field id="tauwlogmodis" long_name="MODIS Optical_Thickness_Water_logMean" unit="1"  detect_missing_value=".true." />
    955       <field id="tauilogmodis" long_name="MODIS Optical_Thickness_Ice_logMean" unit="1"  detect_missing_value=".true." />
    956       <field id="reffclwmodis"  long_name="Modis Cloud_Particle_Size_Water_Mean" unit="m"  detect_missing_value=".true." />
    957       <field id="reffclimodis"  long_name="Modis Cloud_Particle_Size_Ice_Mean" unit="m"  detect_missing_value=".true." />
    958       <field id="pctmodis"  long_name="Modis Cloud_Top_Pressure_Total_Mean" unit="Pa"  detect_missing_value=".true." />
    959       <field id="lwpmodis" long_name="Modis Liquid_Water_Path_Mean" unit="kg m-2"  detect_missing_value=".true." />
    960       <field id="iwpmodis" long_name="Modis Ice_Water_Path_Mean" unit="kg m-2" detect_missing_value=".true." />
    961     </field_group>
    962       <field id="clmodis" long_name="MODIS Cloud Area Fraction" unit="1"  grid_ref="grid4Dtau"  detect_missing_value=".true." />
    963       <field id="crimodis" long_name="MODIS Optical_Thickness_vs_ReffIce" unit="1" grid_ref="grid4Dreffi"  detect_missing_value=".true." />
    964       <field id="crlmodis" long_name="MODIS Optical_Thickness_vs_ReffLiq" unit="1" grid_ref="grid4Dreffl"  detect_missing_value=".true." />
    965 
    966 
    967     </field_group>  <!-- ----------------------------COSP------------------------ -->
     876
    968877
    969878    <field_group id="fields_AIRS" grid_ref="grid_glo" operation="instant" freq_op="3h">
  • LMDZ6/branches/Ocean_skin/DefLists/field_def_lmdz_cospv2.xml

    r3605 r3798  
    1 <!-- $Id: field_def_lmdz.xml 3515 2019-05-21 10:41:38Z emillour $ -->
     1<!-- $Id: field_def_lmdz.xml 3622 2020-01-15 10:50:43Z oboucher $ -->
    22<field_definition level="1" prec="4" operation="average" freq_op="1ts" enabled=".true." default_value="9.96921e+36">
    33   
     
    6060        <field id="wind10m"    long_name="10-m wind speed"      unit="m/s" />
    6161        <field id="wind10max"  long_name="10m wind speed max"   unit="m/s" operation="maximum"/>
    62         <field id="sfcWindmax" field_ref="wind10m" operation="maximum" />
     62        <field id="wind100m"   long_name="100-m wind speed"      unit="m/s" />
     63        <field id="sfcWindmax" field_ref="wind10m" operation="maximum" />
    6364        <field id="sicf"    long_name="Sea-ice fraction"        unit="-" />
    6465        <field id="q2m"     long_name="Specific humidity 2m"    unit="kg/kg" />
     
    511512        <field id="colO3_strat"    long_name="Ozone stratospheric column"     unit="DU" />             <!-- Added ThL -->
    512513        <field id="colO3_trop"     long_name="Ozone tropospheric column"      unit="DU" />             <!-- Added ThL -->
     514        <field id="flx_co2_land"   long_name="CO2 flux from land"             unit="kg CO2/m2/s" />    <!-- Added OB -->
     515        <field id="flx_co2_ocean"  long_name="CO2 flux from ocean"            unit="kg CO2/m2/s" />    <!-- Added OB -->
     516        <field id="flx_co2_ff"     long_name="CO2 flux from ff"               unit="kg CO2/m2/s" />    <!-- Added OB -->
     517        <field id="flx_co2_bb"     long_name="CO2 flux from bb"               unit="kg CO2/m2/s" />    <!-- Added OB -->
    513518    </field_group>
    514519
     
    852857    </field_group>
    853858
    854 <!-- LIDAR DIAGNOSTICS -->
     859   
     860    <!-- LIDAR DIAGNOSTICS -->
    855861    <field_group id="fields_COSP_LIDAR_2D" grid_ref="grid_glo" freq_offset="0ts" freq_op="3h">
    856862<!-- CALIPSO 2D -->
     
    10151021      <field id="modis_ot_vs_reffliq" long_name="MODIS Joint-PDF of optical-depth and liquid particle size" unit="1" freq_offset="0ts" freq_op="3h" grid_ref="grid4Dreffl"  detect_missing_value=".true." />
    10161022
    1017    
     1023
    10181024    <field_group id="fields_AIRS" grid_ref="grid_glo" operation="instant" freq_op="3h">
    10191025      <field id="alt_tropo" long_name="Tropopause pressure" unit="hPa" />
     
    10641070<!-- reducing mass 3D variable to atmosphere total mass scalar -->
    10651071      <field id="mass_sum_axis"    field_ref="mass" grid_ref="grid_sum_axis" freq_op="1mo" > @mass  </field>
    1066       <field id="mass_sum" field_ref="mass_sum_axis" grid_ref="grid_sum" freq_op="1mo" > @mass_sum_axis  </field>
     1072      <field id="mass_sum" field_ref="mass_sum_axis" grid_ref="grid_sum" freq_op="1mo" > @mass_sum_axis*aire  </field>
    10671073   </field_group>
    10681074
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histdayCOSP_lmdz.xml

    r3605 r3798  
    1 <file_definition>
     1<file_definition type="one_file">
    22      <file_group id="defile">
    3         <file id="histdayCOSP" name="histdayCOSP" output_freq="1d" output_level="_AUTO_"  enabled="_AUTO_" compression_level="0">
     3        <file id="histdayCOSP" name="histdayCOSP" output_freq="1d" output_level="_AUTO_"  enabled="_AUTO_" compression_level="2" sync_freq="1d">
    44         
    55            <field_group group_ref="remap_1d">
     
    1010                <field field_ref="clhcalipso"         level="5" grid_ref="grid_out"/>
    1111                <field field_ref="cltcalipso"         level="5" grid_ref="grid_out"/>
    12                 <field field_ref="pcllcalipso"         level="5" grid_ref="grid_out"/>
    13                 <field field_ref="pclmcalipso"         level="5" grid_ref="grid_out"/>
    14                 <field field_ref="pclhcalipso"         level="5" grid_ref="grid_out"/>
    15                 <field field_ref="pcltcalipso"         level="5" grid_ref="grid_out"/>
    1612                <field field_ref="cllcalipsoice"         level="5" grid_ref="grid_out"/>
    1713                <field field_ref="clmcalipsoice"         level="5" grid_ref="grid_out"/>
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histdayCOSPv2_lmdz.xml

    r3605 r3798  
    11<file_definition>
    22      <file_group id="defile">
    3         <file id="histdayCOSP" name="histdayCOSP" output_freq="1d" output_level="1" type="one_file" enabled=".TRUE.">
     3        <file id="histdayCOSP" name="histdayCOSP" output_freq="1d" output_level="1" type="one_file" enabled=".TRUE." compression_level="2" sync_freq="1d">
     4<!-- <variable id="LongName" type="string">LMDZOR configuration</variable> -->
    45            <!-- VARS LIDAR -->
    5             <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
     6            <field_group operation="average" freq_op="3h" freq_offset="0ts" detect_missing_value=".true.">
    67            <!-- VARS CALIPSO -->
    7                 <field field_ref="cllcalipso"           level="1" />
     8                <field field_ref="cllcalipso"           level="0" />
    89                <field field_ref="clmcalipso"           level="1" />
    910                <field field_ref="clhcalipso"           level="1" />
    1011                <field field_ref="cltcalipso"           level="1" />
    11                 <field field_ref="pcllcalipso"          level="10" />
    12                 <field field_ref="pclmcalipso"          level="10" />
    13                 <field field_ref="pclhcalipso"          level="10" />
    14                 <field field_ref="pcltcalipso"          level="10" />
    1512                <field field_ref="cllcalipsoice"        level="1" />
    1613                <field field_ref="clmcalipsoice"        level="1" />
     
    103100            <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
    104101<!--                <field field_ref="sunlit" level="1" /> -->
    105                 <field field_ref="clisccp"             level="1" />
    106                 <field field_ref="boxtauisccp"         level="1" />
    107                 <field field_ref="boxptopisccp"        level="1" />
    108                 <field field_ref="cltisccp"            level="1" />
    109                 <field field_ref="pctisccp"            level="1" />
    110                 <field field_ref="tauisccp"            level="1" />
    111                 <field field_ref="albisccp"            level="1" />
    112                 <field field_ref="meantbisccp"         level="1" />
    113                 <field field_ref="meantbclrisccp"      level="1" />
     102                <field field_ref="clisccp"             level="10" />
     103                <field field_ref="boxtauisccp"         level="10" />
     104                <field field_ref="boxptopisccp"        level="10" />
     105                <field field_ref="cltisccp"            level="10" />
     106                <field field_ref="pctisccp"            level="10" />
     107                <field field_ref="tauisccp"            level="10" />
     108                <field field_ref="albisccp"            level="10" />
     109                <field field_ref="meantbisccp"         level="10" />
     110                <field field_ref="meantbclrisccp"      level="10" />
    114111             </field_group>
    115112             <!-- VARS MISR -->
    116113            <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
    117                 <field field_ref="misr_fq"             level="1" />
    118                 <field field_ref="misr_meanztop"       level="1" />
    119                 <field field_ref="misr_cldarea"        level="1" />
     114                <field field_ref="misr_fq"             level="10" />
     115                <field field_ref="misr_meanztop"       level="10" />
     116                <field field_ref="misr_cldarea"        level="10" />
    120117            </field_group>
    121118             <!-- VARS MODIS -->
    122119            <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
    123                 <field field_ref="cllmodis"            level="1" />
    124                 <field field_ref="clmmodis"            level="1" />
    125                 <field field_ref="clhmodis"            level="1" />
    126                 <field field_ref="cltmodis"            level="1" />
    127                 <field field_ref="clwmodis"            level="1" />
    128                 <field field_ref="climodis"            level="1" />
    129                 <field field_ref="tautmodis"           level="1" />
    130                 <field field_ref="tauwmodis"           level="1" />
    131                 <field field_ref="tauimodis"           level="1" />
    132                 <field field_ref="tautlogmodis"        level="1" />
    133                 <field field_ref="tauilogmodis"        level="1" />
    134                 <field field_ref="tauwlogmodis"        level="1" />
    135                 <field field_ref="reffclwmodis"        level="1" />
    136                 <field field_ref="reffclimodis"        level="1" />
    137                 <field field_ref="pctmodis"            level="1" />
    138                 <field field_ref="lwpmodis"            level="1" />
    139                 <field field_ref="iwpmodis"            level="1" />
    140                 <field field_ref="modis_ot_vs_ctp"     level="1" />
    141                 <field field_ref="modis_ot_vs_reffice" level="1" />
    142                 <field field_ref="modis_ot_vs_reffliq" level="1" />
     120                <field field_ref="cllmodis"            level="10" />
     121                <field field_ref="clmmodis"            level="10" />
     122                <field field_ref="clhmodis"            level="10" />
     123                <field field_ref="cltmodis"            level="10" />
     124                <field field_ref="clwmodis"            level="10" />
     125                <field field_ref="climodis"            level="10" />
     126                <field field_ref="tautmodis"           level="10" />
     127                <field field_ref="tauwmodis"           level="10" />
     128                <field field_ref="tauimodis"           level="10" />
     129                <field field_ref="tautlogmodis"        level="10" />
     130                <field field_ref="tauilogmodis"        level="10" />
     131                <field field_ref="tauwlogmodis"        level="10" />
     132                <field field_ref="reffclwmodis"        level="10" />
     133                <field field_ref="reffclimodis"        level="10" />
     134                <field field_ref="pctmodis"            level="10" />
     135                <field field_ref="lwpmodis"            level="10" />
     136                <field field_ref="iwpmodis"            level="10" />
     137                <field field_ref="modis_ot_vs_ctp"     level="10" />
     138                <field field_ref="modis_ot_vs_reffice" level="10" />
     139                <field field_ref="modis_ot_vs_reffliq" level="10" />
    143140            </field_group>
    144141
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histdayNMC_lmdz.xml

    r3605 r3798  
    33        <file id="histdayNMC" name="histdayNMC" output_freq="1d" output_level="5" enabled="_AUTO_" compression_level="4">
    44
     5            <field_group group_ref="remap_1d">
     6
    57            <!-- VARS 3D -->
    6             <field_group operation="average" freq_op="1ts" detect_missing_value=".true.">
     8            <field_group operation="average" grid_ref="grid_out_plev" freq_op="1ts" detect_missing_value=".true.">
    79<!--            <field field_ref="tnondef" level="5" /> -->
    810                <field field_ref="ta" level="1" />
     
    2527                <field field_ref="v2" level="6" />
    2628                <field field_ref="T2" level="6" />
     29              </field_group>
    2730            </field_group>
    2831        </file>
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histhfCOSP_lmdz.xml

    r3605 r3798  
    11<file_definition>
    22     <file_group id="defile">
    3         <file id="histhfCOSP" name="histhfCOSP" output_freq="3h" output_level="0"  enabled=".TRUE." compression_level="4">
     3        <file id="histhfCOSP" name="histhfCOSP" output_freq="3h" output_level="0"  enabled=".FALSE." compression_level="2" sync_freq="3h">
    44            <!-- VARS Calipso and PARASOL -->
    55            <field_group operation="instant" freq_op="3h" detect_missing_value=".true.">
     
    88                <field field_ref="clhcalipso"         level="5" />
    99                <field field_ref="cltcalipso"         level="5" />
    10                 <field field_ref="pcllcalipso"         level="5" />
    11                 <field field_ref="pclmcalipso"         level="5" />
    12                 <field field_ref="pclhcalipso"         level="5" />
    13                 <field field_ref="pcltcalipso"         level="5" />
    1410                <field field_ref="cllcalipsoice"         level="5" />
    1511                <field field_ref="clmcalipsoice"         level="5" />
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histhfCOSPv2_lmdz.xml

    r3605 r3798  
    11<file_definition>
    22     <file_group id="defile">
    3         <file id="histhfCOSP" name="histhfCOSP" output_freq="3h" output_level="0" type="one_file" enabled=".TRUE.">
     3        <file id="histhfCOSP" name="histhfCOSP" output_freq="3h" output_level="0" type="one_file" enabled=".FALSE." compression_level="2" sync_freq="3h">
    44            <!-- VARS LIDAR -->
    5             <field_group operation="instant" freq_op="3h" detect_missing_value=".true.">
     5            <field_group operation="instant" freq_offset="0ts" freq_op="3h" detect_missing_value=".true.">
    66            <!-- VARS CALIPSO -->
    7                 <field field_ref="cllcalipso"           level="1" />
     7                <field field_ref="cllcalipso"           level="0" />
    88                <field field_ref="clmcalipso"           level="1" />
    99                <field field_ref="clhcalipso"           level="1" />
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histhf_lmdz.xml

    r3605 r3798  
    3333                <field field_ref="gusts" level="10" />
    3434                <field field_ref="wind10m" level="10" />
     35                <field field_ref="wind100m" level="10" />
    3536                <field field_ref="wind10max" level="10" operation="maximum" />
    3637                <field field_ref="sicf" level="10" />
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histmthCOSP_lmdz.xml

    r3605 r3798  
    11<file_definition>
    22     <file_group id="defile">
    3         <file id="histmthCOSP" name="histmthCOSP" output_freq="1mo" output_level="_AUTO_"  enabled="_AUTO_" compression_level="0">
     3        <file id="histmthCOSP" name="histmthCOSP" output_freq="1mo" output_level="_AUTO_"  enabled="_AUTO_" compression_level="2">
    44
    55            <field_group group_ref="remap_1mo">
     
    1111                <field field_ref="clhcalipso"         level="5" grid_ref="grid_out"/>
    1212                <field field_ref="cltcalipso"         level="5" grid_ref="grid_out"/>
    13                 <field field_ref="pcllcalipso"         level="5" grid_ref="grid_out"/>
    14                 <field field_ref="pclmcalipso"         level="5" grid_ref="grid_out"/>
    15                 <field field_ref="pclhcalipso"         level="5" grid_ref="grid_out"/>
    16                 <field field_ref="pcltcalipso"         level="5" grid_ref="grid_out"/>
    1713                <field field_ref="cllcalipsoice"         level="5" grid_ref="grid_out"/>
    1814                <field field_ref="clmcalipsoice"         level="5" grid_ref="grid_out"/>
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histmthCOSPv2_lmdz.xml

    r3605 r3798  
    11<file_definition>
    22     <file_group id="defile">
    3         <file id="histmthCOSP" name="histmthCOSP" output_freq="1mo" output_level="1"  enabled=".TRUE." compression_level="4">
     3        <file id="histmthCOSP" name="histmthCOSP" output_freq="1mo" output_level="1"  enabled=".TRUE." compression_level="2">
    44
    55            <!-- VARS LIDAR -->
     
    104104            <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
    105105<!--                <field field_ref="sunlit" level="1" /> -->
    106                 <field field_ref="clisccp"             level="1" />
    107                 <field field_ref="boxtauisccp"         level="1" />
    108                 <field field_ref="boxptopisccp"        level="1" />
    109                 <field field_ref="cltisccp"            level="1" />
    110                 <field field_ref="pctisccp"            level="1" />
    111                 <field field_ref="tauisccp"            level="1" />
    112                 <field field_ref="albisccp"            level="1" />
    113                 <field field_ref="meantbisccp"         level="1" />
    114                 <field field_ref="meantbclrisccp"      level="1" />
     106                <field field_ref="clisccp"             level="10" />
     107                <field field_ref="boxtauisccp"         level="10" />
     108                <field field_ref="boxptopisccp"        level="10" />
     109                <field field_ref="cltisccp"            level="10" />
     110                <field field_ref="pctisccp"            level="10" />
     111                <field field_ref="tauisccp"            level="10" />
     112                <field field_ref="albisccp"            level="10" />
     113                <field field_ref="meantbisccp"         level="10" />
     114                <field field_ref="meantbclrisccp"      level="10" />
    115115            </field_group>
    116116             <!-- VARS MISR -->
    117117            <field_group operation="average" freq_op="3h" detect_missing_value=".true.">
    118                 <field field_ref="misr_fq"             level="1" />
     118                <field field_ref="misr_fq"             level="10" />
    119119                <field field_ref="misr_meanztop"       level="10" />
    120                 <field field_ref="misr_cldarea"        level="1" />
     120                <field field_ref="misr_cldarea"        level="10" />
    121121            </field_group>
    122122             <!-- VARS MODIS -->
  • LMDZ6/branches/Ocean_skin/DefLists/file_def_histmth_lmdz.xml

    r3673 r3798  
    22<file_definition>
    33        <file_group id="defile">
    4         <file id="histmth" name="histmth" output_freq="1mo" output_level="_AUTO_"  enabled="_AUTO_" compression_level="2">
     4        <file id="histmth" name="histmth" output_freq="1mo" output_level="1"  enabled=".true." compression_level="0">
    55
    66            <!-- VARS 1D -->
  • LMDZ6/branches/Ocean_skin/DefLists/gcm.def

    r3673 r3798  
    11## $Id: gcm.def 1403 2010-07-01 09:02:53Z fairhead $
    22## nombre de pas par jour (multiple de iperiod) ( ici pour  dt = 1 min )     
    3 day_step=480
     3day_step=240
    44## periode pour le pas Matsuno (en pas)
    55iperiod=5
     
    1515niterh=2
    1616## temps de dissipation des plus petites long.d ondes pour u,v (gradiv) 
    17 tetagdiv=5400.
     17tetagdiv=3600.
    1818## temps de dissipation des plus petites long.d ondes pour u,v(nxgradrot)
    19 tetagrot=5400.
     19tetagrot=21600.
    2020## temps de dissipation des plus petites long.d ondes pour  h ( divgrad)
    21 tetatemp=5400.
     21tetatemp=10800.
    2222## coefficient pour gamdissip                                           
     23ngroup = 4
    2324coefdis=0.
    2425## choix du shema d'integration temporelle (Matsuno:y ou Matsuno-leapfrog:n)
     
    3435read_start=y
    3536## periode de la physique (en pas dynamiques, n'a de sens que si iflag_phys=1)                                       
    36 iphysiq=10
    37 ##  Avec ou sans strato
    38 ok_strato=y
    39 #  Couche eponge dans les couches de pression plus faible que 100 fois la pression de la derniere couche
    40 iflag_top_bound=2
    41 #  Coefficient pour la couche eponge (valeur derniere couche)
    42 tau_top_bound=5.e-5
     37iphysiq=5
    4338## longitude en degres du centre du zoom                                 
    4439clon=0.
  • LMDZ6/branches/Ocean_skin/DefLists/iodef.xml

    r3673 r3798  
    1 <?xml version="1.0"?>
     1<?xml version = "1.0"?>
    22<simulation>
    3        
    4         <context  id="xios">
    5                 <variable_definition>
    6                 <variable_group id="buffer">
    7                 buffer_size = 85000000
    8                 buffer_server_factor_size = 2
    9                 </variable_group>
     3  <context  id = "xios">
     4    <variable_definition>
     5      <variable_group id = "buffer">
     6        buffer_size = 85000000
     7        buffer_server_factor_size = 2
     8      </variable_group>
    109
    11                 <variable_group id="parameters" >
    12                         <variable id="using_server" type="bool">true</variable>
    13                         <variable id="info_level" type="int">0</variable>
    14                 </variable_group>
    15                 </variable_definition>
    16         </context>
    17        
     10      <variable_group id = "parameters" >
     11        <variable id = "using_server" type = "bool">false</variable>
     12        <variable id = "info_level" type = "int">0</variable>
     13      </variable_group>
    1814
    19         <context id="LMDZ" src="./context_lmdz.xml"/>
     15      <variable id = "print_file" type = "bool">true</variable>
     16    </variable_definition>
    2017
     18  </context>
    2119
     20  <context id = "LMDZ" src = "./context_lmdz.xml"/>
    2221</simulation>
  • LMDZ6/branches/Ocean_skin/DefLists/physiq.def_NPv6.1

    r3673 r3798  
    169169iflag_albedo=1
    170170
    171           # Frequence appel rayonnement. Nombre appels par jour
     171          # Frequence appel convection. Nombre appels par jour
    172172nbapp_cv=48
    173173
     
    557557
    558558cdnc_min=10.
    559 
    560 
     559flag_ocean_skin=3
     560activate_ocean_skin = 1
  • LMDZ6/branches/Ocean_skin/DefLists/run.def

    r3673 r3798  
    44INCLUDEDEF=gcm.def
    55INCLUDEDEF=vert.def
    6 INCLUDEDEF=orchidee.def
    76INCLUDEDEF=config.def
    8 INCLUDEDEF=reprobus.def
    9 INCLUDEDEF=guide.def
    10 INCLUDEDEF=inca.def
    117## Type de calendrier utilise
    128## valeur possible: earth_360d (defaut), earth_365d, earth_366d
    13 calend= gregorian
     9calend= earth_365d
    1410## Jour de l etat initial ( = 350  si 20 Decembre ,par expl. ,comme ici )
    1511dayref= 1
     
    1713anneeref= 1979
    1814## Nombre de jours d integration
    19 nday= 365
     15nday= 28
    2016## Remise a zero de la date initiale
    2117raz_date= 0
     
    4440### VEGET= y si ORCHIDEE, =n si bucket
    4541### VEGET is modified automatically by the lmdz.driver
    46 VEGET= y
     42VEGET= betaclim
    4743### Choice of tracers type_trac=lmdz/inca/repr
    4844### type_trac is set automatically by the lmdz.driver
  • LMDZ6/branches/Ocean_skin/arch/arch-X64_IRENE.path

    r3605 r3798  
    11NETCDF_LIBDIR="-L$NETCDFFORTRAN_LIBDIR -L$NETCDF_LIBDIR -lnetcdf -lnetcdff"
    22NETCDF_INCDIR=-I$NETCDFFORTRAN_INCDIR
    3 IOIPSL_INCDIR="$LMDGCM/../../lib -I$LMDGCM/../IOIPSL/inc"
    4 IOIPSL_LIBDIR="$LMDGCM/../../lib -lioipsl -L$LMDGCM/../IOIPSL/lib"
     3IOIPSL_INCDIR=$CCCWORKDIR/build/IOIPSL/src
     4IOIPSL_LIBDIR=$CCCWORKDIR/build/IOIPSL/src
    55ORCH_INCDIR=$LMDGCM/../../lib
    66ORCH_LIBDIR=$LMDGCM/../../lib
     
    99INCA_LIBDIR=$LMDGCM/../INCA/build/lib
    1010INCA_INCDIR=$LMDGCM/../INCA/build/inc
    11 XIOS_INCDIR=$LMDGCM/../XIOS/inc
    12 XIOS_LIBDIR=$LMDGCM/../XIOS/lib
     11XIOS_INCDIR=$CCCWORKDIR/include/XIOS
     12XIOS_LIBDIR=$CCCWORKDIR/lib
  • LMDZ6/branches/Ocean_skin/arch/arch-X64_JEANZAY.path

    r3673 r3798  
    44NETCDF_LIBDIR="-lnetcdf -lnetcdff"
    55NETCDF_INCDIR=
    6 IOIPSL_INCDIR="$LMDGCM/../../lib -I$LMDGCM/../IOIPSL/inc"
    7 IOIPSL_LIBDIR="$LMDGCM/../../lib -lioipsl -L$LMDGCM/../IOIPSL/lib"
     6IOIPSL_INCDIR=$WORK/build/IOIPSL_debug/src
     7IOIPSL_LIBDIR=$WORK/build/IOIPSL_debug/src
    88ORCH_INCDIR=$LMDGCM/../../lib
    99ORCH_LIBDIR=$LMDGCM/../../lib
     
    1212INCA_LIBDIR=$LMDGCM/../INCA/build/lib
    1313INCA_INCDIR=$LMDGCM/../INCA/build/inc
    14 XIOS_INCDIR=$LMDGCM/../XIOS/inc
    15 XIOS_LIBDIR=$LMDGCM/../XIOS/lib
     14XIOS_INCDIR=$WORK/include/XIOS
     15XIOS_LIBDIR=$WORK/lib
  • LMDZ6/branches/Ocean_skin/arch/arch-ifort_CICLAD.path

    r3039 r3798  
    11NETCDF_LIBDIR="-L${NETCDF_HOME}/lib -lnetcdf -lnetcdff"
    22NETCDF_INCDIR=-I${NETCDF_HOME}/include
    3 IOIPSL_INCDIR=$LMDGCM/../../lib
    4 IOIPSL_LIBDIR=$LMDGCM/../../lib
     3IOIPSL_INCDIR="$LMDGCM/../../lib -I$LMDGCM/../IOIPSL/inc"
     4IOIPSL_LIBDIR="$LMDGCM/../../lib -lioipsl -L$LMDGCM/../IOIPSL/lib"
    55ORCH_INCDIR=$LMDGCM/../../lib
    66ORCH_LIBDIR=$LMDGCM/../../lib
  • LMDZ6/branches/Ocean_skin/arch/arch-ifort_LSCE.path

    r2184 r3798  
    11NETCDF_LIBDIR="-L/usr/local/install/netcdf-4.3.2p/lib -lnetcdff -lnetcdf -L/usr/local/install/hdf5-1.8.9p/lib -lhdf5_hl -lhdf5 -lhdf5 -lz -lcurl"
    22NETCDF_INCDIR=-I/usr/local/install/netcdf-4.3.2p/include
    3 IOIPSL_INCDIR=$LMDGCM/../../lib
    4 IOIPSL_LIBDIR=$LMDGCM/../../lib
     3IOIPSL_INCDIR="$LMDGCM/../../lib -I$LMDGCM/../IOIPSL/inc"
     4IOIPSL_LIBDIR="$LMDGCM/../../lib -lioipsl -L$LMDGCM/../IOIPSL/lib"
    55ORCH_INCDIR=$LMDGCM/../../lib
    66ORCH_LIBDIR=$LMDGCM/../../lib
  • LMDZ6/branches/Ocean_skin/bld.cfg

    r3673 r3798  
    2727src::dyn_phys_sub %DYN_PHYS_SUB
    2828src::sisvat  %SISVAT
     29src::inlandsis  %INLANDSIS
    2930src::rrtm    %RRTM
    3031src::dust    %DUST
     
    4748dir::root            %CONFIG_PATH
    4849#dir::lib             %BASE_CONFIG_PATH
    49 dir::bin             %ROOT_PATH/bin
     50dir::bin             %LIBO
    5051
    5152#search_src           1
  • LMDZ6/branches/Ocean_skin/build_gcm

    r1907 r3798  
    4646${dirname}fcm build $*
    4747
     48err=$?
     49# Check error message from fcm build
     50if [ $err != 0 ] ; then
     51  # ERROR IN COMPILING
     52  echo ERROR IN COMPILING LMDZ : $err
     53  exit 1
     54fi
     55
    4856# cleanup
    4957\rm -f '.lock'
  • LMDZ6/branches/Ocean_skin/libf/dyn3d_common/infotrac.F90

    r3362 r3798  
    422422    IF (type_trac == 'repr') THEN
    423423#ifdef REPROBUS
    424        CALL Init_chem_rep_trac(nbtr)
     424       CALL Init_chem_rep_trac(nbtr,nqo,tnom_0)
    425425#endif
    426426    END IF
  • LMDZ6/branches/Ocean_skin/libf/dyn3dmem/guide_loc_mod.F90

    r3605 r3798  
    2727  LOGICAL, PRIVATE, SAVE  :: invert_p,invert_y,ini_anal
    2828  LOGICAL, PRIVATE, SAVE  :: guide_2D,guide_sav,guide_modele
     29!FC
     30  LOGICAL, PRIVATE, SAVE  :: convert_Pa
    2931 
    3032  REAL, PRIVATE, SAVE     :: tau_min_u,tau_max_u
     
    152154        guide_plevs=1
    153155    ENDIF
     156!FC
     157    CALL getpar('convert_Pa',.true.,convert_Pa,'Convert Pressure levels in Pa')
    154158    ! Fin raccord
    155159    CALL getpar('ini_anal',.false.,ini_anal,'Etat initial = analyse')
     
    16951699             status=NF_GET_VARA_REAL(ncidpl,varidpl,1,nlevnc,apnc)
    16961700#endif
    1697              apnc=apnc*100.! conversion en Pascals
     1701!FC Pour les corrections la pression est deja en Pascals on commente la ligne ci-dessous
     1702             IF(convert_Pa) apnc=apnc*100.! conversion en Pascals
    16981703             bpnc(:)=0.
    16991704         ENDIF
  • LMDZ6/branches/Ocean_skin/libf/dyn3dmem/leapfrog_loc.F

    r3605 r3798  
    15431543         endif
    15441544#endif
     1545#ifdef REPROBUS
     1546         if (type_trac == 'repr') then
     1547         call finalize_reprobus
     1548         endif
     1549#endif
    15451550
    15461551c$OMP MASTER
     
    15931598              endif
    15941599#endif
     1600#ifdef REPROBUS
     1601              if (type_trac == 'repr') then
     1602         call finalize_reprobus
     1603              endif
     1604#endif
    15951605
    15961606c$OMP MASTER
     
    17421752                 if (type_trac == 'inca') then
    17431753                    call finalize_inca
     1754                 endif
     1755#endif
     1756#ifdef REPROBUS
     1757                 if (type_trac == 'repr') then
     1758         call finalize_reprobus
    17441759                 endif
    17451760#endif
     
    18341849      endif
    18351850#endif
     1851#ifdef REPROBUS
     1852      if (type_trac == 'repr') then
     1853         call finalize_reprobus
     1854      endif
     1855#endif
    18361856
    18371857c$OMP MASTER
  • LMDZ6/branches/Ocean_skin/libf/dynphy_lonlat/phylmd/etat0phys_netcdf.F90

    r3605 r3798  
    4242  USE conf_dat_m,         ONLY: conf_dat2d
    4343  USE phys_state_var_mod, ONLY: zmea, zstd, zsig, zgam, zthe, zpic, zval, z0m, &
    44           solsw, radsol, t_ancien, wake_deltat, wake_s,  rain_fall, qsol, z0h, &
     44          solsw, solswfdiff, radsol, t_ancien, wake_deltat, wake_s,  rain_fall, qsol, z0h, &
    4545          sollw,sollwdown, rugoro, q_ancien, wake_deltaq, wake_pe, snow_fall, ratqs,w01, &
    4646    sig1, ftsol, clwcon, fm_therm, wake_Cstar,  pctsrf,  entr_therm,radpas, f0,&
     
    107107  REAL, DIMENSION(SIZE(masque,1),SIZE(masque,2)) :: masque_tmp,phiso
    108108  REAL, DIMENSION(klon)               :: sn, rugmer, run_off_lic_0, fder
    109   REAL, DIMENSION(klon,nbsrf)         :: qsolsrf, snsrf
     109  REAL, DIMENSION(klon,nbsrf)         :: qsurf, snsrf
    110110  REAL, DIMENSION(klon,nsoilmx,nbsrf) :: tsoil
    111111
     
    121121  LOGICAL :: flag_aer_feedback
    122122  LOGICAL :: flag_bc_internal_mixture
    123   LOGICAL :: new_aod
    124123  REAL    :: bl95_b0, bl95_b1
    125124  INTEGER :: read_climoz                        !--- Read ozone climatology
     
    143142                   chemistry_couple, flag_aerosol, flag_aerosol_strat,  &
    144143                   flag_aer_feedback,                                   &
    145                    new_aod, flag_bc_internal_mixture, bl95_b0, bl95_b1, &
     144                   flag_bc_internal_mixture, bl95_b0, bl95_b1, &
    146145                   read_climoz, alp_offset)
    147146  CALL phys_state_var_init(read_climoz)
     
    193192  WRITE(lunout,*)'phystep =', phystep, radpas
    194193
    195 ! Init: ftsol, snsrf, qsolsrf, tsoil, rain_fall, snow_fall, solsw, sollw, z0
     194! Init: ftsol, snsrf, qsurf, tsoil, rain_fall, snow_fall, solsw, sollw, z0
    196195!*******************************************************************************
    197196  DO i=1,nbsrf; ftsol(:,i) = tsol; END DO
     
    210209
    211210  fevap(:,:) = 0.
    212   DO i=1,nbsrf; qsolsrf(:,i)=150.; END DO
     211  qsurf = 0.
    213212  DO i=1,nbsrf; DO j=1,nsoilmx; tsoil(:,j,i) = tsol; END DO; END DO
    214213  rain_fall  = 0.
    215214  snow_fall  = 0.
    216215  solsw      = 165.
     216  solswfdiff = 1.
    217217  sollw      = -53.
    218218!ym warning missing init for sollwdown => set to 0
     
    272272
    273273  CALL fonte_neige_init(run_off_lic_0)
    274   CALL pbl_surface_init( fder, snsrf, qsolsrf, tsoil )
     274  CALL pbl_surface_init( fder, snsrf, qsurf, tsoil )
    275275  CALL phyredem( "startphy.nc" )
    276276
  • LMDZ6/branches/Ocean_skin/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90

    r3605 r3798  
    2525                      indnum_fn_num,index_trac,&
    2626                      niso,ntraceurs_zone,ntraciso
     27#ifdef CPP_StratAer
     28  USE infotrac, ONLY: nbtr_bin, nbtr_sulgas, id_OCS_strat, &
     29                      id_SO2_strat, id_H2SO4_strat, id_BIN01_strat
     30
     31#endif
    2732#ifdef REPROBUS
    2833  USE CHEM_REP, ONLY : Init_chem_rep_phys
     34#ifdef CPP_PARA
     35  USE parallel_lmdz, ONLY : mpi_size, mpi_rank
     36  USE bands, ONLY : distrib_phys
     37#endif
     38  USE mod_phys_lmdz_omp_data, ONLY: klon_omp
    2939#endif
    3040  USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq, config_inca
     
    4656  USE ioipsl_getin_p_mod, ONLY: getin_p
    4757  USE slab_heat_transp_mod, ONLY: ini_slab_transp_geom
    48 #ifdef REPROBUS
    49   USE CHEM_REP, ONLY : Init_chem_rep_phys
    50 #endif
    5158  IMPLICIT NONE
    5259
     
    147154                         iso_indnum,zone_num,phase_num,&
    148155                         indnum_fn_num,index_trac,&
    149                          niso,ntraceurs_zone,ntraciso)
     156                         niso,ntraceurs_zone,ntraciso&
     157#ifdef CPP_StratAer
     158                         ,nbtr_bin,nbtr_sulgas&
     159                         ,id_OCS_strat,id_SO2_strat,id_H2SO4_strat,id_BIN01_strat&
     160#endif
     161                         )
    150162
    151163  ! Initializations for Reprobus
    152164  IF (type_trac == 'repr') THEN
    153165#ifdef REPROBUS
    154     CALL Init_chem_rep_phys(klon_omp,nlayer)
     166    call Init_chem_rep_phys(klon_omp,nlayer)
     167    call init_reprobus_para( &
     168          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
     169          distrib_phys,communicator)
    155170#endif
    156171  ENDIF
     
    168183#endif
    169184  END IF
     185  IF (type_trac == 'repr') THEN
     186#ifdef REPROBUS
     187    call init_reprobus_para( &
     188          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
     189          distrib_phys,communicator)
     190#endif
     191  ENDIF
    170192
    171193!!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/dustemission_mod.F90

    r2630 r3798  
    153153!======================================================================================
    154154!--------------------------------------------------------------------------------------
     155
     156  SUBROUTINE dustemis_out_init()
     157
     158    USE dimphy
     159
     160    !AS: moved here from subroutine initdust
     161    ALLOCATE( m1dflux(klon) )
     162    ALLOCATE( m2dflux(klon) )
     163    ALLOCATE( m3dflux(klon) )
     164
     165  END SUBROUTINE dustemis_out_init
    155166
    156167  SUBROUTINE dustemission( debutphy, xlat, xlon, &    !Input
     
    625636    ALLOCATE( srel(nats,nclass) )
    626637    ALLOCATE( srel2(nats,nclass) )
    627     ALLOCATE( m1dflux(klon) )
    628     ALLOCATE( m2dflux(klon) )
    629     ALLOCATE( m3dflux(klon) )
     638    !!AS: moved to subroutine dustemission_output_init
     639    !ALLOCATE( m1dflux(klon) )
     640    !ALLOCATE( m2dflux(klon) )
     641    !ALLOCATE( m3dflux(klon) )
    630642
    631643
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/lsc_scav_spl.F90

    r2630 r3798  
    179179
    180180!  pressure and size of the layer
    181   DO k=klev-1, 1, -1
     181  DO k=klev, 1, -1
    182182   DO i=1, klon
    183183     zrho(i,k)=pplay(i,k)/t(i,k)/RD   
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/phys_output_write_spl_mod.F90

    r3332 r3798  
    6868       flux_sparam_sscoa,u10m_ss,v10m_ss
    6969
    70   USE dustemission_mod, ONLY : m1dflux, m2dflux, m3dflux
     70  USE dustemission_mod, ONLY : m1dflux, m2dflux, m3dflux 
    7171
    7272!  USE phytrac_mod, ONLY : d_tr_cl, d_tr_th, d_tr_cv, d_tr_lessi_impa, &
     
    8282CONTAINS
    8383
    84   ! ug Routine pour définir (los du premier passageà) ET sortir les variables
     84  ! ug Routine pour définir (lors du premier passageà) ET sortir les variables
    8585  SUBROUTINE phys_output_write_spl(itap, pdtphys, paprs, pphis, &
    8686       pplay, lmax_th, aerosol_couple,         &
    87        ok_ade, ok_aie, ivap, new_aod, ok_sync, &
     87       ok_ade, ok_aie, ivap, ok_sync, &
    8888       ptconv, read_climoz, clevSTD, ptconvth, &
    8989       d_t, qx, d_qx, d_tr_dyn, zmasse, flag_aerosol, flag_aerosol_strat, ok_cdnc)
    9090
    9191    ! This subroutine does the actual writing of diagnostics that were
    92     ! defined and initialised in phys_output_mod.F90
     92    ! defined and initialised mainly in phytracr_spl_mod.F90 (SPLA tracers, subroutine phytracr_spl_out_init)
    9393
    9494    USE dimphy, ONLY: klon, klev, klevp1
     
    148148         o_alp_bl_fluct_m, o_alp_bl_fluct_tke, &
    149149         o_alp_bl_conv, o_alp_bl_stat, &
    150          o_slab_qflux, o_tslab, o_slab_bils, &
     150         o_slab_qflux, o_tslab, &
     151         !o_slab_bils, &
    151152         o_slab_bilg, o_slab_sic, o_slab_tice, &
    152153         o_weakinv, o_dthmin, o_cldtau, &
    153154         o_cldemi, o_pr_con_l, o_pr_con_i, &
    154155         o_pr_lsc_l, o_pr_lsc_i, o_re, o_fl, &
    155          o_rh2m, o_rh2m_min, o_rh2m_max, &
     156         o_rh2m, &
     157         !o_rh2m_min, o_rh2m_max, &
    156158         o_qsat2m, o_tpot, o_tpote, o_SWnetOR, &
    157159         o_LWdownOR, o_snowl, &
    158160         o_solldown, o_dtsvdfo, o_dtsvdft, &
    159161         o_dtsvdfg, o_dtsvdfi, o_z0m, o_z0h, o_od550aer, &
    160          o_od865aer, o_absvisaer, o_od550lt1aer, &
     162         o_od865aer, o_abs550aer, o_od550lt1aer, &
    161163         o_sconcso4, o_sconcno3, o_sconcoa, o_sconcbc, &
    162164         o_sconcss, o_sconcdust, o_concso4, o_concno3, &
     
    300302         ema_cbmf, Ma, fm_therm, ale_bl, alp_bl, ale, &
    301303         alp, cin, wake_pe, wake_s, wake_deltat, &
     304         ale_wake, ale_bl_stat, &
    302305         wake_deltaq, ftd, fqd, ale_bl_trig, albsol1, &
    303306         rnebcon, wo, falb1, albsol2, coefh, clwcon0, &
     
    323326         t2m, fluxt, fluxlat, fsollw, fsolsw, &
    324327         wfbils, wfbilo, cdragm, cdragh, cldl, cldm, &
    325          cldh, cldt, JrNt, cldljn, cldmjn, cldhjn, &
    326          cldtjn, cldq, flwp, fiwp, ue, ve, uq, vq, &
     328         cldh, cldt, JrNt, &
     329         ! cldljn, cldmjn, cldhjn, cldtjn &
     330         cldq, flwp, fiwp, ue, ve, uq, vq, &
    327331         plcl, plfc, wbeff, upwd, dnwd, dnwd0, prw, &
    328332         s_pblh, s_pblt, s_lcl, s_therm, uwriteSTD, &
    329333         vwriteSTD, wwriteSTD, phiwriteSTD, qwriteSTD, &
    330          twriteSTD, ale_wake, alp_wake, wake_h, &
     334         twriteSTD, alp_wake, wake_h, &
     335         !ale_wake, &
    331336         wake_omg, d_t_wake, d_q_wake, Vprecip, &
    332337         wdtrainA, wdtrainM, n2, s2, proba_notrig, &
    333          random_notrig, ale_bl_stat, &
     338         random_notrig, &
     339         !ale_bl_stat, &
    334340         alp_bl_det, alp_bl_fluct_m, alp_bl_conv, &
    335341         alp_bl_stat, alp_bl_fluct_tke, slab_wfbils, &
     
    337343         pmflxr, pmflxs, prfl, psfl, re, fl, rh2m, &
    338344         qsat2m, tpote, tpot, d_ts, od550aer, &
    339          od865aer, absvisaer, od550lt1aer, sconcso4, sconcno3, &
     345         od865aer, abs550aer, od550lt1aer, sconcso4, sconcno3, &
    340346         sconcoa, sconcbc, sconcss, sconcdust, concso4, concno3, &
    341347         concoa, concbc, concss, concdust, loadso4, &
     
    372378         bils_ec,bils_ech, bils_tke, bils_kinetic, bils_latent, bils_enthalp, &
    373379         itau_con, nfiles, clef_files, nid_files, zvstr_gwd_rando
    374     USE ocean_slab_mod, ONLY: tslab, slab_bils, slab_bilg, tice, seaice
     380    USE ocean_slab_mod, ONLY: tslab, slab_bilg, tice, seaice
    375381    USE pbl_surface_mod, ONLY: snow
    376382    USE indice_sol_mod, ONLY: nbsrf
     
    405411    INTEGER, DIMENSION(klon) :: lmax_th
    406412    LOGICAL :: aerosol_couple, ok_sync
    407     LOGICAL :: ok_ade, ok_aie, new_aod
     413    LOGICAL :: ok_ade, ok_aie
    408414    LOGICAL, DIMENSION(klon, klev) :: ptconv, ptconvth
    409415    REAL :: pdtphys
     
    443449    CALL set_itau_iophy(itau_w)
    444450
    445     IF (.NOT.vars_defined) THEN
    446        iinitend = 2
    447     ELSE
    448        iinitend = 1
    449     ENDIF
     451!AS, vu avec LF : le test est fait maintenant au debut du pdt, pas a la fin, alors on ne passe plus qu'une fois
     452! Donc le "IF (.NOT.vars_defined)" devient inutile, et la boucle "DO iinit=1, iinitend" pourra etre eliminee
     453!  ainsi que iinit, iinitend
     454!    IF (.NOT.vars_defined) THEN
     455!       iinitend = 2
     456!    ELSE
     457!       iinitend = 1
     458!    ENDIF
    450459
    451460    ! ug la boucle qui suit ne sert qu'une fois, pour l'initialisation, sinon il n'y a toujours qu'un seul passage:
     
    736745       CALL histwrite_phy(o_cldt, cldt)
    737746       CALL histwrite_phy(o_JrNt, JrNt)
    738        CALL histwrite_phy(o_cldljn, cldl*JrNt)
    739        CALL histwrite_phy(o_cldmjn, cldm*JrNt)
    740        CALL histwrite_phy(o_cldhjn, cldh*JrNt)
    741        CALL histwrite_phy(o_cldtjn, cldt*JrNt)
     747
     748       !CALL histwrite_phy(o_cldljn, cldl*JrNt)
     749       IF (vars_defined)  zx_tmp_fi2d=cldl*JrNt
     750       CALL histwrite_phy(o_cldljn, zx_tmp_fi2d)
     751       !CALL histwrite_phy(o_cldmjn, cldm*JrNt)
     752       IF (vars_defined)  zx_tmp_fi2d=cldm*JrNt
     753       CALL histwrite_phy(o_cldmjn, zx_tmp_fi2d)
     754       !CALL histwrite_phy(o_cldhjn, cldh*JrNt)
     755       IF (vars_defined)  zx_tmp_fi2d=cldh*JrNt
     756       CALL histwrite_phy(o_cldhjn, zx_tmp_fi2d)
     757       !CALL histwrite_phy(o_cldtjn, cldt*JrNt)
     758       IF (vars_defined)  zx_tmp_fi2d=cldt*JrNt
     759       CALL histwrite_phy(o_cldtjn, zx_tmp_fi2d)
     760
    742761       CALL histwrite_phy(o_cldq, cldq)
    743762       IF (vars_defined)       zx_tmp_fi2d(1:klon) = flwp(1:klon)
     
    933952       IF (type_ocean=='slab ') THEN
    934953          CALL histwrite_phy(o_slab_qflux, slab_wfbils)
    935           CALL histwrite_phy(o_slab_bils, slab_bils)
     954          !CALL histwrite_phy(o_slab_bils, slab_bils)
    936955          IF (nslay.EQ.1) THEN
    937956              zx_tmp_fi2d(:)=tslab(:,1)
     
    968987          ENDDO
    969988       ENDIF
    970        CALL histwrite_phy(o_rh2m_min, zx_tmp_fi2d)
     989       !CALL histwrite_phy(o_rh2m_min, zx_tmp_fi2d)
    971990
    972991       IF (vars_defined) THEN
     
    975994          ENDDO
    976995       ENDIF
    977        CALL histwrite_phy(o_rh2m_max, zx_tmp_fi2d)
     996       !CALL histwrite_phy(o_rh2m_max, zx_tmp_fi2d)
    978997
    979998       CALL histwrite_phy(o_qsat2m, qsat2m)
     
    9941013!--OLIVIER
    9951014!This is warranted by treating INCA aerosols as offline aerosols
    996 !       IF (new_aod .and. (.not. aerosol_couple)) THEN
    997        IF (new_aod) THEN
    998           IF (flag_aerosol.GT.0) THEN
    999              CALL histwrite_phy(o_od550aer, od550aer)
    1000              CALL histwrite_phy(o_od865aer, od865aer)
    1001              CALL histwrite_phy(o_absvisaer, absvisaer)
    1002              CALL histwrite_phy(o_od550lt1aer, od550lt1aer)
    1003              CALL histwrite_phy(o_sconcso4, sconcso4)
    1004              CALL histwrite_phy(o_sconcno3, sconcno3)
    1005              CALL histwrite_phy(o_sconcoa, sconcoa)
    1006              CALL histwrite_phy(o_sconcbc, sconcbc)
    1007              CALL histwrite_phy(o_sconcss, sconcss)
    1008              CALL histwrite_phy(o_sconcdust, sconcdust)
    1009              CALL histwrite_phy(o_concso4, concso4)
    1010              CALL histwrite_phy(o_concno3, concno3)
    1011              CALL histwrite_phy(o_concoa, concoa)
    1012              CALL histwrite_phy(o_concbc, concbc)
    1013              CALL histwrite_phy(o_concss, concss)
    1014              CALL histwrite_phy(o_concdust, concdust)
    1015              CALL histwrite_phy(o_loadso4, loadso4)
    1016              CALL histwrite_phy(o_loadoa, loadoa)
    1017              CALL histwrite_phy(o_loadbc, loadbc)
    1018              CALL histwrite_phy(o_loadss, loadss)
    1019              CALL histwrite_phy(o_loaddust, loaddust)
    1020              !--STRAT AER
    1021           ENDIF
    1022           IF (flag_aerosol.GT.0.OR.flag_aerosol_strat>=1) THEN
    1023 !             DO naero = 1, naero_spc
     1015       IF (flag_aerosol.GT.0) THEN
     1016          CALL histwrite_phy(o_od550aer, od550aer)
     1017          CALL histwrite_phy(o_od865aer, od865aer)
     1018          CALL histwrite_phy(o_abs550aer, abs550aer)
     1019          CALL histwrite_phy(o_od550lt1aer, od550lt1aer)
     1020          CALL histwrite_phy(o_sconcso4, sconcso4)
     1021          CALL histwrite_phy(o_sconcno3, sconcno3)
     1022          CALL histwrite_phy(o_sconcoa, sconcoa)
     1023          CALL histwrite_phy(o_sconcbc, sconcbc)
     1024          CALL histwrite_phy(o_sconcss, sconcss)
     1025          CALL histwrite_phy(o_sconcdust, sconcdust)
     1026          CALL histwrite_phy(o_concso4, concso4)
     1027          CALL histwrite_phy(o_concno3, concno3)
     1028          CALL histwrite_phy(o_concoa, concoa)
     1029          CALL histwrite_phy(o_concbc, concbc)
     1030          CALL histwrite_phy(o_concss, concss)
     1031          CALL histwrite_phy(o_concdust, concdust)
     1032          CALL histwrite_phy(o_loadso4, loadso4)
     1033          CALL histwrite_phy(o_loadoa, loadoa)
     1034          CALL histwrite_phy(o_loadbc, loadbc)
     1035          CALL histwrite_phy(o_loadss, loadss)
     1036          CALL histwrite_phy(o_loaddust, loaddust)
     1037          !--STRAT AER
     1038       ENDIF
     1039       IF (flag_aerosol.GT.0.OR.flag_aerosol_strat>=1) THEN
     1040!          DO naero = 1, naero_spc
    10241041!--correction mini bug OB
    1025              DO naero = 1, naero_tot
    1026                 CALL histwrite_phy(o_tausumaero(naero), &
    1027                      tausum_aero(:,2,naero) )
    1028              ENDDO
    1029           ENDIF
    1030           IF (flag_aerosol_strat>=1) THEN
    1031              CALL histwrite_phy(o_tausumaero_lw, &
    1032                   tausum_aero(:,6,id_STRAT_phy) )
    1033           ENDIF
     1042          DO naero = 1, naero_tot
     1043             CALL histwrite_phy(o_tausumaero(naero), &
     1044                  tausum_aero(:,2,naero) )
     1045          ENDDO
     1046       ENDIF
     1047       IF (flag_aerosol_strat>=1) THEN
     1048          CALL histwrite_phy(o_tausumaero_lw, &
     1049               tausum_aero(:,6,id_STRAT_phy) )
    10341050       ENDIF
    10351051       IF (ok_ade) THEN
     
    10431059          CALL histwrite_phy(o_sollwad0, sollwad0_aero)
    10441060          !====MS forcing diagnostics
    1045           IF (new_aod) THEN
    1046              CALL histwrite_phy(o_swtoaas_nat, topsw_aero(:,1))
    1047              CALL histwrite_phy(o_swsrfas_nat, solsw_aero(:,1))
    1048              CALL histwrite_phy(o_swtoacs_nat, topsw0_aero(:,1))
    1049              CALL histwrite_phy(o_swsrfcs_nat, solsw0_aero(:,1))
    1050              !ant
    1051              CALL histwrite_phy(o_swtoaas_ant, topsw_aero(:,2))
    1052              CALL histwrite_phy(o_swsrfas_ant, solsw_aero(:,2))
    1053              CALL histwrite_phy(o_swtoacs_ant, topsw0_aero(:,2))
    1054              CALL histwrite_phy(o_swsrfcs_ant, solsw0_aero(:,2))
    1055              !cf
    1056              IF (.not. aerosol_couple) THEN
    1057                 CALL histwrite_phy(o_swtoacf_nat, topswcf_aero(:,1))
    1058                 CALL histwrite_phy(o_swsrfcf_nat, solswcf_aero(:,1))
    1059                 CALL histwrite_phy(o_swtoacf_ant, topswcf_aero(:,2))
    1060                 CALL histwrite_phy(o_swsrfcf_ant, solswcf_aero(:,2))
    1061                 CALL histwrite_phy(o_swtoacf_zero,topswcf_aero(:,3))
    1062                 CALL histwrite_phy(o_swsrfcf_zero,solswcf_aero(:,3))
    1063              ENDIF
    1064           ENDIF ! new_aod
     1061          CALL histwrite_phy(o_swtoaas_nat, topsw_aero(:,1))
     1062          CALL histwrite_phy(o_swsrfas_nat, solsw_aero(:,1))
     1063          CALL histwrite_phy(o_swtoacs_nat, topsw0_aero(:,1))
     1064          CALL histwrite_phy(o_swsrfcs_nat, solsw0_aero(:,1))
     1065          !ant
     1066          CALL histwrite_phy(o_swtoaas_ant, topsw_aero(:,2))
     1067          CALL histwrite_phy(o_swsrfas_ant, solsw_aero(:,2))
     1068          CALL histwrite_phy(o_swtoacs_ant, topsw0_aero(:,2))
     1069          CALL histwrite_phy(o_swsrfcs_ant, solsw0_aero(:,2))
     1070          !cf
     1071          IF (.not. aerosol_couple) THEN
     1072             CALL histwrite_phy(o_swtoacf_nat, topswcf_aero(:,1))
     1073             CALL histwrite_phy(o_swsrfcf_nat, solswcf_aero(:,1))
     1074             CALL histwrite_phy(o_swtoacf_ant, topswcf_aero(:,2))
     1075             CALL histwrite_phy(o_swsrfcf_ant, solswcf_aero(:,2))
     1076             CALL histwrite_phy(o_swtoacf_zero,topswcf_aero(:,3))
     1077             CALL histwrite_phy(o_swsrfcf_zero,solswcf_aero(:,3))
     1078          ENDIF
    10651079          !====MS forcing diagnostics
    10661080       ENDIF
     
    11421156       CALL histwrite_phy(o_rnebjn, zx_tmp_fi3d)
    11431157       CALL histwrite_phy(o_rhum, zx_rh)
    1144        CALL histwrite_phy(o_ozone, &
    1145             wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
     1158       !CALL histwrite_phy(o_ozone, &
     1159       !     wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
     1160       IF (vars_defined) zx_tmp_fi3d = wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd
     1161       CALL histwrite_phy(o_ozone, zx_tmp_fi3d)
    11461162
    11471163       IF (read_climoz == 2) THEN
    1148           CALL histwrite_phy(o_ozone_light, &
    1149                wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
    1150        ENDIF
    1151 
     1164         !CALL histwrite_phy(o_ozone_light, &
     1165         !     wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
     1166         IF (vars_defined) zx_tmp_fi3d = wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd
     1167         CALL histwrite_phy(o_ozone_light, zx_tmp_fi3d)
     1168       ENDIF
     1169
     1170       !AS: dans phys_output_write il y a en plus : CALL histwrite_phy(o_duphy, d_u)
    11521171       CALL histwrite_phy(o_dtphy, d_t)
    11531172       CALL histwrite_phy(o_dqphy,  d_qx(:,:,ivap))
     
    15911610#endif
    15921611!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1593         IF (nqtot.GE.nqo+1) THEN
    1594             DO iq=nqo+1,nqtot
    1595               IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
    1596 
     1612       IF (nqtot.GE.nqo+1) THEN
     1613         !AS: type_trac = 'lmdz' par defaut dans libf/dyn3d/conf_gcm.F90
     1614         !Changé par inca, repr(obus), coag(ulation), co2i(nteractif), PAS par SPLA
     1615         !Cet "if" est donc inutile : IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
     1616           DO iq=nqo+1,nqtot
    15971617             CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
    15981618             CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
     
    16181638             ENDIF
    16191639             CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
    1620              ENDIF
    1621           ENDDO
     1640           ENDDO
     1641         !ENDIF
    16221642       ENDIF
    16231643
     
    16451665       ENDIF
    16461666
    1647     ENDDO
     1667    ENDDO ! iinit
    16481668
    16491669    IF (vars_defined) THEN
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/phytracr_spl_mod.F90

    r2648 r3798  
    33
    44MODULE phytracr_spl_mod
    5 
    65
    76! Recuperation des morceaux de la physique de Jeronimo specifiques
     
    445444!
    446445!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     446SUBROUTINE phytracr_spl_out_init()
     447!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     448!AS : This new subroutine centralises les ALLOCATE dont on a besoin au premier appel
     449!     de phys_output_write_spl dans physiq
     450
     451    USE dimphy
     452    USE infotrac_phy, ONLY: nbtr
     453    USE dustemission_mod, ONLY :  dustemis_out_init
     454
     455    ! pour les variables m[1-3]dflux
     456    CALL dustemis_out_init()
     457
     458    !AS: moved here from  section INITIALISATIONS of subroutine phytracr_spl_ini
     459    !    ALLOCATE variables from spla_output_write.h, section "traceur"
     460
     461!traceur
     462      ALLOCATE( diff_aod550_tot(klon)     )
     463      ALLOCATE( diag_aod670_tot(klon)     )
     464      ALLOCATE( diag_aod865_tot(klon)     )
     465      ALLOCATE( diff_aod550_tr2(klon)     )
     466      ALLOCATE( diag_aod670_tr2(klon)     )
     467      ALLOCATE( diag_aod865_tr2(klon)     )
     468      ALLOCATE( diag_aod550_ss(klon)      )
     469      ALLOCATE( diag_aod670_ss(klon)      )
     470      ALLOCATE( diag_aod865_ss(klon)      )
     471      ALLOCATE( diag_aod550_dust(klon)    )
     472      ALLOCATE( diag_aod670_dust(klon)    )
     473      ALLOCATE( diag_aod865_dust(klon)    )
     474      ALLOCATE( diag_aod550_dustsco(klon)  )
     475      ALLOCATE( diag_aod670_dustsco(klon)  )
     476      ALLOCATE( diag_aod865_dustsco(klon)  )
     477      !AS: les 15 vars _terra et 15 _aqua suivantes sont groupees differemment dans spla_output_write.h
     478      ALLOCATE( aod550_terra(klon))
     479      ALLOCATE( aod550_tr2_terra(klon))
     480      ALLOCATE( aod550_ss_terra(klon))
     481      ALLOCATE( aod550_dust_terra(klon))
     482      ALLOCATE( aod550_dustsco_terra(klon))
     483      ALLOCATE( aod670_terra(klon))
     484      ALLOCATE( aod670_tr2_terra(klon))
     485      ALLOCATE( aod670_ss_terra(klon))
     486      ALLOCATE( aod670_dust_terra(klon))
     487      ALLOCATE( aod670_dustsco_terra(klon))
     488      ALLOCATE( aod865_terra(klon))
     489      ALLOCATE( aod865_tr2_terra(klon))
     490      ALLOCATE( aod865_ss_terra(klon))
     491      ALLOCATE( aod865_dust_terra(klon))
     492      ALLOCATE( aod865_dustsco_terra(klon))
     493
     494      ALLOCATE( aod550_aqua(klon))
     495      ALLOCATE( aod550_tr2_aqua(klon))
     496      ALLOCATE( aod550_ss_aqua(klon))
     497      ALLOCATE( aod550_dust_aqua(klon))
     498      ALLOCATE( aod550_dustsco_aqua(klon))
     499      ALLOCATE( aod670_aqua(klon))
     500      ALLOCATE( aod670_tr2_aqua(klon))
     501      ALLOCATE( aod670_ss_aqua(klon))
     502      ALLOCATE( aod670_dust_aqua(klon))
     503      ALLOCATE( aod670_dustsco_aqua(klon))
     504      ALLOCATE( aod865_aqua(klon))
     505      ALLOCATE( aod865_tr2_aqua(klon))
     506      ALLOCATE( aod865_ss_aqua(klon))
     507      ALLOCATE( aod865_dust_aqua(klon))
     508      ALLOCATE( aod865_dustsco_aqua(klon))
     509
     510      ALLOCATE(  sconc01(klon)     )
     511      ALLOCATE(  trm01(klon)     )
     512      ALLOCATE(  sconc02(klon)     )
     513      ALLOCATE(  trm02(klon)     )
     514      ALLOCATE(  sconc03(klon)     )
     515      ALLOCATE(  trm03(klon)     )
     516      ALLOCATE(  sconc04(klon)     )
     517      ALLOCATE(  trm04(klon)     )
     518      ALLOCATE(  sconc05(klon)     )
     519      ALLOCATE(  trm05(klon)     )
     520
     521! Lessivage
     522      ALLOCATE(  flux01(klon)     )
     523      ALLOCATE(  flux02(klon)     )
     524      ALLOCATE(  flux03(klon)     )
     525      ALLOCATE(  flux04(klon)     )
     526      ALLOCATE(  flux05(klon)     )
     527      ALLOCATE(  ds01(klon)     )
     528      ALLOCATE(  ds02(klon)     )
     529      ALLOCATE(  ds03(klon)     )
     530      ALLOCATE(  ds04(klon)     )
     531      ALLOCATE(  ds05(klon)     )
     532      ALLOCATE(  dh01(klon)     )
     533      ALLOCATE(  dh02(klon)     )
     534      ALLOCATE(  dh03(klon)     )
     535      ALLOCATE(  dh04(klon)     )
     536      ALLOCATE(  dh05(klon)     )
     537      ALLOCATE(  dtrconv01(klon)     )
     538      ALLOCATE(  dtrconv02(klon)     )
     539      ALLOCATE(  dtrconv03(klon)     )
     540      ALLOCATE(  dtrconv04(klon)     )
     541      ALLOCATE(  dtrconv05(klon)     )
     542      ALLOCATE(  dtherm01(klon)     )
     543      ALLOCATE(  dtherm02(klon)     )
     544      ALLOCATE(  dtherm03(klon)     )
     545      ALLOCATE(  dtherm04(klon)     )
     546      ALLOCATE(  dtherm05(klon)     )
     547      ALLOCATE(  dhkecv01(klon)     )
     548      ALLOCATE(  dhkecv02(klon)     )
     549      ALLOCATE(  dhkecv03(klon)     )
     550      ALLOCATE(  dhkecv04(klon)     )
     551      ALLOCATE(  dhkecv05(klon)     )
     552      ALLOCATE(  d_tr_ds01(klon)     )
     553      ALLOCATE(  d_tr_ds02(klon)     )
     554      ALLOCATE(  d_tr_ds03(klon)     )
     555      ALLOCATE(  d_tr_ds04(klon)     )
     556      ALLOCATE(  d_tr_ds05(klon)     )
     557      ALLOCATE(  dhkelsc01(klon)     )
     558      ALLOCATE(  dhkelsc02(klon)     )
     559      ALLOCATE(  dhkelsc03(klon)     )
     560      ALLOCATE(  dhkelsc04(klon)     )
     561      ALLOCATE(  dhkelsc05(klon)     )
     562      ALLOCATE(  d_tr_cv01(klon,klev))
     563      ALLOCATE(  d_tr_cv02(klon,klev))
     564      ALLOCATE(  d_tr_cv03(klon,klev))
     565      ALLOCATE(  d_tr_cv04(klon,klev))
     566      ALLOCATE(  d_tr_cv05(klon,klev))
     567      ALLOCATE(  d_tr_trsp01(klon,klev))
     568      ALLOCATE(  d_tr_trsp02(klon,klev))
     569      ALLOCATE(  d_tr_trsp03(klon,klev))
     570      ALLOCATE(  d_tr_trsp04(klon,klev))
     571      ALLOCATE(  d_tr_trsp05(klon,klev))
     572      ALLOCATE(  d_tr_sscav01(klon,klev))
     573      ALLOCATE(  d_tr_sscav02(klon,klev))
     574      ALLOCATE(  d_tr_sscav03(klon,klev))
     575      ALLOCATE(  d_tr_sscav04(klon,klev))
     576      ALLOCATE(  d_tr_sscav05(klon,klev))
     577      ALLOCATE(  d_tr_sat01(klon,klev))
     578      ALLOCATE(  d_tr_sat02(klon,klev))
     579      ALLOCATE(  d_tr_sat03(klon,klev))
     580      ALLOCATE(  d_tr_sat04(klon,klev))
     581      ALLOCATE(  d_tr_sat05(klon,klev))
     582      ALLOCATE(  d_tr_uscav01(klon,klev))
     583      ALLOCATE(  d_tr_uscav02(klon,klev))
     584      ALLOCATE(  d_tr_uscav03(klon,klev))
     585      ALLOCATE(  d_tr_uscav04(klon,klev))
     586      ALLOCATE(  d_tr_uscav05(klon,klev))
     587!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     588      ALLOCATE(  d_tr_insc01(klon,klev))
     589      ALLOCATE(  d_tr_insc02(klon,klev))
     590      ALLOCATE(  d_tr_insc03(klon,klev))
     591      ALLOCATE(  d_tr_insc04(klon,klev))
     592      ALLOCATE(  d_tr_insc05(klon,klev))
     593      ALLOCATE(  d_tr_bcscav01(klon,klev))
     594      ALLOCATE(  d_tr_bcscav02(klon,klev))
     595      ALLOCATE(  d_tr_bcscav03(klon,klev))
     596      ALLOCATE(  d_tr_bcscav04(klon,klev))
     597      ALLOCATE(  d_tr_bcscav05(klon,klev))
     598      ALLOCATE(  d_tr_evapls01(klon,klev))
     599      ALLOCATE(  d_tr_evapls02(klon,klev))
     600      ALLOCATE(  d_tr_evapls03(klon,klev))
     601      ALLOCATE(  d_tr_evapls04(klon,klev))
     602      ALLOCATE(  d_tr_evapls05(klon,klev))
     603      ALLOCATE(  d_tr_ls01(klon,klev))
     604      ALLOCATE(  d_tr_ls02(klon,klev))
     605      ALLOCATE(  d_tr_ls03(klon,klev))
     606      ALLOCATE(  d_tr_ls04(klon,klev))
     607      ALLOCATE(  d_tr_ls05(klon,klev))
     608
     609      ALLOCATE(  d_tr_dyn01(klon,klev))
     610      ALLOCATE(  d_tr_dyn02(klon,klev))
     611      ALLOCATE(  d_tr_dyn03(klon,klev))
     612      ALLOCATE(  d_tr_dyn04(klon,klev))
     613      ALLOCATE(  d_tr_dyn05(klon,klev))
     614
     615      ALLOCATE(  d_tr_cl01(klon,klev))
     616      ALLOCATE(  d_tr_cl02(klon,klev))
     617      ALLOCATE(  d_tr_cl03(klon,klev))
     618      ALLOCATE(  d_tr_cl04(klon,klev))
     619      ALLOCATE(  d_tr_cl05(klon,klev))
     620      ALLOCATE(  d_tr_th01(klon,klev))
     621      ALLOCATE(  d_tr_th02(klon,klev))
     622      ALLOCATE(  d_tr_th03(klon,klev))
     623      ALLOCATE(  d_tr_th04(klon,klev))
     624      ALLOCATE(  d_tr_th05(klon,klev))
     625
     626      ALLOCATE( sed_ss(klon))
     627      ALLOCATE( sed_dust(klon))
     628      ALLOCATE( sed_dustsco(klon))
     629      ALLOCATE( his_g2pgas(klon))
     630      ALLOCATE( his_g2paer(klon))
     631
     632!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     633      ALLOCATE( sed_ss3D(klon,klev))
     634      ALLOCATE( sed_dust3D(klon,klev))
     635      ALLOCATE( sed_dustsco3D(klon,klev))
     636!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     637
     638!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     639! histrac_spl
     640!
     641      ALLOCATE( fluxbb(klon))
     642      ALLOCATE( fluxff(klon))
     643      ALLOCATE( fluxbcbb(klon))
     644      ALLOCATE( fluxbcff(klon))
     645      ALLOCATE( fluxbcnff(klon))
     646      ALLOCATE( fluxbcba(klon))
     647      ALLOCATE( fluxbc(klon))
     648      ALLOCATE( fluxombb(klon))
     649      ALLOCATE( fluxomff(klon))
     650      ALLOCATE( fluxomnff(klon))
     651      ALLOCATE( fluxomba(klon))
     652      ALLOCATE( fluxomnat(klon))
     653      ALLOCATE( fluxom(klon))
     654      ALLOCATE( fluxh2sff(klon))
     655      ALLOCATE( fluxh2snff(klon))
     656      ALLOCATE( fluxso2ff(klon))
     657      ALLOCATE( fluxso2nff(klon))
     658      ALLOCATE( fluxso2bb(klon))
     659      ALLOCATE( fluxso2vol(klon))
     660      ALLOCATE( fluxso2ba(klon))
     661      ALLOCATE( fluxso2(klon))
     662      ALLOCATE( fluxso4ff(klon))
     663      ALLOCATE( fluxso4nff(klon))
     664      ALLOCATE( fluxso4bb(klon))
     665      ALLOCATE( fluxso4ba(klon))
     666      ALLOCATE( fluxso4(klon))
     667      ALLOCATE( fluxdms(klon))
     668      ALLOCATE( fluxh2sbio(klon))
     669      ALLOCATE( fluxdustec(klon))
     670      ALLOCATE( fluxddfine(klon))
     671      ALLOCATE( fluxddcoa(klon))
     672      ALLOCATE( fluxddsco(klon))
     673      ALLOCATE( fluxdd(klon))
     674      ALLOCATE( fluxssfine(klon))
     675      ALLOCATE( fluxsscoa(klon))
     676      ALLOCATE( fluxss(klon))
     677      ALLOCATE( flux_sparam_ind(klon))
     678      ALLOCATE( flux_sparam_bb(klon))
     679      ALLOCATE( flux_sparam_ff(klon))
     680      ALLOCATE( flux_sparam_ddfine(klon))
     681      ALLOCATE( flux_sparam_ddcoa(klon))
     682      ALLOCATE( flux_sparam_ddsco(klon))
     683      ALLOCATE( flux_sparam_ssfine(klon))
     684      ALLOCATE( flux_sparam_sscoa(klon))
     685      ALLOCATE( u10m_ss(klon))
     686      ALLOCATE( v10m_ss(klon))
     687
     688!AS: dans phys_output_write_spl, hors spla_output_write.h
     689!------------------------------------------------------
     690      ALLOCATE(d_tr_cl(klon,klev,nbtr))
     691      ALLOCATE(d_tr_th(klon,klev,nbtr))
     692      ALLOCATE(d_tr_cv(klon,klev,nbtr))
     693      ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
     694      ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
     695      ALLOCATE(d_tr_insc(klon,klev,nbtr))
     696      ALLOCATE(d_tr_bcscav(klon,klev,nbtr))
     697      ALLOCATE(d_tr_evapls(klon,klev,nbtr))
     698      ALLOCATE(d_tr_ls(klon,klev,nbtr))
     699      ALLOCATE(d_tr_trsp(klon,klev,nbtr))
     700      ALLOCATE(d_tr_sscav(klon,klev,nbtr))
     701      ALLOCATE(d_tr_sat(klon,klev,nbtr))
     702      ALLOCATE(d_tr_uscav(klon,klev,nbtr))
     703     
     704END SUBROUTINE phytracr_spl_out_init
     705
     706!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    447707SUBROUTINE phytracr_spl_ini(klon,nbreg_ind,nbreg_bb,nbreg_dust,nbreg_wstardust)
    448708!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    10811341  print *,'JE: jD_cur:',jD_cur,' ijulday:',ijulday,' jH_cur:',jH_cur,' pdtphys:',pdtphys
    10821342  print *,'JE: now read_newemissions:'
    1083   print *,'lmt_so2ff_l AVANT' , MINVAL(lmt_so2ff_l), MAXVAL(lmt_so2ff_l)
     1343!AS: La ligne suivante fait planter a l'execution : lmt_so2ff_l pas initialise
     1344!  print *,'lmt_so2ff_l AVANT' , MINVAL(lmt_so2ff_l), MAXVAL(lmt_so2ff_l)
    10841345  call read_newemissions(ijulday,jH_cur ,edgar, flag_dms,debutphy, & !I
    10851346                         pdtphys, lafin, nbjour, pctsrf,  &       !I
     
    12891550
    12901551      ! convective KE lessivage aer params:
     1552      ! AS: #DFB (Binta) a aussi teste ccntrAA_spla=ccntrENV_spla=0.9/1.0/0.9/0.9
     1553      !     mais effet negligeable sur l'AOD
    12911554      ccntrAA_spla(:)=0.
    12921555      if(id_prec>0)  ccntrAA_spla(id_prec)=-9999.
     
    13021565      if(id_codu>0)  ccntrENV_spla(id_codu)=0.7
    13031566      if(id_scdu>0)  ccntrENV_spla(id_scdu)=0.7
    1304 
     1567      ! #DFB
    13051568      coefcoli_spla(:)=0.
    13061569      if(id_prec>0)  coefcoli_spla(id_prec)=-9999.
     
    18752138!$OMP MASTER
    18762139
    1877       ALLOCATE(d_tr_cl(klon,klev,nbtr),d_tr_dry(klon,nbtr))
     2140      !ALLOCATE(d_tr_cl(klon,klev,nbtr),d_tr_dry(klon,nbtr))
     2141      ALLOCATE(d_tr_dry(klon,nbtr))
    18782142      ALLOCATE(flux_tr_dry(klon,nbtr),d_tr_dec(klon,klev,nbtr))
    1879       ALLOCATE(d_tr_cv(klon,klev,nbtr))
    1880       ALLOCATE(d_tr_insc(klon,klev,nbtr),d_tr_bcscav(klon,klev,nbtr))
    1881       ALLOCATE(d_tr_evapls(klon,klev,nbtr),d_tr_ls(klon,klev,nbtr))
    1882       ALLOCATE(qPrls(klon,nbtr),d_tr_trsp(klon,klev,nbtr))
    1883       ALLOCATE(d_tr_sscav(klon,klev,nbtr),d_tr_sat(klon,klev,nbtr))
    1884       ALLOCATE(d_tr_uscav(klon,klev,nbtr),qPr(klon,klev,nbtr))
     2143      !ALLOCATE(d_tr_cv(klon,klev,nbtr))
     2144      !ALLOCATE(d_tr_insc(klon,klev,nbtr),d_tr_bcscav(klon,klev,nbtr))
     2145      !ALLOCATE(d_tr_evapls(klon,klev,nbtr),d_tr_ls(klon,klev,nbtr))
     2146      !ALLOCATE(qPrls(klon,nbtr),d_tr_trsp(klon,klev,nbtr))
     2147      ALLOCATE(qPrls(klon,nbtr),qPr(klon,klev,nbtr))
     2148      !ALLOCATE(d_tr_sscav(klon,klev,nbtr),d_tr_sat(klon,klev,nbtr))
     2149      !ALLOCATE(d_tr_uscav(klon,klev,nbtr),qPr(klon,klev,nbtr))
    18852150      ALLOCATE(qDi(klon,klev,nbtr))
    18862151      ALLOCATE(qPa(klon,klev,nbtr),qMel(klon,klev,nbtr))
    18872152      ALLOCATE(qTrdi(klon,klev,nbtr),dtrcvMA(klon,klev,nbtr))
    1888       ALLOCATE(d_tr_th(klon,klev,nbtr))
    1889       ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
    1890       ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
    1891 
    1892       ALLOCATE( diff_aod550_tot(klon)     )
    1893       ALLOCATE( diag_aod670_tot(klon)     )
    1894       ALLOCATE( diag_aod865_tot(klon)     )
    1895       ALLOCATE( diff_aod550_tr2(klon)     )
    1896       ALLOCATE( diag_aod670_tr2(klon)     )
    1897       ALLOCATE( diag_aod865_tr2(klon)     )
    1898       ALLOCATE( diag_aod550_ss(klon)      )
    1899       ALLOCATE( diag_aod670_ss(klon)      )
    1900       ALLOCATE( diag_aod865_ss(klon)      )
    1901       ALLOCATE( diag_aod550_dust(klon)    )
    1902       ALLOCATE( diag_aod670_dust(klon)    )
    1903       ALLOCATE( diag_aod865_dust(klon)    )
    1904       ALLOCATE( diag_aod550_dustsco(klon)  )
    1905       ALLOCATE( diag_aod670_dustsco(klon)  )
    1906       ALLOCATE( diag_aod865_dustsco(klon)  )
    1907 
    1908 
    1909       ALLOCATE(  sconc01(klon)     )
    1910       ALLOCATE(  trm01(klon)     )
    1911       ALLOCATE(  sconc02(klon)     )
    1912       ALLOCATE(  trm02(klon)     )
    1913       ALLOCATE(  sconc03(klon)     )
    1914       ALLOCATE(  trm03(klon)     )
    1915       ALLOCATE(  sconc04(klon)     )
    1916       ALLOCATE(  trm04(klon)     )
    1917       ALLOCATE(  sconc05(klon)     )
    1918       ALLOCATE(  trm05(klon)     )
    1919 
    1920 
    1921       ALLOCATE(  flux01(klon)     )
    1922       ALLOCATE(  flux02(klon)     )
    1923       ALLOCATE(  flux03(klon)     )
    1924       ALLOCATE(  flux04(klon)     )
    1925       ALLOCATE(  flux05(klon)     )
    1926       ALLOCATE(  ds01(klon)     )
    1927       ALLOCATE(  ds02(klon)     )
    1928       ALLOCATE(  ds03(klon)     )
    1929       ALLOCATE(  ds04(klon)     )
    1930       ALLOCATE(  ds05(klon)     )
    1931       ALLOCATE(  dh01(klon)     )
    1932       ALLOCATE(  dh02(klon)     )
    1933       ALLOCATE(  dh03(klon)     )
    1934       ALLOCATE(  dh04(klon)     )
    1935       ALLOCATE(  dh05(klon)     )
    1936       ALLOCATE(  dtrconv01(klon)     )
    1937       ALLOCATE(  dtrconv02(klon)     )
    1938       ALLOCATE(  dtrconv03(klon)     )
    1939       ALLOCATE(  dtrconv04(klon)     )
    1940       ALLOCATE(  dtrconv05(klon)     )
    1941       ALLOCATE(  dtherm01(klon)     )
    1942       ALLOCATE(  dtherm02(klon)     )
    1943       ALLOCATE(  dtherm03(klon)     )
    1944       ALLOCATE(  dtherm04(klon)     )
    1945       ALLOCATE(  dtherm05(klon)     )
    1946       ALLOCATE(  dhkecv01(klon)     )
    1947       ALLOCATE(  dhkecv02(klon)     )
    1948       ALLOCATE(  dhkecv03(klon)     )
    1949       ALLOCATE(  dhkecv04(klon)     )
    1950       ALLOCATE(  dhkecv05(klon)     )
    1951       ALLOCATE(  d_tr_ds01(klon)     )
    1952       ALLOCATE(  d_tr_ds02(klon)     )
    1953       ALLOCATE(  d_tr_ds03(klon)     )
    1954       ALLOCATE(  d_tr_ds04(klon)     )
    1955       ALLOCATE(  d_tr_ds05(klon)     )
    1956       ALLOCATE(  dhkelsc01(klon)     )
    1957       ALLOCATE(  dhkelsc02(klon)     )
    1958       ALLOCATE(  dhkelsc03(klon)     )
    1959       ALLOCATE(  dhkelsc04(klon)     )
    1960       ALLOCATE(  dhkelsc05(klon)     )
    1961       ALLOCATE(  d_tr_cv01(klon,klev))
    1962       ALLOCATE(  d_tr_cv02(klon,klev))
    1963       ALLOCATE(  d_tr_cv03(klon,klev))
    1964       ALLOCATE(  d_tr_cv04(klon,klev))
    1965       ALLOCATE(  d_tr_cv05(klon,klev))
    1966       ALLOCATE(  d_tr_trsp01(klon,klev))
    1967       ALLOCATE(  d_tr_trsp02(klon,klev))
    1968       ALLOCATE(  d_tr_trsp03(klon,klev))
    1969       ALLOCATE(  d_tr_trsp04(klon,klev))
    1970       ALLOCATE(  d_tr_trsp05(klon,klev))
    1971       ALLOCATE(  d_tr_sscav01(klon,klev))
    1972       ALLOCATE(  d_tr_sscav02(klon,klev))
    1973       ALLOCATE(  d_tr_sscav03(klon,klev))
    1974       ALLOCATE(  d_tr_sscav04(klon,klev))
    1975       ALLOCATE(  d_tr_sscav05(klon,klev))
    1976       ALLOCATE(  d_tr_sat01(klon,klev))
    1977       ALLOCATE(  d_tr_sat02(klon,klev))
    1978       ALLOCATE(  d_tr_sat03(klon,klev))
    1979       ALLOCATE(  d_tr_sat04(klon,klev))
    1980       ALLOCATE(  d_tr_sat05(klon,klev))
    1981       ALLOCATE(  d_tr_uscav01(klon,klev))
    1982       ALLOCATE(  d_tr_uscav02(klon,klev))
    1983       ALLOCATE(  d_tr_uscav03(klon,klev))
    1984       ALLOCATE(  d_tr_uscav04(klon,klev))
    1985       ALLOCATE(  d_tr_uscav05(klon,klev))
     2153      !ALLOCATE(d_tr_th(klon,klev,nbtr))
     2154      !ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr))
     2155      !ALLOCATE(d_tr_lessi_nucl(klon,klev,nbtr))
     2156
     2157      !ALLOCATE( diff_aod550_tot(klon)     )
     2158      !ALLOCATE( diag_aod670_tot(klon)     )
     2159      !ALLOCATE( diag_aod865_tot(klon)     )
     2160      !ALLOCATE( diff_aod550_tr2(klon)     )
     2161      !ALLOCATE( diag_aod670_tr2(klon)     )
     2162      !ALLOCATE( diag_aod865_tr2(klon)     )
     2163      !ALLOCATE( diag_aod550_ss(klon)      )
     2164      !ALLOCATE( diag_aod670_ss(klon)      )
     2165      !ALLOCATE( diag_aod865_ss(klon)      )
     2166      !ALLOCATE( diag_aod550_dust(klon)    )
     2167      !ALLOCATE( diag_aod670_dust(klon)    )
     2168      !ALLOCATE( diag_aod865_dust(klon)    )
     2169      !ALLOCATE( diag_aod550_dustsco(klon)  )
     2170      !ALLOCATE( diag_aod670_dustsco(klon)  )
     2171      !ALLOCATE( diag_aod865_dustsco(klon)  )
     2172
     2173
     2174      !ALLOCATE(  sconc01(klon)     )
     2175      !ALLOCATE(  trm01(klon)     )
     2176      !ALLOCATE(  sconc02(klon)     )
     2177      !ALLOCATE(  trm02(klon)     )
     2178      !ALLOCATE(  sconc03(klon)     )
     2179      !ALLOCATE(  trm03(klon)     )
     2180      !ALLOCATE(  sconc04(klon)     )
     2181      !ALLOCATE(  trm04(klon)     )
     2182      !ALLOCATE(  sconc05(klon)     )
     2183      !ALLOCATE(  trm05(klon)     )
     2184
     2185
     2186      !ALLOCATE(  flux01(klon)     )
     2187      !ALLOCATE(  flux02(klon)     )
     2188      !ALLOCATE(  flux03(klon)     )
     2189      !ALLOCATE(  flux04(klon)     )
     2190      !ALLOCATE(  flux05(klon)     )
     2191      !ALLOCATE(  ds01(klon)     )
     2192      !ALLOCATE(  ds02(klon)     )
     2193      !ALLOCATE(  ds03(klon)     )
     2194      !ALLOCATE(  ds04(klon)     )
     2195      !ALLOCATE(  ds05(klon)     )
     2196      !ALLOCATE(  dh01(klon)     )
     2197      !ALLOCATE(  dh02(klon)     )
     2198      !ALLOCATE(  dh03(klon)     )
     2199      !ALLOCATE(  dh04(klon)     )
     2200      !ALLOCATE(  dh05(klon)     )
     2201      !ALLOCATE(  dtrconv01(klon)     )
     2202      !ALLOCATE(  dtrconv02(klon)     )
     2203      !ALLOCATE(  dtrconv03(klon)     )
     2204      !ALLOCATE(  dtrconv04(klon)     )
     2205      !ALLOCATE(  dtrconv05(klon)     )
     2206      !ALLOCATE(  dtherm01(klon)     )
     2207      !ALLOCATE(  dtherm02(klon)     )
     2208      !ALLOCATE(  dtherm03(klon)     )
     2209      !ALLOCATE(  dtherm04(klon)     )
     2210      !ALLOCATE(  dtherm05(klon)     )
     2211      !ALLOCATE(  dhkecv01(klon)     )
     2212      !ALLOCATE(  dhkecv02(klon)     )
     2213      !ALLOCATE(  dhkecv03(klon)     )
     2214      !ALLOCATE(  dhkecv04(klon)     )
     2215      !ALLOCATE(  dhkecv05(klon)     )
     2216      !ALLOCATE(  d_tr_ds01(klon)     )
     2217      !ALLOCATE(  d_tr_ds02(klon)     )
     2218      !ALLOCATE(  d_tr_ds03(klon)     )
     2219      !ALLOCATE(  d_tr_ds04(klon)     )
     2220      !ALLOCATE(  d_tr_ds05(klon)     )
     2221      !ALLOCATE(  dhkelsc01(klon)     )
     2222      !ALLOCATE(  dhkelsc02(klon)     )
     2223      !ALLOCATE(  dhkelsc03(klon)     )
     2224      !ALLOCATE(  dhkelsc04(klon)     )
     2225      !ALLOCATE(  dhkelsc05(klon)     )
     2226      !ALLOCATE(  d_tr_cv01(klon,klev))
     2227      !ALLOCATE(  d_tr_cv02(klon,klev))
     2228      !ALLOCATE(  d_tr_cv03(klon,klev))
     2229      !ALLOCATE(  d_tr_cv04(klon,klev))
     2230      !ALLOCATE(  d_tr_cv05(klon,klev))
     2231      !ALLOCATE(  d_tr_trsp01(klon,klev))
     2232      !ALLOCATE(  d_tr_trsp02(klon,klev))
     2233      !ALLOCATE(  d_tr_trsp03(klon,klev))
     2234      !ALLOCATE(  d_tr_trsp04(klon,klev))
     2235      !ALLOCATE(  d_tr_trsp05(klon,klev))
     2236      !ALLOCATE(  d_tr_sscav01(klon,klev))
     2237      !ALLOCATE(  d_tr_sscav02(klon,klev))
     2238      !ALLOCATE(  d_tr_sscav03(klon,klev))
     2239      !ALLOCATE(  d_tr_sscav04(klon,klev))
     2240      !ALLOCATE(  d_tr_sscav05(klon,klev))
     2241      !ALLOCATE(  d_tr_sat01(klon,klev))
     2242      !ALLOCATE(  d_tr_sat02(klon,klev))
     2243      !ALLOCATE(  d_tr_sat03(klon,klev))
     2244      !ALLOCATE(  d_tr_sat04(klon,klev))
     2245      !ALLOCATE(  d_tr_sat05(klon,klev))
     2246      !ALLOCATE(  d_tr_uscav01(klon,klev))
     2247      !ALLOCATE(  d_tr_uscav02(klon,klev))
     2248      !ALLOCATE(  d_tr_uscav03(klon,klev))
     2249      !ALLOCATE(  d_tr_uscav04(klon,klev))
     2250      !ALLOCATE(  d_tr_uscav05(klon,klev))
    19862251     
    19872252!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    19882253!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1989       ALLOCATE(  d_tr_insc01(klon,klev))
    1990       ALLOCATE(  d_tr_insc02(klon,klev))
    1991       ALLOCATE(  d_tr_insc03(klon,klev))
    1992       ALLOCATE(  d_tr_insc04(klon,klev))
    1993       ALLOCATE(  d_tr_insc05(klon,klev))
    1994       ALLOCATE(  d_tr_bcscav01(klon,klev))
    1995       ALLOCATE(  d_tr_bcscav02(klon,klev))
    1996       ALLOCATE(  d_tr_bcscav03(klon,klev))
    1997       ALLOCATE(  d_tr_bcscav04(klon,klev))
    1998       ALLOCATE(  d_tr_bcscav05(klon,klev))
    1999       ALLOCATE(  d_tr_evapls01(klon,klev))
    2000       ALLOCATE(  d_tr_evapls02(klon,klev))
    2001       ALLOCATE(  d_tr_evapls03(klon,klev))
    2002       ALLOCATE(  d_tr_evapls04(klon,klev))
    2003       ALLOCATE(  d_tr_evapls05(klon,klev))
    2004       ALLOCATE(  d_tr_ls01(klon,klev))
    2005       ALLOCATE(  d_tr_ls02(klon,klev))
    2006       ALLOCATE(  d_tr_ls03(klon,klev))
    2007       ALLOCATE(  d_tr_ls04(klon,klev))
    2008       ALLOCATE(  d_tr_ls05(klon,klev))
    2009       ALLOCATE(  d_tr_dyn01(klon,klev))
    2010       ALLOCATE(  d_tr_dyn02(klon,klev))
    2011       ALLOCATE(  d_tr_dyn03(klon,klev))
    2012       ALLOCATE(  d_tr_dyn04(klon,klev))
    2013       ALLOCATE(  d_tr_dyn05(klon,klev))
    2014       ALLOCATE(  d_tr_cl01(klon,klev))
    2015       ALLOCATE(  d_tr_cl02(klon,klev))
    2016       ALLOCATE(  d_tr_cl03(klon,klev))
    2017       ALLOCATE(  d_tr_cl04(klon,klev))
    2018       ALLOCATE(  d_tr_cl05(klon,klev))
    2019       ALLOCATE(  d_tr_th01(klon,klev))
    2020       ALLOCATE(  d_tr_th02(klon,klev))
    2021       ALLOCATE(  d_tr_th03(klon,klev))
    2022       ALLOCATE(  d_tr_th04(klon,klev))
    2023       ALLOCATE(  d_tr_th05(klon,klev))
    2024 
    2025       ALLOCATE( sed_ss3D(klon,klev))
    2026       ALLOCATE( sed_dust3D(klon,klev))
    2027       ALLOCATE( sed_dustsco3D(klon,klev))
     2254      !ALLOCATE(  d_tr_insc01(klon,klev))
     2255      !ALLOCATE(  d_tr_insc02(klon,klev))
     2256      !ALLOCATE(  d_tr_insc03(klon,klev))
     2257      !ALLOCATE(  d_tr_insc04(klon,klev))
     2258      !ALLOCATE(  d_tr_insc05(klon,klev))
     2259      !ALLOCATE(  d_tr_bcscav01(klon,klev))
     2260      !ALLOCATE(  d_tr_bcscav02(klon,klev))
     2261      !ALLOCATE(  d_tr_bcscav03(klon,klev))
     2262      !ALLOCATE(  d_tr_bcscav04(klon,klev))
     2263      !ALLOCATE(  d_tr_bcscav05(klon,klev))
     2264      !ALLOCATE(  d_tr_evapls01(klon,klev))
     2265      !ALLOCATE(  d_tr_evapls02(klon,klev))
     2266      !ALLOCATE(  d_tr_evapls03(klon,klev))
     2267      !ALLOCATE(  d_tr_evapls04(klon,klev))
     2268      !ALLOCATE(  d_tr_evapls05(klon,klev))
     2269      !ALLOCATE(  d_tr_ls01(klon,klev))
     2270      !ALLOCATE(  d_tr_ls02(klon,klev))
     2271      !ALLOCATE(  d_tr_ls03(klon,klev))
     2272      !ALLOCATE(  d_tr_ls04(klon,klev))
     2273      !ALLOCATE(  d_tr_ls05(klon,klev))
     2274      !ALLOCATE(  d_tr_dyn01(klon,klev))
     2275      !ALLOCATE(  d_tr_dyn02(klon,klev))
     2276      !ALLOCATE(  d_tr_dyn03(klon,klev))
     2277      !ALLOCATE(  d_tr_dyn04(klon,klev))
     2278      !ALLOCATE(  d_tr_dyn05(klon,klev))
     2279      !ALLOCATE(  d_tr_cl01(klon,klev))
     2280      !ALLOCATE(  d_tr_cl02(klon,klev))
     2281      !ALLOCATE(  d_tr_cl03(klon,klev))
     2282      !ALLOCATE(  d_tr_cl04(klon,klev))
     2283      !ALLOCATE(  d_tr_cl05(klon,klev))
     2284      !ALLOCATE(  d_tr_th01(klon,klev))
     2285      !ALLOCATE(  d_tr_th02(klon,klev))
     2286      !ALLOCATE(  d_tr_th03(klon,klev))
     2287      !ALLOCATE(  d_tr_th04(klon,klev))
     2288      !ALLOCATE(  d_tr_th05(klon,klev))
     2289
     2290      !ALLOCATE( sed_ss3D(klon,klev))
     2291      !ALLOCATE( sed_dust3D(klon,klev))
     2292      !ALLOCATE( sed_dustsco3D(klon,klev))
    20282293
    20292294!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    20302295!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    20312296
    2032       ALLOCATE( sed_ss(klon))
    2033       ALLOCATE( sed_dust(klon))
    2034       ALLOCATE( sed_dustsco(klon))
    2035       ALLOCATE( his_g2pgas(klon))
    2036       ALLOCATE( his_g2paer(klon))
    2037 
    2038       ALLOCATE( fluxbb(klon))
    2039       ALLOCATE( fluxff(klon))
    2040       ALLOCATE( fluxbcbb(klon))
    2041       ALLOCATE( fluxbcff(klon))
    2042       ALLOCATE( fluxbcnff(klon))
    2043       ALLOCATE( fluxbcba(klon))
    2044       ALLOCATE( fluxbc(klon))
    2045       ALLOCATE( fluxombb(klon))
    2046       ALLOCATE( fluxomff(klon))
    2047       ALLOCATE( fluxomnff(klon))
    2048       ALLOCATE( fluxomba(klon))
    2049       ALLOCATE( fluxomnat(klon))
    2050       ALLOCATE( fluxom(klon))
    2051       ALLOCATE( fluxh2sff(klon))
    2052       ALLOCATE( fluxh2snff(klon))
    2053       ALLOCATE( fluxso2ff(klon))
    2054       ALLOCATE( fluxso2nff(klon))
    2055       ALLOCATE( fluxso2bb(klon))
    2056       ALLOCATE( fluxso2vol(klon))
    2057       ALLOCATE( fluxso2ba(klon))
    2058       ALLOCATE( fluxso2(klon))
    2059       ALLOCATE( fluxso4ff(klon))
    2060       ALLOCATE( fluxso4nff(klon))
    2061       ALLOCATE( fluxso4bb(klon))
    2062       ALLOCATE( fluxso4ba(klon))
    2063       ALLOCATE( fluxso4(klon))
    2064       ALLOCATE( fluxdms(klon))
    2065       ALLOCATE( fluxh2sbio(klon))
    2066       ALLOCATE( fluxdustec(klon))
    2067       ALLOCATE( fluxddfine(klon))
    2068       ALLOCATE( fluxddcoa(klon))
    2069       ALLOCATE( fluxddsco(klon))
    2070       ALLOCATE( fluxdd(klon))
    2071       ALLOCATE( fluxssfine(klon))
    2072       ALLOCATE( fluxsscoa(klon))
    2073       ALLOCATE( fluxss(klon))
    2074       ALLOCATE( flux_sparam_ind(klon))
    2075       ALLOCATE( flux_sparam_bb(klon))
    2076       ALLOCATE( flux_sparam_ff(klon))
    2077       ALLOCATE( flux_sparam_ddfine(klon))
    2078       ALLOCATE( flux_sparam_ddcoa(klon))
    2079       ALLOCATE( flux_sparam_ddsco(klon))
    2080       ALLOCATE( flux_sparam_ssfine(klon))
    2081       ALLOCATE( flux_sparam_sscoa(klon))
    2082       ALLOCATE( u10m_ss(klon))
    2083       ALLOCATE( v10m_ss(klon))
     2297      !ALLOCATE( sed_ss(klon))
     2298      !ALLOCATE( sed_dust(klon))
     2299      !ALLOCATE( sed_dustsco(klon))
     2300      !ALLOCATE( his_g2pgas(klon))
     2301      !ALLOCATE( his_g2paer(klon))
     2302
     2303      !ALLOCATE( fluxbb(klon))
     2304      !ALLOCATE( fluxff(klon))
     2305      !ALLOCATE( fluxbcbb(klon))
     2306      !ALLOCATE( fluxbcff(klon))
     2307      !ALLOCATE( fluxbcnff(klon))
     2308      !ALLOCATE( fluxbcba(klon))
     2309      !ALLOCATE( fluxbc(klon))
     2310      !ALLOCATE( fluxombb(klon))
     2311      !ALLOCATE( fluxomff(klon))
     2312      !ALLOCATE( fluxomnff(klon))
     2313      !ALLOCATE( fluxomba(klon))
     2314      !ALLOCATE( fluxomnat(klon))
     2315      !ALLOCATE( fluxom(klon))
     2316      !ALLOCATE( fluxh2sff(klon))
     2317      !ALLOCATE( fluxh2snff(klon))
     2318      !ALLOCATE( fluxso2ff(klon))
     2319      !ALLOCATE( fluxso2nff(klon))
     2320      !ALLOCATE( fluxso2bb(klon))
     2321      !ALLOCATE( fluxso2vol(klon))
     2322      !ALLOCATE( fluxso2ba(klon))
     2323      !ALLOCATE( fluxso2(klon))
     2324      !ALLOCATE( fluxso4ff(klon))
     2325      !ALLOCATE( fluxso4nff(klon))
     2326      !ALLOCATE( fluxso4bb(klon))
     2327      !ALLOCATE( fluxso4ba(klon))
     2328      !ALLOCATE( fluxso4(klon))
     2329      !ALLOCATE( fluxdms(klon))
     2330      !ALLOCATE( fluxh2sbio(klon))
     2331      !ALLOCATE( fluxdustec(klon))
     2332      !ALLOCATE( fluxddfine(klon))
     2333      !ALLOCATE( fluxddcoa(klon))
     2334      !ALLOCATE( fluxddsco(klon))
     2335      !ALLOCATE( fluxdd(klon))
     2336      !ALLOCATE( fluxssfine(klon))
     2337      !ALLOCATE( fluxsscoa(klon))
     2338      !ALLOCATE( fluxss(klon))
     2339      !ALLOCATE( flux_sparam_ind(klon))
     2340      !ALLOCATE( flux_sparam_bb(klon))
     2341      !ALLOCATE( flux_sparam_ff(klon))
     2342      !ALLOCATE( flux_sparam_ddfine(klon))
     2343      !ALLOCATE( flux_sparam_ddcoa(klon))
     2344      !ALLOCATE( flux_sparam_ddsco(klon))
     2345      !ALLOCATE( flux_sparam_ssfine(klon))
     2346      !ALLOCATE( flux_sparam_sscoa(klon))
     2347      !ALLOCATE( u10m_ss(klon))
     2348      !ALLOCATE( v10m_ss(klon))
    20842349
    20852350
     
    21172382!       ALLOCATE(aod865_terra(klon))
    21182383
    2119       ALLOCATE( aod550_terra(klon)) 
    2120       ALLOCATE( aod550_tr2_terra(klon)) 
    2121       ALLOCATE( aod550_ss_terra(klon))   
    2122       ALLOCATE( aod550_dust_terra(klon))   
    2123       ALLOCATE( aod550_dustsco_terra(klon))   
    2124       ALLOCATE( aod670_terra(klon))   
    2125       ALLOCATE( aod670_tr2_terra(klon)) 
    2126       ALLOCATE( aod670_ss_terra(klon)) 
    2127       ALLOCATE( aod670_dust_terra(klon)) 
    2128       ALLOCATE( aod670_dustsco_terra(klon)) 
    2129       ALLOCATE( aod865_terra(klon))   
    2130       ALLOCATE( aod865_tr2_terra(klon)) 
    2131       ALLOCATE( aod865_ss_terra(klon)) 
    2132       ALLOCATE( aod865_dust_terra(klon)) 
    2133       ALLOCATE( aod865_dustsco_terra(klon)) 
    2134 
    2135       ALLOCATE( aod550_aqua(klon)) 
    2136       ALLOCATE( aod550_tr2_aqua(klon)) 
    2137       ALLOCATE( aod550_ss_aqua(klon))   
    2138       ALLOCATE( aod550_dust_aqua(klon))   
    2139       ALLOCATE( aod550_dustsco_aqua(klon))   
    2140       ALLOCATE( aod670_aqua(klon))   
    2141       ALLOCATE( aod670_tr2_aqua(klon)) 
    2142       ALLOCATE( aod670_ss_aqua(klon)) 
    2143       ALLOCATE( aod670_dust_aqua(klon)) 
    2144       ALLOCATE( aod670_dustsco_aqua(klon)) 
    2145       ALLOCATE( aod865_aqua(klon))   
    2146       ALLOCATE( aod865_tr2_aqua(klon)) 
    2147       ALLOCATE( aod865_ss_aqua(klon)) 
    2148       ALLOCATE( aod865_dust_aqua(klon)) 
    2149       ALLOCATE( aod865_dustsco_aqua(klon)) 
     2384      !ALLOCATE( aod550_terra(klon)) 
     2385      !ALLOCATE( aod550_tr2_terra(klon)) 
     2386      !ALLOCATE( aod550_ss_terra(klon))   
     2387      !ALLOCATE( aod550_dust_terra(klon))   
     2388      !ALLOCATE( aod550_dustsco_terra(klon))   
     2389      !ALLOCATE( aod670_terra(klon))   
     2390      !ALLOCATE( aod670_tr2_terra(klon)) 
     2391      !ALLOCATE( aod670_ss_terra(klon)) 
     2392      !ALLOCATE( aod670_dust_terra(klon)) 
     2393      !ALLOCATE( aod670_dustsco_terra(klon)) 
     2394      !ALLOCATE( aod865_terra(klon))   
     2395      !ALLOCATE( aod865_tr2_terra(klon)) 
     2396      !ALLOCATE( aod865_ss_terra(klon)) 
     2397      !ALLOCATE( aod865_dust_terra(klon)) 
     2398      !ALLOCATE( aod865_dustsco_terra(klon)) 
     2399
     2400      !ALLOCATE( aod550_aqua(klon)) 
     2401      !ALLOCATE( aod550_tr2_aqua(klon)) 
     2402      !ALLOCATE( aod550_ss_aqua(klon))   
     2403      !ALLOCATE( aod550_dust_aqua(klon))   
     2404      !ALLOCATE( aod550_dustsco_aqua(klon))   
     2405      !ALLOCATE( aod670_aqua(klon))   
     2406      !ALLOCATE( aod670_tr2_aqua(klon)) 
     2407      !ALLOCATE( aod670_ss_aqua(klon)) 
     2408      !ALLOCATE( aod670_dust_aqua(klon)) 
     2409      !ALLOCATE( aod670_dustsco_aqua(klon)) 
     2410      !ALLOCATE( aod865_aqua(klon))   
     2411      !ALLOCATE( aod865_tr2_aqua(klon)) 
     2412      !ALLOCATE( aod865_ss_aqua(klon)) 
     2413      !ALLOCATE( aod865_dust_aqua(klon)) 
     2414      !ALLOCATE( aod865_dustsco_aqua(klon)) 
    21502415 
    21512416
     
    36823947! choix du lessivage
    36833948      IF (iflag_lscav .EQ. 3 .OR. iflag_lscav .EQ. 4) THEN
    3684       print *,'JE iflag_lscav',iflag_lscav
    3685        DO it = 1, nbtr
     3949      !IF (.false.) THEN  ! test #DFB (Binta) sans lsc_scav_spl
     3950        print *,'JE iflag_lscav',iflag_lscav
     3951        DO it = 1, nbtr
    36863952
    36873953!       incloud scavenging and removal by large scale rain ! orig : ql_incl
     
    36943960!     .               t_seri,tr_seri,d_tr_insc,
    36953961!     .               d_tr_bcscav,d_tr_evapls,qPrls)
    3696        CALL lsc_scav_spl(pdtphys,it,iflag_lscav,ql_incl,prfl,psfl,  &
     3962          CALL lsc_scav_spl(pdtphys,it,iflag_lscav,ql_incl,prfl,psfl,  &
    36973963                    rneb,beta_fisrt, beta_v1,pplay,paprs,      &
    36983964                    t_seri,tr_seri,d_tr_insc,                  &
     
    37023968
    37033969!large scale scavenging tendency
    3704        DO k = 1, klev
    3705         DO i = 1, klon
    3706          d_tr_ls(i,k,it)=d_tr_insc(i,k,it)+d_tr_bcscav(i,k,it) &
     3970          DO k = 1, klev
     3971           DO i = 1, klon
     3972                d_tr_ls(i,k,it)=d_tr_insc(i,k,it)+d_tr_bcscav(i,k,it) &
    37073973                        +d_tr_evapls(i,k,it)
    3708          tr_seri(i,k,it)=tr_seri(i,k,it)+d_tr_ls(i,k,it)
    3709           tmp_var(i,k)=d_tr_ls(i,k,it)
    3710         ENDDO
    3711        ENDDO
    3712 
    3713        CALL kg_to_cm3(pplay,t_seri,tmp_var)
    3714          DO k=1,klev
    3715             DO i=1,klon
     3974                tr_seri(i,k,it)=tr_seri(i,k,it)+d_tr_ls(i,k,it)
     3975                         tmp_var(i,k)=d_tr_ls(i,k,it)
     3976           ENDDO
     3977          ENDDO
     3978
     3979          CALL kg_to_cm3(pplay,t_seri,tmp_var)
     3980
     3981          DO k=1,klev
     3982           DO i=1,klon
    37163983            his_dhkelsc(i,it)=his_dhkelsc(i,it)-tmp_var(i,k)    &
    37173984                     /RNAVO*masse(it)*1.e3*1.e6*zdz(i,k)/pdtphys
    37183985     
    3719             END DO
    3720          END DO
    3721 
    3722        END DO  !tr
     3986           END DO
     3987          END DO
     3988
     3989        END DO  !it=1,nbtr
     3990
    37233991      ELSE
    3724         his_dhkelsc(i,it)=0.0
    37253992        print *,'WARNING: NO lsc_scav, Please choose iflag_lscav=3 or 4'
    3726        ENDIF !iflag_lscav
     3993        DO it = 1, nbtr
     3994          DO i=1,klon
     3995            his_dhkelsc(i,it)=0.0
     3996          END DO  ! klon
     3997         END DO  !it=1,nbtr
     3998      ENDIF !iflag_lscav
    37273999
    37284000       print *,' AFTER lsc_scav '
     
    55995871      d_tr_th04(i,k)=0.
    56005872      d_tr_th05(i,k)=0.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     5873        ENDDO
     5874      ENDDO
     5875
     5876      IF(1==0) THEN
     5877      ! calcul in original trunk version; problem: budget not closed. Corrected in "ELSE"
     5878      DO i=1, klon
     5879        DO k=1,klev
     5880
    56015881      if(id_prec>0)        d_tr_cv01(i,k)   =d_tr_cv_o(i,k,id_prec)
    56025882      if(id_fine>0)        d_tr_cv02(i,k)   =d_tr_cv_o(i,k,id_fine)
     
    56415921        ENDDO
    56425922      ENDDO
    5643       IF(1==0) THEN
     5923      ELSE ! correction pour fermeture de bilan, par FH dans les simus de Binta pour Habib
     5924      DO i=1, klon
     5925        DO k=1,klev
     5926      if(id_prec>0)        d_tr_cv01(i,k)   =d_tr_cv(i,k,id_prec)/pdtphys
     5927      if(id_fine>0)        d_tr_cv02(i,k)   =d_tr_cv(i,k,id_fine)/pdtphys
     5928      if(id_coss>0)        d_tr_cv03(i,k)   =d_tr_cv(i,k,id_coss)/pdtphys
     5929      if(id_codu>0)        d_tr_cv04(i,k)   =d_tr_cv(i,k,id_codu)/pdtphys
     5930      if(id_scdu>0)        d_tr_cv05(i,k)   =d_tr_cv(i,k,id_scdu)/pdtphys
     5931      if(id_prec>0)        d_tr_trsp01(i,k) =d_tr_trsp(i,k,id_prec)/pdtphys
     5932      if(id_fine>0)        d_tr_trsp02(i,k) =d_tr_trsp(i,k,id_fine)/pdtphys
     5933      if(id_coss>0)        d_tr_trsp03(i,k) =d_tr_trsp(i,k,id_coss)/pdtphys
     5934      if(id_codu>0)        d_tr_trsp04(i,k) =d_tr_trsp(i,k,id_codu)/pdtphys
     5935      if(id_scdu>0)        d_tr_trsp05(i,k) =d_tr_trsp(i,k,id_scdu)/pdtphys
     5936      if(id_prec>0)        d_tr_sscav01(i,k)=d_tr_sscav(i,k,id_prec)/pdtphys
     5937      if(id_fine>0)        d_tr_sscav02(i,k)=d_tr_sscav(i,k,id_fine)/pdtphys
     5938      if(id_coss>0)        d_tr_sscav03(i,k)=d_tr_sscav(i,k,id_coss)/pdtphys
     5939      if(id_codu>0)        d_tr_sscav04(i,k)=d_tr_sscav(i,k,id_codu)/pdtphys
     5940      if(id_scdu>0)        d_tr_sscav05(i,k)=d_tr_sscav(i,k,id_scdu)/pdtphys
     5941      if(id_prec>0)        d_tr_sat01(i,k)  =d_tr_sat(i,k,id_prec)/pdtphys
     5942      if(id_fine>0)        d_tr_sat02(i,k)  =d_tr_sat(i,k,id_fine)/pdtphys
     5943      if(id_coss>0)        d_tr_sat03(i,k)  =d_tr_sat(i,k,id_coss)/pdtphys
     5944      if(id_codu>0)        d_tr_sat04(i,k)  =d_tr_sat(i,k,id_codu)/pdtphys
     5945      if(id_scdu>0)        d_tr_sat05(i,k)  =d_tr_sat(i,k,id_scdu)/pdtphys
     5946      if(id_prec>0)        d_tr_uscav01(i,k)=d_tr_uscav(i,k,id_prec)/pdtphys
     5947      if(id_fine>0)        d_tr_uscav02(i,k)=d_tr_uscav(i,k,id_fine)/pdtphys
     5948      if(id_coss>0)        d_tr_uscav03(i,k)=d_tr_uscav(i,k,id_coss)/pdtphys
     5949      if(id_codu>0)        d_tr_uscav04(i,k)=d_tr_uscav(i,k,id_codu)/pdtphys
     5950      if(id_scdu>0)        d_tr_uscav05(i,k)=d_tr_uscav(i,k,id_scdu)/pdtphys
     5951      if(id_prec>0)        d_tr_insc01(i,k)=d_tr_insc(i,k,id_prec)/pdtphys
     5952      if(id_fine>0)        d_tr_insc02(i,k)=d_tr_insc(i,k,id_fine)/pdtphys
     5953      if(id_coss>0)        d_tr_insc03(i,k)=d_tr_insc(i,k,id_coss)/pdtphys
     5954      if(id_codu>0)        d_tr_insc04(i,k)=d_tr_insc(i,k,id_codu)/pdtphys
     5955      if(id_scdu>0)        d_tr_insc05(i,k)=d_tr_insc(i,k,id_scdu)/pdtphys
     5956      if(id_prec>0)        d_tr_bcscav01(i,k)=d_tr_bcscav(i,k,id_prec)/pdtphys
     5957      if(id_fine>0)        d_tr_bcscav02(i,k)=d_tr_bcscav(i,k,id_fine)/pdtphys
     5958      if(id_coss>0)        d_tr_bcscav03(i,k)=d_tr_bcscav(i,k,id_coss)/pdtphys
     5959      if(id_codu>0)        d_tr_bcscav04(i,k)=d_tr_bcscav(i,k,id_codu)/pdtphys
     5960      if(id_scdu>0)        d_tr_bcscav05(i,k)=d_tr_bcscav(i,k,id_scdu)/pdtphys
     5961      if(id_prec>0)        d_tr_evapls01(i,k)=d_tr_evapls(i,k,id_prec)/pdtphys
     5962      if(id_fine>0)        d_tr_evapls02(i,k)=d_tr_evapls(i,k,id_fine)/pdtphys
     5963      if(id_coss>0)        d_tr_evapls03(i,k)=d_tr_evapls(i,k,id_coss)/pdtphys
     5964      if(id_codu>0)        d_tr_evapls04(i,k)=d_tr_evapls(i,k,id_codu)/pdtphys
     5965      if(id_scdu>0)        d_tr_evapls05(i,k)=d_tr_evapls(i,k,id_scdu)/pdtphys
     5966        ENDDO
     5967      ENDDO
     5968      ENDIF
     5969
     5970      IF(1==0) THEN  ! This "if" is as in original trunk
    56445971      DO i=1, klon
    56455972        DO k=1,klev
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/read_dust.F

    r2630 r3798  
    1414      real dust_ec_glo(klon_glo)
    1515c
    16       real dust_nc(iip1,jjp1)
     16c as      real dust_nc(iip1,jjp1)
    1717      real dust_nc_glo(nbp_lon+1,nbp_lat)
    1818      real rcode
     
    5959c--upside down + physical grid
    6060c
    61 c--OB=change jjp1 to 1 here
     61c--OB=change jjp1 to 1 here ;
     62c----AS: OB's change is needed if lats N to S (90 to -90) in dust.nc
    6263!      dust_ec(1)=MAX(dust_nc(1,jjp1),0.0)
    63       dust_ec(1)=MAX(dust_nc(1,nbp_lat),0.0)
     64      dust_ec_glo(1)=MAX(dust_nc_glo(1,nbp_lat),0.0)
    6465      ig=2
    6566!      DO j=2,jjm
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/read_newemissions.F

    r2630 r3798  
    5959!$OMP THREADPRIVATE(u10m_ec1, v10m_ec1, dust_ec1)
    6060!$OMP THREADPRIVATE(u10m_ec2, v10m_ec2, dust_ec2)
    61       REAL u10m_nc(iip1,jjp1), v10m_nc(iip1,jjp1)
     61c as      REAL u10m_nc(iip1,jjp1), v10m_nc(iip1,jjp1)
    6262      REAL u10m_ec(klon), v10m_ec(klon), dust_ec(klon)
    6363c      REAL cly(klon), wth(klon), zprecipinsoil(klon)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/spla_output_write.h

    r2752 r3798  
    99      CALL histwrite_phy( o_taue670          , diag_aod670_tot  )
    1010      CALL histwrite_phy( o_taue865          , diag_aod865_tot  )
    11       IF(id_fine>0) CALL histwrite_phy( o_taue550_tr2      , diff_aod550_tr2  )
    12       IF(id_fine>0) CALL histwrite_phy( o_taue670_tr2      , diag_aod670_tr2  )
    13       IF(id_fine>0) CALL histwrite_phy( o_taue865_tr2      , diag_aod865_tr2  )
    14       IF(id_coss>0) CALL histwrite_phy( o_taue550_ss       , diag_aod550_ss   )
    15       IF(id_coss>0) CALL histwrite_phy( o_taue670_ss       , diag_aod670_ss   )
    16       IF(id_coss>0) CALL histwrite_phy( o_taue865_ss       , diag_aod865_ss   )
    17       IF(id_codu>0) CALL histwrite_phy( o_taue550_dust     , diag_aod550_dust )
    18       IF(id_codu>0) CALL histwrite_phy( o_taue670_dust     , diag_aod670_dust )
    19       IF(id_codu>0) CALL histwrite_phy( o_taue865_dust     , diag_aod865_dust )
    20       IF(id_scdu>0) CALL histwrite_phy( o_taue550_dustsco  , diag_aod550_dustsco )
    21       IF(id_scdu>0) CALL histwrite_phy( o_taue670_dustsco  , diag_aod670_dustsco )
    22       IF(id_scdu>0) CALL histwrite_phy( o_taue865_dustsco  , diag_aod865_dustsco )
     11      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_tr2      , diff_aod550_tr2  )
     12      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_tr2      , diag_aod670_tr2  )
     13      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_tr2      , diag_aod865_tr2  )
     14      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_ss       , diag_aod550_ss   )
     15      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_ss       , diag_aod670_ss   )
     16      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_ss       , diag_aod865_ss   )
     17      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_dust     , diag_aod550_dust )
     18      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_dust     , diag_aod670_dust )
     19      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_dust     , diag_aod865_dust )
     20      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_dustsco  , diag_aod550_dustsco )
     21      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_dustsco  , diag_aod670_dustsco )
     22      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_dustsco  , diag_aod865_dustsco )
    2323      CALL histwrite_phy( o_taue550_aqua     , aod550_aqua  )
    2424      CALL histwrite_phy( o_taue550_terra    , aod550_terra )
     
    2828      CALL histwrite_phy( o_taue865_terra    , aod865_terra )
    2929
    30       IF(id_fine>0) CALL histwrite_phy( o_taue550_fine_aqua     ,aod550_tr2_aqua   )
    31       IF(id_fine>0) CALL histwrite_phy( o_taue670_fine_aqua     ,aod670_tr2_aqua   )
    32       IF(id_fine>0) CALL histwrite_phy( o_taue865_fine_aqua     ,aod865_tr2_aqua   )
    33       IF(id_coss>0) CALL histwrite_phy( o_taue550_coss_aqua      ,aod550_ss_aqua   )
    34       IF(id_coss>0) CALL histwrite_phy( o_taue670_coss_aqua      ,aod670_ss_aqua   )
    35       IF(id_coss>0) CALL histwrite_phy( o_taue865_coss_aqua      ,aod865_ss_aqua   )
    36       IF(id_codu>0) CALL histwrite_phy( o_taue550_codu_aqua    ,aod550_dust_aqua   )
    37       IF(id_codu>0) CALL histwrite_phy( o_taue670_codu_aqua    ,aod670_dust_aqua   )
    38       IF(id_codu>0) CALL histwrite_phy( o_taue865_codu_aqua    ,aod865_dust_aqua   )
    39       IF(id_scdu>0) CALL histwrite_phy( o_taue670_scdu_aqua ,aod670_dustsco_aqua   )
    40       IF(id_scdu>0) CALL histwrite_phy( o_taue550_scdu_aqua ,aod550_dustsco_aqua   )
    41       IF(id_scdu>0) CALL histwrite_phy( o_taue865_scdu_aqua ,aod865_dustsco_aqua   )
     30      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_fine_aqua     ,aod550_tr2_aqua   )
     31      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_fine_aqua     ,aod670_tr2_aqua   )
     32      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_fine_aqua     ,aod865_tr2_aqua   )
     33      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_coss_aqua      ,aod550_ss_aqua   )
     34      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_coss_aqua      ,aod670_ss_aqua   )
     35      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_coss_aqua      ,aod865_ss_aqua   )
     36      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_codu_aqua    ,aod550_dust_aqua   )
     37      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_codu_aqua    ,aod670_dust_aqua   )
     38      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_codu_aqua    ,aod865_dust_aqua   )
     39      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_scdu_aqua ,aod670_dustsco_aqua   )
     40      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_scdu_aqua ,aod550_dustsco_aqua   )
     41      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_scdu_aqua ,aod865_dustsco_aqua   )
    4242     
    43       IF(id_fine>0) CALL histwrite_phy( o_taue550_fine_terra     ,aod550_tr2_terra   )
    44       IF(id_fine>0) CALL histwrite_phy( o_taue670_fine_terra     ,aod670_tr2_terra   )
    45       IF(id_fine>0) CALL histwrite_phy( o_taue865_fine_terra     ,aod865_tr2_terra   )
    46       IF(id_coss>0) CALL histwrite_phy( o_taue550_coss_terra      ,aod550_ss_terra   )
    47       IF(id_coss>0) CALL histwrite_phy( o_taue670_coss_terra      ,aod670_ss_terra   )
    48       IF(id_coss>0) CALL histwrite_phy( o_taue865_coss_terra      ,aod865_ss_terra   )
    49       IF(id_codu>0) CALL histwrite_phy( o_taue550_codu_terra    ,aod550_dust_terra   )
    50       IF(id_codu>0) CALL histwrite_phy( o_taue670_codu_terra    ,aod670_dust_terra   )
    51       IF(id_codu>0) CALL histwrite_phy( o_taue865_codu_terra    ,aod865_dust_terra   )
    52       IF(id_scdu>0) CALL histwrite_phy( o_taue670_scdu_terra ,aod670_dustsco_terra   )
    53       IF(id_scdu>0) CALL histwrite_phy( o_taue550_scdu_terra ,aod550_dustsco_terra   )
    54       IF(id_scdu>0) CALL histwrite_phy( o_taue865_scdu_terra ,aod865_dustsco_terra   )
    55 
    56 
    57       IF(id_prec>0) CALL histwrite_phy( o_trm01 , trm01 )
    58       IF(id_fine>0) CALL histwrite_phy( o_trm02 , trm02 )
    59       IF(id_coss>0) CALL histwrite_phy( o_trm03 , trm03 )
    60       IF(id_codu>0) CALL histwrite_phy( o_trm04 , trm04 )
    61       IF(id_scdu>0) CALL histwrite_phy( o_trm05 , trm05 )
    62       IF(id_prec>0) CALL histwrite_phy( o_sconc01 , sconc01 )
    63       IF(id_fine>0) CALL histwrite_phy( o_sconc02 , sconc02 )
    64       IF(id_coss>0) CALL histwrite_phy( o_sconc03 , sconc03 )
    65       IF(id_codu>0) CALL histwrite_phy( o_sconc04 , sconc04 )
    66       IF(id_scdu>0) CALL histwrite_phy( o_sconc05 , sconc05 )
     43      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_fine_terra     ,aod550_tr2_terra   )
     44      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_fine_terra     ,aod670_tr2_terra   )
     45      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_fine_terra     ,aod865_tr2_terra   )
     46      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_coss_terra      ,aod550_ss_terra   )
     47      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_coss_terra      ,aod670_ss_terra   )
     48      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_coss_terra      ,aod865_ss_terra   )
     49      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_codu_terra    ,aod550_dust_terra   )
     50      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_codu_terra    ,aod670_dust_terra   )
     51      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_codu_terra    ,aod865_dust_terra   )
     52      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue670_scdu_terra ,aod670_dustsco_terra   )
     53      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue550_scdu_terra ,aod550_dustsco_terra   )
     54      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_taue865_scdu_terra ,aod865_dustsco_terra   )
     55
     56
     57      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm01 , trm01 )
     58      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm02 , trm02 )
     59      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm03 , trm03 )
     60      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm04 , trm04 )
     61      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_trm05 , trm05 )
     62      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc01 , sconc01 )
     63      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc02 , sconc02 )
     64      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc03 , sconc03 )
     65      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc04 , sconc04 )
     66      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sconc05 , sconc05 )
    6767
    6868! Lessivage
    6969
    70       IF(id_prec>0) CALL histwrite_phy( o_flux01       , flux01 )
    71       IF(id_fine>0) CALL histwrite_phy( o_flux02       , flux02 )
    72       IF(id_coss>0) CALL histwrite_phy( o_flux03       , flux03 )
    73       IF(id_codu>0) CALL histwrite_phy( o_flux04       , flux04 )
    74       IF(id_scdu>0) CALL histwrite_phy( o_flux05       , flux05 )
    75       IF(id_prec>0) CALL histwrite_phy( o_ds01         , ds01 )
    76       IF(id_fine>0) CALL histwrite_phy( o_ds02         , ds02 )
    77       IF(id_coss>0) CALL histwrite_phy( o_ds03         , ds03 )
    78       IF(id_codu>0) CALL histwrite_phy( o_ds04         , ds04 )
    79       IF(id_scdu>0) CALL histwrite_phy( o_ds05         , ds05 )
    80       IF(id_prec>0) CALL histwrite_phy( o_dh01         , dh01 )
    81       IF(id_fine>0) CALL histwrite_phy( o_dh02         , dh02 )
    82       IF(id_coss>0) CALL histwrite_phy( o_dh03         , dh03 )
    83       IF(id_codu>0) CALL histwrite_phy( o_dh04         , dh04 )
    84       IF(id_scdu>0) CALL histwrite_phy( o_dh05         , dh05 )
    85       IF(id_prec>0) CALL histwrite_phy( o_dtrconv01    , dtrconv01 )
    86       IF(id_fine>0) CALL histwrite_phy( o_dtrconv02    , dtrconv02 )
    87       IF(id_coss>0) CALL histwrite_phy( o_dtrconv03    , dtrconv03 )
    88       IF(id_codu>0) CALL histwrite_phy( o_dtrconv04    , dtrconv04 )
    89       IF(id_scdu>0) CALL histwrite_phy( o_dtrconv05    , dtrconv05 )
    90       IF(id_prec>0) CALL histwrite_phy( o_dtherm01     , dtherm01 )
    91       IF(id_fine>0) CALL histwrite_phy( o_dtherm02     , dtherm02 )
    92       IF(id_coss>0) CALL histwrite_phy( o_dtherm03     , dtherm03 )
    93       IF(id_codu>0) CALL histwrite_phy( o_dtherm04     , dtherm04 )
    94       IF(id_scdu>0) CALL histwrite_phy( o_dtherm05     , dtherm05 )
    95       IF(id_prec>0) CALL histwrite_phy( o_dhkecv01     , dhkecv01 )
    96       IF(id_fine>0) CALL histwrite_phy( o_dhkecv02     , dhkecv02 )
    97       IF(id_coss>0) CALL histwrite_phy( o_dhkecv03     , dhkecv03 )
    98       IF(id_codu>0) CALL histwrite_phy( o_dhkecv04     , dhkecv04 )
    99       IF(id_scdu>0) CALL histwrite_phy( o_dhkecv05     , dhkecv05 )
    100       IF(id_prec>0) CALL histwrite_phy( o_d_tr_ds01     , d_tr_ds01 )
    101       IF(id_fine>0) CALL histwrite_phy( o_d_tr_ds02     , d_tr_ds02 )
    102       IF(id_coss>0) CALL histwrite_phy( o_d_tr_ds03     , d_tr_ds03 )
    103       IF(id_codu>0) CALL histwrite_phy( o_d_tr_ds04     , d_tr_ds04 )
    104       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_ds05     , d_tr_ds05 )
    105       IF(id_prec>0) CALL histwrite_phy( o_dhkelsc01    , dhkelsc01 )
    106       IF(id_fine>0) CALL histwrite_phy( o_dhkelsc02    , dhkelsc02 )
    107       IF(id_coss>0) CALL histwrite_phy( o_dhkelsc03    , dhkelsc03 )
    108       IF(id_codu>0) CALL histwrite_phy( o_dhkelsc04    , dhkelsc04 )
    109       IF(id_scdu>0) CALL histwrite_phy( o_dhkelsc05    , dhkelsc05 )
    110       IF(id_prec>0) CALL histwrite_phy( o_d_tr_cv01    , d_tr_cv01 )
    111       IF(id_fine>0) CALL histwrite_phy( o_d_tr_cv02    , d_tr_cv02 )
    112       IF(id_coss>0) CALL histwrite_phy( o_d_tr_cv03    , d_tr_cv03 )
    113       IF(id_codu>0) CALL histwrite_phy( o_d_tr_cv04    , d_tr_cv04 )
    114       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_cv05    , d_tr_cv05 )
    115       IF(id_prec>0) CALL histwrite_phy( o_d_tr_trsp01  , d_tr_trsp01 )
    116       IF(id_fine>0) CALL histwrite_phy( o_d_tr_trsp02  , d_tr_trsp02 )
    117       IF(id_coss>0) CALL histwrite_phy( o_d_tr_trsp03  , d_tr_trsp03 )
    118       IF(id_codu>0) CALL histwrite_phy( o_d_tr_trsp04  , d_tr_trsp04 )
    119       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_trsp05  , d_tr_trsp05 )
    120       IF(id_prec>0) CALL histwrite_phy( o_d_tr_sscav01 , d_tr_sscav01 )
    121       IF(id_fine>0) CALL histwrite_phy( o_d_tr_sscav02 , d_tr_sscav02 )
    122       IF(id_coss>0) CALL histwrite_phy( o_d_tr_sscav03 , d_tr_sscav03 )
    123       IF(id_codu>0) CALL histwrite_phy( o_d_tr_sscav04 , d_tr_sscav04 )
    124       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_sscav05 , d_tr_sscav05 )
    125       IF(id_prec>0) CALL histwrite_phy( o_d_tr_sat01   , d_tr_sat01 )
    126       IF(id_fine>0) CALL histwrite_phy( o_d_tr_sat02   , d_tr_sat02 )
    127       IF(id_coss>0) CALL histwrite_phy( o_d_tr_sat03   , d_tr_sat03 )
    128       IF(id_codu>0) CALL histwrite_phy( o_d_tr_sat04   , d_tr_sat04 )
    129       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_sat05   , d_tr_sat05 )
    130       IF(id_prec>0) CALL histwrite_phy( o_d_tr_uscav01 , d_tr_uscav01 )
    131       IF(id_fine>0) CALL histwrite_phy( o_d_tr_uscav02 , d_tr_uscav02 )
    132       IF(id_coss>0) CALL histwrite_phy( o_d_tr_uscav03 , d_tr_uscav03 )
    133       IF(id_codu>0) CALL histwrite_phy( o_d_tr_uscav04 , d_tr_uscav04 )
    134       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_uscav05 , d_tr_uscav05 )
    135       IF(id_prec>0) CALL histwrite_phy( o_d_tr_insc01 , d_tr_insc01 )
    136       IF(id_fine>0) CALL histwrite_phy( o_d_tr_insc02 , d_tr_insc02 )
    137       IF(id_coss>0) CALL histwrite_phy( o_d_tr_insc03 , d_tr_insc03 )
    138       IF(id_codu>0) CALL histwrite_phy( o_d_tr_insc04 , d_tr_insc04 )
    139       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_insc05 , d_tr_insc05 )
    140       IF(id_prec>0) CALL histwrite_phy( o_d_tr_bcscav01 , d_tr_bcscav01 )
    141       IF(id_fine>0) CALL histwrite_phy( o_d_tr_bcscav02 , d_tr_bcscav02 )
    142       IF(id_coss>0) CALL histwrite_phy( o_d_tr_bcscav03 , d_tr_bcscav03 )
    143       IF(id_codu>0) CALL histwrite_phy( o_d_tr_bcscav04 , d_tr_bcscav04 )
    144       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_bcscav05 , d_tr_bcscav05 )
    145       IF(id_prec>0) CALL histwrite_phy( o_d_tr_evapls01 , d_tr_evapls01 )
    146       IF(id_fine>0) CALL histwrite_phy( o_d_tr_evapls02 , d_tr_evapls02 )
    147       IF(id_coss>0) CALL histwrite_phy( o_d_tr_evapls03 , d_tr_evapls03 )
    148       IF(id_codu>0) CALL histwrite_phy( o_d_tr_evapls04 , d_tr_evapls04 )
    149       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_evapls05 , d_tr_evapls05 )
    150       IF(id_prec>0) CALL histwrite_phy( o_d_tr_ls01 , d_tr_ls01 )
    151       IF(id_fine>0) CALL histwrite_phy( o_d_tr_ls02 , d_tr_ls02 )
    152       IF(id_coss>0) CALL histwrite_phy( o_d_tr_ls03 , d_tr_ls03 )
    153       IF(id_codu>0) CALL histwrite_phy( o_d_tr_ls04 , d_tr_ls04 )
    154       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_ls05 , d_tr_ls05 )
    155 
    156       IF(id_prec>0) CALL histwrite_phy( o_d_tr_dyn01 , d_tr_dyn01 )
    157       IF(id_fine>0) CALL histwrite_phy( o_d_tr_dyn02 , d_tr_dyn02 )
    158       IF(id_coss>0) CALL histwrite_phy( o_d_tr_dyn03 , d_tr_dyn03 )
    159       IF(id_codu>0) CALL histwrite_phy( o_d_tr_dyn04 , d_tr_dyn04 )
    160       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_dyn05 , d_tr_dyn05 )
     70      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux01       , flux01 )
     71      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux02       , flux02 )
     72      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux03       , flux03 )
     73      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux04       , flux04 )
     74      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_flux05       , flux05 )
     75      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds01         , ds01 )
     76      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds02         , ds02 )
     77      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds03         , ds03 )
     78      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds04         , ds04 )
     79      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_ds05         , ds05 )
     80      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh01         , dh01 )
     81      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh02         , dh02 )
     82      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh03         , dh03 )
     83      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh04         , dh04 )
     84      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dh05         , dh05 )
     85      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv01    , dtrconv01 )
     86      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv02    , dtrconv02 )
     87      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv03    , dtrconv03 )
     88      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv04    , dtrconv04 )
     89      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtrconv05    , dtrconv05 )
     90      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm01     , dtherm01 )
     91      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm02     , dtherm02 )
     92      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm03     , dtherm03 )
     93      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm04     , dtherm04 )
     94      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dtherm05     , dtherm05 )
     95      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv01     , dhkecv01 )
     96      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv02     , dhkecv02 )
     97      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv03     , dhkecv03 )
     98      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv04     , dhkecv04 )
     99      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkecv05     , dhkecv05 )
     100      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds01     , d_tr_ds01 )
     101      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds02     , d_tr_ds02 )
     102      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds03     , d_tr_ds03 )
     103      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds04     , d_tr_ds04 )
     104      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ds05     , d_tr_ds05 )
     105      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc01    , dhkelsc01 )
     106      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc02    , dhkelsc02 )
     107      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc03    , dhkelsc03 )
     108      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc04    , dhkelsc04 )
     109      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_dhkelsc05    , dhkelsc05 )
     110      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv01    , d_tr_cv01 )
     111      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv02    , d_tr_cv02 )
     112      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv03    , d_tr_cv03 )
     113      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv04    , d_tr_cv04 )
     114      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cv05    , d_tr_cv05 )
     115      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp01  , d_tr_trsp01 )
     116      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp02  , d_tr_trsp02 )
     117      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp03  , d_tr_trsp03 )
     118      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp04  , d_tr_trsp04 )
     119      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_trsp05  , d_tr_trsp05 )
     120      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav01 , d_tr_sscav01 )
     121      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav02 , d_tr_sscav02 )
     122      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav03 , d_tr_sscav03 )
     123      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav04 , d_tr_sscav04 )
     124      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sscav05 , d_tr_sscav05 )
     125      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat01   , d_tr_sat01 )
     126      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat02   , d_tr_sat02 )
     127      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat03   , d_tr_sat03 )
     128      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat04   , d_tr_sat04 )
     129      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_sat05   , d_tr_sat05 )
     130      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav01 , d_tr_uscav01 )
     131      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav02 , d_tr_uscav02 )
     132      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav03 , d_tr_uscav03 )
     133      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav04 , d_tr_uscav04 )
     134      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_uscav05 , d_tr_uscav05 )
     135      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc01 , d_tr_insc01 )
     136      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc02 , d_tr_insc02 )
     137      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc03 , d_tr_insc03 )
     138      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc04 , d_tr_insc04 )
     139      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_insc05 , d_tr_insc05 )
     140      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav01 , d_tr_bcscav01 )
     141      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav02 , d_tr_bcscav02 )
     142      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav03 , d_tr_bcscav03 )
     143      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav04 , d_tr_bcscav04 )
     144      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_bcscav05 , d_tr_bcscav05 )
     145      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls01 , d_tr_evapls01 )
     146      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls02 , d_tr_evapls02 )
     147      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls03 , d_tr_evapls03 )
     148      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls04 , d_tr_evapls04 )
     149      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_evapls05 , d_tr_evapls05 )
     150      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls01 , d_tr_ls01 )
     151      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls02 , d_tr_ls02 )
     152      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls03 , d_tr_ls03 )
     153      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls04 , d_tr_ls04 )
     154      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_ls05 , d_tr_ls05 )
     155
     156      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn01 , d_tr_dyn01 )
     157      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn02 , d_tr_dyn02 )
     158      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn03 , d_tr_dyn03 )
     159      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn04 , d_tr_dyn04 )
     160      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_dyn05 , d_tr_dyn05 )
    161161     
    162       IF(id_prec>0) CALL histwrite_phy( o_d_tr_cl01 , d_tr_cl01 )
    163       IF(id_fine>0) CALL histwrite_phy( o_d_tr_cl02 , d_tr_cl02 )
    164       IF(id_coss>0) CALL histwrite_phy( o_d_tr_cl03 , d_tr_cl03 )
    165       IF(id_codu>0) CALL histwrite_phy( o_d_tr_cl04 , d_tr_cl04 )
    166       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_cl05 , d_tr_cl05 )
    167       IF(id_prec>0) CALL histwrite_phy( o_d_tr_th01 , d_tr_th01 )
    168       IF(id_fine>0) CALL histwrite_phy( o_d_tr_th02 , d_tr_th02 )
    169       IF(id_coss>0) CALL histwrite_phy( o_d_tr_th03 , d_tr_th03 )
    170       IF(id_codu>0) CALL histwrite_phy( o_d_tr_th04 , d_tr_th04 )
    171       IF(id_scdu>0) CALL histwrite_phy( o_d_tr_th05 , d_tr_th05 )
    172 
    173       IF(id_coss>0) CALL histwrite_phy( o_sed_ss , sed_ss)
    174       IF(id_codu>0) CALL histwrite_phy( o_sed_dust , sed_dust)
    175       IF(id_scdu>0) CALL histwrite_phy( o_sed_dustsco , sed_dustsco)
    176       IF(id_prec>0) CALL histwrite_phy( o_g2p_gas , his_g2pgas )
    177       IF(id_fine>0) CALL histwrite_phy( o_g2p_aer , his_g2paer)
     162      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl01 , d_tr_cl01 )
     163      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl02 , d_tr_cl02 )
     164      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl03 , d_tr_cl03 )
     165      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl04 , d_tr_cl04 )
     166      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_cl05 , d_tr_cl05 )
     167      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th01 , d_tr_th01 )
     168      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th02 , d_tr_th02 )
     169      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th03 , d_tr_th03 )
     170      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th04 , d_tr_th04 )
     171      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_d_tr_th05 , d_tr_th05 )
     172
     173      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_ss , sed_ss)
     174      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dust , sed_dust)
     175      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dustsco , sed_dustsco)
     176      IF(id_prec>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_g2p_gas , his_g2pgas )
     177      IF(id_fine>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_g2p_aer , his_g2paer)
    178178
    179179!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    180       IF(id_coss>0) CALL histwrite_phy( o_sed_ss3D , sed_ss3D)
    181       IF(id_codu>0) CALL histwrite_phy( o_sed_dust3D , sed_dust3D)
    182       IF(id_scdu>0) CALL histwrite_phy( o_sed_dustsco3D , sed_dustsco3D)
     180      IF(id_coss>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_ss3D , sed_ss3D)
     181      IF(id_codu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dust3D , sed_dust3D)
     182      IF(id_scdu>0 .OR. .NOT. vars_defined) CALL histwrite_phy( o_sed_dustsco3D , sed_dustsco3D)
    183183!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    184184! histrac_spl
  • LMDZ6/branches/Ocean_skin/libf/phylmd/Dust/splaeropt_6bands_rrtm.F90

    r2753 r3798  
    99  USE aero_mod
    1010  USE infotrac_phy
    11   USE phys_local_var_mod, ONLY: absvisaer
     11  USE phys_local_var_mod, ONLY: abs550aer
    1212
    1313  ! Olivier Boucher Jan 2017
     
    260260!--waveband 2 and all aerosol (third index = 2)
    261261  inu=2
    262   absvisaer(:)=SUM((1-piz_allaer(:,:,2,inu))*tau_allaer(:,:,2,inu),dim=2)
     262  abs550aer(:)=SUM((1-piz_allaer(:,:,2,inu))*tau_allaer(:,:,2,inu),dim=2)
    263263
    264264END SUBROUTINE SPLAEROPT_6BANDS_RRTM
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/aer_sedimnt.F90

    r3605 r3798  
    1919  USE phys_local_var_mod, ONLY: mdw, budg_sed_part, DENSO4, f_r_wet, vsed_aer
    2020  USE dimphy, ONLY : klon,klev
    21   USE infotrac
     21  USE infotrac_phy
    2222  USE aerophys
    2323  USE YOMCST
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/calcaerosolstrato_rrtm.F90

    r3605 r3798  
    44SUBROUTINE calcaerosolstrato_rrtm(pplay,t_seri,paprs,debut)
    55
    6   USE infotrac, ONLY : nbtr
    76  USE phys_state_var_mod, ONLY: tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm, tau_aero_lw_rrtm
    87  USE phys_local_var_mod, ONLY: mdw, tausum_aero, tausum_strat, tau_strat_550, tau_strat_1020, stratomask
     
    118117    zdz=(paprs(i,k)-paprs(i,k+1))/zrho/RG     !thickness of layer in m
    119118    tau_strat_550(i,k)=tau_strat_wave(i,k,2)/zdz
    120     tau_strat_1020(i,k)=tau_strat_wave(i,k,6)/zdz
     119    tau_strat_1020(i,k)=tau_strat_wave(i,k,5)/zdz
    121120  ENDDO
    122121  ENDDO
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/coagulate.F90

    r3605 r3798  
    2525  USE dimphy, ONLY : klon,klev
    2626  USE aerophys
    27   USE infotrac
     27  USE infotrac_phy
    2828  USE phys_local_var_mod, ONLY: DENSO4, f_r_wet
    2929  USE YOMCST
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/cond_evap_tstep_mod.F90

    r3605 r3798  
    2020
    2121      USE aerophys
    22       USE infotrac
     22      USE infotrac_phy
    2323      USE YOMCST, ONLY : RPI
    2424
     
    141141
    142142      USE aerophys
    143       USE infotrac
     143      USE infotrac_phy
    144144      USE YOMCST, ONLY : RPI
    145145
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/interp_sulf_input.F90

    r3605 r3798  
    1616  USE dimphy
    1717  USE phys_cal_mod
    18   USE infotrac
     18  USE infotrac_phy
    1919  USE aerophys
    2020  USE YOMCST
     
    3434  INTEGER n_lon   ! number of longitudes in the input data
    3535  INTEGER, SAVE :: n_lev   ! number of levels in the input data
     36!$OMP THREADPRIVATE(n_lev)
    3637  INTEGER n_mth   ! number of months in the input data
    3738  INTEGER, SAVE :: mth_pre
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/micphy_tstep.F90

    r3605 r3798  
    77  USE dimphy, ONLY : klon,klev
    88  USE aerophys
    9   USE infotrac
     9  USE infotrac_phy
    1010  USE phys_local_var_mod, ONLY: mdw, budg_3D_nucl, budg_3D_cond_evap, budg_h2so4_to_part, R2SO4, DENSO4, f_r_wet
    1111  USE nucleation_tstep_mod
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/miecalc_aer.F90

    r3605 r3798  
    1 !
    2 ! $Id$
    3 !
    41SUBROUTINE MIECALC_AER(tau_strat, piz_strat, cg_strat, tau_strat_wave, tau_lw_abs_rrtm, paprs, debut)
    52
     
    2118  USE aerophys
    2219  USE aero_mod
    23   USE infotrac, ONLY : nbtr, nbtr_bin, nbtr_sulgas, id_SO2_strat
     20  USE infotrac_phy, ONLY : nbtr, nbtr_bin, nbtr_sulgas, id_SO2_strat
    2421  USE dimphy
    2522  USE YOMCST  , ONLY : RG, RPI
     
    157154  REAL ss_g(nbands_sw_rrtm+nbands_lw_rrtm+nwave_sw+nwave_lw)
    158155
     156  !-- fichier h2so4_0.75_300.00_hummel_1988_p_q.dat
     157  ! -- wavenumber (cm-1), wavelength (um), n_r, n_i
    159158  INTEGER, PARAMETER :: nb_lambda_h2so4=62
    160159  REAL, DIMENSION (nb_lambda_h2so4,4) :: ref_ind
    161   !-- fichier h2so4_0.75_300.00_hummel_1988_p_q.dat
    162   ! -- wavenumber (cm-1), wavelength (um), n_r, n_i
    163   DATA ref_ind /                                &
    164    200.000,   50.0000,   2.01000,   6.5000E-01, &
    165    250.000,   40.0000,   1.94000,   6.3000E-01, &
    166    285.714,   35.0000,   1.72000,   5.2000E-01, &
    167    333.333,   30.0000,   1.73000,   2.9000E-01, &
    168    358.423,   27.9000,   1.78000,   2.5000E-01, &
    169    400.000,   25.0000,   1.84000,   2.4000E-01, &
    170    444.444,   22.5000,   1.82000,   2.9000E-01, &
    171    469.484,   21.3000,   1.79000,   2.5000E-01, &
    172    500.000,   20.0000,   1.81000,   2.3000E-01, &
    173    540.541,   18.5000,   1.92700,   3.0200E-01, &
    174    555.556,   18.0000,   1.95000,   4.1000E-01, &
    175    581.395,   17.2000,   1.72400,   5.9000E-01, &
    176    609.756,   16.4000,   1.52000,   4.1400E-01, &
    177    666.667,   15.0000,   1.59000,   2.1100E-01, &
    178    675.676,   14.8000,   1.61000,   2.0500E-01, &
    179    714.286,   14.0000,   1.64000,   1.9500E-01, &
    180    769.231,   13.0000,   1.69000,   1.9500E-01, &
    181    800.000,   12.5000,   1.74000,   1.9800E-01, &
    182    869.565,   11.5000,   1.89000,   3.7400E-01, &
    183    909.091,   11.0000,   1.67000,   4.8500E-01, &
    184    944.198,   10.5910,   1.72000,   3.4000E-01, &
    185   1000.000,   10.0000,   1.89000,   4.5500E-01, &
    186   1020.408,    9.8000,   1.91000,   6.8000E-01, &
    187   1052.632,    9.5000,   1.67000,   7.5000E-01, &
    188   1086.957,    9.2000,   1.60000,   5.8600E-01, &
    189   1111.111,    9.0000,   1.65000,   6.3300E-01, &
    190   1149.425,    8.7000,   1.53000,   7.7200E-01, &
    191   1176.471,    8.5000,   1.37000,   7.5500E-01, &
    192   1219.512,    8.2000,   1.20000,   6.4500E-01, &
    193   1265.823,    7.9000,   1.14000,   4.8800E-01, &
    194   1388.889,    7.2000,   1.21000,   1.7600E-01, &
    195   1538.462,    6.5000,   1.37000,   1.2800E-01, &
    196   1612.903,    6.2000,   1.42400,   1.6500E-01, &
    197   1666.667,    6.0000,   1.42500,   1.9500E-01, &
    198   1818.182,    5.5000,   1.33700,   1.8300E-01, &
    199   2000.000,    5.0000,   1.36000,   1.2100E-01, &
    200   2222.222,    4.5000,   1.38500,   1.2000E-01, &
    201   2500.000,    4.0000,   1.39800,   1.2600E-01, &
    202   2666.667,    3.7500,   1.39600,   1.3100E-01, &
    203   2857.143,    3.5000,   1.37600,   1.5800E-01, &
    204   2948.113,    3.3920,   1.35200,   1.5900E-01, &
    205   3125.000,    3.2000,   1.31100,   1.3500E-01, &
    206   3333.333,    3.0000,   1.29300,   9.5500E-02, &
    207   3703.704,    2.7000,   1.30300,   5.7000E-03, &
    208   4000.000,    2.5000,   1.34400,   3.7600E-03, &
    209   4444.444,    2.2500,   1.37000,   1.8000E-03, &
    210   5000.000,    2.0000,   1.38400,   1.2600E-03, &
    211   5555.556,    1.8000,   1.39000,   5.5000E-04, &
    212   6510.417,    1.5360,   1.40300,   1.3700E-04, &
    213   7692.308,    1.3000,   1.41000,   1.0000E-05, &
    214   9433.962,    1.0600,   1.42000,   1.5000E-06, &
    215  11627.907,    0.8600,   1.42500,   1.7900E-07, &
    216  14409.222,    0.6940,   1.42800,   1.9900E-08, &
    217  15797.788,    0.6330,   1.42900,   1.4700E-08, &
    218  18181.818,    0.5500,   1.43000,   1.0000E-08, &
    219  19417.476,    0.5150,   1.43100,   1.0000E-08, &
    220  20491.803,    0.4880,   1.43200,   1.0000E-08, &
    221  25000.000,    0.4000,   1.44000,   1.0000E-08, &
    222  29673.591,    0.3370,   1.45900,   1.0000E-08, &
    223  33333.333,    0.3000,   1.46900,   1.0000E-08, &
    224  40000.000,    0.2500,   1.48400,   1.0000E-08, &
    225  50000.000,    0.2000,   1.49800,   1.0000E-08 /
     160
    226161!---------------------------------------------------------
    227162
    228163  IF (debut) THEN   
    229164
     165     ref_ind = RESHAPE( (/ &
     166      200.000,   50.0000,   2.01000,   6.5000E-01, &
     167      250.000,   40.0000,   1.94000,   6.3000E-01, &
     168      285.714,   35.0000,   1.72000,   5.2000E-01, &
     169      333.333,   30.0000,   1.73000,   2.9000E-01, &
     170      358.423,   27.9000,   1.78000,   2.5000E-01, &
     171      400.000,   25.0000,   1.84000,   2.4000E-01, &
     172      444.444,   22.5000,   1.82000,   2.9000E-01, &
     173      469.484,   21.3000,   1.79000,   2.5000E-01, &
     174      500.000,   20.0000,   1.81000,   2.3000E-01, &
     175      540.541,   18.5000,   1.92700,   3.0200E-01, &
     176      555.556,   18.0000,   1.95000,   4.1000E-01, &
     177      581.395,   17.2000,   1.72400,   5.9000E-01, &
     178      609.756,   16.4000,   1.52000,   4.1400E-01, &
     179      666.667,   15.0000,   1.59000,   2.1100E-01, &
     180      675.676,   14.8000,   1.61000,   2.0500E-01, &
     181      714.286,   14.0000,   1.64000,   1.9500E-01, &
     182      769.231,   13.0000,   1.69000,   1.9500E-01, &
     183      800.000,   12.5000,   1.74000,   1.9800E-01, &
     184      869.565,   11.5000,   1.89000,   3.7400E-01, &
     185      909.091,   11.0000,   1.67000,   4.8500E-01, &
     186      944.198,   10.5910,   1.72000,   3.4000E-01, &
     187     1000.000,   10.0000,   1.89000,   4.5500E-01, &
     188     1020.408,    9.8000,   1.91000,   6.8000E-01, &
     189     1052.632,    9.5000,   1.67000,   7.5000E-01, &
     190     1086.957,    9.2000,   1.60000,   5.8600E-01, &
     191     1111.111,    9.0000,   1.65000,   6.3300E-01, &
     192     1149.425,    8.7000,   1.53000,   7.7200E-01, &
     193     1176.471,    8.5000,   1.37000,   7.5500E-01, &
     194     1219.512,    8.2000,   1.20000,   6.4500E-01, &
     195     1265.823,    7.9000,   1.14000,   4.8800E-01, &
     196     1388.889,    7.2000,   1.21000,   1.7600E-01, &
     197     1538.462,    6.5000,   1.37000,   1.2800E-01, &
     198     1612.903,    6.2000,   1.42400,   1.6500E-01, &
     199     1666.667,    6.0000,   1.42500,   1.9500E-01, &
     200     1818.182,    5.5000,   1.33700,   1.8300E-01, &
     201     2000.000,    5.0000,   1.36000,   1.2100E-01, &
     202     2222.222,    4.5000,   1.38500,   1.2000E-01, &
     203     2500.000,    4.0000,   1.39800,   1.2600E-01, &
     204     2666.667,    3.7500,   1.39600,   1.3100E-01, &
     205     2857.143,    3.5000,   1.37600,   1.5800E-01, &
     206     2948.113,    3.3920,   1.35200,   1.5900E-01, &
     207     3125.000,    3.2000,   1.31100,   1.3500E-01, &
     208     3333.333,    3.0000,   1.29300,   9.5500E-02, &
     209     3703.704,    2.7000,   1.30300,   5.7000E-03, &
     210     4000.000,    2.5000,   1.34400,   3.7600E-03, &
     211     4444.444,    2.2500,   1.37000,   1.8000E-03, &
     212     5000.000,    2.0000,   1.38400,   1.2600E-03, &
     213     5555.556,    1.8000,   1.39000,   5.5000E-04, &
     214     6510.417,    1.5360,   1.40300,   1.3700E-04, &
     215     7692.308,    1.3000,   1.41000,   1.0000E-05, &
     216     9433.962,    1.0600,   1.42000,   1.5000E-06, &
     217    11627.907,    0.8600,   1.42500,   1.7900E-07, &
     218    14409.222,    0.6940,   1.42800,   1.9900E-08, &
     219    15797.788,    0.6330,   1.42900,   1.4700E-08, &
     220    18181.818,    0.5500,   1.43000,   1.0000E-08, &
     221    19417.476,    0.5150,   1.43100,   1.0000E-08, &
     222    20491.803,    0.4880,   1.43200,   1.0000E-08, &
     223    25000.000,    0.4000,   1.44000,   1.0000E-08, &
     224    29673.591,    0.3370,   1.45900,   1.0000E-08, &
     225    33333.333,    0.3000,   1.46900,   1.0000E-08, &
     226    40000.000,    0.2500,   1.48400,   1.0000E-08, &
     227    50000.000,    0.2000,   1.49800,   1.0000E-08 /), (/nb_lambda_h2so4,4/), order=(/2,1/) )
     228
    230229  !--initialising dry diameters to geometrically spaced mass/volume (see Jacobson 1994)
    231       mdw(1)=mdwmin
    232       IF (V_rat.LT.1.62) THEN ! compensate for dip in second bin for lower volume ratio
    233         mdw(2)=mdw(1)*2.**(1./3.)
    234         DO it=3, nbtr_bin
    235           mdw(it)=mdw(it-1)*V_rat**(1./3.)
    236         ENDDO
    237       ELSE
    238         DO it=2, nbtr_bin
    239           mdw(it)=mdw(it-1)*V_rat**(1./3.)
    240         ENDDO
    241       ENDIF
    242       PRINT *,'init mdw=', mdw
     230    mdw(1)=mdwmin
     231    IF (V_rat.LT.1.62) THEN ! compensate for dip in second bin for lower volume ratio
     232      mdw(2)=mdw(1)*2.**(1./3.)
     233      DO it=3, nbtr_bin
     234        mdw(it)=mdw(it-1)*V_rat**(1./3.)
     235      ENDDO
     236    ELSE
     237      DO it=2, nbtr_bin
     238        mdw(it)=mdw(it-1)*V_rat**(1./3.)
     239      ENDDO
     240    ENDIF
     241    WRITE(lunout,*) 'init mdw=', mdw
    243242
    244243    !--compute particle radius for a composition of 75% H2SO4 / 25% H2O at T=293K
     
    286285
    287286      IF (refr_ind_interpol) THEN
    288 
     287 
    289288        ilambda_max=ref_ind(1,2)/1.e6 !--in m
    290289        ilambda_min=ref_ind(nb_lambda_h2so4,2)/1.e6 !--in m
     
    381380        Nmax=INT(x+4*x**(1./3.)+2.)+1
    382381      ELSE
    383         PRINT *, 'x out of bound, x=', x
     382        WRITE(lunout,*) 'x out of bound, x=', x
    384383        STOP
    385384      ENDIF
     
    461460      omegatot=omegatot+r**2*Q_ext*omega*number
    462461      gtot    =gtot+r**2*Q_sca*g*number
    463 
     462 
    464463      ENDDO   !---bin
     464
    465465    !------------------------------------------------------------------
    466466
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/nucleation_tstep_mod.F90

    r3605 r3798  
    99
    1010  USE aerophys
    11   USE infotrac
     11  USE infotrac_phy
    1212  USE YOMCST, ONLY : RPI, RD, RMD, RKBOL, RNAVO
    1313
     
    7373
    7474  USE aerophys
    75   USE infotrac
     75  USE infotrac_phy
    7676
    7777  IMPLICIT NONE
     
    206206       & + 0.0000504021689382576*t*LOG(rhoa)
    207207
    208   jnuc= 0.1430901615568665 + 2.219563673425199*t - 0.02739106114964264*t**2 +  &
    209        &  0.00007228107239317088*t**3 + 5.91822263375044/x +                   &
     208  jnuc= 0.1430901615568665 + 2.219563673425199*t - 0.02739106114964264*t**2 + &
     209       &  0.00007228107239317088*t**3 + 5.91822263375044/x +                  &
    210210       &  0.1174886643003278*LOG(rh) + 0.4625315047693772*t*LOG(rh) -          &
    211        &  0.01180591129059253*t**2*LOG(rh) +                                   &
     211       &  0.01180591129059253*t**2*LOG(rh) +                                  &
    212212       &  0.0000404196487152575*t**3*LOG(rh) + (15.79628615047088*LOG(rh))/x - &
    213        &  0.215553951893509*LOG(rh)**2 - 0.0810269192332194*t*LOG(rh)**2 +     &
     213       &  0.215553951893509*LOG(rh)**2 - 0.0810269192332194*t*LOG(rh)**2 +    &
    214214       &  0.001435808434184642*t**2*LOG(rh)**2 -                               &
    215215       &  4.775796947178588E-6*t**3*LOG(rh)**2 -                               &
    216        &  (2.912974063702185*LOG(rh)**2)/x - 3.588557942822751*LOG(rh)**3 +    &
     216       &  (2.912974063702185*LOG(rh)**2)/x - 3.588557942822751*LOG(rh)**3 +   &
    217217       &  0.04950795302831703*t*LOG(rh)**3 -                                   &
    218        &  0.0002138195118737068*t**2*LOG(rh)**3 +                              &
     218       &  0.0002138195118737068*t**2*LOG(rh)**3 +                             &
    219219       &  3.108005107949533E-7*t**3*LOG(rh)**3 -                               &
    220        &  (0.02933332747098296*LOG(rh)**3)/x +                                 &
     220       &  (0.02933332747098296*LOG(rh)**3)/x +                                &
    221221       &  1.145983818561277*LOG(rhoa) -                                        &
    222        &  0.6007956227856778*t*LOG(rhoa) +                                     &
     222       &  0.6007956227856778*t*LOG(rhoa) +                                    &
    223223       &  0.00864244733283759*t**2*LOG(rhoa) -                                 &
    224224       &  0.00002289467254710888*t**3*LOG(rhoa) -                              &
    225        &  (8.44984513869014*LOG(rhoa))/x +                                     &
    226        &  2.158548369286559*LOG(rh)*LOG(rhoa) +                                &
     225       &  (8.44984513869014*LOG(rhoa))/x +                                    &
     226       &  2.158548369286559*LOG(rh)*LOG(rhoa) +                               &
    227227       &  0.0808121412840917*t*LOG(rh)*LOG(rhoa) -                             &
    228228       &  0.0004073815255395214*t**2*LOG(rh)*LOG(rhoa) -                       &
    229        &  4.019572560156515E-7*t**3*LOG(rh)*LOG(rhoa) +                        &
    230        &  (0.7213255852557236*LOG(rh)*LOG(rhoa))/x +                           &
     229       &  4.019572560156515E-7*t**3*LOG(rh)*LOG(rhoa) +                       &
     230       &  (0.7213255852557236*LOG(rh)*LOG(rhoa))/x +                          &
    231231       &  1.62409850488771*LOG(rh)**2*LOG(rhoa) -                              &
    232        &  0.01601062035325362*t*LOG(rh)**2*LOG(rhoa) +                         &
    233        &  0.00003771238979714162*t**2*LOG(rh)**2*LOG(rhoa) +                   &
     232       &  0.01601062035325362*t*LOG(rh)**2*LOG(rhoa) +                        &
     233       &  0.00003771238979714162*t**2*LOG(rh)**2*LOG(rhoa) +                  &
    234234       &  3.217942606371182E-8*t**3*LOG(rh)**2*LOG(rhoa) -                     &
    235        &  (0.01132550810022116*LOG(rh)**2*LOG(rhoa))/x +                       &
     235       &  (0.01132550810022116*LOG(rh)**2*LOG(rhoa))/x +                      &
    236236       &  9.71681713056504*LOG(rhoa)**2 -                                      &
    237        &  0.1150478558347306*t*LOG(rhoa)**2 +                                  &
    238        &  0.0001570982486038294*t**2*LOG(rhoa)**2 +                            &
    239        &  4.009144680125015E-7*t**3*LOG(rhoa)**2 +                             &
     237       &  0.1150478558347306*t*LOG(rhoa)**2 +                                 &
     238       &  0.0001570982486038294*t**2*LOG(rhoa)**2 +                           &
     239       &  4.009144680125015E-7*t**3*LOG(rhoa)**2 +                            &
    240240       &  (0.7118597859976135*LOG(rhoa)**2)/x -                                &
    241        &  1.056105824379897*LOG(rh)*LOG(rhoa)**2 +                             &
     241       &  1.056105824379897*LOG(rh)*LOG(rhoa)**2 +                            &
    242242       &  0.00903377584628419*t*LOG(rh)*LOG(rhoa)**2 -                         &
    243        &  0.00001984167387090606*t**2*LOG(rh)*LOG(rhoa)**2 +                   &
     243       &  0.00001984167387090606*t**2*LOG(rh)*LOG(rhoa)**2 +                  &
    244244       &  2.460478196482179E-8*t**3*LOG(rh)*LOG(rhoa)**2 -                     &
    245245       &  (0.05790872906645181*LOG(rh)*LOG(rhoa)**2)/x -                       &
    246        &  0.1487119673397459*LOG(rhoa)**3 +                                    &
     246       &  0.1487119673397459*LOG(rhoa)**3 +                                   &
    247247       &  0.002835082097822667*t*LOG(rhoa)**3 -                                &
    248        &  9.24618825471694E-6*t**2*LOG(rhoa)**3 +                              &
     248       &  9.24618825471694E-6*t**2*LOG(rhoa)**3 +                             &
    249249       &  5.004267665960894E-9*t**3*LOG(rhoa)**3 -                             &
    250250       &  (0.01270805101481648*LOG(rhoa)**3)/x
     
    252252
    253253  ntot =-0.002954125078716302 - 0.0976834264241286*t + 0.001024847927067835*t**2 - 2.186459697726116E-6*t**3 -    &
    254        &   0.1017165718716887/x - 0.002050640345231486*LOG(rh) - 0.007585041382707174*t*LOG(rh) +                 &
     254       &   0.1017165718716887/x - 0.002050640345231486*LOG(rh) - 0.007585041382707174*t*LOG(rh) +                &
    255255       &   0.0001926539658089536*t**2*LOG(rh) - 6.70429719683894E-7*t**3*LOG(rh) -                                &
    256256       &   (0.2557744774673163*LOG(rh))/x + 0.003223076552477191*LOG(rh)**2 + 0.000852636632240633*t*LOG(rh)**2 - &
    257        &   0.00001547571354871789*t**2*LOG(rh)**2 + 5.666608424980593E-8*t**3*LOG(rh)**2 +                        &
     257       &   0.00001547571354871789*t**2*LOG(rh)**2 + 5.666608424980593E-8*t**3*LOG(rh)**2 +                       &
    258258       &   (0.03384437400744206*LOG(rh)**2)/x + 0.04743226764572505*LOG(rh)**3 -                                  &
    259259       &   0.0006251042204583412*t*LOG(rh)**3 + 2.650663328519478E-6*t**2*LOG(rh)**3 -                            &
    260260       &   3.674710848763778E-9*t**3*LOG(rh)**3 - (0.0002672510825259393*LOG(rh)**3)/x -                          &
    261261       &   0.01252108546759328*LOG(rhoa) + 0.005806550506277202*t*LOG(rhoa) -                                     &
    262        &   0.0001016735312443444*t**2*LOG(rhoa) + 2.881946187214505E-7*t**3*LOG(rhoa) +                           &
     262       &   0.0001016735312443444*t**2*LOG(rhoa) + 2.881946187214505E-7*t**3*LOG(rhoa) +                          &
    263263       &   (0.0942243379396279*LOG(rhoa))/x - 0.0385459592773097*LOG(rh)*LOG(rhoa) -                              &
    264        &   0.0006723156277391984*t*LOG(rh)*LOG(rhoa) + 2.602884877659698E-6*t**2*LOG(rh)*LOG(rhoa) +              &
     264       &   0.0006723156277391984*t*LOG(rh)*LOG(rhoa) + 2.602884877659698E-6*t**2*LOG(rh)*LOG(rhoa) +             &
    265265       &   1.194163699688297E-8*t**3*LOG(rh)*LOG(rhoa) - (0.00851515345806281*LOG(rh)*LOG(rhoa))/x -              &
    266266       &   0.01837488495738111*LOG(rh)**2*LOG(rhoa) + 0.0001720723574407498*t*LOG(rh)**2*LOG(rhoa) -              &
    267267       &   3.717657974086814E-7*t**2*LOG(rh)**2*LOG(rhoa) -                                                       &
    268        &   5.148746022615196E-10*t**3*LOG(rh)**2*LOG(rhoa) +                                                      &
    269        &   (0.0002686602132926594*LOG(rh)**2*LOG(rhoa))/x - 0.06199739728812199*LOG(rhoa)**2 +                    &
     268       &   5.148746022615196E-10*t**3*LOG(rh)**2*LOG(rhoa) +                                                     &
     269       &   (0.0002686602132926594*LOG(rh)**2*LOG(rhoa))/x - 0.06199739728812199*LOG(rhoa)**2 +                   &
    270270       &   0.000906958053583576*t*LOG(rhoa)**2 - 9.11727926129757E-7*t**2*LOG(rhoa)**2 -                          &
    271        &   5.367963396508457E-9*t**3*LOG(rhoa)**2 - (0.007742343393937707*LOG(rhoa)**2)/x +                       &
    272        &   0.0121827103101659*LOG(rh)*LOG(rhoa)**2 - 0.0001066499571188091*t*LOG(rh)*LOG(rhoa)**2 +               &
     271       &   5.367963396508457E-9*t**3*LOG(rhoa)**2 - (0.007742343393937707*LOG(rhoa)**2)/x +                      &
     272       &   0.0121827103101659*LOG(rh)*LOG(rhoa)**2 - 0.0001066499571188091*t*LOG(rh)*LOG(rhoa)**2 +              &
    273273       &   2.534598655067518E-7*t**2*LOG(rh)*LOG(rhoa)**2 -                                                       &
    274        &   3.635186504599571E-10*t**3*LOG(rh)*LOG(rhoa)**2 +                                                      &
     274       &   3.635186504599571E-10*t**3*LOG(rh)*LOG(rhoa)**2 +                                                     &
    275275       &   (0.0006100650851863252*LOG(rh)*LOG(rhoa)**2)/x + 0.0003201836700403512*LOG(rhoa)**3 -                  &
    276276       &   0.0000174761713262546*t*LOG(rhoa)**3 + 6.065037668052182E-8*t**2*LOG(rhoa)**3 -                        &
     
    527527     rc_n=0.3E-9
    528528  ELSE
    529      jnuc_n= 2.1361182605986115E-1 + 3.3827029855551838*tln -3.2423555796175563E-2*tln**2 +         &
    530           &  7.0120069477221989E-5*tln**3 +8.0286874752695141/x_n +                                 &
    531           &  -2.6939840579762231E-1*LOG(satratln) +1.6079879299099518*tln*LOG(satratln) +           &
    532           &  -1.9667486968141933E-2*tln**2*LOG(satratln) +                                          &
    533           &  5.5244755979770844E-5*tln**3*LOG(satratln) + (7.8884704837892468*LOG(satratln))/x_n +  &
    534           &  4.6374659198909596*LOG(satratln)**2 - 8.2002809894792153E-2*tln*LOG(satratln)**2 +     &
    535           &  8.5077424451172196E-4*tln**2*LOG(satratln)**2 +                                        &
    536           &  -2.6518510168987462E-6*tln**3*LOG(satratln)**2 +                                       &
    537           &  (-1.4625482500575278*LOG(satratln)**2)/x_n - 5.2413002989192037E-1*LOG(satratln)**3 +  &
    538           &  5.2755117653715865E-3*tln*LOG(satratln)**3 +                                           &
    539           &  -2.9491061332113830E-6*tln**2*LOG(satratln)**3 +                                       &
    540           &  -2.4815454194486752E-8*tln**3*LOG(satratln)**3 +                                       &
    541           &  (-5.2663760117394626E-2*LOG(satratln)**3)/x_n +                                        &
    542           &  1.6496664658266762*LOG(rhoaln) +                                                       &
    543           &  -8.0809397859218401E-1*tln*LOG(rhoaln) +                                               &
    544           &  8.9302927091946642E-3*tln**2*LOG(rhoaln) +                                             &
    545           &  -1.9583649496497497E-5*tln**3*LOG(rhoaln) +                                            &
    546           &  (-8.9505572676891685*LOG(rhoaln))/x_n +                                                &
    547           &  -3.0025283601622881E+1*LOG(satratln)*LOG(rhoaln) +                                     &
    548           &  3.0783365644763633E-1*tln*LOG(satratln)*LOG(rhoaln) +                                  &
    549           &  -7.4521756337984706E-4*tln**2*LOG(satratln)*LOG(rhoaln) +                              &
    550           &  -5.7651433870681853E-7*tln**3*LOG(satratln)*LOG(rhoaln) +                              &
    551           &  (1.2872868529673207*LOG(satratln)*LOG(rhoaln))/x_n +                                   &
    552           &  -6.1739867501526535E-1*LOG(satratln)**2*LOG(rhoaln) +                                  &
    553           &  7.2347385705333975E-3*tln*LOG(satratln)**2*LOG(rhoaln) +                               &
    554           &  -3.0640494530822439E-5*tln**2*LOG(satratln)**2*LOG(rhoaln) +                           &
    555           &  6.5944609194346214E-8*tln**3*LOG(satratln)**2*LOG(rhoaln) +                            &
    556           &  (-2.8681650332461055E-2*LOG(satratln)**2*LOG(rhoaln))/x_n +                            &
    557           &  6.5213802375160306*LOG(rhoaln)**2 +                                                    &
    558           &  -4.7907162004793016E-2*tln*LOG(rhoaln)**2 +                                            &
    559           &  -1.0727890114215117E-4*tln**2*LOG(rhoaln)**2 +                                         &
    560           &  5.6401818280534507E-7*tln**3*LOG(rhoaln)**2 +                                          &
    561           &  (5.4113070888923009E-1*LOG(rhoaln)**2)/x_n +                                           &
    562           &  5.2062808476476330E-1*LOG(satratln)*LOG(rhoaln)**2 +                                   &
    563           &  -6.0696882500824584E-3*tln*LOG(satratln)*LOG(rhoaln)**2 +                              &
    564           &  2.3851383302608477E-5*tln**2*LOG(satratln)*LOG(rhoaln)**2 +                            &
    565           &  -1.5243837103067096E-8*tln**3*LOG(satratln)*LOG(rhoaln)**2 +                           &
    566           &  (-5.6543192378015687E-2*LOG(satratln)*LOG(rhoaln)**2)/x_n +                            &
    567           &  -1.1630806410696815E-1*LOG(rhoaln)**3 +                                                &
    568           &  1.3806404273119610E-3*tln*LOG(rhoaln)**3 +                                             &
    569           &  -2.0199865087650833E-6*tln**2*LOG(rhoaln)**3 +                                         &
    570           &  -3.0200284885763192E-9*tln**3*LOG(rhoaln)**3 +                                         &
     529     jnuc_n= 2.1361182605986115E-1 + 3.3827029855551838*tln -3.2423555796175563E-2*tln**2 +        &
     530          &  7.0120069477221989E-5*tln**3 +8.0286874752695141/x_n +                                &
     531          &  (-2.6939840579762231E-1)*LOG(satratln) +1.6079879299099518*tln*LOG(satratln) +        &
     532          &  (-1.9667486968141933E-2)*tln**2*LOG(satratln) +                                       &
     533          &  5.5244755979770844E-5*tln**3*LOG(satratln) + (7.8884704837892468*LOG(satratln))/x_n + &
     534          &  4.6374659198909596*LOG(satratln)**2 - 8.2002809894792153E-2*tln*LOG(satratln)**2 +    &
     535          &  8.5077424451172196E-4*tln**2*LOG(satratln)**2 +                                       &
     536          &  (-2.6518510168987462E-6)*tln**3*LOG(satratln)**2 +                                    &
     537          &  (-1.4625482500575278*LOG(satratln)**2)/x_n - 5.2413002989192037E-1*LOG(satratln)**3 + &
     538          &  5.2755117653715865E-3*tln*LOG(satratln)**3 +                                          &
     539          &  (-2.9491061332113830E-6)*tln**2*LOG(satratln)**3 +                                    &
     540          &  (-2.4815454194486752E-8)*tln**3*LOG(satratln)**3 +                                    &
     541          &  (-5.2663760117394626E-2*LOG(satratln)**3)/x_n +                                       &
     542          &  1.6496664658266762*LOG(rhoaln) +                                                      &
     543          &  (-8.0809397859218401E-1)*tln*LOG(rhoaln) +                                            &
     544          &  8.9302927091946642E-3*tln**2*LOG(rhoaln) +                                            &
     545          &  (-1.9583649496497497E-5)*tln**3*LOG(rhoaln) +                                         &
     546          &  (-8.9505572676891685*LOG(rhoaln))/x_n +                                               &
     547          &  (-3.0025283601622881E+1)*LOG(satratln)*LOG(rhoaln) +                                  &
     548          &  3.0783365644763633E-1*tln*LOG(satratln)*LOG(rhoaln) +                                 &
     549          &  (-7.4521756337984706E-4)*tln**2*LOG(satratln)*LOG(rhoaln) +                           &
     550          &  (-5.7651433870681853E-7)*tln**3*LOG(satratln)*LOG(rhoaln) +                           &
     551          &  (1.2872868529673207*LOG(satratln)*LOG(rhoaln))/x_n +                                  &
     552          &  (-6.1739867501526535E-1)*LOG(satratln)**2*LOG(rhoaln) +                               &
     553          &  7.2347385705333975E-3*tln*LOG(satratln)**2*LOG(rhoaln) +                              &
     554          &  (-3.0640494530822439E-5)*tln**2*LOG(satratln)**2*LOG(rhoaln) +                        &
     555          &  6.5944609194346214E-8*tln**3*LOG(satratln)**2*LOG(rhoaln) +                           &
     556          &  (-2.8681650332461055E-2*LOG(satratln)**2*LOG(rhoaln))/x_n +                           &
     557          &  6.5213802375160306*LOG(rhoaln)**2 +                                                   &
     558          &  (-4.7907162004793016E-2)*tln*LOG(rhoaln)**2 +                                         &
     559          &  (-1.0727890114215117E-4)*tln**2*LOG(rhoaln)**2 +                                      &
     560          &  5.6401818280534507E-7*tln**3*LOG(rhoaln)**2 +                                         &
     561          &  (5.4113070888923009E-1*LOG(rhoaln)**2)/x_n +                                          &
     562          &  5.2062808476476330E-1*LOG(satratln)*LOG(rhoaln)**2 +                                  &
     563          &  (-6.0696882500824584E-3)*tln*LOG(satratln)*LOG(rhoaln)**2 +                           &
     564          &  2.3851383302608477E-5*tln**2*LOG(satratln)*LOG(rhoaln)**2 +                           &
     565          &  (-1.5243837103067096E-8)*tln**3*LOG(satratln)*LOG(rhoaln)**2 +                        &
     566          &  (-5.6543192378015687E-2*LOG(satratln)*LOG(rhoaln)**2)/x_n +                           &
     567          &  (-1.1630806410696815E-1)*LOG(rhoaln)**3 +                                             &
     568          &  1.3806404273119610E-3*tln*LOG(rhoaln)**3 +                                            &
     569          &  (-2.0199865087650833E-6)*tln**2*LOG(rhoaln)**3 +                                      &
     570          &  (-3.0200284885763192E-9)*tln**3*LOG(rhoaln)**3 +                                      &
    571571          &  (-6.9425267104126316E-3*LOG(rhoaln)**3)/x_n
    572572     jnuc_n=EXP(jnuc_n)
    573573     
    574      ntot_n =-3.5863435141979573E-3 - 1.0098670235841110E-1*tln + 8.9741268319259721E-4*tln**2 - 1.4855098605195757E-6*tln**3 &
    575           &   - 1.2080330016937095E-1/x_n + 1.1902674923928015E-3*LOG(satratln) - 1.9211358507172177E-2*tln*LOG(satratln) +   &
    576           &   2.4648094311204255E-4*tln**2*LOG(satratln) - 7.5641448594711666E-7*tln**3*LOG(satratln) +                       &
    577           &   (-2.0668639384228818E-02*LOG(satratln))/x_n - 3.7593072011595188E-2*LOG(satratln)**2 +                          &
    578           &   9.0993182774415718E-4 *tln*LOG(satratln)**2 +                                                                   &
    579           &   -9.5698412164297149E-6*tln**2*LOG(satratln)**2 + 3.7163166416110421E-8*tln**3*LOG(satratln)**2 +                &
    580           &   (1.1026579525210847E-2*LOG(satratln)**2)/x_n + 1.1530844115561925E-2 *LOG(satratln)**3 +                        &
    581           &   - 1.8083253906466668E-4 *tln*LOG(satratln)**3 + 8.0213604053330654E-7*tln**2*LOG(satratln)**3 +                 &
    582           &   -8.5797885383051337E-10*tln**3*LOG(satratln)**3 + (1.0243693899717402E-3*LOG(satratln)**3)/x_n +                &
    583           &   -1.7248695296299649E-2*LOG(rhoaln) + 1.1294004162437157E-2*tln*LOG(rhoaln) +                                    &
    584           &   -1.2283640163189278E-4*tln**2*LOG(rhoaln) + 2.7391732258259009E-7*tln**3*LOG(rhoaln) +                          &
    585           &   (6.8505583974029602E-2*LOG(rhoaln))/x_n +2.9750968179523635E-1*LOG(satratln)*LOG(rhoaln) +                      &
    586           &   -3.6681154503992296E-3 *tln*LOG(satratln)*LOG(rhoaln) + 1.0636473034653114E-5*tln**2*LOG(satratln)*LOG(rhoaln)+ &
    587           &   5.8687098466515866E-9*tln**3*LOG(satratln)*LOG(rhoaln) + (-5.2028866094191509E-3*LOG(satratln)*LOG(rhoaln))/x_n+&
    588           &   7.6971988880587231E-4*LOG(satratln)**2*LOG(rhoaln) - 2.4605575820433763E-5*tln*LOG(satratln)**2*LOG(rhoaln) +   &
    589           &   2.3818484400893008E-7*tln**2*LOG(satratln)**2*LOG(rhoaln) +                                                     &
    590           &   -8.8474102392445200E-10*tln**3*LOG(satratln)**2*LOG(rhoaln) +                                                   &
    591           &   (-1.6640566678168968E-4*LOG(satratln)**2*LOG(rhoaln))/x_n - 7.7390093776705471E-2*LOG(rhoaln)**2 +              &
    592           &   5.8220163188828482E-4*tln*LOG(rhoaln)**2 + 1.2291679321523287E-6*tln**2*LOG(rhoaln)**2 +                        &
    593           &   -7.4690997508075749E-9*tln**3*LOG(rhoaln)**2 + (-5.6357941220497648E-3*LOG(rhoaln)**2)/x_n +                    &
    594           &   -4.7170109625089768E-3*LOG(satratln)*LOG(rhoaln)**2 + 6.9828868534370193E-5*tln*LOG(satratln)*LOG(rhoaln)**2 + &
    595           &   -3.1738912157036403E-7*tln**2*LOG(satratln)*LOG(rhoaln)**2 +                                                    &
    596           &   2.3975538706787416E-10*tln**3*LOG(satratln)*LOG(rhoaln)**2 +                                                    &
    597           &   (4.2304213386288567E-4*LOG(satratln)*LOG(rhoaln)**2)/x_n + 1.3696520973423231E-3*LOG(rhoaln)**3 +               &
    598           &   -1.6863387574788199E-5*tln*LOG(rhoaln)**3 + 2.7959499278844516E-8*tln**2*LOG(rhoaln)**3 +                       &
     574     ntot_n =-3.5863435141979573E-3 - 1.0098670235841110E-1*tln + 8.9741268319259721E-4*tln**2 - 1.4855098605195757E-6*tln**3  &
     575          &   - 1.2080330016937095E-1/x_n + 1.1902674923928015E-3*LOG(satratln) - 1.9211358507172177E-2*tln*LOG(satratln) +    &
     576          &   2.4648094311204255E-4*tln**2*LOG(satratln) - 7.5641448594711666E-7*tln**3*LOG(satratln) +                        &
     577          &   (-2.0668639384228818E-02*LOG(satratln))/x_n - 3.7593072011595188E-2*LOG(satratln)**2 +                           &
     578          &   9.0993182774415718E-4 *tln*LOG(satratln)**2 +                                                                    &
     579          &   (-9.5698412164297149E-6)*tln**2*LOG(satratln)**2 + 3.7163166416110421E-8*tln**3*LOG(satratln)**2 +               &
     580          &   (1.1026579525210847E-2*LOG(satratln)**2)/x_n + 1.1530844115561925E-2 *LOG(satratln)**3 +                         &
     581          &   (-1.8083253906466668E-4)*tln*LOG(satratln)**3 + 8.0213604053330654E-7*tln**2*LOG(satratln)**3 +                  &
     582          &   (-8.5797885383051337E-10)*tln**3*LOG(satratln)**3 + (1.0243693899717402E-3*LOG(satratln)**3)/x_n +               &
     583          &   (-1.7248695296299649E-2)*LOG(rhoaln) + 1.1294004162437157E-2*tln*LOG(rhoaln) +                                   &
     584          &   (-1.2283640163189278E-4)*tln**2*LOG(rhoaln) + 2.7391732258259009E-7*tln**3*LOG(rhoaln) +                         &
     585          &   (6.8505583974029602E-2*LOG(rhoaln))/x_n +2.9750968179523635E-1*LOG(satratln)*LOG(rhoaln) +                       &
     586          &   (-3.6681154503992296E-3)*tln*LOG(satratln)*LOG(rhoaln) + 1.0636473034653114E-5*tln**2*LOG(satratln)*LOG(rhoaln)+ &
     587          &   5.8687098466515866E-9*tln**3*LOG(satratln)*LOG(rhoaln) + (-5.2028866094191509E-3*LOG(satratln)*LOG(rhoaln))/x_n+ &
     588          &   7.6971988880587231E-4*LOG(satratln)**2*LOG(rhoaln) - 2.4605575820433763E-5*tln*LOG(satratln)**2*LOG(rhoaln) +    &
     589          &   2.3818484400893008E-7*tln**2*LOG(satratln)**2*LOG(rhoaln) +                                                      &
     590          &   (-8.8474102392445200E-10)*tln**3*LOG(satratln)**2*LOG(rhoaln) +                                                  &
     591          &   (-1.6640566678168968E-4*LOG(satratln)**2*LOG(rhoaln))/x_n - 7.7390093776705471E-2*LOG(rhoaln)**2 +               &
     592          &   5.8220163188828482E-4*tln*LOG(rhoaln)**2 + 1.2291679321523287E-6*tln**2*LOG(rhoaln)**2 +                         &
     593          &   (-7.4690997508075749E-9)*tln**3*LOG(rhoaln)**2 + (-5.6357941220497648E-3*LOG(rhoaln)**2)/x_n +                   &
     594          &   (-4.7170109625089768E-3)*LOG(satratln)*LOG(rhoaln)**2 + 6.9828868534370193E-5*tln*LOG(satratln)*LOG(rhoaln)**2 + &
     595          &   (-3.1738912157036403E-7)*tln**2*LOG(satratln)*LOG(rhoaln)**2 +                                                   &
     596          &   2.3975538706787416E-10*tln**3*LOG(satratln)*LOG(rhoaln)**2 +                                                     &
     597          &   (4.2304213386288567E-4*LOG(satratln)*LOG(rhoaln)**2)/x_n + 1.3696520973423231E-3*LOG(rhoaln)**3 +                &
     598          &   (-1.6863387574788199E-5)*tln*LOG(rhoaln)**3 + 2.7959499278844516E-8*tln**2*LOG(rhoaln)**3 +                      &
    599599          &   3.9423927013227455E-11*tln**3*LOG(rhoaln)**3 + (8.6136359966337272E-5*LOG(rhoaln)**3)/x_n
    600600     ntot_n=EXP(ntot_n)
     
    634634
    635635  IF (tln .LT. 185. .AND. tln .GT. 155.) THEN
    636      rhoatres=1.1788859232398459E+5 - 1.0244255702550814E+4*satratln +   &
     636     rhoatres=1.1788859232398459E+5 - 1.0244255702550814E+4*satratln +  &
    637637          & 4.6815029684321962E+3*satratln**2 -1.6755952338499657E+2*tln
    638638  ENDIF
     
    672672        rc_i=0.487E-9
    673673     ELSE
    674         jnuc_i1 = 3.0108954259038608E+01+tli*6.1176722090512577E+01+(tli**2)*8.7240333618891663E-01+(tli**3)*                 &
    675              & -4.6191788649375719E-03+(tli**(-1))*8.3537059107024481E-01 +                                                   &
    676              & (1.5028549216690628E+01+tli*-1.9310989753720623E-01+(tli**2)*8.0155514634860480E-04+(tli**3)*                  &
    677              & -1.0832730707799128E-06+(tli**(-1))*1.7577660457989019)*(LOG(satratli)**(-2)) +                                &
    678              & (-2.0487870170216488E-01 +  tli * 1.3263949252910405E-03 +  (tli**2) * -8.4195688402450274E-06 +               &
    679              & (tli**3)*1.6154895940993287E-08 + (tli**(-1))*3.8734212545203874E+01) * (LOG(satratli)**(-2)*LOG(rhoali)) +    &
    680              & (1.4955918863858371 +  tli * 9.2290004245522454E+01 +  (tli**2) * -8.9006965195392618E-01 +                    &
    681              & (tli**3) * 2.2319123411013099E-03 + (tli**(-1)) * 4.0180079996840852E-03) *                                    &
    682              & (LOG(satratli)**(-1) * LOG(rhoali)**(-1)) +                                                                    &
    683              & (7.9018031228561085 +  tli * -1.1649433968658949E+01 + (tli**2) * 1.1400827854910951E-01 +                    &
    684              & (tli**3) * -3.1941526492127755E-04 + (tli**(-1)) * -3.7662115740271446E-01) * (LOG(satratli)**(-1)) +          &
    685              & (1.5725237111225979E+02 +  tli * -1.0051649979836277 + (tli**2) * 1.1866484014507624E-03 +                    &
    686              & (tli**3) * 7.3557614998540389E-06 + (tli**(-1)) * 2.6270197023115189) * (LOG(satratli)**(-1) * LOG(rhoali)) +  &
    687              & (-1.6973840122470968E+01 +  tli * 1.1258423691432135E-01 +  (tli**2) * -2.9850139351463793E-04 + (tli**3) *    &
    688              & 1.4301286324827064E-07 + (tli**(-1)) * 1.3163389235253725E+01) * (LOG(satratli)**(-1) * LOG(rhoali)**2) +      &
    689              & (-1.0399591631839757 +  tli * 2.7022055588257691E-03 +  (tli**2) * -2.1507467231330936E-06 + (tli**3) *        &
    690              & 3.8059489037584171E-10 + (tli**(-1)) * 1.5000492788553410E+02) * (LOG(satratli)**(-1) * LOG(rhoali)**3) +      &
    691              & (1.2250990965305315 +  tli * 3.0495946490079444E+01 +  (tli**2) * 2.1051563135187106E+01 + (tli**3) *          &
    692              & -8.2200682916580878E-02 + (tli**(-1)) * 2.9965871386685029E-02) * (LOG(rhoali)**(-2)) +                        &
    693              & (4.8281605955680433 +  tli * 1.7346551710836445E+02 +  (tli**2) * -1.0113602140796010E+01 + (tli**3) *         &
    694              & 3.7482518458685089E-02 + (tli**(-1)) * -1.4449998158558205E-01) * (LOG(rhoali)**(-1)) +                        &
    695              & (2.3399230964451237E+02 +  tli * -2.3099267235261948E+01 + (tli**2) * 8.0122962140916354E-02 +                &
    696              & (tli**3) * 6.1542576994557088E-05 + (tli**(-1)) * 5.3718413254843007) * (LOG(rhoali)) +                        &
    697              & (1.0299715519499360E+02 +  tli * -6.4663357203364136E-02 +  (tli**2) * -2.0487150565050316E-03 +               &
    698              & (tli**3) * 8.7935289055530897E-07 + (tli**(-1)) * 3.6013204601215229E+01) * (LOG(rhoali)**2) +                 &
    699              & (-3.5452115439584042 +  tli * 1.7083445731159330E-02 +  (tli**2) * -1.2552625290862626E-05 + (tli**3) *        &
    700              & 1.2968447449182847E-09 + (tli**(-1)) * 1.5748687512056560E+02) * (LOG(rhoali)**3) +                            &
    701              & (2.2338490119517975 +  tli * 1.0229410216045540E+02 +  (tli**2) * -3.2103611955174052 + (tli**3) *             &
    702              & 1.3397152304977591E-02 + (tli**(-1)) * -2.4155187776460030E-02) * (LOG(satratli)* LOG(rhoali)**(-2)) +         &
    703              & (3.7592282990713963 +  tli * -1.5257988769009816E+02 + (tli**2) * 2.6113805420558802 + (tli**3) *             &
    704              & -9.0380721653694363E-03 + (tli**(-1)) * -1.3974197138171082E-01) * (LOG(satratli)* LOG(rhoali)**(-1)) +        &
    705              & (1.8293600730573988E+01 +  tli * 1.8344728606002992E+01 +  (tli**2) * -4.0063363221106751E-01 + (tli**3)       &
    706              & * 1.4842749371258522E-03 + (tli**(-1)) * 1.1848846003282287) * (LOG(satratli)) +                               &
    707              & (-1.7634531623032314E+02 +  tli * 4.9011762441271278 +  (tli**2) * -1.3195821562746339E-02 + (tli**3) *        &
    708              & -2.8668619526430859E-05 + (tli**(-1)) * -2.9823396976393551E-01) * (LOG(satratli)* LOG(rhoali)) +              &
    709              & (-3.2944043694275727E+01 +  tli * 1.2517571921051887E-01 +  (tli**2) * 8.3239769771186714E-05 + (tli**3) *     &
    710              & 2.8191859341519507E-07 + (tli**(-1)) * -2.7352880736682319E+01) * (LOG(satratli)* LOG(rhoali)**2) +            &
    711              & (-1.1451811137553243 +  tli * 2.0625997485732494E-03 +  (tli**2) * -3.4225389469233624E-06 + (tli**3) *        &
    712              & 4.4437613496984567E-10 + (tli**(-1)) * 1.8666644332606754E+02) * (LOG(satratli)* LOG(rhoali)**3) +             &
    713              & (3.2270897099493567E+01 +  tli * 7.7898447327513687E-01 +  (tli**2) * -6.5662738484679626E-03 + (tli**3) *     &
    714              & 3.7899330796456790E-06 + (tli**(-1)) * 7.1106427501756542E-01) * (LOG(satratli)**2 * LOG(rhoali)**(-1)) +      &
    715              & (-2.8901906781697811E+01 +  tli * -1.5356398793054860 + (tli**2) * 1.9267271774384788E-02 + (tli**3) *        &
    716              & -5.3886270475516162E-05 + (tli**(-1)) * 5.0490415975693426E-01) * (LOG(satratli)**2) +                         &
    717              & (3.3365683645733924E+01 +  tli * -3.6114561564894537E-01 + (tli**2) * 9.2977354471929262E-04 + (tli**3) *     &
    718              & 1.9549769069511355E-07 + (tli**(-1)) * -8.8865930095112855) * (LOG(satratli)**2 * LOG(rhoali)) +               &
    719              & (2.4592563042806375 +  tli * -8.3227071743101084E-03 + (tli**2) * 8.2563338043447783E-06 + (tli**3) *         &
    720              & -8.4374976698593496E-09 + (tli**(-1)) * -2.0938173949893473E+02) * (LOG(satratli)**2 * LOG(rhoali)**2) +       &
    721              & (4.4099823444352317E+01 +  tli * 2.5915665826835252 +  (tli**2) * -1.6449091819482634E-02 + (tli**3) *         &
     674        jnuc_i1 = 3.0108954259038608E+01+tli*6.1176722090512577E+01+(tli**2)*8.7240333618891663E-01+(tli**3)*                &
     675             & (-4.6191788649375719E-03)+(tli**(-1))*8.3537059107024481E-01 +                                                &
     676             & (1.5028549216690628E+01+tli*(-1.9310989753720623E-01)+(tli**2)*8.0155514634860480E-04+(tli**3)*               &
     677             & (-1.0832730707799128E-06)+(tli**(-1))*1.7577660457989019)*(LOG(satratli)**(-2)) +                             &
     678             & (-2.0487870170216488E-01 + tli * 1.3263949252910405E-03 + (tli**2) *(-8.4195688402450274E-06) +               &
     679             & (tli**3)*1.6154895940993287E-08 + (tli**(-1))*3.8734212545203874E+01) * (LOG(satratli)**(-2)*LOG(rhoali)) +   &
     680             & (1.4955918863858371 + tli * 9.2290004245522454E+01 + (tli**2) *(-8.9006965195392618E-01) +                    &
     681             & (tli**3) * 2.2319123411013099E-03 + (tli**(-1)) * 4.0180079996840852E-03) *                                   &
     682             & (LOG(satratli)**(-1) * LOG(rhoali)**(-1)) +                                                                   &
     683             & (7.9018031228561085 + tli *(-1.1649433968658949E+01) + (tli**2) * 1.1400827854910951E-01 +                    &
     684             & (tli**3) *(-3.1941526492127755E-04) + (tli**(-1)) *(-3.7662115740271446E-01)) * (LOG(satratli)**(-1)) +       &
     685             & (1.5725237111225979E+02 + tli *(-1.0051649979836277) + (tli**2) * 1.1866484014507624E-03 +                    &
     686             & (tli**3) * 7.3557614998540389E-06 + (tli**(-1)) * 2.6270197023115189) * (LOG(satratli)**(-1) * LOG(rhoali)) + &
     687             & (-1.6973840122470968E+01 + tli * 1.1258423691432135E-01 + (tli**2) *(-2.9850139351463793E-04) + (tli**3) *    &
     688             & 1.4301286324827064E-07 + (tli**(-1)) * 1.3163389235253725E+01) * (LOG(satratli)**(-1) * LOG(rhoali)**2) +     &
     689             & (-1.0399591631839757 + tli * 2.7022055588257691E-03 + (tli**2) *(-2.1507467231330936E-06) + (tli**3) *        &
     690             & 3.8059489037584171E-10 + (tli**(-1)) * 1.5000492788553410E+02) * (LOG(satratli)**(-1) * LOG(rhoali)**3) +     &
     691             & (1.2250990965305315 + tli * 3.0495946490079444E+01 + (tli**2) * 2.1051563135187106E+01 + (tli**3) *           &
     692             & (-8.2200682916580878E-02) + (tli**(-1)) * 2.9965871386685029E-02) * (LOG(rhoali)**(-2)) +                     &
     693             & (4.8281605955680433 + tli * 1.7346551710836445E+02 + (tli**2) *(-1.0113602140796010E+01) + (tli**3) *         &
     694             & 3.7482518458685089E-02 + (tli**(-1)) *(-1.4449998158558205E-01)) * (LOG(rhoali)**(-1)) +                      &
     695             & (2.3399230964451237E+02 + tli *(-2.3099267235261948E+01) + (tli**2) * 8.0122962140916354E-02 +                &
     696             & (tli**3) * 6.1542576994557088E-05 + (tli**(-1)) * 5.3718413254843007) * (LOG(rhoali)) +                       &
     697             & (1.0299715519499360E+02 + tli *(-6.4663357203364136E-02) + (tli**2) *(-2.0487150565050316E-03) +              &
     698             & (tli**3) * 8.7935289055530897E-07 + (tli**(-1)) * 3.6013204601215229E+01) * (LOG(rhoali)**2) +                &
     699             & (-3.5452115439584042 + tli * 1.7083445731159330E-02 + (tli**2) *(-1.2552625290862626E-05) + (tli**3) *        &
     700             & 1.2968447449182847E-09 + (tli**(-1)) * 1.5748687512056560E+02) * (LOG(rhoali)**3) +                           &
     701             & (2.2338490119517975 + tli * 1.0229410216045540E+02 + (tli**2) *(-3.2103611955174052) + (tli**3) *             &
     702             & 1.3397152304977591E-02 + (tli**(-1)) *(-2.4155187776460030E-02)) * (LOG(satratli)* LOG(rhoali)**(-2)) +       &
     703             & (3.7592282990713963 + tli *(-1.5257988769009816E+02) + (tli**2) * 2.6113805420558802 + (tli**3) *             &
     704             & (-9.0380721653694363E-03) + (tli**(-1)) *(-1.3974197138171082E-01)) * (LOG(satratli)* LOG(rhoali)**(-1)) +    &
     705             & (1.8293600730573988E+01 + tli * 1.8344728606002992E+01 + (tli**2) *(-4.0063363221106751E-01) + (tli**3)       &
     706             & * 1.4842749371258522E-03 + (tli**(-1)) * 1.1848846003282287) * (LOG(satratli)) +                              &
     707             & (-1.7634531623032314E+02 + tli * 4.9011762441271278 + (tli**2) *(-1.3195821562746339E-02) + (tli**3) *        &
     708             & (-2.8668619526430859E-05) + (tli**(-1)) *(-2.9823396976393551E-01)) * (LOG(satratli)* LOG(rhoali)) +          &
     709             & (-3.2944043694275727E+01 + tli * 1.2517571921051887E-01 + (tli**2) * 8.3239769771186714E-05 + (tli**3) *      &
     710             & 2.8191859341519507E-07 + (tli**(-1)) *(-2.7352880736682319E+01)) * (LOG(satratli)* LOG(rhoali)**2) +          &
     711             & (-1.1451811137553243 + tli * 2.0625997485732494E-03 + (tli**2) *(-3.4225389469233624E-06) + (tli**3) *        &
     712             & 4.4437613496984567E-10 + (tli**(-1)) * 1.8666644332606754E+02) * (LOG(satratli)* LOG(rhoali)**3) +            &
     713             & (3.2270897099493567E+01 + tli * 7.7898447327513687E-01 + (tli**2) *(-6.5662738484679626E-03) + (tli**3) *     &
     714             & 3.7899330796456790E-06 + (tli**(-1)) * 7.1106427501756542E-01) * (LOG(satratli)**2 * LOG(rhoali)**(-1)) +     &
     715             & (-2.8901906781697811E+01 + tli *(-1.5356398793054860) + (tli**2) * 1.9267271774384788E-02 + (tli**3) *        &
     716             & (-5.3886270475516162E-05) + (tli**(-1)) * 5.0490415975693426E-01) * (LOG(satratli)**2) +                      &
     717             & (3.3365683645733924E+01 + tli *(-3.6114561564894537E-01) + (tli**2) * 9.2977354471929262E-04 + (tli**3) *     &
     718             & 1.9549769069511355E-07 + (tli**(-1)) *(-8.8865930095112855)) * (LOG(satratli)**2 * LOG(rhoali)) +             &
     719             & (2.4592563042806375 + tli *(-8.3227071743101084E-03) + (tli**2) * 8.2563338043447783E-06 + (tli**3) *         &
     720             & (-8.4374976698593496E-09) + (tli**(-1)) *(-2.0938173949893473E+02)) * (LOG(satratli)**2 * LOG(rhoali)**2) +   &
     721             & (4.4099823444352317E+01 + tli * 2.5915665826835252 + (tli**2) *(-1.6449091819482634E-02) + (tli**3) *         &
    722722             & 2.6797249816144721E-05 + (tli**(-1)) * 5.5045672663909995E-01)* satratli
    723723        jnuc_i1=EXP(jnuc_i1)
    724724       
    725         ntot_i = ABS((-4.8324296064013375E+04 +  tli * 5.0469120697428906E+02 +  (tli**2) * -1.1528940488496042E+00 +         &
    726              & (tli**(-1)) * -8.6892744676239192E+02 + (tli**(3)) * 4.0030302028120469E-04) +                                 &
    727              & (-6.7259105232039847E+03 +  tli * 1.9197488157452008E+02 +  (tli**2) * -1.3602976930126354E+00 +               &
    728              & (tli**(-1)) * -1.1212637938360332E+02 + (tli**(3)) * 2.8515597265933207E-03) *                                 &
    729              & LOG(satratli)**(-2) * LOG(rhoali)**(-2) +                                                                      &
    730              & (2.6216455217763342E+02 +  tli * -2.3687553252750821E+00 + (tli**2) * 7.4074554767517521E-03 +                &
    731              & (tli**(-1)) * -1.9213956820114927E+03 + (tli**(3)) * -9.3839114856129453E-06) * LOG(satratli)**(-2) +          &
    732              & (3.9652478944137344E+00 +  tli * 1.2469375098256536E-02 +  (tli**2) * -9.9837754694045633E-05 + (tli**(-1)) *  &
    733              & -5.1919499210175138E+02 + (tli**(3)) * 1.6489001324583862E-07) * LOG(satratli)**(-2) * LOG(rhoali) +           &
    734              & (2.4975714429096206E+02 +  tli * 1.7107594562445172E+02 +  (tli**2) * -7.8988711365135289E-01 + (tli**(-1)) *  &
    735              & -2.2243599782483177E+01 + (tli**(3)) * -1.6291523004095427E-04) * LOG(satratli)**(-1) * LOG(rhoali)**(-2) +    &
    736              & (-8.9270715592533611E+02 +  tli * 1.2053538883338946E+02 +  (tli**2) * -1.5490408828541018E+00 + (tli**(-1)) * &
    737              & -1.1243275579419826E+01 + (tli**(3)) * 4.8053105606904655E-03) * LOG(satratli)**(-1) * LOG(rhoali)**(-1) +     &
    738              & (7.6426441642091631E+03 +  tli * -7.1785462414656578E+01 + (tli**2) * 2.3851864923199523E-01 + (tli**(-1)) *  &
    739              & 8.5591775688708395E+01 + (tli**(3)) * -3.7000473243342858E-04) * LOG(satratli)**(-1) +                         &
    740              & (-5.1516826398607911E+01 +  tli * 9.1385720811460558E-01 +  (tli**2) * -3.5477100262158974E-03 +               &
     725        ntot_i = ABS((-4.8324296064013375E+04 + tli * 5.0469120697428906E+02 + (tli**2) *(-1.1528940488496042E+00) +         &
     726             & (tli**(-1)) *(-8.6892744676239192E+02) + (tli**(3)) * 4.0030302028120469E-04) +                               &
     727             & (-6.7259105232039847E+03 + tli * 1.9197488157452008E+02 + (tli**2) *(-1.3602976930126354E+00) +               &
     728             & (tli**(-1)) *(-1.1212637938360332E+02) + (tli**(3)) * 2.8515597265933207E-03) *                               &
     729             & LOG(satratli)**(-2) * LOG(rhoali)**(-2) +                                                                     &
     730             & (2.6216455217763342E+02 + tli *(-2.3687553252750821E+00) + (tli**2) * 7.4074554767517521E-03 +                &
     731             & (tli**(-1)) *(-1.9213956820114927E+03) + (tli**(3)) *(-9.3839114856129453E-06)) * LOG(satratli)**(-2) +       &
     732             & (3.9652478944137344E+00 + tli * 1.2469375098256536E-02 + (tli**2) *(-9.9837754694045633E-05) + (tli**(-1)) *  &
     733             & (-5.1919499210175138E+02) + (tli**(3)) * 1.6489001324583862E-07) * LOG(satratli)**(-2) * LOG(rhoali) +        &
     734             & (2.4975714429096206E+02 + tli * 1.7107594562445172E+02 + (tli**2) *(-7.8988711365135289E-01) + (tli**(-1)) *  &
     735             & (-2.2243599782483177E+01) + (tli**(3)) *(-1.6291523004095427E-04)) * LOG(satratli)**(-1) * LOG(rhoali)**(-2) +&
     736             & (-8.9270715592533611E+02 + tli * 1.2053538883338946E+02 + (tli**2) *(-1.5490408828541018E+00) + (tli**(-1)) * &
     737             & (-1.1243275579419826E+01) + (tli**(3)) * 4.8053105606904655E-03) * LOG(satratli)**(-1) * LOG(rhoali)**(-1) +  &
     738             & (7.6426441642091631E+03 + tli *(-7.1785462414656578E+01) + (tli**2) * 2.3851864923199523E-01 + (tli**(-1)) *  &
     739             & 8.5591775688708395E+01 + (tli**(3)) *(-3.7000473243342858E-04)) * LOG(satratli)**(-1) +                       &
     740             & (-5.1516826398607911E+01 + tli * 9.1385720811460558E-01 + (tli**2) *(-3.5477100262158974E-03) +               &
    741741             & (tli**(-1)) * 2.7545544507625586E+03 + (tli**(3)) * 5.4708262093640928E-06) * LOG(satratli)**(-1) * LOG(rhoali) + &
    742              & (-3.0386767129196176E+02 +  tli * -1.1033438883583569E+04 + (tli**2) * 8.1296859732896067E+01 + (tli**(-1)) * &
    743              & 1.2625883141097162E+01 + (tli**(3)) * -1.2728497822219101E-01) * LOG(rhoali)**(-2) +                           &
    744              & (-3.3763494256461472E+03 +  tli * 3.1916579136391006E+03 +  (tli**2) * -2.7234339474441143E+01 + (tli**(-1)) * &
    745              & -2.1897653262707397E+01 + (tli**(3)) * 5.1788505812259071E-02) * LOG(rhoali)**(-1) +                           &
    746              & (-1.8817843873687068E+03 +  tli * 4.3038072285882070E+00 +  (tli**2) * 6.6244087689671860E-03 + (tli**(-1)) *  &
    747              & -2.7133073605696295E+03 + (tli**(3)) * -1.7951557394285043E-05) * LOG(rhoali) +                                &
    748              & (-1.7668827539244447E+02 +  tli * 4.8160932330629913E-01 +  (tli**2) * -6.3133007671100293E-04 + (tli**(-1)) * &
    749              & 2.5631774669873157E+04 + (tli**(3)) * 4.1534484127873519E-07) * LOG(rhoali)**(2) +                             &
    750              & (-1.6661835889222382E+03 +  tli * 1.3708900504682877E+03 +  (tli**2) * -1.7919060052198969E+01 + (tli**(-1)) * &
    751              & -3.5145029804436405E+01 + (tli**(3)) * 5.1047240947371224E-02) * LOG(satratli)* LOG(rhoali)**(-2) +            &
    752              & (1.0843549363030939E+04 +  tli * -7.3557073636139577E+01 + (tli**2) * 1.2054625131778862E+00 + (tli**(-1)) *  &
    753              & 1.9358737917864391E+02 + (tli**(3)) * -4.2871620775911338E-03) * LOG(satratli)* LOG(rhoali)**(-1) +            &
    754              & (-2.4269802549752835E+03 +  tli * 1.1348265061941714E+01 +  (tli**2) * -5.0430423939495157E-02 + (tli**(-1)) * &
    755              & 2.3709874548950634E+03 + (tli**(3)) * 1.4091851828620244E-04) * LOG(satratli) +                                &
    756              & (5.2745372575251588E+02 +  tli * -2.6080675912627314E+00 + (tli**2) * 5.6902218056670145E-03 + (tli**(-1)) *  &
    757              & -3.2149319482897838E+04 + (tli**(3)) * -5.4121996056745853E-06) * LOG(satratli)* LOG(rhoali) +                 &
    758              & (-1.6401959518360403E+01 +  tli * 2.4322962162439640E-01 +  (tli**2) * 1.1744366627725344E-03 + (tli**(-1)) *  &
    759              & -8.2694427518413195E+03 + (tli**(3)) * -5.0028379203873102E-06)* LOG(satratli)**(2) +                          &
    760              & (-2.7556572017167782E+03 +  tli * 4.9293344495058264E+01 +  (tli**2) * -2.6503456520676050E-01 + (tli**(-1)) * &
    761              & 1.2130698030982167E+03 + (tli**(3)) * 4.3530610668042957E-04)* LOG(satratli)**2 * LOG(rhoali)**(-1) +          &
    762              & (-6.3419182228959192E+00 +  tli * 4.0636212834605827E-02 +  (tli**2) * -1.0450112687842742E-04 + (tli**(-1)) * &
    763              & 3.1035882189759656E+02 + (tli**(3)) * 9.4328418657873500E-08)* LOG(satratli)**(-3) +                           &
    764              & (3.0189213304689042E+03 +  tli * -2.3804654203861684E+01 + (tli**2) * 6.8113013411972942E-02 + (tli**(-1)) *  &
    765              & 6.3112071081188913E+02 + (tli**(3)) * -9.4460854261685723E-05)* (satratli) * LOG(rhoali) +                     &
    766              & (1.1924791930673702E+04 +  tli * -1.1973824959206000E+02 + (tli**2) * 1.6888713097971020E-01 + (tli**(-1)) *  &
    767              & 1.8735938211539585E+02 + (tli**(3)) * 5.0974564680442852E-04)* (satratli) +                                    &
    768              & (3.6409071302482083E+01 +  tli * 1.7919859306449623E-01 +  (tli**2) * -1.0020116255895206E-03 + (tli**(-1)) *  &
    769              & -8.3521083354432303E+03 + (tli**(3)) * 1.5879900546795635E-06)* satratli * LOG(rhoali)**(2))
     742             & (-3.0386767129196176E+02 + tli *(-1.1033438883583569E+04) + (tli**2) * 8.1296859732896067E+01 + (tli**(-1)) * &
     743             & 1.2625883141097162E+01 + (tli**(3)) *(-1.2728497822219101E-01)) * LOG(rhoali)**(-2) +                         &
     744             & (-3.3763494256461472E+03 + tli * 3.1916579136391006E+03 + (tli**2) *(-2.7234339474441143E+01) + (tli**(-1)) * &
     745             & (-2.1897653262707397E+01) + (tli**(3)) * 5.1788505812259071E-02) * LOG(rhoali)**(-1) +                        &
     746             & (-1.8817843873687068E+03 + tli * 4.3038072285882070E+00 + (tli**2) * 6.6244087689671860E-03 + (tli**(-1)) *   &
     747             & (-2.7133073605696295E+03) + (tli**(3)) *(-1.7951557394285043E-05)) * LOG(rhoali) +                            &
     748             & (-1.7668827539244447E+02 + tli * 4.8160932330629913E-01 + (tli**2) *(-6.3133007671100293E-04) + (tli**(-1)) * &
     749             & 2.5631774669873157E+04 + (tli**(3)) * 4.1534484127873519E-07) * LOG(rhoali)**(2) +                            &
     750             & (-1.6661835889222382E+03 + tli * 1.3708900504682877E+03 + (tli**2) *(-1.7919060052198969E+01) + (tli**(-1)) * &
     751             & (-3.5145029804436405E+01) + (tli**(3)) * 5.1047240947371224E-02) * LOG(satratli)* LOG(rhoali)**(-2) +         &
     752             & (1.0843549363030939E+04 + tli *(-7.3557073636139577E+01) + (tli**2) * 1.2054625131778862E+00 + (tli**(-1)) *  &
     753             & 1.9358737917864391E+02 + (tli**(3)) *(-4.2871620775911338E-03)) * LOG(satratli)* LOG(rhoali)**(-1) +          &
     754             & (-2.4269802549752835E+03 + tli * 1.1348265061941714E+01 + (tli**2) *(-5.0430423939495157E-02) + (tli**(-1)) * &
     755             & 2.3709874548950634E+03 + (tli**(3)) * 1.4091851828620244E-04) * LOG(satratli) +                               &
     756             & (5.2745372575251588E+02 + tli *(-2.6080675912627314E+00) + (tli**2) * 5.6902218056670145E-03 + (tli**(-1)) *  &
     757             & (-3.2149319482897838E+04) + (tli**(3)) *(-5.4121996056745853E-06)) * LOG(satratli)* LOG(rhoali) +             &
     758             & (-1.6401959518360403E+01 + tli * 2.4322962162439640E-01 + (tli**2) * 1.1744366627725344E-03 + (tli**(-1)) *   &
     759             & (-8.2694427518413195E+03) + (tli**(3)) *(-5.0028379203873102E-06))* LOG(satratli)**(2) +                      &
     760             & (-2.7556572017167782E+03 + tli * 4.9293344495058264E+01 + (tli**2) *(-2.6503456520676050E-01) + (tli**(-1)) * &
     761             & 1.2130698030982167E+03 + (tli**(3)) * 4.3530610668042957E-04)* LOG(satratli)**2 * LOG(rhoali)**(-1) +         &
     762             & (-6.3419182228959192E+00 + tli * 4.0636212834605827E-02 + (tli**2) *(-1.0450112687842742E-04) + (tli**(-1)) * &
     763             & 3.1035882189759656E+02 + (tli**(3)) * 9.4328418657873500E-08)* LOG(satratli)**(-3) +                          &
     764             & (3.0189213304689042E+03 + tli *(-2.3804654203861684E+01) + (tli**2) * 6.8113013411972942E-02 + (tli**(-1)) *  &
     765             & 6.3112071081188913E+02 + (tli**(3)) *(-9.4460854261685723E-05))* (satratli) * LOG(rhoali) +                   &
     766             & (1.1924791930673702E+04 + tli *(-1.1973824959206000E+02) + (tli**2) * 1.6888713097971020E-01 + (tli**(-1)) *  &
     767             & 1.8735938211539585E+02 + (tli**(3)) * 5.0974564680442852E-04)* (satratli) +                                   &
     768             & (3.6409071302482083E+01 + tli * 1.7919859306449623E-01 + (tli**2) *(-1.0020116255895206E-03) + (tli**(-1)) *  &
     769             & (-8.3521083354432303E+03) + (tli**(3)) * 1.5879900546795635E-06)* satratli * LOG(rhoali)**(2))
    770770         
    771         rc_i = (-3.6318550637865524E-08 +  tli * 2.1740704135789128E-09   +  (tli**2) *                          &
    772              & -8.5521429066506161E-12 + (tli**3) * -9.3538647454573390E-15) +                                   &
    773              & (2.1366936839394922E-08 +  tli * -2.4087168827395623E-10 +  (tli**2) * 8.7969869277074319E-13 +   &
    774              & (tli**3) * -1.0294466881303291E-15)* LOG(satratli)**(-2) * LOG(rhoali)**(-1) +                    &
    775              & (-7.7804007761164303E-10 +  tli * 1.0327058173517932E-11 +  (tli**2) * -4.2557697639692428E-14 +  &
     771        rc_i = (-3.6318550637865524E-08 + tli * 2.1740704135789128E-09   + (tli**2) *                            &
     772             & (-8.5521429066506161E-12) + (tli**3) *(-9.3538647454573390E-15)) +                                &
     773             & (2.1366936839394922E-08 + tli *(-2.4087168827395623E-10) + (tli**2) * 8.7969869277074319E-13 +    &
     774             & (tli**3) *(-1.0294466881303291E-15))* LOG(satratli)**(-2) * LOG(rhoali)**(-1) +                   &
     775             & (-7.7804007761164303E-10 + tli * 1.0327058173517932E-11 + (tli**2) *(-4.2557697639692428E-14) +   &
    776776             & (tli**3) * 5.4082507061618662E-17)* LOG(satratli)**(-2) +                                         &
    777              & (3.2628927397420860E-12 +  tli * -7.6475692919751066E-14 +  (tli**2) * 4.1985816845259788E-16 +   &
    778              & (tli**3) * -6.2281395889592719E-19)* LOG(satratli)**(-2) * LOG(rhoali) +                          &
    779              & (2.0442205540818555E-09 +  tli * 4.0441858911249830E-08 +  (tli**2) * -3.3423487629482825E-10 +   &
     777             & (3.2628927397420860E-12 + tli *(-7.6475692919751066E-14) + (tli**2) * 4.1985816845259788E-16 +    &
     778             & (tli**3) *(-6.2281395889592719E-19))* LOG(satratli)**(-2) * LOG(rhoali) +                         &
     779             & (2.0442205540818555E-09 + tli * 4.0441858911249830E-08 + (tli**2) *(-3.3423487629482825E-10) +    &
    780780             & (tli**3) * 6.8000404742985678E-13)* LOG(satratli)**(-1) * LOG(rhoali)**(-2) +                     &
    781              & (1.8381489183824627E-08 +  tli * -8.9853322951518919E-09 +  (tli**2) * 7.5888799566036185E-11 +   &
    782              & (tli**3) * -1.5823457864755549E-13)* LOG(satratli)**(-1) * LOG(rhoali)**(-1) +                    &
    783              & (1.1795760639695057E-07 +  tli * -8.1046722896375875E-10 +  (tli**2) * 9.1868604369041857E-14 +   &
     781             & (1.8381489183824627E-08 + tli *(-8.9853322951518919E-09) + (tli**2) * 7.5888799566036185E-11 +    &
     782             & (tli**3) *(-1.5823457864755549E-13))* LOG(satratli)**(-1) * LOG(rhoali)**(-1) +                   &
     783             & (1.1795760639695057E-07 + tli *(-8.1046722896375875E-10) + (tli**2) * 9.1868604369041857E-14 +    &
    784784             & (tli**3) * 4.7882428237444610E-15)* LOG(satratli)**(-1) +                                         &
    785              & (-4.4028846582545952E-09 +  tli * 4.6541269232626618E-11 +  (tli**2) * -1.1939929984285194E-13 +  &
     785             & (-4.4028846582545952E-09 + tli * 4.6541269232626618E-11 + (tli**2) *(-1.1939929984285194E-13) +   &
    786786             & (tli**3) * 2.3602037016614437E-17)* LOG(satratli)**(-1) * LOG(rhoali) +                           &
    787              & (2.7885056884209128E-11 +  tli * -4.5167129624119121E-13 +  (tli**2) * 1.6558404997394422E-15 +   &
    788              & (tli**3) * -1.2037336621218054E-18)* LOG(satratli)**(-1) * LOG(rhoali)**2 +                       &
    789              & (-2.3719627171699983E-09 +  tli * -1.5260127909292053E-07 +  (tli**2) * 1.7177017944754134E-09 +  &
    790              & (tli**3) * -4.7031737537526395E-12)* LOG(rhoali)**(-2) +                                          &
    791              & (-5.6946433724699646E-09 +  tli * 8.4629788237081735E-09 +  (tli**2) * -1.7674135187061521E-10 +  &
     787             & (2.7885056884209128E-11 + tli *(-4.5167129624119121E-13) + (tli**2) * 1.6558404997394422E-15 +    &
     788             & (tli**3) *(-1.2037336621218054E-18))* LOG(satratli)**(-1) * LOG(rhoali)**2 +                      &
     789             & (-2.3719627171699983E-09 + tli *(-1.5260127909292053E-07) + (tli**2) * 1.7177017944754134E-09 +   &
     790             & (tli**3) *(-4.7031737537526395E-12))* LOG(rhoali)**(-2) +                                         &
     791             & (-5.6946433724699646E-09 + tli * 8.4629788237081735E-09 + (tli**2) *(-1.7674135187061521E-10) +   &
    792792             & (tli**3) * 6.6236547903091862E-13)* LOG(rhoali)**(-1) +                                           &
    793              & (-2.2808617930606012E-08 +  tli * 1.4773376696847775E-10 +  (tli**2) * -1.3076953119957355E-13 +  &
     793             & (-2.2808617930606012E-08 + tli * 1.4773376696847775E-10 + (tli**2) *(-1.3076953119957355E-13) +   &
    794794             & (tli**3) * 2.3625301497914000E-16)* LOG(rhoali) +                                                 &
    795              & (1.4014269939947841E-10 +  tli * -2.3675117757377632E-12 +  (tli**2) * 5.1514033966707879E-15 +   &
    796              & (tli**3) * -4.8864233454747856E-18)* LOG(rhoali)**2 +                                             &
    797              & (6.5464943868885886E-11 +  tli * 1.6494354816942769E-08 +  (tli**2) * -1.7480097393483653E-10 +   &
     795             & (1.4014269939947841E-10 + tli *(-2.3675117757377632E-12) + (tli**2) * 5.1514033966707879E-15 +    &
     796             & (tli**3) *(-4.8864233454747856E-18))* LOG(rhoali)**2 +                                            &
     797             & (6.5464943868885886E-11 + tli * 1.6494354816942769E-08 + (tli**2) *(-1.7480097393483653E-10) +    &
    798798             & (tli**3) * 4.7460075628523984E-13)* LOG(satratli)* LOG(rhoali)**(-2) +                            &
    799              & (8.4737893183927871E-09 +  tli * -6.0243327445597118E-09 +  (tli**2) * 5.8766070529814883E-11 +   &
    800              & (tli**3) * -1.4926748560042018E-13)* LOG(satratli)* LOG(rhoali)**(-1) +                           &
    801              & (1.0761964135701397E-07 +  tli * -1.0142496009071148E-09 +  (tli**2) * 2.1337312466519190E-12 +   &
     799             & (8.4737893183927871E-09 + tli *(-6.0243327445597118E-09) + (tli**2) * 5.8766070529814883E-11 +    &
     800             & (tli**3) *(-1.4926748560042018E-13))* LOG(satratli)* LOG(rhoali)**(-1) +                          &
     801             & (1.0761964135701397E-07 + tli *(-1.0142496009071148E-09) + (tli**2) * 2.1337312466519190E-12 +    &
    802802             & (tli**3) * 1.6376014957685404E-15)* LOG(satratli) +                                               &
    803              & (-3.5621571395968670E-09 +  tli * 4.1175339587760905E-11 +  (tli**2) * -1.3535372357998504E-13 +  &
     803             & (-3.5621571395968670E-09 + tli * 4.1175339587760905E-11 + (tli**2) *(-1.3535372357998504E-13) +   &
    804804             & (tli**3) * 8.9334219536920720E-17)* LOG(satratli)* LOG(rhoali) +                                  &
    805              & (2.0700482083136289E-11 +  tli * -3.9238944562717421E-13 +  (tli**2) * 1.5850961422040196E-15 +   &
    806              & (tli**3) * -1.5336775610911665E-18)* LOG(satratli)* LOG(rhoali)**2 +                              &
    807              & (1.8524255464416206E-09 +  tli * -2.1959816152743264E-11 +  (tli**2) * -6.4478119501677012E-14 +  &
     805             & (2.0700482083136289E-11 + tli *(-3.9238944562717421E-13) + (tli**2) * 1.5850961422040196E-15 +    &
     806             & (tli**3) *(-1.5336775610911665E-18))* LOG(satratli)* LOG(rhoali)**2 +                             &
     807             & (1.8524255464416206E-09 + tli *(-2.1959816152743264E-11) + (tli**2) *(-6.4478119501677012E-14) +  &
    808808             & (tli**3) * 5.5135243833766056E-16)* LOG(satratli)**2 * LOG(rhoali)**(-1) +                        &
    809              & (1.9349488650922679E-09 +  tli * -2.2647295919976428E-11 +  (tli**2) * 9.2917479748268751E-14 +   &
    810              & (tli**3) * -1.2741959892173170E-16)* LOG(satratli)**2 +                                           &
    811              & (2.1484978031650972E-11 +  tli * -9.3976642475838013E-14 +  (tli**2) * -4.8892738002751923E-16 +  &
     809             & (1.9349488650922679E-09 + tli *(-2.2647295919976428E-11) + (tli**2) * 9.2917479748268751E-14 +    &
     810             & (tli**3) *(-1.2741959892173170E-16))* LOG(satratli)**2 +                                          &
     811             & (2.1484978031650972E-11 + tli *(-9.3976642475838013E-14) + (tli**2) *(-4.8892738002751923E-16) +  &
    812812             & (tli**3) * 1.4676120441783832E-18)* LOG(satratli)**2 * LOG(rhoali) +                              &
    813              & (6.7565715216420310E-13 +  tli * -3.5421162549480807E-15 +  (tli**2) * -3.4201196868693569E-18 +  &
     813             & (6.7565715216420310E-13 + tli *(-3.5421162549480807E-15) + (tli**2) *(-3.4201196868693569E-18) +  &
    814814             & (tli**3) * 2.2260187650412392E-20)* LOG(satratli)**3 * LOG(rhoali)
    815815                   
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/ocs_to_so2.F90

    r3605 r3798  
    66  USE dimphy, ONLY : klon,klev
    77  USE aerophys
    8   USE infotrac
     8  USE infotrac_phy
    99  USE YOMCST, ONLY : RG
    1010  USE phys_local_var_mod, ONLY : OCS_lifetime, budg_3D_ocs_to_so2, budg_ocs_to_so2
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/so2_to_h2so4.F90

    r3605 r3798  
    66  USE dimphy, ONLY : klon,klev
    77  USE aerophys
    8   USE infotrac
     8  USE infotrac_phy
    99  USE YOMCST, ONLY : RG
    1010  USE phys_local_var_mod, ONLY : SO2_lifetime, budg_3D_so2_to_h2so4, budg_so2_to_h2so4
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/sulfate_aer_mod.F90

    r3605 r3798  
    5050!
    5151    SAVE INSTEP,F,XC,YC,XC1,XC16,YC1,YC28
     52!$OMP THREADPRIVATE(INSTEP,F,XC,YC,XC1,XC16,YC1,YC28)
    5253
    5354! convert pplay (in Pa) to PMB (in mb)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/StratAer/traccoag_mod.F90

    r3605 r3798  
    1717
    1818    USE dimphy
    19     USE infotrac
     19    USE infotrac_phy
    2020    USE aerophys
    2121    USE geometry_mod, ONLY : cell_area, boundslat
  • LMDZ6/branches/Ocean_skin/libf/phylmd/calbeta.F90

    r3102 r3798  
    77  USE dimphy
    88  USE indice_sol_mod
     9
    910  IMPLICIT none
     11
     12#include "flux_arp.h"
     13
    1014!======================================================================
    1115! Auteur(s): Z.X. Li (LMD/CNRS) (adaptation du GCM au LMD)
     
    8286     ENDDO
    8387  ENDIF
     88
     89  ! EV: when beta is prescribed for 1D cases:
     90  IF (knon.EQ.1 .AND. ok_prescr_beta) THEN
     91     DO i = 1, knon
     92          vbeta(i)=betaevap
     93      ENDDO
     94  ENDIF
    8495 
    8596END SUBROUTINE calbeta
  • LMDZ6/branches/Ocean_skin/libf/phylmd/carbon_cycle_mod.F90

    r3605 r3798  
    201201 
    202202  SUBROUTINE carbon_cycle_init()
    203 ! This subroutine is called from traclmdz_init, only at first timestep.
    204 ! - Read controle parameters from .def input file
    205 ! - Search for carbon tracers and set default values
    206 ! - Allocate variables
    207 ! - Test for compatibility
     203    ! This subroutine is called from tracco2i_init, which is called from phytrac_init only at first timestep.
     204    ! - Allocate variables. These variables must be allocated before first call to phys_output_write in physiq.
    208205
    209206    USE dimphy
  • LMDZ6/branches/Ocean_skin/libf/phylmd/change_srf_frac_mod.F90

    r2656 r3798  
    183183           tsurf, alb_dir,alb_dif, ustar, u10m, v10m, pbl_tke)
    184184
    185 
    186185    ELSE
    187186       ! No modifcation should be done
  • LMDZ6/branches/Ocean_skin/libf/phylmd/conf_phys_m.F90

    r3605 r3798  
    1818       iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs, &
    1919       ok_ade, ok_aie, ok_alw, ok_cdnc, ok_volcan, aerosol_couple, chemistry_couple, &
    20        flag_aerosol, flag_aerosol_strat, flag_aer_feedback, new_aod, &
     20       flag_aerosol, flag_aerosol_strat, flag_aer_feedback, &
    2121       flag_bc_internal_mixture, bl95_b0, bl95_b1,&
    2222       read_climoz, &
     
    7979    LOGICAL              :: flag_aer_feedback
    8080    LOGICAL              :: flag_bc_internal_mixture
    81     LOGICAL              :: new_aod
    8281    REAL                 :: bl95_b0, bl95_b1
    8382    REAL                 :: fact_cldcon, facttemps,ratqsbas,ratqshaut,tau_ratqs
     
    8887    CHARACTER (len = 10),SAVE  :: type_veget_omp
    8988    CHARACTER (len = 8), SAVE  :: aer_type_omp
    90     LOGICAL, SAVE       :: ok_snow_omp
     89    INTEGER, SAVE       :: landice_opt_omp
     90    INTEGER, SAVE       :: n_dtis_omp
     91    INTEGER, SAVE       :: iflag_tsurf_inlandsis_omp
     92    INTEGER, SAVE       :: iflag_albzenith_omp   
     93    LOGICAL, SAVE       :: SnoMod_omp,BloMod_omp,ok_outfor_omp
    9194    LOGICAL, SAVE       :: ok_newmicro_omp
    9295    LOGICAL, SAVE       :: ok_all_xml_omp
     
    101104    LOGICAL, SAVE       :: flag_aer_feedback_omp
    102105    LOGICAL, SAVE       :: flag_bc_internal_mixture_omp
    103     LOGICAL, SAVE       :: new_aod_omp
    104106    REAL,SAVE           :: bl95_b0_omp, bl95_b1_omp
    105107    REAL,SAVE           :: freq_ISCCP_omp, ecrit_ISCCP_omp
     
    321323    !
    322324
    323     ! Martin
    324     !Config Key  = ok_snow
    325     !Config Desc = Flag to activate snow model SISVAT
    326     !Config Def  = .FALSE.
    327     ok_snow_omp = .FALSE.
    328     CALL getin('ok_snow', ok_snow_omp)
    329     ! Martin
    330 
     325    ! INLANDSIS
     326    !==================================================================
     327    ! Martin et Etienne
     328    !Config Key  = landice_opt
     329    !Config Desc = which landice snow model (BULK, SISVAT or INLANDSIS)
     330    !Config Def  = 0
     331    landice_opt_omp = 0
     332    CALL getin('landice_opt', landice_opt_omp)
     333    ! Martin et Etienne
     334
     335    !Etienne
     336    !Config Key  = iflag_tsurf_inlandsis
     337    !Config Desc = which method to calculate tsurf in INLANDSIS
     338    !Config Def  = 0
     339    iflag_tsurf_inlandsis_omp = 0
     340    CALL getin('iflag_tsurf_inlandsis', iflag_tsurf_inlandsis_omp)
     341
     342    !Etienne
     343    !Config Key  = iflag_albzenith
     344    !Config Desc = method to account for albedo sensitivity to solar zenith angle
     345    !Config Def  = 0
     346    iflag_albzenith_omp = 0
     347    CALL getin('iflag_albzenith', iflag_albzenith_omp)
     348
     349    !Etienne
     350    !Config Key  = n_dtis
     351    !Config Desc = number of subtimesteps for INLANDSIS
     352    !Config Def  = 1
     353    n_dtis_omp = 1
     354    CALL getin('n_dtis', n_dtis_omp)
     355
     356    !Etienne
     357    !Config Key  = SnoMod
     358    !Config Desc = activation of snow modules in inlandsis
     359    !Config Def  = 1
     360    SnoMod_omp = .TRUE.
     361    CALL getin('SnoMod', SnoMod_omp)
     362
     363    !Etienne
     364    !Config Key  = BloMod
     365    !Config Desc = activation of blowing snow in inlandsis
     366    !Config Def  = 1
     367    BloMod_omp = .FALSE.
     368    CALL getin('BloMod', BloMod_omp)
     369
     370    !Etienne
     371    !Config Key  = ok_outfor
     372    !Config Desc = activation of output ascii file in inlandsis
     373    !Config Def  = 1
     374   ok_outfor_omp = .FALSE.
     375    CALL getin('ok_outfor', ok_outfor_omp)
     376
     377
     378
     379    !==================================================================
     380   
    331381    !Config Key  = OK_journe
    332382    !Config Desc = Pour des sorties journalieres
     
    453503    flag_bc_internal_mixture_omp = .FALSE.
    454504    CALL getin('flag_bc_internal_mixture',flag_bc_internal_mixture_omp)
    455 
    456     ! Temporary variable for testing purpose!
    457     !Config Key  = new_aod
    458     !Config Desc = which calcul of aeropt
    459     !Config Def  = FALSE
    460     !Config Help = Used in physiq.F
    461     !
    462     new_aod_omp = .TRUE.
    463     CALL getin('new_aod',new_aod_omp)
    464505
    465506    !
     
    23032344       ok_veget=.FALSE.
    23042345    ENDIF
    2305     ! Martin
    2306     ok_snow = ok_snow_omp
    2307     ! Martin
    2308 
     2346    ! SISVAT and INLANDSIS
     2347    !=================================================
     2348    landice_opt = landice_opt_omp
     2349    iflag_tsurf_inlandsis = iflag_tsurf_inlandsis_omp
     2350    iflag_albzenith = iflag_albzenith_omp
     2351    n_dtis=n_dtis_omp
     2352    SnoMod=SnoMod_omp
     2353    BloMod=BloMod_omp
     2354    ok_outfor=ok_outfor_omp
     2355    !=================================================
    23092356    ok_all_xml = ok_all_xml_omp
    23102357    ok_lwoff = ok_lwoff_omp
     
    23292376    flag_aer_feedback=flag_aer_feedback_omp
    23302377    flag_bc_internal_mixture=flag_bc_internal_mixture_omp
    2331     new_aod=new_aod_omp
    23322378    aer_type = aer_type_omp
    23332379    bl95_b0 = bl95_b0_omp
     
    24992545    ENDIF
    25002546
    2501     ! Test sur new_aod. Ce flag permet de retrouver les resultats de l'AR4
    2502     ! il n'est utilisable que lors du couplage avec le SO4 seul
     2547    ! Flag_aerosol cannot be set to zero if aerosol direct effect (ade) or aerosol indirect effect (aie) are activated
    25032548    IF (ok_ade .OR. ok_aie) THEN
    25042549       IF ( flag_aerosol .EQ. 0 ) THEN
    25052550          CALL abort_physic('conf_phys','flag_aerosol=0 not compatible avec ok_ade ou ok_aie=.TRUE.',1)
    25062551       ENDIF
    2507        IF ( .NOT. new_aod .AND.  flag_aerosol .NE. 1) THEN
    2508           CALL abort_physic('conf_phys','new_aod=.FALSE. not compatible avec flag_aerosol=1',1)
    2509        ENDIF
    25102552    ENDIF
    25112553
    2512     ! Flag_aerosol cannot be to zero if we are in coupled mode for aerosol
     2554    ! Flag_aerosol cannot be set to zero if we are in coupled mode for aerosol
    25132555    IF (aerosol_couple .AND. flag_aerosol .EQ. 0 ) THEN
    25142556       CALL abort_physic('conf_phys', 'flag_aerosol cannot be to zero if aerosol_couple=y ', 1)
    25152557    ENDIF
    25162558
    2517     ! Read_climoz need to be zero if we are in couple mode for chemistry
     2559    ! Read_climoz needs to be set zero if we are in couple mode for chemistry
    25182560    IF (chemistry_couple .AND. read_climoz .ne. 0) THEN
    25192561       CALL abort_physic('conf_phys', 'read_climoz need to be to zero if chemistry_couple=y ', 1)
     
    25712613    WRITE(lunout,*) ' Version ocean = ', version_ocean
    25722614    WRITE(lunout,*) ' Config veget = ', ok_veget,type_veget
    2573     WRITE(lunout,*) ' Snow model SISVAT : ok_snow = ', ok_snow
     2615    WRITE(lunout,*) ' Snow model landice : landice_opt = ', landice_opt
    25742616    WRITE(lunout,*) ' Config xml pour XIOS : ok_all_xml = ', ok_all_xml
    25752617    WRITE(lunout,*) ' Sortie journaliere = ', ok_journe
     
    26772719    WRITE(lunout,*) ' flag_aerosol_strat= ', flag_aerosol_strat
    26782720    WRITE(lunout,*) ' flag_aer_feedback= ', flag_aer_feedback
    2679     WRITE(lunout,*) ' new_aod = ', new_aod
    26802721    WRITE(lunout,*) ' aer_type = ',aer_type
    26812722    WRITE(lunout,*) ' bl95_b0 = ',bl95_b0
     
    27712812    WRITE(lunout,*) ' carbon_cycle_rad = ', carbon_cycle_rad
    27722813    WRITE(lunout,*) ' level_coupling_esm = ', level_coupling_esm
     2814    WRITE(lunout,*) ' iflag_tsurf_inlandsis = ', iflag_tsurf_inlandsis
     2815    WRITE(lunout,*) ' iflag_albzenith = ', iflag_albzenith
     2816    WRITE(lunout,*) ' n_dtis = ', n_dtis
     2817    WRITE(lunout,*) ' SnoMod = ', SnoMod
     2818    WRITE(lunout,*) ' BloMod = ', BloMod
     2819    WRITE(lunout,*) ' ok_outfor = ', ok_outfor
     2820
    27732821
    27742822    !$OMP END MASTER
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cospv2/cosp_config.F90

    r3491 r3798  
    6363         N_HYDRO = 9               ! Number of hydrometeor classes used by quickbeam radar simulator.
    6464
     65    ! Mode debug ou prod (AI 0302018)
     66    logical :: ok_debug_cosp = .true.
    6567    ! #################################################################################### 
    6668    ! Joint histogram bin-boundaries
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cospv2/cosp_utils.F90

    r3491 r3798  
    5656    integer :: i,j,k
    5757    real(wp) :: sigma,one_over_xip1,xi,rho0,rho,lambda_x,gamma_4_3_2,delta
     58
     59    real(wp) :: seuil
     60
     61    if (ok_debug_cosp) then
     62       seuil=1.e-15
     63    else
     64       seuil=0.0
     65    endif
     66
     67
    5868   
    5969    mxratio = 0.0
     
    7585                        mxratio(i,j,k)=mxratio(i,j,k)/rho
    7686                        ! Compute effective radius
    77                         if ((reff(i,j,k) <= 0._wp).and.(flux(i,k) /= 0._wp)) then
     87!                        if ((reff(i,j,k) <= 0._wp).and.(flux(i,k) /= 0._wp)) then
     88                         if ((reff(i,j,k) <= 0._wp).and.(flux(i,k) > seuil)) then
    7889                           lambda_x = (a_x*c_x*((rho0/rho)**g_x)*n_ax*gamma1/flux(i,k))**(1._wp/delta)
    7990                           reff(i,j,k) = gamma_4_3_2/lambda_x
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cospv2/lmdz_cosp_interface.F90

    r3511 r3798  
    7474
    7575!!! Modules faisant partie du code source de COSPv2
    76   use cosp_kinds,                 only: wp                         
    77   use MOD_COSP_CONFIG,                    only: N_HYDRO,RTTOV_MAX_CHANNELS, &
    78                                                 niv_sorties, vgrid_z_in
    79   use mod_quickbeam_optics,               only: size_distribution,hydro_class_init, &
    80                                                 quickbeam_optics_init
    81   use quickbeam,                         only: radar_cfg
    82   use mod_cosp,                          only: cosp_init,cosp_optical_inputs, &
    83                                                 cosp_column_inputs,cosp_outputs, &
    84                                                 cosp_simulator
     76  use cosp_kinds,  only: wp                         
     77  use MOD_COSP_CONFIG,       only: N_HYDRO,RTTOV_MAX_CHANNELS, &
     78                                    niv_sorties, vgrid_z_in
     79  use mod_quickbeam_optics,  only: size_distribution,hydro_class_init, &
     80                                   quickbeam_optics_init
     81  use quickbeam,            only: radar_cfg
     82  use mod_cosp,            only: cosp_init,cosp_optical_inputs, &
     83                                  cosp_column_inputs,cosp_outputs, &
     84                                  cosp_simulator
    8585
    8686
     
    9494
    9595  ! Local variables
    96   character(len=64),PARAMETER   :: cosp_input_nl  = 'cosp_input_nl.txt'
    97   character(len=64),PARAMETER   :: cosp_output_nl = 'cosp_output_nl.txt'
     96  character(len=64),PARAMETER   :: cosp_input_nl  = 'cospv2_input_nl.txt'
     97  character(len=64),PARAMETER   :: cosp_output_nl = 'cospv2_output_nl.txt'
    9898
    9999  integer, save                 :: isccp_topheight, isccp_topheight_direction, overlap
     
    198198
    199199! Parametres qui sont lus a partir du fichier "cosp_input_nl.txt"
    200    namelist/COSP_INPUT/overlap, isccp_topheight, isccp_topheight_direction,       &
    201               npoints_it, ncolumns, use_vgrid_in, csat_vgrid_in,                  &
    202               cloudsat_radar_freq, surface_radar, use_mie_tables,                 &
    203               cloudsat_use_gas_abs, cloudsat_do_ray, melt_lay, cloudsat_k2,       &
    204               cloudsat_micro_scheme, lidar_ice_type, use_precipitation_fluxes,    &
     200   namelist/COSP_INPUT/overlap, isccp_topheight, isccp_topheight_direction,  &
     201              npoints_it, ncolumns, use_vgrid_in, csat_vgrid_in,  &
     202              cloudsat_radar_freq, surface_radar, use_mie_tables,  &
     203              cloudsat_use_gas_abs, cloudsat_do_ray, melt_lay, cloudsat_k2, &
     204              cloudsat_micro_scheme, lidar_ice_type, use_precipitation_fluxes,   &
    205205              rttov_platform, rttov_satellite, rttov_Instrument, rttov_Nchannels, &
    206206              rttov_Channels, rttov_Surfem, rttov_ZenAng, co2, ch4, n2o, co
     
    215215!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    216216
    217  print*,'Entree lmdz_cosp_interface' !phys_cosp2'
    218  if (debut_cosp) then
     217print*,'Entree lmdz_cosp_interface' !phys_cosp2'
     218if (debut_cosp) then
    219219  NPoints=Nptslmdz
    220220  Nlevels=Nlevlmdz
     
    261261    print*,'ok read  cosp_input_nl'
    262262
    263 
    264 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    265 !
    266 ! 2) Initialisation de COSPv2
    267 !
    268 ! Il y a 2 options possibles pour ecrire les sorties : XIOS ou sorties standard
    269 !
    270 ! Si le modele a ete compile AVEC l'option xios, le programme passe par les
    271 ! bouts de code delimites par "#ifdef CPP_XIOS" et "#else". Dans ce cas,
    272 ! l'initialisation de COSP se fait au deuxieme appel de cette interface.
    273 !
    274 ! Si le modele a ete compile SANS l'option xios, le programme passe par les
    275 ! bouts de code delimites par "#else" et "#endif". Dans ce cas,
    276 ! l'initialisation de COSP se fait au premier appel de cette interface.
    277 !
    278 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    279 
    280263! Clefs Outputs initialisation
    281264#ifdef CPP_XIOS
     
    286269
    287270  print*,' Cles des differents simulateurs cosp a itap :',itap
    288 print*,'cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, &
     271  print*,'cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, &
    289272        cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov', &
    290273        cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, &
    291         cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov
     274        cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov
    292275
    293276    if (overlaplmdz.ne.overlap) then
     
    309292    call quickbeam_optics_init()
    310293
    311  print*,' just before call COSP_INIT, cosp_init_flag =', cosp_init_flag
     294  print*,' just before call COSP_INIT, cosp_init_flag =', cosp_init_flag
    312295  call COSP_INIT(cfg%Lisccp, cfg%Lmodis, cfg%Lmisr, cfg%Lcloudsat, cfg%Lcalipso, &
    313                  cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, cfg%Lrttov,          &
    314                  cloudsat_radar_freq, cloudsat_k2, cloudsat_use_gas_abs,         &
    315                  cloudsat_do_ray, isccp_topheight, isccp_topheight_direction,    &
    316                 surface_radar, rcfg_cloudsat, use_vgrid_in, csat_vgrid_in,      &
    317                  niv_sorties, Nlevels, cloudsat_micro_scheme)
    318 cosp_init_flag = 1
     296        cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, cfg%Lrttov,          &
     297        cloudsat_radar_freq, cloudsat_k2, cloudsat_use_gas_abs,         &
     298        cloudsat_do_ray, isccp_topheight, isccp_topheight_direction,    &
     299        surface_radar, rcfg_cloudsat, use_vgrid_in, csat_vgrid_in,      &
     300        niv_sorties, Nlevels, cloudsat_micro_scheme)
     301  cosp_init_flag = 1
    319302 print*,' just after call COSP_INIT, cosp_init_flag =', cosp_init_flag
    320303endif
    321304#endif
    322305
    323    print*,'Fin lecture Namelists, debut_cosp =',debut_cosp
     306  print*,'Fin lecture Namelists, debut_cosp =',debut_cosp
    324307
    325308  endif ! debut_cosp
     
    327310
    328311!!! Ici on modifie les cles logiques pour les outputs selon les champs actives dans les .xml
    329   if ((itap.gt.1).and.(first_write))then
     312  if ((itap.ge.1).and.(first_write))then
    330313#ifdef CPP_XIOS
    331314    call read_xiosfieldactive(cfg)
     
    344327    call quickbeam_optics_init()
    345328
    346  print*,' just before call COSP_INIT, cosp_init_flag =', cosp_init_flag
     329  print*,' just before call COSP_INIT, cosp_init_flag =', cosp_init_flag
    347330  call COSP_INIT(cfg%Lisccp, cfg%Lmodis, cfg%Lmisr, cfg%Lcloudsat, cfg%Lcalipso, &
    348                  cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, cfg%Lrttov,          &
    349                  cloudsat_radar_freq, cloudsat_k2, cloudsat_use_gas_abs,         &
    350                  cloudsat_do_ray, isccp_topheight, isccp_topheight_direction,    &
    351                 surface_radar, rcfg_cloudsat, use_vgrid_in, csat_vgrid_in,      &
    352                  niv_sorties, Nlevels, cloudsat_micro_scheme)
    353 cosp_init_flag = 1
     331        cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, cfg%Lrttov,          &
     332        cloudsat_radar_freq, cloudsat_k2, cloudsat_use_gas_abs,         &
     333        cloudsat_do_ray, isccp_topheight, isccp_topheight_direction,    &
     334        surface_radar, rcfg_cloudsat, use_vgrid_in, csat_vgrid_in,      &
     335        niv_sorties, Nlevels, cloudsat_micro_scheme)
     336  cosp_init_flag = 1
    354337 print*,' just after call COSP_INIT, cosp_init_flag =', cosp_init_flag
    355338endif ! cosp_init_flag
     
    573556       print *, 'Calling write output'
    574557        call lmdz_cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, &
    575                                     missing_val, cfg, niv_sorties, cospOUT)
     558                                    missing_val, cfg, niv_sorties, cospOUT)
    576559
    577560!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cospv2/lmdz_cosp_output_write_mod.F90

    r3491 r3798  
    3030
    3131  SUBROUTINE lmdz_cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, missing_cosp, &
    32                                     cfg, Nlvgrid, cospOUT)
     32                                    cfg, Nlvgrid, cospOUT)
    3333
    3434
     
    4141  use mod_cosp,   only: cosp_outputs
    4242
    43 #ifdef CPP_XIOS
    4443    USE wxios, only: wxios_closedef
    4544    USE xios, only: xios_update_calendar, xios_field_is_active
    46 #endif
    4745  IMPLICIT NONE 
    4846!!! Variables d'entree
     
    6260! Variables locals intermidiaires pour inverser les axes des champs 4D
    6361! Compatibilite avec sorties CMIP
    64   real, dimension(Npoints,Nlevout,SR_BINS) :: tmp_fi4da_cfadL, tmp_fi4da_cfadLgr, tmp_fi4da_cfadLatlid
    65   real, dimension(Npoints,Nlevout,CLOUDSAT_DBZE_BINS) :: tmp_fi4da_cfadR
     62  real, dimension(Npoints,Nlvgrid,SR_BINS) :: tmp_fi4da_cfadL, tmp_fi4da_cfadLgr, tmp_fi4da_cfadLatlid
     63  real, dimension(Npoints,Nlvgrid,CLOUDSAT_DBZE_BINS) :: tmp_fi4da_cfadR
    6664  real, dimension(Npoints,numMISRHgtBins,7) :: tmp_fi4da_misr
    6765
    68 #ifdef CPP_XIOS
    6966  missing_val=missing_cosp
    70 #else
    71   missing_val=0.
    72 #endif
    7367
    7468  Nlevout = Nlvgrid
     
    9084    ok_sync = .TRUE.
    9185   
    92 !DO iinit=1, iinitend
    93 ! AI sept 2014 cette boucle supprimee
    94 ! On n'ecrit pas quand itap=1 (cosp)
    95 
    96 !   if (prt_level >= 10) then
    97 !         WRITE(lunout,*)'DO iinit=1, iinitend ',iinitend
    98 !   endif
    99 
    100 !!#ifdef CPP_XIOS
    101 ! !$OMP MASTER
    102 !IF (cosp_varsdefined) THEN
    103 !   if (prt_level >= 10) then
    104 !         WRITE(lunout,*)'Apell xios_update_calendar cosp_varsdefined iinitend ', &
    105 !                         cosp_varsdefined,iinitend
    106 !   endif
    107 !    CALL xios_update_calendar(itau_wcosp)
    108 !ENDIF
    109 !  !$OMP END MASTER
    110 !  !$OMP BARRIER
    111 !!#endif
    112 
    11386!!!! Sorties Calipso
    11487 if (cfg%Lcalipso) then
    115 !!! AI 02 2018
    116 ! Traitement missing_val
    117 !!!   where(stlidar%lidarcld == R_UNDEF) stlidar%lidarcld = missing_val
    118 !!!   where(sglidar%beta_mol == R_UNDEF) sglidar%beta_mol = missing_val 
    119 !!!   where(sglidar%beta_tot == R_UNDEF) sglidar%beta_tot = missing_val
    120 !!!   where(stlidar%cldlayer == R_UNDEF) stlidar%cldlayer = missing_val
    121 !   where(stlidar%cldtype == R_UNDEF) stlidar%cldtype = missing_val     !OPAQ
    122 !!!   where(stlidar%cfad_sr == R_UNDEF) stlidar%cfad_sr = missing_val
    123 ! AI 11 / 2015
    124 !!!   where(stlidar%parasolrefl == R_UNDEF) stlidar%parasolrefl = missing_val
    125 !!!   where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val
    126 !!!   where(stlidar%cldlayerphase == R_UNDEF) stlidar%cldlayerphase = missing_val
    127 !!!   where(stlidar%lidarcldphase == R_UNDEF) stlidar%lidarcldphase = missing_val
    128 !   where(stlidar%lidarcldtype == R_UNDEF) stlidar%lidarcldtype = missing_val   !OPAQ
    129 !!!   where(stlidar%lidarcldtmp == R_UNDEF) stlidar%lidarcldtmp = missing_val
    130 
    131 !!! missing values pour toutes les valeurs R_UNDEF des variables de CALIPSO
    132 !   where(cospOUT%calipso_betaperp_tot == R_UNDEF) cospOUT%calipso_betaperp_tot = missing_val
    133    where(cospOUT%calipso_beta_tot == R_UNDEF) cospOUT%calipso_beta_tot = missing_val
    134    where(cospOUT%calipso_tau_tot == R_UNDEF) cospOUT%calipso_tau_tot = missing_val
    135    where(cospOUT%calipso_lidarcldphase == R_UNDEF) cospOUT%calipso_lidarcldphase = missing_val
    136    where(cospOUT%calipso_lidarcldtype == R_UNDEF) cospOUT%calipso_lidarcldtype = missing_val
    137    where(cospOUT%calipso_cldlayerphase == R_UNDEF) cospOUT%calipso_cldlayerphase = missing_val
    138    where(cospOUT%calipso_lidarcldtmp == R_UNDEF)    cospOUT%calipso_lidarcldtmp = missing_val
    139    where(cospOUT%calipso_cfad_sr == R_UNDEF)        cospOUT%calipso_cfad_sr = missing_val
    140    where(cospOUT%calipso_lidarcld == R_UNDEF)       cospOUT%calipso_lidarcld = missing_val
    141    where(cospOUT%calipso_cldlayer == R_UNDEF)       cospOUT%calipso_cldlayer = missing_val
    142    where(cospOUT%calipso_cldtype == R_UNDEF)        cospOUT%calipso_cldtype = missing_val
    143    where(cospOUT%calipso_cldtypetemp == R_UNDEF)    cospOUT%calipso_cldtypetemp = missing_val
    144    where(cospOUT%calipso_cldtypemeanz == R_UNDEF)   cospOUT%calipso_cldtypemeanz = missing_val
    145    where(cospOUT%calipso_cldtypemeanzse == R_UNDEF) cospOUT%calipso_cldtypemeanzse = missing_val
    146    where(cospOUT%calipso_beta_mol == R_UNDEF)       cospOUT%calipso_beta_mol = missing_val
    147    where(cospOUT%calipso_temp_tot == R_UNDEF)       cospOUT%calipso_temp_tot = missing_val
    148    where(cospOUT%calipso_cldthinemis == R_UNDEF)    cospOUT%calipso_cldthinemis = missing_val
    149    where(cospOUT%calipso_srbval == R_UNDEF)         cospOUT%calipso_srbval = missing_val
    150 
    15188
    15289!   print*,'Appel histwrite2d_cosp'
    153    if (cfg%Lcllcalipso) CALL histwrite2d_cosp(o_cllcalipso,cospOUT%calipso_cldlayer(:,1))
    154    if (cfg%Lclhcalipso) CALL histwrite2d_cosp(o_clhcalipso,cospOUT%calipso_cldlayer(:,3))
    155    if (cfg%Lclmcalipso) CALL histwrite2d_cosp(o_clmcalipso,cospOUT%calipso_cldlayer(:,2))
    156    if (cfg%Lcltcalipso) CALL histwrite2d_cosp(o_cltcalipso,cospOUT%calipso_cldlayer(:,4))
    157    if (cfg%Lclcalipso) CALL histwrite3d_cosp(o_clcalipso,cospOUT%calipso_lidarcld,nvert)
    158    if (cfg%Lclcalipsotmp) CALL histwrite3d_cosp(o_clcalipsotmp,cospOUT%calipso_lidarcldtmp(:,:,1),nverttemp)
    159 
    160    if (cfg%Lcllcalipsoice) CALL histwrite2d_cosp(o_cllcalipsoice,cospOUT%calipso_cldlayerphase(:,1,1))
    161    if (cfg%Lclhcalipsoice) CALL histwrite2d_cosp(o_clhcalipsoice,cospOUT%calipso_cldlayerphase(:,3,1))
    162    if (cfg%Lclmcalipsoice) CALL histwrite2d_cosp(o_clmcalipsoice,cospOUT%calipso_cldlayerphase(:,2,1))
    163    if (cfg%Lcltcalipsoice) CALL histwrite2d_cosp(o_cltcalipsoice,cospOUT%calipso_cldlayerphase(:,4,1))
    164    if (cfg%Lclcalipsoice) CALL histwrite3d_cosp(o_clcalipsoice,cospOUT%calipso_lidarcldphase(:,:,1),nvert)
    165    if (cfg%Lclcalipsotmpice) CALL histwrite3d_cosp(o_clcalipsotmpice,cospOUT%calipso_lidarcldtmp(:,:,2),nverttemp)
    166 
    167    if (cfg%Lcllcalipsoliq) CALL histwrite2d_cosp(o_cllcalipsoliq,cospOUT%calipso_cldlayerphase(:,1,2))
    168    if (cfg%Lclhcalipsoliq) CALL histwrite2d_cosp(o_clhcalipsoliq,cospOUT%calipso_cldlayerphase(:,3,2))
    169    if (cfg%Lclmcalipsoliq) CALL histwrite2d_cosp(o_clmcalipsoliq,cospOUT%calipso_cldlayerphase(:,2,2))
    170    if (cfg%Lcltcalipsoliq) CALL histwrite2d_cosp(o_cltcalipsoliq,cospOUT%calipso_cldlayerphase(:,4,2))
    171    if (cfg%Lclcalipsoliq) CALL histwrite3d_cosp(o_clcalipsoliq,cospOUT%calipso_lidarcldphase(:,:,2),nvert)
    172    if (cfg%Lclcalipsotmpliq) CALL histwrite3d_cosp(o_clcalipsotmpliq,cospOUT%calipso_lidarcldtmp(:,:,3),nverttemp)
    173 
    174    if (cfg%Lcllcalipsoun) CALL histwrite2d_cosp(o_cllcalipsoun,cospOUT%calipso_cldlayerphase(:,1,3))
    175    if (cfg%Lclhcalipsoun) CALL histwrite2d_cosp(o_clhcalipsoun,cospOUT%calipso_cldlayerphase(:,3,3))
    176    if (cfg%Lclmcalipsoun) CALL histwrite2d_cosp(o_clmcalipsoun,cospOUT%calipso_cldlayerphase(:,2,3))
    177    if (cfg%Lcltcalipsoun) CALL histwrite2d_cosp(o_cltcalipsoun,cospOUT%calipso_cldlayerphase(:,4,3))
    178    if (cfg%Lclcalipsoun) CALL histwrite3d_cosp(o_clcalipsoun,cospOUT%calipso_lidarcldphase(:,:,3),nvert)
    179    if (cfg%Lclcalipsotmpun) CALL histwrite3d_cosp(o_clcalipsotmpun,cospOUT%calipso_lidarcldtmp(:,:,4),nverttemp)
    180 
    181    if (cfg%Lclopaquecalipso) CALL histwrite2d_cosp(o_clopaquecalipso,cospOUT%calipso_cldtype(:,1))
    182    if (cfg%Lclthincalipso) CALL histwrite2d_cosp(o_clthincalipso,cospOUT%calipso_cldtype(:,2))   
    183    if (cfg%Lclzopaquecalipso) CALL histwrite2d_cosp(o_clzopaquecalipso,cospOUT%calipso_cldtype(:,3))
    184    if (cfg%Lclcalipsoopaque) CALL histwrite3d_cosp(o_clcalipsoopaque,cospOUT%calipso_lidarcldtype(:,:,1),nvert)
    185    if (cfg%Lclcalipsothin) CALL histwrite3d_cosp(o_clcalipsothin,cospOUT%calipso_lidarcldtype(:,:,2),nvert) 
    186    if (cfg%Lclcalipsozopaque) CALL histwrite3d_cosp(o_clcalipsozopaque,cospOUT%calipso_lidarcldtype(:,:,3),nvert)
    187    if (cfg%Lclcalipsoopacity) CALL histwrite3d_cosp(o_clcalipsoopacity,cospOUT%calipso_lidarcldtype(:,:,4),nvert)
    188 
    189    if (cfg%Lclopaquetemp) CALL histwrite2d_cosp(o_clopaquetemp,cospOUT%calipso_cldtypetemp(:,1))
    190    if (cfg%Lclthintemp) CALL histwrite2d_cosp(o_clthintemp,cospOUT%calipso_cldtypetemp(:,2))
    191    if (cfg%Lclzopaquetemp) CALL histwrite2d_cosp(o_clzopaquetemp,cospOUT%calipso_cldtypetemp(:,3))
    192    if (cfg%Lclopaquemeanz) CALL histwrite2d_cosp(o_clopaquemeanz,cospOUT%calipso_cldtypemeanz(:,1))
    193    if (cfg%Lclthinmeanz) CALL histwrite2d_cosp(o_clthinmeanz,cospOUT%calipso_cldtypemeanz(:,2))
    194    if (cfg%Lclthinemis) CALL histwrite2d_cosp(o_clthinemis,cospOUT%calipso_cldthinemis)
    195    if (cfg%Lclopaquemeanzse) CALL histwrite2d_cosp(o_clopaquemeanzse,cospOUT%calipso_cldtypemeanzse(:,1))
    196    if (cfg%Lclthinmeanzse) CALL histwrite2d_cosp(o_clthinmeanzse,cospOUT%calipso_cldtypemeanzse(:,2))
    197    if (cfg%Lclzopaquecalipsose) CALL histwrite2d_cosp(o_clzopaquecalipsose,cospOUT%calipso_cldtypemeanzse(:,3))
    198 
    199 
    200 #ifdef CPP_XIOS
    201    do icl=1,SR_BINS
    202       tmp_fi4da_cfadL(:,:,icl)=cospOUT%calipso_cfad_sr(:,icl,:)
    203    enddo
     90   if (cfg%Lcllcalipso) then
     91      where(cospOUT%calipso_cldlayer(:,1) == R_UNDEF) cospOUT%calipso_cldlayer(:,1) = missing_val
     92      CALL histwrite2d_cosp(o_cllcalipso,cospOUT%calipso_cldlayer(:,1))
     93   endif
     94   if (cfg%Lclhcalipso) then
     95      where(cospOUT%calipso_cldlayer(:,3) == R_UNDEF) cospOUT%calipso_cldlayer(:,3) = missing_val
     96      CALL histwrite2d_cosp(o_clhcalipso,cospOUT%calipso_cldlayer(:,3))
     97   endif
     98   if (cfg%Lclmcalipso) then
     99      where(cospOUT%calipso_cldlayer(:,2) == R_UNDEF) cospOUT%calipso_cldlayer(:,2) = missing_val
     100      CALL histwrite2d_cosp(o_clmcalipso,cospOUT%calipso_cldlayer(:,2))
     101   endif
     102   if (cfg%Lcltcalipso) then
     103      where(cospOUT%calipso_cldlayer(:,4) == R_UNDEF) cospOUT%calipso_cldlayer(:,4) = missing_val
     104      CALL histwrite2d_cosp(o_cltcalipso,cospOUT%calipso_cldlayer(:,4))
     105   endif
     106   if (cfg%Lclcalipso) then
     107      where(cospOUT%calipso_lidarcld == R_UNDEF)    cospOUT%calipso_lidarcld = missing_val
     108      CALL histwrite3d_cosp(o_clcalipso,cospOUT%calipso_lidarcld,nvert)
     109   endif
     110   if (cfg%Lclcalipsotmp) then
     111      where(cospOUT%calipso_lidarcldtmp(:,:,1) == R_UNDEF) cospOUT%calipso_lidarcldtmp(:,:,1) = missing_val
     112      CALL histwrite3d_cosp(o_clcalipsotmp,cospOUT%calipso_lidarcldtmp(:,:,1),nverttemp)
     113   endif
     114
     115   if (cfg%Lcllcalipsoice) then
     116      where(cospOUT%calipso_cldlayerphase(:,1,1) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,1,1) = missing_val
     117      CALL histwrite2d_cosp(o_cllcalipsoice,cospOUT%calipso_cldlayerphase(:,1,1))
     118   endif
     119   if (cfg%Lclhcalipsoice) then
     120      where(cospOUT%calipso_cldlayerphase(:,3,1) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,3,1) = missing_val
     121      CALL histwrite2d_cosp(o_clhcalipsoice,cospOUT%calipso_cldlayerphase(:,3,1))
     122   endif
     123   if (cfg%Lclmcalipsoice) then
     124      where(cospOUT%calipso_cldlayerphase(:,2,1) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,2,1) = missing_val
     125      CALL histwrite2d_cosp(o_clmcalipsoice,cospOUT%calipso_cldlayerphase(:,2,1))
     126   endif
     127   if (cfg%Lcltcalipsoice) then
     128      where(cospOUT%calipso_cldlayerphase(:,4,1) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,4,1) = missing_val
     129      CALL histwrite2d_cosp(o_cltcalipsoice,cospOUT%calipso_cldlayerphase(:,4,1))
     130   endif
     131   if (cfg%Lclcalipsoice) then
     132      where(cospOUT%calipso_lidarcldphase(:,:,1) == R_UNDEF) cospOUT%calipso_lidarcldphase(:,:,1) = missing_val
     133      CALL histwrite3d_cosp(o_clcalipsoice,cospOUT%calipso_lidarcldphase(:,:,1),nvert)
     134   endif
     135   if (cfg%Lclcalipsotmpice) then
     136      where(cospOUT%calipso_lidarcldtmp(:,:,2) == R_UNDEF) cospOUT%calipso_lidarcldtmp(:,:,2) = missing_val
     137      CALL histwrite3d_cosp(o_clcalipsotmpice,cospOUT%calipso_lidarcldtmp(:,:,2),nverttemp)
     138   endif
     139
     140   if (cfg%Lcllcalipsoliq) then
     141      where(cospOUT%calipso_cldlayerphase(:,1,2) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,1,2) = missing_val
     142      CALL histwrite2d_cosp(o_cllcalipsoliq,cospOUT%calipso_cldlayerphase(:,1,2))
     143   endif
     144   if (cfg%Lclhcalipsoliq) then
     145      where(cospOUT%calipso_cldlayerphase(:,3,2) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,3,2) = missing_val
     146      CALL histwrite2d_cosp(o_clhcalipsoliq,cospOUT%calipso_cldlayerphase(:,3,2))
     147   endif
     148   if (cfg%Lclmcalipsoliq) then
     149      where(cospOUT%calipso_cldlayerphase(:,2,2) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,2,2) = missing_val
     150      CALL histwrite2d_cosp(o_clmcalipsoliq,cospOUT%calipso_cldlayerphase(:,2,2))
     151   endif
     152   if (cfg%Lcltcalipsoliq) then
     153      where(cospOUT%calipso_cldlayerphase(:,4,2) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,4,2) = missing_val
     154      CALL histwrite2d_cosp(o_cltcalipsoliq,cospOUT%calipso_cldlayerphase(:,4,2))
     155   endif
     156   if (cfg%Lclcalipsoliq) then
     157      where(cospOUT%calipso_lidarcldphase(:,:,2) == R_UNDEF) cospOUT%calipso_lidarcldphase(:,:,2) = missing_val
     158      CALL histwrite3d_cosp(o_clcalipsoliq,cospOUT%calipso_lidarcldphase(:,:,2),nvert)
     159   endif
     160   if (cfg%Lclcalipsotmpliq) then
     161      where(cospOUT%calipso_lidarcldtmp(:,:,3) == R_UNDEF) cospOUT%calipso_lidarcldtmp(:,:,3) = missing_val
     162      CALL histwrite3d_cosp(o_clcalipsotmpliq,cospOUT%calipso_lidarcldtmp(:,:,3),nverttemp)
     163   endif
     164   if (cfg%Lcllcalipsoun) then
     165      where(cospOUT%calipso_cldlayerphase(:,1,3) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,1,3) = missing_val
     166      CALL histwrite2d_cosp(o_cllcalipsoun,cospOUT%calipso_cldlayerphase(:,1,3))
     167   endif
     168   if (cfg%Lclhcalipsoun) then
     169      where(cospOUT%calipso_cldlayerphase(:,3,3) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,3,3) = missing_val
     170      CALL histwrite2d_cosp(o_clhcalipsoun,cospOUT%calipso_cldlayerphase(:,3,3))
     171   endif
     172   if (cfg%Lclmcalipsoun) then
     173      where(cospOUT%calipso_cldlayerphase(:,2,3) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,2,3) = missing_val
     174      CALL histwrite2d_cosp(o_clmcalipsoun,cospOUT%calipso_cldlayerphase(:,2,3))
     175   endif
     176   if (cfg%Lcltcalipsoun) then
     177      where(cospOUT%calipso_cldlayerphase(:,4,3) == R_UNDEF) cospOUT%calipso_cldlayerphase(:,4,3) = missing_val
     178      CALL histwrite2d_cosp(o_cltcalipsoun,cospOUT%calipso_cldlayerphase(:,4,3))
     179   endif
     180   if (cfg%Lclcalipsoun) then
     181      where(cospOUT%calipso_lidarcldphase(:,:,3) == R_UNDEF) cospOUT%calipso_lidarcldphase(:,:,3) = missing_val
     182      CALL histwrite3d_cosp(o_clcalipsoun,cospOUT%calipso_lidarcldphase(:,:,3),nvert)
     183   endif
     184   if (cfg%Lclcalipsotmpun) then
     185      where(cospOUT%calipso_lidarcldtmp(:,:,4) == R_UNDEF) cospOUT%calipso_lidarcldtmp(:,:,4) = missing_val
     186      CALL histwrite3d_cosp(o_clcalipsotmpun,cospOUT%calipso_lidarcldtmp(:,:,4),nverttemp)
     187   endif
     188
     189   if (cfg%Lclopaquecalipso) then
     190      where(cospOUT%calipso_cldtype(:,1) == R_UNDEF) cospOUT%calipso_cldtype(:,1) = missing_val
     191      CALL histwrite2d_cosp(o_clopaquecalipso,cospOUT%calipso_cldtype(:,1))
     192   endif
     193   if (cfg%Lclthincalipso) then
     194      where(cospOUT%calipso_cldtype(:,2) == R_UNDEF) cospOUT%calipso_cldtype(:,2) = missing_val
     195      CALL histwrite2d_cosp(o_clthincalipso,cospOUT%calipso_cldtype(:,2))   
     196   endif
     197   if (cfg%Lclzopaquecalipso) then
     198      where(cospOUT%calipso_cldtype(:,3) == R_UNDEF) cospOUT%calipso_cldtype(:,3) = missing_val     
     199      CALL histwrite2d_cosp(o_clzopaquecalipso,cospOUT%calipso_cldtype(:,3))
     200   endif
     201   if (cfg%Lclcalipsoopaque) then
     202      where(cospOUT%calipso_lidarcldtype(:,:,1) == R_UNDEF) cospOUT%calipso_lidarcldtype(:,:,1) = missing_val     
     203      CALL histwrite3d_cosp(o_clcalipsoopaque,cospOUT%calipso_lidarcldtype(:,:,1),nvert)
     204   endif
     205   if (cfg%Lclcalipsothin) then
     206      where(cospOUT%calipso_lidarcldtype(:,:,2) == R_UNDEF) cospOUT%calipso_lidarcldtype(:,:,2) = missing_val
     207      CALL histwrite3d_cosp(o_clcalipsothin,cospOUT%calipso_lidarcldtype(:,:,2),nvert) 
     208   endif
     209   if (cfg%Lclcalipsozopaque) then
     210      where(cospOUT%calipso_lidarcldtype(:,:,3) == R_UNDEF) cospOUT%calipso_lidarcldtype(:,:,3) = missing_val
     211      CALL histwrite3d_cosp(o_clcalipsozopaque,cospOUT%calipso_lidarcldtype(:,:,3),nvert)
     212   endif
     213   if (cfg%Lclcalipsoopacity) then
     214      where(cospOUT%calipso_lidarcldtype(:,:,4) == R_UNDEF) cospOUT%calipso_lidarcldtype(:,:,4) = missing_val
     215      CALL histwrite3d_cosp(o_clcalipsoopacity,cospOUT%calipso_lidarcldtype(:,:,4),nvert)
     216   endif
     217
     218   if (cfg%Lclopaquetemp) then
     219      where(cospOUT%calipso_cldtypetemp(:,1) == R_UNDEF) cospOUT%calipso_cldtypetemp(:,1) = missing_val
     220      CALL histwrite2d_cosp(o_clopaquetemp,cospOUT%calipso_cldtypetemp(:,1))
     221   endif
     222   if (cfg%Lclthintemp) then
     223      where(cospOUT%calipso_cldtypetemp(:,2) == R_UNDEF) cospOUT%calipso_cldtypetemp(:,2) = missing_val
     224      CALL histwrite2d_cosp(o_clthintemp,cospOUT%calipso_cldtypetemp(:,2))
     225   endif
     226   if (cfg%Lclzopaquetemp) then
     227      where(cospOUT%calipso_cldtypetemp(:,3) == R_UNDEF) cospOUT%calipso_cldtypetemp(:,3) = missing_val
     228      CALL histwrite2d_cosp(o_clzopaquetemp,cospOUT%calipso_cldtypetemp(:,3))
     229   endif
     230   if (cfg%Lclopaquemeanz) then
     231      where(cospOUT%calipso_cldtypemeanz(:,1) == R_UNDEF) cospOUT%calipso_cldtypemeanz(:,1) = missing_val
     232      CALL histwrite2d_cosp(o_clopaquemeanz,cospOUT%calipso_cldtypemeanz(:,1))
     233   endif
     234   if (cfg%Lclthinmeanz) then
     235      where(cospOUT%calipso_cldtypemeanz(:,2) == R_UNDEF) cospOUT%calipso_cldtypemeanz(:,2) = missing_val
     236      CALL histwrite2d_cosp(o_clthinmeanz,cospOUT%calipso_cldtypemeanz(:,2))
     237   endif
     238   if (cfg%Lclthinemis) then
     239      where(cospOUT%calipso_cldthinemis == R_UNDEF) cospOUT%calipso_cldthinemis = missing_val
     240      CALL histwrite2d_cosp(o_clthinemis,cospOUT%calipso_cldthinemis)
     241   endif
     242   if (cfg%Lclopaquemeanzse) then
     243      where(cospOUT%calipso_cldtypemeanzse(:,1) == R_UNDEF) cospOUT%calipso_cldtypemeanzse(:,1) = missing_val
     244      CALL histwrite2d_cosp(o_clopaquemeanzse,cospOUT%calipso_cldtypemeanzse(:,1))
     245   endif
     246   if (cfg%Lclthinmeanzse) then
     247      where(cospOUT%calipso_cldtypemeanzse(:,2) == R_UNDEF) cospOUT%calipso_cldtypemeanzse(:,2) = missing_val
     248      CALL histwrite2d_cosp(o_clthinmeanzse,cospOUT%calipso_cldtypemeanzse(:,2))
     249   endif
     250   if (cfg%Lclzopaquecalipsose) then
     251      where(cospOUT%calipso_cldtypemeanzse(:,3) == R_UNDEF) cospOUT%calipso_cldtypemeanzse(:,3) = missing_val
     252      CALL histwrite2d_cosp(o_clzopaquecalipsose,cospOUT%calipso_cldtypemeanzse(:,3))
     253   endif
     254
     255
     256   if (cfg%LcfadLidarsr532) then
     257     where(cospOUT%calipso_cfad_sr == R_UNDEF) cospOUT%calipso_cfad_sr = missing_val
     258   
     259     do icl=1,SR_BINS
     260      do k=1,Nlvgrid
     261       do ip=1,Npoints
     262        tmp_fi4da_cfadL(ip,k,icl)=cospOUT%calipso_cfad_sr(ip,icl,k)
     263       enddo
     264      enddo
     265     enddo
    204266!   if (cfg%LcfadLidarsr532) CALL histwrite4d_cosp(o_cfad_lidarsr532,stlidar%cfad_sr)
    205    if (cfg%LcfadLidarsr532) CALL histwrite4d_cosp(o_cfadLidarsr532,tmp_fi4da_cfadL)   !!! "_" enleve
    206 #else
    207    if (cfg%LcfadLidarsr532) then
    208      do icl=1,SR_BINS
    209         CALL histwrite3d_cosp(o_cfadLidarsr532,cospOUT%calipso_cfad_sr(:,icl,:),nvert,icl)   !!! "_" enleve
    210      enddo
    211    endif
    212 #endif
    213 
    214 #ifdef CPP_XIOS
    215    if (cfg%Latb532) CALL histwrite4d_cosp(o_atb532,cospOUT%calipso_beta_tot)
    216 #else
     267    CALL histwrite4d_cosp(o_cfadLidarsr532,tmp_fi4da_cfadL)   !!! "_" enleve
     268   endif
     269
    217270   if (cfg%Latb532) then 
    218      do icl=1,Ncolumns
    219         CALL histwrite3d_cosp(o_atb532,cospOUT%calipso_beta_tot(:,icl,:),nvertmcosp,icl)
    220      enddo
    221    endif
    222 #endif
    223 
    224    if (cfg%LlidarBetaMol532) CALL histwrite3d_cosp(o_lidarBetaMol532,cospOUT%calipso_beta_mol,nvertmcosp)
     271     where(cospOUT%calipso_beta_tot == R_UNDEF) cospOUT%calipso_beta_tot = missing_val
     272     CALL histwrite4d_cosp(o_atb532,cospOUT%calipso_beta_tot)
     273   endif
     274   if (cfg%LlidarBetaMol532) then
     275     where(cospOUT%calipso_beta_mol == R_UNDEF) cospOUT%calipso_beta_mol = missing_val
     276     CALL histwrite3d_cosp(o_lidarBetaMol532,cospOUT%calipso_beta_mol,nvertmcosp)
     277   endif
    225278
    226279 endif !Calipso
     
    229282!!!! Sorties Ground Lidar
    230283 if (cfg%LgrLidar532) then
    231 
    232    where(cospOUT%grLidar532_beta_tot == R_UNDEF) cospOUT%grLidar532_beta_tot = missing_val
    233    where(cospOUT%grLidar532_cfad_sr == R_UNDEF) cospOUT%grLidar532_cfad_sr = missing_val
    234    where(cospOUT%grLidar532_lidarcld == R_UNDEF) cospOUT%grLidar532_lidarcld = missing_val
    235    where(cospOUT%grLidar532_cldlayer == R_UNDEF) cospOUT%grLidar532_cldlayer = missing_val
    236    where(cospOUT%grLidar532_beta_mol == R_UNDEF) cospOUT%grLidar532_beta_mol = missing_val
    237    where(cospOUT%grLidar532_srbval == R_UNDEF) cospOUT%grLidar532_srbval = missing_val
    238 
    239    if (cfg%LcllgrLidar532) CALL histwrite2d_cosp(o_cllgrLidar532,cospOUT%grLidar532_cldlayer(:,1))
    240    if (cfg%LclmgrLidar532) CALL histwrite2d_cosp(o_clmgrLidar532,cospOUT%grLidar532_cldlayer(:,2))
    241    if (cfg%LclhgrLidar532) CALL histwrite2d_cosp(o_clhgrLidar532,cospOUT%grLidar532_cldlayer(:,3))
    242    if (cfg%LcltgrLidar532) CALL histwrite2d_cosp(o_cltgrLidar532,cospOUT%grLidar532_cldlayer(:,4))
    243 
    244    if (cfg%LclgrLidar532) CALL histwrite3d_cosp(o_clgrLidar532,cospOUT%grLidar532_lidarcld,nvert)
    245    if (cfg%LlidarBetaMol532gr) CALL histwrite3d_cosp(o_lidarBetaMol532gr,cospOUT%grLidar532_beta_mol,nvertmcosp)
    246 
    247 #ifdef CPP_XIOS
    248    do icl=1,SR_BINS
    249       tmp_fi4da_cfadLgr(:,:,icl)=cospOUT%grLidar532_cfad_sr(:,icl,:)
    250    enddo
    251    if (cfg%LcfadLidarsr532gr) CALL histwrite4d_cosp(o_cfadLidarsr532gr,tmp_fi4da_cfadLgr)
    252 #else
     284! AI juin 2020 Voir a quoi correspond ce champs
     285!   where(cospOUT%grLidar532_srbval == R_UNDEF) cospOUT%grLidar532_srbval = missing_val
     286
     287   if (cfg%LcllgrLidar532) then
     288      where(cospOUT%grLidar532_cldlayer(:,1) == R_UNDEF) cospOUT%grLidar532_cldlayer(:,1) = missing_val
     289      CALL histwrite2d_cosp(o_cllgrLidar532,cospOUT%grLidar532_cldlayer(:,1))
     290   endif
     291   if (cfg%LclmgrLidar532) then
     292      where(cospOUT%grLidar532_cldlayer(:,2) == R_UNDEF) cospOUT%grLidar532_cldlayer(:,2) = missing_val
     293      CALL histwrite2d_cosp(o_clmgrLidar532,cospOUT%grLidar532_cldlayer(:,2))
     294   endif
     295   if (cfg%LclhgrLidar532) then
     296      where(cospOUT%grLidar532_cldlayer(:,3) == R_UNDEF) cospOUT%grLidar532_cldlayer(:,3) = missing_val
     297      CALL histwrite2d_cosp(o_clhgrLidar532,cospOUT%grLidar532_cldlayer(:,3))
     298   endif
     299   if (cfg%LcltgrLidar532) then
     300      where(cospOUT%grLidar532_cldlayer(:,4) == R_UNDEF) cospOUT%grLidar532_cldlayer(:,4) = missing_val
     301      CALL histwrite2d_cosp(o_cltgrLidar532,cospOUT%grLidar532_cldlayer(:,4))
     302   endif
     303
     304   if (cfg%LclgrLidar532) then
     305       where(cospOUT%grLidar532_lidarcld == R_UNDEF) cospOUT%grLidar532_lidarcld = missing_val
     306      CALL histwrite3d_cosp(o_clgrLidar532,cospOUT%grLidar532_lidarcld,nvert)
     307   endif
     308   if (cfg%LlidarBetaMol532gr) then
     309      where(cospOUT%grLidar532_beta_mol == R_UNDEF) cospOUT%grLidar532_beta_mol = missing_val
     310      CALL histwrite3d_cosp(o_lidarBetaMol532gr,cospOUT%grLidar532_beta_mol,nvertmcosp)
     311   endif
    253312   if (cfg%LcfadLidarsr532gr) then
     313     where(cospOUT%grLidar532_cfad_sr == R_UNDEF) cospOUT%grLidar532_cfad_sr = missing_val
    254314     do icl=1,SR_BINS
    255         CALL histwrite3d_cosp(o_cfadLidarsr532gr,cospOUT%grLidar532_cfad_sr(:,icl,:),nvert,icl)
     315      do k=1,Nlvgrid
     316       do ip=1,Npoints
     317         tmp_fi4da_cfadLgr(ip,k,icl)=cospOUT%grLidar532_cfad_sr(ip,icl,k)
     318       enddo
     319      enddo
    256320     enddo
    257    endif
    258 #endif
    259 
    260 #ifdef CPP_XIOS
    261    if (cfg%Latb532gr) CALL histwrite4d_cosp(o_atb532gr,cospOUT%grLidar532_beta_tot)
    262 #else
    263    if (cfg%Latb532gr) then 
    264      do icl=1,Ncolumns
    265         CALL histwrite3d_cosp(o_atb532gr,cospOUT%grLidar532_beta_tot(:,icl,:),nvertmcosp,icl)
    266      enddo
    267    endif
    268 #endif
    269 
     321     CALL histwrite4d_cosp(o_cfadLidarsr532gr,tmp_fi4da_cfadLgr)
     322   endif
     323
     324   if (cfg%Latb532gr) then
     325      where(cospOUT%grLidar532_beta_tot == R_UNDEF) cospOUT%grLidar532_beta_tot = missing_val
     326      CALL histwrite4d_cosp(o_atb532gr,cospOUT%grLidar532_beta_tot)
     327   endif
    270328endif ! Ground Lidar 532 nm
    271329
     
    273331!!!! Sorties Atlid
    274332 if (cfg%Latlid) then
    275 
    276    where(cospOUT%atlid_beta_tot == R_UNDEF) cospOUT%atlid_beta_tot = missing_val
    277    where(cospOUT%atlid_cfad_sr == R_UNDEF) cospOUT%atlid_cfad_sr = missing_val
    278    where(cospOUT%atlid_lidarcld == R_UNDEF) cospOUT%atlid_lidarcld = missing_val
    279    where(cospOUT%atlid_cldlayer == R_UNDEF) cospOUT%atlid_cldlayer = missing_val
    280    where(cospOUT%atlid_beta_mol == R_UNDEF) cospOUT%atlid_beta_mol = missing_val
    281    where(cospOUT%atlid_srbval == R_UNDEF) cospOUT%atlid_srbval = missing_val
    282 
    283    if (cfg%Lcllatlid) CALL histwrite2d_cosp(o_cllatlid,cospOUT%atlid_cldlayer(:,1))
    284    if (cfg%Lclmatlid) CALL histwrite2d_cosp(o_clmatlid,cospOUT%atlid_cldlayer(:,2))
    285    if (cfg%Lclhatlid) CALL histwrite2d_cosp(o_clhatlid,cospOUT%atlid_cldlayer(:,3))
    286    if (cfg%Lcltatlid) CALL histwrite2d_cosp(o_cltatlid,cospOUT%atlid_cldlayer(:,4))
    287 
    288    if (cfg%Lclatlid) CALL histwrite3d_cosp(o_clatlid,cospOUT%atlid_lidarcld,nvert)
    289    if (cfg%LlidarBetaMol355) CALL histwrite3d_cosp(o_lidarBetaMol355,cospOUT%atlid_beta_mol,nvertmcosp)
    290 
    291 #ifdef CPP_XIOS
    292    do icl=1,SR_BINS
    293       tmp_fi4da_cfadLatlid(:,:,icl)=cospOUT%atlid_cfad_sr(:,icl,:)
    294    enddo
    295    if (cfg%LcfadLidarsr355) CALL histwrite4d_cosp(o_cfadlidarsr355,tmp_fi4da_cfadLatlid)
    296 #else
     333! AI juin 2020 Voir a quoi correspond ce champs
     334!   where(cospOUT%atlid_srbval == R_UNDEF) cospOUT%atlid_srbval = missing_val
     335
     336   if (cfg%Lcllatlid) then
     337      where(cospOUT%atlid_cldlayer(:,1) == R_UNDEF) cospOUT%atlid_cldlayer(:,1) = missing_val
     338      CALL histwrite2d_cosp(o_cllatlid,cospOUT%atlid_cldlayer(:,1))
     339   endif
     340   if (cfg%Lclmatlid) then
     341      where(cospOUT%atlid_cldlayer(:,2) == R_UNDEF) cospOUT%atlid_cldlayer(:,2) = missing_val
     342      CALL histwrite2d_cosp(o_clmatlid,cospOUT%atlid_cldlayer(:,2))
     343   endif
     344   if (cfg%Lclhatlid) then
     345      where(cospOUT%atlid_cldlayer(:,3) == R_UNDEF) cospOUT%atlid_cldlayer(:,3) = missing_val
     346      CALL histwrite2d_cosp(o_clhatlid,cospOUT%atlid_cldlayer(:,3))
     347   endif
     348   if (cfg%Lcltatlid) then
     349      where(cospOUT%atlid_cldlayer(:,4) == R_UNDEF) cospOUT%atlid_cldlayer(:,4) = missing_val
     350      CALL histwrite2d_cosp(o_cltatlid,cospOUT%atlid_cldlayer(:,4))
     351   endif
     352   if (cfg%Lclatlid) then
     353      where(cospOUT%atlid_lidarcld == R_UNDEF) cospOUT%atlid_lidarcld = missing_val
     354      CALL histwrite3d_cosp(o_clatlid,cospOUT%atlid_lidarcld,nvert)
     355   endif
     356   if (cfg%LlidarBetaMol355) then
     357      where(cospOUT%atlid_beta_mol == R_UNDEF) cospOUT%atlid_beta_mol = missing_val
     358      CALL histwrite3d_cosp(o_lidarBetaMol355,cospOUT%atlid_beta_mol,nvertmcosp)
     359   endif
    297360   if (cfg%LcfadLidarsr355) then
     361     where(cospOUT%atlid_cfad_sr == R_UNDEF) cospOUT%atlid_cfad_sr = missing_val
    298362     do icl=1,SR_BINS
    299         CALL histwrite3d_cosp(o_cfadlidarsr355,cospOUT%atlid_cfad_sr(:,icl,:),nvert,icl)
     363      do k=1,Nlvgrid
     364       do ip=1,Npoints
     365          tmp_fi4da_cfadLatlid(ip,k,icl)=cospOUT%atlid_cfad_sr(ip,icl,k)
     366       enddo
     367      enddo
    300368     enddo
    301    endif
    302 #endif
    303 
    304 #ifdef CPP_XIOS
    305    if (cfg%Latb355) CALL histwrite4d_cosp(o_atb355,cospOUT%atlid_beta_tot)
    306 #else
    307    if (cfg%Latb355) then 
    308      do icl=1,Ncolumns
    309         CALL histwrite3d_cosp(o_atb355,cospOUT%atlid_beta_tot(:,icl,:),nvertmcosp,icl)
    310      enddo
    311    endif
    312 #endif
    313 
     369     CALL histwrite4d_cosp(o_cfadlidarsr355,tmp_fi4da_cfadLatlid)
     370   endif
     371
     372   if (cfg%Latb355) then
     373      where(cospOUT%atlid_beta_tot == R_UNDEF) cospOUT%atlid_beta_tot = missing_val
     374      CALL histwrite4d_cosp(o_atb355,cospOUT%atlid_beta_tot)
     375   endif
    314376endif ! Atlid
    315377
     
    317379 if (cfg%Lparasol) then
    318380   if (cfg%LparasolRefl) then
    319 ! Ces 2 diagnostics sont controles par la clef logique "LparasolRefl"
    320 
    321 !!!   if (cfg%LparasolRefl) CALL histwrite3d_cosp(o_parasolrefl,cospOUT%parasolrefl,nvertp)
     381     where(cospOUT%parasolGrid_refl == R_UNDEF) cospOUT%parasolGrid_refl = missing_val
     382     where(cospOUT%parasolPix_refl == R_UNDEF) cospOUT%parasolPix_refl = missing_val
    322383     CALL histwrite3d_cosp(o_parasolGrid_refl,cospOUT%parasolGrid_refl,nvertp)
    323 
    324 #ifdef CPP_XIOS
    325384     CALL histwrite4d_cosp(o_parasolPix_refl,cospOUT%parasolPix_refl)
    326 #else
    327      do icl=1,Ncolumns
    328         CALL histwrite3d_cosp(o_parasolPix_refl,cospOUT%parasolPix_refl(:,icl,:),nvertp,icl)
    329      enddo
    330 #endif
    331 
    332     endif ! LparasolRefl
    333    endif ! Parasol
     385   endif ! LparasolRefl
     386 endif ! Parasol
    334387
    335388!  if (cfg%LparasolRefl) then
     
    353406!!! Sorties CloudSat
    354407 if (cfg%Lcloudsat) then
    355 
    356    where(cospOUT%cloudsat_Ze_tot == R_UNDEF) cospOUT%cloudsat_Ze_tot = missing_val
    357    where(cospOUT%cloudsat_cfad_ze == R_UNDEF) cospOUT%cloudsat_cfad_ze = missing_val
    358    where(cospOUT%cloudsat_precip_cover == R_UNDEF) cospOUT%cloudsat_precip_cover = missing_val
    359    where(cospOUT%cloudsat_pia == R_UNDEF) cospOUT%cloudsat_pia = missing_val
    360 
    361    if (cfg%Lptradarflag0) CALL histwrite2d_cosp(o_ptradarflag0,cospOUT%cloudsat_precip_cover(:,1))
    362    if (cfg%Lptradarflag1) CALL histwrite2d_cosp(o_ptradarflag1,cospOUT%cloudsat_precip_cover(:,2))
    363    if (cfg%Lptradarflag2) CALL histwrite2d_cosp(o_ptradarflag2,cospOUT%cloudsat_precip_cover(:,3))
    364    if (cfg%Lptradarflag3) CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,4))
    365    if (cfg%Lptradarflag4) CALL histwrite2d_cosp(o_ptradarflag4,cospOUT%cloudsat_precip_cover(:,5))
    366    if (cfg%Lptradarflag5) CALL histwrite2d_cosp(o_ptradarflag5,cospOUT%cloudsat_precip_cover(:,6))
    367    if (cfg%Lptradarflag6) CALL histwrite2d_cosp(o_ptradarflag6,cospOUT%cloudsat_precip_cover(:,7))
    368    if (cfg%Lptradarflag7) CALL histwrite2d_cosp(o_ptradarflag7,cospOUT%cloudsat_precip_cover(:,8))
    369    if (cfg%Lptradarflag8) CALL histwrite2d_cosp(o_ptradarflag8,cospOUT%cloudsat_precip_cover(:,9))
    370    if (cfg%Lptradarflag9) CALL histwrite2d_cosp(o_ptradarflag9,cospOUT%cloudsat_precip_cover(:,10))
    371    if (cfg%Lradarpia) CALL histwrite2d_cosp(o_radarpia,cospOUT%cloudsat_pia)
    372 
    373 #ifdef CPP_XIOS
    374    do icl=1,CLOUDSAT_DBZE_BINS
    375      tmp_fi4da_cfadR(:,:,icl)=cospOUT%cloudsat_cfad_ze(:,icl,:)
    376    enddo
    377    if (cfg%Ldbze94) CALL histwrite4d_cosp(o_dbze94,cospOUT%cloudsat_Ze_tot)
    378 !   if (cfg%LcfadDbze94) CALL histwrite4d_cosp(o_cfadDbze94,stradar%cfad_ze)
    379    if (cfg%LcfadDbze94) CALL histwrite4d_cosp(o_cfadDbze94,tmp_fi4da_cfadR)
    380 #else
     408! AI juin 2020 voir a quoi correspond ce champs
     409!   where(cospOUT%cloudsat_pia == R_UNDEF) cospOUT%cloudsat_pia = missing_val
     410
     411   if (cfg%Lptradarflag0) then
     412     where(cospOUT%cloudsat_precip_cover(:,1) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,1) = missing_val
     413     CALL histwrite2d_cosp(o_ptradarflag0,cospOUT%cloudsat_precip_cover(:,1))
     414   endif
     415   if (cfg%Lptradarflag1) then
     416     where(cospOUT%cloudsat_precip_cover(:,2) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,2) = missing_val
     417     CALL histwrite2d_cosp(o_ptradarflag1,cospOUT%cloudsat_precip_cover(:,2))
     418   endif
     419   if (cfg%Lptradarflag2) then
     420      where(cospOUT%cloudsat_precip_cover(:,3) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,3) = missing_val
     421      CALL histwrite2d_cosp(o_ptradarflag2,cospOUT%cloudsat_precip_cover(:,3))
     422   endif
     423   if (cfg%Lptradarflag3) then
     424      where(cospOUT%cloudsat_precip_cover(:,4) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,4) = missing_val
     425      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,4))
     426   endif
     427   if (cfg%Lptradarflag4) then
     428      where(cospOUT%cloudsat_precip_cover(:,5) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,5) = missing_val
     429      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,5))
     430   endif
     431   if (cfg%Lptradarflag5) then
     432      where(cospOUT%cloudsat_precip_cover(:,6) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,6) = missing_val
     433      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,6))
     434   endif
     435   if (cfg%Lptradarflag6) then
     436      where(cospOUT%cloudsat_precip_cover(:,7) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,7) = missing_val
     437      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,7))
     438   endif
     439   if (cfg%Lptradarflag7) then
     440      where(cospOUT%cloudsat_precip_cover(:,8) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,8) = missing_val
     441      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,8))
     442   endif
     443   if (cfg%Lptradarflag8) then
     444      where(cospOUT%cloudsat_precip_cover(:,9) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,9) = missing_val
     445      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,9))
     446   endif
     447   if (cfg%Lptradarflag9) then
     448      where(cospOUT%cloudsat_precip_cover(:,10) == R_UNDEF) cospOUT%cloudsat_precip_cover(:,10) = missing_val
     449      CALL histwrite2d_cosp(o_ptradarflag3,cospOUT%cloudsat_precip_cover(:,10))
     450   endif
     451
    381452   if (cfg%Ldbze94) then
    382     do icl=1,Ncolumns
    383        CALL histwrite3d_cosp(o_dbze94,cospOUT%cloudsat_Ze_tot(:,icl,:),nvert,icl)
    384     enddo
    385    endif
    386    if (cfg%LcfadDbze94) then
    387     do icl=1,CLOUDSAT_DBZE_BINS
    388     CALL histwrite3d_cosp(o_cfadDbze94,cospOUT%cloudsat_cfad_ze(:,icl,:),nvert,icl)
    389     enddo
    390    endif
    391 #endif
     453     where(cospOUT%cloudsat_Ze_tot == R_UNDEF) cospOUT%cloudsat_Ze_tot = missing_val
     454     CALL histwrite4d_cosp(o_dbze94,cospOUT%cloudsat_Ze_tot)
     455   endif
     456   if (cfg%LcfadDbze94)  then
     457     where(cospOUT%cloudsat_cfad_ze == R_UNDEF) cospOUT%cloudsat_cfad_ze = missing_val 
     458     do icl=1,CLOUDSAT_DBZE_BINS
     459      do k=1,Nlvgrid
     460       do ip=1,Npoints
     461         tmp_fi4da_cfadR(ip,k,icl)=cospOUT%cloudsat_cfad_ze(ip,icl,k)
     462       enddo
     463      enddo
     464     enddo
     465     CALL histwrite4d_cosp(o_cfadDbze94,tmp_fi4da_cfadR)
     466  endif
    392467 endif
    393468! endif pour CloudSat
     
    396471!!! Sorties combinees Cloudsat et Calipso
    397472 if (cfg%Lcalipso .and. cfg%Lcloudsat) then
    398    where(cospOUT%lidar_only_freq_cloud == R_UNDEF) &
     473
     474   if (cfg%Lclcalipso2) then
     475     where(cospOUT%lidar_only_freq_cloud == R_UNDEF) &
    399476                           cospOUT%lidar_only_freq_cloud = missing_val
    400    where(cospOUT%cloudsat_tcc == R_UNDEF) &
     477     CALL histwrite3d_cosp(o_clcalipso2,cospOUT%lidar_only_freq_cloud,nvert)
     478   endif
     479   if (cfg%Lcloudsat_tcc) then
     480     where(cospOUT%cloudsat_tcc == R_UNDEF) &
    401481                           cospOUT%cloudsat_tcc = missing_val
    402    where(cospOUT%cloudsat_tcc2 == R_UNDEF) &
     482     CALL histwrite2d_cosp(o_cloudsat_tcc,cospOUT%cloudsat_tcc)
     483   endif
     484   if (cfg%Lcloudsat_tcc2) then
     485     where(cospOUT%cloudsat_tcc2 == R_UNDEF) &
    403486                           cospOUT%cloudsat_tcc2 = missing_val
    404    where(cospOUT%radar_lidar_tcc == R_UNDEF) &
    405                            cospOUT%radar_lidar_tcc = missing_val
    406 
    407    if (cfg%Lclcalipso2) CALL histwrite3d_cosp(o_clcalipso2,cospOUT%lidar_only_freq_cloud,nvert)
    408    if (cfg%Lcloudsat_tcc) CALL histwrite2d_cosp(o_cloudsat_tcc,cospOUT%cloudsat_tcc)
    409    if (cfg%Lcloudsat_tcc2) CALL histwrite2d_cosp(o_cloudsat_tcc2,cospOUT%cloudsat_tcc2)
    410    if (cfg%Lcltlidarradar) CALL histwrite2d_cosp(o_cltlidarradar,cospOUT%radar_lidar_tcc)
     487     CALL histwrite2d_cosp(o_cloudsat_tcc2,cospOUT%cloudsat_tcc2)
     488   endif
     489   if (cfg%Lcltlidarradar) then
     490     where(cospOUT%radar_lidar_tcc == R_UNDEF) &
     491                           cospOUT%radar_lidar_tcc = missing_val     
     492     CALL histwrite2d_cosp(o_cltlidarradar,cospOUT%radar_lidar_tcc)
     493   endif
    411494 endif
    412495
     
    425508
    426509!   CALL histwrite2d_cosp(o_sunlit,gbx%sunlit)
    427 #ifdef CPP_XIOS
    428510  if (cfg%Lclisccp) CALL histwrite4d_cosp(o_clisccp,cospOUT%isccp_fq)
    429 #else
    430    if (cfg%Lclisccp) then
    431      do icl=1,7
    432        CALL histwrite3d_cosp(o_clisccp,cospOUT%isccp_fq(:,icl,:),nvertisccp,icl)
    433      enddo
    434    endif
    435 #endif
    436511
    437512   if (cfg%Lboxtauisccp) CALL histwrite3d_cosp(o_boxtauisccp,cospOUT%isccp_boxtau,nvertcol)
     
    456531   where(cospOUT%misr_cldarea == R_UNDEF) cospOUT%misr_cldarea = missing_val
    457532
    458 #ifdef CPP_XIOS
    459533   do icl=1,numMISRHgtBins
    460       tmp_fi4da_misr(:,icl,:)=cospOUT%misr_fq(:,:,icl)
     534      do k=1,Nlvgrid
     535       do ip=1,Npoints   
     536      tmp_fi4da_misr(ip,icl,k)=cospOUT%misr_fq(ip,k,icl)
     537       enddo
     538      enddo
    461539   enddo
    462540!   if (cfg%LclMISR) CALL histwrite4d_cosp(o_clMISR,misr%fq_MISR)
    463541!   if (cfg%LclMISR) CALL histwrite4d_cosp(o_clMISR,tmp_fi4da_misr)
    464542   CALL histwrite4d_cosp(o_misr_fq,tmp_fi4da_misr)
    465 #else
    466     do icl=1,7
    467       CALL histwrite3d_cosp(o_misr_fq,cospOUT%misr_fq(:,icl,:),nvertmisr,icl)
    468     enddo
    469 #endif
    470543
    471544   CALL histwrite2d_cosp(o_misr_meanztop,cospOUT%misr_meanztop)
     
    540613          cospOUT%modis_Optical_thickness_vs_ReffLIQ = missing_val
    541614
    542 #ifdef CPP_XIOS
    543615    CALL histwrite4d_cosp(o_modis_ot_vs_ctp,cospOUT%modis_Optical_Thickness_vs_Cloud_Top_Pressure)
    544616    CALL histwrite4d_cosp(o_modis_ot_vs_reffice,cospOUT%modis_Optical_Thickness_vs_ReffICE)
    545617    CALL histwrite4d_cosp(o_modis_ot_vs_reffliq,cospOUT%modis_Optical_thickness_vs_ReffLIQ)
    546 #else
    547    do icl=1,7
    548    CALL histwrite3d_cosp(o_modis_ot_vs_ctp, &
    549      cospOUT%modis_Optical_Thickness_vs_Cloud_Top_Pressure(:,icl,:),nvertisccp,icl)
    550    CALL histwrite3d_cosp(o_modis_ot_vs_reffice, &
    551      cospOUT%modis_Optical_Thickness_vs_ReffICE(:,icl,:),nvertReffIce,icl)
    552    CALL histwrite3d_cosp(o_modis_ot_vs_reffliq, &
    553      cospOUT%modis_Optical_thickness_vs_ReffLIQ(:,icl,:),nvertReffLiq,icl)
    554    enddo
    555 #endif
    556 
    557 !#ifdef CPP_XIOS
    558 !  if (cfg%Lclmodis) CALL histwrite4d_cosp(o_crimodis,modis%Optical_Thickness_vs_ReffIce)
    559 !  if (cfg%Lclmodis) CALL histwrite4d_cosp(o_crlmodis,modis%Optical_Thickness_vs_ReffLiq)
    560 !#else
    561 !  if (cfg%Lclmodis) then
    562 !    do icl=1,7
    563 !     CALL histwrite3d_cosp(o_crimodis, &
    564 !          modis%Optical_Thickness_vs_ReffIce(:,icl,:),nvertReffIce,icl)
    565 !    enddo
    566 !  endif
    567 !  if (cfg%Lclmodis) then
    568 !    do icl=1,7
    569 !     CALL histwrite3d_cosp(o_crlmodis, &
    570 !          modis%Optical_Thickness_vs_ReffLiq(:,icl,:),nvertReffLiq,icl)
    571 !    enddo
    572 !  endif
    573 !#endif
     618
    574619  endif ! Lclmodis
    575620
     
    579624 IF(.NOT.cosp_varsdefined) THEN
    580625!$OMP MASTER
    581 #ifndef CPP_IOIPSL_NO_OUTPUT
    582             DO iff=1,3
    583                 IF (cosp_outfilekeys(iff)) THEN
    584                   CALL histend(cosp_nidfiles(iff))
    585                 ENDIF ! cosp_outfilekeys
    586             ENDDO !  iff
    587 #endif
    588626! Fermeture dans phys_output_write
    589 !#ifdef CPP_XIOS
     627!#ifdef 1
    590628            !On finalise l'initialisation:
    591629            !CALL wxios_closedef()
     
    599637    IF(cosp_varsdefined) THEN
    600638! On synchronise les fichiers pour IOIPSL
    601 #ifndef CPP_IOIPSL_NO_OUTPUT
    602 !$OMP MASTER
    603      DO iff=1,3
    604          IF (ok_sync .AND. cosp_outfilekeys(iff)) THEN
    605              CALL histsync(cosp_nidfiles(iff))
    606          ENDIF
    607      END DO
    608 !$OMP END MASTER
    609 #endif
    610639    ENDIF  !cosp_varsdefined
    611640
     
    628657    USE mod_grid_phy_lmdz, ONLY: nbp_lon
    629658    USE print_control_mod, ONLY: lunout,prt_level
    630 #ifdef CPP_XIOS
    631659  USE wxios
    632 #endif
    633660
    634661    IMPLICIT NONE
     
    662689    ENDIF
    663690
    664 #ifdef CPP_XIOS
    665691     IF (.not. ok_all_xml) then
    666692       IF ( var%cles(iff) ) THEN
     
    672698       ENDIF
    673699     ENDIF
    674 #endif
    675 
    676 #ifndef CPP_IOIPSL_NO_OUTPUT
    677        IF ( var%cles(iff) ) THEN
    678           CALL histdef (cosp_nidfiles(iff), var%name, var%description, var%unit, &
    679                nbp_lon,jj_nb,nhoricosp(iff), 1,1,1, -99, 32, &
    680                typeecrit, zstophym,zoutm_cosp(iff))
    681        ENDIF
    682 #endif
     700
    683701
    684702  END SUBROUTINE histdef2d_cosp
     
    693711    USE print_control_mod, ONLY: lunout,prt_level
    694712
    695 #ifdef CPP_XIOS
    696713  USE wxios
    697 #endif
    698714
    699715
     
    769785    ENDIF
    770786
    771 #ifdef CPP_XIOS
    772787      IF (.not. ok_all_xml) then
    773788        IF ( var%cles(iff) ) THEN
     
    779794        ENDIF
    780795      ENDIF
    781 #endif
    782 
    783 #ifndef CPP_IOIPSL_NO_OUTPUT
    784        IF ( var%cles(iff) ) THEN
    785           CALL histdef (cosp_nidfiles(iff), nom, var%description, var%unit, &
    786                nbp_lon, jj_nb, nhoricosp(iff), klevs, 1, &
    787                klevs, nvertsave, 32, typeecrit, &
    788                zstophym, zoutm_cosp(iff))
    789        ENDIF
    790 #endif
     796
    791797
    792798  END SUBROUTINE histdef3d_cosp
     
    801807  USE print_control_mod, ONLY: lunout,prt_level
    802808
    803 #ifdef CPP_XIOS
    804809  USE xios, only: xios_send_field
    805 #endif
    806810
    807811  IMPLICIT NONE
     
    826830  IF(.NOT.cosp_varsdefined) THEN
    827831!$OMP MASTER
     832      print*,'var, cosp_varsdefined dans cosp_varsdefined ',var%name, cosp_varsdefined
    828833      !Si phase de définition.... on définit
    829834      CALL conf_cospoutputs(var%name,var%cles)
     
    848853           IF (var%cles(iff) .AND. cosp_outfilekeys(iff)) THEN
    849854                ALLOCATE(index2d(nbp_lon*jj_nb))
    850 #ifndef CPP_IOIPSL_NO_OUTPUT
    851         CALL histwrite(cosp_nidfiles(iff),var%name,itau_iocosp,Field2d,nbp_lon*jj_nb,index2d)
    852 #endif
    853855                deallocate(index2d)
    854 #ifdef CPP_XIOS
    855856              IF (.not. ok_all_xml) then
    856857                 if (firstx) then
     
    862863                 endif
    863864              ENDIF
    864 #endif
    865865           ENDIF
    866866      ENDDO
    867867
    868 #ifdef CPP_XIOS
    869868      IF (ok_all_xml) THEN
    870869        if (prt_level >= 1) then
     
    873872       CALL xios_send_field(var%name, Field2d)
    874873      ENDIF
    875 #endif
    876874
    877875!$OMP END MASTER   
     
    891889  USE print_control_mod, ONLY: lunout,prt_level
    892890
    893 #ifdef CPP_XIOS
    894891  USE xios, only: xios_send_field
    895 #endif
    896892
    897893
     
    952948        IF (var%cles(iff) .AND. cosp_outfilekeys(iff)) THEN
    953949           ALLOCATE(index3d(nbp_lon*jj_nb*nlev))
    954 #ifndef CPP_IOIPSL_NO_OUTPUT
    955     CALL histwrite(cosp_nidfiles(iff),nom,itau_iocosp,Field3d,nbp_lon*jj_nb*nlev,index3d)
    956 #endif
    957 
    958 #ifdef CPP_XIOS
     950
    959951          IF (.not. ok_all_xml) then
    960952           IF (firstx) THEN
     
    964956           ENDIF
    965957          ENDIF
    966 #endif
    967958         deallocate(index3d)
    968959        ENDIF
    969960      ENDDO
    970 #ifdef CPP_XIOS
    971961    IF (ok_all_xml) THEN
    972962     CALL xios_send_field(nom, Field3d(:,:,1:nlev))
    973963     IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name
    974964    ENDIF
    975 #endif
    976965
    977966!$OMP END MASTER   
     
    991980  USE print_control_mod, ONLY: lunout,prt_level
    992981
    993 #ifdef CPP_XIOS
    994982  USE xios, only: xios_send_field
    995 #endif
    996983
    997984
     
    10231010    CALL grid1Dto2D_mpi(buffer_omp,field4d)
    10241011
    1025 #ifdef CPP_XIOS
    10261012!    IF (ok_all_xml) THEN
    10271013     CALL xios_send_field(var%name, Field4d(:,:,1:nlev,1:nlev2))
    10281014     IF (prt_level >= 1) WRITE(lunout,*)'xios_send_field ',var%name
    10291015!    ENDIF
    1030 #endif
    10311016
    10321017!$OMP END MASTER   
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cpl_mod.F90

    r3767 r3798  
    167167    cpl_old_calving=.FALSE.
    168168    CALL getin_p("cpl_old_calving",cpl_old_calving)
     169    WRITE(lunout,*)' cpl_old_calving = ', cpl_old_calving
    169170
    170171
     
    265266    ALLOCATE(cell_area2D(nbp_lon, jj_nb), stat = error)   
    266267    sum_error = sum_error + error
    267 
    268268
    269269    CALL gather_omp(longitude_deg,rlon_mpi)
     
    276276      CALL Grid1DTo2D_mpi(rlat_mpi,lat2D)
    277277      CALL Grid1DTo2D_mpi(cell_area_mpi,cell_area2D)
     278      !--the next line is required for lat-lon grid and should have no impact
     279      !--for an unstructured grid for which nbp_lon=1
     280      !--if north pole in process mpi then divide cell area of pole cell by number of replicates
     281      IF (is_north_pole_dyn) cell_area2D(:,1)=cell_area2D(:,1)/FLOAT(nbp_lon)
     282      !--if south pole in process mpi then divide cell area of pole cell by number of replicates
     283      IF (is_south_pole_dyn) cell_area2D(:,jj_nb)=cell_area2D(:,jj_nb)/FLOAT(nbp_lon)
    278284      mask_calving(:,:,:) = 0
    279285      WHERE ( lat2D >= 40) mask_calving(:,:,1) = 1
     
    303309    ENDIF
    304310   
    305            
    306311    IF (sum_error /= 0) THEN
    307312       abort_message='Pb allocation variables couplees'
     
    374379    ENDIF    ! is_sequential
    375380   
    376 
    377381!*************************************************************************************
    378382! compatibility test
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cv3_routines.F90

    r3617 r3798  
    888888! - relaxation of sig and w0 when no convection
    889889
    890 ! Caution1: if no convection, we set iflag=4
     890! Caution1: if no convection, we set iflag=14
    891891! (it used to be 0 in convect3)
    892892
     
    968968        sig(i, k) = amax1(sig(i,k), 0.0)
    969969        w0(i, k) = beta*w0(i, k)
    970         iflag(i) = 4 ! pour version vectorisee
     970        iflag(i) = 14 ! pour version vectorisee
    971971! convect3         iflag(i)=0
    972972      END IF
     
    11901190  REAL tg, qg, dqgdT, ahg, alv, alf, s, tc, es, esi, denom, rg, tca, elacrit
    11911191  REAL                                               :: phinu2p
    1192   REAL als
     1192  REAL                                               :: qhthreshold
     1193  REAL                                               :: als
    11931194  REAL                                               :: qsat_new, snew
    11941195  REAL, DIMENSION (nloc,nd)                          :: qi
     
    14941495            elacrit = elcrit*min(max(1.-(tp(i,k)-T0)/Tlcrit, 0.), 1.)                   !!jygprl
    14951496!!!!            qcld(i,k) = min(clw(i,k), elacrit)                                          !!jygprl
    1496             qcld(i,k) = min(clw(i,k), elacrit*(1.-qta(i,k-1))/(1.-elacrit))             !!jygprl
    1497             phinu2p = max(qhsat(i,k-1) + qcld(i,k-1) - (qhsat(i,k) + qcld(i,k)),0.)   !!jygprl
     1497            qhthreshold = elacrit*(1.-qta(i,k-1))/(1.-elacrit)
     1498            qcld(i,k) = min(clw(i,k), qhthreshold)             !!jygprl
     1499!!!!            phinu2p = max(qhsat(i,k-1) + qcld(i,k-1) - (qhsat(i,k) + qcld(i,k)),0.)   !!jygprl
     1500            phinu2p = max(clw(i,k) - max(qta(i,k-1) - qhsat(i,k-1), qhthreshold), 0.)
    14981501            qpl(i,k) = qpl(i,k-1) + (1.-frac(i,k))*phinu2p                            !!jygprl
    14991502            qps(i,k) = qps(i,k-1) + frac(i,k)     *phinu2p                            !!jygprl
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cv3p1_closure.F90

    r3605 r3798  
    4141
    4242  ! input/output:
     43  INTEGER, DIMENSION (nloc), INTENT (INOUT)          :: iflag
    4344  REAL, DIMENSION (nloc, nd), INTENT (INOUT)         :: sig, w0
    4445  REAL, DIMENSION (nloc), INTENT (INOUT)             :: ptop2
     
    5354  REAL, DIMENSION (nloc), INTENT (OUT)               :: cbmf, plfc
    5455  REAL, DIMENSION (nloc), INTENT (OUT)               :: wbeff
    55   INTEGER, DIMENSION (nloc), INTENT (OUT)            :: iflag
    5656
    5757  ! local variables:
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cv3p2_closure.F90

    r3605 r3798  
    4141
    4242  ! input/output:
     43  INTEGER, DIMENSION (nloc), INTENT (INOUT)          :: iflag
    4344  REAL, DIMENSION (nloc, nd), INTENT (INOUT)         :: sig, w0
    4445  REAL, DIMENSION (nloc), INTENT (INOUT)             :: ptop2
     
    5354  REAL, DIMENSION (nloc), INTENT (OUT)               :: cbmflast, plfc
    5455  REAL, DIMENSION (nloc), INTENT (OUT)               :: wbeff
    55   INTEGER, DIMENSION (nloc), INTENT (OUT)            :: iflag
    5656
    5757  ! local variables:
  • LMDZ6/branches/Ocean_skin/libf/phylmd/cva_driver.F90

    r3605 r3798  
    361361!               then the level NL-1.
    362362!        10     No moist convection: cloud top is too warm.
     363!        14     No moist convection; atmosphere is very
     364!               stable (=> no computation)
    363365!
    364366
     
    539541  CHARACTER (LEN=80) :: abort_message
    540542
     543  REAL, PARAMETER    :: Cin_noconv = -100000.
     544  REAL, PARAMETER    :: Cape_noconv = -1.
     545
    541546  INTEGER,SAVE                                       :: igout=1
    542547!$OMP THREADPRIVATE(igout)
     
    622627
    623628  DO il = 1, len
    624     cin1(il) = -100000.
    625     cape1(il) = -1.
     629!!    cin1(il) = -100000.
     630!!    cape1(il) = -1.
     631    cin1(il) = Cin_noconv
     632    cape1(il) = Cape_noconv
    626633  END DO
    627634
     
    12461253
    12471254  END IF ! ncum>0
     1255!
     1256!
     1257  DO i = 1,len
     1258    IF (iflag1(i) == 14) THEN
     1259      Cin1(i) = Cin_noconv
     1260      Cape1(i) = Cape_noconv
     1261    ENDIF
     1262  ENDDO
    12481263
    12491264!
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dimsoil.h

    r1907 r3798  
    44      INTEGER nsoilmx
    55      PARAMETER (nsoilmx=11)
     6
     7! For Inlandsis, Etienne Vignon:
     8
     9      INTEGER nsnowmx
     10      PARAMETER (nsnowmx=35)
     11     
     12      INTEGER nsismx
     13      PARAMETER (nsismx=46)
     14
     15! nsismx should be equal to nsoilmx+nsnowmx
     16
     17
     18
     19
     20
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/1DUTILS.h

    r3605 r3798  
    233233       CALL getin('ok_flux_surf',ok_flux_surf)
    234234
     235!Config  Key  = ok_forc_tsurf
     236!Config  Desc = forcage ou non par la Ts
     237!Config  Def  = false
     238!Config  Help = forcage ou non par la Ts
     239       ok_forc_tsurf=.false.
     240       CALL getin('ok_forc_tsurf',ok_forc_tsurf)
     241
    235242!Config  Key  = ok_prescr_ust
    236243!Config  Desc = ustar impose ou non
     
    239246       ok_prescr_ust = .false.
    240247       CALL getin('ok_prescr_ust',ok_prescr_ust)
     248
     249
     250!Config  Key  = ok_prescr_beta
     251!Config  Desc = betaevap impose ou non
     252!Config  Def  = false
     253!Config  Help = betaevap impose ou non
     254       ok_prescr_beta = .false.
     255       CALL getin('ok_prescr_beta',ok_prescr_beta)
    241256
    242257!Config  Key  = ok_old_disvert
     
    280295!Config  Desc = surface temperature
    281296!Config  Def  = 290.
    282 !Config  Help = not used if type_ts_forcing=1 in lmdz1d.F
     297!Config  Help = surface temperature
    283298       tsurf = 290.
    284299       CALL getin('tsurf',tsurf)
     
    297312       zsurf = 0.
    298313       CALL getin('zsurf',zsurf)
     314! EV pour accord avec format standard       
     315       CALL getin('zorog',zsurf)
     316
    299317
    300318!Config  Key  = rugos
     
    304322       rugos = 0.0001
    305323       CALL getin('rugos',rugos)
     324! FH/2020/04/08/confinement: Pour le nouveau format standard, la rugosite s'appelle z0
     325       CALL getin('z0',rugos)
    306326
    307327!Config  Key  = rugosh
     
    357377       qsolinp = 1.
    358378       CALL getin('qsolinp',qsolinp)
     379
     380
     381
     382!Config  Key  = betaevap
     383!Config  Desc = beta for actual evaporation when prescribed
     384!Config  Def  = 1.0
     385!Config  Help =
     386       betaevap = 1.
     387       CALL getin('betaevap',betaevap)     
    359388
    360389!Config  Key  = zpicinp
     
    518547       CALL getin('forc_ustar',forc_ustar)
    519548       IF (forc_ustar .EQ. 1) ok_prescr_ust=.true.
     549
    520550
    521551!Config  Key  = nudging_u
     
    12461276      END
    12471277
    1248 !======================================================================
    1249        SUBROUTINE read_tsurf1d(knon,sst_out)
    1250 
    1251 ! This subroutine specifies the surface temperature to be used in 1D simulations
    1252 
    1253       USE dimphy, ONLY : klon
    1254 
    1255       INTEGER, INTENT(IN)                  :: knon     ! nomber of points on compressed grid
    1256       REAL, DIMENSION(klon), INTENT(OUT)   :: sst_out  ! tsurf used to force the single-column model
    1257 
    1258        INTEGER :: i
    1259 ! COMMON defined in lmdz1d.F:
    1260        real ts_cur
    1261        common /sst_forcing/ts_cur
    1262 
    1263        DO i = 1, knon
    1264         sst_out(i) = ts_cur
    1265        ENDDO
    1266 
    1267       END SUBROUTINE read_tsurf1d
    1268 
     1278!!======================================================================
     1279!       SUBROUTINE read_tsurf1d(knon,sst_out)
     1280!
     1281!! This subroutine specifies the surface temperature to be used in 1D simulations
     1282!
     1283!      USE dimphy, ONLY : klon
     1284!
     1285!      INTEGER, INTENT(IN)                  :: knon     ! nomber of points on compressed grid
     1286!      REAL, DIMENSION(klon), INTENT(OUT)   :: sst_out  ! tsurf used to force the single-column model
     1287!
     1288!       INTEGER :: i
     1289!! COMMON defined in lmdz1d.F:
     1290!       real ts_cur
     1291!       common /sst_forcing/ts_cur
     1292
     1293!       DO i = 1, knon
     1294!        sst_out(i) = ts_cur
     1295!       ENDDO
     1296!
     1297!      END SUBROUTINE read_tsurf1d
     1298!
    12691299!===============================================================
    12701300      subroutine advect_vert(llm,w,dt,q,plev)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/1D_decl_cases.h

    r3605 r3798  
    3434        real w_mod(llm), t_mod(llm),q_mod(llm)
    3535        real u_mod(llm),v_mod(llm), ht_mod(llm),vt_mod(llm),ug_mod(llm),vg_mod(llm)
    36         real temp_nudg_mod(llm),qv_nudg_mod(llm),u_nudg_mod(llm),v_nudg_mod(llm)
     36            real temp_nudg_mod(llm),qv_nudg_mod(llm),u_nudg_mod(llm),v_nudg_mod(llm)
    3737        real hq_mod(llm),vq_mod(llm),qv_mod(llm),ql_mod(llm),qt_mod(llm)
    3838        real th_mod(llm)
    3939
    40         real ts_cur
    41         common /sst_forcing/ts_cur ! also in read_tsurf1d.F
     40! EV comment these lines
     41!        real ts_cur
     42!        common /sst_forcing/ts_cur ! also in read_tsurf1d.F
    4243!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    4344! Declarations specifiques au cas RICO
     
    286287        real temp_nudg_mod_cas(llm),qv_nudg_mod_cas(llm),v_nudg_mod_cas(llm),u_nudg_mod_cas(llm)
    287288        real u_mod_cas(llm),v_mod_cas(llm)
    288         real omega_mod_cas(llm)
     289        real omega_mod_cas(llm),tke_mod_cas(llm+1)
    289290        real ht_mod_cas(llm),vt_mod_cas(llm),dt_mod_cas(llm),dtrad_mod_cas(llm)
    290291        real hth_mod_cas(llm),vth_mod_cas(llm),dth_mod_cas(llm)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/1D_interp_cases.h

    r3605 r3798  
    11
    2          print*,'FORCING CASE forcing_case2'
     2        print*,'FORCING CASE forcing_case2'
    33!       print*,                                                             &
    44!    & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/pdt_cas=',     &
     
    1313     &       ,u_cas,v_cas,ug_cas,vg_cas                                                     &
    1414     &       ,temp_nudg_cas,qv_nudg_cas,u_nudg_cas,v_nudg_cas                               &
    15      &       ,vitw_cas,omega_cas,du_cas,hu_cas,vu_cas                                       &
     15     &       ,vitw_cas,omega_cas,tke_cas,du_cas,hu_cas,vu_cas                                       &
    1616     &       ,dv_cas,hv_cas,vv_cas,dt_cas,ht_cas,vt_cas,dtrad_cas                           &
    1717     &       ,dq_cas,hq_cas,vq_cas,dth_cas,hth_cas,vth_cas,lat_cas,sens_cas,ustar_cas       &
    18      &       ,uw_cas,vw_cas,q1_cas,q2_cas,tke_cas                                           &
     18     &       ,uw_cas,vw_cas,q1_cas,q2_cas,tkes_cas                                           &
    1919!
    2020     &       ,ts_prof_cas,ps_prof_cas,plev_prof_cas,t_prof_cas,theta_prof_cas,thv_prof_cas  &
     
    2222     &       ,u_prof_cas,v_prof_cas,ug_prof_cas,vg_prof_cas                                 &
    2323     &       ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas           &
    24      &       ,vitw_prof_cas,omega_prof_cas                                                  &
     24     &       ,vitw_prof_cas,omega_prof_cas,tke_prof_cas                                     &
    2525     &       ,du_prof_cas,hu_prof_cas,vu_prof_cas                                           &
    2626     &       ,dv_prof_cas,hv_prof_cas,vv_prof_cas,dt_prof_cas,ht_prof_cas,vt_prof_cas       &
    2727     &       ,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas                            &
    2828     &       ,dth_prof_cas,hth_prof_cas,vth_prof_cas,lat_prof_cas                           &
    29      &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tke_prof_cas)
    30 
    31              ts_cur = ts_prof_cas
     29     &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tkes_prof_cas)
     30! EV tg instead of ts_cur
     31             tg = ts_prof_cas
    3232!            psurf=plev_prof_cas(1)
    3333             psurf=ps_prof_cas
    3434
    3535! vertical interpolation:
    36       CALL interp2_case_vertical_std(play,nlev_cas,plev_prof_cas                                              &
     36      CALL interp2_case_vertical_std(play,plev,nlev_cas,plev_prof_cas                                              &
    3737     &         ,t_prof_cas,theta_prof_cas,thv_prof_cas,thl_prof_cas                                       &
    3838     &         ,qv_prof_cas,ql_prof_cas,qi_prof_cas,u_prof_cas,v_prof_cas                                 &
    3939     &         ,ug_prof_cas,vg_prof_cas                                                                   &
    4040     &         ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas                       &
    41      &         ,vitw_prof_cas,omega_prof_cas                                      &
     41     &         ,vitw_prof_cas,omega_prof_cas,tke_prof_cas                                                 &
    4242     &         ,du_prof_cas,hu_prof_cas,vu_prof_cas,dv_prof_cas,hv_prof_cas,vv_prof_cas                   &
    4343     &         ,dt_prof_cas,ht_prof_cas,vt_prof_cas,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas    &
     
    4747     &         ,u_mod_cas,v_mod_cas,ug_mod_cas,vg_mod_cas                                                 &
    4848     &         ,temp_nudg_mod_cas,qv_nudg_mod_cas,u_nudg_mod_cas,v_nudg_mod_cas                           &
    49      &         ,w_mod_cas,omega_mod_cas                                                                   &
     49     &         ,w_mod_cas,omega_mod_cas,tke_mod_cas                                                       &
    5050     &         ,du_mod_cas,hu_mod_cas,vu_mod_cas,dv_mod_cas,hv_mod_cas,vv_mod_cas                         &
    5151     &         ,dt_mod_cas,ht_mod_cas,vt_mod_cas,dtrad_mod_cas,dq_mod_cas,hq_mod_cas,vq_mod_cas           &
     
    109109      do l = 1, llm
    110110! Modif w_mod_cas -> omega_mod_cas (MM+MPL 20170309)
     111        print*, l, llm
     112        print*, play(l), temp(l)
    111113       omega(l) = -w_mod_cas(l)*play(l)*rg/(rd*temp(l))
    112114      enddo
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/1D_read_forc_cases.h

    r3605 r3798  
    2727     &       ,u_cas,v_cas,ug_cas,vg_cas                                                     &
    2828     &       ,temp_nudg_cas,qv_nudg_cas,u_nudg_cas,v_nudg_cas                               &
    29      &       ,vitw_cas,omega_cas,du_cas,hu_cas,vu_cas                                       &
     29     &       ,vitw_cas,omega_cas,tke_cas,du_cas,hu_cas,vu_cas                                       &
    3030     &       ,dv_cas,hv_cas,vv_cas,dt_cas,ht_cas,vt_cas,dtrad_cas                           &
    3131     &       ,dq_cas,hq_cas,vq_cas,dth_cas,hth_cas,vth_cas,lat_cas,sens_cas,ustar_cas       &
    32      &       ,uw_cas,vw_cas,q1_cas,q2_cas,tke_cas                                           &
     32     &       ,uw_cas,vw_cas,q1_cas,q2_cas,tkes_cas                                           &
    3333!
    3434     &       ,ts_prof_cas,ps_prof_cas,plev_prof_cas,t_prof_cas,theta_prof_cas,thv_prof_cas  &
     
    3636     &       ,u_prof_cas,v_prof_cas,ug_prof_cas,vg_prof_cas                                 &
    3737     &       ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas           &
    38      &       ,vitw_prof_cas,omega_prof_cas                                                  &
     38     &       ,vitw_prof_cas,omega_prof_cas,tke_prof_cas                                    &
    3939     &       ,du_prof_cas,hu_prof_cas,vu_prof_cas                                           &
    4040     &       ,dv_prof_cas,hv_prof_cas,vv_prof_cas,dt_prof_cas,ht_prof_cas,vt_prof_cas       &
    4141     &       ,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas                            &
    4242     &       ,dth_prof_cas,hth_prof_cas,vth_prof_cas,lat_prof_cas                           &
    43      &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tke_prof_cas)
     43     &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tkes_prof_cas)
    4444
    4545      do l = 1, nlev_cas
     
    4949! vertical interpolation using interpolation routine:
    5050!      write(*,*)'avant interp vert', t_prof
    51       CALL interp2_case_vertical_std(play,nlev_cas,plev_prof_cas                                              &
     51      CALL interp2_case_vertical_std(play,plev,nlev_cas,plev_prof_cas                                              &
    5252     &         ,t_prof_cas,theta_prof_cas,thv_prof_cas,thl_prof_cas                                          &
    5353     &         ,qv_prof_cas,ql_prof_cas,qi_prof_cas,u_prof_cas,v_prof_cas                                 &
     
    5555     &       ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas                         &
    5656
    57      &         ,vitw_prof_cas,omega_prof_cas                                                              &
     57     &         ,vitw_prof_cas,omega_prof_cas,tke_prof_cas                                                 &
    5858     &         ,du_prof_cas,hu_prof_cas,vu_prof_cas,dv_prof_cas,hv_prof_cas,vv_prof_cas                   &
    5959     &         ,dt_prof_cas,ht_prof_cas,vt_prof_cas,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas    &
     
    6363     &         ,u_mod_cas,v_mod_cas,ug_mod_cas,vg_mod_cas                                                 &
    6464     &         ,temp_nudg_mod_cas,qv_nudg_mod_cas,u_nudg_mod_cas,v_nudg_mod_cas                           &
    65      &         ,w_mod_cas,omega_mod_cas                                                                   &
     65     &         ,w_mod_cas,omega_mod_cas,tke_mod_cas                                                       &
    6666     &         ,du_mod_cas,hu_mod_cas,vu_mod_cas,dv_mod_cas,hv_mod_cas,vv_mod_cas                         &
    6767     &         ,dt_mod_cas,ht_mod_cas,vt_mod_cas,dtrad_mod_cas,dq_mod_cas,hq_mod_cas,vq_mod_cas           &
     
    7070
    7171! initial and boundary conditions :
    72 !      tsurf = ts_prof_cas
     72!     tsurf = ts_prof_cas
    7373      psurf = ps_prof_cas
    74       ts_cur = ts_prof_cas
     74      !EV tg instead of ts_cur
     75      tg = ts_prof_cas
     76      print*, 'tg=', tg
     77
    7578      do l = 1, llm
    7679       temp(l) = t_mod_cas(l)
     
    9598       d_u_adv(l) = du_mod_cas(l)+hu_mod_cas(l)+vu_mod_cas(l)
    9699       d_v_adv(l) = dv_mod_cas(l)+hv_mod_cas(l)+vv_mod_cas(l)
     100      enddo
    97101
    98 !print*,'d_t_adv ',d_t_adv(1:20)*86400
     102! Etienne pour initialisation de TKE
    99103
    100       enddo     
     104       do l=1,llm+1
     105       pbl_tke(:,l,:)=tke_mod_cas(l)
     106       enddo     
    101107
    102108! Faut-il multiplier par -1 ? (MPL 20160713)
     
    108114       IF (ok_prescr_ust) THEN
    109115       ust=ustar_prof_cas
    110        print *,'ust=',ust
    111116       ENDIF
    112117
     118
    113119      endif !forcing_SCM
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/mod_1D_cases_read2.F90

    r3605 r3798  
    316316
    317317!**********************************************************************************************
    318 SUBROUTINE read_SCM_cas
     318SUBROUTINE old_read_SCM_cas
    319319      implicit none
    320320
     
    457457
    458458        print*,'Allocations OK'
    459         call read_SCM (nid,nlev_cas,nt_cas,                                                                     &
     459        call old_read_SCM (nid,nlev_cas,nt_cas,                                                                     &
    460460     &     ap_cas,bp_cas,z_cas,plev_cas,zh_cas,plevh_cas,t_cas,th_cas,thv_cas,thl_cas,qv_cas,                    &
    461461     &     ql_cas,qi_cas,rh_cas,rv_cas,u_cas,v_cas,vitw_cas,omega_cas,ug_cas,vg_cas,du_cas,hu_cas,vu_cas,        &
     
    470470
    471471
    472 END SUBROUTINE read_SCM_cas
     472END SUBROUTINE old_read_SCM_cas
    473473
    474474
     
    846846
    847847!======================================================================
    848       subroutine read_SCM(nid,nlevel,ntime,                                       &
     848      subroutine old_read_SCM(nid,nlevel,ntime,                                       &
    849849     &     ap,bp,zz,pp,zzh,pph,temp,theta,thv,thl,qv,ql,qi,rh,rv,u,v,vitw,omega,ug,vg,&
    850850     &     du,hu,vu,dv,hv,vv,dt,ht,vt,dq,hq,vq,                                    &
     
    10731073
    10741074         return
    1075          end subroutine read_SCM
     1075         end subroutine old_read_SCM
    10761076!======================================================================
    10771077
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90

    r3605 r3798  
    1818        real, allocatable::  t_cas(:,:),q_cas(:,:),qv_cas(:,:),ql_cas(:,:),qi_cas(:,:),rh_cas(:,:)
    1919        real, allocatable::  th_cas(:,:),thv_cas(:,:),thl_cas(:,:),rv_cas(:,:)
    20         real, allocatable::  u_cas(:,:),v_cas(:,:),vitw_cas(:,:),omega_cas(:,:)
     20        real, allocatable::  u_cas(:,:),v_cas(:,:),vitw_cas(:,:),omega_cas(:,:),tke_cas(:,:)
    2121
    2222!forcing
     
    3030        real, allocatable::  temp_nudg_cas(:,:),qv_nudg_cas(:,:),u_nudg_cas(:,:),v_nudg_cas(:,:)
    3131        real, allocatable::  lat_cas(:),sens_cas(:),ts_cas(:),ps_cas(:),ustar_cas(:)
    32         real, allocatable::  uw_cas(:,:),vw_cas(:,:),q1_cas(:,:),q2_cas(:,:),tke_cas(:)
     32        real, allocatable::  uw_cas(:,:),vw_cas(:,:),q1_cas(:,:),q2_cas(:,:),tkes_cas(:)
    3333
    3434!champs interpoles
     
    4848        real, allocatable::  vitw_prof_cas(:)
    4949        real, allocatable::  omega_prof_cas(:)
     50        real, allocatable::  tke_prof_cas(:)
    5051        real, allocatable::  ug_prof_cas(:)
    5152        real, allocatable::  vg_prof_cas(:)
     
    7374
    7475
    75         real lat_prof_cas,sens_prof_cas,ts_prof_cas,ps_prof_cas,ustar_prof_cas,tke_prof_cas
     76        real lat_prof_cas,sens_prof_cas,ts_prof_cas,ps_prof_cas,ustar_prof_cas,tkes_prof_cas
    7677        real o3_cas,orog_cas,albedo_cas,emiss_cas,t_skin_cas,q_skin_cas,mom_rough,heat_rough,rugos_cas,sand_cas,clay_cas
    7778     
     
    9293      REAL, ALLOCATABLE :: time_val(:)
    9394
    94       print*,'ON EST VRAIMENT LA'
     95      print*,'ON EST VRAIMENT DASN MOD_1D_CASES_READ_STD'
    9596      fich_cas='cas.nc'
    9697      print*,'fich_cas ',fich_cas
     
    123124      ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
    124125      print*,'OK3 read2: nid,rid,nlev_cas',nid,rid,nlev_cas
    125       IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 1000 )) THEN
     126      IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 200000 )) THEN
    126127              print*,'Valeur de nlev_cas peu probable'
    127128              STOP
     
    168169        allocate(th_cas(nlev_cas,nt_cas),thl_cas(nlev_cas,nt_cas),thv_cas(nlev_cas,nt_cas),rv_cas(nlev_cas,nt_cas))
    169170        allocate(u_cas(nlev_cas,nt_cas),v_cas(nlev_cas,nt_cas),vitw_cas(nlev_cas,nt_cas),omega_cas(nlev_cas,nt_cas))
    170 
     171        allocate(tke_cas(nlev_cas,nt_cas))
    171172!forcing
    172173        allocate(ht_cas(nlev_cas,nt_cas),vt_cas(nlev_cas,nt_cas),dt_cas(nlev_cas,nt_cas),dtrad_cas(nlev_cas,nt_cas))
     
    179180        allocate(temp_nudg_cas(nlev_cas,nt_cas),qv_nudg_cas(nlev_cas,nt_cas))
    180181        allocate(u_nudg_cas(nlev_cas,nt_cas),v_nudg_cas(nlev_cas,nt_cas))
    181         allocate(lat_cas(nt_cas),sens_cas(nt_cas),ts_cas(nt_cas),ps_cas(nt_cas),ustar_cas(nt_cas),tke_cas(nt_cas))
     182        allocate(lat_cas(nt_cas),sens_cas(nt_cas),ts_cas(nt_cas),ps_cas(nt_cas),ustar_cas(nt_cas),tkes_cas(nt_cas))
    182183        allocate(uw_cas(nlev_cas,nt_cas),vw_cas(nlev_cas,nt_cas),q1_cas(nlev_cas,nt_cas),q2_cas(nlev_cas,nt_cas))
    183184
     
    200201        allocate(vitw_prof_cas(nlev_cas))
    201202        allocate(omega_prof_cas(nlev_cas))
     203        allocate(tke_prof_cas(nlev_cas))
    202204        allocate(ug_prof_cas(nlev_cas))
    203205        allocate(vg_prof_cas(nlev_cas))
     
    228230        CALL read_SCM (nid,nlev_cas,nt_cas,                                                                     &
    229231     &     ap_cas,bp_cas,z_cas,plev_cas,zh_cas,plevh_cas,t_cas,th_cas,thv_cas,thl_cas,qv_cas,                   &
    230      &     ql_cas,qi_cas,rh_cas,rv_cas,u_cas,v_cas,vitw_cas,omega_cas,ug_cas,vg_cas,                            &
     232     &     ql_cas,qi_cas,rh_cas,rv_cas,u_cas,v_cas,vitw_cas,omega_cas,tke_cas,ug_cas,vg_cas,                            &
    231233     &     temp_nudg_cas,qv_nudg_cas,u_nudg_cas,v_nudg_cas,                                                     &
    232234     &     du_cas,hu_cas,vu_cas,                                                                                &
    233235     &     dv_cas,hv_cas,vv_cas,dt_cas,ht_cas,vt_cas,dq_cas,hq_cas,vq_cas,dth_cas,hth_cas,vth_cas,               &
    234      &     dr_cas,hr_cas,vr_cas,dtrad_cas,sens_cas,lat_cas,ts_cas,ps_cas,ustar_cas,tke_cas,                      &
     236     &     dr_cas,hr_cas,vr_cas,dtrad_cas,sens_cas,lat_cas,ts_cas,ps_cas,ustar_cas,tkes_cas,                      &
    235237     &     uw_cas,vw_cas,q1_cas,q2_cas,orog_cas,albedo_cas,emiss_cas,t_skin_cas,q_skin_cas,mom_rough,heat_rough, &
    236238     &     o3_cas,rugos_cas,clay_cas,sand_cas)
     
    254256        deallocate(t_cas,q_cas,qv_cas,ql_cas,qi_cas,rh_cas)
    255257        deallocate(th_cas,thl_cas,thv_cas,rv_cas)
    256         deallocate(u_cas,v_cas,vitw_cas,omega_cas)
     258        deallocate(u_cas,v_cas,vitw_cas,omega_cas,tke_cas)
    257259       
    258260!forcing
     
    265267        deallocate(ug_cas)
    266268        deallocate(vg_cas)
    267         deallocate(lat_cas,sens_cas,ts_cas,ps_cas,ustar_cas,tke_cas,uw_cas,vw_cas,q1_cas,q2_cas)
     269        deallocate(lat_cas,sens_cas,ts_cas,ps_cas,ustar_cas,tkes_cas,uw_cas,vw_cas,q1_cas,q2_cas)
    268270
    269271!champs interpoles
     
    283285        deallocate(vitw_prof_cas)
    284286        deallocate(omega_prof_cas)
     287        deallocate(tke_prof_cas)
    285288        deallocate(ug_prof_cas)
    286289        deallocate(vg_prof_cas)
     
    312315!=====================================================================
    313316      SUBROUTINE read_SCM(nid,nlevel,ntime,                                       &
    314      &     ap,bp,zz,pp,zzh,pph,temp,theta,thv,thl,qv,ql,qi,rh,rv,u,v,vitw,omega,ug,vg,&
     317     &     ap,bp,zz,pp,zzh,pph,temp,theta,thv,thl,qv,ql,qi,rh,rv,u,v,vitw,omega,tke,ug,vg,&
    315318     &     temp_nudg,qv_nudg,u_nudg,v_nudg,                                        &
    316319     &     du,hu,vu,dv,hv,vv,dt,ht,vt,dq,hq,vq,                                    &
    317      &     dth,hth,vth,dr,hr,vr,dtrad,sens,flat,ts,ps,ustar,tke,uw,vw,q1,q2,       &
     320     &     dth,hth,vth,dr,hr,vr,dtrad,sens,flat,ts,ps,ustar,tkes,uw,vw,q1,q2,       &
    318321     &     orog_cas,albedo_cas,emiss_cas,t_skin_cas,q_skin_cas,mom_rough,          &
    319322     &     heat_rough,o3_cas,rugos_cas,clay_cas,sand_cas)
     
    334337      real temp(nlevel,ntime),qv(nlevel,ntime),ql(nlevel,ntime),qi(nlevel,ntime),rh(nlevel,ntime)
    335338      real theta(nlevel,ntime),thv(nlevel,ntime),thl(nlevel,ntime),rv(nlevel,ntime)
    336       real u(nlevel,ntime),v(nlevel,ntime),tke(nlevel,ntime)
     339      real u(nlevel,ntime),v(nlevel,ntime),tkes(ntime)
    337340      real temp_nudg(nlevel,ntime),qv_nudg(nlevel,ntime),u_nudg(nlevel,ntime),v_nudg(nlevel,ntime)
    338341      real ug(nlevel,ntime),vg(nlevel,ntime)
    339       real vitw(nlevel,ntime),omega(nlevel,ntime)
     342      real vitw(nlevel,ntime),omega(nlevel,ntime),tke(nlevel,ntime)
    340343      real du(nlevel,ntime),hu(nlevel,ntime),vu(nlevel,ntime)
    341344      real dv(nlevel,ntime),hv(nlevel,ntime),vv(nlevel,ntime)
     
    365368     &'temp','qv','ql','qi','u','v','tke','pressure',& ! #5-#12
    366369     ! coordonnees pression + temps #42
    367      &'w','omega','ug','vg','uadv','uadvh','uadvv','vadv','vadvh','vadvv','tadv','tadvh','tadvv',& !  #13 - #25
    368      &'qvadv','qvadvh','qvadvv','thadv','thadvh','thadvv','thladvh',                             & ! #26 - #33
    369      & 'radv','radvh','radvv','radcool','q1','q2','ustress','vstress',                           & ! #34 - #41
    370      & 'rh','temp_nudg','qv_nudg','u_nudg','v_nudg',&
    371      &'height_f','pressure_forc','tempt','theta','thv','thl','qvt','qlt','qit','rv','ut','vt','tket',&
     370     &'w','omega','ug','vg','uadv','uadvh','uadvv','vadv','vadvh','vadvv','temp_adv','tadvh','tadvv',& !  #13 - #25
     371     &'qv_adv','qvadvh','qvadvv','thadv','thadvh','thadvv','thladvh',                             & ! #26 - #32
     372     & 'radv','radvh','radvv','radcool','q1','q2','ustress','vstress',                           & ! #33 - #40
     373     & 'rh','temp_nudging','qv_nudging','u_nudging','v_nudging',                                       & ! #41-45
     374     &'height_f','pressure_forc','tempt','theta','thv','thl','qvt','qlt','qit','rv','ut','vt',   & ! #46-58
    372375     ! coordonnees temps #12
    373      &'sfc_sens_flx','sfc_lat_flx','ts','ps','ustar',&
     376     &'tkes','sfc_sens_flx','sfc_lat_flx','ts','ps','ustar',&
    374377     &'orog','albedo','emiss','t_skin','q_skin','mom_rough','heat_rough',&
    375378     ! scalaires #4
    376379     &'o3','rugos','clay','sand'/
    377380
    378       do i=1,nbvar3d
    379         missing_var(i)=0.
    380       enddo
    381 
     381!-----------------------------------------------------------------------
     382! Checking availability of variable #i in the cas.nc file
     383!     missing_var=1 if the variable is missing
    382384!-----------------------------------------------------------------------
    383385
    384386       do i=1,nbvar3d
     387         missing_var(i)=0.
    385388         ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i))
    386389         if(ierr/=NF_NOERR) then
     
    391394
    392395!-----------------------------------------------------------------------
    393 ! Activation de quelques cles en fonction des variables disponibles
     396! Activating keys depending on the presence of specific variables in cas.nc
    394397!-----------------------------------------------------------------------
    395398if ( 1 == 1 ) THEN
    396             if ( name_var(i) == 'temp_nudg' .and. nint(nudging_t)==0) stop 'Nudging inconsistency temp'
    397             if ( name_var(i) == 'qv_nudg' .and. nint(nudging_qv)==0) stop 'Nudging inconsistency qv'
    398             if ( name_var(i) == 'u_nudg' .and. nint(nudging_u)==0) stop 'Nudging inconsistency u'
    399             if ( name_var(i) == 'v_nudg' .and. nint(nudging_u)==0) stop 'Nudging inconsistency v'
     399! A MODIFIER: il faudrait dire nudging_temp mais faut le declarer dans compar1d.h etc...       
     400!           if ( name_var(i) == 'temp_nudging' .and. nint(nudging_t)==0) stop 'Nudging inconsistency temp'
     401            if ( name_var(i) == 'qv_nudging' .and. nint(nudging_qv)==0) stop 'Nudging inconsistency qv'
     402            if ( name_var(i) == 'u_nudging' .and. nint(nudging_u)==0) stop 'Nudging inconsistency u'
     403            if ( name_var(i) == 'v_nudging' .and. nint(nudging_u)==0) stop 'Nudging inconsistency v'
    400404    ELSE
    401405             print*,'GUIDAGE : CONSISTENCY CHECK DEACTIVATED FOR TESTS of SANDU/REF'
     
    403407
    404408!-----------------------------------------------------------------------
    405            if(i.LE.4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
     409! Reading variables 1D (N+1) vertical variables (nlevelp1,lat,lon)
     410!-----------------------------------------------------------------------
     411           if(i.LE.4) then
    406412#ifdef NC_DOUBLE
    407413           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),apbp)
     
    414420              stop "getvarup"
    415421           endif
    416 !-----------------------------------------------------------------------
    417            else if(i.gt.4.and.i.LE.12) then   ! Lecture des variables en (time,nlevel,lat,lon)
     422
     423!-----------------------------------------------------------------------
     424!  Reading 1D (N) vertical varialbes    (nlevel,lat,lon)   
     425!-----------------------------------------------------------------------
     426           else if(i.gt.4.and.i.LE.12) then 
    418427#ifdef NC_DOUBLE
    419428           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul1)
     
    427436           endif
    428437         print*,'Lecture de la variable #i ',i,name_var(i),minval(resul1),maxval(resul1)
    429 !-----------------------------------------------------------------------
    430            else if(i.gt.12.and.i.LE.54) then   ! Lecture des variables en (time,nlevel,lat,lon)
     438
     439!-----------------------------------------------------------------------
     440!  Reading 2D tim-vertical variables  (time,nlevel,lat,lon)
     441!  TBD : seems to be the same as above.
     442!-----------------------------------------------------------------------
     443           else if(i.gt.12.and.i.LE.57) then
    431444#ifdef NC_DOUBLE
    432445           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul)
     
    439452              stop "getvarup"
    440453           endif
    441 
    442454         print*,'Lecture de la variable #i ',i,name_var(i),minval(resul),maxval(resul)
    443 !-----------------------------------------------------------------------
    444            else if (i.gt.54.and.i.LE.65) then   ! Lecture des variables en (time,lat,lon)
     455
     456!-----------------------------------------------------------------------
     457!  Reading 1D time variables (time,lat,lon)
     458!-----------------------------------------------------------------------
     459           else if (i.gt.57.and.i.LE.63) then
    445460#ifdef NC_DOUBLE
    446461           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul2)
     
    454469           endif
    455470         print*,'Lecture de la variable #i  ',i,name_var(i),minval(resul2),maxval(resul2)
    456 !-----------------------------------------------------------------------
    457            else     ! Lecture des constantes (lat,lon)
     471
     472!-----------------------------------------------------------------------
     473! Reading scalar variables (lat,lon)
     474!-----------------------------------------------------------------------
     475           else
    458476#ifdef NC_DOUBLE
    459477           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul3)
     
    469487           endif
    470488         endif
     489
     490!-----------------------------------------------------------------------
     491! Attributing variables
    471492!-----------------------------------------------------------------------
    472493         select case(i)
     
    528549           case(56) ; u=resul
    529550           case(57) ; v=resul
    530            case(58) ; tke=resul
    531            case(59) ; sens=resul2   ! donnees indexees en time
     551           case(58) ; tkes=resul2   ! donnees indexees en time
     552           case(59) ; sens=resul2
    532553           case(60) ; flat=resul2
    533554           case(61) ; ts=resul2
     
    577598
    578599!**********************************************************************************************
     600
     601!**********************************************************************************************
    579602        SUBROUTINE interp_case_time_std(day,day1,annee_ref                           &
    580603!    &         ,year_cas,day_cas,nt_cas,pdt_forc,nlev_cas                         &
     
    583606     &         ,qv_cas,ql_cas,qi_cas,u_cas,v_cas                                  &
    584607     &         ,ug_cas,vg_cas,temp_nudg_cas,qv_nudg_cas,u_nudg_cas,v_nudg_cas     &
    585      &         ,vitw_cas,omega_cas,du_cas,hu_cas,vu_cas             &
     608     &         ,vitw_cas,omega_cas,tke_cas,du_cas,hu_cas,vu_cas             &
    586609     &         ,dv_cas,hv_cas,vv_cas,dt_cas,ht_cas,vt_cas,dtrad_cas               &
    587610     &         ,dq_cas,hq_cas,vq_cas,dth_cas,hth_cas,vth_cas                      &
    588611     &         ,lat_cas,sens_cas,ustar_cas                                        &
    589      &         ,uw_cas,vw_cas,q1_cas,q2_cas,tke_cas                               &
     612     &         ,uw_cas,vw_cas,q1_cas,q2_cas,tkes_cas                               &
    590613!
    591614     &         ,ts_prof_cas,ps_prof_cas,plev_prof_cas,t_prof_cas,theta_prof_cas               &
     
    593616     &         ,u_prof_cas,v_prof_cas,ug_prof_cas,vg_prof_cas                     &
    594617     &         ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas     &
    595      &         ,vitw_prof_cas,omega_prof_cas,du_prof_cas,hu_prof_cas,vu_prof_cas  &
     618     &         ,vitw_prof_cas,omega_prof_cas,tke_prof_cas,du_prof_cas,hu_prof_cas,vu_prof_cas  &
    596619     &         ,dv_prof_cas,hv_prof_cas,vv_prof_cas,dt_prof_cas                   &
    597620     &         ,ht_prof_cas,vt_prof_cas,dtrad_prof_cas,dq_prof_cas                &
    598621     &         ,hq_prof_cas,vq_prof_cas,dth_prof_cas,hth_prof_cas,vth_prof_cas    &
    599622     &         ,lat_prof_cas,sens_prof_cas                                        &
    600      &         ,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tke_prof_cas)
    601          
    602 
    603         implicit none
     623     &         ,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tkes_prof_cas)
     624
     625
     626
     627
     628
     629
     630       implicit none
    604631
    605632!---------------------------------------------------------------------------------------
     
    621648        real ts_cas(nt_cas),ps_cas(nt_cas)
    622649        real plev_cas(nlev_cas,nt_cas)
    623         real t_cas(nlev_cas,nt_cas),theta_cas(nlev_cas,nt_cas),thv_cas(nlev_cas,nt_cas),thl_cas(nlev_cas,nt_cas)
     650        real t_cas(nlev_cas,nt_cas),theta_cas(nlev_cas,nt_cas)
     651        real thv_cas(nlev_cas,nt_cas), thl_cas(nlev_cas,nt_cas)
    624652        real qv_cas(nlev_cas,nt_cas),ql_cas(nlev_cas,nt_cas),qi_cas(nlev_cas,nt_cas)
    625653        real u_cas(nlev_cas,nt_cas),v_cas(nlev_cas,nt_cas)
     
    628656        real u_nudg_cas(nlev_cas,nt_cas),v_nudg_cas(nlev_cas,nt_cas)
    629657
    630         real vitw_cas(nlev_cas,nt_cas),omega_cas(nlev_cas,nt_cas)
     658        real vitw_cas(nlev_cas,nt_cas),omega_cas(nlev_cas,nt_cas),tke_cas(nlev_cas,nt_cas)
    631659        real du_cas(nlev_cas,nt_cas),hu_cas(nlev_cas,nt_cas),vu_cas(nlev_cas,nt_cas)
    632660        real dv_cas(nlev_cas,nt_cas),hv_cas(nlev_cas,nt_cas),vv_cas(nlev_cas,nt_cas)
     
    635663        real dtrad_cas(nlev_cas,nt_cas)
    636664        real dq_cas(nlev_cas,nt_cas),hq_cas(nlev_cas,nt_cas),vq_cas(nlev_cas,nt_cas)
    637         real lat_cas(nt_cas),sens_cas(nt_cas),tke_cas(nt_cas)
     665        real lat_cas(nt_cas),sens_cas(nt_cas),tkes_cas(nt_cas)
    638666        real ustar_cas(nt_cas),uw_cas(nlev_cas,nt_cas),vw_cas(nlev_cas,nt_cas)
    639667        real q1_cas(nlev_cas,nt_cas),q2_cas(nlev_cas,nt_cas)
     
    648676        real u_nudg_prof_cas(nlev_cas),v_nudg_prof_cas(nlev_cas)
    649677
    650         real vitw_prof_cas(nlev_cas),omega_prof_cas(nlev_cas)
     678        real vitw_prof_cas(nlev_cas),omega_prof_cas(nlev_cas),tke_prof_cas(nlev_cas)
    651679        real du_prof_cas(nlev_cas),hu_prof_cas(nlev_cas),vu_prof_cas(nlev_cas)
    652680        real dv_prof_cas(nlev_cas),hv_prof_cas(nlev_cas),vv_prof_cas(nlev_cas)
     
    655683        real dtrad_prof_cas(nlev_cas)
    656684        real dq_prof_cas(nlev_cas),hq_prof_cas(nlev_cas),vq_prof_cas(nlev_cas)
    657         real lat_prof_cas,sens_prof_cas,tke_prof_cas,ts_prof_cas,ps_prof_cas,ustar_prof_cas
     685        real lat_prof_cas,sens_prof_cas,tkes_prof_cas,ts_prof_cas,ps_prof_cas,ustar_prof_cas
    658686        real uw_prof_cas(nlev_cas),vw_prof_cas(nlev_cas),q1_prof_cas(nlev_cas),q2_prof_cas(nlev_cas)
    659687! local:
     
    739767       sens_prof_cas = sens_cas(it_cas2)                                 &
    740768     &          -frac*(sens_cas(it_cas2)-sens_cas(it_cas1))
    741        tke_prof_cas = tke_cas(it_cas2)                                   &
    742      &          -frac*(tke_cas(it_cas2)-tke_cas(it_cas1))
     769       tkes_prof_cas = tkes_cas(it_cas2)                                   &
     770     &          -frac*(tkes_cas(it_cas2)-tkes_cas(it_cas1))
    743771       ts_prof_cas = ts_cas(it_cas2)                                     &
    744772     &          -frac*(ts_cas(it_cas2)-ts_cas(it_cas1))
     
    786814        omega_prof_cas(k) = omega_cas(k,it_cas2)                         &
    787815     &          -frac*(omega_cas(k,it_cas2)-omega_cas(k,it_cas1))
     816        tke_prof_cas(k) = tke_cas(k,it_cas2)                         &
     817     &          -frac*(tke_cas(k,it_cas2)-tke_cas(k,it_cas1))
    788818        du_prof_cas(k) = du_cas(k,it_cas2)                               &
    789819     &          -frac*(du_cas(k,it_cas2)-du_cas(k,it_cas1))
     
    833863!**********************************************************************************************
    834864!=====================================================================
    835        SUBROUTINE interp2_case_vertical_std(play,nlev_cas,plev_prof_cas                                &
     865       SUBROUTINE interp2_case_vertical_std(play,plev,nlev_cas,plev_prof_cas                           &
    836866     &         ,t_prof_cas,th_prof_cas,thv_prof_cas,thl_prof_cas                                       &
    837867     &         ,qv_prof_cas,ql_prof_cas,qi_prof_cas,u_prof_cas,v_prof_cas                              &
    838868     &         ,ug_prof_cas,vg_prof_cas                                                                &
    839869     &         ,temp_nudg_prof_cas,qv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas                    &
    840      &         ,vitw_prof_cas,omega_prof_cas                                                           &
     870     &         ,vitw_prof_cas,omega_prof_cas,tke_prof_cas                                              &
    841871     &         ,du_prof_cas,hu_prof_cas,vu_prof_cas,dv_prof_cas,hv_prof_cas,vv_prof_cas                &
    842872     &         ,dt_prof_cas,ht_prof_cas,vt_prof_cas,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas &
     
    847877     &         ,ug_mod_cas,vg_mod_cas                                                                  &
    848878     &         ,temp_nudg_mod_cas,qv_nudg_mod_cas,u_nudg_mod_cas,v_nudg_mod_cas                        &
    849      &         ,w_mod_cas,omega_mod_cas                                                                &
     879     &         ,w_mod_cas,omega_mod_cas,tke_mod_cas                                                    &
    850880     &         ,du_mod_cas,hu_mod_cas,vu_mod_cas,dv_mod_cas,hv_mod_cas,vv_mod_cas                      &
    851881     &         ,dt_mod_cas,ht_mod_cas,vt_mod_cas,dtrad_mod_cas,dq_mod_cas,hq_mod_cas,vq_mod_cas        &
     
    870900!       real hq_prof(nlevmax),vq_prof(nlevmax)
    871901 
    872        real play(llm), plev_prof_cas(nlev_cas)
     902       real play(llm), plev(llm+1), plev_prof_cas(nlev_cas)
    873903       real t_prof_cas(nlev_cas),th_prof_cas(nlev_cas),thv_prof_cas(nlev_cas),thl_prof_cas(nlev_cas)
    874904       real qv_prof_cas(nlev_cas),ql_prof_cas(nlev_cas),qi_prof_cas(nlev_cas)
    875905       real u_prof_cas(nlev_cas),v_prof_cas(nlev_cas)
    876        real ug_prof_cas(nlev_cas),vg_prof_cas(nlev_cas), vitw_prof_cas(nlev_cas),omega_prof_cas(nlev_cas)
     906       real ug_prof_cas(nlev_cas),vg_prof_cas(nlev_cas), vitw_prof_cas(nlev_cas),omega_prof_cas(nlev_cas),tke_prof_cas(nlev_cas)
    877907       real temp_nudg_prof_cas(nlev_cas),qv_nudg_prof_cas(nlev_cas)
    878908       real u_nudg_prof_cas(nlev_cas),v_nudg_prof_cas(nlev_cas)
     
    887917       real qv_mod_cas(llm),ql_mod_cas(llm),qi_mod_cas(llm)
    888918       real u_mod_cas(llm),v_mod_cas(llm)
    889        real ug_mod_cas(llm),vg_mod_cas(llm), w_mod_cas(llm),omega_mod_cas(llm)
     919       real ug_mod_cas(llm),vg_mod_cas(llm), w_mod_cas(llm),omega_mod_cas(llm),tke_mod_cas(llm+1)
    890920       real temp_nudg_mod_cas(llm),qv_nudg_mod_cas(llm)
    891921       real u_nudg_mod_cas(llm),v_nudg_mod_cas(llm)
     
    899929       real frac,frac1,frac2,fact
    900930 
    901 !       do l = 1, llm
    902 !       print *,'debut interp2, play=',l,play(l)
    903 !       enddo
    904 !      do l = 1, nlev_cas
    905 !      print *,'debut interp2, plev_prof_cas=',l,play(l),plev_prof_cas(l)
    906 !      enddo
     931
     932
     933! for variables defined at the middle of layers
    907934
    908935       do l = 1, llm
     
    932959         endif
    933960
     961
     962
    934963         frac = (plev_prof_cas(k2)-play(l))/(plev_prof_cas(k2)-plev_prof_cas(k1))
     964         
    935965         t_mod_cas(l)= t_prof_cas(k2) - frac*(t_prof_cas(k2)-t_prof_cas(k1))
    936966         theta_mod_cas(l)= th_prof_cas(k2) - frac*(th_prof_cas(k2)-th_prof_cas(k1))
     
    10291059         ug_mod_cas(l)= ug_prof_cas(nlev_cas)                          !jyg
    10301060         vg_mod_cas(l)= vg_prof_cas(nlev_cas)                          !jyg
    1031          temp_nudg_mod_cas(l)= temp_nudg_prof_cas(nlev_cas)                          !jyg
    1032          qv_nudg_mod_cas(l)= qv_nudg_prof_cas(nlev_cas)                          !jyg
    1033          u_nudg_mod_cas(l)= u_nudg_prof_cas(nlev_cas)                          !jyg
    1034          v_nudg_mod_cas(l)= v_nudg_prof_cas(nlev_cas)                          !jyg
     1061         temp_nudg_mod_cas(l)= temp_nudg_prof_cas(nlev_cas)            !jyg
     1062         qv_nudg_mod_cas(l)= qv_nudg_prof_cas(nlev_cas)                !jyg
     1063         u_nudg_mod_cas(l)= u_nudg_prof_cas(nlev_cas)                  !jyg
     1064         v_nudg_mod_cas(l)= v_nudg_prof_cas(nlev_cas)                  !jyg
    10351065         thv_mod_cas(l)= thv_prof_cas(nlev_cas)                        !jyg
    10361066         w_mod_cas(l)= 0.0                                             !jyg
     
    10571087       enddo ! l
    10581088
     1089! for variables defined at layer interfaces (EV):
     1090
     1091
     1092       do l = 1, llm+1
     1093
     1094        if (plev(l).ge.plev_prof_cas(nlev_cas)) then
     1095
     1096         mxcalc=l
     1097         k1=0
     1098         k2=0
     1099
     1100         if (plev(l).le.plev_prof_cas(1)) then
     1101
     1102         do k = 1, nlev_cas-1
     1103          if (plev(l).le.plev_prof_cas(k).and. plev(l).gt.plev_prof_cas(k+1)) then
     1104            k1=k
     1105            k2=k+1
     1106          endif
     1107         enddo
     1108
     1109         if (k1.eq.0 .or. k2.eq.0) then
     1110          write(*,*) 'PB! k1, k2 = ',k1,k2
     1111          write(*,*) 'l,plev(l) = ',l,plev(l)/100
     1112         do k = 1, nlev_cas-1
     1113          write(*,*) 'k,plev_prof_cas(k) = ',k,plev_prof_cas(k)/100
     1114         enddo
     1115         endif
     1116
     1117         frac = (plev_prof_cas(k2)-plev(l))/(plev_prof_cas(k2)-plev_prof_cas(k1))
     1118         tke_mod_cas(l)= tke_prof_cas(k2) - frac*(tke_prof_cas(k2)-tke_prof_cas(k1))
     1119         else !play>plev_prof_cas(1)
     1120         k1=1
     1121         k2=2
     1122         tke_mod_cas(l)= frac1*tke_prof_cas(k1) - frac2*tke_prof_cas(k2)
     1123
     1124         endif ! plev.le.plev_prof_cas(1)
     1125
     1126        else ! above max altitude of forcing file
     1127
     1128         tke_mod_cas(l)=0.0
     1129
     1130        endif ! plev
     1131
     1132       enddo ! l
     1133
     1134
     1135
    10591136          return
    1060           end
     1137          end SUBROUTINE interp2_case_vertical_std
    10611138!*****************************************************************************
    10621139
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/old_1D_decl_cases.h

    r3605 r3798  
    3737        real th_mod(llm)
    3838
    39         real ts_cur
    40         common /sst_forcing/ts_cur ! also in read_tsurf1d.F
     39        !real ts_cur
     40        !common /sst_forcing/ts_cur ! also in read_tsurf1d.F
    4141!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    4242! Declarations specifiques au cas RICO
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/old_1D_interp_cases.h

    r3605 r3798  
    6262     &             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof    &
    6363     &             ,ht_prof,vt_prof,hq_prof,vq_prof)
    64 
    65         if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
     64! EV: tg instead of ts_cur
     65        if (type_ts_forcing.eq.1) tg = ts_prof !
    6666
    6767! vertical interpolation:
     
    113113!     print *,'llm l omega_profd',llm,l,omega_profd(l)
    114114!     enddo
    115 
    116         if (type_ts_forcing.eq.1) ts_cur = tg_prof ! SST used in read_tsurf1d
     115! EV tg instead of ts_cur
     116        if (type_ts_forcing.eq.1) tg = tg_prof ! SST used
    117117
    118118! vertical interpolation:
     
    206206     &             ,ug_gabls4,vg_gabls4,ht_gabls4,hq_gabls4,tg_gabls4                            &
    207207     &             ,ug_profg,vg_profg,ht_profg,hq_profg,tg_profg)
    208 
    209         if (type_ts_forcing.eq.1) ts_cur = tg_prof ! SST used in read_tsurf1d
     208!EV tg instead of ts_cur
     209        if (type_ts_forcing.eq.1) tg = tg_prof ! SST used
    210210
    211211! vertical interpolation:
     
    499499     &             ,nlev_sandu                                              &
    500500     &             ,ts_sandu,ts_prof)
    501 
    502         if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
     501! EV tg instead of ts_cur
     502        if (type_ts_forcing.eq.1) tg = ts_prof ! SST used in read_tsurf1d
    503503
    504504! vertical interpolation:
     
    582582     &             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof    &
    583583     &             ,ufa_prof,vfa_prof)
    584 
    585         if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
    586 
     584! EV tg instead of ts_cur
     585        if (type_ts_forcing.eq.1) tg = ts_prof ! SST used
    587586! vertical interpolation:
    588587      CALL interp_astex_vertical(play,nlev_astex,plev_profa                 &
     
    675674     &       ,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas,lat_prof_cas               &
    676675     &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas)
    677 
    678              ts_cur = ts_prof_cas
     676! EV tg instead of ts_cur
     677
     678             tg = ts_prof_cas
    679679             psurf=plev_prof_cas(1)
    680680
     
    850850     &       ,dth_prof_cas,hth_prof_cas,vth_prof_cas,lat_prof_cas                           &
    851851     &       ,sens_prof_cas,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas,tke_prof_cas)
    852 
    853              ts_cur = ts_prof_cas
     852! EV tg instead of ts_cur
     853
     854             tg = ts_prof_cas
    854855!            psurf=plev_prof_cas(1)
    855856             psurf=ps_prof_cas
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/old_1D_read_forc_cases.h

    r3605 r3798  
    875875
    876876! initial and boundary conditions :
    877 !      tsurf = ts_prof_cas
    878       ts_cur = ts_prof_cas
     877!     tsurf = ts_prof_cas
     878! EV tg instead of ts_cur
     879      tg= ts_prof_cas
    879880      psurf=plev_prof_cas(1)
    880881      write(*,*) 'SST initiale: ',tsurf
     
    965966! initial and boundary conditions :
    966967!      tsurf = ts_prof_cas
    967       ts_cur = ts_prof_cas
     968! EV tg instead of ts_cur
     969      tg = ts_prof_cas
    968970      psurf=plev_prof_cas(1)
    969971      write(*,*) 'SST initiale: ',tsurf
     
    10151017      if (forcing_SCM) then
    10161018
    1017          write(*,*),'avant call read_SCM'
    1018          call read_SCM_cas
     1019         write(*,*),'avant call old_read_SCM_cas'
     1020         call old_read_SCM_cas
    10191021         write(*,*) 'Forcing read'
    10201022
     
    10631065! initial and boundary conditions :
    10641066!      tsurf = ts_prof_cas
    1065       ts_cur = ts_prof_cas
     1067! EV tg instead of ts_cur
     1068
     1069      tg = ts_prof_cas
    10661070      psurf=plev_prof_cas(1)
    10671071      write(*,*) 'SST initiale: ',tsurf
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/old_lmdz1d.F90

    r3605 r3798  
    632632!          (phys_state_var_init is called again in physiq)
    633633      read_climoz = 0
    634 !
     634      nsw=6          ! EV et LF: sinon, falb_dir et falb_dif ne peuvent etre alloues
     635
     636
    635637      call phys_state_var_init(read_climoz)
    636638
     
    728730
    729731!Al1 pour SST forced, appell?? depuis ocean_forced_noice
    730       ts_cur = tsurf ! SST used in read_tsurf1d
     732! EV tg instead of ts_cur
     733
     734      tg = tsurf ! SST used in read_tsurf1d
    731735!=====================================================================
    732736! Initialisation de la physique :
     
    791795
    792796        fder=0.
     797        print *, 'snsrf', snsrf
    793798        snsrf(1,:)=snowmass ! masse de neige des sous surface
    794799        qsurfsrf(1,:)=qsurf ! humidite de l'air des sous surface
     
    841846     end if
    842847
    843 
    844848        print*,'nat_surf,pctsrf(1,is_oce),pctsrf(1,is_ter)',nat_surf         &
    845849     &        ,pctsrf(1,is_oce),pctsrf(1,is_ter)
     
    848852        zpic = zpicinp
    849853        ftsol=tsurf
    850         nsw=6 ! on met le nb de bandes SW=6, pour initialiser
    851               ! 6 albedo, mais on peut quand meme tourner avec
    852               ! moins. Seules les 2 ou 4 premiers seront lus
    853854        falb_dir=albedo
    854855        falb_dif=albedo
     
    913914        v_ancien(1,:)=v(:)
    914915
    915 u10m=0.
    916 v10m=0.
    917 ale_wake=0.
    918 ale_bl_stat=0.
     916        u10m=0.
     917        v10m=0.
     918        ale_wake=0.
     919        ale_bl_stat=0.
    919920 
    920921!------------------------------------------------------------------------
  • LMDZ6/branches/Ocean_skin/libf/phylmd/dyn1d/scm.F90

    r3605 r3798  
    7575      real :: zcufi    = 1.
    7676      real :: zcvfi    = 1.
    77 
    78 !-      real :: nat_surf
    79 !-      logical :: ok_flux_surf
    80 !-      real :: fsens
    81 !-      real :: flat
    82 !-      real :: tsurf
    83 !-      real :: rugos
    84 !-      real :: qsol(1:2)
    85 !-      real :: qsurf
    86 !-      real :: psurf
    87 !-      real :: zsurf
    88 !-      real :: albedo
    89 !-
    90 !-      real :: time     = 0.
    91 !-      real :: time_ini
    92 !-      real :: xlat
    93 !-      real :: xlon
    94 !-      real :: wtsurf
    95 !-      real :: wqsurf
    96 !-      real :: restart_runoff
    97 !-      real :: xagesno
    98 !-      real :: qsolinp
    99 !-      real :: zpicinp
    100 !-
    10177      real :: fnday
    10278      real :: day, daytime
     
    141117        logical :: forcing_case2   = .false.
    142118        logical :: forcing_SCM   = .false.
    143         integer :: type_ts_forcing ! 0 = SST constant; 1 = SST read from a file
    144 !                                                            (cf read_tsurf1d.F)
    145119
    146120!flag forcings
     
    148122        logical :: nudge_thermo=.false.
    149123        logical :: cptadvw=.true.
     124
     125
    150126!=====================================================================
    151127! DECLARATIONS FOR EACH CASE
     
    190166      real :: dt_cooling(llm),d_t_adv(llm),d_t_nudge(llm)
    191167      real :: d_u_nudge(llm),d_v_nudge(llm)
    192       real :: du_adv(llm),dv_adv(llm)
    193       real :: du_age(llm),dv_age(llm)
     168!      real :: d_u_adv(llm),d_v_adv(llm)
     169      real :: d_u_age(llm),d_v_age(llm)
    194170      real :: alpha
    195171      real :: ttt
     
    248224!
    249225      integer :: it_end ! iteration number of the last call
    250 !Al1
     226!Al1,plev,play,phi,phis,presnivs,
    251227      integer ecrit_slab_oc !1=ecrit,-1=lit,0=no file
    252228      data ecrit_slab_oc/-1/
     
    273249      d_u_nudge(:)=0.
    274250      d_v_nudge(:)=0.
    275       du_adv(:)=0.
    276       dv_adv(:)=0.
    277       du_age(:)=0.
    278       dv_age(:)=0.
     251      d_u_adv(:)=0.
     252      d_v_adv(:)=0.
     253      d_u_age(:)=0.
     254      d_v_age(:)=0.
     255     
    279256     
    280257! Initialization of Common turb_forcing
     
    290267! OPTIONS OF THE 1D SIMULATION (lmdz1d.def => unicol.def)
    291268!---------------------------------------------------------------------
    292 !Al1
    293269        call conf_unicol
    294270!Al1 moves this gcssold var from common fcg_gcssold to
     
    296272! --------------------------------------------------------------------
    297273        close(1)
    298 !Al1
    299274        write(*,*) 'lmdz1d.def lu => unicol.def'
    300275
     
    302277       year_ini_cas=1997
    303278       ! It is possible that those parameters are run twice.
    304 
    305279       ! A REVOIR : LIRE PEUT ETRE AN MOIS JOUR DIRECETEMENT
     280
     281
    306282       call getin('anneeref',year_ini_cas)
    307283       call getin('dayref',day_deb)
     
    309285       call getin('time_ini',heure_ini_cas)
    310286
    311         type_ts_forcing = 0
    312         IF (nat_surf==0) type_ts_forcing=1 ! SST forcee sur OCEAN
    313         print*,'NATURE DE LA SURFACE ',nat_surf
     287      print*,'NATURE DE LA SURFACE ',nat_surf
    314288!
    315289! Initialization of the logical switch for nudging
     290
    316291     jcode = iflag_nudge
    317292     do i = 1,nudge_max
     
    319294       jcode = jcode/10
    320295     enddo
    321 !---------------------------------------------------------------------
     296!-----------------------------------------------------------------------
    322297!  Definition of the run
    323 !---------------------------------------------------------------------
     298!-----------------------------------------------------------------------
    324299
    325300      call conf_gcm( 99, .TRUE. )
     
    343318      allocate( phy_flic(year_len)) ! Fraction de glace
    344319      phy_flic(:)=0.0
     320
     321
    345322!-----------------------------------------------------------------------
    346323!   Choix du calendrier
     
    373350!      Le numero du jour est dans "day". L heure est traitee separement.
    374351!      La date complete est dans "daytime" (l'unite est le jour).
     352
     353
    375354      if (nday>0) then
    376355         fnday=nday
     
    409388! Initialization of dimensions, geometry and initial state
    410389!---------------------------------------------------------------------
    411 !      call init_phys_lmdz(1,1,llm,1,(/1/)) ! job now done via iniphysiq
     390!     call init_phys_lmdz(1,1,llm,1,(/1/)) ! job now done via iniphysiq
    412391!     but we still need to initialize dimphy module (klon,klev,etc.)  here.
    413392      call init_dimphy1D(1,llm)
     
    433412!          (phys_state_var_init is called again in physiq)
    434413      read_climoz = 0
    435 !
     414      nsw=6
     415
    436416      call phys_state_var_init(read_climoz)
    437417
     
    446426!!! Feedback forcing values for Gateaux differentiation (al1)
    447427!!!=====================================================================
    448 !!! Surface Planck forcing bracketing call radiation
    449 !!      surf_Planck = 0.
    450 !!      surf_Conv   = 0.
    451 !!      write(*,*) 'Gateaux-dif Planck,Conv:',surf_Planck,surf_Conv
    452 !!! a mettre dans le lmdz1d.def ou autre
    453 !!
    454428!!
    455429      qsol = qsolinp
     
    469443      ENDIF
    470444      print*,'Flux sol ',fsens,flat
    471 !!      ok_flux_surf=.false.
    472 !!      fsens=-wtsurf*rcpd*rho(1)
    473 !!      flat=-wqsurf*rlvtt*rho(1)
    474 !!!!
    475445
    476446! Vertical discretization and pressure levels at half and mid levels:
     
    496466      plev =ap+bp*psurf
    497467      play = 0.5*(plev(1:llm)+plev(2:llm+1))
    498       zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles
     468      zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles.
    499469
    500470      IF (forcing_type .eq. 59) THEN
     
    527497      print*,'mxcalc=',mxcalc
    528498!     print*,'zlay=',zlay(mxcalc)
    529       print*,'play=',play(mxcalc)
    530 
    531 !Al1 pour SST forced, appell?? depuis ocean_forced_noice
    532       ts_cur = tsurf ! SST used in read_tsurf1d
     499!      print*,'play=',play(mxcalc)
     500
     501!! When surface temperature is forced
     502      tg= tsurf ! surface T used in read_tsurf1d
     503
     504
    533505!=====================================================================
    534506! Initialisation de la physique :
     
    546518! airefi,zcufi,zcvfi initialises au debut de ce programme
    547519! rday,ra,rg,rd,rcpd declares dans YOMCST.h et calcules dans suphel.F
     520
     521
    548522      day_step = float(nsplit_phys)*day_step/float(iphysiq)
    549523      write (*,*) 'Time step divided by nsplit_phys (=',nsplit_phys,')'
     
    563537     ! e.g. for cell boundaries, which are meaningless in 1D; so pad these
    564538     ! with '0.' when necessary
     539
    565540      call iniphysiq(iim,jjm,llm, &
    566541           1,comm_lmdz, &
     
    650625        zpic = zpicinp
    651626        ftsol=tsurf
    652         nsw=6 ! on met le nb de bandes SW=6, pour initialiser
    653               ! 6 albedo, mais on peut quand meme tourner avec
    654               ! moins. Seules les 2 ou 4 premiers seront lus
    655627        falb_dir=albedo
    656628        falb_dif=albedo
     
    664636        prw_ancien = 0.
    665637!jyg<
    666 !!        pbl_tke(:,:,:)=1.e-8
    667         pbl_tke(:,:,:)=0.
    668         pbl_tke(:,2,:)=1.e-2
    669         PRINT *, ' pbl_tke dans lmdz1d '
    670         if (prt_level .ge. 5) then
    671          DO nsrf = 1,4
    672            PRINT *,'pbl_tke(1,:,',nsrf,') ',pbl_tke(1,:,nsrf)
    673          ENDDO
    674         end if
    675 
     638! Etienne: comment those lines since now the TKE is inialized in 1D_read_forc_cases
     639!!      pbl_tke(:,:,:)=1.e-8
     640!        pbl_tke(:,:,:)=0.
     641!        pbl_tke(:,2,:)=1.e-2
    676642!>jyg
    677 
    678643        rain_fall=0.
    679644        snow_fall=0.
     
    715680        v_ancien(1,:)=v(:)
    716681 
    717 u10m=0.
    718 v10m=0.
    719 ale_wake=0.
    720 ale_bl_stat=0.
     682        u10m=0.
     683        v10m=0.
     684        ale_wake=0.
     685        ale_bl_stat=0.
    721686
    722687!------------------------------------------------------------------------
     
    738703! to be set at some arbitratry convenient values.
    739704!------------------------------------------------------------------------
    740 !Al1 =============== restart option ==========================
     705!Al1 =============== restart option ======================================
    741706        if (.not.restart) then
    742707          iflag_pbl = 5
     
    803768       print*,'plev,play,phi,phis,presnivs,u,v,temp,q,omega2'
    804769       print*,'temp(1),q(1,1),u(1),v(1),plev(1),phis :'
    805        print*,temp(1),q(1,1),u(1),v(1),plev(1),phis
     770       print*,temp(1),q(1,1),u(1),v(1),plev(1),phis(1)
    806771! raz for safety
    807772       do l=1,llm
     
    809774       enddo
    810775      endif
    811 !Al1 ================  end restart =================================
     776!======================  end restart =================================
    812777      IF (ecrit_slab_oc.eq.1) then
    813778         open(97,file='div_slab.dat',STATUS='UNKNOWN')
     
    820785       CALL iophys_ini
    821786#endif
     787
     788!=====================================================================
    822789! START OF THE TEMPORAL LOOP :
    823790!=====================================================================
    824791           
    825792      it_end = nint(fnday*day_step)
    826 !test JLD     it_end = 10
    827793      do while(it.le.it_end)
    828794
     
    832798         print*,'PAS DE TEMPS ',timestep
    833799       endif
    834 !Al1 demande de restartphy.nc
    835800       if (it.eq.it_end) lastcall=.True.
    836801
     
    840805
    841806#include "1D_interp_cases.h"
    842    ! Vertical advection
    843 !  call lstendH(llm,nqtot,omega,d_t_vert_adv,d_q_vert_adv,q,temp,u,v,play)
    844 !  print*,'B d_t_adv ',d_t_adv(1:20)*86400
    845 !  print*,'B d_t_vert_adv ',d_t_vert_adv(1:20)*86400
    846 !  print*,'B dt omega ',omega
    847807
    848808!---------------------------------------------------------------------
    849809!  Geopotential :
    850810!---------------------------------------------------------------------
    851 
     811!        phis(1)=zsurf*RG
     812!        phi(1)=phis(1)+RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1)))
    852813        phi(1)=RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1)))
     814
    853815        do l = 1, llm-1
    854816          phi(l+1)=phi(l)+RD*(temp(l)+temp(l+1))*                           &
    855817     &    (play(l)-play(l+1))/(play(l)+play(l+1))
    856818        enddo
     819
    857820
    858821!---------------------------------------------------------------------
     
    872835      teta=temp*(pzero/play)**rkappa
    873836      do l=2,llm-1
     837        ! vertical tendencies computed as d X / d t = -W  d X / d z
    874838        d_u_vert_adv(l)=-w_adv(l)*(u(l+1)-u(l-1))/(z_adv(l+1)-z_adv(l-1))
    875839        d_v_vert_adv(l)=-w_adv(l)*(v(l+1)-v(l-1))/(z_adv(l+1)-z_adv(l-1))
    876         d_t_vert_adv(l)=-(w_adv(l)*(teta(l+1)-teta(l-1))/(z_adv(l+1)-z_adv(l-1)))/(pzero/play(l))**rkappa
     840        ! d theta / dt = -W d theta / d z, transformed into d temp / d t dividing by (pzero/play(l))**rkappa
     841        d_t_vert_adv(l)=-w_adv(l)*(teta(l+1)-teta(l-1))/(z_adv(l+1)-z_adv(l-1)) / (pzero/play(l))**rkappa
    877842        d_q_vert_adv(l,1)=-w_adv(l)*(q(l+1,1)-q(l-1,1))/(z_adv(l+1)-z_adv(l-1))
    878843      enddo
     844      d_u_adv(:)=d_u_adv(:)+d_u_vert_adv(:)
     845      d_v_adv(:)=d_v_adv(:)+d_v_vert_adv(:)
    879846      d_t_adv(:)=d_t_adv(:)+d_t_vert_adv(:)
    880847      d_q_adv(:,1)=d_q_adv(:,1)+d_q_vert_adv(:,1)
     
    938905       fcoriolis=2.*sin(rpi*xlat/180.)*romega
    939906
    940 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    941 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    942 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    943 !       if (forcing_radconv .or. forcing_fire) then
    944 !         fcoriolis=0.0
    945 !         dt_cooling=0.0
    946 !         d_t_adv=0.0
    947 !         d_q_adv=0.0
    948 !       endif
    949 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    950 
    951 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    952 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    953 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    954 !      if (forcing_toga .or. forcing_GCSSold .or. forcing_twpice            &
    955 !    &    .or.forcing_amma .or. forcing_type.eq.101) then
    956 !        fcoriolis=0.0 ; ug=0. ; vg=0.
    957 !      endif
    958 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    959 
    960 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    961 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    962 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    963 !      if(forcing_rico) then
    964 !         dt_cooling=0.
    965 !      endif
    966 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    967 
    968 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    969 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    970 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    971 !CRio:Attention modif sp??cifique cas de Caroline
    972 !     if (forcing_type==-1) then
    973 !        fcoriolis=0.
    974 !       
    975 !on calcule dt_cooling
    976 !       do l=1,llm
    977 !       if (play(l).ge.20000.) then
    978 !           dt_cooling(l)=-1.5/86400.
    979 !       elseif ((play(l).ge.10000.).and.((play(l).lt.20000.))) then
    980 !           dt_cooling(l)=-1.5/86400.*(play(l)-10000.)/(10000.)-1./86400.*(20000.-play(l))/10000.*(temp(l)-200.)
    981 !       else
    982 !           dt_cooling(l)=-1.*(temp(l)-200.)/86400.
    983 !       endif
    984 !       enddo
    985 !
    986 !     endif     
    987 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    988 
    989 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    990 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    991 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    992 !     if (forcing_sandu) then
    993 !        ug(1:llm)=u_mod(1:llm)
    994 !        vg(1:llm)=v_mod(1:llm)
    995 !     endif
    996 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    997 
    998907      IF (prt_level >= 5) print*, 'fcoriolis, xlat,mxcalc ', &
    999908                                   fcoriolis, xlat,mxcalc
    1000909
    1001 !       print *,'u-ug=',u-ug
    1002 
    1003 !!!!!!!!!!!!!!!!!!!!!!!!
    1004 ! Geostrophic wind
    1005 ! Le calcul ci dessous est insuffisamment precis
    1006 !      du_age(1:mxcalc)=fcoriolis*(v(1:mxcalc)-vg(1:mxcalc))
    1007 !      dv_age(1:mxcalc)=-fcoriolis*(u(1:mxcalc)-ug(1:mxcalc))
    1008 !!!!!!!!!!!!!!!!!!!!!!!!
     910!---------------------------------------------------------------------
     911! Geostrophic forcing
     912!---------------------------------------------------------------------
     913
     914      IF ( forc_geo == 0 ) THEN
     915              d_u_age(1:mxcalc)=0.
     916              d_v_age(1:mxcalc)=0.
     917      ELSE
    1009918       sfdt = sin(0.5*fcoriolis*timestep)
    1010919       cfdt = cos(0.5*fcoriolis*timestep)
    1011 !       print *,'fcoriolis,sfdt,cfdt,timestep',fcoriolis,sfdt,cfdt,timestep
    1012 !
    1013         du_age(1:mxcalc)= -2.*sfdt/timestep*                                &
     920
     921        d_u_age(1:mxcalc)= -2.*sfdt/timestep*                                &
    1014922     &          (sfdt*(u(1:mxcalc)-ug(1:mxcalc)) -                          &
    1015923     &           cfdt*(v(1:mxcalc)-vg(1:mxcalc))  )
    1016924!!     : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc))
    1017925!
    1018        dv_age(1:mxcalc)= -2.*sfdt/timestep*                                 &
     926       d_v_age(1:mxcalc)= -2.*sfdt/timestep*                                 &
    1019927     &          (cfdt*(u(1:mxcalc)-ug(1:mxcalc)) +                           &
    1020928     &           sfdt*(v(1:mxcalc)-vg(1:mxcalc))  )
    1021929!!     : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc))
    1022 !
    1023 !!!!!!!!!!!!!!!!!!!!!!!!
     930      ENDIF
     931!
     932!---------------------------------------------------------------------
    1024933!  Nudging
    1025 !!!!!!!!!!!!!!!!!!!!!!!!
     934!---------------------------------------------------------------------
    1026935      d_t_nudge(:) = 0.
    1027936      d_u_nudge(:) = 0.
     
    1039948      ENDDO
    1040949
     950!---------------------------------------------------------------------
     951!  Optional outputs
     952!---------------------------------------------------------------------
    1041953#ifdef OUTPUT_PHYS_SCM
    1042954      CALL iophys_ecrit('w_adv',klev,'w_adv','K/day',w_adv)
     
    1056968#endif
    1057969
    1058 !
    1059 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1060 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    1061 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1062 !       if (forcing_fire) THEN
    1063 !               print*,'Enlever cette section rapidement'
    1064 !               stop
    1065 !               
    1066 !
    1067 !!let ww=if ( alt le 1100 ) then alt*-0.00001 else 0
    1068 !!let wt=if ( alt le 1100 ) then min( -3.75e-5 , -7.5e-8*alt)  else 0
    1069 !!let wq=if ( alt le 1100 ) then max( 1.5e-8 , 3e-11*alt)  else 0
    1070 !           d_t_adv=0.
    1071 !           d_q_adv=0.
    1072 !           teta=temp*(pzero/play)**rkappa
    1073 !           d_t_adv=0.
    1074 !           d_q_adv=0.
    1075 !           do l=2,llm-1
    1076 !              if (zlay(l)<=1100) then
    1077 !                  wwww=-0.00001*zlay(l)
    1078 !                  d_t_adv(l)=-wwww*(teta(l)-teta(l+1))/(zlay(l)-zlay(l+1)) /(pzero/play(l))**rkappa
    1079 !                  d_q_adv(l,1:2)=-wwww*(q(l,1:2)-q(l+1,1:2))/(zlay(l)-zlay(l+1))
    1080 !                  d_t_adv(l)=d_t_adv(l)+min(-3.75e-5 , -7.5e-8*zlay(l))
    1081 !                  d_q_adv(l,1)=d_q_adv(l,1)+max( 1.5e-8 , 3e-11*zlay(l))
    1082 !              endif
    1083 !           enddo
    1084 !
    1085 !        endif
    1086 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1087 
    1088 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1089 !         call  writefield_phy('dv_age' ,dv_age,llm)
    1090 !         call  writefield_phy('du_age' ,du_age,llm)
    1091 !         call  writefield_phy('du_phys' ,du_phys,llm)
    1092 !         call  writefield_phy('u_tend' ,u,llm)
    1093 !         call  writefield_phy('u_g' ,ug,llm)
    1094 !
    1095 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1096 !! Increment state variables
    1097 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1098970    IF (flag_inhib_forcing == 0) then ! if tendency of forcings should be added
    1099971
    1100 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1101 !! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    1102 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1103 ! pour les cas sandu et astex, on reclacule u,v,q,temp et teta dans 1D_nudge_sandu_astex.h
    1104 ! au dessus de 700hpa, on relaxe vers les profils initiaux
    1105 !     if (forcing_sandu .OR. forcing_astex) then
    1106 !#include "1D_nudge_sandu_astex.h"
    1107 !      else
    1108 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1109972        u(1:mxcalc)=u(1:mxcalc) + timestep*(                                &
    1110973     &              du_phys(1:mxcalc)                                       &
    1111      &             +du_age(1:mxcalc)+du_adv(1:mxcalc)                       &
     974     &             +d_u_age(1:mxcalc)+d_u_adv(1:mxcalc)                       &
    1112975     &             +d_u_nudge(1:mxcalc) )           
    1113976        v(1:mxcalc)=v(1:mxcalc) + timestep*(                                 &
    1114977     &              dv_phys(1:mxcalc)                                       &
    1115      &             +dv_age(1:mxcalc)+dv_adv(1:mxcalc)                       &
     978     &             +d_v_age(1:mxcalc)+d_v_adv(1:mxcalc)                       &
    1116979     &             +d_v_nudge(1:mxcalc) )
    1117980        q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*(                              &
     
    1125988     &              temp(1),dt_phys(1),d_t_adv(1),dt_cooling(1)
    1126989           print* ,'dv_phys=',dv_phys
    1127            print* ,'dv_age=',dv_age
    1128            print* ,'dv_adv=',dv_adv
     990           print* ,'d_v_age=',d_v_age
     991           print* ,'d_v_adv=',d_v_adv
    1129992           print* ,'d_v_nudge=',d_v_nudge
    1130993           print*, v
     
    1134997        temp(1:mxcalc)=temp(1:mxcalc)+timestep*(                            &
    1135998     &              dt_phys(1:mxcalc)                                       &
    1136      &             +d_t_adv(1:mxcalc)                                      &
    1137      &             +d_t_nudge(1:mxcalc)                                      &
     999     &             +d_t_adv(1:mxcalc)                                       &
     1000     &             +d_t_nudge(1:mxcalc)                                     &
    11381001     &             +dt_cooling(1:mxcalc))  ! Taux de chauffage ou refroid.
    11391002
    11401003
    1141 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1004!=======================================================================
    11421005!! CONSERVE EN ATTENDANT QUE LE CAS EN QUESTION FONCTIONNE EN STD !!
    1143 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1144 !     endif  ! forcing_sandu or forcing_astex
    1145 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1006!=======================================================================
    11461007
    11471008        teta=temp*(pzero/play)**rkappa
    1148 !
     1009
    11491010!---------------------------------------------------------------------
    11501011!   Nudge soil temperature if requested
     
    11841045
    11851046!  incremente day time
    1186 !        print*,'daytime bef',daytime,1./day_step
    11871047        daytime = daytime+1./day_step
    1188 !Al1dbg
    11891048        day = int(daytime+0.1/day_step)
    11901049!        time = max(daytime-day,0.0)
     
    11921051!cc        time = real(mod(it,day_step))/day_step
    11931052        time = time_ini/24.+real(mod(it,day_step))/day_step
    1194 !        print*,'daytime nxt time',daytime,time
    11951053        it=it+1
    11961054
    11971055      enddo
    11981056
    1199 !Al1
    12001057      if (ecrit_slab_oc.ne.-1) close(97)
    12011058
    12021059!Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?)
    1203 ! -------------------------------------
     1060! ---------------------------------------------------------------------------
    12041061       call dyn1dredem("restart1dyn.nc",                                    &
    12051062     &              plev,play,phi,phis,presnivs,                            &
  • LMDZ6/branches/Ocean_skin/libf/phylmd/flux_arp.h

    r2329 r3798  
    11!
    22! $Id: flux_arp.h 2010-08-04 17:02:56Z lahellec $
     3! Modif EV, 10/2020
    34!
    45      logical :: ok_flux_surf
    56      logical :: ok_prescr_ust !for prescribed ustar
     7      logical :: ok_prescr_beta
     8      logical :: ok_forc_tsurf
     9
     10
    611      real :: fsens
    712      real :: flat
     13      real :: betaevap
    814      real :: ust
    915      real :: tg
    1016
    11       common /flux_arp/fsens,flat,ust,tg,ok_flux_surf,ok_prescr_ust
     17      common /flux_arp/fsens,flat,ust,tg,ok_flux_surf,ok_prescr_ust,ok_prescr_beta,betaevap,ok_forc_tsurf
    1218
    1319!$OMP THREADPRIVATE(/flux_arp/)
    1420
    1521
     22     
    1623
    17 
  • LMDZ6/branches/Ocean_skin/libf/phylmd/infotrac_phy.F90

    r3043 r3798  
    2121!$OMP THREADPRIVATE(nbtr)
    2222
     23#ifdef CPP_StratAer
     24! nbtr_bin: number of aerosol bins for StratAer model
     25! nbtr_sulgas: number of sulfur gases for StratAer model
     26  INTEGER, SAVE :: nbtr_bin, nbtr_sulgas
     27!$OMP THREADPRIVATE(nbtr_bin,nbtr_sulgas)
     28  INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat
     29!$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat)
     30#endif
     31
    2332! CRisi: nb traceurs pères= directement advectés par l'air
    2433  INTEGER, SAVE :: nqperes
     34!$OMP THREADPRIVATE(nqperes)
    2535
    2636! Name variables
     
    94104                               iso_indnum_,zone_num_,phase_num_,&
    95105                               indnum_fn_num_,index_trac_,&
    96                                niso_,ntraceurs_zone_,ntraciso_)
     106                               niso_,ntraceurs_zone_,ntraciso_&
     107#ifdef CPP_StratAer
     108                               ,nbtr_bin_,nbtr_sulgas_&
     109                               ,id_OCS_strat_,id_SO2_strat_,id_H2SO4_strat_,id_BIN01_strat_&
     110#endif
     111                               )
    97112
    98113    ! transfer information on tracers from dynamics to physics
     
    103118    INTEGER,INTENT(IN) :: nqo_
    104119    INTEGER,INTENT(IN) :: nbtr_
     120#ifdef CPP_StratAer
     121    INTEGER,INTENT(IN) :: nbtr_bin_
     122    INTEGER,INTENT(IN) :: nbtr_sulgas_
     123    INTEGER,INTENT(IN) :: id_OCS_strat_
     124    INTEGER,INTENT(IN) :: id_SO2_strat_
     125    INTEGER,INTENT(IN) :: id_H2SO4_strat_
     126    INTEGER,INTENT(IN) :: id_BIN01_strat_
     127#endif
    105128    CHARACTER(len=20),INTENT(IN) :: tname_(nqtot_) ! tracer short name for restart and diagnostics
    106129    CHARACTER(len=23),INTENT(IN) :: ttext_(nqtot_) ! tracer long name for diagnostics
     
    140163    nqo=nqo_
    141164    nbtr=nbtr_
     165#ifdef CPP_StratAer
     166    nbtr_bin=nbtr_bin_
     167    nbtr_sulgas=nbtr_sulgas_
     168    id_OCS_strat=id_OCS_strat_
     169    id_SO2_strat=id_SO2_strat_
     170    id_H2SO4_strat=id_H2SO4_strat_
     171    id_BIN01_strat=id_BIN01_strat_
     172#endif
    142173    ALLOCATE(tname(nqtot))
    143174    tname(:) = tname_(:)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/ocean_forced_mod.F90

    r3687 r3798  
    3939    INCLUDE "YOMCST.h"
    4040    INCLUDE "clesphys.h"
    41 
     41    INCLUDE "flux_arp.h"
    4242
    4343! Input arguments
     
    9696!!jyg    if (knon.eq.1) then ! single-column model
    9797    if (klon_glo.eq.1) then ! single-column model
    98       CALL read_tsurf1d(knon,tsurf_lim) ! new
     98      ! EV: now surface Tin flux_arp.h
     99      !CALL read_tsurf1d(knon,tsurf_lim) ! new
     100       DO i = 1, knon
     101        tsurf_lim(i) = tg
     102       ENDDO
     103
    99104    else ! GCM
    100105      CALL limit_read_sst(knon,knindex,tsurf_lim)
     
    108113!****************************************************************************************
    109114! Set some variables for calcul_fluxs
    110     cal = 0.
    111     beta = 1.
    112     dif_grnd = 0.
     115    !cal = 0.
     116    !beta = 1.
     117    !dif_grnd = 0.
     118   
     119   
     120    ! EV: use calbeta to calculate beta
     121    ! Need to initialize qsurf for calbeta but it is not modified by this routine
     122    qsurf(:)=0.
     123    CALL calbeta(dtime, is_oce, knon, snow, qsurf, beta, cal, dif_grnd)
     124
     125
    113126    alb_neig(:) = 0.
    114127    agesno(:) = 0.
     
    174187    USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
    175188
    176 !    INCLUDE "indicesol.h"
     189!   INCLUDE "indicesol.h"
    177190    INCLUDE "dimsoil.h"
    178191    INCLUDE "YOMCST.h"
    179192    INCLUDE "clesphys.h"
     193    INCLUDE "flux_arp.h"
    180194
    181195! Input arguments
     
    240254    tsurf_tmp(:) = tsurf_in(:)
    241255
    242 ! calculate the parameters cal, beta, capsol and dif_grnd
     256! calculate the parameters cal, beta, capsol and dif_grnd and then recalculate cal
    243257    CALL calbeta(dtime, is_sic, knon, snow, qsol, beta, capsol, dif_grnd)
    244258
     
    256270    ENDIF
    257271
    258     beta = 1.0
     272!    beta = 1.0
    259273    lat_prec_liq = 0.; lat_prec_sol = 0.
    260274
     
    314328! 1D case
    315329!************************************************************************
    316   SUBROUTINE read_tsurf1d(knon,sst_out)
    317 
     330!  SUBROUTINE read_tsurf1d(knon,sst_out)
     331!
    318332! This subroutine specifies the surface temperature to be used in 1D simulations
    319 
    320       USE dimphy, ONLY : klon
    321 
    322       INTEGER, INTENT(IN)                  :: knon     ! nomber of points on compressed grid
    323       REAL, DIMENSION(klon), INTENT(OUT)   :: sst_out  ! tsurf used to force the single-column model
    324 
    325        INTEGER :: i
     333!
     334!      USE dimphy, ONLY : klon
     335!
     336!      INTEGER, INTENT(IN)                  :: knon     ! nomber of points on compressed grid
     337!      REAL, DIMENSION(klon), INTENT(OUT)   :: sst_out  ! tsurf used to force the single-column model
     338!
     339!       INTEGER :: i
    326340! COMMON defined in lmdz1d.F:
    327        real ts_cur
    328        common /sst_forcing/ts_cur
    329 
    330        DO i = 1, knon
    331         sst_out(i) = ts_cur
    332        ENDDO
    333 
    334       END SUBROUTINE read_tsurf1d
    335 
     341!       real ts_cur
     342!       common /sst_forcing/ts_cur
     343!
     344!       DO i = 1, knon
     345!        sst_out(i) = ts_cur
     346!       ENDDO
     347!
     348!      END SUBROUTINE read_tsurf1d
     349!
    336350!
    337351!************************************************************************
    338 !
    339352END MODULE ocean_forced_mod
    340353
  • LMDZ6/branches/Ocean_skin/libf/phylmd/ocean_slab_mod.F90

    r3102 r3798  
    421421!   
    422422!****************************************************************************************
    423     cal(:)      = 0. ! infinite thermal inertia
    424     beta(:)     = 1. ! wet surface
    425     dif_grnd(:) = 0. ! no diffusion into ground
     423    !cal(:)      = 0. ! infinite thermal inertia
     424    !beta(:)     = 1. ! wet surface
     425    !dif_grnd(:) = 0. ! no diffusion into ground
     426    ! EV: use calbeta
     427    CALL calbeta(dtime, is_oce, knon, snow,qsurf, beta, cal, dif_grnd)
     428
     429
    426430   
    427431! Suppose zero surface speed
     
    742746! set beta, cal, compute conduction fluxes inside ice/snow
    743747    slab_bilg(:)=0.
    744     dif_grnd(:)=0.
    745     beta(:) = 1.
     748    !dif_grnd(:)=0.
     749    !beta(:) = 1.
     750    ! EV: use calbeta to calculate beta and then recalculate properly cal
     751    CALL calbeta(dtime, is_sic, knon, snow, qsol, beta, cal, dif_grnd)
     752
     753
    746754    DO i=1,knon
    747755    ki=knindex(i)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/pbl_surface_mod.F90

    r3767 r3798  
    165165       rlon,      rlat,      rugoro,   rmu0,          &
    166166       zsig,      lwdown_m,  pphi,     cldt,          &
    167        rain_f,    snow_f,    solsw_m,  sollw_m,       &
     167       rain_f,    snow_f,    solsw_m,  solswfdiff_m, sollw_m,       &
    168168       gustiness,                                     &
    169169       t,         q,         u,        v,             &
     
    207207!jyg<
    208208!!       zxfluxt,   zxfluxq,   q2m,      flux_q, tke,   &
    209        zxfluxt,   zxfluxq,   q2m,      flux_q, tke_x,   &
     209       zxfluxt,   zxfluxq,   q2m,      flux_q, tke_x,  &
    210210!>jyg
    211211!!! nrlmd+jyg le 02/05/2011 et le 20/02/2012
     
    287287    USE carbon_cycle_mod,   ONLY : carbon_cycle_cpl, carbon_cycle_tr, level_coupling_esm
    288288    USE carbon_cycle_mod,   ONLY : co2_send, nbcf_out, fields_out, yfields_out, cfname_out
     289    use hbtm_mod, only: hbtm
    289290    USE indice_sol_mod
    290291    USE time_phylmdz_mod,   ONLY : day_ini,annee_ref,itau_phy
     
    326327    REAL, DIMENSION(klon),        INTENT(IN)        :: snow_f  ! snow fall
    327328    REAL, DIMENSION(klon),        INTENT(IN)        :: solsw_m ! net shortwave radiation at mean surface
     329    REAL, DIMENSION(klon),        INTENT(IN)        :: solswfdiff_m ! diffuse fraction fordownward shortwave radiation at mean surface
    328330    REAL, DIMENSION(klon),        INTENT(IN)        :: sollw_m ! net longwave radiation at mean surface
    329331    REAL, DIMENSION(klon,klev),   INTENT(IN)        :: t       ! temperature (K)
     
    461463    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zxfluxu    ! u wind tension, mean for each grid point
    462464    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zxfluxv    ! v wind tension, mean for each grid point
    463     REAL, DIMENSION(klon, nbsrf+1), INTENT(INOUT)     :: z0m,z0h      ! rugosity length (m)
    464     REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)       :: agesno   ! age of snow at surface
     465    REAL, DIMENSION(klon, nbsrf+1), INTENT(INOUT)   :: z0m,z0h      ! rugosity length (m)
     466    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: agesno   ! age of snow at surface
    465467    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: solsw      ! net shortwave radiation at surface
    466468    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: sollw      ! net longwave radiation at surface
    467469    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: d_ts       ! change in temperature at surface
    468     REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)       :: evap     ! evaporation at surface
     470    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: evap     ! evaporation at surface
    469471    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: fluxlat    ! latent flux
    470472    REAL, DIMENSION(klon, nbsrf), INTENT(OUT)       :: t2m        ! temperature at 2 meter height
     
    856858       ! Initialize ok_flux_surf (for 1D model)
    857859       if (klon_glo>1) ok_flux_surf=.FALSE.
     860       if (klon_glo>1) ok_forc_tsurf=.FALSE.
    858861
    859862       ! intialize beta_land
     
    958961!!    tke(:,:,is_ave)=0.
    959962    tke_x(:,:,is_ave)=0.
     963
    960964    wake_dltke(:,:,is_ave)=0.
    961965!>jyg
     
    977981    yqsurf = 0.0  ; yalb = 0.0 ; yalb_vis = 0.0
    978982!albedo SB <<<
    979     yrain_f = 0.0 ; ysnow_f = 0.0    ; yfder = 0.0     ; ysolsw = 0.0   
     983    yrain_f = 0.0 ; ysnow_f = 0.0    ; yfder = 0.0     ; ysolsw = 0.0
    980984    ysollw = 0.0  ; yz0m = 0.0 ; yz0h = 0.0    ; yu1 = 0.0   
    981985    yv1 = 0.0     ; ypaprs = 0.0     ; ypplay = 0.0
     
    988992!!    d_t_diss= 0.0 ;d_u = 0.0     ; d_v = 0.0
    989993    yqsol = 0.0   
    990     ytherm = 0.0  ; ytke=0.
     994
     995    ytke=0.
    991996!FC
    992997    y_treedrg=0.
     
    11951200!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    11961201
     1202!--OB this line is not satisfactory because alb is the direct albedo not total albedo
    11971203          solsw(i,nsrf) = solsw_m(i) * (1.-alb(i,nsrf)) / (1.-alb_m(i))
    11981204       ENDDO
     
    12171223!>al1
    12181224
     1225!--OB add diffuse fraction of SW down
     1226   DO n=1,nbcf_out
     1227       IF (cfname_out(n) == "swdownfdiff" ) fields_out(:,n) = solswfdiff_m(:)
     1228   ENDDO
    12191229! >> PC
    12201230   IF (carbon_cycle_cpl .AND. carbon_cycle_tr .AND. nbcf_out.GT.0 ) THEN
     
    13931403             ytke_w(j,k)      = tke_x(i,k,nsrf)+wake_dltke(i,k,nsrf)
    13941404             ywake_dltke(j,k) = wake_dltke(i,k,nsrf)
     1405           
    13951406!>jyg
    13961407          ENDDO
     
    14771488      ENDDO
    14781489     ENDIF
     1490
    14791491        IF (prt_level >=10) print *,'clcdrag -> ycdragh ', ycdragh
    14801492       ELSE  !(iflag_split .eq.0)
     
    15601572      print *,' args coef_diff_turb: ycdragh ', ycdragh
    15611573      print *,' args coef_diff_turb: ytke ', ytke
     1574
    15621575       ENDIF
    15631576        CALL coef_diff_turb(dtime, nsrf, knon, ni,  &
     
    15891602      print *,' args coef_diff_turb: ycdragh_x ', ycdragh_x
    15901603      print *,' args coef_diff_turb: ytke_x ', ytke_x
     1604
    15911605       ENDIF
    15921606        CALL coef_diff_turb(dtime, nsrf, knon, ni,  &
     
    20372051!
    20382052!****************************************************************************************
    2039 
    2040 !!!
    2041 !!! jyg le 10/04/2013
     2053!!
     2054!!!
     2055!!! jyg le 10/04/2013 et EV 10/2020
     2056
     2057        IF (ok_forc_tsurf) THEN
     2058            DO j=1,knon
     2059                ytsurf_new(j)=tg
     2060                y_d_ts(j) = ytsurf_new(j) - yts(j)
     2061            ENDDO
     2062        ENDIF ! ok_forc_tsurf
     2063
    20422064!!!
    20432065        IF (ok_flux_surf) THEN
     
    24682490              tke_x(i,k,nsrf)    = ytke(j,k)
    24692491              tke_x(i,k,is_ave) = tke_x(i,k,is_ave) + ytke(j,k)*ypct(j)
     2492
    24702493!>jyg
    24712494           ENDDO
     
    24812504!!            tke(i,k,is_ave) = tke(i,k,is_ave) + tke(i,k,nsrf)*ypct(j)
    24822505            tke_x(i,k,nsrf)   = ytke_x(j,k)
    2483             tke_x(i,k,is_ave)   = tke_x(i,k,is_ave) + tke_x(i,k,nsrf)*ypct(j)
     2506            tke_x(i,k,is_ave)   = tke_x(i,k,is_ave) + tke_x(i,k,nsrf)*ypct(j)       
    24842507            wake_dltke(i,k,is_ave)   = wake_dltke(i,k,is_ave) + wake_dltke(i,k,nsrf)*ypct(j)
     2508           
    24852509
    24862510!>jyg
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0.F90

    r3767 r3798  
    1515       ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, radpas, radsol, rain_fall, ratqs, &
    1616       rnebcon, rugoro, sig1, snow_fall, solaire_etat0, sollw, sollwdown, &
    17        solsw, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
     17       solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
    1818       wake_deltat, wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, &
    1919       wake_s, wake_dens, zgam, zmax0, zmea, zpic, zsig, &
     
    312312
    313313  found=phyetat0_get(1,solsw,"solsw","net SW radiation surf",0.)
     314  found=phyetat0_get(1,solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.)
    314315  found=phyetat0_get(1,sollw,"sollw","net LW radiation surf",0.)
    315316  found=phyetat0_get(1,sollwdown,"sollwdown","down LW radiation surf",0.)
    316317  IF (.NOT. found) THEN
    317      sollwdown = 0. ;  zts=0.
    318      do nsrf=1,nbsrf
     318     sollwdown(:) = 0. ;  zts(:)=0.
     319     DO nsrf=1,nbsrf
    319320        zts(:)=zts(:)+ftsol(:,nsrf)*pctsrf(:,nsrf)
    320      enddo
     321     ENDDO
    321322     sollwdown(:)=sollw(:)+RSIGMA*zts(:)**4
    322323  ENDIF
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phyredem.F90

    r3767 r3798  
    2626                                detr_therm, ale_bl, ale_bl_trig, alp_bl,     &
    2727                                ale_wake, ale_bl_stat,                       &
    28                                 du_gwd_rando, du_gwd_front, u10m, v10m,      &
    29                                 treedrg, delta_sal, ds_ns, dt_ns, delta_sst
     28                                du_gwd_rando, du_gwd_front, u10m, v10m, &
     29                                treedrg, solswfdiff, delta_sal, ds_ns, dt_ns, &
     30                                delta_sst
     31
    3032  USE geometry_mod, ONLY : longitude_deg, latitude_deg
    3133  USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
     
    185187
    186188    CALL put_field(pass,"solsw", "Rayonnement solaire a la surface", solsw)
     189
     190    CALL put_field(pass,"solswfdiff", "Fraction du rayonnement solaire a la surface qui est diffus", solswfdiff)
    187191
    188192    CALL put_field(pass,"sollw", "Rayonnement IF a la surface", sollw)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phys_local_var_mod.F90

    r3605 r3798  
    1616      REAL, SAVE, ALLOCATABLE :: u_seri(:,:), v_seri(:,:)
    1717      !$OMP THREADPRIVATE(u_seri, v_seri)
    18       REAL, SAVE, ALLOCATABLE :: l_mixmin(:,:,:), l_mix(:,:,:)
    19       !$OMP THREADPRIVATE(l_mixmin, l_mix)
    20 
     18      REAL, SAVE, ALLOCATABLE :: l_mixmin(:,:,:), l_mix(:,:,:), tke_dissip(:,:,:)
     19      !$OMP THREADPRIVATE(l_mixmin, l_mix, tke_dissip)
    2120      REAL, SAVE, ALLOCATABLE :: tr_seri(:,:,:)
    2221      !$OMP THREADPRIVATE(tr_seri)
     
    301300      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m
    302301!$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m )
    303       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cldhjn, cldljn, cldmjn,cldtjn
    304 !$OMP THREADPRIVATE(cldhjn, cldljn, cldmjn, cldtjn)
     302!AS: cldhjn, cldljn, cldmjn,cldtjn pas utilisés en tant que variables, juste noms de diagnostics
    305303      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: JrNt
    306304!$OMP THREADPRIVATE(JrNt)
     
    446444      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ref_liq_pi, ref_ice_pi
    447445!$OMP THREADPRIVATE(ref_liq_pi, ref_ice_pi)
    448       REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zx_rh
    449 !$OMP THREADPRIVATE(zx_rh)
     446      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: zx_rh, zx_rhl, zx_rhi
     447!$OMP THREADPRIVATE(zx_rh, zx_rhl, zx_rhi)
    450448      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: prfl, psfl, fraca
    451449!$OMP THREADPRIVATE(prfl, psfl, fraca)
     
    562560      ALLOCATE(t_seri(klon,klev),q_seri(klon,klev),ql_seri(klon,klev),qs_seri(klon,klev))
    563561      ALLOCATE(u_seri(klon,klev),v_seri(klon,klev))
    564       ALLOCATE(l_mixmin(klon,klev+1,nbsrf), l_mix(klon,klev+1,nbsrf))
    565       l_mix(:,:,:)=0. ; l_mixmin(:,:,:)=0. ! doit etre initialse car pas toujours remplis
     562      ALLOCATE(l_mixmin(klon,klev+1,nbsrf), l_mix(klon,klev+1,nbsrf), tke_dissip(klon,klev+1,nbsrf))
     563      l_mix(:,:,:)=0. ; l_mixmin(:,:,:)=0. ; tke_dissip(:,:,:)=0. ! doit etre initialse car pas toujours remplis
    566564
    567565      ALLOCATE(tr_seri(klon,klev,nbtr))
     
    716714      ALLOCATE(cdragm(klon), cdragh(klon), cldh(klon), cldl(klon))
    717715      ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon))
    718       ALLOCATE(cldhjn(klon), cldljn(klon), cldmjn(klon), cldtjn(klon))
    719716      ALLOCATE(JrNt(klon))
    720717      ALLOCATE(dthmin(klon), evap(klon), fder(klon), plcl(klon), plfc(klon))
     
    782779      ALLOCATE(ref_liq(klon, klev), ref_ice(klon, klev), theta(klon, klev))
    783780      ALLOCATE(ref_liq_pi(klon, klev), ref_ice_pi(klon, klev))
    784       ALLOCATE(zphi(klon, klev), zx_rh(klon, klev))
     781      ALLOCATE(zphi(klon, klev), zx_rh(klon, klev), zx_rhl(klon,klev), zx_rhi(klon,klev))
    785782      ALLOCATE(pmfd(klon, klev), pmfu(klon, klev))
    786783
     
    846843      ALLOCATE (OCS_lifetime(klon,klev))
    847844      ALLOCATE (SO2_lifetime(klon,klev))
    848       ALLOCATE (alpha_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave+nwave_lw,nbtr))
    849       ALLOCATE (piz_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave+nwave_lw,nbtr))
    850       ALLOCATE (cg_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave+nwave_lw,nbtr))
     845      ALLOCATE (alpha_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
     846      ALLOCATE (piz_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
     847      ALLOCATE (cg_bin(nbands_sw_rrtm+nbands_lw_rrtm+nwave,nbtr))
    851848      ALLOCATE (tau_strat_550(klon,klev))
    852849      ALLOCATE (tau_strat_1020(klon,klev))
     
    881878      DEALLOCATE(t_seri,q_seri,ql_seri,qs_seri)
    882879      DEALLOCATE(u_seri,v_seri)
    883       DEALLOCATE(l_mixmin,l_mix)
     880      DEALLOCATE(l_mixmin,l_mix, tke_dissip)
    884881
    885882      DEALLOCATE(tr_seri)
     
    10171014      DEALLOCATE(cdragm, cdragh, cldh, cldl)
    10181015      DEALLOCATE(cldm, cldq, cldt, qsat2m)
    1019       DEALLOCATE(cldljn, cldmjn, cldhjn, cldtjn, JrNt)
     1016      DEALLOCATE(JrNt)
    10201017      DEALLOCATE(dthmin, evap, fder, plcl, plfc)
    10211018      DEALLOCATE(prw, prlw, prsw, zustar, zu10m, zv10m, rh2m, s_lcl)
     
    10761073      DEALLOCATE(ref_liq, ref_ice, theta)
    10771074      DEALLOCATE(ref_liq_pi, ref_ice_pi)
    1078       DEALLOCATE(zphi, zx_rh)
     1075      DEALLOCATE(zphi, zx_rh, zx_rhl, zx_rhi)
    10791076      DEALLOCATE(pmfd, pmfu)
    10801077
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_ctrlout_mod.F90

    • Property svn:keywords set to Id
    r3767 r3798  
    277277  TYPE(ctrl_out), SAVE :: o_wind10m = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11, 11/), &
    278278    'wind10m', '10-m wind speed', 'm/s', (/ ('', i=1, 10) /))
     279  TYPE(ctrl_out), SAVE :: o_wind100m = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     280    'wind100m', '100-m wind speed', 'm/s', (/ ('', i=1, 10) /))
     281  TYPE(ctrl_out), SAVE :: o_loadfactor_wind_onshore = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     282    'woncfr', 'Onshore Wind Capacity factor', 'kW/kW_installed', (/ ('', i=1, 10) /))
     283  TYPE(ctrl_out), SAVE :: o_loadfactor_wind_offshore = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     284    'wofcfr', 'Offshore Wind Capacity factor', 'kW/kW_installed', (/ ('', i=1, 10) /))
    279285  TYPE(ctrl_out), SAVE :: o_wind10max = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11, 11/), &
    280286    'wind10max', '10m wind speed max', 'm/s', &
     
    459465  TYPE(ctrl_out), SAVE :: o_SWupSFCcleanclr = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
    460466    'SWupSFCcleanclr', 'SWup clear sky clean (no aerosol) at surface', 'W/m2', (/ ('', i=1, 10) /))
    461   TYPE(ctrl_out), SAVE :: o_SWdnSFC = ctrl_out((/ 1, 1, 10, 10, 5, 10, 11, 11, 11, 11/), &
     467  TYPE(ctrl_out), SAVE :: o_fdiffSWdnSFC = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
     468    'fdiffSWdnSFC', 'Fraction of diffuse SWdn at surface', 'W/m2', (/ ('', i=1, 10) /))
     469  TYPE(ctrl_out), SAVE :: o_SWdnSFC = ctrl_out((/ 1, 1, 1, 10, 5, 10, 11, 11, 11, 11/), &
    462470    'SWdnSFC', 'SWdn at surface', 'W/m2', (/ ('', i=1, 10) /))
    463471  TYPE(ctrl_out), SAVE :: o_SWdnSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11, 11/), &
     
    686694 
    687695  TYPE(ctrl_out), SAVE :: o_cldq = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11, 11/), &
    688     'cldq', 'Cloud liquid water path', 'kg/m2', (/ ('', i=1, 10) /))
     696    'cldq', 'Cloud water path', 'kg/m2', (/ ('', i=1, 10) /))
    689697  TYPE(ctrl_out), SAVE :: o_lwp = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11, 11/), &
    690     'lwp', 'Cloud water path', 'kg/m2', (/ ('', i=1, 10) /))
     698    'lwp', 'Cloud liquid water path', 'kg/m2', (/ ('', i=1, 10) /))
    691699  TYPE(ctrl_out), SAVE :: o_iwp = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11, 11/), &
    692700    'iwp', 'Cloud ice water path', 'kg/m2', (/ ('', i=1, 10) /))
    693701  TYPE(ctrl_out), SAVE :: o_ue = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    694     'ue', 'Zonal dry static energy transport', '-', (/ ('', i=1, 10) /))
     702    'ue', 'Zonal dry static energy transport', 'J/m/s', (/ ('', i=1, 10) /))
    695703  TYPE(ctrl_out), SAVE :: o_ve = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    696     've', 'Merid dry static energy transport', '-', (/ ('', i=1, 10) /))
     704    've', 'Merid dry static energy transport', 'J/m/s', (/ ('', i=1, 10) /))
    697705  TYPE(ctrl_out), SAVE :: o_uq = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    698     'uq', 'Zonal humidity transport', '-', (/ ('', i=1, 10) /))
     706    'uq', 'Zonal humidity transport', 'kg/m/s', (/ ('', i=1, 10) /))
    699707  TYPE(ctrl_out), SAVE :: o_vq = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    700     'vq', 'Merid humidity transport', '-', (/ ('', i=1, 10) /))
     708    'vq', 'Merid humidity transport', 'kg/m/s', (/ ('', i=1, 10) /))
    701709  TYPE(ctrl_out), SAVE :: o_uwat = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    702     'uwat', 'Zonal total water transport', '-', (/ ('', i=1, 10) /))
     710    'uwat', 'Zonal total water transport', 'kg/m/s', (/ ('', i=1, 10) /))
    703711  TYPE(ctrl_out), SAVE :: o_vwat = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    704     'vwat', 'Merid total water transport', '-', (/ ('', i=1, 10) /))
     712    'vwat', 'Merid total water transport', 'kg/m/s', (/ ('', i=1, 10) /))
    705713  TYPE(ctrl_out), SAVE :: o_cape = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    706714    'cape', 'Conv avlbl pot ener', 'J/kg', (/ ('', i=1, 10) /))
     
    10011009  TYPE(ctrl_out), SAVE :: o_tke = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    10021010    'tke ', 'TKE', 'm2/s2', (/ ('', i=1, 10) /))
     1011  TYPE(ctrl_out), SAVE :: o_tke_dissip = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
     1012    'tke_dissip ', 'TKE DISSIPATION', 'm2/s3', (/ ('', i=1, 10) /))   
    10031013  TYPE(ctrl_out), SAVE :: o_tke_max = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    10041014    'tke_max', 'TKE max', 'm2/s2',                                  &
    10051015      (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', &
    10061016         't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
    1007 
    10081017  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_srf      = (/             &
    10091018      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11, 11/),'tke_ter',       &
     
    10461055      ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11/),'l_mix_sic',       &
    10471056      "min PBL mixing length "//clnsurf(4),"m", (/ ('', i=1, 10) /)) /)
     1057
    10481058
    10491059  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_max_srf  = (/                          &
     
    14301440  TYPE(ctrl_out), SAVE :: o_rhum = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11, 11/), &
    14311441    'rhum', 'Relative humidity', '-', (/ ('', i=1, 10) /))
     1442  TYPE(ctrl_out), SAVE :: o_rhl = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), &
     1443    'rhl', 'Relative humidity wrt liquid', '%', (/ ('', i=1, 10) /))
     1444  TYPE(ctrl_out), SAVE :: o_rhi = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11, 11/), &
     1445    'rhi', 'Relative humidity wrt ice', '%', (/ ('', i=1, 10) /))
    14321446  TYPE(ctrl_out), SAVE :: o_ozone = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    14331447    'ozone', 'Ozone mole fraction', '-', (/ ('', i=1, 10) /))
     
    17781792  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac(:)
    17791793  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac_cum(:)
    1780 #ifdef REPROBUS
    1781   TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_nas(:)
    1782 #endif
    17831794  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_vdf(:)
    17841795  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_the(:)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_mod.F90

    r3605 r3798  
    2929       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
    3030       phys_out_filestations, &
    31        new_aod, aerosol_couple, flag_aerosol_strat, &
     31       aerosol_couple, flag_aerosol_strat, &
    3232       pdtphys, paprs, pphis, pplay, lmax_th, ptconv, ptconvth, ivap, &
    3333       d_u, d_t, qx, d_qx, zmasse, ok_sync)   
     
    4040    USE mod_phys_lmdz_para
    4141    !Martin
    42     USE surface_data, ONLY : ok_snow
     42    USE surface_data, ONLY : landice_opt
    4343    USE phys_output_ctrlout_mod
    4444    USE mod_grid_phy_lmdz, only: klon_glo,nbp_lon,nbp_lat
     
    4646    USE vertical_layers_mod, ONLY: ap,bp,preff,presnivs, aps, bps, pseudoalt
    4747    USE time_phylmdz_mod, ONLY: day_ini, itau_phy, start_time, annee_ref, day_ref
    48 #ifdef REPROBUS
    49     USE chem_rep, ONLY: nbnas, tnamenas, ttextnas
    50 #endif
    5148#ifdef CPP_XIOS
    5249    ! ug Pour les sorties XIOS
     
    8582    LOGICAL                               :: ok_LES,ok_ade,ok_aie
    8683    INTEGER                               :: flag_aerosol_strat
    87     LOGICAL                               :: new_aod, aerosol_couple
     84    LOGICAL                               :: aerosol_couple
    8885    INTEGER, INTENT(IN)::  read_climoz ! read ozone climatology
    8986    !     Allowed values are 0, 1 and 2
     
    160157    IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
    161158    IF (.NOT. ALLOCATED(o_trac_cum)) ALLOCATE(o_trac_cum(nqtot))
    162 #ifdef REPROBUS
    163     IF (.NOT. ALLOCATED(o_nas)) ALLOCATE(o_nas(nbnas))
    164 #endif
    165159    ALLOCATE(o_dtr_the(nqtot),o_dtr_con(nqtot),o_dtr_lessi_impa(nqtot))
    166160    ALLOCATE(o_dtr_lessi_nucl(nqtot),o_dtr_insc(nqtot),o_dtr_bcscav(nqtot))
     
    581575            ENDDO
    582576      ENDIF
    583       IF (type_trac=='repr') THEN
    584 #ifdef REPROBUS
    585          DO iiq=1,nbnas
    586             o_nas(iiq) = ctrl_out((/ 4, 5, 5, 5, 10, 10, 11, 11, 11, 11 /), &
    587                  tnamenas(iiq),ttextnas(iiq), "-", &
    588                  (/ '', '', '', '', '', '', '', '', '', '' /))
    589          ENDDO
    590 #endif
    591       ENDIF
    592577
    593578   ENDDO !  iff
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phys_output_write_mod.F90

    r3767 r3798  
    1717  SUBROUTINE phys_output_write(itap, pdtphys, paprs, pphis, &
    1818       pplay, lmax_th, aerosol_couple,         &
    19        ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, new_aod, ok_sync, &
     19       ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync, &
    2020       ptconv, read_climoz, clevSTD, ptconvth, &
    2121       d_u, d_t, qx, d_qx, zmasse, flag_aerosol, flag_aerosol_strat, ok_cdnc)
     
    3939         o_t2m_min_mon, o_t2m_max_mon, &
    4040         o_q2m, o_ustar, o_u10m, o_v10m, &
    41          o_wind10m, o_wind10max, o_gusts, o_sicf, &
     41         o_wind10m, o_wind10max, o_wind100m, o_gusts, o_sicf, &
     42         o_loadfactor_wind_onshore, o_loadfactor_wind_offshore, &
    4243         o_psol, o_mass, o_qsurf, o_qsol, &
    4344         o_precip, o_rain_fall, o_rain_con, o_ndayrain, o_plul, o_pluc, o_plun, &
    4445         o_snow, o_msnow, o_fsnow, o_evap, o_ep,o_epmax_diag, & ! epmax_cape
    4546         o_tops, o_tops0, o_topl, o_topl0, &
    46          o_SWupTOA, o_SWupTOAclr, o_SWupTOAcleanclr, o_SWdnTOA, &
     47         o_SWupTOA, o_SWupTOAclr, o_SWupTOAcleanclr, o_SWdnTOA, o_fdiffSWdnSFC, &
    4748         o_SWdnTOAclr, o_nettop, o_SWup200, &
    4849         o_SWup200clr, o_SWdn200, o_SWdn200clr, &
     
    132133         o_vitu, o_vitv, o_vitw, o_pres, o_paprs, &
    133134         o_zfull, o_zhalf, o_rneb, o_rnebjn, o_rnebcon, &
    134          o_rnebls, o_rneblsvol, o_rhum, o_ozone, o_ozone_light, &
     135         o_rnebls, o_rneblsvol, o_rhum, o_rhl, o_rhi, o_ozone, o_ozone_light, &
    135136         o_duphy, o_dtphy, o_dqphy, o_dqphy2d, o_dqlphy, o_dqlphy2d, &
    136137         o_dqsphy, o_dqsphy2d, o_albe_srf, o_z0m_srf, o_z0h_srf, &
    137          o_ages_srf, o_snow_srf, o_alb1, o_alb2, o_tke, &
     138         o_ages_srf, o_snow_srf, o_alb1, o_alb2, o_tke, o_tke_dissip, &
    138139         o_tke_max, o_kz, o_kz_max, o_clwcon, &
    139140         o_dtdyn, o_dqdyn, o_dqdyn2d, o_dqldyn, o_dqldyn2d, &
     
    172173         o_uxv, o_vxq, o_vxT, o_wxq, o_vxphi, &
    173174         o_wxT, o_uxu, o_vxv, o_TxT, o_trac, &
    174 #ifdef REPROBUS
    175          o_nas, &
    176 #endif
    177175         o_dtr_vdf, o_dtr_the, o_dtr_con, &
    178176         o_dtr_lessi_impa, o_dtr_lessi_nucl, &
     
    226224         qsol, z0m, z0h, fevap, agesno, &
    227225         nday_rain, rain_con, snow_con, &
    228          topsw, toplw, toplw0, swup, swdn, &
     226         topsw, toplw, toplw0, swup, swdn, solswfdiff, &
    229227         topsw0, swupc0, swdnc0, swup0, swdn0, SWup200, SWup200clr, &
    230228         SWdn200, SWdn200clr, LWup200, LWup200clr, &
     
    255253         zt2m_cor,zq2m_cor,zu10m_cor,zv10m_cor, zrh2m_cor, zqsat2m_cor, &
    256254         t2m_min_mon, t2m_max_mon, evap, &
    257          l_mixmin,l_mix, &
     255         l_mixmin,l_mix, tke_dissip, &
    258256         zu10m, zv10m, zq2m, zustar, zxqsurf, &
    259257         rain_lsc, rain_num, snow_lsc, bils, sens, fder, &
     
    262260         sissnow, runoff, albsol3_lic, evap_pot, &
    263261         t2m, fluxt, fluxlat, fsollw, fsolsw, &
    264          wfbils, wfbilo, wfevap, wfrain, wfsnow, & 
     262         wfbils, wfbilo, wfevap, wfrain, wfsnow, &
    265263         cdragm, cdragh, cldl, cldm, &
    266          cldh, cldt, JrNt, cldljn, cldmjn, cldhjn, &
    267          cldtjn, cldq, flwp, fiwp, ue, ve, uq, vq, &
     264         cldh, cldt, JrNt,   & ! only output names: cldljn,cldmjn,cldhjn,cldtjn
     265         cldq, flwp, fiwp, ue, ve, uq, vq, &
    268266         uwat, vwat, &
    269267         plcl, plfc, wbeff, convoccur, upwd, dnwd, dnwd0, prw, prlw, prsw, &
     
    301299         ql_seri, qs_seri, tr_seri, &
    302300         zphi, u_seri, v_seri, omega, cldfra, &
    303          rneb, rnebjn, rneblsvol, zx_rh, d_t_dyn,  &
     301         rneb, rnebjn, rneblsvol, zx_rh, zx_rhl, zx_rhi, d_t_dyn,  &
    304302         d_q_dyn,  d_ql_dyn, d_qs_dyn, &
    305303         d_q_dyn2d,  d_ql_dyn2d, d_qs_dyn2d, &
     
    333331         surf_PM25_sulf, tau_strat_550, tausum_strat, &
    334332         vsed_aer, tau_strat_1020, f_r_wet
    335 #endif
    336 
    337 #ifdef REPROBUS
    338     USE CHEM_REP, ONLY : nas, nbnas, tnamenas, ttextnas
    339333#endif
    340334
     
    369363    USE infotrac_phy, ONLY: nqtot, nqo, type_trac, tname, niadv
    370364    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    371     USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, ok_snow
     365    USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, landice_opt
    372366    USE aero_mod, ONLY: naero_tot, id_STRAT_phy
    373367    USE ioipsl, ONLY: histend, histsync
     
    390384    use config_ocean_skin_m, only: activate_ocean_skin
    391385
     386    USE vertical_layers_mod, ONLY: presnivs
     387
    392388    IMPLICIT NONE
    393389
     
    401397    INTEGER, DIMENSION(klon) :: lmax_th
    402398    LOGICAL :: aerosol_couple, ok_sync
    403     LOGICAL :: ok_ade, ok_aie, ok_volcan, new_aod
     399    LOGICAL :: ok_ade, ok_aie, ok_volcan
    404400    LOGICAL, DIMENSION(klon, klev) :: ptconv, ptconvth
    405401    REAL :: pdtphys
     
    419415    INTEGER :: itau_w
    420416    INTEGER :: i, iinit, iinitend=1, iff, iq, iiq, nsrf, k, ll, naero
    421     REAL, DIMENSION (klon) :: zx_tmp_fi2d, zpt_conv2d
     417    REAL, DIMENSION (klon) :: zx_tmp_fi2d, zpt_conv2d, wind100m
    422418    REAL, DIMENSION (klon,klev) :: zx_tmp_fi3d, zpt_conv
    423419    REAL, DIMENSION (klon,klev+1) :: zx_tmp_fi3d1
     
    431427    REAL, DIMENSION(klev,2) :: Ahyb_mid_bounds, Bhyb_mid_bounds
    432428    INTEGER :: ilev
     429    INTEGER, SAVE :: kmax_100m
     430!$OMP THREADPRIVATE(kmax_100m)
     431    REAL :: x
    433432#ifndef CPP_XIOS
    434433    REAL :: missing_val
     
    446445    LOGICAL, PARAMETER :: debug_strataer=.FALSE.
    447446#endif
     447    REAL,DIMENSION(klon,klev) :: z, dz
     448    REAL,DIMENSION(klon)      :: zrho, zt
    448449
    449450    ! On calcul le nouveau tau:
     
    461462    CALL wxios_set_context
    462463#endif
     464
     465#ifndef CPP_XIOS
     466    missing_val=missing_val_nf90
     467#endif
     468
     469    IF (.NOT.vars_defined) THEN
     470      kmax_100m=1
     471      DO k=1, klev-1
     472        IF (presnivs(k).GT.0.97*101325.) kmax_100m = k !--finding out max level for 100 m with a good margin
     473      ENDDO
     474    ENDIF
    463475
    464476    Ahyb_bounds(1,1) = 0.
     
    694706
    695707       IF (vars_defined) THEN
     708          DO k = 1, kmax_100m                                      !--we could stop much lower
     709            zrho(:) = pplay(:,k)/t_seri(:,k)/RD                    ! air density in kg/m3
     710            dz(:,k) = (paprs(:,k)-paprs(:,k+1))/zrho(:)/RG         ! layer thickness in m
     711            IF (k==1) THEN
     712              z(:,1) = (paprs(:,1)-pplay(:,1))/zrho(:)/RG          ! altitude middle of first layer in m
     713              zt(:)  = dz(:,1)                                     ! altitude top of first layer in m
     714            ELSE
     715              z(:,k) = zt(:) + (paprs(:,k)-pplay(:,k))/zrho(:)/RG  ! altitude middle of layer k in m
     716              zt(:)  = zt(:) + dz(:,k)                             ! altitude top of layer k in m
     717            ENDIF
     718          ENDDO
     719          wind100m(:)=missing_val
     720          DO k=1, kmax_100m-1                                      !--we could stop much lower
     721            DO i=1,klon
     722              IF (z(i,k).LT.100..AND.z(i,k+1).GE.100.) THEN
     723                wind100m(i)=SQRT( (u_seri(i,k)+(100.-z(i,k))/(z(i,k+1)-z(i,k))*(u_seri(i,k+1)-u_seri(i,k)))**2.0 + &
     724                                  (v_seri(i,k)+(100.-z(i,k))/(z(i,k+1)-z(i,k))*(v_seri(i,k+1)-v_seri(i,k)))**2.0 )
     725              ENDIF
     726            ENDDO
     727          ENDDO
     728       ENDIF
     729       CALL histwrite_phy(o_wind100m, wind100m)
     730
     731       IF (vars_defined) THEN
     732         !--polynomial fit for 14,Vestas,1074,V136/3450 kW windmill - Olivier
     733         DO i=1,klon
     734           IF (pctsrf(i,is_ter).GT.0.05 .AND. wind100m(i).NE.missing_val) THEN
     735             x=wind100m(i)
     736             IF (x.LE.3.0 .OR. x.GE.22.5) THEN
     737               zx_tmp_fi2d(i)=0.0
     738             ELSE IF (x.GE.10.0) THEN
     739               zx_tmp_fi2d(i)=1.0
     740             ELSE
     741               zx_tmp_fi2d(i)= 10.73 + x*(-14.69 + x*(8.339 + x*(-2.59 + x*(0.4893 + x*(-0.05898 + x*(0.004627 + &
     742                               x*(-0.0002352 + x*(7.478e-06 + x*(-1.351e-07 + x*(1.059e-09))))))))))
     743               zx_tmp_fi2d(i)=MIN(MAX(zx_tmp_fi2d(i),0.0),1.0)
     744             ENDIF
     745           ELSE
     746             zx_tmp_fi2d(i)=missing_val
     747           ENDIF
     748         ENDDO
     749       ENDIF
     750       CALL histwrite_phy(o_loadfactor_wind_onshore, zx_tmp_fi2d)
     751
     752       IF (vars_defined) THEN
     753         !--polynomial fit for 14,Vestas,867,V164/8000 kW - Olivier
     754         DO i=1,klon
     755           IF (pctsrf(i,is_oce).GT.0.05 .AND. wind100m(i).NE.missing_val) THEN
     756             x=wind100m(i)
     757             IF (x.LE.3.0 .OR. x.GE.25.5) THEN
     758               zx_tmp_fi2d(i)=0.0
     759             ELSE IF (x.GE.12.5) THEN
     760               zx_tmp_fi2d(i)=1.0
     761             ELSE
     762               zx_tmp_fi2d(i)= 20.59 + x*(-22.39 + x*(10.25 + x*(-2.601 + x*(0.4065 + x*(-0.04099 + x*(0.002716 + &
     763                               x*(-0.0001175 + x*(3.195e-06 + x*(-4.959e-08 + x*(3.352e-10))))))))))
     764               zx_tmp_fi2d(i)=MIN(MAX(zx_tmp_fi2d(i),0.0),1.0)
     765             ENDIF
     766           ELSE
     767             zx_tmp_fi2d(i)=missing_val
     768           ENDIF
     769         ENDDO
     770       ENDIF
     771       CALL histwrite_phy(o_loadfactor_wind_offshore, zx_tmp_fi2d)
     772
     773       IF (vars_defined) THEN
    696774          DO i = 1, klon
    697775             zx_tmp_fi2d(i) = pctsrf(i,is_sic)
     
    863941       ENDIF
    864942       CALL histwrite_phy(o_SWdnSFCcleanclr, zx_tmp_fi2d)
     943
     944       CALL histwrite_phy(o_fdiffSWdnSFC, solswfdiff)
    865945
    866946       IF (vars_defined) THEN
     
    9241004       CALL histwrite_phy(o_tauy, zx_tmp_fi2d)
    9251005
    926        IF (ok_snow) THEN
     1006       IF (landice_opt .GE. 1) THEN
    9271007          CALL histwrite_phy(o_snowsrf, snow_o)
    9281008          CALL histwrite_phy(o_qsnow, qsnow)
     
    9821062             CALL histwrite_phy(o_l_mixmin(nsrf),  l_mixmin(:,1:klev,nsrf))
    9831063             CALL histwrite_phy(o_tke_max_srf(nsrf),  pbl_tke(:,1:klev,nsrf))
     1064
     1065                         
    9841066          ENDIF
    9851067!jyg<
     
    9921074!            ENDIF
    9931075
    994 
    9951076       ENDDO
     1077       
     1078               
     1079        IF (iflag_pbl > 1) THEN
     1080          zx_tmp_fi3d=0.
     1081          IF (vars_defined) THEN
     1082             DO nsrf=1,nbsrf
     1083                DO k=1,klev
     1084                   zx_tmp_fi3d(:,k)=zx_tmp_fi3d(:,k) &
     1085                        +pctsrf(:,nsrf)*tke_dissip(:,k,nsrf)
     1086                ENDDO
     1087             ENDDO
     1088          ENDIF
     1089         
     1090          CALL histwrite_phy(o_tke_dissip, zx_tmp_fi3d)   
     1091       ENDIF
    9961092
    9971093       IF (vars_defined) zx_tmp_fi2d(1 : klon) = sens_prec_liq_o(1 : klon, 1)
     
    11171213       ! ATTENTION, LES ANCIENS HISTWRITE ONT ETES CONSERVES EN ATTENDANT MIEUX:
    11181214       ! Champs interpolles sur des niveaux de pression
    1119        missing_val=missing_val_nf90
    11201215       DO iff=1, nfiles
    11211216          ll=0
     
    13581453!--OLIVIER
    13591454!This is warranted by treating INCA aerosols as offline aerosols
    1360 !       IF (new_aod .and. (.not. aerosol_couple)) THEN
    1361        IF (new_aod) THEN
    1362           IF (flag_aerosol.GT.0) THEN
    1363              CALL histwrite_phy(o_od443aer, od443aer)
    1364              CALL histwrite_phy(o_od550aer, od550aer)
    1365              CALL histwrite_phy(o_od865aer, od865aer)
    1366              CALL histwrite_phy(o_abs550aer, abs550aer)
    1367              CALL histwrite_phy(o_od550lt1aer, od550lt1aer)
    1368              CALL histwrite_phy(o_sconcso4, sconcso4)
    1369              CALL histwrite_phy(o_sconcno3, sconcno3)
    1370              CALL histwrite_phy(o_sconcoa, sconcoa)
    1371              CALL histwrite_phy(o_sconcbc, sconcbc)
    1372              CALL histwrite_phy(o_sconcss, sconcss)
    1373              CALL histwrite_phy(o_sconcdust, sconcdust)
    1374              CALL histwrite_phy(o_concso4, concso4)
    1375              CALL histwrite_phy(o_concno3, concno3)
    1376              CALL histwrite_phy(o_concoa, concoa)
    1377              CALL histwrite_phy(o_concbc, concbc)
    1378              CALL histwrite_phy(o_concss, concss)
    1379              CALL histwrite_phy(o_concdust, concdust)
    1380              CALL histwrite_phy(o_loadso4, loadso4)
    1381              CALL histwrite_phy(o_loadoa, loadoa)
    1382              CALL histwrite_phy(o_loadbc, loadbc)
    1383              CALL histwrite_phy(o_loadss, loadss)
    1384              CALL histwrite_phy(o_loaddust, loaddust)
    1385              CALL histwrite_phy(o_loadno3, loadno3)
    1386              CALL histwrite_phy(o_dryod550aer, dryod550aer)
    1387              DO naero = 1, naero_tot-1
    1388                 CALL histwrite_phy(o_drytausumaero(naero),drytausum_aero(:,naero))
    1389              END DO
    1390           ENDIF
    1391           !--STRAT AER
    1392           IF (flag_aerosol.GT.0.OR.flag_aerosol_strat.GT.0) THEN
    1393              DO naero = 1, naero_tot
    1394                 CALL histwrite_phy(o_tausumaero(naero),tausum_aero(:,2,naero))
    1395              END DO
    1396           ENDIF
    1397           IF (flag_aerosol_strat.GT.0) THEN
    1398              CALL histwrite_phy(o_tausumaero_lw,tausum_aero(:,6,id_STRAT_phy))
    1399           ENDIF
     1455       IF (flag_aerosol.GT.0) THEN
     1456          CALL histwrite_phy(o_od443aer, od443aer)
     1457          CALL histwrite_phy(o_od550aer, od550aer)
     1458          CALL histwrite_phy(o_od865aer, od865aer)
     1459          CALL histwrite_phy(o_abs550aer, abs550aer)
     1460          CALL histwrite_phy(o_od550lt1aer, od550lt1aer)
     1461          CALL histwrite_phy(o_sconcso4, sconcso4)
     1462          CALL histwrite_phy(o_sconcno3, sconcno3)
     1463          CALL histwrite_phy(o_sconcoa, sconcoa)
     1464          CALL histwrite_phy(o_sconcbc, sconcbc)
     1465          CALL histwrite_phy(o_sconcss, sconcss)
     1466          CALL histwrite_phy(o_sconcdust, sconcdust)
     1467          CALL histwrite_phy(o_concso4, concso4)
     1468          CALL histwrite_phy(o_concno3, concno3)
     1469          CALL histwrite_phy(o_concoa, concoa)
     1470          CALL histwrite_phy(o_concbc, concbc)
     1471          CALL histwrite_phy(o_concss, concss)
     1472          CALL histwrite_phy(o_concdust, concdust)
     1473          CALL histwrite_phy(o_loadso4, loadso4)
     1474          CALL histwrite_phy(o_loadoa, loadoa)
     1475          CALL histwrite_phy(o_loadbc, loadbc)
     1476          CALL histwrite_phy(o_loadss, loadss)
     1477          CALL histwrite_phy(o_loaddust, loaddust)
     1478          CALL histwrite_phy(o_loadno3, loadno3)
     1479          CALL histwrite_phy(o_dryod550aer, dryod550aer)
     1480          DO naero = 1, naero_tot-1
     1481             CALL histwrite_phy(o_drytausumaero(naero),drytausum_aero(:,naero))
     1482          END DO
     1483       ENDIF
     1484       !--STRAT AER
     1485       IF (flag_aerosol.GT.0.OR.flag_aerosol_strat.GT.0) THEN
     1486          DO naero = 1, naero_tot
     1487             CALL histwrite_phy(o_tausumaero(naero),tausum_aero(:,2,naero))
     1488          END DO
     1489       ENDIF
     1490       IF (flag_aerosol_strat.GT.0) THEN
     1491          CALL histwrite_phy(o_tausumaero_lw,tausum_aero(:,6,id_STRAT_phy))
    14001492       ENDIF
    14011493
     
    14871579          CALL histwrite_phy(o_sollwad0, sollwad0_aero)
    14881580          !====MS forcing diagnostics
    1489           IF (new_aod) THEN
    14901581          !ym warning : topsw_aero, solsw_aero, topsw0_aero, solsw0_aero are not defined by model
    14911582          !ym => init to 0 in radlwsw_m.F90 ztopsw_aero, zsolsw_aero, ztopsw0_aero, zsolsw0_aero
    14921583
    1493              IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,1)*swradcorr(:)
    1494              CALL histwrite_phy(o_swtoaas_nat,zx_tmp_fi2d)
    1495              IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,1)*swradcorr(:)
    1496              CALL histwrite_phy(o_swsrfas_nat,zx_tmp_fi2d)
    1497              IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,1)*swradcorr(:)
    1498              CALL histwrite_phy(o_swtoacs_nat,zx_tmp_fi2d)
    1499              IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,1)*swradcorr(:)
    1500              CALL histwrite_phy(o_swsrfcs_nat,zx_tmp_fi2d)
    1501              !ant
    1502              IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,2)*swradcorr(:)
    1503              CALL histwrite_phy(o_swtoaas_ant,zx_tmp_fi2d)
    1504              IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,2)*swradcorr(:)
    1505              CALL histwrite_phy(o_swsrfas_ant,zx_tmp_fi2d)
    1506              IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,2)*swradcorr(:)
    1507              CALL histwrite_phy(o_swtoacs_ant,zx_tmp_fi2d)
    1508              IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,2)*swradcorr(:)
    1509              CALL histwrite_phy(o_swsrfcs_ant,zx_tmp_fi2d)
    1510              !cf
    1511              IF (.not. aerosol_couple) THEN
    1512                 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,1)*swradcorr(:)
    1513                 CALL histwrite_phy(o_swtoacf_nat,zx_tmp_fi2d)
    1514                 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,1)*swradcorr(:)
    1515                 CALL histwrite_phy(o_swsrfcf_nat,zx_tmp_fi2d)
    1516                 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,2)*swradcorr(:)
    1517                 CALL histwrite_phy(o_swtoacf_ant,zx_tmp_fi2d)
    1518                 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,2)*swradcorr(:)
    1519                 CALL histwrite_phy(o_swsrfcf_ant,zx_tmp_fi2d)
    1520                 IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,3)*swradcorr(:)
    1521                 CALL histwrite_phy(o_swtoacf_zero,zx_tmp_fi2d)
    1522                 IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,3)*swradcorr(:)
    1523                 CALL histwrite_phy(o_swsrfcf_zero,zx_tmp_fi2d)
    1524              ENDIF
    1525           ENDIF ! new_aod
     1584          IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,1)*swradcorr(:)
     1585          CALL histwrite_phy(o_swtoaas_nat,zx_tmp_fi2d)
     1586          IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,1)*swradcorr(:)
     1587          CALL histwrite_phy(o_swsrfas_nat,zx_tmp_fi2d)
     1588          IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,1)*swradcorr(:)
     1589          CALL histwrite_phy(o_swtoacs_nat,zx_tmp_fi2d)
     1590          IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,1)*swradcorr(:)
     1591          CALL histwrite_phy(o_swsrfcs_nat,zx_tmp_fi2d)
     1592          !ant
     1593          IF (vars_defined) zx_tmp_fi2d(:)=topsw_aero(:,2)*swradcorr(:)
     1594          CALL histwrite_phy(o_swtoaas_ant,zx_tmp_fi2d)
     1595          IF (vars_defined) zx_tmp_fi2d(:)=solsw_aero(:,2)*swradcorr(:)
     1596          CALL histwrite_phy(o_swsrfas_ant,zx_tmp_fi2d)
     1597          IF (vars_defined) zx_tmp_fi2d(:)=topsw0_aero(:,2)*swradcorr(:)
     1598          CALL histwrite_phy(o_swtoacs_ant,zx_tmp_fi2d)
     1599          IF (vars_defined) zx_tmp_fi2d(:)=solsw0_aero(:,2)*swradcorr(:)
     1600          CALL histwrite_phy(o_swsrfcs_ant,zx_tmp_fi2d)
     1601          !cf
     1602          IF (.not. aerosol_couple) THEN
     1603             IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,1)*swradcorr(:)
     1604             CALL histwrite_phy(o_swtoacf_nat,zx_tmp_fi2d)
     1605             IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,1)*swradcorr(:)
     1606             CALL histwrite_phy(o_swsrfcf_nat,zx_tmp_fi2d)
     1607             IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,2)*swradcorr(:)
     1608             CALL histwrite_phy(o_swtoacf_ant,zx_tmp_fi2d)
     1609             IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,2)*swradcorr(:)
     1610             CALL histwrite_phy(o_swsrfcf_ant,zx_tmp_fi2d)
     1611             IF (vars_defined) zx_tmp_fi2d(:)=topswcf_aero(:,3)*swradcorr(:)
     1612             CALL histwrite_phy(o_swtoacf_zero,zx_tmp_fi2d)
     1613             IF (vars_defined) zx_tmp_fi2d(:)=solswcf_aero(:,3)*swradcorr(:)
     1614             CALL histwrite_phy(o_swsrfcf_zero,zx_tmp_fi2d)
     1615          ENDIF
    15261616          !====MS forcing diagnostics
    15271617       ENDIF
     
    16241714       CALL histwrite_phy(o_rnebjn, zx_tmp_fi3d)
    16251715       CALL histwrite_phy(o_rhum, zx_rh)
     1716       IF (iflag_ice_thermo .GT. 0) THEN
     1717          IF (vars_defined) zx_tmp_fi3d = zx_rhl * 100.
     1718          CALL histwrite_phy(o_rhl, zx_tmp_fi3d)
     1719          IF (vars_defined) zx_tmp_fi3d = zx_rhi * 100.
     1720          CALL histwrite_phy(o_rhi, zx_tmp_fi3d)
     1721       ENDIF
     1722
    16261723       
    16271724       IF (vars_defined) zx_tmp_fi3d = wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd
     
    16821779          ENDIF
    16831780          CALL histwrite_phy(o_tke, zx_tmp_fi3d)
    1684 
    1685           CALL histwrite_phy(o_tke_max, zx_tmp_fi3d)
     1781          CALL histwrite_phy(o_tke_max, zx_tmp_fi3d) 
     1782
    16861783       ENDIF
    16871784
     
    21012198       ! ATTENTION, LES ANCIENS HISTWRITE ONT ETES CONSERVES EN ATTENDANT MIEUX:
    21022199       ! Champs interpolles sur des niveaux de pression
    2103        missing_val=missing_val_nf90
    21042200       DO iff=7, nfiles-1 !--OB: here we deal with files 7,8,9
    21052201
     
    22372333!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    22382334       IF (iflag_phytrac == 1 ) then
    2239          IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag') THEN
     2335         IF (type_trac == 'lmdz' .OR. type_trac == 'coag') THEN
    22402336           DO iq=nqo+1, nqtot
    22412337             !--3D fields
     
    22622358                ENDDO
    22632359             ENDIF
    2264 #ifndef REPROBUS
    22652360             CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
    2266 #endif
    22672361           ENDDO !--iq
    22682362         ENDIF   !--type_trac
     
    22922386         ENDIF !--type_trac co2i
    22932387
    2294          IF (type_trac == 'repr') THEN
    2295 #ifdef REPROBUS
    2296            DO iq=1,nbnas
    2297              CALL histwrite_phy(o_nas(iq), nas(:,:,iq))
    2298            ENDDO
    2299 #endif
    2300          ENDIF
    2301 
    23022388       ENDIF   !(iflag_phytrac==1)
    23032389
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phys_state_var_mod.F90

    r3767 r3798  
    4747!albedo SB >>>
    4848      REAL, ALLOCATABLE, SAVE :: falb_dif(:,:,:), falb_dir(:,:,:)
    49       real, allocatable, save :: chl_con(:)
     49      REAL, ALLOCATABLE, SAVE :: chl_con(:)
    5050!$OMP THREADPRIVATE(falb_dir,falb_dif,chl_con)
    5151!albedo SB <<<
     
    5454      REAL, ALLOCATABLE, SAVE :: rain_fall(:), snow_fall(:)
    5555!$OMP THREADPRIVATE( rain_fall, snow_fall)
    56       REAL, ALLOCATABLE, SAVE :: solsw(:), sollw(:)
    57 !$OMP THREADPRIVATE(solsw, sollw)
     56      REAL, ALLOCATABLE, SAVE :: solsw(:), solswfdiff(:), sollw(:)
     57!$OMP THREADPRIVATE(solsw, solswfdiff, sollw)
    5858      REAL, ALLOCATABLE, SAVE :: radsol(:)
    5959!$OMP THREADPRIVATE(radsol)
     
    358358      REAL,ALLOCATABLE,SAVE :: albplap(:)
    359359!$OMP THREADPRIVATE(albplap)
    360       REAL,ALLOCATABLE,SAVE :: solswp(:), sollwp(:)
    361 !$OMP THREADPRIVATE(solswp, sollwp)
     360      REAL,ALLOCATABLE,SAVE :: solswp(:), solswfdiffp(:), sollwp(:)
     361!$OMP THREADPRIVATE(solswp, solswfdiffp, sollwp)
    362362      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
    363363!$OMP THREADPRIVATE(sollwdownp)
     
    472472include "clesphys.h"
    473473
     474      print*, 'is_initialized', is_initialized
    474475      IF (is_initialized) RETURN
    475476      is_initialized=.TRUE.
     
    483484      ALLOCATE(falb2(klon,nbsrf))
    484485!albedo SB >>>
     486      print*, 'allocate falb'
    485487      ALLOCATE(falb_dir(klon,nsw,nbsrf),falb_dif(klon,nsw,nbsrf))
     488      print*, 'allocate falb good', falb_dir(1,1,1)
    486489      ALLOCATE(chl_con(klon))
    487490!albedo SB <<<
    488491      ALLOCATE(rain_fall(klon))
    489492      ALLOCATE(snow_fall(klon))
    490       ALLOCATE(solsw(klon), sollw(klon))
     493      ALLOCATE(solsw(klon), solswfdiff(klon), sollw(klon))
    491494      sollw=0.0
    492495      ALLOCATE(radsol(klon))
     
    619622      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
    620623      ALLOCATE(albplap(klon))
    621       ALLOCATE(solswp(klon), sollwp(klon))
     624      ALLOCATE(solswp(klon), solswfdiffp(klon), sollwp(klon))
    622625      ALLOCATE(gustiness(klon))
    623626      ALLOCATE(sollwdownp(klon))
     
    650653!!! fin nrlmd le 10/04/2012
    651654      IF (ok_gwd_rando) THEN
    652         allocate(du_gwd_rando(klon, klev))
     655        ALLOCATE(du_gwd_rando(klon, klev))
    653656        du_gwd_rando(:,:)=0.
    654657      ENDIF
     
    671674include "clesphys.h"
    672675
    673       deallocate(pctsrf, ftsol, falb1, falb2)
    674       deallocate(qsol,fevap,z0m,z0h,agesno)
     676      DEALLOCATE(pctsrf, ftsol, falb1, falb2)
     677      DEALLOCATE(qsol,fevap,z0m,z0h,agesno)
    675678!FC
    676       deallocate(treedrg)
    677       deallocate(rain_fall, snow_fall, solsw, sollw, radsol, swradcorr)
    678       deallocate(zmea, zstd, zsig, zgam)
    679       deallocate(zthe, zpic, zval)
    680       deallocate(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
    681       deallocate(qs_ancien, ql_ancien)
    682       deallocate(prw_ancien, prlw_ancien, prsw_ancien)
    683       deallocate(qtc_cv,sigt_cv)
    684       deallocate(u_ancien, v_ancien)
    685       deallocate(tr_ancien)                           !RomP
    686       deallocate(ratqs, pbl_tke,coefh,coefm)
     679      DEALLOCATE(treedrg)
     680      DEALLOCATE(rain_fall, snow_fall, solsw, solswfdiff, sollw, radsol, swradcorr)
     681      DEALLOCATE(zmea, zstd, zsig, zgam)
     682      DEALLOCATE(zthe, zpic, zval)
     683      DEALLOCATE(rugoro, t_ancien, q_ancien, clwcon, rnebcon)
     684      DEALLOCATE(qs_ancien, ql_ancien)
     685      DEALLOCATE(prw_ancien, prlw_ancien, prsw_ancien)
     686      DEALLOCATE(qtc_cv,sigt_cv)
     687      DEALLOCATE(u_ancien, v_ancien)
     688      DEALLOCATE(tr_ancien)                           !RomP
     689      DEALLOCATE(ratqs, pbl_tke,coefh,coefm)
    687690!nrlmd<
    688       deallocate(delta_tsurf)
     691      DEALLOCATE(delta_tsurf)
    689692!>nrlmd
    690       deallocate(zmax0, f0)
    691       deallocate(sig1, w01)
    692       deallocate(entr_therm, fm_therm)
    693       deallocate(detr_therm)
    694       deallocate(clwcon0th, rnebcon0th)
     693      DEALLOCATE(zmax0, f0)
     694      DEALLOCATE(sig1, w01)
     695      DEALLOCATE(entr_therm, fm_therm)
     696      DEALLOCATE(detr_therm)
     697      DEALLOCATE(clwcon0th, rnebcon0th)
    695698! radiation outputs
    696       deallocate(swdnc0, swdn0, swdn)
    697       deallocate(swupc0, swup0, swup)
    698       deallocate(lwdnc0, lwdn0, lwdn)
    699       deallocate(lwupc0, lwup0, lwup)
    700       deallocate(SWdn200clr, SWdn200)
    701       deallocate(SWup200clr, SWup200)
    702       deallocate(LWdn200clr, LWdn200)
    703       deallocate(LWup200clr, LWup200)
    704       deallocate(LWdnTOA, LWdnTOAclr)
     699      DEALLOCATE(swdnc0, swdn0, swdn)
     700      DEALLOCATE(swupc0, swup0, swup)
     701      DEALLOCATE(lwdnc0, lwdn0, lwdn)
     702      DEALLOCATE(lwupc0, lwup0, lwup)
     703      DEALLOCATE(SWdn200clr, SWdn200)
     704      DEALLOCATE(SWup200clr, SWup200)
     705      DEALLOCATE(LWdn200clr, LWdn200)
     706      DEALLOCATE(LWup200clr, LWup200)
     707      DEALLOCATE(LWdnTOA, LWdnTOAclr)
    705708! pressure level
    706       deallocate(tsumSTD)
    707       deallocate(usumSTD, vsumSTD)
    708       deallocate(wsumSTD, phisumSTD)
    709       deallocate(tnondef)
    710       deallocate(qsumSTD, rhsumSTD)
    711       deallocate(uvsumSTD)
    712       deallocate(vqsumSTD)
    713       deallocate(vTsumSTD)
    714       deallocate(wqsumSTD)
    715       deallocate(vphisumSTD)
    716       deallocate(wTsumSTD)
    717       deallocate(u2sumSTD)
    718       deallocate(v2sumSTD)
    719       deallocate(T2sumSTD)
    720       deallocate(O3sumSTD)
    721       deallocate(O3daysumSTD)
     709      DEALLOCATE(tsumSTD)
     710      DEALLOCATE(usumSTD, vsumSTD)
     711      DEALLOCATE(wsumSTD, phisumSTD)
     712      DEALLOCATE(tnondef)
     713      DEALLOCATE(qsumSTD, rhsumSTD)
     714      DEALLOCATE(uvsumSTD)
     715      DEALLOCATE(vqsumSTD)
     716      DEALLOCATE(vTsumSTD)
     717      DEALLOCATE(wqsumSTD)
     718      DEALLOCATE(vphisumSTD)
     719      DEALLOCATE(wTsumSTD)
     720      DEALLOCATE(u2sumSTD)
     721      DEALLOCATE(v2sumSTD)
     722      DEALLOCATE(T2sumSTD)
     723      DEALLOCATE(O3sumSTD)
     724      DEALLOCATE(O3daysumSTD)
    722725!IM beg
    723       deallocate(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
    724       deallocate(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
     726      DEALLOCATE(wlevSTD,ulevSTD,vlevSTD,tlevSTD,qlevSTD,rhlevSTD,philevSTD)
     727      DEALLOCATE(uvSTD,vqSTD,vTSTD,wqSTD,vphiSTD,wTSTD,u2STD,v2STD,T2STD,O3STD,O3daySTD)
    725728!IM end
    726       deallocate(seed_old)
    727       deallocate(zuthe, zvthe)
    728       deallocate(alb_neig)
    729       deallocate(ema_cbmf)
    730       deallocate(ema_pcb, ema_pct)
    731       deallocate(Mipsh, Ma, qcondc)
    732       deallocate(wd, sigd)
    733       deallocate(cin, ALE, ALP)
    734       deallocate(ftd, fqd)
    735       deallocate(Ale_bl, Alp_bl)
    736       deallocate(ale_wake)
    737       deallocate(ale_bl_stat)
    738       deallocate(lalim_conv, wght_th)
    739       deallocate(wake_deltat, wake_deltaq)
    740       deallocate(wake_s, awake_dens, wake_dens)
    741       deallocate(wake_Cstar, wake_pe, wake_fip)
     729      DEALLOCATE(seed_old)
     730      DEALLOCATE(zuthe, zvthe)
     731      DEALLOCATE(alb_neig)
     732      DEALLOCATE(ema_cbmf)
     733      DEALLOCATE(ema_pcb, ema_pct)
     734      DEALLOCATE(Mipsh, Ma, qcondc)
     735      DEALLOCATE(wd, sigd)
     736      DEALLOCATE(cin, ALE, ALP)
     737      DEALLOCATE(ftd, fqd)
     738      DEALLOCATE(Ale_bl, Alp_bl)
     739      DEALLOCATE(ale_wake)
     740      DEALLOCATE(ale_bl_stat)
     741      DEALLOCATE(lalim_conv, wght_th)
     742      DEALLOCATE(wake_deltat, wake_deltaq)
     743      DEALLOCATE(wake_s, awake_dens, wake_dens)
     744      DEALLOCATE(wake_Cstar, wake_pe, wake_fip)
    742745!jyg<
    743       deallocate(wake_delta_pbl_TKE)
     746      DEALLOCATE(wake_delta_pbl_TKE)
    744747!>jyg
    745       deallocate(pfrac_impa, pfrac_nucl)
    746       deallocate(pfrac_1nucl)
    747       deallocate(total_rain, nday_rain)
    748       deallocate(paire_ter)
    749       deallocate(albsol1, albsol2)
     748      DEALLOCATE(pfrac_impa, pfrac_nucl)
     749      DEALLOCATE(pfrac_1nucl)
     750      DEALLOCATE(total_rain, nday_rain)
     751      DEALLOCATE(paire_ter)
     752      DEALLOCATE(albsol1, albsol2)
    750753!albedo SB >>>
    751       deallocate(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
     754      DEALLOCATE(albsol_dir,albsol_dif,falb_dir,falb_dif,chl_con)
    752755!albedo SB <<<
    753       deallocate(wo)
    754       deallocate(clwcon0,rnebcon0)
    755       deallocate(heat, heat0)
    756       deallocate(cool, cool0)
    757       deallocate(heat_volc, cool_volc)
    758       deallocate(topsw, toplw)
    759       deallocate(sollwdown, sollwdownclr)
    760       deallocate(gustiness)
    761       deallocate(toplwdown, toplwdownclr)
    762       deallocate(topsw0,toplw0,solsw0,sollw0)
    763       deallocate(albpla)
     756      DEALLOCATE(wo)
     757      DEALLOCATE(clwcon0,rnebcon0)
     758      DEALLOCATE(heat, heat0)
     759      DEALLOCATE(cool, cool0)
     760      DEALLOCATE(heat_volc, cool_volc)
     761      DEALLOCATE(topsw, toplw)
     762      DEALLOCATE(sollwdown, sollwdownclr)
     763      DEALLOCATE(gustiness)
     764      DEALLOCATE(toplwdown, toplwdownclr)
     765      DEALLOCATE(topsw0,toplw0,solsw0,sollw0)
     766      DEALLOCATE(albpla)
    764767!IM ajout variables CFMIP2/CMIP5
    765       deallocate(heatp, coolp)
    766       deallocate(heat0p, cool0p)
    767       deallocate(radsolp, topswp, toplwp)
    768       deallocate(albplap)
    769       deallocate(solswp, sollwp)
    770       deallocate(sollwdownp)
    771       deallocate(topsw0p,toplw0p)
    772       deallocate(solsw0p,sollw0p)
    773       deallocate(lwdnc0p, lwdn0p, lwdnp)
    774       deallocate(lwupc0p, lwup0p, lwupp)
    775       deallocate(swdnc0p, swdn0p, swdnp)
    776       deallocate(swupc0p, swup0p, swupp)
    777       deallocate(cape)
    778       deallocate(pbase,bbase)
    779       deallocate(zqasc)
    780       deallocate(ibas_con, itop_con)
    781       deallocate(rain_con, snow_con)
    782       deallocate(rlonPOS)
    783       deallocate(newsst)
    784       deallocate(ustar,u10m, v10m,wstar)
    785       deallocate(topswad, solswad)
    786       deallocate(topswai, solswai)
    787       deallocate(tau_aero,piz_aero,cg_aero)
    788       deallocate(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
    789       deallocate(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
    790       deallocate(ccm)
    791       if (ok_gwd_rando) deallocate(du_gwd_rando)
    792       if (.not. ok_hines .and. ok_gwd_rando) deallocate(du_gwd_front)
     768      DEALLOCATE(heatp, coolp)
     769      DEALLOCATE(heat0p, cool0p)
     770      DEALLOCATE(radsolp, topswp, toplwp)
     771      DEALLOCATE(albplap)
     772      DEALLOCATE(solswp, solswfdiffp, sollwp)
     773      DEALLOCATE(sollwdownp)
     774      DEALLOCATE(topsw0p,toplw0p)
     775      DEALLOCATE(solsw0p,sollw0p)
     776      DEALLOCATE(lwdnc0p, lwdn0p, lwdnp)
     777      DEALLOCATE(lwupc0p, lwup0p, lwupp)
     778      DEALLOCATE(swdnc0p, swdn0p, swdnp)
     779      DEALLOCATE(swupc0p, swup0p, swupp)
     780      DEALLOCATE(cape)
     781      DEALLOCATE(pbase,bbase)
     782      DEALLOCATE(zqasc)
     783      DEALLOCATE(ibas_con, itop_con)
     784      DEALLOCATE(rain_con, snow_con)
     785      DEALLOCATE(rlonPOS)
     786      DEALLOCATE(newsst)
     787      DEALLOCATE(ustar,u10m, v10m,wstar)
     788      DEALLOCATE(topswad, solswad)
     789      DEALLOCATE(topswai, solswai)
     790      DEALLOCATE(tau_aero,piz_aero,cg_aero)
     791      DEALLOCATE(tau_aero_sw_rrtm,piz_aero_sw_rrtm,cg_aero_sw_rrtm)
     792      DEALLOCATE(tau_aero_lw_rrtm,piz_aero_lw_rrtm,cg_aero_lw_rrtm)
     793      DEALLOCATE(ccm)
     794      if (ok_gwd_rando) DEALLOCATE(du_gwd_rando)
     795      if (.not. ok_hines .and. ok_gwd_rando) DEALLOCATE(du_gwd_front)
    793796       
    794797!!! nrlmd le 10/04/2012
    795       deallocate(ale_bl_trig)
     798      DEALLOCATE(ale_bl_trig)
    796799!!! fin nrlmd le 10/04/2012
    797800
  • LMDZ6/branches/Ocean_skin/libf/phylmd/physiq_mod.F90

    • Property svn:keywords changed from Author Date Id Revision to Id
    r3617 r3798  
    1616       d_u, d_v, d_t, d_qx, d_ps)
    1717
     18! For clarity, the "USE" section is now arranged in alphabetical order,
     19! with a separate section for CPP keys
     20! PLEASE try to follow this rule
     21
     22    USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando
     23    USE aero_mod
     24    USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, &
     25  &      fl_ebil, fl_cor_ebil
    1826    USE assert_m, only: assert
     27    USE change_srf_frac_mod
     28    USE conf_phys_m, only: conf_phys
     29    USE carbon_cycle_mod, ONLY : infocfields_init, RCO2_glo, carbon_cycle_rad
     30    USE CFMIP_point_locations   ! IM stations CFMIP
     31    USE cmp_seri_mod
     32    USE dimphy
     33    USE etat0_limit_unstruct_mod
     34    USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando
     35    USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
     36    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    1937    USE ioipsl, only: histbeg, histvert, histdef, histend, histsync, &
    2038         histwrite, ju2ymds, ymds2ju, getin
    21     USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
     39    USE ioipsl_getin_p_mod, ONLY : getin_p
     40    USE indice_sol_mod
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac
     42    USE iophy
     43    USE limit_read_mod, ONLY : init_limit_read
     44    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured
     45    USE mod_phys_lmdz_mpi_data, only: is_mpi_root
     46    USE mod_phys_lmdz_para
     47    USE netcdf95, only: nf95_close
     48    USE netcdf, only: nf90_fill_real     ! IM for NMC files
     49    USE open_climoz_m, only: open_climoz ! ozone climatology from a file
     50    USE ozonecm_m, only: ozonecm ! ozone of J.-F. Royer
     51    USE pbl_surface_mod, ONLY : pbl_surface
     52    USE phyaqua_mod, only: zenang_an
     53    USE phystokenc_mod, ONLY: offline, phystokenc
    2254    USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, &
    2355         year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour
     56!!  USE phys_local_var_mod, ONLY : a long list of variables
     57!!              ==> see below, after "CPP Keys" section
     58    USE phys_state_var_mod ! Variables sauvegardees de la physique
     59    USE phys_output_mod
     60    USE phys_output_ctrlout_mod
     61    USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level
     62    USE readaerosol_mod, ONLY : init_aero_fromfile
     63    USE readaerosolstrato_m, ONLY : init_readaerosolstrato
     64    USE radlwsw_m, only: radlwsw
     65    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
     66    USE regr_pr_time_av_m, only: regr_pr_time_av
     67    USE surface_data,     ONLY : type_ocean, ok_veget, landice_opt
     68    USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, &
     69          day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time
     70    USE tracinca_mod, ONLY: config_inca
     71    USE tropopause_m,     ONLY: dyn_tropopause
     72    USE vampir
     73    USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp
    2474    USE write_field_phy
    25     USE dimphy
    26     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac
    27     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured
    28     USE mod_phys_lmdz_para
    29     USE iophy
    30     USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level
    31     USE phystokenc_mod, ONLY: offline, phystokenc
    32     USE time_phylmdz_mod, only: raz_date, day_step_phy, update_time,current_time
    33     USE vampir
    34     USE pbl_surface_mod, ONLY : pbl_surface
    35     USE change_srf_frac_mod
    36     USE surface_data,     ONLY : type_ocean, ok_veget, ok_snow
    37     USE tropopause_m,     ONLY: dyn_tropopause
     75
     76    !USE cmp_seri_mod
     77!    USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, &
     78!  &      fl_ebil, fl_cor_ebil
     79
     80!!!!!!!!!!!!!!!!!! "USE" section for CPP keys !!!!!!!!!!!!!!!!!!!!!!!!
     81!
     82!
    3883#ifdef CPP_Dust
    39     USE phytracr_spl_mod, ONLY: phytracr_spl
     84    USE phytracr_spl_mod, ONLY: phytracr_spl, phytracr_spl_out_init
     85    USE phys_output_write_spl_mod
     86#else
     87    USE phytrac_mod, ONLY : phytrac_init, phytrac
     88    USE phys_output_write_mod
    4089#endif
     90
     91
     92#ifdef REPROBUS
     93    USE CHEM_REP, ONLY : Init_chem_rep_xjour, &
     94         d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, &
     95         ztrop, gravit,itroprep, Z1,Z2,fac,B
     96#endif
     97
     98
     99#ifdef CPP_RRTM
     100    USE YOERAD, ONLY : NRADLP
     101    USE YOESW, ONLY : RSUN
     102#endif
     103
     104
    41105#ifdef CPP_StratAer
    42106    USE strataer_mod, ONLY: strataer_init
    43107#endif
    44     USE phys_local_var_mod, ONLY: phys_local_var_init, phys_local_var_end, &
     108
     109
     110#ifdef CPP_XIOS
     111    USE xios, ONLY: xios_update_calendar, xios_context_finalize, &
     112            xios_get_field_attr, xios_field_is_active
     113    USE wxios, ONLY: missing_val, missing_val_omp
     114#endif
     115#ifndef CPP_XIOS
     116    USE paramLMDZ_phy_mod
     117#endif
     118!
     119!
     120!!!!!!!!!!!!!!!!!!  END "USE" for CPP keys !!!!!!!!!!!!!!!!!!!!!!
     121
     122USE phys_local_var_mod, ONLY: phys_local_var_init, phys_local_var_end, &
    45123       ! [Variables internes non sauvegardees de la physique]
    46124       ! Variables locales pour effectuer les appels en serie
     
    195273       ref_liq, ref_ice, theta,  &
    196274       ref_liq_pi, ref_ice_pi,  &
    197        zphi, zx_rh, &
     275       zphi, zx_rh, zx_rhl, zx_rhi, &
    198276       pmfd, pmfu,  &
    199277       !
     
    216294       zxsnow,snowhgt,qsnow,to_ice,sissnow,runoff,albsol3_lic
    217295       !
    218     USE phys_state_var_mod ! Variables sauvegardees de la physique
    219 #ifdef CPP_Dust
    220     USE phys_output_write_spl_mod
    221 #else
    222     USE phys_output_var_mod ! Variables pour les ecritures des sorties
    223 #endif
    224 
    225     USE phys_output_write_mod
    226     USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
    227     USE phys_output_mod
    228     USE phys_output_ctrlout_mod
    229     USE open_climoz_m, only: open_climoz ! ozone climatology from a file
    230     USE regr_pr_time_av_m, only: regr_pr_time_av
    231     USE netcdf95, only: nf95_close
    232     !IM for NMC files
    233     USE netcdf, only: nf90_fill_real
    234     USE mod_phys_lmdz_mpi_data, only: is_mpi_root
    235     USE aero_mod
    236     USE ozonecm_m, only: ozonecm ! ozone of J.-F. Royer
    237     USE conf_phys_m, only: conf_phys
    238     USE radlwsw_m, only: radlwsw
    239     USE phyaqua_mod, only: zenang_an
    240     USE time_phylmdz_mod, only: day_step_phy, annee_ref, day_ref, itau_phy, &
    241          start_time, pdtphys, day_ini
    242     USE tracinca_mod, ONLY: config_inca
    243 #ifdef CPP_XIOS
    244     USE wxios, ONLY: missing_val, missing_val_omp
    245     USE xios, ONLY: xios_get_field_attr, xios_field_is_active
    246 #endif
    247 #ifdef REPROBUS
    248     USE CHEM_REP, ONLY : Init_chem_rep_xjour
    249 #endif
    250     USE indice_sol_mod
    251     USE phytrac_mod, ONLY : phytrac_init, phytrac
    252     USE carbon_cycle_mod, ONLY : infocfields_init, RCO2_glo, carbon_cycle_rad
    253 
    254 #ifdef CPP_RRTM
    255     USE YOERAD, ONLY : NRADLP
    256     USE YOESW, ONLY : RSUN
    257 #endif
    258     USE ioipsl_getin_p_mod, ONLY : getin_p
    259 
    260 #ifndef CPP_XIOS
    261     USE paramLMDZ_phy_mod
    262 #endif
    263 
    264     USE cmp_seri_mod
    265     USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, &
    266   &      fl_ebil, fl_cor_ebil
    267 
    268     !IM stations CFMIP
    269     USE CFMIP_point_locations
    270     USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando
    271     USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando
    272     USE VERTICAL_LAYERS_MOD, ONLY: aps,bps
    273     USE etat0_limit_unstruct_mod
    274 #ifdef CPP_XIOS
    275     USE xios, ONLY: xios_update_calendar, xios_context_finalize
    276 #endif
    277     USE limit_read_mod, ONLY : init_limit_read
    278     USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
    279     USE readaerosol_mod, ONLY : init_aero_fromfile
    280     USE readaerosolstrato_m, ONLY : init_readaerosolstrato
     296
    281297
    282298    IMPLICIT NONE
     
    10651081    LOGICAL, SAVE :: flag_bc_internal_mixture
    10661082    !$OMP THREADPRIVATE(flag_bc_internal_mixture)
    1067     LOGICAL, SAVE :: new_aod
    1068     !$OMP THREADPRIVATE(new_aod)
    10691083    !
    10701084    !--STRAT AEROSOL
     
    12491263            ok_ade, ok_aie, ok_alw, ok_cdnc, ok_volcan, aerosol_couple, &
    12501264            chemistry_couple, &
    1251             flag_aerosol, flag_aerosol_strat, flag_aer_feedback, new_aod, &
     1265            flag_aerosol, flag_aerosol_strat, flag_aer_feedback, &
    12521266            flag_bc_internal_mixture, bl95_b0, bl95_b1, &
    12531267                                ! nv flags pour la convection et les
     
    13471361       iflag_phytrac = 1 ! by default we do want to call phytrac
    13481362       CALL getin_p('iflag_phytrac',iflag_phytrac)
     1363#ifdef CPP_Dust
     1364       IF (iflag_phytrac.EQ.0) THEN
     1365         WRITE(lunout,*) 'In order to run with SPLA, iflag_phytrac will be forced to 1'
     1366         iflag_phytrac = 1
     1367       ENDIF
     1368#endif 
    13491369       nvm_lmdz = 13
    13501370       CALL getin_p('NVM',nvm_lmdz)
     
    15151535       ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    15161536       CALL init_iophy_new(latitude_deg,longitude_deg)
     1537       CALL create_etat0_limit_unstruct
     1538       CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0)
    15171539
    15181540          !===================================================================
     
    15751597            ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, &
    15761598            read_climoz, phys_out_filestations, &
    1577             new_aod, aerosol_couple, &
     1599            aerosol_couple, &
    15781600            flag_aerosol_strat, pdtphys, paprs, pphis,  &
    15791601            pplay, lmax_th, ptconv, ptconvth, ivap,  &
     
    16091631#ifdef CPP_COSP
    16101632      IF (ok_cosp) THEN
    1611            DO k = 1, klev
    1612              DO i = 1, klon
    1613                phicosp(i,k) = pphi(i,k) + pphis(i)
    1614              ENDDO
    1615            ENDDO
     1633!           DO k = 1, klev
     1634!             DO i = 1, klon
     1635!               phicosp(i,k) = pphi(i,k) + pphis(i)
     1636!             ENDDO
     1637!           ENDDO
    16161638        CALL phys_cosp(itap,phys_tstep,freq_cosp, &
    16171639               ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, &
     
    16311653#ifdef CPP_COSP2
    16321654        IF (ok_cosp) THEN
    1633            DO k = 1, klev
    1634              DO i = 1, klon
    1635                phicosp(i,k) = pphi(i,k) + pphis(i)
    1636              ENDDO
    1637            ENDDO
     1655!           DO k = 1, klev
     1656!             DO i = 1, klon
     1657!               phicosp(i,k) = pphi(i,k) + pphis(i)
     1658!             ENDDO
     1659!           ENDDO
    16381660          CALL phys_cosp2(itap,phys_tstep,freq_cosp, &
    16391661               ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, &
     
    16811703
    16821704       CALL iniradia(klon,klev,paprs(1,1:klev+1))
    1683        ! Initialisation des champs dans phytrac qui sont utilisés par phys_output_write
     1705
     1706       ! Initialisation des champs dans phytrac* qui sont utilisés par phys_output_write*
     1707#ifdef CPP_Dust
     1708       ! Quand on utilise SPLA, on force iflag_phytrac=1
     1709       CALL phytracr_spl_out_init()
     1710       CALL phys_output_write_spl(itap, pdtphys, paprs, pphis,                  &
     1711                                pplay, lmax_th, aerosol_couple,                 &
     1712                                ok_ade, ok_aie, ivap, ok_sync,                  &
     1713                                ptconv, read_climoz, clevSTD,                   &
     1714                                ptconvth, d_t, qx, d_qx, d_tr_dyn, zmasse,      &
     1715                                flag_aerosol, flag_aerosol_strat, ok_cdnc)
     1716#else
     1717       ! phys_output_write écrit des variables traceurs seulement si iflag_phytrac == 1
     1718       ! donc seulement dans ce cas on doit appeler phytrac_init()
    16841719       IF (iflag_phytrac == 1 ) THEN
    16851720          CALL phytrac_init()
    1686         ENDIF
    1687 
     1721       ENDIF
    16881722       CALL phys_output_write(itap, pdtphys, paprs, pphis,                    &
    16891723                              pplay, lmax_th, aerosol_couple,                 &
    1690                               ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, new_aod, ok_sync,&
     1724                              ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, ok_sync,&
    16911725                              ptconv, read_climoz, clevSTD,                   &
    16921726                              ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
    16931727                              flag_aerosol, flag_aerosol_strat, ok_cdnc)
     1728#endif
     1729
    16941730
    16951731#ifdef CPP_XIOS
     
    16971733#endif
    16981734       IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz)
    1699        CALL create_etat0_limit_unstruct
    1700        CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0)
    17011735
    17021736!jyg<
     
    19521986#endif
    19531987       ENDIF
     1988       IF (type_trac == 'repr') THEN
     1989#ifdef REPROBUS
     1990          CALL chemini_rep(  &
     1991               presnivs, &
     1992               pdtphys, &
     1993               annee_ref, &
     1994               day_ref,  &
     1995               day_ini, &
     1996               start_time, &
     1997               itau_phy, &
     1998               io_lon, &
     1999               io_lat)
     2000#endif
     2001       ENDIF
    19542002
    19552003       !$omp single
     
    22882336
    22892337          wo(:,:,1)=ozonecm(latitude_deg, paprs,read_climoz,rjour=zzz)
     2338#ifdef REPROBUS
     2339          ptrop=dyn_tropopause(t_seri, ztsol, paprs, pplay, rot)/100.
     2340          DO i = 1, klon
     2341             Z1=t_seri(i,itroprep(i)+1)
     2342             Z2=t_seri(i,itroprep(i))
     2343             fac=(Z1-Z2)/alog(pplay(i,itroprep(i)+1)/pplay(i,itroprep(i)))
     2344             B=Z2-fac*alog(pplay(i,itroprep(i)))
     2345             ttrop(i)= fac*alog(ptrop(i))+B
     2346!       
     2347             Z1= 1.e-3 * ( pphi(i,itroprep(i)+1)+pphis(i) ) / gravit
     2348             Z2= 1.e-3 * ( pphi(i,itroprep(i))  +pphis(i) ) / gravit
     2349             fac=(Z1-Z2)/alog(pplay(i,itroprep(i)+1)/pplay(i,itroprep(i)))
     2350             B=Z2-fac*alog(pplay(i,itroprep(i)))
     2351             ztrop(i)=fac*alog(ptrop(i))+B
     2352          ENDDO
     2353#endif
    22902354       ELSE
    22912355          !--- ro3i = elapsed days number since current year 1st january, 0h
     
    24842548            longitude_deg, latitude_deg, rugoro,  zrmu0,      &
    24852549            zsig,      sollwdown, pphi,    cldt,      &
    2486             rain_fall, snow_fall, solsw,   sollw,     &
     2550            rain_fall, snow_fall, solsw,   solswfdiff, sollw,     &
    24872551            gustiness,                                &
    24882552            t_seri,    q_seri,    u_seri,  v_seri,    &
     
    36743738          ENDIF
    36753739          zx_rh(i,k) = q_seri(i,k)/zx_qs
     3740            IF (iflag_ice_thermo .GT. 0) THEN
     3741          zx_rhl(i,k) = q_seri(i,k)/(qsatl(zx_t)/pplay(i,k))
     3742          zx_rhi(i,k) = q_seri(i,k)/(qsats(zx_t)/pplay(i,k))
     3743            ENDIF
    36763744          zqsat(i,k)=zx_qs
    36773745       ENDDO
     
    37563824#endif
    37573825    ENDIF !type_trac = inca
    3758 
     3826    IF (type_trac == 'repr') THEN
     3827#ifdef REPROBUS
     3828    !CALL chemtime_rep(itap+itau_phy-1, date0, dtime, itap)
     3829    CALL chemtime_rep(itap+itau_phy-1, date0, phys_tstep, itap)
     3830#endif
     3831    ENDIF
    37593832
    37603833    !
     
    37713844                !
    37723845                CALL readaerosol_optic( &
    3773                      debut, new_aod, flag_aerosol, itap, jD_cur-jD_ref, &
     3846                     debut, flag_aerosol, itap, jD_cur-jD_ref, &
    37743847                     pdtphys, pplay, paprs, t_seri, rhcl, presnivs,  &
    37753848                     mass_solu_aero, mass_solu_aero_pi,  &
     
    37963869                   !--climatologies or INCA aerosols
    37973870                   CALL readaerosol_optic_rrtm( debut, aerosol_couple, ok_alw, ok_volcan, &
    3798                         new_aod, flag_aerosol, flag_bc_internal_mixture, itap, jD_cur-jD_ref, &
     3871                        flag_aerosol, flag_bc_internal_mixture, itap, jD_cur-jD_ref, &
    37993872                        pdtphys, pplay, paprs, t_seri, rhcl, presnivs,  &
    38003873                        tr_seri, mass_solu_aero, mass_solu_aero_pi,  &
     
    38133886                   !
    38143887                   CALL readaerosol_optic( &
    3815                         debut, new_aod, flag_aerosol, itap, jD_cur-jD_ref, &
     3888                        debut, flag_aerosol, itap, jD_cur-jD_ref, &
    38163889                        pdtphys, pplay, paprs, t_seri, rhcl, presnivs,  &
    38173890                        mass_solu_aero, mass_solu_aero_pi,  &
     
    41024175               ! Rajoute par OB pour RRTM
    41034176               tau_aero_lw_rrtm, &
    4104                cldtaupirad,new_aod, &
     4177               cldtaupirad, &
    41054178!              zqsat, flwcrad, fiwcrad, &
    41064179               zqsat, flwc, fiwc, &
     
    41084181               heat,heat0,cool,cool0,albpla, &
    41094182               heat_volc,cool_volc, &
    4110                topsw,toplw,solsw,sollw, &
     4183               topsw,toplw,solsw,solswfdiff,sollw, &
    41114184               sollwdown, &
    41124185               topsw0,toplw0,solsw0,sollw0, &
     
    41894262                                ! Rajoute par OB pour RRTM
    41904263                     tau_aero_lw_rrtm, &
    4191                      cldtaupi,new_aod, &
     4264                     cldtaupi, &
    41924265!                    zqsat, flwcrad, fiwcrad, &
    41934266                     zqsat, flwc, fiwc, &
     
    41954268                     heatp,heat0p,coolp,cool0p,albplap, &
    41964269                     heat_volc,cool_volc, &
    4197                      topswp,toplwp,solswp,sollwp, &
     4270                     topswp,toplwp,solswp,solswfdiffp,sollwp, &
    41984271                     sollwdownp, &
    41994272                     topsw0p,toplw0p,solsw0p,sollw0p, &
     
    46654738#ifdef CPP_COSPV2
    46664739       IF (itap.eq.1.or.MOD(itap,NINT(freq_cosp/phys_tstep)).EQ.0) THEN
     4740!        IF (MOD(itap,NINT(freq_cosp/phys_tstep)).EQ.0) THEN
    46674741
    46684742          IF (prt_level .GE.10) THEN
    46694743             print*,'freq_cosp',freq_cosp
    46704744          ENDIF
     4745           DO k = 1, klev
     4746             DO i = 1, klon
     4747               phicosp(i,k) = pphi(i,k) + pphis(i)
     4748             ENDDO
     4749           ENDDO
    46714750          mr_ozone=wo(:, :, 1) * dobson_u * 1e3 / zmasse
    46724751                 print*,'Dans physiq.F avant appel '
     
    47214800
    47224801    IF (type_trac=='repr') THEN
     4802!MM pas d'impact, car on recupere q_seri,tr_seri,t_seri via phys_local_var_mod
     4803!MM                               dans Reprobus
    47234804       sh_in(:,:) = q_seri(:,:)
     4805#ifdef REPROBUS
     4806       d_q_rep(:,:) = 0.
     4807       d_ql_rep(:,:) = 0.
     4808       d_qi_rep(:,:) = 0.
     4809#endif
    47244810    ELSE
    47254811       sh_in(:,:) = qx(:,:,ivap)
     
    47274813    ENDIF
    47284814
    4729     IF (iflag_phytrac == 1 ) THEN
    4730 
    47314815#ifdef CPP_Dust
    4732       CALL       phytracr_spl ( debut,lafin , jD_cur,jH_cur,iflag_con,       &  ! I
     4816    !  Avec SPLA, iflag_phytrac est forcé =1
     4817    CALL       phytracr_spl ( debut,lafin , jD_cur,jH_cur,iflag_con,       &  ! I
    47334818                      pdtphys,ftsol,                                   &  ! I
    47344819                      t,q_seri,paprs,pplay,RHcl,                  &  ! I
     
    47464831
    47474832#else
    4748 
    4749     CALL phytrac ( &
     4833    IF (iflag_phytrac == 1 ) THEN
     4834      CALL phytrac ( &
    47504835         itap,     days_elapsed+1,    jH_cur,   debut, &
    47514836         lafin,    phys_tstep,     u, v,     t, &
     
    47714856         d_tr_dyn, &                                 !<<RomP
    47724857         tr_seri, init_source)
     4858#ifdef REPROBUS
     4859
     4860
     4861          print*,'avt add phys rep',abortphy
     4862
     4863     CALL add_phys_tend &
     4864            (du0,dv0,dt0,d_q_rep,d_ql_rep,d_qi_rep,paprs,&
     4865             'rep',abortphy,flag_inhib_tend,itap,0)
     4866        IF (abortphy==1) Print*,'ERROR ABORT REP'
     4867
     4868          print*,'apr add phys rep',abortphy
     4869
    47734870#endif
    47744871    ENDIF    ! (iflag_phytrac=1)
     4872
     4873#endif
     4874    !ENDIF    ! (iflag_phytrac=1)
    47754875
    47764876    IF (offline) THEN
     
    48664966            pphis, &
    48674967            zx_rh, &
    4868             aps, bps)
     4968            aps, bps, ap, bp)
    48694969
    48704970       CALL VTe(VTinca)
     
    50725172  CALL phys_output_write_spl(itap, pdtphys, paprs, pphis,  &
    50735173       pplay, lmax_th, aerosol_couple,                 &
    5074        ok_ade, ok_aie, ivap, new_aod, ok_sync,         &
     5174       ok_ade, ok_aie, ivap, ok_sync,                  &
    50755175       ptconv, read_climoz, clevSTD,                   &
    50765176       ptconvth, d_t, qx, d_qx, d_tr_dyn, zmasse,      &
     
    50795179    CALL phys_output_write(itap, pdtphys, paprs, pphis,  &
    50805180         pplay, lmax_th, aerosol_couple,                 &
    5081          ok_ade, ok_aie, ok_volcan, ivap, iliq, isol, new_aod,      &
     5181         ok_ade, ok_aie, ok_volcan, ivap, iliq, isol,    &
    50825182         ok_sync, ptconv, read_climoz, clevSTD,          &
    50835183         ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
     
    50915191#endif
    50925192
    5093 ! On remet des variables a .false. apres un premier appel
     5193! Pour XIOS : On remet des variables a .false. apres un premier appel
    50945194    IF (debut) THEN
    50955195#ifdef CPP_XIOS
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phytrac_mod.F90

    r3605 r3798  
    5656  SUBROUTINE phytrac_init()
    5757    USE dimphy
    58     USE infotrac_phy, ONLY: nbtr
     58    USE infotrac_phy, ONLY: nbtr, type_trac
     59    USE tracco2i_mod, ONLY: tracco2i_init
    5960    IMPLICIT NONE
    6061
     
    7071       ALLOCATE(d_tr_th(klon,klev,nbtr))
    7172       ALLOCATE(d_tr_lessi_impa(klon,klev,nbtr),d_tr_lessi_nucl(klon,klev,nbtr))
     73
     74
     75
     76    !===============================================================================
     77    !    -- Do specific treatment according to chemestry model or local LMDZ tracers
     78    !     
     79    !===============================================================================
     80    SELECT CASE(type_trac)
     81    CASE('co2i')
     82       !   -- CO2 interactif --
     83       CALL tracco2i_init()
     84    END SELECT
     85
    7286
    7387  END SUBROUTINE phytrac_init
  • LMDZ6/branches/Ocean_skin/libf/phylmd/radiation_AR4.F90

    r2346 r3798  
    482482#ifdef REPROBUS
    483483  USE chem_rep, ONLY: rsuntime, ok_suntime
     484  USE print_control_mod, ONLY: lunout
    484485#endif
    485486
  • LMDZ6/branches/Ocean_skin/libf/phylmd/radlwsw_m.F90

    r3605 r3798  
    2121   tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm,& ! rajoute par OB pour RRTM
    2222   tau_aero_lw_rrtm, &                                   ! rajoute par C. Kleinschmitt pour RRTM
    23    cldtaupi, new_aod, &
     23   cldtaupi, &
    2424   qsat, flwc, fiwc, &
    2525   ref_liq, ref_ice, ref_liq_pi, ref_ice_pi, &
    2626   heat,heat0,cool,cool0,albpla,&
    2727   heat_volc, cool_volc,&
    28    topsw,toplw,solsw,sollw,&
     28   topsw,toplw,solsw,solswfdiff,sollw,&
    2929   sollwdown,&
    3030   topsw0,toplw0,solsw0,sollw0,&
     
    117117  ! toplw----output-R- ray. IR montant au sommet de l'atmosphere
    118118  ! solsw----output-R- flux solaire net a la surface
     119  ! solswfdiff----output-R- fraction de rayonnement diffus pour le flux solaire descendant a la surface
    119120  ! sollw----output-R- ray. IR montant a la surface
    120121  ! solswad---output-R- ray. solaire net absorbe a la surface (aerosol dir)
     
    188189  REAL,    INTENT(in)  :: tsol(KLON)
    189190  REAL,    INTENT(in) :: alb_dir(KLON,NSW),alb_dif(KLON,NSW)
    190   real, intent(in) :: SFRWL(6)
     191  REAL,    INTENT(in) :: SFRWL(6)
    191192!albedo SB <<<
    192193  REAL,    INTENT(in)  :: t(KLON,KLEV), q(KLON,KLEV)
     
    222223
    223224  REAL,    INTENT(in)  :: cldtaupi(KLON,KLEV)                            ! cloud optical thickness for pre-industrial aerosol concentrations
    224   LOGICAL, INTENT(in)  :: new_aod                                        ! flag pour retrouver les resultats exacts de l'AR4 dans le cas ou l'on ne travaille qu'avec les sulfates
    225225  REAL,    INTENT(in)  :: qsat(klon,klev) ! Variable pour iflag_rrtm=1
    226226  REAL,    INTENT(in)  :: flwc(klon,klev) ! Variable pour iflag_rrtm=1
     
    236236  REAL,    INTENT(out) :: heat_volc(KLON,KLEV), cool_volc(KLON,KLEV) !NL
    237237  REAL,    INTENT(out) :: topsw(KLON), toplw(KLON)
    238   REAL,    INTENT(out) :: solsw(KLON), sollw(KLON), albpla(KLON)
     238  REAL,    INTENT(out) :: solsw(KLON), sollw(KLON), albpla(KLON), solswfdiff(KLON)
    239239  REAL,    INTENT(out) :: topsw0(KLON), toplw0(KLON), solsw0(KLON), sollw0(KLON)
    240240  REAL,    INTENT(out) :: sollwdown(KLON)
     
    287287  REAL(KIND=8) PWV(kdlon,kflev), PQS(kdlon,kflev)
    288288
    289   real(kind=8) POZON(kdlon, kflev, size(wo, 3)) ! mass fraction of ozone
     289  REAL(kind=8) POZON(kdlon, kflev, size(wo, 3)) ! mass fraction of ozone
    290290  ! "POZON(:, :, 1)" is for the average day-night field,
    291291  ! "POZON(:, :, 2)" is for daylight time.
     
    303303  REAL(KIND=8) zheat_volc(kdlon,kflev), zcool_volc(kdlon,kflev) !NL
    304304  REAL(KIND=8) ztopsw(kdlon), ztoplw(kdlon)
    305   REAL(KIND=8) zsolsw(kdlon), zsollw(kdlon), zalbpla(kdlon)
     305  REAL(KIND=8) zsolsw(kdlon), zsollw(kdlon), zalbpla(kdlon), zsolswfdiff(kdlon)
    306306  REAL(KIND=8) zsollwdown(kdlon)
    307307  REAL(KIND=8) ztopsw0(kdlon), ztoplw0(kdlon)
     
    330330!MPL input supplementaires pour RECMWFL
    331331! flwc, fiwc = Liquid Water Content & Ice Water Content (kg/kg)
    332       REAL(KIND=8) GEMU(klon)
     332  REAL(KIND=8) GEMU(klon)
    333333!MPL input RECMWFL:
    334334! Tableaux aux niveaux inverses pour respecter convention Arpege
    335       REAL(KIND=8) ref_liq_i(klon,klev) ! cloud droplet radius present-day from newmicro (inverted)
    336       REAL(KIND=8) ref_ice_i(klon,klev) ! ice crystal radius present-day from newmicro (inverted)
     335  REAL(KIND=8) ref_liq_i(klon,klev) ! cloud droplet radius present-day from newmicro (inverted)
     336  REAL(KIND=8) ref_ice_i(klon,klev) ! ice crystal radius present-day from newmicro (inverted)
    337337!--OB
    338       REAL(KIND=8) ref_liq_pi_i(klon,klev) ! cloud droplet radius pre-industrial from newmicro (inverted)
    339       REAL(KIND=8) ref_ice_pi_i(klon,klev) ! ice crystal radius pre-industrial from newmicro (inverted)
     338  REAL(KIND=8) ref_liq_pi_i(klon,klev) ! cloud droplet radius pre-industrial from newmicro (inverted)
     339  REAL(KIND=8) ref_ice_pi_i(klon,klev) ! ice crystal radius pre-industrial from newmicro (inverted)
    340340!--end OB
    341       REAL(KIND=8) paprs_i(klon,klev+1)
    342       REAL(KIND=8) pplay_i(klon,klev)
    343       REAL(KIND=8) cldfra_i(klon,klev)
    344       REAL(KIND=8) POZON_i(kdlon,kflev, size(wo, 3)) ! mass fraction of ozone
     341  REAL(KIND=8) paprs_i(klon,klev+1)
     342  REAL(KIND=8) pplay_i(klon,klev)
     343  REAL(KIND=8) cldfra_i(klon,klev)
     344  REAL(KIND=8) POZON_i(kdlon,kflev, size(wo, 3)) ! mass fraction of ozone
    345345  ! "POZON(:, :, 1)" is for the average day-night field,
    346346  ! "POZON(:, :, 2)" is for daylight time.
    347347!!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6     
    348       REAL(KIND=8) PAER_i(kdlon,kflev,6)
    349       REAL(KIND=8) PDP_i(klon,klev)
    350       REAL(KIND=8) t_i(klon,klev),q_i(klon,klev),qsat_i(klon,klev)
    351       REAL(KIND=8) flwc_i(klon,klev),fiwc_i(klon,klev)
     348  REAL(KIND=8) PAER_i(kdlon,kflev,6)
     349  REAL(KIND=8) PDP_i(klon,klev)
     350  REAL(KIND=8) t_i(klon,klev),q_i(klon,klev),qsat_i(klon,klev)
     351  REAL(KIND=8) flwc_i(klon,klev),fiwc_i(klon,klev)
    352352!MPL output RECMWFL:
    353       REAL(KIND=8) ZEMTD (klon,klev+1),ZEMTD_i (klon,klev+1)       
    354       REAL(KIND=8) ZEMTU (klon,klev+1),ZEMTU_i (klon,klev+1)     
    355       REAL(KIND=8) ZTRSO (klon,klev+1),ZTRSO_i (klon,klev+1)   
    356       REAL(KIND=8) ZTH   (klon,klev+1),ZTH_i   (klon,klev+1)   
    357       REAL(KIND=8) ZCTRSO(klon,2)       
    358       REAL(KIND=8) ZCEMTR(klon,2)     
    359       REAL(KIND=8) ZTRSOD(klon)       
    360       REAL(KIND=8) ZLWFC (klon,2)     
    361       REAL(KIND=8) ZLWFT (klon,klev+1),ZLWFT_i (klon,klev+1)   
    362       REAL(KIND=8) ZSWFC (klon,2)     
    363       REAL(KIND=8) ZSWFT (klon,klev+1),ZSWFT_i (klon,klev+1)
    364       REAL(KIND=8) ZFLUCDWN_i(klon,klev+1),ZFLUCUP_i(klon,klev+1)
    365       REAL(KIND=8) PPIZA_TOT(klon,klev,NSW)
    366       REAL(KIND=8) PCGA_TOT(klon,klev,NSW)
    367       REAL(KIND=8) PTAU_TOT(klon,klev,NSW)
    368       REAL(KIND=8) PPIZA_NAT(klon,klev,NSW)
    369       REAL(KIND=8) PCGA_NAT(klon,klev,NSW)
    370       REAL(KIND=8) PTAU_NAT(klon,klev,NSW)
     353  REAL(KIND=8) ZEMTD (klon,klev+1),ZEMTD_i (klon,klev+1)       
     354  REAL(KIND=8) ZEMTU (klon,klev+1),ZEMTU_i (klon,klev+1)     
     355  REAL(KIND=8) ZTRSO (klon,klev+1),ZTRSO_i (klon,klev+1)   
     356  REAL(KIND=8) ZTH   (klon,klev+1),ZTH_i   (klon,klev+1)   
     357  REAL(KIND=8) ZCTRSO(klon,2)       
     358  REAL(KIND=8) ZCEMTR(klon,2)     
     359  REAL(KIND=8) ZTRSOD(klon)       
     360  REAL(KIND=8) ZLWFC (klon,2)     
     361  REAL(KIND=8) ZLWFT (klon,klev+1),ZLWFT_i (klon,klev+1)   
     362  REAL(KIND=8) ZSWFC (klon,2)     
     363  REAL(KIND=8) ZSWFT (klon,klev+1),ZSWFT_i (klon,klev+1)
     364  REAL(KIND=8) ZFLUCDWN_i(klon,klev+1),ZFLUCUP_i(klon,klev+1)
     365  REAL(KIND=8) PPIZA_TOT(klon,klev,NSW)
     366  REAL(KIND=8) PCGA_TOT(klon,klev,NSW)
     367  REAL(KIND=8) PTAU_TOT(klon,klev,NSW)
     368  REAL(KIND=8) PPIZA_NAT(klon,klev,NSW)
     369  REAL(KIND=8) PCGA_NAT(klon,klev,NSW)
     370  REAL(KIND=8) PTAU_NAT(klon,klev,NSW)
    371371#ifdef CPP_RRTM
    372       REAL(KIND=8) PTAU_LW_TOT(klon,klev,NLW)
    373       REAL(KIND=8) PTAU_LW_NAT(klon,klev,NLW)
     372  REAL(KIND=8) PTAU_LW_TOT(klon,klev,NLW)
     373  REAL(KIND=8) PTAU_LW_NAT(klon,klev,NLW)
    374374#endif
    375       REAL(KIND=8) PSFSWDIR(klon,NSW)
    376       REAL(KIND=8) PSFSWDIF(klon,NSW)
    377       REAL(KIND=8) PFSDNN(klon)
    378       REAL(KIND=8) PFSDNV(klon)
     375  REAL(KIND=8) PSFSWDIR(klon,NSW)
     376  REAL(KIND=8) PSFSWDIF(klon,NSW)
     377  REAL(KIND=8) PFSDNN(klon)
     378  REAL(KIND=8) PFSDNV(klon)
    379379!MPL On ne redefinit pas les tableaux ZFLUX,ZFLUC,
    380380!MPL ZFSDWN,ZFCDWN,ZFSUP,ZFCUP car ils existent deja
    381381!MPL sous les noms de ZFLDN,ZFLDN0,ZFLUP,ZFLUP0,
    382382!MPL ZFSDN,ZFSDN0,ZFSUP,ZFSUP0
    383       REAL(KIND=8) ZFLUX_i (klon,2,klev+1)
    384       REAL(KIND=8) ZFLUC_i (klon,2,klev+1)
    385       REAL(KIND=8) ZFSDWN_i (klon,klev+1)
    386       REAL(KIND=8) ZFCDWN_i (klon,klev+1)
    387       REAL(KIND=8) ZFCCDWN_i (klon,klev+1)
    388       REAL(KIND=8) ZFSUP_i (klon,klev+1)
    389       REAL(KIND=8) ZFCUP_i (klon,klev+1)
    390       REAL(KIND=8) ZFCCUP_i (klon,klev+1)
    391       REAL(KIND=8) ZFLCCDWN_i (klon,klev+1)
    392       REAL(KIND=8) ZFLCCUP_i (klon,klev+1)
     383  REAL(KIND=8) ZFLUX_i (klon,2,klev+1)
     384  REAL(KIND=8) ZFLUC_i (klon,2,klev+1)
     385  REAL(KIND=8) ZFSDWN_i (klon,klev+1)
     386  REAL(KIND=8) ZFCDWN_i (klon,klev+1)
     387  REAL(KIND=8) ZFCCDWN_i (klon,klev+1)
     388  REAL(KIND=8) ZFSUP_i (klon,klev+1)
     389  REAL(KIND=8) ZFCUP_i (klon,klev+1)
     390  REAL(KIND=8) ZFCCUP_i (klon,klev+1)
     391  REAL(KIND=8) ZFLCCDWN_i (klon,klev+1)
     392  REAL(KIND=8) ZFLCCUP_i (klon,klev+1)
    393393! 3 lignes suivantes a activer pour CCMVAL (MPL 20100412)
    394394!      REAL(KIND=8) RSUN(3,2)
    395395!      REAL(KIND=8) SUN(3)
    396396!      REAL(KIND=8) SUN_FRACT(2)
    397   real, parameter:: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
     397  REAL, PARAMETER:: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
    398398  CHARACTER (LEN=80) :: abort_message
    399399  CHARACTER (LEN=80) :: modname='radlwsw_m'
    400400
    401   call assert(size(wo, 1) == klon, size(wo, 2) == klev, "radlwsw wo")
     401  REAL zdir, zdif
     402
     403  CALL assert(size(wo, 1) == klon, size(wo, 2) == klev, "radlwsw wo")
    402404  ! initialisation
    403405  ist=1
     
    415417  zsolsw0_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4
    416418
    417 
    418    ZTOPSWADAERO(:)  = 0. !ym missing init
    419    ZSOLSWADAERO(:)  = 0. !ym missing init
    420    ZTOPSWAD0AERO(:) = 0. !ym missing init
    421    ZSOLSWAD0AERO(:) = 0. !ym missing init
    422    ZTOPSWAIAERO(:)  = 0. !ym missing init
    423    ZSOLSWAIAERO(:)  = 0. !ym missing init 
    424    ZTOPSWCF_AERO(:,:)= 0.!ym missing init 
    425    ZSOLSWCF_AERO(:,:) =0. !ym missing init 
     419  ZTOPSWADAERO(:)  = 0. !ym missing init
     420  ZSOLSWADAERO(:)  = 0. !ym missing init
     421  ZTOPSWAD0AERO(:) = 0. !ym missing init
     422  ZSOLSWAD0AERO(:) = 0. !ym missing init
     423  ZTOPSWAIAERO(:)  = 0. !ym missing init
     424  ZSOLSWAIAERO(:)  = 0. !ym missing init 
     425  ZTOPSWCF_AERO(:,:)= 0.!ym missing init 
     426  ZSOLSWCF_AERO(:,:) =0. !ym missing init 
    426427
    427428  !
     
    454455  IF (type_trac == 'repr') THEN
    455456#ifdef REPROBUS
    456      if(ok_SUNTIME) PSCT = solaireTIME/zdist/zdist
    457      print*,'Constante solaire: ',PSCT*zdist*zdist
     457    IF (iflag_rrtm==0) THEN
     458      IF (ok_SUNTIME) PSCT = solaireTIME/zdist/zdist
     459      print*,'Constante solaire: ',PSCT*zdist*zdist
     460    ENDIF
    458461#endif
    459   END IF
     462  ENDIF
    460463
    461464  DO j = 1, nb_gr
     
    540543       CALL RAD_INTERACTIF(POZON,iof)
    541544#endif
    542     END IF
    543 
     545    ENDIF
    544546    !
    545547    DO k = 1, kflev+1
     
    567569      ENDDO
    568570    ENDDO
    569 
    570571!
    571572!===== iflag_rrtm ================================================
    572573!     
    573574    IF (iflag_rrtm == 0) THEN       !!!! remettre 0 juste pour tester l'ancien rayt via rrtm
     575!
    574576!--- Mise a zero des tableaux output du rayonnement LW-AR4 ----------             
    575577      DO k = 1, kflev+1
     
    650652      zsolswaiaero(i)=0.
    651653      ENDDO
     654
     655      !--fraction of diffuse radiation in surface SW downward radiation
     656      !--not computed with old radiation scheme
     657      zsolswfdiff(:) = -999.999
     658
    652659!     print *,'Avant SW_LMDAR4: PSCT zrmu0 zfract',PSCT, zrmu0, zfract
    653660       ! daylight ozone, if we have it, for short wave
    654        IF (.NOT. new_aod) THEN
    655           ! use old version
    656           CALL SW_LMDAR4(PSCT, zrmu0, zfract,&
    657                PPMB, PDP, &
    658                PPSOL, PALBD, PALBP,&
    659                PTAVE, PWV, PQS, POZON(:, :, size(wo, 3)), PAER,&
    660                PCLDSW, PTAU, POMEGA, PCG,&
    661                zheat, zheat0,&
    662                zalbpla,ztopsw,zsolsw,ztopsw0,zsolsw0,&
    663                ZFSUP,ZFSDN,ZFSUP0,ZFSDN0,&
    664                tauaero(:,:,5,:), pizaero(:,:,5,:), cgaero(:,:,5,:),&
    665                PTAUA, POMEGAA,&
    666                ztopswadaero,zsolswadaero,&
    667                ztopswaiaero,zsolswaiaero,&
    668                ok_ade, ok_aie)
    669          
    670        ELSE ! new_aod=T         
    671           CALL SW_AEROAR4(PSCT, zrmu0, zfract,&
     661      CALL SW_AEROAR4(PSCT, zrmu0, zfract,&
    672662               PPMB, PDP,&
    673663               PPSOL, PALBD, PALBP,&
     
    686676               ztopswcf_aero,zsolswcf_aero, &
    687677               ok_ade, ok_aie, flag_aerosol,flag_aerosol_strat)
    688        ENDIF
    689678
    690679       ZSWFT0_i(:,:) = ZFSDN0(:,:)-ZFSUP0(:,:)
     
    693682       DO i=1,kdlon
    694683       DO k=1,kflev+1
    695 !        print *,'iof i k klon klev=',iof,i,k,klon,klev
    696684         lwdn0 ( iof+i,k)   = ZFLDN0 ( i,k)
    697685         lwdn  ( iof+i,k)   = ZFLDN  ( i,k)
     
    704692       ENDDO 
    705693       ENDDO 
    706 !          print*,'SW_AR4 ZFSDN0 1 , klev:',ZFSDN0(1:klon,1),ZFSDN0(1:klon,klev)
    707 !          print*,'SW_AR4 swdn0  1 , klev:',swdn0(1:klon,1),swdn0(1:klon,klev)
    708 !          print*,'SW_AR4 ZFSUP0 1 , klev:',ZFSUP0(1:klon,1),ZFSUP0(1:klon,klev)
    709 !          print*,'SW_AR4 swup0  1 , klev:',swup0(1:klon,1),swup0(1:klon,klev)
    710 !          print*,'SW_AR4 ZFSDN  1 , klev:',ZFSDN(1:klon,1) ,ZFSDN(1:klon,klev)
    711 !          print*,'SW_AR4 ZFSUP  1 , klev:',ZFSUP(1:klon,1) ,ZFSUP(1:klon,klev)
     694!
    712695    ELSE 
    713696#ifdef CPP_RRTM
     
    717700      DO k = 1, kflev+1
    718701      DO i = 1, kdlon
    719       ZEMTD_i(i,k)=0.
    720       ZEMTU_i(i,k)=0.
    721       ZTRSO_i(i,k)=0.
    722       ZTH_i(i,k)=0.
    723       ZLWFT_i(i,k)=0.
    724       ZSWFT_i(i,k)=0.
    725       ZFLUX_i(i,1,k)=0.
    726       ZFLUX_i(i,2,k)=0.
    727       ZFLUC_i(i,1,k)=0.
    728       ZFLUC_i(i,2,k)=0.
    729       ZFSDWN_i(i,k)=0.
    730       ZFCDWN_i(i,k)=0.
    731       ZFCCDWN_i(i,k)=0.
    732       ZFSUP_i(i,k)=0.
    733       ZFCUP_i(i,k)=0.
    734       ZFCCUP_i(i,k)=0.
    735       ZFLCCDWN_i(i,k)=0.
    736       ZFLCCUP_i(i,k)=0.
     702        ZEMTD_i(i,k)=0.
     703        ZEMTU_i(i,k)=0.
     704        ZTRSO_i(i,k)=0.
     705        ZTH_i(i,k)=0.
     706        ZLWFT_i(i,k)=0.
     707        ZSWFT_i(i,k)=0.
     708        ZFLUX_i(i,1,k)=0.
     709        ZFLUX_i(i,2,k)=0.
     710        ZFLUC_i(i,1,k)=0.
     711        ZFLUC_i(i,2,k)=0.
     712        ZFSDWN_i(i,k)=0.
     713        ZFCDWN_i(i,k)=0.
     714        ZFCCDWN_i(i,k)=0.
     715        ZFSUP_i(i,k)=0.
     716        ZFCUP_i(i,k)=0.
     717        ZFCCUP_i(i,k)=0.
     718        ZFLCCDWN_i(i,k)=0.
     719        ZFLCCUP_i(i,k)=0.
    737720      ENDDO
    738721      ENDDO
     
    788771      PFSDNV(i)=0.
    789772      DO kk = 1, NSW
    790       PSFSWDIR(i,kk)=0.
    791       PSFSWDIF(i,kk)=0.
     773        PSFSWDIR(i,kk)=0.
     774        PSFSWDIF(i,kk)=0.
    792775      ENDDO
    793776      ENDDO
     
    796779! On met les donnees dans l'ordre des niveaux arpege
    797780         paprs_i(:,1)=paprs(:,klev+1)
    798          do k=1,klev
     781         DO k=1,klev
    799782            paprs_i(1:klon,k+1) =paprs(1:klon,klev+1-k)
    800783            pplay_i(1:klon,k)   =pplay(1:klon,klev+1-k)
     
    811794            ref_liq_pi_i(1:klon,k) =ref_liq_pi(1:klon,klev+1-k)
    812795            ref_ice_pi_i(1:klon,k) =ref_ice_pi(1:klon,klev+1-k)
    813          enddo
    814          do k=1,kflev
     796         ENDDO
     797         DO k=1,kflev
    815798           POZON_i(1:klon,k,:)=POZON(1:klon,kflev+1-k,:)
    816799!!!            POZON_i(1:klon,k)=POZON(1:klon,k)            !!! on laisse 1=sol et klev=top
    817800!          print *,'Juste avant RECMWFL: k tsol temp',k,tsol,t(1,k)
    818801!!!!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6     
    819             do i=1,6
     802            DO i=1,6
    820803            PAER_i(1:klon,k,i)=PAER(1:klon,kflev+1-k,i)
    821             enddo
    822          enddo
     804            ENDDO
     805         ENDDO
    823806!       print *,'RADLWSW: avant RECMWFL, RI0,rmu0=',solaire,rmu0
    824807
     
    849832!    s   'RECMWF ')
    850833!
    851       if(lldebug) then
     834      IF (lldebug) THEN
    852835        CALL writefield_phy('paprs_i',paprs_i,klev+1)
    853836        CALL writefield_phy('pplay_i',pplay_i,klev)
     
    863846        CALL writefield_phy('palbd_new',PALBD_NEW,NSW)
    864847        CALL writefield_phy('palbp_new',PALBP_NEW,NSW)
    865       endif
     848      ENDIF
    866849
    867850! Nouvel appel a RECMWF (celui du cy32t0)
     
    893876           
    894877!        print *,'RADLWSW: apres RECMWF'
    895       if(lldebug) then
     878      IF (lldebug) THEN
    896879        CALL writefield_phy('zemtd_i',ZEMTD_i,klev+1)
    897880        CALL writefield_phy('zemtu_i',ZEMTU_i,klev+1)
     
    918901        CALL writefield_phy('zfcdwn_i',ZFCDWN_i,klev+1)
    919902        CALL writefield_phy('zfcup_i',ZFCUP_i,klev+1)
    920       endif
     903      ENDIF
    921904! --------- output RECMWFL
    922905!  ZEMTD        (KPROMA,KLEV+1)  ; TOTAL DOWNWARD LONGWAVE EMISSIVITY
     
    969952         ZFLDNC0(i,k+1)= ZFLCCDWN_i(i,k+1)
    970953         ZFLUPC0(i,k+1)= ZFLCCUP_i(i,k+1)
    971          IF(ok_volcan) THEN
     954         IF (ok_volcan) THEN
    972955            ZSWADAERO(i,k+1)=ZSWADAERO(i,k+1)*fract(i) !--NL
    973956         ENDIF
     
    1009992! On renseigne les champs LMDz, pour avoir la meme chose qu'en sortie de
    1010993! LW_LMDAR4 et SW_LMDAR4
     994
     995      !--fraction of diffuse radiation in surface SW downward radiation
     996      DO i = 1, kdlon
     997       IF (fract(i).GT.0.0) THEN
     998         zdir=SUM(PSFSWDIR(i,:))
     999         zdif=SUM(PSFSWDIF(i,:))
     1000         zsolswfdiff(i) = zdif/(zdir+zdif)
     1001       ELSE  !--night
     1002         zsolswfdiff(i) = 1.0
     1003       ENDIF
     1004      ENDDO
     1005!
    10111006      DO i = 1, kdlon
    10121007         zsolsw(i)    = ZSWFT(i,1)
     
    10261021         ztoplw0(i)   = ZLWFT0_i(i,klev+1)*(-1)
    10271022!         
    1028            IF (fract(i) == 0.) THEN
     1023         IF (fract(i) == 0.) THEN
    10291024!!!!! A REVOIR MPL (20090630) ca n a pas de sens quand fract=0
    10301025! pas plus que dans le sw_AR4
     
    10471042! ZLWFT(klon,k),ZSWFT
    10481043
    1049       do k=1,kflev
    1050          do i=1,kdlon
     1044      DO k=1,kflev
     1045         DO i=1,kdlon
    10511046           zheat(i,k)=(ZSWFT(i,k+1)-ZSWFT(i,k))*RDAY*RG/RCPD/PDP(i,k)
    10521047           zheat0(i,k)=(ZSWFT0_i(i,k+1)-ZSWFT0_i(i,k))*RDAY*RG/RCPD/PDP(i,k)
    10531048           zcool(i,k)=(ZLWFT(i,k)-ZLWFT(i,k+1))*RDAY*RG/RCPD/PDP(i,k)
    10541049           zcool0(i,k)=(ZLWFT0_i(i,k)-ZLWFT0_i(i,k+1))*RDAY*RG/RCPD/PDP(i,k)
    1055            IF(ok_volcan) THEN
     1050           IF (ok_volcan) THEN
    10561051              zheat_volc(i,k)=(ZSWADAERO(i,k+1)-ZSWADAERO(i,k))*RG/RCPD/PDP(i,k) !NL
    10571052              zcool_volc(i,k)=(ZLWADAERO(i,k)-ZLWADAERO(i,k+1))*RG/RCPD/PDP(i,k) !NL
     
    10601055!          ZFLUCUP_i(i,k)=ZFLUC_i(i,1,k)
    10611056!          ZFLUCDWN_i(i,k)=ZFLUC_i(i,2,k)         
    1062          enddo
    1063       enddo
     1057         ENDDO
     1058      ENDDO
    10641059#else
    10651060    abort_message="You should compile with -rrtm if running with iflag_rrtm=1"
     
    10731068      toplw(iof+i) = ztoplw(i)
    10741069      solsw(iof+i) = zsolsw(i)
     1070      solswfdiff(iof+i) = zsolswfdiff(i)
    10751071      sollw(iof+i) = zsollw(i)
    10761072      sollwdown(iof+i) = zsollwdown(i)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/readaerosol_optic.F90

    r2953 r3798  
    11! $Id$
    22!
    3 SUBROUTINE readaerosol_optic(debut, new_aod, flag_aerosol, itap, rjourvrai, &
     3SUBROUTINE readaerosol_optic(debut, flag_aerosol, itap, rjourvrai, &
    44     pdtphys, pplay, paprs, t_seri, rhcl, presnivs, &
    55     mass_solu_aero, mass_solu_aero_pi, &
     
    2222!****************************************************************************************
    2323  LOGICAL, INTENT(IN)                      :: debut
    24   LOGICAL, INTENT(IN)                      :: new_aod
    2524  INTEGER, INTENT(IN)                      :: flag_aerosol
    2625  INTEGER, INTENT(IN)                      :: itap
     
    189188  END DO
    190189
    191   IF (new_aod) THEN
    192 
    193190! RAF delete??     fractnat_allaer(:,:) = 0.
    194191! RAF fractnat_allaer -> m_allaer_pi
     
    206203          flag_aerosol, pplay, t_seri,   &
    207204          tausum_aero, tau3d_aero, presnivs)
    208   ELSE
    209 
    210      CALL aeropt(pplay, paprs, t_seri, sulfate, rhcl, &
    211           tau_aero(:,:,id_ASSO4M_phy,:), piz_aero(:,:,id_ASSO4M_phy,:), cg_aero(:,:,id_ASSO4M_phy,:), aerindex)
    212      
    213   END IF
    214205
    215206! Diagnostics calculation for CMIP5 protocol
  • LMDZ6/branches/Ocean_skin/libf/phylmd/rrtm/lwu.F90

    r2027 r3798  
    7474!USE YOERDI   , ONLY : RCH4     ,RN2O     ,RCFC11   ,RCFC12
    7575USE YOERDU   , ONLY : R10E     ,REPSCO   ,REPSCQ
     76#ifdef REPROBUS
     77USE chem_rep, ONLY: rch42d, rn2o2d, rcfc112d, rcfc122d, ok_rtime2d
     78USE infotrac_phy, ONLY : type_trac
     79#endif
    7680
    7781
     
    316320      PABCU(JL,17,IC)=PABCU(JL,17,ICP1)+ ZUAER(JL,4)    *ZDUC(JL,IC)*ZDIFF
    317321      PABCU(JL,18,IC)=PABCU(JL,18,ICP1)+ ZUAER(JL,5)    *ZDUC(JL,IC)*ZDIFF
     322#ifdef REPROBUS
     323        IF (type_trac=='repr'.and. ok_rtime2d) THEN
     324!- CH4
     325      PABCU(JL,19,IC)=PABCU(JL,19,ICP1)&
     326       & + ZABLY(JL,2,IC)*RCH42D(JL, IC)/PCCO2*ZPHM6(JL)*ZDIFF
     327      PABCU(JL,20,IC)=PABCU(JL,20,ICP1)&
     328       & + ZABLY(JL,3,IC)*RCH42D(JL, IC)/PCCO2*ZPSM6(JL)*ZDIFF
     329!- N2O
     330      PABCU(JL,21,IC)=PABCU(JL,21,ICP1)&
     331       & + ZABLY(JL,2,IC)*RN2O2D(JL, IC)/PCCO2*ZPHN6(JL)*ZDIFF
     332      PABCU(JL,22,IC)=PABCU(JL,22,ICP1)&
     333       & + ZABLY(JL,3,IC)*RN2O2D(JL, IC)/PCCO2*ZPSN6(JL)*ZDIFF
     334!- CFC11
     335      PABCU(JL,23,IC)=PABCU(JL,23,ICP1)&
     336       & + ZABLY(JL,2,IC)*RCFC112D(JL, IC)/PCCO2        *ZDIFF
     337!- CFC12
     338      PABCU(JL,24,IC)=PABCU(JL,24,ICP1)&
     339       & + ZABLY(JL,2,IC)*RCFC122D(JL, IC)/PCCO2        *ZDIFF
     340
     341         ELSE
     342#endif
    318343!- CH4
    319344      PABCU(JL,19,IC)=PABCU(JL,19,ICP1)&
     
    332357      PABCU(JL,24,IC)=PABCU(JL,24,ICP1)&
    333358       & + ZABLY(JL,2,IC)*RCFC12/PCCO2        *ZDIFF 
     359#ifdef REPROBUS
     360        END IF
     361#endif
    334362    ENDDO
    335363  ENDDO
  • LMDZ6/branches/Ocean_skin/libf/phylmd/rrtm/readaerosol_optic_rrtm.F90

    r3605 r3798  
    22!
    33SUBROUTINE readaerosol_optic_rrtm(debut, aerosol_couple, ok_alw, ok_volcan, &
    4      new_aod, flag_aerosol, flag_bc_internal_mixture, itap, rjourvrai, &
     4     flag_aerosol, flag_bc_internal_mixture, itap, rjourvrai, &
    55     pdtphys, pplay, paprs, t_seri, rhcl, presnivs, &
    66     tr_seri, mass_solu_aero, mass_solu_aero_pi, &
     
    3333  LOGICAL, INTENT(IN)                      :: ok_alw
    3434  LOGICAL, INTENT(IN)                      :: ok_volcan
    35   LOGICAL, INTENT(IN)                      :: new_aod
    3635  INTEGER, INTENT(IN)                      :: flag_aerosol
    3736  LOGICAL, INTENT(IN)                      :: flag_bc_internal_mixture
  • LMDZ6/branches/Ocean_skin/libf/phylmd/surf_landice_mod.F90

    r3102 r3798  
    2525
    2626    USE dimphy
    27     USE surface_data,     ONLY : type_ocean, calice, calsno, ok_snow
     27    USE surface_data,     ONLY : type_ocean, calice, calsno, landice_opt, n_dtis
    2828    USE fonte_neige_mod,  ONLY : fonte_neige, run_off_lic
    2929    USE cpl_mod,          ONLY : cpl_send_landice_fields
     
    3636    USE surf_sisvat_mod,  ONLY : surf_sisvat
    3737#endif
     38
     39#ifdef CPP_INLANDSIS
     40    USE surf_inlandsis_mod,  ONLY : surf_inlandsis
     41#endif
     42
    3843    USE indice_sol_mod
    3944
     
    8691!    REAL, DIMENSION(klon), INTENT(OUT)            :: alb1  ! new albedo in visible SW interval
    8792!    REAL, DIMENSION(klon), INTENT(OUT)            :: alb2  ! new albedo in near IR interval
    88     REAL, DIMENSION(6), INTENT(IN)              ::SFRWL
    89     REAL, DIMENSION(klon,nsw), INTENT(OUT)        ::alb_dir,alb_dif
     93    REAL, DIMENSION(6), INTENT(IN)                :: SFRWL
     94    REAL, DIMENSION(klon,nsw), INTENT(OUT)        :: alb_dir,alb_dif
    9095!albedo SB <<<
    9196    REAL, DIMENSION(klon), INTENT(OUT)            :: evap, fluxsens, fluxlat
     
    108113    REAL, DIMENSION(klon)    :: zfra, alb_neig
    109114    REAL, DIMENSION(klon)    :: radsol
    110     REAL, DIMENSION(klon)    :: u0, v0, u1_lay, v1_lay
    111     INTEGER                  :: i,j
     115    REAL, DIMENSION(klon)    :: u0, v0, u1_lay, v1_lay, ustar
     116    INTEGER                  :: i,j,nt
    112117
    113118    REAL, DIMENSION(klon)    :: emis_new                  !Emissivity
    114119    REAL, DIMENSION(klon)    :: swdown,lwdown
    115120    REAL, DIMENSION(klon)    :: precip_snow_adv, snow_adv !Snow Drift precip./advection
    116     REAL, DIMENSION(klon)    :: bl_height, wind_velo      !height boundary layer, wind spd
     121    REAL, DIMENSION(klon)    :: zsl_height, wind_velo      !surface layer height, wind spd
    117122    REAL, DIMENSION(klon)    :: dens_air,  snow_cont_air  !air density; snow content air
    118123    REAL, DIMENSION(klon)    :: alb_soil                  !albedo of underlying ice
    119124    REAL, DIMENSION(klon)    :: pexner                    !Exner potential
    120125    REAL                     :: pref
    121     REAL, DIMENSION(klon,nsoilmx) :: tsoil0 !modfi
     126    REAL, DIMENSION(klon,nsoilmx) :: tsoil0               !modif
     127    REAL                          :: dtis                ! subtimestep
     128    LOGICAL                       :: debut_is, lafin_is  ! debut and lafin for inlandsis
    122129
    123130    CHARACTER (len = 20)                      :: modname = 'surf_landice'
     
    139146  LOGICAL, SAVE :: firstcall = .TRUE.
    140147  !$OMP THREADPRIVATE(firstcall)
    141 !FC
    142 
    143 
     148
     149
     150!FC firtscall initializations
     151!******************************************************************************************
    144152  IF (firstcall) THEN
    145153  alb_vis_sno_lic=0.77
     
    149157  CALL getin_p('alb_nir_sno_lic',alb_nir_sno_lic)
    150158           PRINT*, 'alb_nir_sno_lic',alb_nir_sno_lic
     159 
     160!  z0m=1.e-3
     161!  z0h = z0m
    151162  firstcall=.false.
    152163  ENDIF
    153 !
     164!******************************************************************************************
     165
    154166! Initialize output variables
    155167    alb3(:) = 999999.
     
    166178
    167179!****************************************************************************************
    168 !   ok_snow = TRUE  : prepare and call SISVAT snow model
    169 !   ok_snow = FALSE : soil_model, calcul_flux, fonte_neige, ...
    170 !
    171 !****************************************************************************************
    172     IF (ok_snow) THEN
     180!  landice_opt = 0 : soil_model, calcul_flux, fonte_neige, ... 
     181!  landice_opt = 1  : prepare and call SISVAT snow model
     182!  landice_opt = 2  : prepare and call INLANDSIS snow model
     183!****************************************************************************************
     184
     185
     186    IF (landice_opt .EQ. 1) THEN
     187   
     188!****************************************************************************************
     189! CALL to SISVAT interface
     190!****************************************************************************************
     191
    173192#ifdef CPP_SISVAT
    174193       ! Prepare for calling SISVAT
     
    192211          pexner(i)        = (p1lay(i)/pref)**(RD/RCPD)
    193212          dens_air(i)      = p1lay(i)/RD/temp_air(i)  ! dry air density
    194           bl_height(i)     = pphi1(i)/RG             
     213          zsl_height(i)     = pphi1(i)/RG             
    195214       END DO
    196215
    197 !****************************************************************************************
    198 ! CALL to SISVAT interface
    199 !
    200 !****************************************************************************************
     216
    201217       ! config: compute everything with SV but temperatures afterwards with soil/calculfluxs
    202218       DO i = 1, knon
     
    209225            rmu0, swdown, lwdown, pexner, ps, p1lay, &
    210226            precip_rain, precip_snow, precip_snow_adv, snow_adv, &
    211             bl_height, wind_velo, temp_air, dens_air, spechum, tsurf, &
     227            zsl_height, wind_velo, temp_air, dens_air, spechum, tsurf, &
    212228            rugoro, snow_cont_air, alb_soil, slope, cloudf, &
    213229            radsol, qsol, tsoil0, snow, snowhgt, qsnow, to_ice,sissnow, agesno, &
     
    232248            flux_u1, flux_v1)
    233249#else
    234        abort_message='Pb de coherence: ok_snow = .true. mais CPP_SISVAT = .false.'
     250       abort_message='Pb de coherence: landice_opt = 1 mais CPP_SISVAT = .false.'
    235251       CALL abort_physic(modname,abort_message,1)
    236252#endif
    237     ELSE ! ok_snow=FALSE
     253
     254!****************************************************************************************
     255! CALL to INLANDSIS interface
     256!****************************************************************************************
     257
     258    ELSE IF (landice_opt .EQ. 2) THEN
     259#ifdef CPP_INLANDSIS
     260
     261        debut_is=debut
     262        lafin_is=.false.
     263        ! Suppose zero surface speed
     264        u0(:)            = 0.0
     265        v0(:)            = 0.0
     266
     267
     268        CALL calcul_flux_wind(knon, dtime, &
     269         u0, v0, u1, v1, gustiness, cdragm, &
     270         AcoefU, AcoefV, BcoefU, BcoefV, &
     271         p1lay, temp_air, &
     272         flux_u1, flux_v1)
     273
     274       
     275       ! Set constants and compute some input for SISVAT
     276       ! = 1000 hPa
     277       ! and calculate incoming flux for SW and LW interval: swdown, lwdown
     278       swdown(:)        = 0.0
     279       lwdown(:)        = 0.0
     280       snow_adv(:)      = 0.  ! no snow blown in for now
     281       snow_cont_air(:) = 0.       
     282       alb_soil(:)      = 0.4 ! before albedo(:) but here it is the ice albedo that we have to set
     283       ustar(:)         = 0.
     284       pref             = 100000.       
     285       DO i = 1, knon
     286          swdown(i)        = swnet(i)/(1-albedo(i))
     287          lwdown(i)        = lwdownm(i)
     288          wind_velo(i)     = u1(i)**2 + v1(i)**2
     289          wind_velo(i)     = wind_velo(i)**0.5
     290          pexner(i)        = (p1lay(i)/pref)**(RD/RCPD)
     291          dens_air(i)      = p1lay(i)/RD/temp_air(i)  ! dry air density
     292          zsl_height(i)    = pphi1(i)/RG     
     293          tsoil0(i,:)      = tsoil(i,:) 
     294          ustar(i)= (cdragm(i)*(wind_velo(i)**2))**0.5   
     295       END DO
     296       
     297
     298       ! Subtimestepping
     299       
     300        dtis=dtime/n_dtis
     301
     302        DO nt=1,n_dtis
     303
     304          IF (lafin .and. nt.eq.n_dtis) THEN
     305            lafin_is=.true.
     306          END IF
     307
     308        !PRINT*,'RENTRE DANS INLANDSIS','itime',itime,'dtime',dtime,'dtis',dtis
     309        CALL surf_inlandsis(knon, rlon, rlat, knindex, itime, dtis, debut_is, lafin_is, &
     310            rmu0, swdown, lwdown, albedo, pexner, ps, p1lay, &
     311            precip_rain, precip_snow, precip_snow_adv, snow_adv, &
     312            zsl_height, wind_velo, ustar, temp_air, dens_air, spechum, tsurf, &
     313            rugoro, snow_cont_air, alb_soil, slope, cloudf, &
     314            radsol, qsol, tsoil0, snow, zfra, snowhgt, qsnow, to_ice,sissnow, agesno, &
     315            AcoefH, AcoefQ, BcoefH, BcoefQ, cdragm, cdragh, &
     316            run_off_lic, evap, fluxsens, fluxlat, dflux_s, dflux_l, &       
     317            tsurf_new, alb1, alb2, alb3, &
     318            emis_new, z0m, z0h, qsurf)     
     319
     320         debut_is=.false.
     321
     322        END DO
     323
     324
     325#else
     326       abort_message='Pb de coherence: landice_opt = 2 mais CPP_INLANDSIS = .false.'
     327       CALL abort_physic(modname,abort_message,1)
     328#endif
     329
     330
     331
     332    ELSE
    238333
    239334!****************************************************************************************
     
    241336!
    242337!****************************************************************************************
     338
     339    ! EV: use calbeta
     340    CALL calbeta(dtime, is_lic, knon, snow, qsol, beta, cal, dif_grnd)
     341
     342
     343    ! use soil model and recalculate properly cal
    243344    IF (soil_model) THEN
    244345       CALL soil(dtime, is_lic, knon, snow, tsurf, tsoil, soilcap, soilflux)
     
    255356!
    256357!****************************************************************************************
    257     beta(:) = 1.0
    258     dif_grnd(:) = 0.0
     358!    beta(:) = 1.0
     359!    dif_grnd(:) = 0.0
    259360
    260361! Suppose zero surface speed
     
    281382!   
    282383!****************************************************************************************
    283     CALL fonte_neige( knon, is_lic, knindex, dtime, &
     384    CALL fonte_neige(knon, is_lic, knindex, dtime, &
    284385         tsurf, precip_rain, precip_snow, &
    285386         snow, qsol, tsurf_new, evap)
     
    291392!****************************************************************************************
    292393    CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) 
     394
    293395    WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.
    294396    zfra(1:knon) = MAX(0.0,MIN(1.0,snow(1:knon)/(snow(1:knon)+10.0)))
     
    303405!IM: KstaTER0.77 & LMD_ARMIP6   
    304406
    305 ! Attantion: alb1 and alb2 are the same!
     407! Attantion: alb1 and alb2 are not the same!
    306408    alb1(1:knon)  = alb_vis_sno_lic
    307409    alb2(1:knon)  = alb_nir_sno_lic
     
    316418    z0m = SQRT(z0m**2+rugoro**2)
    317419
    318     END IF ! ok_snow
     420
     421
     422
     423   
     424
     425    END IF ! landice_opt
    319426
    320427
     
    333440 
    334441!****************************************************************************************
    335        snow_o=0.
    336        zfra_o = 0.
    337        DO j = 1, knon
    338            i = knindex(j)
    339            snow_o(i) = snow(j)
    340            zfra_o(i) = zfra(j)
    341        ENDDO
    342 
     442! Etienne: comment these lines because of duplication just below
     443!       snow_o=0.
     444!       zfra_o = 0.
     445!       DO j = 1, knon
     446!           i = knindex(j)
     447!           snow_o(i) = snow(j)
     448!           zfra_o(i) = zfra(j)
     449!       ENDDO
     450!
    343451!****************************************************************************************
    344452       snow_o=0.
  • LMDZ6/branches/Ocean_skin/libf/phylmd/surface_data.F90

    r3327 r3798  
    1515  !$OMP THREADPRIVATE(type_veget)
    1616
    17   LOGICAL, SAVE          :: ok_snow       ! true for coupling to snow model SISVAT
    18   !$OMP THREADPRIVATE(ok_snow)
    19 
    2017  CHARACTER(len=6), SAVE :: type_ocean    ! force/slab/couple
    2118  !$OMP THREADPRIVATE(type_ocean)
     
    3027  !$OMP THREADPRIVATE(t_coupl)
    3128
     29  ! FOR INLANDSIS:
     30  !===============
     31
     32   INTEGER, SAVE          :: landice_opt       ! 1 for coupling with SISVAT, 2 for coupling with INLANDSIS
     33  !$OMP THREADPRIVATE(landice_opt)
     34
     35   INTEGER, SAVE          :: iflag_tsurf_inlandsis ! 0 SISVAT method, 1 LMDZ method
     36  !$OMP THREADPRIVATE(iflag_tsurf_inlandsis)
     37
     38   INTEGER, SAVE          :: iflag_albzenith ! dependency of albedo to zenith angle
     39  !$OMP THREADPRIVATE(iflag_albzenith) 
     40
     41   INTEGER, SAVE          :: n_dtis           ! number of subtimesteps for INLANDSIS
     42  !$OMP THREADPRIVATE(n_dtis)
     43
     44  ! with or without snow module/ blowing snow, ascii outfile
     45   LOGICAL, SAVE           :: SnoMod,BloMod,ok_outfor
     46  !$OMP THREADPRIVATE(SnoMod,BloMod,ok_outfor)   
     47
    3248END MODULE surface_data
  • LMDZ6/branches/Ocean_skin/libf/phylmd/tracco2i_mod.F90

    r3605 r3798  
    1414CONTAINS
    1515
     16  SUBROUTINE tracco2i_init()
     17    ! This subroutine calls carbon_cycle_init needed to be done before first call to phys_output_write in physiq.
     18    USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl
     19
     20    ! Initialize carbon_cycle_mod
     21    IF (carbon_cycle_cpl) THEN
     22       CALL carbon_cycle_init()
     23    ENDIF
     24
     25  END SUBROUTINE tracco2i_init
     26
    1627  SUBROUTINE tracco2i(pdtphys, debutphy, &
    1728       xlat, xlon, pphis, pphi, &
     
    2132    USE infotrac_phy
    2233    USE geometry_mod, ONLY: cell_area
    23     USE carbon_cycle_mod, ONLY: carbon_cycle_init
    2434    USE carbon_cycle_mod, ONLY: id_CO2, nbcf_in, fields_in, cfname_in
    2535    USE carbon_cycle_mod, ONLY: fco2_ocn_day, fco2_ff, fco2_bb, fco2_land, fco2_ocean
     
    7989!--convert 280 ppm into kg CO2 / kg air
    8090    IF (debutphy) THEN
    81 
    82 ! Initialisation de module carbon_cycle_mod
    83       IF (carbon_cycle_cpl) THEN
    84         CALL carbon_cycle_init()
    85       ENDIF
    8691
    8792! Initialisation de tr_seri(id_CO2) si pas initialise
     
    312317!$OMP END MASTER
    313318
     319    ! Allocation needed for all proc otherwise scatter might complain
     320    IF (.NOT.ALLOCATED(flx_co2ff_glo)) ALLOCATE(flx_co2ff_glo(0,0))
     321    IF (.NOT.ALLOCATED(flx_co2bb_glo)) ALLOCATE(flx_co2bb_glo(0,0))
     322
    314323!--scatter on all proc
    315324    CALL scatter(flx_co2ff_glo,flx_co2ff)
    316325    CALL scatter(flx_co2bb_glo,flx_co2bb)
    317326
    318 !$OMP MASTER
    319     IF (is_mpi_root) THEN
    320        DEALLOCATE(flx_co2ff_glo)
    321        DEALLOCATE(flx_co2bb_glo)
    322     ENDIF
    323 !$OMP END MASTER
     327   IF (ALLOCATED(flx_co2ff_glo)) DEALLOCATE(flx_co2ff_glo)
     328   IF (ALLOCATED(flx_co2bb_glo)) DEALLOCATE(flx_co2bb_glo)
    324329
    325330  ENDIF !--end debuthy
  • LMDZ6/branches/Ocean_skin/libf/phylmd/tracreprobus_mod.F90

    r3125 r3798  
    1616    USE CHEM_REP, ONLY : pdt_rep, &  ! pas de temps reprobus
    1717         daynum, iter, &             ! jourjulien, iteration chimie
    18          pdel
     18         pdel,&
     19         d_q_rep,d_ql_rep,d_qi_rep
    1920#endif
    2021    IMPLICIT NONE
     
    4647! Local variables
    4748!----------------
    48     INTEGER :: it, k
     49    INTEGER :: it, k, niter
    4950
    5051#ifdef REPROBUS
    5152    !   -- CHIMIE REPROBUS --
    52     pdt_rep=pdtphys/2.
     53!    pdt_rep=pdtphys/2.
     54    niter=pdtphys/pdt_rep
     55    write(*,*)'nb d appel de REPROBUS',niter
    5356   
    5457    DO k = 1, klev
     
    6063       tr_seri(:,:,11)=tr_seri(:,:,8)
    6164    END IF
     65
     66    d_q_rep(:,:)  =0.
     67    d_ql_rep(:,:) =0.
     68    d_qi_rep(:,:) =0.
    6269   
    63     DO  iter = 1,2
     70    DO  iter = 1,niter
    6471       daynum = FLOAT(julien) + gmtime + (iter-1)*pdt_rep/86400.
    6572       
    66        DO it=1, nbtr
     73!       DO it=1, nbtr
    6774!     WRITE(lunout,*)it,' ',minval(tr_seri(:,:,it)),maxval(tr_seri(:,:,it))
    6875! seulement pour les especes chimiques (pas l'age de l'air)
     
    7077! correction: a 1.e-30 quand =0 ou negatif et
    7178! call abort si >ou= 1.e10
    72           WRITE(*,*)it,'nqtot',nqtot,'nbtr',nbtr
    73           IF (it < nqtot) THEN
    74              WRITE(*,*)'iciav',it,nqtot
    75 #ifdef REPROBUS
    76              CALL minmaxqfi_chimie(it,tr_seri(1,1,it),0.,1.e10,'avant chimie ')
    77 #endif
    78              WRITE(*,*)iter,'avpres'
    79           ENDIF
    80        ENDDO
     79!          WRITE(*,*)it,'nqtot',nqtot,'nbtr',nbtr
     80!          IF (it < nqtot) THEN
     81!             WRITE(*,*)'iciav',it,nqtot
     82!#ifdef REPROBUS
     83!             CALL minmaxqfi_chimie(it,tr_seri(1,1,it),0.,1.e10,'avant chimie ')
     84!#endif
     85!             WRITE(*,*)iter,'avpres'
     86!          ENDIF
     87!       ENDDO
    8188       
    8289#ifdef REPROBUS
     
    95102       !                 et transporte par CHEM_REP
    96103
    97        DO it=1, nbtr
     104!       DO it=1, nbtr
    98105!     WRITE(lunout,*)it,' ',minval(tr_seri(:,:,it)),maxval(tr_seri(:,:,it))
    99106! seulement pour les especes chimiques (pas l'age de l'air)
     
    101108! correction: a 1.e-30 quand =0 ou negatif et
    102109! call abort si >ou= 1.e10
    103           WRITE(*,*)it,'nqtot',nqtot,'nbtr',nbtr
    104           IF (it < nqtot) THEN
    105              WRITE(*,*)'iciap',it,nqtot
    106              CALL minmaxqfi_chimie(it,tr_seri(1,1,it),0.,1.e10,'apres chemmain')
    107              WRITE(*,*)iter,'appres'
    108           ENDIF
    109        ENDDO
     110!          WRITE(*,*)it,'nqtot',nqtot,'nbtr',nbtr
     111!          IF (it < nqtot) THEN
     112!             WRITE(*,*)'iciap',it,nqtot
     113!             CALL minmaxqfi_chimie(it,tr_seri(1,1,it),0.,1.e10,'apres chemmain')
     114!             WRITE(*,*)iter,'appres'
     115!          ENDIF
     116!       ENDDO
    110117
    111118#endif       
  • LMDZ6/branches/Ocean_skin/libf/phylmd/tropopause_m.F90

    r3141 r3798  
    1717  USE geometry_mod, ONLY: latitude_deg, longitude_deg
    1818  USE vertical_layers_mod, ONLY: aps, bps, preff
     19#ifdef REPROBUS
     20  USE chem_rep, ONLY: itroprep
     21#endif
    1922
    2023!-------------------------------------------------------------------------------
     
    108111      DO kt=1,klev-1; IF(pplay(i,kt+1)>dyn_tropopause(i)) EXIT; END DO; kp=kt
    109112    END IF
     113#ifdef REPROBUS
     114    itroprep(i)=MAX(kt,kp)
     115#endif
    110116    !--- LAST TROPOSPHERIC LAYER INDEX NEEDED
    111117    IF(PRESENT(itrop)) itrop(i)=MAX(kt,kp)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/wake.F90

    r3605 r3798  
    317317
    318318!!  DATA wapecut, sigmad, hwmin/5., .02, 10./
    319   DATA wapecut, sigmad, hwmin/1., .02, 10./
     319!!  DATA wapecut, sigmad, hwmin/1., .02, 10./
     320  DATA sigmad, hwmin/.02, 10./
    320321!!  DATA wdensmin/1.e-12/
    321322  DATA wdensmin/1.e-14/
     
    323324  DATA sigmaw_max/0.4/
    324325  DATA dens_rate/0.1/
    325   DATA rzero /5000./
    326326  ! cc
    327327  ! Longueur de maille (en m)
     
    360360  crep_sol = 1.0
    361361
    362   aa0 = 3.14*rzero*rzero
    363 
    364   tau_cv = 4000.
     362  ! Get wapecut from parameter file
     363  wapecut = 1.
     364  CALL getin_p('wapecut', wapecut)
    365365
    366366  ! cc nrlmd Lecture du fichier wake_param.data
     
    379379  CALL getin_p('wdens_ref_l',wdens_ref(2))    !wake number per unit area ; land
    380380!>jyg
     381!
     382!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     383!!!!!!!!!  Population dynamics parameters    !!!!!!!!!!!!!!!!!!!!!!!!!!!!
     384!------------------------------------------------------------------------
     385
    381386  iflag_wk_pop_dyn = 0
    382387  CALL getin_p('iflag_wk_pop_dyn',iflag_wk_pop_dyn) ! switch between wdens prescribed
     
    386391                                            ! 1: act(:)=1.
    387392                                            ! 2: act(:)=f(Wape)
     393
     394  rzero = 5000.
     395  CALL getin_p('rzero_wk', rzero)
     396  aa0 = 3.14*rzero*rzero
     397!
     398  tau_cv = 4000.
     399  CALL getin_p('tau_cv', tau_cv)
     400
     401!------------------------------------------------------------------------
     402
    388403  coefgw=4.
    389404  CALL getin_p('coefgw',coefgw)
  • LMDZ6/branches/Ocean_skin/libf/phylmd/yamada4.F90

    r3605 r3798  
    66  USE dimphy
    77  USE ioipsl_getin_p_mod, ONLY : getin_p
    8 
     8  USE phys_local_var_mod, only: tke_dissip
     9 
    910  IMPLICIT NONE
    1011  include "iniprint.h"
     
    5657  !             iflag_pbl=11 -> the model starts with NP from start files created by ce0l
    5758  !                          -> the model can run with longer time-steps.
    58   !             2016/11/30 (EV etienne.vignon@univ-grenoble-alpes.fr)
     59  !             2016/11/30 (EV etienne.vignon@lmd.ipsl.fr)
    5960  !               On met tke (=q2/2) en entr??e plut??t que q2
    6061  !               On corrige l'update de la tke
    61   !
     62  !             2020/10/01 (EV)
     63  !               On ajoute la dissipation de la TKE en diagnostique de sortie
     64  !                 
    6265  ! Inpout/Output :
    6366  !==============
     
    121124  REAL,SAVE :: viscom,viscoh
    122125  !$OMP THREADPRIVATE( hboville,viscom,viscoh)
    123   INTEGER ig, k
     126  INTEGER ig, jg, k
    124127  REAL ri, zrif, zalpha, zsm, zsn
    125128  REAL rif(klon, klev+1), sm(klon, klev+1), alpha(klon, klev)
     
    186189       viscom=1.46E-5
    187190       viscoh=2.06E-5
     191       !lmixmin=1.0E-3
    188192       lmixmin=0.
    189193       yamada4_num=5
     
    416420  ELSE IF (iflag_pbl>=10) THEN
    417421
     422    shear(:,:)=0.
     423    buoy(:,:)=0.
     424    dissip(:,:)=0.
     425    km(:,:)=0.
     426       
    418427    IF (yamada4_num>=1) THEN
    419428 
     
    424433      shear(ig,k)=km(ig, k)*m2(ig, k)
    425434      buoy(ig,k)=km(ig, k)*m2(ig, k)*(-1.*rif(ig,k))
    426       dissip(ig,k)=((sqrt(q2(ig,k)))**3)/(b1*l(ig,k))
     435!      dissip(ig,k)=min(max(((sqrt(q2(ig,k)))**3)/(b1*l(ig,k)),1.E-12),1.E4)
     436      dissip(ig,k)=((sqrt(q2(ig,k)))**3)/(b1*l(ig,k))
    427437     ENDDO
    428438    ENDDO
    429 
     439   
    430440    IF (yamada4_num==1) THEN ! Schema du MAR tel quel
    431441       DO k = 2, klev - 1
     
    478488        ENDDO
    479489       ENDDO
     490       
     491      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     492      !! Attention, yamada4_num=5 est inexacte car néglige les termes de flottabilité
     493      !! en conditions instables
     494      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    480495    ELSE IF (yamada4_num==5) THEN ! version modifiee avec integration exacte pour la dissipation
    481496       DO k = 2, klev - 1
     
    507522       DO k = 2, klev - 1
    508523         DO ig=1,ngrid
     524         !tkeprov=q2(ig,k)/ydeux
     525         !tkeprov=tkeprov+max(buoy(ig,k)+shear(ig,k),0.)*dt
     526         !disseff=dissip(ig,k)-min(0.,buoy(ig,k)+shear(ig,k))
     527         !tkeexp=exp(-dt*disseff/tkeprov)
     528         !tkeprov= tkeprov*tkeexp
     529         !q2(ig,k)=tkeprov*ydeux
     530         ! En cas stable, on traite la flotabilite comme la
     531         ! dissipation, en supposant que dissipeff/TKE est constant.
     532         ! Puis on prend la solution exacte
     533         !
     534         ! With drag and dissipation from high vegetation (EV & FC, 05/10/2020)
     535         winds(ig,k)=sqrt(u(ig,k)**2+v(ig,k)**2)
    509536         tkeprov=q2(ig,k)/ydeux
    510          tkeprov=tkeprov+max(buoy(ig,k)+shear(ig,k),0.)*dt
    511          disseff=dissip(ig,k)-min(0.,buoy(ig,k)+shear(ig,k))
     537         tkeprov=tkeprov+max(buoy(ig,k)+shear(ig,k)+drgpro(ig,k)*(winds(ig,k))**3,0.)*dt
     538         disseff=dissip(ig,k)-min(0.,buoy(ig,k)+shear(ig,k)+drgpro(ig,k)*(winds(ig,k))**3) + drgpro(ig,k)*tkeprov
    512539         tkeexp=exp(-dt*disseff/tkeprov)
    513540         tkeprov= tkeprov*tkeexp
    514541         q2(ig,k)=tkeprov*ydeux
    515          ! En cas stable, on traite la flotabilite comme la
    516          ! dissipation, en supposant que buoy/q2^3 est constant.
    517          ! Puis on prend la solution exacte
     542         
    518543        ENDDO
    519544       ENDDO
     
    725750
    726751!============================================================================
     752! Diagnostique de la dissipation
     753!============================================================================
     754
     755! Diagnostics
     756 tke_dissip(1:ngrid,:,nsrf)=0.
     757! DO k=2,klev
     758!    DO ig=1,ngrid
     759!       jg=ni(ig)
     760!       tke_dissip(jg,k,nsrf)=dissip(ig,k)
     761!    ENDDO
     762! ENDDO
     763 
     764!=============================================================================
    727765
    728766  RETURN
     
    10171055!=====================================================================
    10181056
    1019 
     1057  l1(1:ngrid,:)=0.
    10201058  IF (iflag_pbl==8 .OR. iflag_pbl==10) THEN
    10211059
     
    11351173
    11361174
    1137  DO k=2,klev
     1175 DO k=1,klev+1
    11381176    DO ig=1,ngrid
    11391177       lmix(ig,k)=MAX(MAX(l1(ig,k), l2(ig,k)),lmixmin)
  • LMDZ6/branches/Ocean_skin/makegcm

    r3605 r3798  
    4242set cospv2=false
    4343set sisvat=false
     44set inlandsis=false
    4445
    4546set FC_LINUX=gfortran
     
    518519     case -sisvat
    519520        set sisvat="$2" ; shift ; shift ; goto top
     521     case -inlandsis
     522        set inlandsis="$2" ; shift ; shift ; goto top
     523
    520524
    521525     case -filtre
     
    621625endif
    622626
     627if ( "$inlandsis" == 'true' ) then
     628    set cppflags="$cppflags -DCPP_INLANDSIS"
     629endif
     630
     631
    623632if ( "$physique" == 'nophys' ) then
    624633   set phys="L_PHY= LIBPHY="
  • LMDZ6/branches/Ocean_skin/makelmdz

    r3605 r3798  
    2828cospv2=false
    2929sisvat=false
     30inlandsis=false
    3031rrtm=false
    3132rrtm=false
     
    122123[-cospv2 true/false]    : compile with/without cospv2 package (default: false)
    123124[-sisvat true/false]  : compile with/without sisvat package (default: false)
     125[-inlandsis true/false]  : compile with/without inlandsis package (default: false)
    124126[-rrtm true/false]    : compile with/without rrtm package (default: false)
    125127[-dust true/false]    : compile with/without the dust package from Boucher et al. (default: false)
     
    192194      "-sisvat")
    193195          sisvat="$2" ; shift ; shift ;;
    194      
     196
     197      "-inlandsis")
     198          inlandsis="$2" ; shift ; shift ;; 
     199
    195200      "-rrtm")
    196201          rrtm="$2" ; shift ; shift ;;
     
    518523   src_dirs="$src_dirs phy${physique}/sisvat"
    519524fi
     525
     526
     527if [[ "$inlandsis" == "true" ]]
     528then
     529   CPP_KEY="$CPP_KEY CPP_INLANDSIS"
     530   src_dirs="$src_dirs phy${physique}/inlandsis"
     531fi
     532
    520533
    521534if [[ "$rrtm" == "true" ]]
  • LMDZ6/branches/Ocean_skin/makelmdz_fcm

    r3673 r3798  
    2424veget=false
    2525sisvat=false
     26inlandsis=false
    2627rrtm=false
    2728dust=false
     
    4546
    4647LMDGCM=`/bin/pwd`
    47 LIBOGCM=$LMDGCM/libo
     48LIBOGCM=$WORK/build/LMDZ_ocean_skin
    4849LIBFGCM=$LMDGCM/libf
    4950DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
     
    99100[-cospv2 true/false]    : compile with/without cospv2 package (default: false)
    100101[-sisvat true/false]  : compile with/without sisvat package (default: false)
     102[-inlandsis true/false]  : compile with/without inlandsis package (default: false)
    101103[-rrtm true/false]    : compile with/without rrtm package (default: false)
    102104[-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
     
    151153      "-sisvat")
    152154          sisvat="$2" ; shift ; shift ;;
     155
     156      "-inlandsis")
     157    inlandsis="$2" ; shift ; shift ;;
    153158
    154159      "-rrtm")
     
    415420fi
    416421
     422if [[ "$inlandsis" == "true" ]]
     423then
     424   CPP_KEY="$CPP_KEY CPP_INLANDSIS"
     425   INLANDSIS_PATH="$LIBFGCM/%PHYS/inlandsis"
     426fi
     427
     428
    417429if [[ "$rrtm" == "true" ]]
    418430then
     
    681693echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
    682694echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
     695echo "%INLANDSIS     $INLANDSIS_PATH" >> $config_fcm
    683696echo "%COSP          $COSP_PATH"     >> $config_fcm
    684697echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
     
    703716./build_gcm ${fcm_path} -j $job $full
    704717
     718err=$?
     719# Check error message from fcm build
     720if [ $err != 0 ] ; then
     721  exit 1
     722fi
     723
    705724rm -rf tmp_src
    706725rm -rf config
Note: See TracChangeset for help on using the changeset viewer.