Changeset 4242 for dynamico_lmdz


Ignore:
Timestamp:
Jun 5, 2020, 1:59:19 PM (4 years ago)
Author:
dubos
Message:

simple_physics : output SW fluxes

Location:
dynamico_lmdz/simple_physics
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • dynamico_lmdz/simple_physics/config/DYNAMICO/TEST/field_def_dynamico.xml

    r4239 r4242  
    1313    <field id="preff" grid_ref="scalar"    unit="Pa"/>
    1414    <field id="ap" axis_ref="levp1"   long_name="hybrid A coefficient at layer interface" />
    15     <field id="bp" axis_ref="levp1"  long_name="hybrid B coefficient at layer interface" />
    16     <field id="mid_ap" axis_ref="lev"   long_name="hybrid A coefficient at midpoints" />
    17     <field id="mid_bp" axis_ref="lev"  long_name="hybrid B coefficient at midpoints" />
     15    <field id="bp" axis_ref="levp1"   long_name="hybrid B coefficient at layer interface" />
     16    <field id="mid_ap" axis_ref="lev" long_name="hybrid A coefficient at midpoints" />
     17    <field id="mid_bp" axis_ref="lev" long_name="hybrid B coefficient at midpoints" />
    1818   
    1919    <field_group domain_ref="i">
    20       <field id="ps" />
     20      <field id="ps"   standard_name="surface_pressure"     long_name="Surface pressure" unit="Pa"/>
     21      <field id="phis" standard_name="surface_geopotential" long_name="Surface geopotential" unit="m2/m2"/>
    2122      <field id="dps"  />
    2223      <field id="Ai" />
    23       <field id="phis" />
    2424      <field id="phi" />
    2525      <field id="precl" />
     
    2727      <field id="Q2_col_int" />     
    2828      <field id="ps_init" />
    29      
     29
    3030      <field_group axis_ref="lev">
    3131        <field id="mass" />
    32         <field id="p" />
    3332        <field id="dmass"/>
    34         <field id="theta" />
    3533        <field id="dyn_q" />
    3634        <field id="pk"/>
    37         <field id="ulon"/>
    38         <field id="ulat"/>
    39         <field id="uz"/>
    40         <field id="omega"/>
    41         <field id="temp"/>
     35        <field id="p"     standard_name="air_pressure"        long_name="Pressure"              unit="Pa"/>
     36        <field id="temp"  standard_name="air_temperature"     long_name="Temperature"           unit="K"/>
     37        <field id="theta" standard_name="pot_temp"            long_name="Potential temperature" unit="m/s"/>
     38        <field id="ulon"  standard_name="eastward_wind"       long_name="Zonal wind"            unit="m/s"/>
     39        <field id="ulat"  standard_name="northward_wind"      long_name="Meridional wind"       unit="m/s"/>
     40        <field id="uz"    standard_name="upward_air_velocity" long_name="Vertical velocity"     unit="m/s"/>
     41        <field id="omega" standard_name="lagrangian_tendency_of_air_pressure" long_name="Vertical pressure velocity"     unit="Pa/s"/>
    4242        <field id="kinetic_trisk"/>
    4343        <field id="kinetic"/>
     
    9393       
    9494      </field_group>
    95       <field id="u850" />
    96       <field id="v850" />
    97       <field id="w850" />
    98       <field id="t850" />
    99       <field id="omega850"/>                 
    100       <field id="u500" />
    101       <field id="v500" />
    102       <field id="w500" />
    103       <field id="t500" />
    104       <field id="omega500"/>                 
    105       <field id="SST"/>
    106      
     95
     96      <field id="u850" long_name="Zonal wind at 850 hPa"      unit="m/s"/>
     97      <field id="u500" long_name="Zonal wind at 500 hPa"      unit="m/s"/>
     98      <field id="v850" long_name="Meridional wind at 850 hPa" unit="m/s"/>
     99      <field id="v500" long_name="Meridional wind at 850 hPa" unit="m/s"/>
     100      <field id="w850" long_name="Vertical wind at 850 hPa"   unit="m/s"/>
     101      <field id="w500" long_name="Vertical wind at 500 hPa"   unit="m/s"/>
     102      <field id="t850" long_name="Temperature at 850 hPa"     unit="K"/>
     103      <field id="t500" long_name="Temperature at 500 hPa"     unit="K"/>
     104      <field id="omega850" long_name="Vertical pressure velocity at 850 hPa" unit="Pa/s"/>
     105      <field id="omega500" long_name="Vertical pressure velocity at 500 hPa" unit="Pa/s"/>
     106      <field id="SST"/>     
    107107      <field id="ulon_850_500" field_ref="p" axis_ref="lev_pressure" />
    108108     
    109109      <field_group axis_ref="levp1">
    110         <field id="geopot"/>
     110        <field id="geopot" standard_name="geopotential" long_name="geopotential" unit="m2/s2"/>
    111111        <field id="geopot_init"/>
    112112      </field_group>
     
    124124 
    125125</field_definition>
    126 
  • dynamico_lmdz/simple_physics/config/DYNAMICO/TEST/field_def_physics.xml

    r4239 r4242  
    11<!-- =========================================================================================================== -->
    2 <!-- field_def_phyparam.xml                                                                                      -->
     2<!-- field_def_physics.xml                                                                                      -->
    33<!-- Definition of all existing variables that can be output from phyparam                                       -->
    44<!-- =========================================================================================================== -->
     
    88  <field_group id="phyparam_output">     
    99    <field_group domain_ref="i">
    10       <field id="phyparam_mu0" />
     10      <field id="phyparam_ts"     name="Tsurf"  long_name="Surface temperature"     unit="K"/>
     11      <field id="phyparam_mu0"    name="mu0"    long_name="Cosine zenithal angle"/>
     12      <field id="phyparam_swsurf" name="swsurf" long_name="Upward SW flux at surface"/>
     13      <field id="phyparam_swtop"  name="swtop"  long_name="Downward SW fluw at TOA" unit="W/m2" />
     14      <field id="phyparam_lwsurf" name="lwsurf" long_name="LW flux at surface"      unit="W/m2" />
    1115      <field id="phyparam_alb" />
    12       <field id="phyparam_ts" />
    1316      <field id="phyparam_ps" />
    1417      <field id="phyparam_slp" />
    15       <field id="phyparam_swsurf" />
    16       <field id="phyparam_lwsurf" />
    1718
    1819      <field id="phyparam_coslon" />
     
    2021      <field id="phyparam_coslat" />
    2122      <field id="phyparam_sinlat" />
     23
     24      <field_group axis_ref="lev">
     25        <field id="phyparam_u"    name="u" long_name="Zonal velocity"      unit="m/s" />
     26        <field id="phyparam_v"    name="v" long_name="Meridional velocity" unit="m/s" />
     27        <field id="phyparam_temp" name="T" long_name="Temperature"         unit="K"   />
     28        <field id="phyparam_geop" />
     29        <field id="phyparam_plev" />
     30
     31        <field id="phyparam_du" name="du"    long_name="Zonal velocity tendency"      unit="m/s2" />
     32        <field id="phyparam_dv" name="dv"    long_name="Meridional velocity tendency" unit="m/s2" />
     33        <field id="phyparam_dt" name="dT"    long_name="Temperature tendency"         unit="K/s"  />
     34        <field id="phyparam_dtsw" name="dT_SW" long_name="Temperature tendency due to shortwave radiation" unit="K/s" />
     35        <field id="phyparam_dtlw" name="dT_LW" long_name="Temperature tendency due to longwave radiation"  unit="K/s" />
     36      </field_group>
     37
     38      <field_group axis_ref="levp1">
     39        <field id="phyparam_swflux_down" name="swflux_down" long_name="Downward SW radiative flux" unit="W/m2" />
     40      </field_group>
     41     
    2242    </field_group>
    2343  </field_group>
    2444 
    2545</field_definition>
    26 
    27 <!--       
    28        call writefield('u','Vent zonal moy','m/s',pu)
    29        call writefield('v','Vent meridien moy','m/s',pv)
    30        call writefield('temp','Temperature','K',pt)
    31        call writefield('geop','Geopotential','m2/s2',pphi)
    32        call writefield('plev','plev','Pa',pplev(:,1:nlayer))
    33 
    34        call writefield('du','du',' ',pdu)
    35        call writefield('dv','du',' ',pdv)
    36        call writefield('dt','du',' ',pdt)
    37        call writefield('dtsw','dtsw',' ',zdtsw)
    38        call writefield('dtlw','dtlw',' ',zdtlw)
    39 
    40        call writefield('ts','Surface temper','K',tsurf)
    41        call writefield('coslon','coslon',' ',coslon)
    42        call writefield('sinlon','sinlon',' ',sinlon)
    43        call writefield('coslat','coslat',' ',coslat)
    44        call writefield('sinlat','sinlat',' ',sinlat)
    45        call writefield('mu0','mu0',' ',mu0)
    46        call writefield('alb','alb',' ',albedo)
    47        call writefield('ps','Surface pressure','Pa',pplev(:,1))
    48        call writefield('slp','Sea level pressure','Pa',zpmer)
    49        call writefield('swsurf','SW surf','Pa',zfluxsw)
    50        call writefield('lwsurf','LW surf','Pa',zfluxlw)
    51 -->
  • dynamico_lmdz/simple_physics/config/DYNAMICO/TEST/file_def_dynamico.xml

    r4239 r4242  
    77  <file id="dynamico_native" convention="CF" enabled="false" output_freq="3h" sync_freq="3h" output_level="10" timeseries="none" description="Simple physics" >
    88   
    9     <field_group id="dcmip2016_output_field_once" operation="once" freq_offset="0ts" ts_enabled="true">
     9    <field_group id="output_field_once" operation="once" freq_offset="0ts" ts_enabled="true">
    1010      <field field_ref="timestep" name="mdt" enabled="false" />
    1111      <field field_ref="preff" name="P0" long_name="reference pressure" />
     
    1717   
    1818   
    19     <field_group id="dcmip2016_output_field" ts_enabled="true">
    20       <field field_ref="ps" name="PS"       standard_name="surface_pressure" long_name="Surface pressure"         unit="Pa" />
    21       <field field_ref="phis" operation="once" freq_offset="0ts" name="PHIS"   standard_name="surface_geopotential" long_name="Surface geopotential" unit="m2/m2"/>
     19    <field_group id="output_field" ts_enabled="true">
     20
     21      <field field_ref="phis" operation="once" freq_offset="0ts" />
     22      <field field_ref="ps" name="PS" />
     23      <field field_ref="ulon"  />
     24      <field field_ref="ulat"  />
     25      <field field_ref="temp"  />
     26      <field field_ref="theta" />
     27
     28      <field field_ref="u850" />
     29      <field field_ref="v850" />
     30      <field field_ref="t850" />
     31      <field field_ref="omega850" />
     32      <field field_ref="u500" />
     33      <field field_ref="v500" />
     34      <field field_ref="t500" />
     35      <field field_ref="omega500" />
    2236
    2337<!--     
    24       <field field_ref="geopot"  name="PHI"   standard_name="geopotential" long_name="geopotential" unit="m2/s2"/>
    25       <field field_ref="uz" name="W"        standard_name="upward_air_velocity" long_name="Vertical velocity"     unit="m/s"/>
    26       <field field_ref="omega" name="OMEGA"        standard_name="lagrangian_tendency_of_air_pressure" long_name="Vertical pressure velocity"     unit="Pa/s"/>
    27       <field field_ref="p"  name="P"        standard_name="air_pressure" long_name="Pressure"     unit="Pa"/>
    28       <field field_ref="w850" name="W850"       long_name="Vertical velocity at 850 hPa"     unit="m/s"/>
    29       <field field_ref="w500" name="W500"       long_name="Vertical velocity at 500 hPa"     unit="m/s"/>
     38      <field field_ref="geopot" />
     39      <field field_ref="uz" />
     40      <field field_ref="omega" />
     41      <field field_ref="p" />
     42      <field field_ref="w850" />
     43      <field field_ref="w500" />
    3044-->
    31       <field field_ref="ulon" name="U"      standard_name="eastward_wind" long_name="Zonal wind"                  unit="m/s"/>
    32       <field field_ref="ulat" name="V"      standard_name="northward_wind" long_name="Meridional wind"            unit="m/s"/>
    33       <field field_ref="temp"  name="T"        standard_name="air_temperature" long_name="Temperature"     unit="K"/>
    3445
    35       <field field_ref="u850" name="U850"       long_name="Zonal wind at 850 hPa"      unit="m/s"/>
    36       <field field_ref="v850" name="V850"       long_name="Meridional wind at 850 hPa"   unit="m/s"/>
    37       <field field_ref="t850" name="T850"       long_name="Temperature at 850 hPa"   unit="K"/>
    38       <field field_ref="omega850" name="OMEGA850"   long_name="Vertical pressure velocity at 850 hPa"     unit="Pa/s"/>
    39       <field field_ref="u500" name="U500"       long_name="Zonal wind at 500 hPa"      unit="m/s"/>
    40       <field field_ref="v500" name="V500"       long_name="Meridional wind at 850 hPa"   unit="m/s"/>
    41       <field field_ref="t500" name="T500"       long_name="Temperature at 850 hPa"   unit="K"/>
    42       <field field_ref="omega500" name="OMEGA500"   long_name="Vertical pressure velocity at 500 hPa"     unit="Pa/s"/>
    4346     
    4447    </field_group>
     
    5356  <file id="dynamico_regular" enabled="true" output_freq="24h" sync_freq="24h" output_level="10" description="Simple physics" timeseries="none" >
    5457   
    55     <field_group group_ref="dcmip2016_output_field_once"/>
    56    
    57     <field_group group_ref="dcmip2016_output_field" domain_ref="regular_one_degree" />
    58 
     58    <field_group group_ref="output_field_once"/>
     59    <field_group group_ref="output_field" domain_ref="regular_one_degree" />
    5960    <variable name="model" type="string" > dynamico </variable>
    6061    <variable name="grid" type="string" > hex </variable>
  • dynamico_lmdz/simple_physics/config/DYNAMICO/TEST/file_def_physics.xml

    r4239 r4242  
    44   
    55    <field_group id="phyparam_output_field" ts_enabled="true">
    6       <field field_ref="phyparam_ts" unit="K"/>
    7       <field field_ref="phyparam_swsurf" unit="W/m2"/>
    8       <field field_ref="phyparam_lwsurf" unit="W/m2"/>
     6
     7      <field field_ref="phyparam_mu0" />
     8      <field field_ref="phyparam_ts" />
     9      <field field_ref="phyparam_swsurf" />
     10      <field field_ref="phyparam_swtop" />
     11      <field field_ref="phyparam_lwsurf" />
     12
     13      <field field_ref="phyparam_u" />
     14      <field field_ref="phyparam_v" />
     15      <field field_ref="phyparam_temp" />
     16      <field field_ref="phyparam_du" />
     17      <field field_ref="phyparam_dv" />
     18      <field field_ref="phyparam_dtsw" />
     19      <field field_ref="phyparam_dtlw" />
     20      <field field_ref="phyparam_swflux_down" />
     21
    922    </field_group>
    1023
  • dynamico_lmdz/simple_physics/config/DYNAMICO/TEST/run.def

    r4239 r4242  
    3333
    3434#-------------- Physics -------------
    35 itau_physics=1
     35itau_physics=5
    3636physics=plugin
     37#physics_log_level=DBG
     38
    3739# 0.25 day = 6h
    3840period_sort=0.25
  • dynamico_lmdz/simple_physics/config/LMDZ/USEFUL

    r4230 r4242  
    33(cd TEST_PARAM/; time ./gcm.e | tee gcm.log | grep '*    pas ' && ./check.sh IRENE)
    44grep WRN TEST_PARAM/gcm.log | sort -u
     5
     6# IPSL / Camelot
     7module load gnu/7.2.0
  • dynamico_lmdz/simple_physics/phyparam/DYNAMICO/icosa_phyparam_mod.F90

    r4240 r4242  
    199199      CALL allocate_field(f_write_llmp1, field_t, type_real, llm+1, name='phyparam_write_llmp1')
    200200      writefield1_plugin => plugin_writefield1
     201      writefield2_plugin => plugin_writefield2
    201202    END SUBROUTINE init_plugin_writefield
    202203
     
    206207      CHARACTER(*), INTENT(IN) :: name, longname, unit
    207208      REAL, INTENT(IN)         :: var(:)
    208       WRITELOG(*,*) TRIM(name), ' : ', TRIM(longname), MINVAL(var), MAXVAL(var), inout%it
     209      WRITELOG(*,*) TRIM(name), ' : ', TRIM(longname), SHAPE(var), inout%it
     210      WRITELOG(*,*) TRIM(name), ' : ', MINVAL(var), MAXVAL(var)
    209211      LOG_INFO('writefield1')
    210212      CALL unpack_field(f_write2d, var)
     
    213215
    214216    SUBROUTINE plugin_writefield2(name,longname,unit, var)
     217      USE physics_interface_mod, ONLY : unpack_field, inout => physics_inout
     218      USE output_field_mod, ONLY : output_field
     219      USE icosa,    ONLY : llm
    215220      CHARACTER(*), INTENT(IN) :: name, longname, unit
    216221      REAL, INTENT(IN)         :: var(:,:)
     222      INTEGER :: nlev
     223      WRITELOG(*,*) TRIM(name), ' : ', TRIM(longname), SHAPE(var), inout%it
     224      WRITELOG(*,*) TRIM(name), ' : ', MINVAL(var), MAXVAL(var)
     225      LOG_INFO('writefield2')
     226      nlev = SIZE(var, 2)
     227      IF(nlev==llm) THEN
     228         CALL unpack_field(f_write_llm, var)
     229         CALL output_field('phyparam_'//TRIM(name), f_write_llm)
     230      ELSEIF(nlev==llm+1) THEN
     231         CALL unpack_field(f_write_llmp1, var)
     232         CALL output_field('phyparam_'//TRIM(name), f_write_llmp1)
     233      END IF
    217234    END SUBROUTINE plugin_writefield2
    218235
  • dynamico_lmdz/simple_physics/phyparam/physics/phyparam_mod.F90

    r4236 r4242  
    33  USE callkeys
    44  USE comgeomfi
     5  USE surface
    56  IMPLICIT NONE
    67  PRIVATE
    78  SAVE
    89
    9   REAL :: nan ! initialized to NaN with adequate compiler options
    10 
    11   REAL, PARAMETER :: pi=2*ASIN(1.), solarcst=1370., stephan=5.67e-08, &
    12        ps_rad=1.e5, height_scale=10000., ref_temp=285., &
    13        capcal_nosoil=1e5, tsoil_init=300.
    14 
    15   ! internal state, written to / read from disk at checkpoint / restart
    16   REAL, ALLOCATABLE :: tsurf(:), tsoil(:,:), capcal(:), fluxgrd(:)
    17   !$OMP THREADPRIVATE(tsurf, tsoil, capcal, fluxgrd)
    18 
    19   ! precomputed arrays
    20   REAL, ALLOCATABLE :: rnatur(:), albedo(:),emissiv(:), z0(:), inertie(:)
    21   !$OMP THREADPRIVATE( rnatur, albedo, emissiv, z0, inertie)
     10  REAL, PARAMETER :: ref_temp=285., capcal_nosoil=1e5, tsoil_init=300.
    2211
    2312  INTEGER :: icount
     
    3625       &            pdu,pdv,pdt,pdpsrf) BIND(C, name='phyparam_phyparam')
    3726    USE phys_const, ONLY : g, rcp, r, unjours
    38     USE surface,    ONLY : soil
    3927    USE turbulence, ONLY : vdif
    4028    USE convection, ONLY : convadj
     29    USE radiative_mod,  ONLY : radiative_tendencies
    4130    USE writefield_mod, ONLY : writefield
    4231
     
    7968    REAL, DIMENSION(ngrid) :: mu0
    8069    INTEGER :: j,l,ig,nlevel,igout
     70    LOGICAL :: lwrite
    8171    !
    8272    REAL :: zday, zdtime
     
    9080    REAL zdum2(ngrid,nlayer)
    9181    REAL zdum3(ngrid,nlayer)
    92     REAL zdtlw(ngrid,nlayer),zdtsw(ngrid,nlayer)
    93     REAL zfluxsw(ngrid),zfluxlw(ngrid), fluxrad(ngrid)
     82    REAL fluxrad(ngrid)
    9483
    9584    WRITELOG(*,*) 'latitude0', ngrid, lati(1:2), lati(ngrid-1:ngrid)
     
    134123    zdtsrf(:) = 0.
    135124
     125    IF(abs(zday-zday_last-period_sort)<=ptimestep/unjours/10.) THEN
     126       WRITELOG(*,*) 'zday, zday_last SORTIE ', zday, zday_last
     127       LOG_INFO('phyparam')
     128       zday_last=zday
     129       lwrite = .TRUE.
     130    END IF
     131
    136132    !-----------------------------------------------------------------------
    137133    !   calcul du geopotentiel aux niveaux intercouches
     
    167163    !    ---------------------------------------
    168164
    169     IF(callrad) CALL radiative_tendencies(ngrid, igout, nlayer, &
     165    IF(callrad) CALL radiative_tendencies(lwrite, ngrid, igout, nlayer, &
    170166         gmtime, ptimestep*float(iradia), zday, pplev, pplay, pt, &
    171          pdt, zdtlw, zfluxlw, zdtsw, zfluxsw, fluxrad, mu0)
     167         pdt, fluxrad)
    172168
    173169    !-----------------------------------------------------------------------
     
    281277    LOG_DBG('phyparam')
    282278
    283     if(abs(zday-zday_last-period_sort)<=ptimestep/unjours/10.) then
    284        WRITELOG(*,*) 'zday, zday_last SORTIE ', zday, zday_last
    285        LOG_INFO('phyparam')
    286 
    287        zday_last=zday
    288        !  Ecriture/extension de la coordonnee temps
     279    IF(lwrite) THEN
    289280
    290281       do ig=1,ngridmax
     
    299290
    300291       call writefield('du','du',' ',pdu)
    301        call writefield('dv','du',' ',pdv)
    302        call writefield('dt','du',' ',pdt)
    303        call writefield('dtsw','dtsw',' ',zdtsw)
    304        call writefield('dtlw','dtlw',' ',zdtlw)
     292       call writefield('dv','dv',' ',pdv)
     293       call writefield('dt','dt',' ',pdt)
    305294
    306295       call writefield('ts','Surface temper','K',tsurf)
     
    309298       call writefield('coslat','coslat',' ',coslat)
    310299       call writefield('sinlat','sinlat',' ',sinlat)
    311        call writefield('mu0','mu0',' ',mu0)
    312300       call writefield('alb','alb',' ',albedo)
    313301       call writefield('ps','Surface pressure','Pa',pplev(:,1))
    314302       call writefield('slp','Sea level pressure','Pa',zpmer)
    315        call writefield('swsurf','SW surf','Pa',zfluxsw)
    316        call writefield('lwsurf','LW surf','Pa',zfluxlw)
    317 
    318     endif
     303    END IF
    319304
    320305  END SUBROUTINE phyparam
    321 
    322   SUBROUTINE radiative_tendencies(ngrid, igout, nlayer, &
    323        gmtime, zdtime, zday, pplev, pplay, pt, &
    324        pdt, zdtlw, zfluxlw, zdtsw, zfluxsw, fluxrad, mu0)
    325     USE planet
    326     USE phys_const,   ONLY : planet_rad, unjours
    327     USE astronomy,    ONLY : orbite, solarlong
    328     USE solar,        ONLY : solang, zenang, mucorr
    329     USE radiative_sw, ONLY : sw
    330     USE radiative_lw, ONLY : lw
    331 
    332     INTEGER, INTENT(IN) :: ngrid, igout, nlayer
    333     REAL, INTENT(IN)    :: gmtime, zdtime, zday, &
    334          &                 pplev(ngrid,nlayer+1), pplay(ngrid, nlayer), &
    335          &                 pt(ngrid, nlayer+1)
    336     REAL, INTENT(INOUT) :: pdt(ngrid,nlayer)
    337     REAL, INTENT(OUT)   :: zdtlw(ngrid,nlayer), & ! long-wave temperature tendency
    338          &                 zfluxlw(ngrid),      & ! long-wave flux at surface
    339          &                 zdtsw(ngrid,nlayer), & ! short-wave temperature tendency
    340          &                 zfluxsw(ngrid),      & ! short-wave flux at surface
    341          &                 fluxrad(ngrid),      & ! surface flux
    342          mu0(ngrid)             ! ??
    343     ! local variables
    344     REAL :: fract(ngrid), dtrad(ngrid, nlayer)
    345     REAL :: zls, zinsol, tsurf2, ztim1,ztim2,ztim3, dist_sol, declin
    346     REAL :: zplanck(ngrid)
    347     INTEGER :: ig, l
    348 
    349     !    2.1 Insolation
    350     !    --------------------------------------------------
    351 
    352     CALL solarlong(zday,zls)
    353     CALL orbite(zls,dist_sol,declin)
    354 
    355     IF(diurnal) THEN
    356        IF ( .TRUE. ) then
    357           ztim1=SIN(declin)
    358           ztim2=COS(declin)*COS(2.*pi*(zday-.5))
    359           ztim3=-COS(declin)*SIN(2.*pi*(zday-.5))
    360           CALL solang(ngrid,sinlon,coslon,sinlat,coslat, &
    361                &         ztim1,ztim2,ztim3,                   &
    362                &         mu0,fract)
    363        ELSE
    364           CALL zenang(ngrid,zls,gmtime,zdtime,lati,long,mu0,fract)
    365        ENDIF
    366 
    367        IF(lverbose) THEN
    368           WRITELOG(*,*) 'day, declin, sinlon,coslon,sinlat,coslat'
    369           WRITELOG(*,*) zday, declin,                       &
    370                &        sinlon(igout),coslon(igout),  &
    371                &        sinlat(igout),coslat(igout)
    372           LOG_DBG('radiative_tendencies')
    373        ENDIF
    374     ELSE
    375        WRITELOG(*,*) 'declin,ngrid,planet_rad', declin, ngrid, planet_rad
    376        LOG_DBG('radiative_tendencies')
    377        CALL mucorr(ngrid,declin,lati,mu0,fract,height_scale,planet_rad)
    378     ENDIF
    379 
    380     zinsol=solarcst/(dist_sol*dist_sol)
    381 
    382     !    2.2 Radiative tendencies and fluxes:
    383     !    --------------------------------------------------
    384 
    385     CALL sw(ngrid,nlayer,diurnal,coefvis,albedo, &
    386          &              pplev,ps_rad,                 &
    387          &              mu0,fract,zinsol,             &
    388          &              zfluxsw,zdtsw,                &
    389          &              lverbose)
    390 
    391     CALL lw(ngrid,nlayer,coefir,emissiv, &
    392          &             pplev,ps_rad,tsurf,pt, &
    393          &             zfluxlw,zdtlw,         &
    394          &             lverbose)
    395 
    396     !    2.4 surface fluxes
    397     !    ------------------------------
    398 
    399     DO ig=1,ngrid
    400        fluxrad(ig)=emissiv(ig)*zfluxlw(ig) &
    401             &         +zfluxsw(ig)*(1.-albedo(ig))
    402        tsurf2 = tsurf(ig)*tsurf(ig)
    403        zplanck(ig)=emissiv(ig)*stephan*tsurf2*tsurf2
    404        fluxrad(ig)=fluxrad(ig)-zplanck(ig)
    405     ENDDO
    406 
    407     !    2.5 Temperature tendencies
    408     !    --------------------------
    409 
    410     DO l=1,nlayer
    411        DO ig=1,ngrid
    412           dtrad(ig,l)=zdtsw(ig,l)+zdtlw(ig,l)
    413           pdt(ig,l)=pdt(ig,l)+dtrad(ig,l)
    414        ENDDO
    415     ENDDO
    416 
    417     IF(lverbose) THEN
    418        WRITELOG(*,*) 'Diagnostics for radiation'
    419        WRITELOG(*,*) 'albedo, emissiv, mu0,fract,Frad,Planck'
    420        WRITELOG(*,*) albedo(igout),emissiv(igout),mu0(igout), &
    421             &        fract(igout),                       &
    422             &        fluxrad(igout),zplanck(igout)
    423        WRITELOG(*,*) 'Tlay Play Plev dT/dt SW dT/dt LW (K/day)'
    424        WRITELOG(*,*) 'unjours',unjours
    425        DO l=1,nlayer
    426           WRITELOG(*,'(3f15.5,2e15.2)') pt(igout,l),     &
    427                &         pplay(igout,l),pplev(igout,l),  &
    428                &         zdtsw(igout,l),zdtlw(igout,l)
    429        ENDDO
    430        LOG_DBG('radiative_tendencies')
    431     ENDIF
    432 
    433   END SUBROUTINE radiative_tendencies
    434306
    435307  SUBROUTINE alloc(ngrid, nlayer) BIND(C, name='phyparam_alloc')
     
    437309    !$cython wrapper def alloc(ngrid, nlayer) : phy.phyparam_alloc(ngrid, nlayer)
    438310    USE astronomy, ONLY : iniorbit
    439     USE surface, ONLY : zc,zd
    440311    INTEGER, INTENT(IN), VALUE :: ngrid, nlayer
    441     LOGICAL, PARAMETER :: firstcall=.TRUE.
    442312    ! allocate arrays for internal state
    443313    ALLOCATE(tsurf(ngrid))
     
    447317    ALLOCATE(zc(ngrid,nsoilmx),zd(ngrid,nsoilmx))
    448318    ! allocate precomputed arrays
    449     ALLOCATE(rnatur(ngrid))
    450     ALLOCATE(albedo(ngrid),emissiv(ngrid),z0(ngrid),inertie(ngrid))
     319    ALLOCATE(rnatur(ngrid), albedo(ngrid), emissiv(ngrid))
     320    ALLOCATE(z0(ngrid),inertie(ngrid))
    451321    CALL iniorbit
    452322  END SUBROUTINE alloc
     
    455325    !$cython header void phyparam_precompute();
    456326    !$cython wrapper def precompute() : phy.phyparam_precompute()
    457     USE surface
    458327    ! precompute time-independent arrays
    459328    rnatur(:)  = 1.
     329    inertie(:) = (1.-rnatur(:))*I_mer+rnatur(:)*I_ter
     330    z0(:)      = (1.-rnatur(:))*Cd_mer+rnatur(:)*Cd_ter
    460331    emissiv(:) = (1.-rnatur(:))*emi_mer+rnatur(:)*emi_ter
    461     inertie(:) = (1.-rnatur(:))*I_mer+rnatur(:)*I_ter
    462332    albedo(:)  = (1.-rnatur(:))*alb_mer+rnatur(:)*alb_ter
    463     z0(:)      = (1.-rnatur(:))*Cd_mer+rnatur(:)*Cd_ter
    464333  END SUBROUTINE precompute
    465334
     
    468337    !$cython wrapper def coldstart (ngrid, timestep): phy.phyparam_coldstart(ngrid, timestep)
    469338    ! create internal state to start a run without a restart file
    470     USE surface, ONLY : soil
    471339    INTEGER, INTENT(IN), VALUE :: ngrid
    472340    REAL, INTENT(IN),    VALUE :: ptimestep
  • dynamico_lmdz/simple_physics/phyparam/physics/radiative_sw.F90

    r4233 r4242  
    2323  END SUBROUTINE monGATHER
    2424
    25   PURE subroutine monscatter(n,a,index,b)
    26     INTEGER, INTENT(IN) :: n,index(n)
    27     REAL, INTENT(IN) :: b(n)
    28     REAL, INTENT(OUT) :: a(n)
     25  PURE subroutine monscatter(ngrid, n,a,index,b)
     26    INTEGER, INTENT(IN) :: ngrid, n,index(n)
     27    REAL, INTENT(IN)    :: b(n)
     28    REAL, INTENT(OUT)   :: a(ngrid)
    2929    INTEGER :: i
    30     DO i=1,n
    31        a(index(i))=b(i)
    32     END DO
     30    IF(n<ngrid) THEN
     31       a(:)=0.
     32       DO i=1,n
     33          a(index(i))=b(i)
     34       END DO
     35    ELSE
     36       a(:)=b(:)
     37    END IF
    3338  end subroutine monscatter
    3439
    35   SUBROUTINE sw(ngrid,nlayer,ldiurn, &
    36        coefvis,albedo, &
    37        plevel,ps_rad,pmu,pfract,psolarf0, &
    38        fsrfvis,dtsw, &
    39        lwrite)
     40  SUBROUTINE sw(ngrid,nlayer,ldiurn, coefvis,albedo, &
     41       &        plevel,ps_rad,pmu,pfract,psolarf0, &
     42       &        fsrfvis,dtsw, lverbose, lwrite)
    4043    USE phys_const, ONLY : cpp, g
     44    USE writefield_mod, ONLY : writefield
     45
    4146    !=======================================================================
    4247    !
     
    5459    !
    5560    INTEGER, INTENT(IN) :: ngrid,nlayer
    56     LOGICAL, INTENT(IN) :: lwrite,ldiurn
     61    LOGICAL, INTENT(IN) :: ldiurn, lverbose, lwrite
    5762    REAL, INTENT(IN)    :: albedo(ngrid), coefvis
    5863    REAL, INTENT(IN)    :: pmu(ngrid), pfract(ngrid)
     
    6671
    6772    INTEGER ig,l,nlevel,index(ngrid),ncount,igout
    68     REAL ztrdir(ngrid,nlayer+1),ztrref(ngrid,nlayer+1)
    69     REAL zfsrfref(ngrid)
     73    REAL ztrdir(ngrid,nlayer+1), & ! transmission coef for downward flux
     74         ztrref(ngrid,nlayer+1)    ! transmission coef for upward flux
     75    REAL zfsrfref(ngrid)           ! upward flux at surface
    7076    REAL z1(ngrid)
    7177    REAL zu(ngrid,nlayer+1)
    7278    REAL tau0
     79
     80    REAL :: flux_in(ngrid), &             ! incoming solar flux
     81         &  flux_ref(ngrid), &            ! flux reflected by surface
     82         &  flux_down(ngrid, nlayer+1), & ! downward flux
     83         &  flux_up(ngrid, nlayer+1)      ! upward flux
     84    REAL :: buf1(ngrid), buf2(ngrid, nlayer+1) ! buffers for output
    7385
    7486    !-----------------------------------------------------------------------
     
    125137    !   -----------------------------------------------------------
    126138
     139    DO ig=1,ncount
     140       flux_in(ig) = psolarf0*zfract(ig)*zmu(ig)
     141    ENDDO
     142
    127143    DO l=1,nlevel
    128144       DO ig=1,ncount
    129           ztrdir(ig,l)=exp(-zu(ig,l)/zmu(ig))
    130        ENDDO
    131     ENDDO
    132 
    133     IF (lwrite) THEN
     145          ztrdir(ig,l)=exp(-zu(ig,l)/zmu(ig)) ! transmission coefficient
     146          flux_down(ig,l) = flux_in(ig)*ztrdir(ig,l)
     147       ENDDO
     148    ENDDO
     149
     150    IF (lverbose) THEN
    134151       igout=ncount/2+1
    135152       WRITELOG(*,*)
     
    149166    DO l=1,nlayer
    150167       DO ig=1,ncount
    151           zdtsw(ig,l)=g*psolarf0*zfract(ig)*zmu(ig)*      &
    152                (ztrdir(ig,l+1)-ztrdir(ig,l))/    &
    153                (cpp*(zplev(ig,l)-zplev(ig,l+1)))
    154        ENDDO
    155     ENDDO
    156     IF (lwrite) THEN
     168          ! m.cp.dT = dflux/dz
     169          ! m = -(dp/dz)/g
     170          ! flux = ztrdir * psolarf0*zfract*zmu
     171          IF(.FALSE.) THEN
     172             zdtsw(ig,l)=g*psolarf0*zfract(ig)*zmu(ig)       &
     173                  &     *(ztrdir(ig,l+1)-ztrdir(ig,l))     &
     174                  &     /(cpp*(zplev(ig,l)-zplev(ig,l+1)))
     175          ELSE
     176             zdtsw(ig,l)=(g/cpp) &
     177                  &     * (flux_down(ig,l+1)-flux_down(ig,l)) &
     178                  &     / (zplev(ig,l)-zplev(ig,l+1))
     179          END IF
     180       ENDDO
     181    ENDDO
     182    IF (lverbose) THEN
    157183       WRITELOG(*,*)
    158184       WRITELOG(*,*) 'Diagnostique des taux de chauffage solaires:'
     
    169195
    170196    DO ig=1,ncount
    171        z1(ig)=zfract(ig)*zmu(ig)*psolarf0*ztrdir(ig,1)
    172        zflux(ig)=(1.-zalb(ig))*z1(ig)
    173        zfsrfref(ig)=    zalb(ig)*z1(ig)
    174     ENDDO
    175     IF (lwrite) THEN
     197       z1(ig)=zfract(ig)*zmu(ig)*psolarf0*ztrdir(ig,1) ! total (down)
     198       zflux(ig)=(1.-zalb(ig))*z1(ig)                  ! absorbed (net)
     199       zfsrfref(ig)=    zalb(ig)*z1(ig)                ! reflected (up)
     200    ENDDO
     201    IF (lverbose) THEN
    176202       WRITELOG(*,*)
    177203       WRITELOG(*,*) 'Diagnostique des taux de chauffage solaires:'
     
    182208
    183209    !-----------------------------------------------------------------------
    184     !   5.calcul des traansmissions depuis le sol, cas diffus:
     210    !   5.calcul des transmissions depuis le sol, cas diffus:
    185211    !   ------------------------------------------------------
    186212
     
    191217    ENDDO
    192218
    193     IF (lwrite) THEN
     219    IF (lverbose) THEN
    194220       WRITELOG(*,*)
    195221       WRITELOG(*,*) 'Diagnostique des taux de chauffage solaires'
     
    214240
    215241    !-----------------------------------------------------------------------
    216     !   10. sorites eventuelles:
     242    !   10. sorties eventuelles:
    217243    !   ------------------------
    218244
    219     IF (lwrite) THEN
     245    IF (lverbose) THEN
    220246       WRITELOG(*,*)
    221247       WRITELOG(*,*) 'Diagnostique des taux de chauffage solaires:'
     
    226252    ENDIF
    227253
    228     IF (ldiurn) THEN
    229        fsrfvis(:)=0.
    230        CALL monscatter(ncount,fsrfvis,index,zflux)
    231        dtsw(:,:)=0.
    232        DO l=1,nlayer
    233           CALL monscatter(ncount,dtsw(1,l),index,zdtsw(1,l))
    234        ENDDO
    235     ELSE
    236        WRITELOG(*,*) 'NOT DIURNE'
    237        fsrfvis(:)=zflux(:)
    238        dtsw(:,:)=zdtsw(:,:)
    239     ENDIF
    240     !        call dump2d(iim,jjm-1,zflux(2),'ZFLUX      ')
    241     !        call dump2d(iim,jjm-1,fsrfvis(2),'FSRVIS     ')
    242     !        call dump2d(iim,jjm-1,ztrdir(2,1),'ztrdir     ')
    243     !        call dump2d(iim,jjm-1,pmu(2),'pmu        ')
    244     !        call dump2d(iim,jjm-1,pfract(2),'pfract     ')
    245     !        call dump2d(iim,jjm-1,albedo(2),'albedo     ')
    246     !        call dump2d(iim,jjm-1,ztrdir(2,1),'ztrdir     ')
     254    CALL monscatter(ngrid,ncount,fsrfvis,index,zflux)
     255    DO l=1,nlayer
     256       CALL monscatter(ngrid,ncount,dtsw(:,l),index,zdtsw(:,l))
     257    ENDDO
     258
     259    IF(lwrite) THEN
     260       CALL monscatter(ngrid, ncount,buf1,index,flux_in)
     261       CALL writefield('swtop','SW down TOA','W/m2',buf1)
     262
     263       DO l=1,nlayer+1
     264          CALL monscatter(ngrid,ncount,buf2(:,l),index,flux_down(:,l))
     265       ENDDO
     266       CALL writefield('swflux_down','Downwards SW flux','W/m2',buf2)
     267
     268    END IF
     269
    247270    LOG_INFO('rad_sw')
    248271
  • dynamico_lmdz/simple_physics/phyparam/physics/surface.F90

    r4233 r4242  
    1515  ! precomputed variables
    1616  REAL :: lambda
    17   REAL,ALLOCATABLE :: dz1(:),dz2(:)
    18   !$OMP THREADPRIVATE(dz1,dz2,zc,lambda)
    19 
    20   ! internal state variables needed for checkpoint/restart
     17  REAL, ALLOCATABLE :: dz1(:),dz2(:)
     18  !$OMP THREADPRIVATE(dz1,dz2,zc)
     19  REAL, ALLOCATABLE :: rnatur(:), albedo(:),emissiv(:), z0(:), inertie(:)
     20  !$OMP THREADPRIVATE( rnatur, albedo, emissiv, z0, inertie)
     21
     22  ! internal state, written to / read from disk at checkpoint / restart
    2123  REAL, ALLOCATABLE :: zc(:,:),zd(:,:)
    2224  !$OMP THREADPRIVATE(zc,zd)
    23 
    24   PUBLIC :: soil, zc, zd
     25  REAL, ALLOCATABLE :: tsurf(:), tsoil(:,:), capcal(:), fluxgrd(:)
     26  !$OMP THREADPRIVATE(tsurf, tsoil, capcal, fluxgrd)
     27
     28  PUBLIC :: soil, zc, zd, &
     29       rnatur, albedo, emissiv, z0, inertie, &
     30       tsurf, tsoil, capcal, fluxgrd
    2531
    2632CONTAINS
Note: See TracChangeset for help on using the changeset viewer.