Changeset 3768


Ignore:
Timestamp:
Jul 21, 2020, 11:08:53 AM (4 years ago)
Author:
adurocher
Message:

Offload post-processing to XIOS

use expressions in .xml files to offload computations previously done in phys_output_write to XIOS

Location:
LMDZ6/branches/Optimisation_LMDZ
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Optimisation_LMDZ/DefLists/context_lmdz.xml

    r3655 r3768  
    33<context id="LMDZ">
    44<!--  <calendar type="D360" start_date="1980-01-01 00:00:00" /> -->
    5 
     5  <variable_definition src="./var_def_lmdz.xml"/>
    66  <!-- Define available variables -->
    77  <field_definition src="./field_def_lmdz.xml"/>
  • LMDZ6/branches/Optimisation_LMDZ/DefLists/context_lmdz_sans_cosp.xml

    r3474 r3768  
    22<context id="LMDZ">
    33<!--  <calendar type="D360" start_date="1980-01-01 00:00:00" /> -->
    4 
     4  <variable_definition src="./var_def_lmdz.xml"/>
    55  <!-- Define available variables -->
    66  <field_definition src="./field_def_lmdz.xml"/>
  • LMDZ6/branches/Optimisation_LMDZ/DefLists/field_def_lmdz.xml

    r3656 r3768  
    66<!--        <field id="Bp"   long_name="Hybrid coordinate: sigma part"    unit="-" />  -->
    77<!--        <field id="Alt"  long_name="Pseudo-altitude (for an 8km scale height)"    unit="km" />  -->
    8 <!--    </field_group>  -->
    9 
     8<!--    </field_group>  -->   
    109    <field_group id="remap_expr" level="_reset_" prec="_reset_" operation="_reset_" freq_op="_reset_" enabled="_reset_" default_value="_reset_">
    1110      <field_group id="remap_1ts" />
     
    3837        <field id="phis"    long_name="Surface geop.height"     unit="m2/s2" />
    3938        <field id="aire"    long_name="Grid area"               unit="m2"    />
    40         <field id="contfracATM"     long_name="% sfce ter+lic"  unit="-"   />
    41         <field id="contfracOR"      long_name="% sfce terre OR" unit="-" />
     39        <field id="contfracATM"     long_name="% sfce ter+lic"  unit="-"   > fract_ter + fract_lic </field>
     40        <field id="contfracOR"      long_name="% sfce terre OR" unit="-"   > fract_ter </field>
    4241        <field id="sza"     long_name="Solar zenithal angle "   unit="deg" />
    4342        <field id="flat"    long_name="Latent heat flux"        unit="W/m2" />
     
    4948        <field id="tasmax"  field_ref="t2m"  operation="maximum" />
    5049        <field id="tasmin"  field_ref="t2m"  operation="minimum" />
    51         <field id="t2m_min"    long_name="Temp 2m min"    unit="K" operation="minimum" />
    52         <field id="t2m_max"    long_name="Temp 2m max"    unit="K" operation="maximum" />
     50        <field id="t2m_min"  field_ref="t2m" long_name="Temp 2m min" operation="minimum" />
     51        <field id="t2m_max"  field_ref="t2m" long_name="Temp 2m max" operation="maximum" />
    5352        <field id="t2m_ter"    long_name="Temp 2m ter"    unit="K" />
    5453        <field id="t2m_max_mon"   long_name="Monthly average max 2m temperature" unit="K" />
     
    6160        <field id="t2m_probsup30"   field_ref="t2m" long_name="Prob. t2m exceeds 30 degC" unit="-"> t2m &gt; 303.15 </field>
    6261        <field id="gusts"    long_name="surface gustiness"    unit="m2/s2" />
    63         <field id="wind10m"    long_name="10-m wind speed"      unit="m/s" />
    64         <field id="wind10max"  long_name="10m wind speed max"   unit="m/s" operation="maximum"/>
     62        <field id="wind10m"    long_name="10-m wind speed"      unit="m/s" >  sqrt(v10m*v10m + u10m*u10m) </field>
     63        <field id="wind10max"  long_name="10m wind speed max"   unit="m/s" operation="maximum"> wind10m </field>
    6564        <field id="wind100m"   long_name="100-m wind speed"      unit="m/s" />
    6665        <field id="sfcWindmax" field_ref="wind10m" operation="maximum" />
    67         <field id="sicf"    long_name="Sea-ice fraction"        unit="-" />
     66        <field id="sicf"    long_name="Sea-ice fraction"        unit="-" > fract_sic </field>
    6867        <field id="q2m"     long_name="Specific humidity 2m"    unit="kg/kg" />
    6968        <field id="ustar"   long_name="Friction velocity"       unit="m/s" />
     
    9190        <field id="qsol"        long_name="Soil watter content"         unit="mm" />
    9291        <field id="JrNt"        long_name="1 if Day 0 if Night"         unit="-" />
    93         <field id="cldhjn"      long_name="High-level cloudiness Day"         unit="-" />
    94         <field id="cldmjn"      long_name="Mid-level cloudiness Day"         unit="-" />
    95         <field id="cldljn"      long_name="Low-level cloudiness Day"         unit="-" />
    96         <field id="cldtjn"      long_name="Total cloudiness Day"         unit="-" />
     92        <field id="cldhjn"      long_name="High-level cloudiness Day"         unit="-" > cldh/JrNt </field>
     93        <field id="cldmjn"      long_name="Mid-level cloudiness Day"         unit="-" > cldm/JrNt </field>
     94        <field id="cldljn"      long_name="Low-level cloudiness Day"         unit="-" > cldl/JrNt </field>
     95        <field id="cldtjn"      long_name="Total cloudiness Day"         unit="-"  > cldt/JrNt </field>
    9796        <field id="rnebjn"      long_name="Cloud fraction in day"         unit="-" />
    9897        <field id="ndayrain"    long_name="Number of dayrain(liq+sol)"  unit="-" operation="instant"/>
    99         <field id="precip"      long_name="Precip Totale liq+sol"       unit="kg/(s*m2)" />
     98        <field id="precip"      long_name="Precip Totale liq+sol"       unit="kg/(s*m2)" > rain_fall+snow </field>
    10099        <field id="prhmax"      field_ref="precip" operation="maximum"           />
    101100        <field id="rain_fall"   long_name="Precip Totale liq"   unit="kg/(s*m2)" />
    102101        <field id="rain_con"    long_name="Precip convective liq"   unit="kg/(s*m2)" />
    103         <field id="plul"    long_name="Large-scale Precip."     unit="kg/(s*m2)" />
     102        <field id="plul"    long_name="Large-scale Precip."     unit="kg/(s*m2)" > this+snowl </field>
    104103        <field id="plun"    long_name="Numerical Precip."       unit="kg/(s*m2)" />
    105         <field id="pluc"    long_name="Convective Precip."      unit="kg/(s*m2)" />
     104        <field id="pluc"    long_name="Convective Precip."      unit="kg/(s*m2)" > rain_con + this </field>
    106105        <field id="snow"    long_name="Snow fall"               unit="kg/(s*m2)" />
    107106        <field id="evap"    long_name="Evaporat"                unit="kg/(s*m2)" />
     
    112111        <field id="msnow"    long_name="Surface snow amount"    unit="kg/m2" />
    113112        <field id="fsnow"    long_name="Surface snow area fraction"    unit="-" />
    114         <field id="tops"    long_name="Solar rad. at TOA"    unit="W/m2" />
    115         <field id="tops0"    long_name="CS Solar rad. at TOA"    unit="W/m2" />
     113        <field id="swradcorr"    long_name="Temporary" />
     114        <field id="tops"    long_name="Solar rad. at TOA"    unit="W/m2" > this*swradcorr </field>
     115        <field id="tops0"    long_name="CS Solar rad. at TOA"    unit="W/m2" > this*swradcorr </field>
    116116        <field id="topl"    long_name="IR rad. at TOA"    unit="W/m2" />
    117117        <field id="topl0"    long_name="IR rad. at TOA"    unit="W/m2" />
    118         <field id="SWupTOA"    long_name="SWup at TOA"    unit="W/m2" />
    119         <field id="SWupTOAclr"    long_name="SWup clear sky at TOA"    unit="W/m2" />
    120         <field id="SWupTOAcleanclr"    long_name="SWup clean (no aerosol) clear sky at TOA"    unit="W/m2" />
    121         <field id="SWdnTOA"    long_name="SWdn at TOA"    unit="W/m2" />
    122         <field id="SWdnTOAclr"    long_name="SWdn clear sky at TOA"    unit="W/m2" />
    123         <field id="nettop"    long_name="Net dn radiatif flux at TOA"    unit="W/m2" />
    124         <field id="SWup200"    long_name="SWup at 200mb"    unit="W/m2" />
    125         <field id="SWup200clr"    long_name="SWup clear sky at 200mb"    unit="W/m2" />
    126         <field id="SWdn200"    long_name="SWdn at 200mb"    unit="W/m2" />
    127         <field id="SWdn200clr"    long_name="SWdn clear sky at 200mb"    unit="W/m2" />
     118        <field id="SWupTOA"    long_name="SWup at TOA"    unit="W/m2" > this*swradcorr </field>
     119        <field id="SWupTOAclr"    long_name="SWup clear sky at TOA"    unit="W/m2"  > this*swradcorr </field>
     120        <field id="SWupTOAcleanclr"    long_name="SWup clean (no aerosol) clear sky at TOA"    unit="W/m2" > this*swradcorr </field>
     121        <field id="SWdnTOA"    long_name="SWdn at TOA"    unit="W/m2" > this*swradcorr </field>
     122        <field id="SWdnTOAclr"    long_name="SWdn clear sky at TOA"    unit="W/m2"> this*swradcorr </field>
     123        <field id="nettop"    long_name="Net dn radiatif flux at TOA"    unit="W/m2" > tops - topl </field>
     124        <field id="SWup200"    long_name="SWup at 200mb"    unit="W/m2" > this*swradcorr </field>
     125        <field id="SWup200clr"    long_name="SWup clear sky at 200mb"    unit="W/m2" > this*swradcorr </field>
     126        <field id="SWdn200"    long_name="SWdn at 200mb"    unit="W/m2" > this*swradcorr </field>
     127        <field id="SWdn200clr"    long_name="SWdn clear sky at 200mb"    unit="W/m2" > this*swradcorr </field>
    128128        <field id="LWup200"    long_name="LWup at 200mb"    unit="W/m2" />
    129129        <field id="LWup200clr"    long_name="LWup clear sky at 200mb"    unit="W/m2" />
    130130        <field id="LWdn200"    long_name="LWdn at 200mb"    unit="W/m2" />
    131131        <field id="LWdn200clr"    long_name="LWdn clear sky at 200mb"    unit="W/m2" />
    132         <field id="sols"    long_name="Solar rad. at surf."    unit="W/m2" />
    133         <field id="sols0"    long_name="Solar rad. at surf."    unit="W/m2" />
     132        <field id="sols"    long_name="Solar rad. at surf."    unit="W/m2" > this*swradcorr </field>
     133        <field id="sols0"    long_name="Solar rad. at surf."    unit="W/m2" > this*swradcorr </field>
    134134        <field id="soll"    long_name="IR rad. at surface"    unit="W/m2" />
    135135        <field id="soll0"    long_name="IR rad. at surface"    unit="W/m2" />
    136136        <field id="radsol"    long_name="Rayonnement au sol"    unit="W/m2" />
    137         <field id="SWupSFC"    long_name="SWup at surface"    unit="W/m2" />
    138         <field id="SWupSFCclr"    long_name="SWup clear sky at surface"    unit="W/m2" />
    139         <field id="SWupSFCcleanclr"    long_name="SWup clean (no aerosol) clear sky at surface"    unit="W/m2" />
    140         <field id="SWdnSFC"    long_name="SWdn at surface"    unit="W/m2" />
    141         <field id="SWdnSFCclr"    long_name="SWdn clear sky at surface"    unit="W/m2" />
    142         <field id="SWdnSFCcleanclr"    long_name="SWdn clean (no aerosol) clear sky at surface"    unit="W/m2" />
    143         <field id="LWupSFC"    long_name="Upwd. IR rad. at surface"    unit="W/m2" />
    144         <field id="LWupSFCclr"    long_name="CS Upwd. IR rad. at surface"    unit="W/m2" />
     137 
     138        <field id="SWupSFC"    long_name="SWup at surface"    unit="W/m2" > this*swradcorr </field>
     139        <field id="SWupSFCclr"    long_name="SWup clear sky at surface"    unit="W/m2" > this*swradcorr </field>
     140        <field id="SWupSFCcleanclr"    long_name="SWup clean (no aerosol) clear sky at surface"    unit="W/m2" > this*swradcorr </field>
     141        <field id="SWdnSFC"    long_name="SWdn at surface"    unit="W/m2" > this*swradcorr </field>
     142        <field id="SWdnSFCclr"    long_name="SWdn clear sky at surface"    unit="W/m2" > this*swradcorr </field>
     143        <field id="SWdnSFCcleanclr"    long_name="SWdn clean (no aerosol) clear sky at surface"    unit="W/m2" > this*swradcorr </field>
     144        <field id="LWupSFC"    long_name="Upwd. IR rad. at surface"    unit="W/m2"> LWdnSFC - soll </field>
     145       
     146        <field id="LWupSFCclr"    long_name="CS Upwd. IR rad. at surface"    unit="W/m2" > LWdnSFCclr - soll0  </field>
    145147        <field id="LWupTOAcleanclr"    long_name="CS clean (no aerosol) Upwd. IR rad. at TOA"    unit="W/m2" />
    146         <field id="LWdnSFC"    long_name="Down. IR rad. at surface"    unit="W/m2" />
    147         <field id="LWdnSFCclr"    long_name="Down. CS IR rad. at surface"    unit="W/m2" />
    148         <field id="LWdnSFCcleanclr"    long_name="Down. CS clean (no aerosol) IR rad. at surface"    unit="W/m2" />
     148        <field id="LWdnSFC"    long_name="Down. IR rad. at surface"    unit="W/m2"  />
     149        <field id="LWdnSFCclr"    long_name="Down. CS IR rad. at surface"    unit="W/m2" > -this </field>
     150        <field id="LWdnSFCcleanclr"    long_name="Down. CS clean (no aerosol) IR rad. at surface"    unit="W/m2" > -this </field>
    149151        <field id="bils"    long_name="Surf. total heat flux"    unit="W/m2" />
    150152        <field id="bils_tke"    long_name="Surf. total heat flux"    unit="W/m2" />
     
    161163        <field id="ustr_gwd_rando"    long_name="zonal wind stress random gravity waves"    unit="Pa" />
    162164        <field id="vstr_gwd_rando"    long_name="meridinal wind stress random gravity waves"    unit="Pa" />
    163         <field id="sens"    long_name="Sensible heat flux"    unit="W/m2" />
     165        <field id="sens"    long_name="Sensible heat flux"    unit="W/m2" > -this </field>
    164166        <field id="sens_x"    long_name="sens off-wake"    unit="W/m2" />
    165167        <field id="sens_w"    long_name="sens within-wake"    unit="W/m2" />
    166168        <field id="flat_x"    long_name="flat off-wake"    unit="W/m2" />
    167169        <field id="flat_w"    long_name="flat within-wake"    unit="W/m2" />
    168         <field id="delta_tsurf"    long_name="Temperature difference (w-x)"    unit="K" enabled="false" /> <!-- ym --field disabled-- delta_tsurf is not conform to the associated grid (the is an arry containing all sub_surface) -->
     170        <field id="delta_tsurf"    long_name="Temperature difference (w-x)"    unit="K" enabled="false" /> <!-- ym field disabled delta_tsurf is not conform to the associated grid (the is an arry containing all sub_surface) -->
    169171        <field id="cdragh_x"    long_name="cdragh off-wake"    unit="-" />
    170172        <field id="cdragh_w"    long_name="cdragh within-wake"    unit="-" />
     
    179181        <field id="fqfonte"    long_name="Land ice melt"    unit="kg/m2/s" />
    180182        <field id="runofflic"  long_name="Land ice melt to ocean" unit="kg/m2/s" />
    181         <field id="mrroli"  long_name="Runoff flux over land ice" unit="kg/m2/s" />
    182         <field id="taux"    long_name="Zonal wind stress"    unit="Pa" />
    183         <field id="tauy"    long_name="Meridional wind stress"    unit="Pa" />
     183        <field id="mrroli"  long_name="Runoff flux over land ice" unit="kg/m2/s"> (fqfonte + rain_fall)*fract_lic </field>
     184        <field id="taux"    long_name="Zonal wind stress"    unit="Pa" >      fract_ter*taux_ter + fract_lic*taux_lic + fract_oce*taux_oce +fract_sic*taux_sic </field>
     185        <field id="tauy"    long_name="Meridional wind stress"    unit="Pa" > fract_ter*tauy_ter + fract_lic*tauy_lic + fract_oce*tauy_oce +fract_sic*tauy_sic </field>
    184186        <field id="taux_ter"    long_name="Zonal wind stress ter"    unit="Pa" />
    185187        <field id="taux_lic"    long_name="Zonal wind stress lic"    unit="Pa" />
     
    190192        <field id="tauy_oce"    long_name="Meridional wind stress oce"    unit="Pa" />
    191193        <field id="tauy_sic"    long_name="Meridional wind stress sic"    unit="Pa" />
    192         <field id="pourc_ter"    long_name="% ter"    unit="%" />
    193         <field id="pourc_lic"    long_name="% lic"    unit="%" />
    194         <field id="pourc_oce"    long_name="% oce"    unit="%" />
    195         <field id="pourc_sic"    long_name="% sic"    unit="%" />
     194        <field id="pourc_ter"    long_name="% ter"    unit="%" > 100*fract_ter </field>
     195        <field id="pourc_lic"    long_name="% lic"    unit="%" > 100*fract_lic </field>
     196        <field id="pourc_oce"    long_name="% oce"    unit="%" > 100*fract_oce </field>
     197        <field id="pourc_sic"    long_name="% sic"    unit="%" > 100*fract_sic </field>
    196198        <field id="fract_ter"    long_name="Fraction ter"    unit="1" />
    197199        <field id="fract_lic"    long_name="Fraction lic"    unit="1" />
     
    335337        <field id="z50"    long_name="Geopotential height 50hPa"    unit="m" detect_missing_value=".true." />
    336338        <field id="z10"    long_name="Geopotential height 10hPa"    unit="m" detect_missing_value=".true." />
    337         <field id="t_oce_sic"    long_name="Temp mixte oce-sic"    unit="K" />
     339        <field id="t_oce_sic"    long_name="Temp mixte oce-sic"    unit="K" > ((fract_oce > 1.0E-05)+(fract_sic > 1.0E-05))?(tsol_oce*fract_oce+tsol_sic*fract_sic)/(fract_oce+fract_sic):273.15 </field>
     340        <!--<field id="t_oce_sic"    long_name="Temp mixte oce-sic"    unit="K" > (fract_oce > 1.0E-05 || fract_sic > 1.0E-05)?(tsol_oce*fract_oce+tsol_sic*fract_sic)/(fract_oce+fract_sic):273.15 </field > -->
    338341        <field id="weakinv"    long_name="Weak inversion"    unit="-" />
    339342        <field id="dthmin"    long_name="dTheta mini"    unit="K/m" />
     
    346349        <field id="v10_oce"    long_name="-"    unit="-" />
    347350        <field id="v10_sic"    long_name="-"    unit="-" />
    348         <field id="rh2m"    long_name="Relative humidity at 2m"    unit="%" />
     351        <field id="rh2m"    long_name="Relative humidity at 2m"    unit="%" > (this > 1.) ? 100. : this*100. </field>
    349352        <field id="rh2m_max"    field_ref="rh2m" operation="maximum" enabled="false"/> <!-- ym Problem : field is disabled check rh2m_min has a reference (field_ref) to rh2 but is also sent by model which is not compatible-->
    350353        <field id="rh2m_min"    field_ref="rh2m" operation="minimum" enabled="false"/> <!-- ym Problem : field is disabled check rh2m_max has a reference (field_ref) to rh2 but is also sent by model which is not compatible-->
     
    354357        <field id="tpot"    long_name="Surface air potential temperature"    unit="K" />
    355358        <field id="tpote"    long_name="Surface air equivalent potential temperature"    unit="K" />
    356         <field id="SWnetOR"    long_name="Sfce net SW radiation OR"    unit="W/m2" />
     359        <field id="SWnetOR"   field_ref="fsw_ter" long_name="Sfce net SW radiation OR"    unit="W/m2" />
    357360        <field id="SWdownOR"    long_name="Sfce incident SW radiation OR"    unit="W/m2" />
    358         <field id="LWdownOR"    long_name="Sfce incident LW radiation OR"    unit="W/m2" />
     361        <field id="LWdownOR"   field_ref="LWdnSFC" long_name="Sfce incident LW radiation OR"    unit="W/m2" />
    359362        <field id="snowl"    long_name="Solid Large-scale Precip."    unit="kg/(m2*s)" />
    360         <field id="cape_max"    long_name="CAPE max."    unit="J/kg" operation="maximum"/>
    361         <field id="solldown"    long_name="Down. IR rad. at surface"    unit="W/m2" />
     363        <field id="cape_max"  field_ref="cape"   long_name="CAPE max." operation="maximum"/>
     364        <field id="solldown"   field_ref="LWdnSFC" long_name="Down. IR rad. at surface"    unit="W/m2" />
    362365        <field id="dtsvdfo"    long_name="Boundary-layer dTs(o)"    unit="K/s" />
    363366        <field id="dtsvdft"    long_name="Boundary-layer dTs(t)"    unit="K/s" />
     
    369372        <field id="topswad"    long_name="ADE at TOA"    unit="W/m2" />
    370373        <field id="topswad0"    long_name="ADE clear-sky at TOA"    unit="W/m2" />
    371         <field id="topswai"    long_name="AIE at TOA"    unit="W/m2" />
    372         <field id="solswad"    long_name="ADE at SRF"    unit="W/m2" />
     374        <field id="topswai"    long_name="AIE at TOA"    unit="W/m2" > this/swradcorr </field>
     375        <field id="solswad"    long_name="ADE at SRF"    unit="W/m2" > this/swradcorr </field>
    373376        <field id="solswad0"    long_name="ADE clear-sky at SRF"    unit="W/m2" />
    374         <field id="solswai"    long_name="AIE at SFR"    unit="W/m2" />
    375         <field id="toplwad"    long_name="LW-ADE at TOA" unit="W/m2" />
    376         <field id="toplwad0"    long_name="LW-ADE clear-sky at TOA"    unit="W/m2" />
    377         <field id="toplwai"    long_name="LW-AIE clear-sky at TOA"    unit="W/m2" />
     377        <field id="solswai"    long_name="AIE at SFR"    unit="W/m2" > this/swradcorr </field>
     378        <field id="toplwad"    long_name="LW-ADE at TOA" unit="W/m2"  > this/swradcorr </field>
     379        <field id="toplwad0"    long_name="LW-ADE clear-sky at TOA"    unit="W/m2"  > this/swradcorr </field>
     380        <field id="toplwai"    long_name="LW-AIE clear-sky at TOA"    unit="W/m2" > this/swradcorr </field>
    378381        <field id="sollwad"    long_name="LW-ADE at SRF" unit="W/m2" />
    379382        <field id="sollwad0"    long_name="LW-ADE clear-sky at SRF"    unit="W/m2" />
    380         <field id="sollwai"    long_name="LW-AIE at SRF" unit="W/m2" />
     383        <field id="sollwai"    long_name="LW-AIE at SRF" unit="W/m2" > this/swradcorr </field>
    381384        <field id="od550_ASBCM"    long_name="Aerosol Optical depth at 550 nm "    unit="1" />
    382385        <field id="od550_ASPOMM"   long_name="Aerosol Optical depth at 550 nm "    unit="1" />
     
    425428        <field id="loaddust"  long_name="Column Load of Dust "    unit="kg/m2" />
    426429        <field id="loadno3"   long_name="Column Load of Nitrate " unit="kg/m2" />
    427         <field id="swtoaas_nat"    long_name="Natural aerosol radiative forcing all-sky at TOA"    unit="W/m2" />
    428         <field id="swsrfas_nat"    long_name="Natural aerosol radiative forcing all-sky at SRF"    unit="W/m2" />
    429         <field id="swtoacs_nat"    long_name="Natural aerosol radiative forcing clear-sky at TOA"    unit="W/m2" />
    430         <field id="swsrfcs_nat"    long_name="Natural aerosol radiative forcing clear-sky at SRF"    unit="W/m2" />
    431         <field id="swtoaas_ant"    long_name="Anthropogenic aerosol radiative forcing all-sky at TOA"    unit="W/m2" />
    432         <field id="swsrfas_ant"    long_name="Anthropogenic aerosol radiative forcing all-sky at SRF"    unit="W/m2" />
    433         <field id="swtoacs_ant"    long_name="Anthropogenic aerosol radiative forcing clear-sky at TOA"    unit="W/m2" />
    434         <field id="swsrfcs_ant"    long_name="Anthropogenic aerosol radiative forcing clear-sky at SRF"    unit="W/m2" />
    435         <field id="swtoacf_nat"    long_name="Natural aerosol impact on cloud radiative forcing at TOA"    unit="W/m2" />
    436         <field id="swsrfcf_nat"    long_name="Natural aerosol impact on cloud radiative forcing  at SRF"    unit="W/m2" />
    437         <field id="swtoacf_ant"    long_name="Anthropogenic aerosol impact on cloud radiative forcing at TOA"    unit="W/m2" />
    438         <field id="swsrfcf_ant"    long_name="Anthropogenic aerosol impact on cloud radiative forcing at SRF"    unit="W/m2" />
    439         <field id="swtoacf_zero"    long_name="Cloud radiative forcing (allsky-clearsky fluxes) at TOA"    unit="W/m2" />
    440         <field id="swsrfcf_zero"    long_name="Cloud radiative forcing (allsky-clearsky fluxes) at SRF"    unit="W/m2" />
     430        <field id="swtoaas_nat"    long_name="Natural aerosol radiative forcing all-sky at TOA"    unit="W/m2" > this/swradcorr </field>
     431        <field id="swsrfas_nat"    long_name="Natural aerosol radiative forcing all-sky at SRF"    unit="W/m2" > this/swradcorr </field>
     432        <field id="swtoacs_nat"    long_name="Natural aerosol radiative forcing clear-sky at TOA"    unit="W/m2" > this/swradcorr </field>
     433        <field id="swsrfcs_nat"    long_name="Natural aerosol radiative forcing clear-sky at SRF"    unit="W/m2" > this/swradcorr </field>
     434        <field id="swtoaas_ant"    long_name="Anthropogenic aerosol radiative forcing all-sky at TOA"    unit="W/m2" > this/swradcorr </field>
     435        <field id="swsrfas_ant"    long_name="Anthropogenic aerosol radiative forcing all-sky at SRF"    unit="W/m2"  > this/swradcorr </field>
     436        <field id="swtoacs_ant"    long_name="Anthropogenic aerosol radiative forcing clear-sky at TOA"    unit="W/m2"  > this/swradcorr </field>
     437        <field id="swsrfcs_ant"    long_name="Anthropogenic aerosol radiative forcing clear-sky at SRF"    unit="W/m2" > this/swradcorr </field>
     438        <field id="swtoacf_nat"    long_name="Natural aerosol impact on cloud radiative forcing at TOA"    unit="W/m2" > this/swradcorr </field>
     439        <field id="swsrfcf_nat"    long_name="Natural aerosol impact on cloud radiative forcing  at SRF"    unit="W/m2" > this/swradcorr </field>
     440        <field id="swtoacf_ant"    long_name="Anthropogenic aerosol impact on cloud radiative forcing at TOA"    unit="W/m2" > this/swradcorr </field>
     441        <field id="swsrfcf_ant"    long_name="Anthropogenic aerosol impact on cloud radiative forcing at SRF"    unit="W/m2" > this/swradcorr </field>
     442        <field id="swtoacf_zero"    long_name="Cloud radiative forcing (allsky-clearsky fluxes) at TOA"    unit="W/m2" > this/swradcorr </field>
     443        <field id="swsrfcf_zero"    long_name="Cloud radiative forcing (allsky-clearsky fluxes) at SRF"    unit="W/m2" > this/swradcorr </field>
    441444        <field id="cldncl"    long_name="CDNC at top of liquid water cloud"    unit="m-3" />
    442445        <field id="reffclwtop"    long_name="Droplet effective radius at top of liquid water cloud"    unit="m" />
     
    478481        <field id="alb1"    long_name="Surface VIS albedo"    unit="-" />
    479482        <field id="alb2"    long_name="Surface Near IR albedo"    unit="-" />
    480         <field id="ftime_con"    long_name="Fraction of time convection Occurs"    unit="-" operation="instant" />
     483        <field id="ftime_con"    long_name="Fraction of time convection Occurs"    unit="-" operation="instant" > (ftime_th>ftime_deepcv)?ftime_th:ftime_deepcv </field>
    481484        <field id="ftime_deepcv"    long_name="Fraction of time deep convection Occurs"    unit="-" />
    482485        <field id="wake_h"    long_name="wake height"    unit="m" />
     
    490493        <field id="f0_th"    long_name="Thermal closure mass flux"    unit="K/s" />
    491494        <field id="zmax_th"    long_name="Thermal plume height"    unit="K/s" />
    492         <field id="rsut4co2"    long_name="TOA Out SW in 4xCO2 atmosphere"    unit="W/m2" />
     495        <field id="rsut4co2"    long_name="TOA Out SW in 4xCO2 atmosphere"    unit="W/m2" > this*swradcorr </field>
    493496        <field id="rlut4co2"    long_name="TOA Out LW in 4xCO2 atmosphere"    unit="W/m2" />
    494         <field id="rsutcs4co2"    long_name="TOA Out CS SW in 4xCO2 atmosphere"    unit="W/m2" />
     497        <field id="rsutcs4co2"    long_name="TOA Out CS SW in 4xCO2 atmosphere"    unit="W/m2" > this*swradcorr </field>
    495498        <field id="rlutcs4co2"    long_name="TOA Out CS LW in 4xCO2 atmosphere"    unit="W/m2" />
    496499        <field id="dqphy2d"    long_name="Physics dQ"    unit="(kg/m2)/s" />
     
    527530        <field id="tke_oce"    long_name="Max Turb. Kinetic Energy oce"    unit="m2/s2" />
    528531        <field id="tke_sic"    long_name="Max Turb. Kinetic Energy sic"    unit="m2/s2" />
    529         <field id="tke_max_ter"    long_name="Max Turb. Kinetic Energy ter"    unit="m2/s2" operation="maximum"/>
    530         <field id="tke_max_lic"    long_name="Max Turb. Kinetic Energy lic"    unit="m2/s2" operation="maximum"/>
    531         <field id="tke_max_oce"    long_name="Max Turb. Kinetic Energy oce"    unit="m2/s2" operation="maximum"/>
    532         <field id="tke_max_sic"    long_name="Max Turb. Kinetic Energy sic"    unit="m2/s2" operation="maximum"/>
     532        <field id="tke_max_ter"  field_ref="tke_ter" operation="maximum"/>
     533        <field id="tke_max_lic"  field_ref="tke_lic" operation="maximum"/>
     534        <field id="tke_max_oce"  field_ref="tke_oce" operation="maximum"/>
     535        <field id="tke_max_sic"  field_ref="tke_sic" operation="maximum"/>
    533536        <field id="l_mix_ter"    long_name="PBL mixing length ter"    unit="m" />
    534537        <field id="l_mix_lic"    long_name="PBL mixing length lic"    unit="m" />
     
    549552        <field id="cldtau"    long_name="Cloud optical thickness"    unit="1" />
    550553        <field id="cldemi"    long_name="Cloud optical emissivity"    unit="1" />
    551         <field id="tke_max"    long_name="TKE max"    unit="m2/s2" operation="maximum"/>
     554        <field id="tke_max"  long_name="TKE max" field_ref="tke" operation="maximum"/>
    552555        <field id="kz"    long_name="Kz melange"    unit="m2/s" enabled="FALSE" />
    553         <field id="kz_max"    long_name="Kz melange max"    unit="m2/s" enabled="FALSE" operation="maximum" />
     556        <field id="kz_max"    field_ref="kz" long_name="Kz melange max" enabled="FALSE" operation="maximum" />
    554557        <field id="concso4"    long_name="Concentration of Sulfate "    unit="kg/m3" />
    555558        <field id="concno3"    long_name="Concentration of Nitrate "    unit="kg/m3" />
     
    566569        <field id="ovapinit"    long_name="Specific humidity (begin of timestep)"    unit="kg/kg" />
    567570        <field id="oliq"    long_name="Liquid water"    unit="kg/kg" />
    568         <field id="ocond"    long_name="Condensed water"    unit="kg/kg" />
     571        <field id="ocond"    long_name="Condensed water"    unit="kg/kg" >oliq+this</field>
    569572        <field id="geop"    long_name="Geopotential height"    unit="m2/s2" />
    570573        <field id="geoph" field_ref="geop" long_name="Geopotential height" unit="m" > geop/9.80665 </field>
     
    575578        <field id="paprs"    long_name="Air pressure Inter-Couches"    unit="Pa" />
    576579        <field id="mass"    long_name="Masse Couches"    unit="kg/m2" />
    577         <field id="zfull"    long_name="Altitude of full pressure levels"    unit="m" />
     580        <field id="zfull"    long_name="Altitude of full pressure levels"    unit="m"  > geop / $RG </field>
    578581        <field id="zhalf"    long_name="Altitude of half pressure levels"    unit="m" />
    579582        <field id="rneb"    long_name="Cloud fraction"    unit="-" />
     
    582585        <field id="rneblsvol" long_name="LS Cloud fraction by volume"    unit="-" />
    583586        <field id="rhum"    long_name="Relative humidity"    unit="-" />
    584         <field id="ozone"    long_name="Ozone mole fraction"    unit="-" />
    585         <field id="ozone_daylight"    long_name="Daylight ozone mole fraction"    unit="-" />
     587        <field id="wo_1"    long_name="Temporary"/>
     588        <field id="ozone"    long_name="Ozone mole fraction"    unit="-" > wo_1 * $dobson_u * 1E3 / mass / $rmo3 * $rmd </field>
     589        <field id="ozone_daylight"    long_name="Daylight ozone mole fraction"    unit="-" > this * $dobson_u * 1E3 / mass / $rmo3 * $rmd </field>
    586590        <field id="upwd"    long_name="saturated updraft"    unit="kg/m2/s" />
    587591        <field id="ep"    long_name="ep"    unit="su" />
     
    603607        <field id="lcc3dcon"    long_name="Convective cloud liquid fraction"    unit="1" />
    604608        <field id="lcc3dstra"    long_name="Stratiform cloud liquid fraction"    unit="1" />
    605         <field id="cldwatmxrat"    long_name="Cloud Water Mixing Ratio"    unit="1" />
     609        <field id="cldwatmxrat"    long_name="Cloud Water Mixing Ratio"    unit="1" > 1-this </field>
    606610        <field id="icc3dcon"    long_name="Mass Fraction of Convective Cloud Ice"    unit="kg/kg" />
    607611        <field id="icc3dstra"    long_name="Mass Fraction of Stratiform Cloud Ice "    unit="kg/kg" />
     
    612616        <field id="dnwd"    long_name="saturated downdraft"    unit="kg/m2/s" />
    613617        <field id="dnwd0"    long_name="unsat. downdraft"    unit="kg/m2/s" />
    614         <field id="mc"    long_name="Convective mass flux"    unit="kg/m2/s" />
     618        <field id="mc"    long_name="Convective mass flux"    unit="kg/m2/s" > -dnwd + dnwd0 + upwd + f_th </field>
    615619        <field id="dtdyn"    long_name="Dynamics dT"    unit="K/s" />
    616620        <field id="dqdyn"    long_name="Dynamics dQ"    unit="(kg/kg)/s" />
     
    619623        <field id="dudyn"    long_name="Dynamics dU"    unit="m/s2" />
    620624        <field id="dvdyn"    long_name="Dynamics dV"    unit="m/s2" />
    621         <field id="dtcon"    long_name="Convection dT"    unit="K/s" />
    622         <field id="ducon"    long_name="Convection du"    unit="m/s2" />
    623         <field id="dvcon"    long_name="Convection dv"    unit="m/s2" />
    624         <field id="dqcon"    long_name="Convection dQ"    unit="(kg/kg)/s" />
    625         <field id="dtwak"    long_name="Wake dT"    unit="K/s" />
    626         <field id="dqwak"    long_name="Wake dQ"    unit="(kg/kg)/s" />
     625        <field id="dtcon"    long_name="Convection dT"    unit="K/s" > this/$pdtphys </field>
     626        <field id="ducon"    long_name="Convection du"    unit="m/s2" > this/$pdtphys </field>
     627        <field id="dvcon"    long_name="Convection dv"    unit="m/s2" > this/$pdtphys </field>
     628        <field id="dqcon"    long_name="Convection dQ"    unit="(kg/kg)/s" > this/$pdtphys </field>
     629        <field id="dtwak"    long_name="Wake dT"    unit="K/s" > this/$pdtphys </field>
     630        <field id="dqwak"    long_name="Wake dQ"    unit="(kg/kg)/s" > this/$pdtphys </field>
    627631        <field id="wake_deltat"    long_name="wake_deltat"    unit="-" />
    628632        <field id="wake_deltaq"    long_name="wake_deltaq"    unit="-" />
     
    640644        <field id="dqlsc"    long_name="Condensation dQ"    unit="(kg/kg)/s" />
    641645        <field id="beta_prec"    long_name="LS Conversion rate to prec"    unit="(kg/kg)/s" />
    642         <field id="dtvdf"    long_name="Boundary-layer dT"    unit="K/s" />
    643         <field id="dtvdf_x"  long_name="dtvdf off_wake"    unit="K/s" />
    644         <field id="dtvdf_w"  long_name="dtvdf within_wake"    unit="K/s" />
    645         <field id="dtdis"    long_name="TKE dissipation dT"    unit="K/s" />
    646         <field id="dqvdf"    long_name="Boundary-layer dQ"    unit="(kg/kg)/s" />
    647         <field id="dqvdf_x" long_name="dqvdf off_wake" unit="(kg/kg)/s" />
    648         <field id="dqvdf_w" long_name="dqvdf within_wake" unit="(kg/kg)/s" />
    649         <field id="dteva"    long_name="Reevaporation dT"    unit="K/s" />
    650         <field id="dqeva"    long_name="Reevaporation dQ"    unit="(kg/kg)/s" />
    651         <field id="dqlscth"    long_name="dQ therm."    unit="(kg/kg)/s" />
    652         <field id="dqlscst"    long_name="dQ strat."    unit="(kg/kg)/s" />
    653         <field id="dtlscth"    long_name="dQ therm."    unit="K/s" />
    654         <field id="dtlscst"    long_name="dQ strat."    unit="K/s" />
    655         <field id="ptconvth"    long_name="POINTS CONVECTIFS therm."    unit="-" />
     646        <field id="dtvdf"    long_name="Boundary-layer dT"    unit="K/s" > this/$pdtphys </field>
     647        <field id="dtvdf_x"  long_name="dtvdf off_wake"    unit="K/s"> this/$pdtphys </field>
     648        <field id="dtvdf_w"  long_name="dtvdf within_wake"    unit="K/s"> this/$pdtphys </field>
     649        <field id="dtdis"    long_name="TKE dissipation dT"    unit="K/s" > this/$pdtphys </field>
     650        <field id="dqvdf"    long_name="Boundary-layer dQ"    unit="(kg/kg)/s" > this/$pdtphys </field>
     651        <field id="dqvdf_x" long_name="dqvdf off_wake" unit="(kg/kg)/s" > this/$pdtphys </field>
     652        <field id="dqvdf_w" long_name="dqvdf within_wake" unit="(kg/kg)/s" > this/$pdtphys </field>
     653        <field id="dteva"    long_name="Reevaporation dT"    unit="K/s" > this/$pdtphys </field>
     654        <field id="dqeva"    long_name="Reevaporation dQ"    unit="(kg/kg)/s" > this/$pdtphys </field>
     655        <field id="dqlscth"    long_name="dQ therm."    unit="(kg/kg)/s" > this/$pdtphys </field>
     656        <field id="dqlscst"    long_name="dQ strat."    unit="(kg/kg)/s" > this/$pdtphys </field>
     657        <field id="dtlscth"    long_name="dQ therm."    unit="K/s" > this/$pdtphys </field>
     658        <field id="dtlscst"    long_name="dQ strat."    unit="K/s" > this/$pdtphys </field>
     659        <field id="ptconvth"    long_name="POINTS CONVECTIFS therm."    unit="-" > this/=0 </field>
    656660        <field id="ptconv"    long_name="POINTS CONVECTIFS"    unit="-" />
    657661        <field id="ratqs"    long_name="RATQS"    unit="-" />
    658         <field id="dtthe"    long_name="Thermal dT"    unit="K/s" />
    659         <field id="duthe"    long_name="Thermal du"    unit="m/s2" />
    660         <field id="dvthe"    long_name="Thermal dv"    unit="m/s2" />
     662        <field id="dtthe"    long_name="Thermal dT"    unit="K/s" > this/$pdtphys - dtajs </field>
     663        <field id="duthe"    long_name="Thermal du"    unit="m/s2" > this/$pdtphys </field>
     664        <field id="dvthe"    long_name="Thermal dv"    unit="m/s2" > this/$pdtphys </field>
    661665        <field id="f_th"    long_name="Thermal plume mass flux"    unit="kg/(m2*s)" />
    662666        <field id="e_th"    long_name="Thermal plume entrainment"    unit="K/s" />
     
    671675        <field id="d_th"    long_name="Thermal plume detrainment"    unit="K/s" />
    672676        <field id="dqthe"    long_name="Thermal dQ"    unit="(kg/kg)/s" />
    673         <field id="dtajs"    long_name="Dry adjust. dT"    unit="K/s" />
    674         <field id="dqajs"    long_name="Dry adjust. dQ"    unit="(kg/kg)/s" />
    675         <field id="dtswr"    long_name="SW radiation dT"    unit="K/s" />
    676         <field id="dtsw0"    long_name="CS SW radiation dT"    unit="K/s" />
    677         <field id="dtlwr"    long_name="LW radiation dT"    unit="K/s" />
    678         <field id="dtlw0"    long_name="CS LW radiation dT"    unit="K/s" />
    679         <field id="dtec"    long_name="Cinetic dissip dT"    unit="K/s" />
    680         <field id="duvdf"    long_name="Boundary-layer dU"    unit="m/s2" />
    681         <field id="dvvdf"    long_name="Boundary-layer dV"    unit="m/s2" />
    682         <field id="duoro"    long_name="Orography dU"    unit="m/s2" />
    683         <field id="dvoro"    long_name="Orography dV"    unit="m/s2" />
    684         <field id="dulif"    long_name="Orography dU"    unit="m/s2" />
    685         <field id="dvlif"    long_name="Orography dV"    unit="m/s2" />
    686         <field id="du_gwd_rando"    long_name="peu importe"    unit="W/m2" />
    687         <field id="dv_gwd_rando"    long_name="peu importe"    unit="W/m2" />
    688         <field id="du_gwd_hines" long_name="Hines GWD dU" unit="m/s2" />
    689         <field id="dv_gwd_hines" long_name="Hines GWD dV" unit="m/s2" />
    690         <field id="du_gwd_front" long_name="Fronts GWD dU" unit="m/s2" />
    691         <field id="dv_gwd_front" long_name="Fronts GWD dV" unit="m/s2" />
     677        <field id="dtajs"    long_name="Dry adjust. dT"    unit="K/s" > this/$pdtphys </field>
     678        <field id="dqajs"    long_name="Dry adjust. dQ"    unit="(kg/kg)/s" > this/$pdtphys </field>
     679        <field id="dtswr"    long_name="SW radiation dT"    unit="K/s" > this/$pdtphys </field>
     680        <field id="dtsw0"    long_name="CS SW radiation dT"    unit="K/s" > this/$pdtphys </field>
     681        <field id="dtlwr"    long_name="LW radiation dT"    unit="K/s" > this/$pdtphys </field>
     682        <field id="dtlw0"    long_name="CS LW radiation dT"    unit="K/s" > this/$pdtphys </field>
     683        <field id="dtec"    long_name="Cinetic dissip dT"    unit="K/s" > this/$pdtphys </field>
     684        <field id="duvdf"    long_name="Boundary-layer dU"    unit="m/s2" > this/$pdtphys </field>
     685        <field id="dvvdf"    long_name="Boundary-layer dV"    unit="m/s2" > this/$pdtphys </field>
     686        <field id="duoro"    long_name="Orography dU"    unit="m/s2" > this/$pdtphys </field>
     687        <field id="dvoro"    long_name="Orography dV"    unit="m/s2" > this/$pdtphys </field>
     688        <field id="dulif"    long_name="Orography dU"    unit="m/s2" > this/$pdtphys </field>
     689        <field id="dvlif"    long_name="Orography dV"    unit="m/s2" > this/$pdtphys </field>
     690        <field id="du_gwd_rando"    long_name="peu importe"    unit="W/m2" > this/$pdtphys </field>
     691        <field id="dv_gwd_rando"    long_name="peu importe"    unit="W/m2" > this/$pdtphys </field>
     692        <field id="du_gwd_hines" long_name="Hines GWD dU" unit="m/s2" > this/$pdtphys </field>
     693        <field id="dv_gwd_hines" long_name="Hines GWD dV" unit="m/s2" > this/$pdtphys </field>
     694        <field id="du_gwd_front" long_name="Fronts GWD dU" unit="m/s2" > this/$pdtphys </field>
     695        <field id="dv_gwd_front" long_name="Fronts GWD dV" unit="m/s2" > this/$pdtphys </field>
    692696        <field id="east_gwstress" long_name="Eastward GW Stress" unit="Pa" />
    693697        <field id="west_gwstress" long_name="Westward GW Stress" unit="Pa" />
    694         <field id="dtoro"    long_name="Orography dT"    unit="K/s" />
    695         <field id="dtlif"    long_name="Orography dT"    unit="K/s" />
    696         <field id="dthin"    long_name="Hines GWD dT"    unit="K/s" />
     698        <field id="dtoro"    long_name="Orography dT"    unit="K/s" > this/$pdtphys </field>
     699        <field id="dtlif"    long_name="Orography dT"    unit="K/s" > this/$pdtphys </field>
     700        <field id="dthin"    long_name="Hines GWD dT"    unit="K/s" > this/$pdtphys </field>
    697701        <field id="rsu"    long_name="SW upward radiation"    unit="W m-2" />
    698702        <field id="rsd"    long_name="SW downward radiation"    unit="W m-2" />
     
    705709        <field id="rlucs"    long_name="LW CS upward radiation"    unit="W m-2" />
    706710        <field id="rldcs"    long_name="LW CS downward radiation"    unit="W m-2" />
    707         <field id="tnt"    long_name="Tendency of air temperature"    unit="K s-1" />
     711        <field id="tnt"    long_name="Tendency of air temperature"    unit="K s-1" > dtphy + dtdyn </field>
    708712        <field id="tntc"    long_name="Tendency of air temperature due to Moist Convection"    unit="K s-1" />
    709         <field id="tntr"    long_name="Air temperature tendency due to Radiative heating"    unit="K s-1" />
    710         <field id="tntscpbl"    long_name="Air temperature tendency due to St cloud and precipitation and BL mixing"    unit="K s-1" />
    711         <field id="tnhus"    long_name="Tendency of specific humidity"    unit="s-1" />
     713        <field id="tntr"    long_name="Air temperature tendency due to Radiative heating"    unit="K s-1" > dtswr + dtlwr </field>
     714        <field id="tntscpbl"    long_name="Air temperature tendency due to St cloud and precipitation and BL mixing"    unit="K s-1" > dtlsc +  dteva + dtvdf </field>
     715        <field id="tnhus"    long_name="Tendency of specific humidity"    unit="s-1" > dqphy + dqdyn </field>
    712716        <field id="tnhusc"    long_name="Tendency of specific humidity due to convection"    unit="s-1" />
    713         <field id="tnhusscpbl"    long_name="Tendency of Specific humidity due to ST cl, precip and BL mixing"    unit="s-1" />
     717        <field id="tnhusscpbl"    long_name="Tendency of Specific humidity due to ST cl, precip and BL mixing"    unit="s-1" > dqlsc + dqeva </field>
    714718        <field id="evu"    long_name="Eddy viscosity coefficient for Momentum Variables"    unit="m2 s-1" />
    715         <field id="h2o"    long_name="Mass Fraction of Water"    unit="1" />
     719        <field id="h2o"    long_name="Mass Fraction of Water"    unit="1" > ovap + oliq </field>
    716720        <field id="mcd"    long_name="Downdraft COnvective Mass Flux"    unit="kg/(m2*s)" />
    717721        <field id="dmc"    long_name="Deep COnvective Mass Flux"    unit="kg/(m2*s)" />
     
    783787      <field id="wap" long_name="Lagrangian tendency of air pressure" unit="Pa s-1" detect_missing_value=".true." />
    784788<!--  <field id="psbg" long_name="Pressure sfce below ground" unit="%" detect_missing_value=".true." /> -->
    785       <field id="tro3" long_name="Ozone mole fraction" unit="1e-9" detect_missing_value=".true." />
    786       <field id="tro3_daylight" long_name="Daylight ozone mole fraction" unit="1e-9" detect_missing_value=".true." />
     789      <field id="tro3" long_name="Ozone mole fraction" unit="1e-9" detect_missing_value=".true." > (this/=$missing_val)?this*1.e+9:$missing_val </field>
     790      <field id="tro3_daylight" long_name="Daylight ozone mole fraction" unit="1e-9" detect_missing_value=".true." > (this/=$missing_val)?this*1.e+9:$missing_val </field>
    787791      <field id="uv" long_name="uv" unit="m2/s2" detect_missing_value=".true." />
    788792      <field id="vxq" long_name="vxq" unit="m/s * (kg/kg)" detect_missing_value=".true." />
  • LMDZ6/branches/Optimisation_LMDZ/libf/phylmd/phys_output_write_xios_mod.f90

    r3754 r3768  
    353353    INTEGER :: flag_aerosol_strat
    354354    INTEGER :: flag_aerosol
    355     LOGICAL :: ok_cdnc
     355    LOGICAL :: ok_cdnc, var_is_set
    356356
    357357    ! Local
     
    374374    INTEGER ISW
    375375    CHARACTER*1 ch1
     376    CHARACTER(len=3) :: isrf_str
    376377    CHARACTER*20 varname
    377378
     
    381382    REAL, DIMENSION(klon, klev) :: z, dz
    382383    REAL, DIMENSION(klon)      :: zrho, zt
     384
     385    type(ctrl_out), SAVE :: o_wo_1 = ctrl_out(flag=0, name="wo_1", description = "Temporary", unit = "-", type_ecrit = "")
     386    type(ctrl_out), SAVE :: o_swradcorr = ctrl_out(flag=0, name="swradcorr", description = "Temporary", unit = "-", type_ecrit = "")
    383387
    384388    if( .not. CPP_XIOS_defined ) call abort_physic("phys_output_write_xios", "This io backend can only be used when LMDZ is compiled with XIOS support",1 )
     
    420424
    421425    !$omp MASTER
     426    IF (.not. vars_defined) THEN
     427      var_is_set = xios_setVar("pdtphys", pdtphys)
     428      var_is_set = xios_setVar("RG", RG)
     429      !wo_coeff = dobson_u*1e3/rmo3*rmd
     430      var_is_set = xios_setVar("dobson_u", dobson_u)
     431      var_is_set = xios_setVar("rmo3", rmo3)
     432      var_is_set = xios_setVar("rmd", rmd)
     433      var_is_set = xios_setVar("missing_val", missing_val)
     434    ENDIF
    422435    IF (.not. vars_defined .and. ok_strataer) THEN
    423436      !On ajoute les variables 3D traceurs par l interface fortran
     
    510523      CALL histwrite_phy(o_aire, zx_tmp_fi2d)
    511524
    512       DO i = 1, klon
    513         zx_tmp_fi2d(i) = pctsrf(i, is_ter) + pctsrf(i, is_lic)
    514       ENDDO
    515       CALL histwrite_phy(o_contfracATM, zx_tmp_fi2d)
    516       CALL histwrite_phy(o_contfracOR, pctsrf(:, is_ter))
     525      ! DO i = 1, klon
     526      !   zx_tmp_fi2d(i) = pctsrf(i, is_ter) + pctsrf(i, is_lic)
     527      ! ENDDO
     528      ! CALL histwrite_phy(o_contfracATM, zx_tmp_fi2d)
     529      !CALL histwrite_phy(o_contfracOR, pctsrf(:, is_ter))
    517530      CALL histwrite_phy("R_ecc", R_ecc)
    518531      CALL histwrite_phy("R_peri", R_peri)
     
    580593      CALL histwrite_phy(o_tsol, zxtsol)
    581594      CALL histwrite_phy(o_t2m, zt2m_cor)
    582       CALL histwrite_phy(o_t2m_min, zt2m_cor)
    583       CALL histwrite_phy(o_t2m_max, zt2m_cor)
     595      !CALL histwrite_phy(o_t2m_min, zt2m_cor)
     596      !CALL histwrite_phy(o_t2m_max, zt2m_cor)
    584597      CALL histwrite_phy(o_t2m_max_mon, t2m_max_mon)
    585598      CALL histwrite_phy(o_t2m_min_mon, t2m_min_mon)
    586       DO i = 1, klon
    587         zx_tmp_fi2d(i) = SQRT(zu10m_cor(i)*zu10m_cor(i) + zv10m_cor(i)*zv10m_cor(i))
    588       ENDDO
    589       CALL histwrite_phy(o_wind10m, zx_tmp_fi2d)
    590       DO i = 1, klon
    591         zx_tmp_fi2d(i) = SQRT(zu10m_cor(i)*zu10m_cor(i) + zv10m_cor(i)*zv10m_cor(i))
    592       ENDDO
    593       CALL histwrite_phy(o_wind10max, zx_tmp_fi2d)
     599      ! DO i = 1, klon
     600      !   zx_tmp_fi2d(i) = SQRT(zu10m_cor(i)*zu10m_cor(i) + zv10m_cor(i)*zv10m_cor(i))
     601      ! ENDDO
     602      ! CALL histwrite_phy(o_wind10m, zx_tmp_fi2d)
     603      ! DO i = 1, klon
     604      !   zx_tmp_fi2d(i) = SQRT(zu10m_cor(i)*zu10m_cor(i) + zv10m_cor(i)*zv10m_cor(i))
     605      ! ENDDO
     606      ! CALL histwrite_phy(o_wind10max, zx_tmp_fi2d)
    594607
    595608      CALL histwrite_phy(o_gusts, gustiness)
     
    615628        ENDDO
    616629      ENDDO
    617     CALL histwrite_phy(o_wind100m, zx_tmp_fi2d)
    618     IF (vars_defined) THEN
    619       DO i = 1, klon
    620         zx_tmp_fi2d(i) = pctsrf(i, is_sic)
    621       ENDDO
    622     ENDIF
    623       CALL histwrite_phy(o_sicf, zx_tmp_fi2d)
     630      CALL histwrite_phy(o_wind100m, zx_tmp_fi2d)
     631      !CALL histwrite_phy(o_sicf, pctsrf(1:klon, is_sic))
    624632      CALL histwrite_phy(o_q2m, zq2m_cor)
    625633      CALL histwrite_phy(o_ustar, zustar)
    626634      CALL histwrite_phy(o_u10m, zu10m_cor)
    627635      CALL histwrite_phy(o_v10m, zv10m_cor)
    628       DO i = 1, klon
    629         zx_tmp_fi2d(i) = paprs(i, 1)
    630       ENDDO
    631 
    632       CALL histwrite_phy(o_psol, zx_tmp_fi2d)
     636      CALL histwrite_phy(o_psol, paprs(1:klon, 1))
    633637      CALL histwrite_phy(o_mass, zmasse)
    634638      CALL histwrite_phy(o_qsurf, zxqsurf)
     
    638642      ENDIF
    639643
    640       DO i = 1, klon
    641         zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
    642       ENDDO
    643 
    644       CALL histwrite_phy(o_precip, zx_tmp_fi2d)
     644      ! DO i = 1, klon
     645      !   zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
     646      ! ENDDO
     647      ! CALL histwrite_phy(o_precip, zx_tmp_fi2d)
    645648      CALL histwrite_phy(o_rain_fall, rain_fall)
    646649      CALL histwrite_phy(o_ndayrain, nday_rain)
    647650      CALL histwrite_phy(o_ep, ep)
    648651     
    649       DO i = 1, klon
    650         zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
    651       ENDDO
    652       CALL histwrite_phy(o_plul, zx_tmp_fi2d)
     652      ! DO i = 1, klon
     653      !   zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
     654      ! ENDDO
     655      ! CALL histwrite_phy(o_plul, zx_tmp_fi2d)
     656      CALL histwrite_phy(o_plul, rain_lsc)
    653657      CALL histwrite_phy(o_plun, rain_num)
    654658
    655       DO i = 1, klon
    656         zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
    657       ENDDO
    658       CALL histwrite_phy(o_pluc, zx_tmp_fi2d)
    659       CALL histwrite_phy(o_rain_con, rain_con)
     659      ! DO i = 1, klon
     660      !   zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
     661      ! ENDDO
     662      ! CALL histwrite_phy(o_pluc, zx_tmp_fi2d)
     663      CALL histwrite_phy(o_pluc, snow_con)
     664      CALL histwrite_phy(o_rain_con, rain_con)     
    660665      CALL histwrite_phy(o_snow, snow_fall)
    661666      CALL histwrite_phy(o_msnow, zxsnow)
     
    663668      CALL histwrite_phy(o_evap, evap)
    664669
    665 
    666       zx_tmp_fi2d = topsw*swradcorr
    667       CALL histwrite_phy(o_tops, zx_tmp_fi2d)
    668       zx_tmp_fi2d = topsw0*swradcorr
    669       CALL histwrite_phy(o_tops0, zx_tmp_fi2d)
     670     
     671
    670672      CALL histwrite_phy(o_topl, toplw)
    671673      CALL histwrite_phy(o_topl0, toplw0)
    672       zx_tmp_fi2d(:) = swup(:, klevp1)*swradcorr(:)
    673       CALL histwrite_phy(o_SWupTOA, zx_tmp_fi2d)
    674       zx_tmp_fi2d(:) = swup0(:, klevp1)*swradcorr(:)
    675       CALL histwrite_phy(o_SWupTOAclr, zx_tmp_fi2d)
    676       zx_tmp_fi2d(:) = swupc0(:, klevp1)*swradcorr(:)
    677       CALL histwrite_phy(o_SWupTOAcleanclr, zx_tmp_fi2d)
    678       zx_tmp_fi2d(:) = swdn(:, klevp1)*swradcorr(:)
    679       CALL histwrite_phy(o_SWdnTOA, zx_tmp_fi2d)
    680       zx_tmp_fi2d(:) = swdn0(:, klevp1)*swradcorr(:)
    681       CALL histwrite_phy(o_SWdnTOAclr, zx_tmp_fi2d)
    682       zx_tmp_fi2d(:) = topsw(:)*swradcorr(:) - toplw(:)
    683       CALL histwrite_phy(o_nettop, zx_tmp_fi2d)
    684       zx_tmp_fi2d = SWup200*swradcorr
    685       CALL histwrite_phy(o_SWup200, zx_tmp_fi2d)
    686       zx_tmp_fi2d = SWup200clr*swradcorr
    687       CALL histwrite_phy(o_SWup200clr, zx_tmp_fi2d)
    688       zx_tmp_fi2d = SWdn200*swradcorr
    689       CALL histwrite_phy(o_SWdn200, zx_tmp_fi2d)
    690       zx_tmp_fi2d = SWdn200clr*swradcorr
    691       CALL histwrite_phy(o_SWdn200clr, zx_tmp_fi2d)
     674
     675      ! zx_tmp_fi2d = topsw*swradcorr
     676      ! CALL histwrite_phy(o_tops, zx_tmp_fi2d)     
     677      ! zx_tmp_fi2d = topsw0*swradcorr
     678      ! CALL histwrite_phy(o_tops0, zx_tmp_fi2d)     
     679      ! zx_tmp_fi2d(:) = swup(:, klevp1)*swradcorr(:)
     680      ! CALL histwrite_phy(o_SWupTOA, zx_tmp_fi2d)
     681      ! zx_tmp_fi2d(:) = swup0(:, klevp1)*swradcorr(:)
     682      ! CALL histwrite_phy(o_SWupTOAclr, zx_tmp_fi2d)
     683      ! zx_tmp_fi2d(:) = swupc0(:, klevp1)*swradcorr(:)
     684      ! CALL histwrite_phy(o_SWupTOAcleanclr, zx_tmp_fi2d)
     685      ! zx_tmp_fi2d(:) = swdn(:, klevp1)*swradcorr(:)
     686      ! CALL histwrite_phy(o_SWdnTOA, zx_tmp_fi2d)
     687      ! zx_tmp_fi2d(:) = swdn0(:, klevp1)*swradcorr(:)
     688      ! CALL histwrite_phy(o_SWdnTOAclr, zx_tmp_fi2d)
     689      ! zx_tmp_fi2d(:) = topsw(:)*swradcorr(:) - toplw(:)
     690      ! CALL histwrite_phy(o_nettop, zx_tmp_fi2d)
     691      ! zx_tmp_fi2d = SWup200*swradcorr
     692      ! CALL histwrite_phy(o_SWup200, zx_tmp_fi2d)
     693      ! zx_tmp_fi2d = SWup200clr*swradcorr
     694      ! CALL histwrite_phy(o_SWup200clr, zx_tmp_fi2d)
     695      ! zx_tmp_fi2d = SWdn200*swradcorr
     696      ! CALL histwrite_phy(o_SWdn200, zx_tmp_fi2d)
     697      ! zx_tmp_fi2d = SWdn200clr*swradcorr
     698      ! CALL histwrite_phy(o_SWdn200clr, zx_tmp_fi2d)
     699      ! zx_tmp_fi2d = solsw*swradcorr
     700      ! CALL histwrite_phy(o_sols, zx_tmp_fi2d)
     701      ! zx_tmp_fi2d = solsw0*swradcorr
     702      ! CALL histwrite_phy(o_sols0, zx_tmp_fi2d)
     703      ! zx_tmp_fi2d(:) = swup(:, 1)*swradcorr(:)
     704      ! CALL histwrite_phy(o_SWupSFC, zx_tmp_fi2d)
     705      ! zx_tmp_fi2d(:) = swup0(:, 1)*swradcorr(:)
     706      ! CALL histwrite_phy(o_SWupSFCclr, zx_tmp_fi2d)
     707      ! zx_tmp_fi2d(:) = swupc0(:, 1)*swradcorr(:)
     708      ! CALL histwrite_phy(o_SWupSFCcleanclr, zx_tmp_fi2d)
     709      ! zx_tmp_fi2d(:) = swdn(:, 1)*swradcorr(:)
     710      ! CALL histwrite_phy(o_SWdnSFC, zx_tmp_fi2d)
     711      ! zx_tmp_fi2d(:) = swdn0(:, 1)*swradcorr(:)
     712      ! CALL histwrite_phy(o_SWdnSFCclr, zx_tmp_fi2d)
     713      ! zx_tmp_fi2d(:) = swdnc0(:, 1)*swradcorr(:)
     714      ! CALL histwrite_phy(o_SWdnSFCcleanclr, zx_tmp_fi2d)
     715      CALL histwrite_phy(o_swradcorr, swradcorr)
     716      CALL histwrite_phy(o_tops, topsw)
     717      CALL histwrite_phy(o_tops0, topsw0)
     718      CALL histwrite_phy(o_SWupTOA, swup(:, klevp1))
     719      CALL histwrite_phy(o_SWupTOAclr, swup0(:, klevp1))
     720      CALL histwrite_phy(o_SWupTOAcleanclr, swupc0(:, klevp1))
     721      CALL histwrite_phy(o_SWdnTOA, swdn(:, klevp1))
     722      CALL histwrite_phy(o_SWdnTOAclr, swdn0(:, klevp1))
     723      CALL histwrite_phy(o_SWup200, SWup200)
     724      CALL histwrite_phy(o_SWup200clr, SWup200clr)
     725      CALL histwrite_phy(o_SWdn200, SWdn200)
     726      CALL histwrite_phy(o_SWdn200clr, SWdn200clr)
     727
     728      CALL histwrite_phy(o_SWupSFC, swup(:, 1))
     729      CALL histwrite_phy(o_SWupSFCclr, swup0(:, 1))
     730      CALL histwrite_phy(o_SWupSFCcleanclr, swupc0(:, 1))
     731      CALL histwrite_phy(o_SWdnSFC, swdn(:, 1))
     732      CALL histwrite_phy(o_SWdnSFCclr, swdn0(:, 1))
     733      CALL histwrite_phy(o_SWdnSFCcleanclr, swdnc0(:, 1))
     734
    692735      CALL histwrite_phy(o_LWup200, LWup200)
    693736      CALL histwrite_phy(o_LWup200clr, LWup200clr)
    694737      CALL histwrite_phy(o_LWdn200, LWdn200)
    695738      CALL histwrite_phy(o_LWdn200clr, LWdn200clr)
    696       zx_tmp_fi2d = solsw*swradcorr
    697       CALL histwrite_phy(o_sols, zx_tmp_fi2d)
    698       zx_tmp_fi2d = solsw0*swradcorr
    699       CALL histwrite_phy(o_sols0, zx_tmp_fi2d)
     739     
     740      CALL histwrite_phy(o_sols, solsw)
     741      CALL histwrite_phy(o_sols0, solsw0)
    700742      CALL histwrite_phy(o_soll, sollw)
    701743      CALL histwrite_phy(o_soll0, sollw0)
    702744      CALL histwrite_phy(o_radsol, radsol)
    703       zx_tmp_fi2d(:) = swup(:, 1)*swradcorr(:)
    704       CALL histwrite_phy(o_SWupSFC, zx_tmp_fi2d)
    705       zx_tmp_fi2d(:) = swup0(:, 1)*swradcorr(:)
    706       CALL histwrite_phy(o_SWupSFCclr, zx_tmp_fi2d)
    707       zx_tmp_fi2d(:) = swupc0(:, 1)*swradcorr(:)
    708       CALL histwrite_phy(o_SWupSFCcleanclr, zx_tmp_fi2d)
    709       zx_tmp_fi2d(:) = swdn(:, 1)*swradcorr(:)
    710       CALL histwrite_phy(o_SWdnSFC, zx_tmp_fi2d)
    711       zx_tmp_fi2d(:) = swdn0(:, 1)*swradcorr(:)
    712       CALL histwrite_phy(o_SWdnSFCclr, zx_tmp_fi2d)
    713       zx_tmp_fi2d(:) = swdnc0(:, 1)*swradcorr(:)
    714       CALL histwrite_phy(o_SWdnSFCcleanclr, zx_tmp_fi2d)
    715       zx_tmp_fi2d(:) = sollwdown(:) - sollw(:)
    716       CALL histwrite_phy(o_LWupSFC, zx_tmp_fi2d)
     745
    717746      CALL histwrite_phy(o_LWdnSFC, sollwdown)
    718       sollwdownclr(1:klon) = -1.*lwdn0(1:klon, 1)
    719       zx_tmp_fi2d(1:klon) = sollwdownclr(1:klon) - sollw0(1:klon)
    720       CALL histwrite_phy(o_LWupSFCclr, zx_tmp_fi2d)
    721       CALL histwrite_phy(o_LWdnSFCclr, sollwdownclr)
    722       zx_tmp_fi2d(:) = lwupc0(:, klevp1)
    723       CALL histwrite_phy(o_LWupTOAcleanclr, zx_tmp_fi2d)
    724       zx_tmp_fi2d(:) = -1.*lwdnc0(:, 1)
    725       CALL histwrite_phy(o_LWdnSFCcleanclr, zx_tmp_fi2d)
     747
     748      !sollwdownclr(1:klon) = -1.*lwdn0(1:klon, 1)
     749      !zx_tmp_fi2d(1:klon) = sollwdownclr(1:klon) - sollw0(1:klon)
     750      !CALL histwrite_phy(o_LWupSFCclr, zx_tmp_fi2d)
     751      !CALL histwrite_phy(o_LWdnSFCclr, sollwdownclr)
     752      CALL histwrite_phy(o_LWdnSFCclr, lwdn0(1:klon, 1))
     753      CALL histwrite_phy(o_LWupTOAcleanclr, lwupc0(:, klevp1))
     754      ! zx_tmp_fi2d(:) = -1.*lwdnc0(:, 1)
     755      ! CALL histwrite_phy(o_LWdnSFCcleanclr, zx_tmp_fi2d)
     756      CALL histwrite_phy(o_LWdnSFCcleanclr, lwdnc0(:, 1))
    726757      CALL histwrite_phy(o_bils, bils)
    727758      CALL histwrite_phy(o_bils_diss, bils_diss)
     
    732763      CALL histwrite_phy(o_bils_latent, bils_latent)
    733764      CALL histwrite_phy(o_bils_enthalp, bils_enthalp)
    734       zx_tmp_fi2d(1:klon) = -1*sens(1:klon)
    735       CALL histwrite_phy(o_sens, zx_tmp_fi2d)
     765      ! zx_tmp_fi2d(1:klon) = -1*sens(1:klon)
     766      ! CALL histwrite_phy(o_sens, zx_tmp_fi2d)
     767      CALL histwrite_phy(o_sens, sens(1:klon))
    736768      CALL histwrite_phy(o_fder, fder)
    737769      CALL histwrite_phy(o_ffonte, zxffonte)
    738770      CALL histwrite_phy(o_fqcalving, zxfqcalving)
    739771      CALL histwrite_phy(o_fqfonte, zxfqfonte)
    740       zx_tmp_fi2d(1:klon) = (zxfqfonte(1:klon) + rain_fall(1:klon))*pctsrf(1:klon, is_lic)
    741       CALL histwrite_phy(o_mrroli, zx_tmp_fi2d)
     772      ! zx_tmp_fi2d(1:klon) = (zxfqfonte(1:klon) + rain_fall(1:klon))*pctsrf(1:klon, is_lic)
     773      ! CALL histwrite_phy(o_mrroli, zx_tmp_fi2d)
    742774      CALL histwrite_phy(o_runofflic, zxrunofflic)
    743       zx_tmp_fi2d = 0.
    744       DO nsrf = 1, nbsrf
    745         zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + pctsrf(:, nsrf)*fluxu(:, 1, nsrf)
    746       ENDDO
    747       CALL histwrite_phy(o_taux, zx_tmp_fi2d)
    748 
    749       zx_tmp_fi2d = 0.
    750       DO nsrf = 1, nbsrf
    751         zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + pctsrf(:, nsrf)*fluxv(:, 1, nsrf)
    752       ENDDO
    753       CALL histwrite_phy(o_tauy, zx_tmp_fi2d)
     775      ! zx_tmp_fi2d = 0.
     776      ! DO nsrf = 1, nbsrf
     777      !   zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + pctsrf(:, nsrf)*fluxu(:, 1, nsrf)
     778      ! ENDDO
     779      ! CALL histwrite_phy(o_taux, zx_tmp_fi2d)
     780      ! zx_tmp_fi2d = 0.
     781      ! DO nsrf = 1, nbsrf
     782      !   zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + pctsrf(:, nsrf)*fluxv(:, 1, nsrf)
     783      ! ENDDO
     784      ! CALL histwrite_phy(o_tauy, zx_tmp_fi2d)
    754785
    755786      IF (ok_snow) THEN
     
    764795   
    765796      DO nsrf = 1, nbsrf
    766         zx_tmp_fi2d(1:klon) = pctsrf(1:klon, nsrf)*100.
    767         CALL histwrite_phy(o_pourc_srf(nsrf), zx_tmp_fi2d)
    768         zx_tmp_fi2d(1:klon) = pctsrf(1:klon, nsrf)
    769         CALL histwrite_phy(o_fract_srf(nsrf), zx_tmp_fi2d)
    770         zx_tmp_fi2d(1:klon) = fluxu(1:klon, 1, nsrf)
    771         CALL histwrite_phy(o_taux_srf(nsrf), zx_tmp_fi2d)
    772         zx_tmp_fi2d(1:klon) = fluxv(1:klon, 1, nsrf)
    773         CALL histwrite_phy(o_tauy_srf(nsrf), zx_tmp_fi2d)
    774         zx_tmp_fi2d(1:klon) = ftsol(1:klon, nsrf)
    775         CALL histwrite_phy(o_tsol_srf(nsrf), zx_tmp_fi2d)
    776         zx_tmp_fi2d(1:klon) = evap_pot(1:klon, nsrf)
    777         CALL histwrite_phy(o_evappot_srf(nsrf), zx_tmp_fi2d)
    778         zx_tmp_fi2d(1:klon) = ustar(1:klon, nsrf)
    779         CALL histwrite_phy(o_ustar_srf(nsrf), zx_tmp_fi2d)
    780         zx_tmp_fi2d(1:klon) = u10m(1:klon, nsrf)
    781         CALL histwrite_phy(o_u10m_srf(nsrf), zx_tmp_fi2d)
    782         zx_tmp_fi2d(1:klon) = v10m(1:klon, nsrf)
    783         CALL histwrite_phy(o_v10m_srf(nsrf), zx_tmp_fi2d)
    784         zx_tmp_fi2d(1:klon) = t2m(1:klon, nsrf)
    785         CALL histwrite_phy(o_t2m_srf(nsrf), zx_tmp_fi2d)
    786         zx_tmp_fi2d(1:klon) = fevap(1:klon, nsrf)
    787         CALL histwrite_phy(o_evap_srf(nsrf), zx_tmp_fi2d)
    788         zx_tmp_fi2d(1:klon) = fluxt(1:klon, 1, nsrf)
    789         CALL histwrite_phy(o_sens_srf(nsrf), zx_tmp_fi2d)
    790         zx_tmp_fi2d(1:klon) = fluxlat(1:klon, nsrf)
    791         CALL histwrite_phy(o_lat_srf(nsrf), zx_tmp_fi2d)
    792         zx_tmp_fi2d(1:klon) = fsollw(1:klon, nsrf)
    793         CALL histwrite_phy(o_flw_srf(nsrf), zx_tmp_fi2d)
    794         zx_tmp_fi2d(1:klon) = fsolsw(1:klon, nsrf)
    795         CALL histwrite_phy(o_fsw_srf(nsrf), zx_tmp_fi2d)
    796         zx_tmp_fi2d(1:klon) = wfbils(1:klon, nsrf)
    797         CALL histwrite_phy(o_wbils_srf(nsrf), zx_tmp_fi2d)
    798         zx_tmp_fi2d(1:klon) = wfbilo(1:klon, nsrf)
    799         CALL histwrite_phy(o_wbilo_srf(nsrf), zx_tmp_fi2d)
    800         zx_tmp_fi2d(1:klon) = wfevap(1:klon, nsrf)
    801         CALL histwrite_phy(o_wevap_srf(nsrf), zx_tmp_fi2d)
    802         zx_tmp_fi2d(1:klon) = wfrain(1:klon, nsrf)
    803         CALL histwrite_phy(o_wrain_srf(nsrf), zx_tmp_fi2d)
    804         zx_tmp_fi2d(1:klon) = wfsnow(1:klon, nsrf)
    805         CALL histwrite_phy(o_wsnow_srf(nsrf), zx_tmp_fi2d)
     797        ! zx_tmp_fi2d(1:klon) = pctsrf(1:klon, nsrf)*100.
     798        ! CALL histwrite_phy(o_pourc_srf(nsrf), zx_tmp_fi2d)
     799        CALL histwrite_phy(o_fract_srf(nsrf), pctsrf(1:klon, nsrf))
     800        CALL histwrite_phy(o_taux_srf(nsrf), fluxu(1:klon, 1, nsrf))
     801        CALL histwrite_phy(o_tauy_srf(nsrf), fluxv(1:klon, 1, nsrf))
     802        CALL histwrite_phy(o_tsol_srf(nsrf), ftsol(1:klon, nsrf))
     803        CALL histwrite_phy(o_evappot_srf(nsrf), evap_pot(1:klon, nsrf))
     804        CALL histwrite_phy(o_ustar_srf(nsrf), ustar(1:klon, nsrf))
     805        CALL histwrite_phy(o_u10m_srf(nsrf), u10m(1:klon, nsrf))
     806        CALL histwrite_phy(o_v10m_srf(nsrf), v10m(1:klon, nsrf))
     807        CALL histwrite_phy(o_t2m_srf(nsrf), t2m(1:klon, nsrf))
     808        CALL histwrite_phy(o_evap_srf(nsrf), fevap(1:klon, nsrf))
     809        CALL histwrite_phy(o_sens_srf(nsrf), fluxt(1:klon, 1, nsrf))
     810        CALL histwrite_phy(o_lat_srf(nsrf), fluxlat(1:klon, nsrf))
     811        CALL histwrite_phy(o_flw_srf(nsrf), fsollw(1:klon, nsrf))
     812        CALL histwrite_phy(o_fsw_srf(nsrf), fsolsw(1:klon, nsrf))
     813        CALL histwrite_phy(o_wbils_srf(nsrf), wfbils(1:klon, nsrf))
     814        CALL histwrite_phy(o_wbilo_srf(nsrf), wfbilo(1:klon, nsrf))
     815        CALL histwrite_phy(o_wevap_srf(nsrf), wfevap(1:klon, nsrf))
     816        CALL histwrite_phy(o_wrain_srf(nsrf), wfrain(1:klon, nsrf))
     817        CALL histwrite_phy(o_wsnow_srf(nsrf), wfsnow(1:klon, nsrf))
    806818
    807819        IF (iflag_pbl > 1) THEN
    808820          CALL histwrite_phy(o_tke_srf(nsrf), pbl_tke(:, 1:klev, nsrf))
    809821          CALL histwrite_phy(o_l_mixmin(nsrf), l_mixmin(:, 1:klev, nsrf))
    810           CALL histwrite_phy(o_tke_max_srf(nsrf), pbl_tke(:, 1:klev, nsrf))
     822          !CALL histwrite_phy(o_tke_max_srf(nsrf), pbl_tke(:, 1:klev, nsrf))
    811823        ENDIF
    812824        IF (iflag_pbl > 1 .AND. iflag_wake >= 1 .AND. iflag_pbl_split >= 1) THEN
     
    815827      ENDDO
    816828
    817       zx_tmp_fi2d(1:klon) = sens_prec_liq_o(1:klon, 1)
    818       CALL histwrite_phy(o_sens_prec_liq_oce, zx_tmp_fi2d)
    819       zx_tmp_fi2d(1:klon) = sens_prec_liq_o(1:klon, 2)
    820       CALL histwrite_phy(o_sens_prec_liq_sic, zx_tmp_fi2d)
    821       zx_tmp_fi2d(1:klon) = sens_prec_sol_o(1:klon, 1)
    822       CALL histwrite_phy(o_sens_prec_sol_oce, zx_tmp_fi2d)
    823       zx_tmp_fi2d(1:klon) = sens_prec_sol_o(1:klon, 2)
    824       CALL histwrite_phy(o_sens_prec_sol_sic, zx_tmp_fi2d)
    825 
    826       zx_tmp_fi2d(1:klon) = lat_prec_liq_o(1:klon, 1)
    827       CALL histwrite_phy(o_lat_prec_liq_oce, zx_tmp_fi2d)
    828       zx_tmp_fi2d(1:klon) = lat_prec_liq_o(1:klon, 2)
    829       CALL histwrite_phy(o_lat_prec_liq_sic, zx_tmp_fi2d)
    830       zx_tmp_fi2d(1:klon) = lat_prec_sol_o(1:klon, 1)
    831       CALL histwrite_phy(o_lat_prec_sol_oce, zx_tmp_fi2d)
    832       zx_tmp_fi2d(1:klon) = lat_prec_sol_o(1:klon, 2)
    833       CALL histwrite_phy(o_lat_prec_sol_sic, zx_tmp_fi2d)
     829      CALL histwrite_phy(o_sens_prec_liq_oce, sens_prec_liq_o(1:klon, 1))
     830      CALL histwrite_phy(o_sens_prec_liq_sic, sens_prec_liq_o(1:klon, 2))
     831      CALL histwrite_phy(o_sens_prec_sol_oce, sens_prec_sol_o(1:klon, 1))
     832      CALL histwrite_phy(o_sens_prec_sol_sic, sens_prec_sol_o(1:klon, 2))
     833
     834      CALL histwrite_phy(o_lat_prec_liq_oce, lat_prec_liq_o(1:klon, 1))
     835      CALL histwrite_phy(o_lat_prec_liq_sic, lat_prec_liq_o(1:klon, 2))
     836      CALL histwrite_phy(o_lat_prec_sol_oce, lat_prec_sol_o(1:klon, 1))
     837      CALL histwrite_phy(o_lat_prec_sol_sic, lat_prec_sol_o(1:klon, 2))
    834838
    835839      DO nsrf = 1, nbsrf + 1
     
    845849      CALL histwrite_phy(o_JrNt, JrNt)
    846850
    847       zx_tmp_fi2d = cldl*JrNt
    848       CALL histwrite_phy(o_cldljn, zx_tmp_fi2d)
    849 
    850       zx_tmp_fi2d = cldm*JrNt
    851       CALL histwrite_phy(o_cldmjn, zx_tmp_fi2d)
    852 
    853       zx_tmp_fi2d = cldh*JrNt
    854       CALL histwrite_phy(o_cldhjn, zx_tmp_fi2d)
    855 
    856       zx_tmp_fi2d = cldt*JrNt
    857       CALL histwrite_phy(o_cldtjn, zx_tmp_fi2d)
     851      ! zx_tmp_fi2d = cldl*JrNt
     852      ! CALL histwrite_phy(o_cldljn, zx_tmp_fi2d)
     853      ! zx_tmp_fi2d = cldm*JrNt
     854      ! CALL histwrite_phy(o_cldmjn, zx_tmp_fi2d)
     855      ! zx_tmp_fi2d = cldh*JrNt
     856      ! CALL histwrite_phy(o_cldhjn, zx_tmp_fi2d)
     857      ! zx_tmp_fi2d = cldt*JrNt
     858      ! CALL histwrite_phy(o_cldtjn, zx_tmp_fi2d)
    858859
    859860      CALL histwrite_phy(o_cldq, cldq)
    860       zx_tmp_fi2d(1:klon) = flwp(1:klon)
    861       CALL histwrite_phy(o_lwp, zx_tmp_fi2d)
    862       zx_tmp_fi2d(1:klon) = fiwp(1:klon)
    863       CALL histwrite_phy(o_iwp, zx_tmp_fi2d)
     861      CALL histwrite_phy(o_lwp, flwp(1:klon))
     862      CALL histwrite_phy(o_iwp, fiwp(1:klon))
    864863      CALL histwrite_phy(o_ue, ue)
    865864      CALL histwrite_phy(o_ve, ve)
     
    868867      CALL histwrite_phy(o_uwat, uwat)
    869868      CALL histwrite_phy(o_vwat, vwat)
    870    
     869
    871870      IF (iflag_con .GE. 3) THEN ! sb
    872871        CALL histwrite_phy(o_cape, cape)
     
    881880        ENDIF
    882881
    883         CALL histwrite_phy(o_cape_max, cape)
     882        !CALL histwrite_phy(o_cape_max, cape)
    884883
    885884        CALL histwrite_phy(o_upwd, upwd)
     
    891890            !! convection (output of the 3 fields: ftime_deepcv, ftime_th and
    892891            !!  ftime_con).
    893         IF (iflag_thermals >= 1) THEN
    894           zx_tmp_fi3d = -dnwd + dnwd0 + upwd + fm_therm(:, 1:klev)
    895         ELSE
    896           zx_tmp_fi3d = -dnwd + dnwd0 + upwd
    897         ENDIF
    898         CALL histwrite_phy(o_mc, zx_tmp_fi3d)
     892        ! IF (iflag_thermals >= 1) THEN
     893        !   zx_tmp_fi3d = -dnwd + dnwd0 + upwd + fm_therm(:, 1:klev)
     894        ! ELSE
     895        !   zx_tmp_fi3d = -dnwd + dnwd0 + upwd
     896        ! ENDIF
     897        ! CALL histwrite_phy(o_mc, zx_tmp_fi3d)
    899898      ENDIF !iflag_con .GE. 3
    900899      CALL histwrite_phy(o_prw, prw)
     
    922921        ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR.
    923922      ENDDO
    924       DO i = 1, klon
    925         IF (pctsrf(i, is_oce) .GT. epsfra .OR. &
    926             pctsrf(i, is_sic) .GT. epsfra) THEN
    927           zx_tmp_fi2d(i) = (ftsol(i, is_oce)*pctsrf(i, is_oce) + &
    928                             ftsol(i, is_sic)*pctsrf(i, is_sic))/ &
    929                            (pctsrf(i, is_oce) + pctsrf(i, is_sic))
    930         ELSE
    931           zx_tmp_fi2d(i) = 273.15
    932         ENDIF
    933       ENDDO
    934       CALL histwrite_phy(o_t_oce_sic, zx_tmp_fi2d)
     923
     924      if( epsfra /= 1.0E-05 ) call abort_physic("phys_output_write_xios", "epsfra changed and is not synchronized with field_def_lmdz.xml", 1)
     925      ! DO i = 1, klon
     926      !   IF (pctsrf(i, is_oce) .GT. epsfra .OR. &
     927      !       pctsrf(i, is_sic) .GT. epsfra) THEN
     928      !     zx_tmp_fi2d(i) = (ftsol(i, is_oce)*pctsrf(i, is_oce) + &
     929      !                       ftsol(i, is_sic)*pctsrf(i, is_sic))/ &
     930      !                      (pctsrf(i, is_oce) + pctsrf(i, is_sic))
     931      !   ELSE
     932      !     zx_tmp_fi2d(i) = 273.15
     933      !   ENDIF
     934      ! ENDDO
     935      ! CALL histwrite_phy(o_t_oce_sic, zx_tmp_fi2d)
    935936
    936937      ! Couplage convection-couche limite
     
    948949          CALL histwrite_phy(o_alp_wk, alp_wake)
    949950          IF (iflag_pbl_split >= 1) THEN
    950             zx_tmp_fi3d(1:klon, 1:klev) = d_t_vdf_x(1:klon, 1:klev)/pdtphys
    951             CALL histwrite_phy(o_dtvdf_x, zx_tmp_fi3d)
    952             zx_tmp_fi3d(1:klon, 1:klev) = d_t_vdf_w(1:klon, 1:klev)/pdtphys
    953             CALL histwrite_phy(o_dtvdf_w, zx_tmp_fi3d)
    954             zx_tmp_fi3d(1:klon, 1:klev) = d_q_vdf_x(1:klon, 1:klev)/pdtphys
    955             CALL histwrite_phy(o_dqvdf_x, zx_tmp_fi3d)
    956             zx_tmp_fi3d(1:klon, 1:klev) = d_q_vdf_w(1:klon, 1:klev)/pdtphys
    957             CALL histwrite_phy(o_dqvdf_w, zx_tmp_fi3d)
     951            ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_vdf_x(1:klon, 1:klev)/pdtphys
     952            ! CALL histwrite_phy(o_dtvdf_x, zx_tmp_fi3d)
     953            ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_vdf_w(1:klon, 1:klev)/pdtphys
     954            ! CALL histwrite_phy(o_dtvdf_w, zx_tmp_fi3d)
     955            ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_vdf_x(1:klon, 1:klev)/pdtphys
     956            ! CALL histwrite_phy(o_dqvdf_x, zx_tmp_fi3d)
     957            ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_vdf_w(1:klon, 1:klev)/pdtphys
     958            ! CALL histwrite_phy(o_dqvdf_w, zx_tmp_fi3d)
     959            CALL histwrite_phy(o_dtvdf_x, d_t_vdf_x(1:klon, 1:klev))
     960            CALL histwrite_phy(o_dtvdf_w, d_t_vdf_w(1:klon, 1:klev))
     961            CALL histwrite_phy(o_dqvdf_x, d_q_vdf_x(1:klon, 1:klev))
     962            CALL histwrite_phy(o_dqvdf_w, d_q_vdf_w(1:klon, 1:klev))
     963
    958964            CALL histwrite_phy(o_sens_x, sens_x)
    959965            CALL histwrite_phy(o_sens_w, sens_w)
     
    980986          CALL histwrite_phy(o_wake_deltaq, wake_deltaq)
    981987          CALL histwrite_phy(o_wake_omg, wake_omg)
    982           zx_tmp_fi3d(1:klon, 1:klev) = d_t_wake(1:klon, 1:klev) &
    983                                                           /pdtphys
    984           CALL histwrite_phy(o_dtwak, zx_tmp_fi3d)
     988          ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_wake(1:klon, 1:klev) &
     989          !                                                 /pdtphys
     990          ! CALL histwrite_phy(o_dtwak, zx_tmp_fi3d)
     991          ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_wake(1:klon, 1:klev)/pdtphys
     992          ! CALL histwrite_phy(o_dqwak, zx_tmp_fi3d)
     993          CALL histwrite_phy(o_dtwak, d_t_wake(1:klon, 1:klev))
     994          CALL histwrite_phy(o_dqwak, d_q_wake(1:klon, 1:klev))
    985995          zx_tmp_fi3d(1:klon, 1:klev) = d_q_wake(1:klon, 1:klev)/pdtphys
    986           CALL histwrite_phy(o_dqwak, zx_tmp_fi3d)
    987996          CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    988997          CALL histwrite_phy(o_dqwak2d, zx_tmp_fi2d)
     
    10211030        CALL histwrite_phy(o_slab_bils, slab_wfbils)
    10221031        IF (nslay .EQ. 1) THEN
    1023           zx_tmp_fi2d(:) = tslab(:, 1)
    1024           CALL histwrite_phy(o_tslab, zx_tmp_fi2d)
    1025           zx_tmp_fi2d(:) = dt_qflux(:, 1)
    1026           CALL histwrite_phy(o_slab_qflux, zx_tmp_fi2d)
     1032          CALL histwrite_phy(o_tslab, tslab(:, 1))
     1033          CALL histwrite_phy(o_slab_qflux, dt_qflux(:, 1))
    10271034        ELSE
    10281035          CALL histwrite_phy(o_tslab, tslab(:, 1:nslay))
     
    10391046        IF (slab_hdiff) THEN
    10401047          IF (nslay .EQ. 1) THEN
    1041             zx_tmp_fi2d(:) = dt_hdiff(:, 1)
    1042             CALL histwrite_phy(o_slab_hdiff, zx_tmp_fi2d)
     1048            CALL histwrite_phy(o_slab_hdiff, dt_hdiff(:, 1))
    10431049          ELSE
    10441050            CALL histwrite_phy(o_slab_hdiff, dt_hdiff(:, 1:nslay))
     
    10471053        IF (slab_ekman .GT. 0) THEN
    10481054          IF (nslay .EQ. 1) THEN
    1049             zx_tmp_fi2d(:) = dt_ekman(:, 1)
    1050             CALL histwrite_phy(o_slab_ekman, zx_tmp_fi2d)
     1055            CALL histwrite_phy(o_slab_ekman, dt_ekman(:, 1))
    10511056          ELSE
    10521057            CALL histwrite_phy(o_slab_ekman, dt_ekman(:, 1:nslay))
     
    10641069      CALL histwrite_phy(o_re, re)
    10651070      CALL histwrite_phy(o_fl, fl)
    1066       DO i = 1, klon
    1067         zx_tmp_fi2d(i) = MIN(100., rh2m(i)*100.)
    1068       ENDDO
    1069       CALL histwrite_phy(o_rh2m, zx_tmp_fi2d)
     1071      ! DO i = 1, klon
     1072      !   zx_tmp_fi2d(i) = MIN(100., rh2m(i)*100.)
     1073      ! ENDDO
     1074      ! CALL histwrite_phy(o_rh2m, zx_tmp_fi2d)
     1075      CALL histwrite_phy(o_rh2m, rh2m)
    10701076      CALL histwrite_phy(o_qsat2m, zqsat2m_cor)
    10711077      CALL histwrite_phy(o_tpot, tpot)
    10721078      CALL histwrite_phy(o_tpote, tpote)
    1073       zx_tmp_fi2d(1:klon) = fsolsw(1:klon, is_ter)
    1074       CALL histwrite_phy(o_SWnetOR, zx_tmp_fi2d)
    1075       CALL histwrite_phy(o_LWdownOR, sollwdown)
     1079      !CALL histwrite_phy(o_SWnetOR, fsolsw(1:klon, is_ter))
     1080      !CALL histwrite_phy(o_LWdownOR, sollwdown)
    10761081      CALL histwrite_phy(o_snowl, snow_lsc)
    1077       CALL histwrite_phy(o_solldown, sollwdown)
     1082      !CALL histwrite_phy(o_solldown, sollwdown)
    10781083      CALL histwrite_phy(o_dtsvdfo, d_ts(:, is_oce))
    10791084      CALL histwrite_phy(o_dtsvdft, d_ts(:, is_ter))
     
    11411146      END DO
    11421147      CALL histwrite_phy(o_col_O3_tropo, zx_tmp_fi2d)   ! Added ThL
     1148      CALL histwrite_phy(o_wo_1, wo(:,:,1))
    11431149
    11441150      IF (ok_strataer .and. type_trac == 'coag') THEN
     
    11821188        ENDDO
    11831189        CALL histwrite_phy(o_heat_volc, zx_tmp_fi3d)
    1184         DO k = 1, klev
    1185           zx_tmp_fi3d(:, k) = cool_volc(:, k)
    1186         ENDDO
    1187         CALL histwrite_phy(o_cool_volc, zx_tmp_fi3d)
     1190        ! DO k = 1, klev
     1191        !   zx_tmp_fi3d(:, k) = cool_volc(:, k)
     1192        ! ENDDO
     1193        ! CALL histwrite_phy(o_cool_volc, zx_tmp_fi3d)
     1194        CALL histwrite_phy(o_cool_volc, cool_volc)
    11881195      ENDIF
    11891196      IF (ok_ade) THEN
    1190         zx_tmp_fi2d(:) = topswad_aero*swradcorr
    1191         CALL histwrite_phy(o_topswad, zx_tmp_fi2d)
    1192 
    1193         zx_tmp_fi2d(:) = topswad0_aero*swradcorr
    1194         CALL histwrite_phy(o_topswad0, zx_tmp_fi2d)
    1195 
    1196         zx_tmp_fi2d(:) = solswad_aero*swradcorr
    1197         CALL histwrite_phy(o_solswad, zx_tmp_fi2d)
    1198 
    1199         zx_tmp_fi2d(:) = solswad0_aero*swradcorr
    1200         CALL histwrite_phy(o_solswad0, zx_tmp_fi2d)
     1197        ! zx_tmp_fi2d(:) = topswad_aero*swradcorr
     1198        ! CALL histwrite_phy(o_topswad, zx_tmp_fi2d)
     1199
     1200        ! zx_tmp_fi2d(:) = topswad0_aero*swradcorr
     1201        ! CALL histwrite_phy(o_topswad0, zx_tmp_fi2d)
     1202
     1203        ! zx_tmp_fi2d(:) = solswad_aero*swradcorr
     1204        ! CALL histwrite_phy(o_solswad, zx_tmp_fi2d)
     1205
     1206        ! zx_tmp_fi2d(:) = solswad0_aero*swradcorr
     1207        ! CALL histwrite_phy(o_solswad0, zx_tmp_fi2d)
     1208
     1209        CALL histwrite_phy(o_topswad, topswad_aero)
     1210        CALL histwrite_phy(o_topswad0, topswad0_aero)
     1211        CALL histwrite_phy(o_solswad, solswad_aero)
     1212        CALL histwrite_phy(o_solswad0, solswad0_aero)
    12011213
    12021214        CALL histwrite_phy(o_toplwad, toplwad_aero)
     
    12081220        !ym => init to 0 in radlwsw_m.F90 ztopsw_aero, zsolsw_aero, ztopsw0_aero, zsolsw0_aero
    12091221
    1210         zx_tmp_fi2d(:) = topsw_aero(:, 1)*swradcorr(:)
    1211         CALL histwrite_phy(o_swtoaas_nat, zx_tmp_fi2d)
    1212         zx_tmp_fi2d(:) = solsw_aero(:, 1)*swradcorr(:)
    1213         CALL histwrite_phy(o_swsrfas_nat, zx_tmp_fi2d)
    1214         zx_tmp_fi2d(:) = topsw0_aero(:, 1)*swradcorr(:)
    1215         CALL histwrite_phy(o_swtoacs_nat, zx_tmp_fi2d)
    1216         zx_tmp_fi2d(:) = solsw0_aero(:, 1)*swradcorr(:)
    1217         CALL histwrite_phy(o_swsrfcs_nat, zx_tmp_fi2d)
     1222        ! zx_tmp_fi2d(:) = topsw_aero(:, 1)*swradcorr(:)
     1223        ! CALL histwrite_phy(o_swtoaas_nat, zx_tmp_fi2d)
     1224        ! zx_tmp_fi2d(:) = solsw_aero(:, 1)*swradcorr(:)
     1225        ! CALL histwrite_phy(o_swsrfas_nat, zx_tmp_fi2d)
     1226        ! zx_tmp_fi2d(:) = topsw0_aero(:, 1)*swradcorr(:)
     1227        ! CALL histwrite_phy(o_swtoacs_nat, zx_tmp_fi2d)
     1228        ! zx_tmp_fi2d(:) = solsw0_aero(:, 1)*swradcorr(:)
     1229        ! CALL histwrite_phy(o_swsrfcs_nat, zx_tmp_fi2d)
     1230        ! !ant
     1231        ! zx_tmp_fi2d(:) = topsw_aero(:, 2)*swradcorr(:)
     1232        ! CALL histwrite_phy(o_swtoaas_ant, zx_tmp_fi2d)
     1233        ! zx_tmp_fi2d(:) = solsw_aero(:, 2)*swradcorr(:)
     1234        ! CALL histwrite_phy(o_swsrfas_ant, zx_tmp_fi2d)
     1235        ! zx_tmp_fi2d(:) = topsw0_aero(:, 2)*swradcorr(:)
     1236        ! CALL histwrite_phy(o_swtoacs_ant, zx_tmp_fi2d)
     1237        ! zx_tmp_fi2d(:) = solsw0_aero(:, 2)*swradcorr(:)
     1238        ! CALL histwrite_phy(o_swsrfcs_ant, zx_tmp_fi2d)
     1239
     1240        CALL histwrite_phy(o_swtoaas_nat, topsw_aero(:, 1))
     1241        CALL histwrite_phy(o_swsrfas_nat, solsw_aero(:, 1))
     1242        CALL histwrite_phy(o_swtoacs_nat, topsw0_aero(:, 1))
     1243        CALL histwrite_phy(o_swsrfcs_nat, solsw0_aero(:, 1))
    12181244        !ant
    1219         zx_tmp_fi2d(:) = topsw_aero(:, 2)*swradcorr(:)
    1220         CALL histwrite_phy(o_swtoaas_ant, zx_tmp_fi2d)
    1221         zx_tmp_fi2d(:) = solsw_aero(:, 2)*swradcorr(:)
    1222         CALL histwrite_phy(o_swsrfas_ant, zx_tmp_fi2d)
    1223         zx_tmp_fi2d(:) = topsw0_aero(:, 2)*swradcorr(:)
    1224         CALL histwrite_phy(o_swtoacs_ant, zx_tmp_fi2d)
    1225         zx_tmp_fi2d(:) = solsw0_aero(:, 2)*swradcorr(:)
    1226         CALL histwrite_phy(o_swsrfcs_ant, zx_tmp_fi2d)
     1245        CALL histwrite_phy(o_swtoaas_ant, topsw_aero(:, 2))
     1246        CALL histwrite_phy(o_swsrfas_ant, solsw_aero(:, 2))
     1247        CALL histwrite_phy(o_swtoacs_ant, topsw0_aero(:, 2))
     1248        CALL histwrite_phy(o_swsrfcs_ant, solsw0_aero(:, 2))
    12271249        !cf
    12281250        IF (.not. aerosol_couple) THEN
    1229           zx_tmp_fi2d(:) = topswcf_aero(:, 1)*swradcorr(:)
    1230           CALL histwrite_phy(o_swtoacf_nat, zx_tmp_fi2d)
    1231           zx_tmp_fi2d(:) = solswcf_aero(:, 1)*swradcorr(:)
    1232           CALL histwrite_phy(o_swsrfcf_nat, zx_tmp_fi2d)
    1233           zx_tmp_fi2d(:) = topswcf_aero(:, 2)*swradcorr(:)
    1234           CALL histwrite_phy(o_swtoacf_ant, zx_tmp_fi2d)
    1235           zx_tmp_fi2d(:) = solswcf_aero(:, 2)*swradcorr(:)
    1236           CALL histwrite_phy(o_swsrfcf_ant, zx_tmp_fi2d)
    1237           zx_tmp_fi2d(:) = topswcf_aero(:, 3)*swradcorr(:)
    1238           CALL histwrite_phy(o_swtoacf_zero, zx_tmp_fi2d)
    1239           zx_tmp_fi2d(:) = solswcf_aero(:, 3)*swradcorr(:)
    1240           CALL histwrite_phy(o_swsrfcf_zero, zx_tmp_fi2d)
     1251          ! zx_tmp_fi2d(:) = topswcf_aero(:, 1)*swradcorr(:)
     1252          ! CALL histwrite_phy(o_swtoacf_nat, zx_tmp_fi2d)
     1253          ! zx_tmp_fi2d(:) = solswcf_aero(:, 1)*swradcorr(:)
     1254          ! CALL histwrite_phy(o_swsrfcf_nat, zx_tmp_fi2d)
     1255          ! zx_tmp_fi2d(:) = topswcf_aero(:, 2)*swradcorr(:)
     1256          ! CALL histwrite_phy(o_swtoacf_ant, zx_tmp_fi2d)
     1257          ! zx_tmp_fi2d(:) = solswcf_aero(:, 2)*swradcorr(:)
     1258          ! CALL histwrite_phy(o_swsrfcf_ant, zx_tmp_fi2d)
     1259          ! zx_tmp_fi2d(:) = topswcf_aero(:, 3)*swradcorr(:)
     1260          ! CALL histwrite_phy(o_swtoacf_zero, zx_tmp_fi2d)
     1261          ! zx_tmp_fi2d(:) = solswcf_aero(:, 3)*swradcorr(:)
     1262          ! CALL histwrite_phy(o_swsrfcf_zero, zx_tmp_fi2d)
     1263
     1264          CALL histwrite_phy(o_swtoacf_nat, topswcf_aero(:, 1))
     1265          CALL histwrite_phy(o_swsrfcf_nat, solswcf_aero(:, 1))
     1266          CALL histwrite_phy(o_swtoacf_ant, topswcf_aero(:, 2))
     1267          CALL histwrite_phy(o_swsrfcf_ant, solswcf_aero(:, 2))
     1268          CALL histwrite_phy(o_swtoacf_zero, topswcf_aero(:, 3))
     1269          CALL histwrite_phy(o_swsrfcf_zero, solswcf_aero(:, 3))
    12411270        ENDIF
    12421271        !====MS forcing diagnostics
    12431272      ENDIF
    12441273      IF (ok_aie) THEN
    1245         zx_tmp_fi2d(:) = topswai_aero*swradcorr
    1246         CALL histwrite_phy(o_topswai, zx_tmp_fi2d)
    1247 
    1248         zx_tmp_fi2d(:) = toplwai_aero*swradcorr
    1249         CALL histwrite_phy(o_toplwai, zx_tmp_fi2d)
    1250 
    1251         zx_tmp_fi2d(:) = solswai_aero*swradcorr
    1252         CALL histwrite_phy(o_solswai, zx_tmp_fi2d)
    1253 
    1254         zx_tmp_fi2d(:) = sollwai_aero*swradcorr
    1255         CALL histwrite_phy(o_sollwai, zx_tmp_fi2d)
     1274        CALL histwrite_phy(o_topswai, topswai_aero)
     1275        CALL histwrite_phy(o_toplwai, toplwai_aero)
     1276        CALL histwrite_phy(o_solswai, solswai_aero)
     1277        CALL histwrite_phy(o_sollwai, sollwai_aero)
    12561278      ENDIF
    12571279      IF (flag_aerosol .GT. 0 .AND. ok_cdnc) THEN
     
    12681290        CALL histwrite_phy(o_icc3dstra, icc3dstra)
    12691291        CALL histwrite_phy(o_cldicemxrat, zfice)
    1270         zx_tmp_fi3d(:, :) = 1 - zfice(:, :)
    1271         CALL histwrite_phy(o_cldwatmxrat, zx_tmp_fi3d)
     1292        ! zx_tmp_fi3d(:, :) = 1 - zfice(:, :)
     1293        ! CALL histwrite_phy(o_cldwatmxrat, zx_tmp_fi3d)
     1294        CALL histwrite_phy(o_cldwatmxrat, zfice)
    12721295        CALL histwrite_phy(o_reffclwtop, reffclwtop)
    12731296      ENDIF
     
    12841307      CALL histwrite_phy(o_oliq, ql_seri)
    12851308
    1286       zx_tmp_fi3d = ql_seri + qs_seri
    1287       CALL histwrite_phy(o_ocond, zx_tmp_fi3d)
     1309      ! zx_tmp_fi3d = ql_seri + qs_seri
     1310      ! CALL histwrite_phy(o_ocond, zx_tmp_fi3d)
     1311      CALL histwrite_phy(o_ocond, qs_seri)
    12881312
    12891313      CALL histwrite_phy(o_geop, zphi)
     
    12941318      CALL histwrite_phy(o_paprs, paprs(:, 1:klev))
    12951319
    1296       zx_tmp_fi3d = zphi/RG
    1297       CALL histwrite_phy(o_zfull, zx_tmp_fi3d)
     1320      ! zx_tmp_fi3d = zphi/RG
     1321      ! CALL histwrite_phy(o_zfull, zx_tmp_fi3d)
    12981322
    12991323      IF (ok_rrtm .and. iflag_rrtm .EQ. 1) THEN
     
    13041328      ENDIF
    13051329
    1306       IF (flag_aerosol_strat .EQ. 2) THEN
     1330      !IF (flag_aerosol_strat .EQ. 2) THEN
    13071331        CALL histwrite_phy(o_stratomask, stratomask)
    1308       ENDIF
     1332      !ENDIF
    13091333
    13101334      zx_tmp_fi3d(:, 1) = pphis(:)/RG
     
    13291353      CALL histwrite_phy(o_rhum, zx_rh)
    13301354
    1331       zx_tmp_fi3d = wo(:, :, 1)*dobson_u*1e3/zmasse/rmo3*rmd
    1332       CALL histwrite_phy(o_ozone, zx_tmp_fi3d)
     1355     
     1356      ! zx_tmp_fi3d = wo(:, :, 1)*dobson_u*1e3/zmasse/rmo3*rmd
     1357      ! CALL histwrite_phy(o_ozone, zx_tmp_fi3d) ! o_wo_1*dobson_u*1e3/o_mass/rmo3*rmd
    13331358
    13341359      IF (read_climoz == 2) THEN
    1335         zx_tmp_fi3d = wo(:, :, 2)*dobson_u*1e3/zmasse/rmo3*rmd
    1336         CALL histwrite_phy(o_ozone_light, zx_tmp_fi3d)
     1360        ! zx_tmp_fi3d = wo(:, :, 2)*dobson_u*1e3/zmasse/rmo3*rmd
     1361        ! CALL histwrite_phy(o_ozone_light, zx_tmp_fi3d)
     1362        CALL histwrite_phy(o_ozone_light, wo(:, :, 2))
    13371363      ENDIF
    13381364
     
    13611387
    13621388      DO nsrf = 1, nbsrf
    1363         zx_tmp_fi2d(1:klon) = falb1(1:klon, nsrf)
    1364         CALL histwrite_phy(o_albe_srf(nsrf), zx_tmp_fi2d)
    1365         zx_tmp_fi2d(1:klon) = z0m(1:klon, nsrf)
    1366         CALL histwrite_phy(o_z0m_srf(nsrf), zx_tmp_fi2d)
    1367         zx_tmp_fi2d(1:klon) = z0h(1:klon, nsrf)
    1368         CALL histwrite_phy(o_z0h_srf(nsrf), zx_tmp_fi2d)
    1369         zx_tmp_fi2d(1:klon) = agesno(1:klon, nsrf)
    1370         CALL histwrite_phy(o_ages_srf(nsrf), zx_tmp_fi2d)
    1371         zx_tmp_fi2d(1:klon) = snow(1:klon, nsrf)
    1372         CALL histwrite_phy(o_snow_srf(nsrf), zx_tmp_fi2d)
     1389        CALL histwrite_phy(o_albe_srf(nsrf), falb1(1:klon, nsrf))
     1390        CALL histwrite_phy(o_z0m_srf(nsrf), z0m(1:klon, nsrf))
     1391        CALL histwrite_phy(o_z0h_srf(nsrf), z0h(1:klon, nsrf))
     1392        CALL histwrite_phy(o_ages_srf(nsrf), agesno(1:klon, nsrf))
     1393        CALL histwrite_phy(o_snow_srf(nsrf), snow(1:klon, nsrf))
    13731394      ENDDO !nsrf=1, nbsrf
    13741395      CALL histwrite_phy(o_alb1, albsol1)
     
    13831404          ENDDO
    13841405        ENDDO
    1385         CALL histwrite_phy(o_tke, zx_tmp_fi3d)
    1386 
    1387         CALL histwrite_phy(o_tke_max, zx_tmp_fi3d)
     1406        ! reduce( sum(nsrf[1,4], o_fract_srf(nsrf)(:) * o_tke_srf(nsrf)(:,:))  )
     1407        ! == sum( o_fract_srf(nsrf)(:) * reduce(o_tke_srf(nsrf)(:,:)) )
     1408        CALL histwrite_phy(o_tke, zx_tmp_fi3d)
     1409        !CALL histwrite_phy(o_tke_max, zx_tmp_fi3d)
    13881410      ENDIF
    13891411
    13901412      CALL histwrite_phy(o_kz, coefh(:, :, is_ave))
    13911413
    1392       CALL histwrite_phy(o_kz_max, coefh(:, :, is_ave))
     1414      !CALL histwrite_phy(o_kz_max, coefh(:, :, is_ave))
    13931415
    13941416      CALL histwrite_phy(o_clwcon, clwcon0)
     
    14101432      CALL histwrite_phy(o_dvdyn, d_v_dyn)
    14111433
    1412       zx_tmp_fi3d(1:klon, 1:klev) = d_t_con(1:klon, 1:klev)/pdtphys
    1413       CALL histwrite_phy(o_dtcon, zx_tmp_fi3d)
     1434      ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_con(1:klon, 1:klev)/pdtphys
     1435      ! CALL histwrite_phy(o_dtcon, zx_tmp_fi3d)
     1436      CALL histwrite_phy(o_dtcon, d_t_con(:, 1:klev))
     1437
    14141438      IF (iflag_thermals .EQ. 0) THEN
    14151439        zx_tmp_fi3d(1:klon, 1:klev) = d_t_con(1:klon, 1:klev)/pdtphys + &
    14161440                                      d_t_ajsb(1:klon, 1:klev)/pdtphys
    1417         CALL histwrite_phy(o_tntc, zx_tmp_fi3d)
     1441        CALL histwrite_phy(o_tntc, zx_tmp_fi3d) ! o_tntc = dtcon + o_dtthe
    14181442      ELSE IF (iflag_thermals .GE. 1 .AND. iflag_wake .EQ. 1) THEN
    14191443        zx_tmp_fi3d(1:klon, 1:klev) = d_t_con(1:klon, 1:klev)/pdtphys + &
    14201444                                      d_t_ajs(1:klon, 1:klev)/pdtphys + &
    14211445                                      d_t_wake(1:klon, 1:klev)/pdtphys
    1422         CALL histwrite_phy(o_tntc, zx_tmp_fi3d)
    1423       ENDIF
    1424       zx_tmp_fi3d(1:klon, 1:klev) = d_u_con(1:klon, 1:klev)/pdtphys
    1425       CALL histwrite_phy(o_ducon, zx_tmp_fi3d)
    1426       zx_tmp_fi3d(1:klon, 1:klev) = d_v_con(1:klon, 1:klev)/pdtphys
    1427       CALL histwrite_phy(o_dvcon, zx_tmp_fi3d)
     1446        CALL histwrite_phy(o_tntc, zx_tmp_fi3d) ! o_tntc = dtcon + ? + o_dtwak
     1447      ENDIF
     1448      ! zx_tmp_fi3d(1:klon, 1:klev) = d_u_con(1:klon, 1:klev)/pdtphys
     1449      ! CALL histwrite_phy(o_ducon, zx_tmp_fi3d)
     1450      ! zx_tmp_fi3d(1:klon, 1:klev) = d_v_con(1:klon, 1:klev)/pdtphys
     1451      ! CALL histwrite_phy(o_dvcon, zx_tmp_fi3d)
     1452      ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_con(1:klon, 1:klev)/pdtphys
     1453      ! CALL histwrite_phy(o_dqcon, zx_tmp_fi3d)     
     1454      CALL histwrite_phy(o_ducon, d_u_con(1:klon, 1:klev))
     1455      CALL histwrite_phy(o_dvcon, d_v_con(1:klon, 1:klev))
     1456      CALL histwrite_phy(o_dqcon, d_q_con(1:klon, 1:klev))
     1457
    14281458      zx_tmp_fi3d(1:klon, 1:klev) = d_q_con(1:klon, 1:klev)/pdtphys
    1429       CALL histwrite_phy(o_dqcon, zx_tmp_fi3d)
    14301459      CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    14311460      CALL histwrite_phy(o_dqcon2d, zx_tmp_fi2d)
    14321461
    14331462      IF (iflag_thermals .EQ. 0) THEN
    1434         zx_tmp_fi3d(1:klon, 1:klev) = d_q_con(1:klon, 1:klev)/pdtphys
    1435         CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
     1463        ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_con(1:klon, 1:klev)/pdtphys
     1464        ! CALL histwrite_phy(o_tnhusc, d_q_con)
     1465        CALL histwrite_phy(o_tnhusc, d_q_con(1:klon, 1:klev))
    14361466      ELSE IF (iflag_thermals .GE. 1 .AND. iflag_wake .EQ. 1) THEN
    14371467        zx_tmp_fi3d(1:klon, 1:klev) = d_q_con(1:klon, 1:klev)/pdtphys + &
     
    14551485      ! Sorties specifiques a la separation thermiques/non thermiques
    14561486      IF (iflag_thermals >= 1) THEN
    1457         zx_tmp_fi3d(1:klon, 1:klev) = d_t_lscth(1:klon, 1:klev)/pdtphys
    1458         CALL histwrite_phy(o_dtlscth, zx_tmp_fi3d)
    1459         zx_tmp_fi3d(1:klon, 1:klev) = d_t_lscst(1:klon, 1:klev)/pdtphys
    1460         CALL histwrite_phy(o_dtlscst, zx_tmp_fi3d)
     1487        ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_lscth(1:klon, 1:klev)/pdtphys
     1488        ! CALL histwrite_phy(o_dtlscth, zx_tmp_fi3d)
     1489        ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_lscst(1:klon, 1:klev)/pdtphys
     1490        ! CALL histwrite_phy(o_dtlscst, zx_tmp_fi3d)
     1491        ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_lscth(1:klon, 1:klev)/pdtphys
     1492        ! CALL histwrite_phy(o_dqlscth, zx_tmp_fi3d)
     1493        ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_lscst(1:klon, 1:klev)/pdtphys
     1494        ! CALL histwrite_phy(o_dqlscst, zx_tmp_fi3d)
     1495
     1496        CALL histwrite_phy(o_dtlscth, d_t_lscth(1:klon, 1:klev))
     1497        CALL histwrite_phy(o_dtlscst, d_t_lscst(1:klon, 1:klev))
     1498        CALL histwrite_phy(o_dqlscth, d_q_lscth(1:klon, 1:klev))
     1499        CALL histwrite_phy(o_dqlscst, d_q_lscst(1:klon, 1:klev))
     1500
    14611501        zx_tmp_fi3d(1:klon, 1:klev) = d_q_lscth(1:klon, 1:klev)/pdtphys
    1462         CALL histwrite_phy(o_dqlscth, zx_tmp_fi3d)
    14631502        CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    1464         CALL histwrite_phy(o_dqlscth2d, zx_tmp_fi2d)
     1503        CALL histwrite_phy(o_dqlscth2d, zx_tmp_fi2d)       
    14651504        zx_tmp_fi3d(1:klon, 1:klev) = d_q_lscst(1:klon, 1:klev)/pdtphys
    1466         CALL histwrite_phy(o_dqlscst, zx_tmp_fi3d)
    14671505        CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    14681506        CALL histwrite_phy(o_dqlscst2d, zx_tmp_fi2d)
    14691507        CALL histwrite_phy(o_plulth, plul_th)
    14701508        CALL histwrite_phy(o_plulst, plul_st)
    1471         DO i = 1, klon
    1472           zx_tmp_fi2d(1:klon) = lmax_th(:)
    1473         ENDDO
     1509        zx_tmp_fi2d(:) = lmax_th(1:klon) ! Cast from int to real
    14741510        CALL histwrite_phy(o_lmaxth, zx_tmp_fi2d)
    1475         DO k = 1, klev
    1476           DO i = 1, klon
    1477             IF (ptconvth(i, k)) THEN
    1478               zx_tmp_fi3d(i, k) = 1.
    1479             ELSE
    1480               zx_tmp_fi3d(i, k) = 0.
    1481             ENDIF
    1482           ENDDO
    1483         ENDDO
     1511        ! DO k = 1, klev
     1512        !   DO i = 1, klon
     1513        !     IF (ptconvth(i, k)) THEN
     1514        !       zx_tmp_fi3d(i, k) = 1.
     1515        !     ELSE
     1516        !       zx_tmp_fi3d(i, k) = 0.
     1517        !     ENDIF
     1518        !   ENDDO
     1519        ! ENDDO
     1520        ! CALL histwrite_phy(o_ptconvth, zx_tmp_fi3d)
     1521        zx_tmp_fi3d(:,:) = MERGE(1., 0., ptconvth(:,:)) ! Cast from logical to real
    14841522        CALL histwrite_phy(o_ptconvth, zx_tmp_fi3d)
    14851523      ENDIF ! iflag_thermals>=1
    14861524
    1487       zpt_conv = 0.
    1488       WHERE (ptconv) zpt_conv = 1.
     1525      zpt_conv(:,:) = MERGE(1., 0., ptconv(:,:))
    14891526      CALL histwrite_phy(o_ptconv, zpt_conv)
    14901527      zpt_conv2d(:) = 0.
     
    14981535      ENDDO
    14991536      CALL histwrite_phy(o_ftime_th, zx_tmp_fi2d)
    1500       zx_tmp_fi2d(:) = max(zx_tmp_fi2d(:), zpt_conv2d(:))
    1501       CALL histwrite_phy(o_ftime_con, zx_tmp_fi2d)
     1537      ! zx_tmp_fi2d(:) = max(zx_tmp_fi2d(:), zpt_conv2d(:))
     1538      ! CALL histwrite_phy(o_ftime_con, zx_tmp_fi2d)
    15021539      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1503       zx_tmp_fi3d(1:klon, 1:klev) = d_t_vdf(1:klon, 1:klev)/pdtphys
    1504       CALL histwrite_phy(o_dtvdf, zx_tmp_fi3d)
    1505       zx_tmp_fi3d(1:klon, 1:klev) = d_t_diss(1:klon, 1:klev)/pdtphys
    1506       CALL histwrite_phy(o_dtdis, zx_tmp_fi3d)
     1540      CALL histwrite_phy(o_dtvdf, d_t_vdf(1:klon, 1:klev))
     1541      CALL histwrite_phy(o_dtdis, d_t_diss(1:klon, 1:klev))
     1542      CALL histwrite_phy(o_dqvdf, d_q_vdf(1:klon, 1:klev))
     1543      CALL histwrite_phy(o_dteva, d_t_eva(1:klon, 1:klev))
     1544      CALL histwrite_phy(o_dqeva, d_q_eva(1:klon, 1:klev))
     1545      CALL histwrite_phy(o_duthe, d_u_ajs(1:klon, 1:klev))
     1546      CALL histwrite_phy(o_dvthe, d_v_ajs(1:klon, 1:klev))
     1547
    15071548      zx_tmp_fi3d(1:klon, 1:klev) = d_q_vdf(1:klon, 1:klev)/pdtphys
    1508       CALL histwrite_phy(o_dqvdf, zx_tmp_fi3d)
    15091549      CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    15101550      CALL histwrite_phy(o_dqvdf2d, zx_tmp_fi2d)
    1511       zx_tmp_fi3d(1:klon, 1:klev) = d_t_eva(1:klon, 1:klev)/pdtphys
    1512       CALL histwrite_phy(o_dteva, zx_tmp_fi3d)
    15131551      zx_tmp_fi3d(1:klon, 1:klev) = d_q_eva(1:klon, 1:klev)/pdtphys
    1514       CALL histwrite_phy(o_dqeva, zx_tmp_fi3d)
    15151552      CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    15161553      CALL histwrite_phy(o_dqeva2d, zx_tmp_fi2d)
     1554      ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_ajs(1:klon, 1:klev)/pdtphys - &
     1555      !                               d_t_ajsb(1:klon, 1:klev)/pdtphys
     1556      ! CALL histwrite_phy(o_dtthe, zx_tmp_fi3d) ! d_t_ajs(1:klon, 1:klev)/pdtphys + o_dtajs
     1557      CALL histwrite_phy(o_dtthe, d_t_ajs(1:klon, 1:klev))
    15171558      CALL histwrite_phy(o_ratqs, ratqs)
    1518         zx_tmp_fi3d(1:klon, 1:klev) = d_t_ajs(1:klon, 1:klev)/pdtphys - &
    1519                                       d_t_ajsb(1:klon, 1:klev)/pdtphys
    1520       CALL histwrite_phy(o_dtthe, zx_tmp_fi3d)
    1521         zx_tmp_fi3d(1:klon, 1:klev) = d_u_ajs(1:klon, 1:klev)/pdtphys
    1522       CALL histwrite_phy(o_duthe, zx_tmp_fi3d)
    1523         zx_tmp_fi3d(1:klon, 1:klev) = d_v_ajs(1:klon, 1:klev)/pdtphys
    1524       CALL histwrite_phy(o_dvthe, zx_tmp_fi3d)
     1559     
    15251560
    15261561      IF (iflag_thermals >= 1) THEN
     
    15461581        CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    15471582        CALL histwrite_phy(o_dqthe2d, zx_tmp_fi2d)
     1583      ELSE
     1584        zx_tmp_fi2d(:) = 0
     1585        CALL histwrite_phy(o_f_th, zx_tmp_fi2d)
    15481586      ENDIF !iflag_thermals
    1549       zx_tmp_fi3d(1:klon, 1:klev) = d_t_ajsb(1:klon, 1:klev)/pdtphys
    1550       CALL histwrite_phy(o_dtajs, zx_tmp_fi3d)
    15511587      zx_tmp_fi3d(1:klon, 1:klev) = d_q_ajsb(1:klon, 1:klev)/pdtphys
    1552       CALL histwrite_phy(o_dqajs, zx_tmp_fi3d)
    15531588      CALL water_int(klon, klev, zx_tmp_fi3d, zmasse, zx_tmp_fi2d)
    15541589      CALL histwrite_phy(o_dqajs2d, zx_tmp_fi2d)
    1555       zx_tmp_fi3d(1:klon, 1:klev) = d_t_swr(1:klon, 1:klev)/pdtphys
    1556       CALL histwrite_phy(o_dtswr, zx_tmp_fi3d)
    1557       zx_tmp_fi3d(1:klon, 1:klev) = d_t_sw0(1:klon, 1:klev)/pdtphys
    1558       CALL histwrite_phy(o_dtsw0, zx_tmp_fi3d)
    1559       zx_tmp_fi3d(1:klon, 1:klev) = d_t_lwr(1:klon, 1:klev)/pdtphys
    1560       CALL histwrite_phy(o_dtlwr, zx_tmp_fi3d)
    1561       zx_tmp_fi3d(1:klon, 1:klev) = d_t_lw0(1:klon, 1:klev)/pdtphys
    1562       CALL histwrite_phy(o_dtlw0, zx_tmp_fi3d)
    1563       zx_tmp_fi3d(1:klon, 1:klev) = d_t_ec(1:klon, 1:klev)/pdtphys
    1564       CALL histwrite_phy(o_dtec, zx_tmp_fi3d)
    1565       zx_tmp_fi3d(1:klon, 1:klev) = d_u_vdf(1:klon, 1:klev)/pdtphys
    1566       CALL histwrite_phy(o_duvdf, zx_tmp_fi3d)
    1567       zx_tmp_fi3d(1:klon, 1:klev) = d_v_vdf(1:klon, 1:klev)/pdtphys
    1568       CALL histwrite_phy(o_dvvdf, zx_tmp_fi3d)
     1590
     1591      CALL histwrite_phy(o_dtajs, d_t_ajsb(1:klon, 1:klev))
     1592      CALL histwrite_phy(o_dqajs, d_q_ajsb(1:klon, 1:klev))
     1593      CALL histwrite_phy(o_dtswr, d_t_swr(1:klon, 1:klev))
     1594      CALL histwrite_phy(o_dtsw0, d_t_sw0(1:klon, 1:klev))
     1595      CALL histwrite_phy(o_dtlwr, d_t_lwr(1:klon, 1:klev))
     1596      CALL histwrite_phy(o_dtlw0, d_t_lw0(1:klon, 1:klev))
     1597      CALL histwrite_phy(o_dtec, d_t_ec(1:klon, 1:klev))
     1598      CALL histwrite_phy(o_duvdf, d_u_vdf(1:klon, 1:klev))
     1599      CALL histwrite_phy(o_dvvdf, d_v_vdf(1:klon, 1:klev))
     1600
    15691601      IF (ok_orodr) THEN
    1570         zx_tmp_fi3d(1:klon, 1:klev) = d_u_oro(1:klon, 1:klev)/pdtphys
    1571         CALL histwrite_phy(o_duoro, zx_tmp_fi3d)
    1572         zx_tmp_fi3d(1:klon, 1:klev) = d_v_oro(1:klon, 1:klev)/pdtphys
    1573         CALL histwrite_phy(o_dvoro, zx_tmp_fi3d)
    1574         zx_tmp_fi3d(1:klon, 1:klev) = d_t_oro(1:klon, 1:klev)/pdtphys
    1575         CALL histwrite_phy(o_dtoro, zx_tmp_fi3d)
     1602        ! zx_tmp_fi3d(1:klon, 1:klev) = d_u_oro(1:klon, 1:klev)/pdtphys
     1603        ! CALL histwrite_phy(o_duoro, zx_tmp_fi3d)
     1604        ! zx_tmp_fi3d(1:klon, 1:klev) = d_v_oro(1:klon, 1:klev)/pdtphys
     1605        ! CALL histwrite_phy(o_dvoro, zx_tmp_fi3d)
     1606        ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_oro(1:klon, 1:klev)/pdtphys
     1607        ! CALL histwrite_phy(o_dtoro, zx_tmp_fi3d)
     1608
     1609        CALL histwrite_phy(o_duoro, d_u_oro(1:klon, 1:klev))
     1610        CALL histwrite_phy(o_dvoro, d_v_oro(1:klon, 1:klev))
     1611        CALL histwrite_phy(o_dtoro, d_t_oro(1:klon, 1:klev))
    15761612      ENDIF
    15771613      IF (ok_orolf) THEN
    1578         zx_tmp_fi3d(1:klon, 1:klev) = d_u_lif(1:klon, 1:klev)/pdtphys
    1579         CALL histwrite_phy(o_dulif, zx_tmp_fi3d)
    1580 
    1581         zx_tmp_fi3d(1:klon, 1:klev) = d_v_lif(1:klon, 1:klev)/pdtphys
    1582         CALL histwrite_phy(o_dvlif, zx_tmp_fi3d)
    1583 
    1584         zx_tmp_fi3d(1:klon, 1:klev) = d_t_lif(1:klon, 1:klev)/pdtphys
    1585         CALL histwrite_phy(o_dtlif, zx_tmp_fi3d)
     1614        ! zx_tmp_fi3d(1:klon, 1:klev) = d_u_lif(1:klon, 1:klev)/pdtphys
     1615        ! CALL histwrite_phy(o_dulif, zx_tmp_fi3d)
     1616        ! zx_tmp_fi3d(1:klon, 1:klev) = d_v_lif(1:klon, 1:klev)/pdtphys
     1617        ! CALL histwrite_phy(o_dvlif, zx_tmp_fi3d)
     1618        ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_lif(1:klon, 1:klev)/pdtphys
     1619        ! CALL histwrite_phy(o_dtlif, zx_tmp_fi3d)
     1620
     1621        CALL histwrite_phy(o_dulif, d_u_lif(1:klon, 1:klev))
     1622        CALL histwrite_phy(o_dvlif, d_v_lif(1:klon, 1:klev))
     1623        CALL histwrite_phy(o_dtlif, d_t_lif(1:klon, 1:klev))
    15861624      ENDIF
    15871625
    15881626      IF (ok_hines) THEN
    1589         zx_tmp_fi3d = du_gwd_hines/pdtphys
    1590         CALL histwrite_phy(o_du_gwd_hines, zx_tmp_fi3d)
    1591 
    1592         zx_tmp_fi3d = dv_gwd_hines/pdtphys
    1593         CALL histwrite_phy(o_dv_gwd_hines, zx_tmp_fi3d)
    1594 
    1595         zx_tmp_fi3d(1:klon, 1:klev) = d_t_hin(1:klon, 1:klev)/pdtphys
    1596         CALL histwrite_phy(o_dthin, zx_tmp_fi3d)
     1627        ! zx_tmp_fi3d = du_gwd_hines/pdtphys
     1628        ! CALL histwrite_phy(o_du_gwd_hines, zx_tmp_fi3d)
     1629        ! zx_tmp_fi3d = dv_gwd_hines/pdtphys
     1630        ! CALL histwrite_phy(o_dv_gwd_hines, zx_tmp_fi3d)
     1631        ! zx_tmp_fi3d = d_t_hin(1:klon, 1:klev)/pdtphys
     1632
     1633        CALL histwrite_phy(o_du_gwd_hines, du_gwd_hines)
     1634        CALL histwrite_phy(o_dv_gwd_hines, dv_gwd_hines)
     1635        CALL histwrite_phy(o_dthin, d_t_hin)
     1636
    15971637        CALL histwrite_phy(o_ustr_gwd_hines, zustr_gwd_hines)
    15981638        CALL histwrite_phy(o_vstr_gwd_hines, zvstr_gwd_hines)
     
    16001640
    16011641      IF (.not. ok_hines .and. ok_gwd_rando) THEN
    1602         zx_tmp_fi3d = du_gwd_front/pdtphys
    1603         CALL histwrite_phy(o_du_gwd_front, zx_tmp_fi3d)
    1604 
    1605         zx_tmp_fi3d = dv_gwd_front/pdtphys
    1606         CALL histwrite_phy(o_dv_gwd_front, zx_tmp_fi3d)
     1642        ! zx_tmp_fi3d = du_gwd_front/pdtphys
     1643        ! CALL histwrite_phy(o_du_gwd_front, zx_tmp_fi3d)
     1644        ! zx_tmp_fi3d = dv_gwd_front/pdtphys
     1645        ! CALL histwrite_phy(o_dv_gwd_front, zx_tmp_fi3d)
     1646
     1647        CALL histwrite_phy(o_du_gwd_front, du_gwd_front)
     1648        CALL histwrite_phy(o_dv_gwd_front, dv_gwd_front)
    16071649
    16081650        CALL histwrite_phy(o_ustr_gwd_front, zustr_gwd_front)
     
    16111653
    16121654      IF (ok_gwd_rando) THEN
    1613         zx_tmp_fi3d = du_gwd_rando/pdtphys
    1614         CALL histwrite_phy(o_du_gwd_rando, zx_tmp_fi3d)
    1615 
    1616         zx_tmp_fi3d = dv_gwd_rando/pdtphys
    1617         CALL histwrite_phy(o_dv_gwd_rando, zx_tmp_fi3d)
     1655        ! zx_tmp_fi3d = du_gwd_rando/pdtphys
     1656        ! CALL histwrite_phy(o_du_gwd_rando, zx_tmp_fi3d)
     1657        ! zx_tmp_fi3d = dv_gwd_rando/pdtphys
     1658        ! CALL histwrite_phy(o_dv_gwd_rando, zx_tmp_fi3d)
     1659
     1660        CALL histwrite_phy(o_du_gwd_rando, du_gwd_rando)
     1661        CALL histwrite_phy(o_dv_gwd_rando, dv_gwd_rando)
     1662
    16181663        CALL histwrite_phy(o_ustr_gwd_rando, zustr_gwd_rando)
    16191664        CALL histwrite_phy(o_vstr_gwd_rando, zvstr_gwd_rando)
     
    16231668
    16241669      IF (ok_qch4) THEN
     1670        ! GLITCHY : not in field_def_lmdz.xml
    16251671        zx_tmp_fi3d = d_q_ch4/pdtphys
    16261672        CALL histwrite_phy(o_dqch4, zx_tmp_fi3d)
     
    16301676        zx_tmp_fi3d1(:, k) = swup(:, k)*swradcorr(:)
    16311677      ENDDO
    1632 
    16331678      CALL histwrite_phy(o_rsu, zx_tmp_fi3d1)
    16341679
     
    16361681        zx_tmp_fi3d1(:, k) = swdn(:, k)*swradcorr(:)
    16371682      ENDDO
    1638 
    1639 
    16401683      CALL histwrite_phy(o_rsd, zx_tmp_fi3d1)
     1684
    16411685      DO k = 1, klevp1
    16421686        zx_tmp_fi3d1(:, k) = swup0(:, k)*swradcorr(:)
    16431687      ENDDO
    1644 
    16451688      CALL histwrite_phy(o_rsucs, zx_tmp_fi3d1)
     1689
    16461690      DO k = 1, klevp1
    16471691        zx_tmp_fi3d1(:, k) = swupc0(:, k)*swradcorr(:)
     
    16641708      CALL histwrite_phy(o_rldcs, lwdn0)
    16651709
    1666       zx_tmp_fi3d(1:klon, 1:klev) = d_t(1:klon, 1:klev) + &
    1667                                     d_t_dyn(1:klon, 1:klev)
    1668       CALL histwrite_phy(o_tnt, zx_tmp_fi3d)
    1669 
    1670       zx_tmp_fi3d(1:klon, 1:klev) = d_t_swr(1:klon, 1:klev)/pdtphys + &
    1671                                     d_t_lwr(1:klon, 1:klev)/pdtphys
    1672       CALL histwrite_phy(o_tntr, zx_tmp_fi3d)
    1673       zx_tmp_fi3d(1:klon, 1:klev) = (d_t_lsc(1:klon, 1:klev) + &
    1674                                      d_t_eva(1:klon, 1:klev) + &
    1675                                      d_t_vdf(1:klon, 1:klev))/pdtphys
    1676       CALL histwrite_phy(o_tntscpbl, zx_tmp_fi3d)
    1677       zx_tmp_fi3d(1:klon, 1:klev) = d_qx(1:klon, 1:klev, ivap) + &
    1678                                     d_q_dyn(1:klon, 1:klev)
    1679       CALL histwrite_phy(o_tnhus, zx_tmp_fi3d)
    1680       zx_tmp_fi3d(1:klon, 1:klev) = d_q_lsc(1:klon, 1:klev)/pdtphys + &
    1681                                     d_q_eva(1:klon, 1:klev)/pdtphys
    1682       CALL histwrite_phy(o_tnhusscpbl, zx_tmp_fi3d)
    16831710      CALL histwrite_phy(o_evu, coefm(:, :, is_ave))
    1684       zx_tmp_fi3d(1:klon, 1:klev) = q_seri(1:klon, 1:klev) + &
    1685                                     ql_seri(1:klon, 1:klev)
    1686       CALL histwrite_phy(o_h2o, zx_tmp_fi3d)
     1711
     1712      ! zx_tmp_fi3d(1:klon, 1:klev) = d_t(1:klon, 1:klev) + &
     1713      !                               d_t_dyn(1:klon, 1:klev)
     1714      ! CALL histwrite_phy(o_tnt, zx_tmp_fi3d) ! o_dtphy + o_dtdyn
     1715      ! zx_tmp_fi3d(1:klon, 1:klev) = d_t_swr(1:klon, 1:klev)/pdtphys + &
     1716      !                               d_t_lwr(1:klon, 1:klev)/pdtphys
     1717      ! CALL histwrite_phy(o_tntr, zx_tmp_fi3d)!o_dtswr + o_dtlwr
     1718      ! zx_tmp_fi3d(1:klon, 1:klev) = (d_t_lsc(1:klon, 1:klev) + &
     1719      !                                d_t_eva(1:klon, 1:klev) + &
     1720      !                                d_t_vdf(1:klon, 1:klev))/pdtphys
     1721      ! CALL histwrite_phy(o_tntscpbl, zx_tmp_fi3d) ! o_dtlsc + o_dteva + o_dtvdf
     1722      ! zx_tmp_fi3d(1:klon, 1:klev) = d_qx(1:klon, 1:klev, ivap) + &
     1723      !                               d_q_dyn(1:klon, 1:klev)
     1724      ! CALL histwrite_phy(o_tnhus, zx_tmp_fi3d) ! o_dqphy + o_dqdyn
     1725      ! zx_tmp_fi3d(1:klon, 1:klev) = d_q_lsc(1:klon, 1:klev)/pdtphys + &
     1726      !                               d_q_eva(1:klon, 1:klev)/pdtphys
     1727      ! CALL histwrite_phy(o_tnhusscpbl, zx_tmp_fi3d) ! o_dqlsc + o_dqeva
     1728      ! zx_tmp_fi3d(1:klon, 1:klev) = q_seri(1:klon, 1:klev) + &
     1729      !                               ql_seri(1:klon, 1:klev)
     1730      ! CALL histwrite_phy(o_h2o, zx_tmp_fi3d) ! o_ovap + o_oliq
    16871731      IF (iflag_con >= 3) THEN
    16881732        zx_tmp_fi3d(1:klon, 1:klev) = -1*(dnwd(1:klon, 1:klev) + &
    16891733                                            dnwd0(1:klon, 1:klev))
    1690         CALL histwrite_phy(o_mcd, zx_tmp_fi3d)
     1734        CALL histwrite_phy(o_mcd, zx_tmp_fi3d) ! - (o_dnwd + dnwd0)
    16911735        zx_tmp_fi3d(1:klon, 1:klev) = upwd(1:klon, 1:klev) + &
    16921736                                        dnwd(1:klon, 1:klev) + dnwd0(1:klon, 1:klev)
    1693         CALL histwrite_phy(o_dmc, zx_tmp_fi3d)
     1737        CALL histwrite_phy(o_dmc, zx_tmp_fi3d) ! o_upwd - o_mcd
    16941738      ELSE IF (iflag_con == 2) THEN
    16951739        CALL histwrite_phy(o_mcd, pmfd)
    16961740        zx_tmp_fi3d = pmfu + pmfd
    1697         CALL histwrite_phy(o_dmc, zx_tmp_fi3d)
     1741        CALL histwrite_phy(o_dmc, zx_tmp_fi3d) ! pmfu + o_mcd
    16981742      ENDIF
    16991743      CALL histwrite_phy(o_ref_liq, ref_liq)
     
    17011745
    17021746      IF (ok_4xCO2atm) THEN
    1703         zx_tmp_fi2d(:) = swupp(:, klevp1)*swradcorr(:)
    1704         CALL histwrite_phy(o_rsut4co2, zx_tmp_fi2d)
    1705         zx_tmp_fi2d(:) = lwupp(:, klevp1)
    1706         CALL histwrite_phy(o_rlut4co2, zx_tmp_fi2d)
    1707         zx_tmp_fi2d(:) = swup0p(:, klevp1)*swradcorr(:)
    1708         CALL histwrite_phy(o_rsutcs4co2, zx_tmp_fi2d)
    1709         zx_tmp_fi2d(:) = lwup0p(:, klevp1)
    1710         CALL histwrite_phy(o_rlutcs4co2, zx_tmp_fi2d)
    1711         DO k = 1, klevp1
    1712           zx_tmp_fi3d1(:, k) = swupp(:, k)*swradcorr(:)
    1713         ENDDO
    1714         CALL histwrite_phy(o_rsu4co2, zx_tmp_fi3d1)
    1715         DO k = 1, klevp1
    1716           zx_tmp_fi3d1(:, k) = swup0p(:, k)*swradcorr(:)
    1717         ENDDO
    1718         CALL histwrite_phy(o_rsucs4co2, zx_tmp_fi3d1)
    1719         DO k = 1, klevp1
    1720           zx_tmp_fi3d1(:, k) = swdnp(:, k)*swradcorr(:)
    1721         ENDDO
    1722         CALL histwrite_phy(o_rsd4co2, zx_tmp_fi3d1)
    1723         DO k = 1, klevp1
    1724           zx_tmp_fi3d1(:, k) = swdn0p(:, k)*swradcorr(:)
    1725         ENDDO
    1726         CALL histwrite_phy(o_rsdcs4co2, zx_tmp_fi3d1)
     1747        ! zx_tmp_fi2d(:) = swupp(:, klevp1)*swradcorr(:)
     1748        ! CALL histwrite_phy(o_rsut4co2, zx_tmp_fi2d)
     1749        ! zx_tmp_fi2d(:) = lwupp(:, klevp1)
     1750        ! CALL histwrite_phy(o_rlut4co2, zx_tmp_fi2d)
     1751        ! zx_tmp_fi2d(:) = swup0p(:, klevp1)*swradcorr(:)
     1752        ! CALL histwrite_phy(o_rsutcs4co2, zx_tmp_fi2d)
     1753        ! zx_tmp_fi2d(:) = lwup0p(:, klevp1)
     1754        ! CALL histwrite_phy(o_rlutcs4co2, zx_tmp_fi2d)
     1755        CALL histwrite_phy(o_rsut4co2, swupp(:, klevp1))
     1756        CALL histwrite_phy(o_rlut4co2, lwupp(:, klevp1))
     1757        CALL histwrite_phy(o_rsutcs4co2, swup0p(:, klevp1))
     1758        CALL histwrite_phy(o_rlutcs4co2, lwup0p(:, klevp1))
     1759       
     1760        if( any(swradcorr(:) /= 1.0) ) then
     1761          DO k = 1, klevp1
     1762            zx_tmp_fi3d1(:, k) = swupp(:, k)*swradcorr(:)
     1763          ENDDO
     1764          CALL histwrite_phy(o_rsu4co2, zx_tmp_fi3d1)
     1765          DO k = 1, klevp1
     1766            zx_tmp_fi3d1(:, k) = swup0p(:, k)*swradcorr(:)
     1767          ENDDO
     1768          CALL histwrite_phy(o_rsucs4co2, zx_tmp_fi3d1)
     1769          DO k = 1, klevp1
     1770            zx_tmp_fi3d1(:, k) = swdnp(:, k)*swradcorr(:)
     1771          ENDDO
     1772          CALL histwrite_phy(o_rsd4co2, zx_tmp_fi3d1)
     1773          DO k = 1, klevp1
     1774            zx_tmp_fi3d1(:, k) = swdn0p(:, k)*swradcorr(:)
     1775          ENDDO
     1776          CALL histwrite_phy(o_rsdcs4co2, zx_tmp_fi3d1)
     1777        else
     1778          CALL histwrite_phy(o_rsu4co2, swupp)
     1779          CALL histwrite_phy(o_rsucs4co2, swup0p)
     1780          CALL histwrite_phy(o_rsd4co2, swdnp)
     1781          CALL histwrite_phy(o_rsdcs4co2, swdn0p)
     1782        endif
    17271783        CALL histwrite_phy(o_rlu4co2, lwupp)
    17281784        CALL histwrite_phy(o_rlucs4co2, lwup0p)
     
    17381794      CALL histwrite_phy(o_va, vlevSTD(:, :))
    17391795      CALL histwrite_phy(o_wap, wlevSTD(:, :))
    1740       DO k = 1, nlevSTD
    1741         DO i = 1, klon
    1742           IF (O3STD(i, k) .NE. missing_val) THEN
    1743             zx_tmp_fi3d_STD(i, k) = O3STD(i, k)*1.e+9
    1744           ELSE
    1745             zx_tmp_fi3d_STD(i, k) = missing_val
    1746           ENDIF
    1747         ENDDO
    1748       ENDDO !k=1, nlevSTD
    1749       CALL histwrite_phy(o_tro3, zx_tmp_fi3d_STD)
     1796      ! DO k = 1, nlevSTD
     1797      !   DO i = 1, klon
     1798      !     IF (O3STD(i, k) .NE. missing_val) THEN
     1799      !       zx_tmp_fi3d_STD(i, k) = O3STD(i, k)*1.e+9
     1800      !     ELSE
     1801      !       zx_tmp_fi3d_STD(i, k) = missing_val
     1802      !     ENDIF
     1803      !   ENDDO
     1804      ! ENDDO !k=1, nlevSTD
     1805      ! CALL histwrite_phy(o_tro3, zx_tmp_fi3d_STD)
     1806      ! !(this/=missing_val)?this*1.e+9:missing_val
     1807      CALL histwrite_phy(o_tro3, O3STD(1:klon, 1:nlevSTD))
     1808      ! IF (read_climoz == 2) THEN
     1809      !   DO k = 1, nlevSTD
     1810      !     DO i = 1, klon
     1811      !       IF (O3daySTD(i, k) .NE. missing_val) THEN
     1812      !         zx_tmp_fi3d_STD(i, k) = O3daySTD(i, k)*1.e+9
     1813      !       ELSE
     1814      !         zx_tmp_fi3d_STD(i, k) = missing_val
     1815      !       ENDIF
     1816      !     ENDDO
     1817      !   ENDDO !k=1, nlevSTD
     1818      ! ENDIF
     1819      ! CALL histwrite_phy(o_tro3_daylight, zx_tmp_fi3d_STD)
     1820      ! !(this/=missing_val)?this*1.e+9:missing_val
    17501821      IF (read_climoz == 2) THEN
    1751         DO k = 1, nlevSTD
    1752           DO i = 1, klon
    1753             IF (O3daySTD(i, k) .NE. missing_val) THEN
    1754               zx_tmp_fi3d_STD(i, k) = O3daySTD(i, k)*1.e+9
    1755             ELSE
    1756               zx_tmp_fi3d_STD(i, k) = missing_val
    1757             ENDIF
    1758           ENDDO
    1759         ENDDO !k=1, nlevSTD
    1760       ENDIF
    1761       CALL histwrite_phy(o_tro3_daylight, zx_tmp_fi3d_STD)
     1822        CALL histwrite_phy(o_tro3_daylight, O3daySTD(1:klon, 1:nlevSTD))
     1823      else
     1824        CALL histwrite_phy(o_tro3_daylight, O3STD(1:klon, 1:nlevSTD))
     1825      ENDIF
    17621826      CALL histwrite_phy(o_uxv, uvSTD(:, :))
    17631827      CALL histwrite_phy(o_vxq, vqSTD(:, :))
     
    17901854            !--2D fields
    17911855            CALL histwrite_phy(o_dtr_dry(iq - nqo), flux_tr_dry(:, iq - nqo))
    1792             zx_tmp_fi2d = 0.
    1793             DO k = 1, klev
    1794               zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + zmasse(:, k)*tr_seri(:, k, iq - nqo)
    1795             ENDDO
    17961856            if (.not. ok_reprobus) then
     1857              zx_tmp_fi2d = 0.
     1858              DO k = 1, klev
     1859                zx_tmp_fi2d(:) = zx_tmp_fi2d(:) + zmasse(:, k)*tr_seri(:, k, iq - nqo)
     1860              ENDDO
    17971861              CALL histwrite_phy(o_trac_cum(iq - nqo), zx_tmp_fi2d)
    17981862            end if
Note: See TracChangeset for help on using the changeset viewer.