Changeset 3035 for trunk/LMDZ.VENUS/libf


Ignore:
Timestamp:
Sep 7, 2023, 3:47:46 PM (16 months ago)
Author:
amartinez
Message:

======= VENUS PCM ===============

COMMIT BY ANTOINE MARTINEZ

Implementation of vertical ambipolar diffusion in physics

=================================

NEW KEYWORD OF PHYSIQ.DEF

=================================

NEW VERSION OF "physiq.def"

  • deftank/physiq-96x96x90-chemistry-IONOSPHERE-IONDIFF.def
  • ok_iondiff: keyword supposed to activate ion ambipolar diffusion
  • nbapp_chem: replaces nbapp_chim, in order to characterize the Number of calls to the chemistry routines (per Venusian day)

================

phyvenus

================

Iondiff_red.F

  • Calculation of the Ion Ambipolar Diffusion for 13 ions on 14:

O2+, O+, C+, N+, CO2+,
NO+, CO+, H+, H2O+, H3O+,

HCO+, N2+, OH+


The ion temperature is fixed as the half of the electron temperature
calculated in ion_h.F for the stability of the program and because the
ion temperature is lower than electron temperature.

plasmaphys_venus_mod.F90

  • parameters of the ambipolar diffusion scheme:

parameter (Pdiffion = 7.0D-4) ! pressure in Pa below which ion diffusion is computed
parameter (naltvert = 168) ! number of level on the altimetric subgrid
parameter (nsubvert = 24000) ! ptimephysiq/nsubvert - minimum sub-timestep allowed
parameter ( nsubmin = 40) ! ptimephysiq/nsubmin - maximum sub-timestep allowed

physic_mod.F

  • nbapp_chem is not fixed anymore here but deftank/in physiq.def
  • Ambipolar diffusion activated if (ok_iondiff) is true

conf_phys.f90

  • add ok_iondiff as parameters to read from physiq.def file set to .false. by default
  • add nbapp_chem as parameters to characterize the Number of calls to the chemistry routines (per Venusian day) instead of be fixed in physic_mod.F

to read from physiq.def file set to 24000 by default

cleshphys.h

  • added ok_iondiff & nbapp_chem in COMMON/clesphys_l/
  • removed nbapp_chim

phytrac_chemistry.F

  • Added security in the calculation of the sza_local in order to avoid the rare case where the |range| is above 1
