Ignore:
Timestamp:
Feb 21, 2023, 9:08:49 AM (20 months ago)
Author:
emillour
Message:

Generic PCM:
Some cleanup in aerosol_mod.F90 : integrate "iniaerosol" in the module.
Also adapted kcm1d to follow up on recent code updates.
EM

Location:
trunk/LMDZ.GENERIC/libf/phystd
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90

    r2831 r2898  
    22module aerosol_mod
    33implicit none
    4 save
     4
    55!==================================================================
    66
    77!  aerosol indexes: these are initialized to be 0 if the
    88!                 corresponding aerosol was not activated in callphys.def
    9 !                 -- otherwise a value is given in iniaerosol
    10       integer :: iaero_co2 = 0
    11       integer :: iaero_h2o = 0
    12       integer :: iaero_dust = 0
    13       integer :: iaero_h2so4 = 0
    14       logical :: noaero = .false.
     9!                 -- otherwise a value is set via iniaerosol
     10      integer, save, protected :: iaero_co2 = 0
     11      integer, save, protected :: iaero_h2o = 0
     12      integer, save, protected :: iaero_dust = 0
     13      integer, save, protected :: iaero_h2so4 = 0
     14      logical, save, protected :: noaero = .false.
    1515!$OMP THREADPRIVATE(iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero)
    1616
    1717! two-layer simple aerosol model
    18       integer :: iaero_back2lay = 0
     18      integer, save, protected :: iaero_back2lay = 0
    1919 ! NH3 cloud
    20       integer :: iaero_nh3 = 0
     20      integer, save, protected :: iaero_nh3 = 0
    2121! N-layer aerosol model (replaces the 2-layer and hard-coded clouds)
    22       integer,dimension(:),allocatable,save :: iaero_nlay
     22      integer,dimension(:), allocatable, save, protected :: iaero_nlay
    2323! Auroral aerosols
    24       integer :: iaero_aurora = 0
     24      integer, save, protected :: iaero_aurora = 0
    2525!$OMP THREADPRIVATE(iaero_back2lay,iaero_nh3,iaero_nlay,iaero_aurora)
    2626
    2727! Generic aerosols
    28       integer, dimension(:),allocatable,save :: iaero_generic
    29       integer,dimension(:),allocatable,save :: i_rgcs_ice
     28      integer, dimension(:), allocatable, save, protected :: iaero_generic
     29      integer, dimension(:), allocatable, save, protected :: i_rgcs_ice
    3030!$OMP THREADPRIVATE(iaero_generic,i_rgcs_ice)
    3131
    3232! Venus clouds
    33       integer :: iaero_venus1 = 0
    34       integer :: iaero_venus2 = 0
    35       integer :: iaero_venus2p = 0
    36       integer :: iaero_venus3 = 0
    37       integer :: iaero_venusUV = 0
     33      integer, save, protected :: iaero_venus1 = 0
     34      integer, save, protected :: iaero_venus2 = 0
     35      integer, save, protected :: iaero_venus2p = 0
     36      integer, save, protected :: iaero_venus3 = 0
     37      integer, save, protected :: iaero_venusUV = 0
    3838!$OMP THREADPRIVATE(iaero_venus1,iaero_venus2,iaero_venus2p)
    3939!$OMP THREADPRIVATE(iaero_venus3,iaero_venusUV)
    4040
     41!==================================================================
     42
     43contains
     44
     45  SUBROUTINE iniaerosol
     46
     47  use mod_phys_lmdz_para, only : is_master
     48  use radinc_h, only: naerkind
     49  use tracer_h, only: n_rgcs, nqtot, is_rgcs
     50  use callkeys_mod, only: aeroco2, aeroh2o, dusttau, aeroh2so4, &
     51                          aeroback2lay, aeronh3, nlayaero, aeronlay, &
     52                          aeroaurora, aerogeneric, &
     53                          aerovenus1, aerovenus2, aerovenus2p, &
     54                          aerovenus3, aerovenusUV
     55
     56  IMPLICIT NONE
     57!=======================================================================
     58!   subject:
     59!   --------
     60!   Initialization related to aerosols
     61!   (CO2 aerosols, dust, water, chemical species, ice...)   
     62!
     63!   author: Laura Kerber, S. Guerlet
     64!   ------
     65!       
     66!=======================================================================
     67
     68  integer :: i, ia, iq
     69
     70  ! Special case, dyn. allocation for n-layer depending on callphys.def
     71  IF(.NOT.ALLOCATED(iaero_nlay)) ALLOCATE(iaero_nlay(nlayaero))
     72  iaero_nlay(:) = 0
     73  ! Do the same for iaero_generic and i_rgcs_ice
     74  IF (.not. allocated(iaero_generic)) allocate(iaero_generic(aerogeneric))
     75  if (.not. allocated(i_rgcs_ice)) allocate(i_rgcs_ice(aerogeneric))
     76
     77  ! Init of i_rgcs_ice
     78  i_rgcs_ice(:) =0
     79  ia = 1
     80  do iq=1,nqtot
     81    if (is_rgcs(iq) .eq. 1) then
     82        i_rgcs_ice(ia)=iq
     83        ia = ia+1
     84     endif
     85  enddo
     86
     87  iaero_generic(:)=0
     88  ia=0
     89  if (aeroco2) then
     90     ia=ia+1
     91     iaero_co2=ia
     92  endif
     93  if (is_master) write(*,*) '--- CO2 aerosol = ', iaero_co2
     94
     95  if (aeroh2o) then
     96     ia=ia+1
     97     iaero_h2o=ia
     98      endif
     99  if (is_master) write(*,*) '--- H2O aerosol = ', iaero_h2o
     100
     101  if (dusttau.gt.0) then
     102     ia=ia+1
     103     iaero_dust=ia
     104  endif
     105  if (is_master) write(*,*) '--- Dust aerosol = ', iaero_dust
     106
     107  if (aeroh2so4) then
     108     ia=ia+1
     109     iaero_h2so4=ia
     110  endif
     111  if (is_master) write(*,*) '--- H2SO4 aerosol = ', iaero_h2so4
    41112     
    42 !==================================================================
     113  if (aeroback2lay) then
     114     ia=ia+1
     115     iaero_back2lay=ia
     116  endif
     117  if (is_master) write(*,*) '--- Two-layer aerosol = ', iaero_back2lay
     118
     119  if (aeronh3) then
     120     ia=ia+1
     121     iaero_nh3=ia
     122  endif
     123  if (is_master) write(*,*) '--- NH3 Cloud = ', iaero_nh3
     124
     125  if (aeronlay) then
     126     do i=1,nlayaero
     127       ia=ia+1
     128       iaero_nlay(i)=ia
     129     enddo
     130  endif
     131  if (is_master) write(*,*) '--- N-layer aerosol = ', iaero_nlay
     132
     133  if (aeroaurora) then
     134     ia=ia+1
     135     iaero_aurora=ia
     136  endif
     137  if (is_master) write(*,*) '--- Auroral aerosols = ', iaero_aurora
     138
     139  if (aerovenus1) then
     140     ia=ia+1
     141     iaero_venus1=ia
     142  endif
     143  if (is_master) write(*,*) '--- Venus cloud, mode 1 aerosol = ', iaero_venus1
     144
     145  if (aerovenus2) then
     146     ia=ia+1
     147     iaero_venus2=ia
     148  endif
     149  if (is_master) write(*,*) '--- Venus cloud, mode 2 aerosol = ', iaero_venus2
     150
     151  if (aerovenus2p) then
     152     ia=ia+1
     153     iaero_venus2p=ia
     154  endif
     155  if (is_master) write(*,*) '--- Venus cloud, mode 2p aerosol = ', iaero_venus2p
     156
     157  if (aerovenus3) then
     158     ia=ia+1
     159     iaero_venus3=ia
     160  endif
     161  if (is_master) write(*,*) '--- Venus cloud, mode 3 aerosol = ', iaero_venus3
     162
     163  if (aerovenusUV) then
     164     ia=ia+1
     165     iaero_venusUV=ia
     166  endif
     167  if (is_master) write(*,*) '--- Venus cloud, UV absorber = ', iaero_venusUV
     168
     169  if (aerogeneric .ne. 0) then
     170     do i=1,aerogeneric
     171        ia = ia+1
     172        iaero_generic(i) = ia
     173     enddo
     174  endif
     175     
     176  if (is_master) then
     177    write(*,*)'--- Radiative Generic Condensable Species = ',iaero_generic
     178
     179    write(*,*) '=== Number of aerosols= ', ia
     180  endif ! of is_master
     181
     182! For the zero aerosol case, we currently make a dummy co2 aerosol which is zero everywhere.
     183! (See aeropacity.F90 for how this works). A better solution would be to turn off the
     184! aerosol machinery in the no aerosol case, but this would be complicated. LK
     185
     186  if (ia.eq.0) then  !For the zero aerosol case.
     187     ia = 1
     188     noaero = .true.
     189     iaero_co2=ia
     190  endif
     191
     192  if (ia.ne.naerkind) then
     193    if (is_master) then
     194      print*, 'Aerosols counted not equal to naerkind'
     195      print*, 'Compile with tag -s',ia,'to run'
     196      print*, 'or change options in callphys.def'
     197      print*, 'Abort in iniaerosol'
     198    endif
     199    call abort_physic("iniaerosl",'wrong number of aerosols',1)
     200  endif ! of if (ia.ne.naerkind)
     201
     202  END SUBROUTINE iniaerosol
     203
    43204end module aerosol_mod
    44205!==================================================================
  • trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90

    r2785 r2898  
    1010  use callkeys_mod, only: pceil, tstrat, tracer, global1d
    1111  use inifis_mod, only: inifis
     12  use aerosol_mod, only: iniaerosol
     13  use callcorrk_mod, only: callcorrk
    1214  use comcstfi_mod
    1315  use mod_grid_phy_lmdz, only : regular_lonlat
     
    5658  real,allocatable :: vmr(:,:) ! tracer mixing ratio [mol/mol]
    5759  real,allocatable :: qsurf(:)        ! tracer surface budget [kg/kg] ????
    58   real psurf,psurf_n,tsurf     
    59 
    60   real emis, albedo, albedo_equivalent
     60  real psurf,psurf_n,tsurf(1)     
     61
     62  real emis(1), albedo(1), albedo_equivalent(1)
    6163  real albedo_wv(1,L_NSPECTV)
    6264
     
    6567  real dtsw(llm) ! heating rate (K/s) due to SW
    6668  real dtlw(llm) ! heating rate (K/s) due to LW
    67   real fluxsurf_lw   ! incident LW flux to surf (W/m2)
    68   real fluxtop_lw    ! outgoing LW flux to space (W/m2)
    69   real fluxsurf_sw   ! incident SW flux to surf (W/m2)
    70   real fluxsurfabs_sw ! absorbed SW flux by the surf (W/m2)
    71   real fluxabs_sw    ! SW flux absorbed by planet (W/m2)
    72   real fluxtop_dn    ! incident top of atmosphere SW flux (W/m2)
     69  real fluxsurf_lw(1)   ! incident LW flux to surf (W/m2)
     70  real fluxtop_lw(1)    ! outgoing LW flux to space (W/m2)
     71  real fluxsurf_sw(1)   ! incident SW flux to surf (W/m2)
     72  real fluxsurfabs_sw(1) ! absorbed SW flux by the surf (W/m2)
     73  real fluxabs_sw(1)    ! SW flux absorbed by planet (W/m2)
     74  real fluxtop_dn(1)    ! incident top of atmosphere SW flux (W/m2)
    7375
    7476  ! not used
    75   real cloudfrac(llm)
    76   real totcloudfrac
    77   real tau_col
     77  real cloudfrac(1,llm)
     78  real totcloudfrac(1)
     79  real tau_col(1)
    7880
    7981  real dTstrat
     
    8183  real OLR_nu(1,L_NSPECTI)
    8284  real OSR_nu(1,L_NSPECTV)
     85  real GSR_nu(1,L_NSPECTV)
     86  real int_dtaui(1,llm,L_NSPECTI)
     87  real int_dtauv(1,llm,L_NSPECTV)
    8388  real Eatmtot
    8489
     
    100105  pi=2.E+0*asin(1.E+0)
    101106
    102   cloudfrac(:)  = 0.0
    103   totcloudfrac  = 0.0
     107  cloudfrac(1,:)  = 0.0
     108  totcloudfrac(1)  = 0.0
    104109
    105110
     
    254259  write(*,*) " albedo = ",albedo
    255260  do iw=1,L_NSPECTV
    256      albedo_wv(1,iw)=albedo
     261     albedo_wv(1,iw)=albedo(1)
    257262  enddo
    258263
     
    360365         
    361366               
    362      call iniaerosol()
     367     call iniaerosol
    363368     
    364369
     
    372377          dtlw,dtsw,fluxsurf_lw,fluxsurf_sw,              &
    373378          fluxsurfabs_sw,fluxtop_lw,                      &
    374           fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,tau_col,    &
    375           cloudfrac,totcloudfrac,.false.,firstcall,lastcall)
     379          fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,GSR_nu,     &
     380          int_dtaui,int_dtauv,                            &
     381          tau_col,cloudfrac,totcloudfrac,                 &
     382          .false.,firstcall,lastcall)
    376383
    377384     !write(*,*) 'BASE 3'
     
    397404     ! skin temperature (gray approx.) using analytic pure H2 expression
    398405     !Tstrat  = (fluxabs_sw/(2*sigma))**0.25 ! skin temperature (gray approx.)
    399      Tstrat  = (fluxtop_lw/(2*sigma))**0.25 ! skin temperature (gray approx.)
     406     Tstrat  = (fluxtop_lw(1)/(2*sigma))**0.25 ! skin temperature (gray approx.)
    400407     dTstrat = dTstrat-Tstrat
    401408
     
    422429       tsurf,fract,dist_star,aerosol,muvar,                    &
    423430       dtlw,dtsw,fluxsurf_lw,fluxsurf_sw,fluxsurfabs_sw,       &
    424        fluxtop_lw, fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,        &
    425        tau_col,                                                &
    426        cloudfrac,totcloudfrac,.false.,firstcall,lastcall)
     431       fluxtop_lw, fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,GSR_nu, &
     432       int_dtaui,int_dtauv,                                    &
     433       tau_col,cloudfrac,totcloudfrac,                         &
     434       .false.,firstcall,lastcall)
    427435
    428436
  • trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90

    r2891 r2898  
    2121      use radcommon_h, only: sigma, glat, grav, BWNV, WNOI, DWNI, DWNV, WNOV
    2222      use radii_mod, only: h2o_reffrad, co2_reffrad
    23       use aerosol_mod, only: iaero_co2, iaero_h2o
     23      use aerosol_mod, only: iniaerosol, iaero_co2, iaero_h2o
    2424      use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe, &
    2525                           dryness
     
    512512!        Initialize aerosol indexes.
    513513!        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    514          call iniaerosol()
     514         call iniaerosol
    515515
    516516#ifdef CPP_XIOS
Note: See TracChangeset for help on using the changeset viewer.