Location:
trunk/LMDZ.VENUS/libf/phyvenus
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.VENUS/libf/phyvenus/clesphys.h

    r2836 r3035  
    1111       LOGICAL ok_orodr,ok_orolf,ok_gw_nonoro
    1212       LOGICAL ok_kzmin,tuneupperatm, ok_ionchem, ok_jonline
     13       LOGICAL ok_iondiff
    1314       LOGICAL callnlte,callnirco2,callthermos
    1415       LOGICAL ok_cloud, ok_chem, reinit_trac, ok_sedim
    1516       LOGICAL ok_clmain, physideal, startphy_file
    16        INTEGER nbapp_rad, nbapp_chim, iflag_con, iflag_ajs
     17       INTEGER nbapp_rad, nbapp_chem, iflag_con, iflag_ajs
    1718       INTEGER lev_histins, lev_histday, lev_histmth
    1819       INTEGER tr_scheme, cl_scheme
     
    2930     &     tuneupperatm,callnlte,callnirco2,callthermos,                &
    3031     &     ok_cloud, ok_chem, reinit_trac, ok_sedim,                    &
    31      &     ok_clmain, physideal, startphy_file, ok_ionchem, ok_jonline
     32     &     ok_clmain, physideal, startphy_file, ok_ionchem, ok_jonline, &
     33     &     ok_iondiff
    3234
    33        COMMON/clesphys_i/ nbapp_rad, nbapp_chim,                        &
     35       COMMON/clesphys_i/ nbapp_rad, nbapp_chem,                        &
    3436     &     iflag_con, iflag_ajs,                                        &
    3537     &     lev_histins, lev_histday, lev_histmth, tr_scheme,            &
  • trunk/LMDZ.VENUS/libf/phyvenus/conf_phys.F90

    r2969 r3035  
    9292       call getin('nbapp_rad',nbapp_rad)
    9393       print*,"nbapp_rad",nbapp_rad
    94 !Config  Key  = nbapp_chim
     94!Config  Key  = nbapp_chem
    9595!Config  Desc = Frequence d'appel a la chimie
    96 !Config  Def  = 1
     96!Config  Def  = 24000
    9797!Config  Help = Nombre  d'appels des routines de chimie
    9898!Config         par jour.
    99        nbapp_chim = 1
    100        call getin('nbapp_chim',nbapp_chim)
     99       nbapp_chem = 24000
     100       call getin('nbapp_chem',nbapp_chem)
    101101
    102102!Config  Key  = iflag_con
     
    481481!Config Desc =
    482482!Config Def  = .false.
    483 !Config Help =
     483!Config Help = Activate thermosphere tuning for oxygen compensation
    484484!
    485485  tuneupperatm = .false.
     
    499499!Config Desc =
    500500!Config Def  = .false.
    501 !Config Help =
     501!Config Help = Activate the ionosphere chemistry
    502502!
    503503  ok_ionchem = .false.
     
    514514
    515515!
     516!Config Key  = ok_iondiff
     517!Config Desc =
     518!Config Def  = .false.
     519!Config Help = Activate the ambipolar ion diffusion in physic
     520!
     521  ok_iondiff = .false.
     522  call getin('ok_iondiff',ok_iondiff)
     523
     524  if ((ok_ionchem.eqv..false.).and.(.true..eqv.ok_iondiff)) then
     525    write(*,*) "Error incoherent flags :"
     526    write(*,*) "ok_ionchem=",ok_ionchem," / ok_iondiff=",ok_iondiff
     527    write(*,*) "If you include ions diffusion,"
     528    write(*,*) "   you need also ok_ionchem==.true."
     529    write(*,*) "If you do not include ions diffusion,"
     530    write(*,*) "   you need ok_iondiff==.false."
     531    write(*,*) "Check physiq.def"
     532    stop
     533  endif
     534
     535!
    516536!
    517537!Config Key  =
     
    535555  write(lunout,*)' ok_gw_nonoro = ', ok_gw_nonoro
    536556  write(lunout,*)' nbapp_rad = ', nbapp_rad
    537   write(lunout,*)' nbapp_chim = ', nbapp_chim
     557  write(lunout,*)' nbapp_chem = ', nbapp_chem
    538558  write(lunout,*)' iflag_con = ', iflag_con
    539559  write(lunout,*)' Sortie journaliere = ', ok_journe
     
    576596  write(lunout,*)' ok_jonline = ',ok_jonline
    577597  write(lunout,*)' ok_ionchem = ',ok_ionchem
    578  
     598  write(lunout,*)' ok_iondiff = ',ok_iondiff
     599
    579600  end subroutine conf_phys
    580601
  • trunk/LMDZ.VENUS/libf/phyvenus/nonoro_gwd_ran_mod.F90

    r2836 r3035  
    264264             zp(jw, ii) = (sign(1., 0.5 - ran_num_1) &
    265265                        + 1.) * RPI / 2.
     266           !   zp(jw, ii) = atan2(4.*vh(ii, launch),uh(ii, launch)) &
     267           !            + (sign(1., 0.5 - ran_num_1) + 1.) * RPI / 2.
    266268           ! --------- TRY 00 -----------------------
    267269           !IF((abs(latitude_deg(ii)) .le. 55.)) THEN
     
    301303                     sqrt(3.) / sqrt(na * 1.)
    302304           end DO
     305           !cpha = cpha - uh(ii, launch)
    303306           IF (cpha < 0.) THEN
    304307              cpha = - 1. * cpha
    305308              zp (jw, ii) = zp(jw, ii) + RPI
    306309           ENDIF
     310           !IF (cpha < 1.) THEN
     311           !  cpha = 1.
     312           !ENDIF
    307313! otherwise, with the computation below, we get a uniform distribution between cmin and cmax.
    308314!           ran_num_3 = mod(tt(ii, jw)**2, 1.)
  • trunk/LMDZ.VENUS/libf/phyvenus/photochemistry_venus.F90

    r2949 r3035  
    25072507!-- TuneE
    25082508! VCD 2.0 tuning
    2509     v_phot(65:90,4) = v_phot(65:90,4)*10. ! CO2 + hv ==> O(1D) + CO
     2509    v_phot(65:nz,4) = v_phot(65:nz,4)*10. ! CO2 + hv ==> O(1D) + CO
    25102510!--
    25112511!   v_phot(:,4) = v_phot(:,4)*10.
     
    45904590          v_phot(65:nz,4) = v_phot(65:nz,4)*8. ! CO2 + hv ==> O(1D) + CO
    45914591      !--
     4592      ! TEST TUNEH
     4593      !     v_phot(62:74,4) = v_phot(62:74,4)*6.5 ! CO2 + hv ==> O(1D) + CO
     4594      !--
    45924595      !   v_phot(:,4) = v_phot(:,4)*10.
    45934596      !do ij=3,4
  • trunk/LMDZ.VENUS/libf/phyvenus/physiq_mod.F

    r2836 r3035  
    298298
    299299      integer :: chempas
    300       real :: nbapp_chem, zctime
     300      real :: zctime
    301301
    302302! sedimentation
     
    340340c Tendencies due to molecular diffusion
    341341      real d_q_moldif(klon,klev,nqmax)
     342
     343c Tendencies due to ambipolar ion diffusion
     344      real d_q_iondif(klon,klev,nqmax)
    342345
    343346c
     
    671674         ENDIF
    672675
     676c Verification synchronize AMBIPOLAR DIFFUSION & CHEMISTRY
     677
     678         IF ((ok_iondiff) .and. (NINT(RDAY/dtime).ne.nbapp_chem)) THEN
     679          WRITE(lunout,*)'nbapp_chem .NE. day_step'
     680          WRITE(lunout,*)'nbapp_chem ', nbapp_chem
     681          WRITE(lunout,*)'day_step ', NINT(RDAY/dtime)
     682          WRITE(lunout,*)'nbapp_chem must be equal to day_step'
     683          STOP
     684         ENDIF
     685       
    673686c Initialisation des sorties
    674687c===========================
     
    10501063!=========
    10511064
    1052          nbapp_chem = 24000
     1065         
    10531066         chempas = nint(rday/pdtphys/nbapp_chem)
    10541067         zctime = dtime*real(chempas)             ! chemical timestep
     
    16591672
    16601673c====================================================================
     1674
     1675c==================================
     1676!  --  ION AMBIPOLAR DIFFUSION ---
     1677c==================================
     1678
     1679         d_q_iondif(:,:,:)=0
     1680
     1681         IF (callthermos .and. ok_chem .and. ok_ionchem) THEN
     1682           IF (ok_iondiff) THEN
     1683
     1684            call iondiff_red(klon,klev,nqmax,pplay,paprs,
     1685     &                        t_seri,tr_seri,pphis,
     1686     &                        gmtime,latitude_deg,longitude_deg,
     1687     &                        pdtphys,d_t_euv,d_t_conduc,d_q_moldif,
     1688     &                        d_q_iondif)
     1689
     1690            !write (*,*) 'TITI EST PASSE PAR LA'
     1691! --- update tendencies tracers ---
     1692
     1693            DO iq = 1, nqmax
     1694              IF (type_tr(iq) .eq. 2) THEN
     1695                DO k=1,klev
     1696                  DO ig=1,klon
     1697                    tr_seri(ig,k,iq)= max(tr_seri(ig,k,iq)+
     1698     &                           d_q_iondif(ig,k,iq)*dtime,1.e-30)
     1699                  ENDDO
     1700                ENDDO
     1701              ENDIF
     1702            ENDDO
     1703           ENDIF ! ok_iondiff
     1704         ENDIF  ! callthermos & ok_chem & ok_ionchem
     1705
     1706c====================================================================
    16611707      ! tests: output tendencies
    16621708!      call writefield_phy('physiq_dtrad',dtrad,klev)
  • trunk/LMDZ.VENUS/libf/phyvenus/phytrac_chimie.F

    r2836 r3035  
    391391                       
    392392!           solar zenith angle
    393 
    394             sza_local = acos(cos(lat_local(ilon))*cos(lon_local(ilon))
     393!            sza_local = acos(cos(lat_local(ilon))*cos(lon_local(ilon))
     394!     $                 *cos(lon_sun) + cos(lat_local(ilon))
     395!     $                 *sin(lon_local(ilon))*sin(lon_sun))*180./rpi
     396
     397            sza_local = cos(lat_local(ilon))*cos(lon_local(ilon))
    395398     $                 *cos(lon_sun) + cos(lat_local(ilon))
    396      $                 *sin(lon_local(ilon))*sin(lon_sun))*180./rpi
     399     $                 *sin(lon_local(ilon))*sin(lon_sun)
     400
     401            ! Security - Handle rare cases where |sza_local| > 1
     402            sza_local = min(sza_local,1.)
     403            sza_local = max(-1.,sza_local)
     404            sza_local = acos(sza_local)*180./rpi
    397405
    398406!           electron temperature
Note: See TracChangeset for help on using the changeset viewer.