Changeset 3067


Ignore:
Timestamp:
Oct 3, 2023, 11:21:28 AM (15 months ago)
Author:
jbclement
Message:

Mars PCM:
In 1D, 'q' has been converted from dimension (:,:) to (1,:,:) and 'q2' is now got through the module 'turb_mod'. It allows more generalization and to match dimension in the subroutines.
JBC

Location:
trunk/LMDZ.MARS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r3066 r3067  
    42314231Slight changes are expected for the PEM (TBC w/ JBC).
    42324232
     4233== 03/10/2023 == JBC
     4234In 1D, 'q' has been converted from dimension (:,:) to (1,:,:) and 'q2' is now got through the module 'turb_mod'. It allows more generalization and to match dimension in the subroutines.
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90

    r3066 r3067  
    55contains
    66
    7 SUBROUTINE init_testphys1d(pem1d,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D,therestartfi, &
    8                            ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,q2,play,plev,   &
    9                            latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
     7SUBROUTINE init_testphys1d(pem1d,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D, &
     8                           therestartfi,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,        &
     9                           play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
    1010
    1111use ioipsl_getincom,          only: getin ! To use 'getin'
     
    1313use time_phylmdz_mod,         only: daysec, day_step, ecritphy, iphysiq
    1414use planete_h,                only: year_day, periheli, aphelie, peri_day, obliquit, emin_turb, lmixmin
    15 use surfdat_h,                only: albedodat, z0_default, z0, emissiv, emisice, albedice, iceradius, dtemisice, &
     15use surfdat_h,                only: albedodat, z0_default, z0, emissiv, emisice, albedice, iceradius, dtemisice,      &
    1616                                    zmea, zstd, zsig, zgam, zthe, hmons, summit, base, phisfi, watercaptag, watercap, &
    1717                                    tsurf, emis, qsurf
     
    3737use mod_grid_phy_lmdz,        only: regular_lonlat
    3838use phys_state_var_init_mod,  only: phys_state_var_init
     39use turb_mod,                 only: q2
    3940! Mostly for XIOS outputs:
    4041use mod_const_mpi,            only: COMM_LMDZ
     
    4849! Arguments
    4950!=======================================================================
    50 integer,            intent(in) :: ngrid, nlayer
    51 real,               intent(in) :: odpref        ! DOD reference pressure (Pa)
    52 logical,            intent(in) :: pem1d         ! If initialization for the 1D PEM
     51integer, intent(in) :: ngrid, nlayer
     52real,    intent(in) :: odpref        ! DOD reference pressure (Pa)
     53logical, intent(in) :: pem1d         ! If initialization for the 1D PEM
    5354
    5455integer, intent(inout) :: nq
    5556
    56 real, dimension(:,:), allocatable, intent(out) :: q     ! tracer mixing ratio (e.g. kg/kg)
    57 real,                              intent(out) :: time  ! time (0<time<1; time=0.5 at noon)
    58 real,                              intent(out) :: psurf ! Surface pressure
    59 real, dimension(nlayer),           intent(out) :: u, v  ! zonal, meridional wind
    60 real, dimension(nlayer),           intent(out) :: temp  ! temperature at the middle of the layers
    61 logical,                           intent(out) :: startfiles_1D, therestart1D, therestartfi ! Use of starting files for 1D
    62 integer,                           intent(out) :: ndt
    63 real,                              intent(out) :: ptif, pks
    64 real,                              intent(out) :: dttestphys                   ! testphys1d timestep
    65 real, dimension(:),   allocatable, intent(out) :: zqsat                        ! useful for (atm_wat_profile=2)
    66 real, dimension(:,:), allocatable, intent(out) :: dq, dqdyn                    ! Physical and dynamical tandencies
    67 integer,                           intent(out) :: day0                         ! initial (sol ; =0 at Ls=0) and final date
    68 real,                              intent(out) :: day                          ! date during the run
    69 real,                              intent(out) :: gru, grv                     ! prescribed "geostrophic" background wind
    70 real, dimension(nlayer),           intent(out) :: w                            ! "Dummy wind" in 1D
    71 real, dimension(nlayer + 1),       intent(out) :: q2                           ! Turbulent Kinetic Energy
    72 real, dimension(nlayer),           intent(out) :: play                         ! Pressure at the middle of the layers (Pa)
    73 real, dimension(nlayer + 1),       intent(out) :: plev                         ! intermediate pressure levels (pa)
    74 real, dimension(1),                intent(out) :: latitude, longitude, cell_area
    75 real,                              intent(out) :: atm_wat_profile, atm_wat_tau ! Force atmospheric water profiles
     57real, dimension(:,:,:), allocatable, intent(out) :: q     ! tracer mixing ratio (e.g. kg/kg)
     58real,                                intent(out) :: time  ! time (0<time<1; time=0.5 at noon)
     59real,                                intent(out) :: psurf ! Surface pressure
     60real, dimension(nlayer),             intent(out) :: u, v  ! zonal, meridional wind
     61real, dimension(nlayer),             intent(out) :: temp  ! temperature at the middle of the layers
     62logical,                             intent(out) :: startfiles_1D, therestart1D, therestartfi ! Use of starting files for 1D
     63integer,                             intent(out) :: ndt
     64real,                                intent(out) :: ptif, pks
     65real,                                intent(out) :: dttestphys                   ! testphys1d timestep
     66real, dimension(:),     allocatable, intent(out) :: zqsat                        ! useful for (atm_wat_profile=2)
     67real, dimension(:,:,:), allocatable, intent(out) :: dq, dqdyn                    ! Physical and dynamical tandencies
     68integer,                             intent(out) :: day0                         ! initial (sol ; =0 at Ls=0) and final date
     69real,                                intent(out) :: day                          ! date during the run
     70real,                                intent(out) :: gru, grv                     ! prescribed "geostrophic" background wind
     71real, dimension(nlayer),             intent(out) :: w                            ! "Dummy wind" in 1D
     72real, dimension(nlayer),             intent(out) :: play                         ! Pressure at the middle of the layers (Pa)
     73real, dimension(nlayer + 1),         intent(out) :: plev                         ! intermediate pressure levels (pa)
     74real, dimension(1),                  intent(out) :: latitude, longitude, cell_area
     75real,                                intent(out) :: atm_wat_profile, atm_wat_tau ! Force atmospheric water profiles
    7676
    7777!=======================================================================
     
    237237
    238238! allocate arrays:
    239 allocate(tname(nq),q(nlayer,nq),zqsat(nlayer))
    240 allocate(dq(nlayer,nq),dqdyn(nlayer,nq),tnom_transp(nq))
     239allocate(tname(nq),q(1,nlayer,nq),zqsat(nlayer))
     240allocate(dq(1,nlayer,nq),dqdyn(1,nlayer,nq),tnom_transp(nq))
    241241
    242242! read tracer names from file traceur.def
     
    289289write(*,*) 'nqfils=',nqfils
    290290
    291 
    292 
    293291#ifdef CPP_XIOS
    294292    call init_physics_distribution(regular_lonlat,4,1,1,1,nlayer,COMM_LMDZ)
     
    455453    do iq = 1,nq
    456454        open(3,file = start1Dname,status = "old",action = "read")
    457         read(3,*) header, qsurf(1,iq,1),(q(ilayer,iq), ilayer = 1,nlayer)
     455        read(3,*) header, qsurf(1,iq,1),(q(1,ilayer,iq), ilayer = 1,nlayer)
    458456        if (trim(tname(iq)) /= trim(header)) then
    459457            write(*,*) 'Tracer names not compatible for initialization with "'//trim(start1Dname)//'"!'
     
    554552w = 0. ! default: no vertical wind
    555553
    556 ! Initialize turbulente kinetic energy
     554! Initialize turbulent kinetic energy
    557555q2 = 0.
    558556
     
    690688    ! q & psurf arrays are on the dynamics scalar grid
    691689    allocate(qdyn(2,1,llm,nq),psdyn(2,1))
    692     qdyn(1,1,1:llm,1:nq) = q(1:llm,1:nq)
     690    qdyn(1,1,1:llm,1:nq) = q(1,1:llm,1:nq)
    693691    psdyn(1:2,1) = psurf
    694692    call inichim_newstart(ngrid,nq,qdyn,qsurf(1,:,1),psdyn,flagh2o,flagthermo)
    695     q(1:llm,1:nq) = qdyn(1,1,1:llm,1:nq)
     693    q(1,1:llm,1:nq) = qdyn(1,1,1:llm,1:nq)
    696694endif
    697695
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90

    r3066 r3067  
    11PROGRAM testphys1d
    22
    3 use comsoil_h,               only: inertiedat, inertiesoil, nsoilmx, tsoil
    4 use surfdat_h,               only: albedodat, perenial_co2ice, watercap, tsurf, emis, qsurf
    5 use comslope_mod,            only: def_slope, subslope_dist
    6 use phyredem,                only: physdem0, physdem1
    7 use watersat_mod,            only: watersat
    8 use tracer_mod,              only: igcm_h2o_vap, igcm_h2o_ice, noms
    9 use comcstfi_h,              only: pi, rad, omeg, g, mugaz, rcp, r, cpp
    10 use time_phylmdz_mod,        only: daysec, day_step
    11 use dimradmars_mod,          only: tauvis, totcloudfrac, albedo
    12 use dust_param_mod,          only: tauscaling
    13 use comvert_mod,             only: ap, bp, aps, bps, pa, preff, sig
    14 use physiq_mod,              only: physiq
    15 use phyetat0_mod,            only: phyetat0
    16 use write_output_mod,        only: write_output
    17 use init_testphys1d_mod,     only: init_testphys1d
     3use comsoil_h,           only: inertiedat, inertiesoil, nsoilmx, tsoil
     4use surfdat_h,           only: albedodat, perenial_co2ice, watercap, tsurf, emis, qsurf
     5use comslope_mod,        only: def_slope, subslope_dist
     6use phyredem,            only: physdem0, physdem1
     7use watersat_mod,        only: watersat
     8use tracer_mod,          only: igcm_h2o_vap, igcm_h2o_ice, noms
     9use comcstfi_h,          only: pi, rad, omeg, g, mugaz, rcp, r, cpp
     10use time_phylmdz_mod,    only: daysec, day_step
     11use dimradmars_mod,      only: tauvis, totcloudfrac, albedo
     12use dust_param_mod,      only: tauscaling
     13use comvert_mod,         only: ap, bp, aps, bps, pa, preff, sig
     14use physiq_mod,          only: physiq
     15use turb_mod,            only: q2
     16use write_output_mod,    only: write_output
     17use init_testphys1d_mod, only: init_testphys1d
    1818! Mostly for XIOS outputs:
    19 use mod_const_mpi,           only: init_const_mpi
    20 use parallel_lmdz,           only: init_parallel
     19use mod_const_mpi,       only: init_const_mpi
     20use parallel_lmdz,       only: init_parallel
    2121
    2222implicit none
     
    5858! Declarations
    5959!--------------------------------------------------------------
    60 integer, parameter                :: ngrid = 1     ! (2+(jjm-1)*iim - 1/jjm)
    61 integer, parameter                :: nlayer = llm
    62 real, parameter                   :: odpref = 610. ! DOD reference pressure (Pa)
    63 integer                           :: unitstart     ! unite d'ecriture de "startfi"
    64 integer                           :: ndt, ilayer, ilevel, isoil, idt, iq
    65 logical                           :: firstcall, lastcall
    66 integer                           :: day0          ! initial (sol ; =0 at Ls=0)
    67 real                              :: day           ! date during the run
    68 real                              :: time          ! time (0<time<1 ; time=0.5 a midi)
    69 real                              :: dttestphys    ! testphys1d timestep
    70 real, dimension(nlayer)           :: play          ! Pressure at the middle of the layers (Pa)
    71 real, dimension(nlayer + 1)       :: plev          ! intermediate pressure levels (pa)
    72 real                              :: psurf         ! Surface pressure
    73 real, dimension(nlayer)           :: u, v          ! zonal, meridional wind
    74 real                              :: gru, grv      ! prescribed "geostrophic" background wind
    75 real, dimension(nlayer)           :: temp          ! temperature at the middle of the layers
    76 real, dimension(:,:), allocatable :: q             ! tracer mixing ratio (e.g. kg/kg)
    77 real, dimension(1)                :: wstar = 0.    ! Thermals vertical velocity
    78 real, dimension(nlayer + 1)       :: q2            ! Turbulent Kinetic Energy
     60integer, parameter                  :: ngrid = 1     ! (2+(jjm-1)*iim - 1/jjm)
     61integer, parameter                  :: nlayer = llm
     62real, parameter                     :: odpref = 610. ! DOD reference pressure (Pa)
     63integer                             :: unitstart     ! unite d'ecriture de "startfi"
     64integer                             :: ndt, ilayer, ilevel, isoil, idt, iq
     65logical                             :: firstcall, lastcall
     66integer                             :: day0          ! initial (sol ; =0 at Ls=0)
     67real                                :: day           ! date during the run
     68real                                :: time          ! time (0<time<1 ; time=0.5 a midi)
     69real                                :: dttestphys    ! testphys1d timestep
     70real, dimension(nlayer)             :: play          ! Pressure at the middle of the layers (Pa)
     71real, dimension(nlayer + 1)         :: plev          ! intermediate pressure levels (pa)
     72real                                :: psurf         ! Surface pressure
     73real, dimension(nlayer)             :: u, v          ! zonal, meridional wind
     74real                                :: gru, grv      ! prescribed "geostrophic" background wind
     75real, dimension(nlayer)             :: temp          ! temperature at the middle of the layers
     76real, dimension(:,:,:), allocatable :: q             ! tracer mixing ratio (e.g. kg/kg)
     77real, dimension(1)                  :: wstar = 0.    ! Thermals vertical velocity
    7978
    8079! Physical and dynamical tandencies (e.g. m.s-2, K/s, Pa/s)
    81 real, dimension(nlayer)           :: du, dv, dtemp, dudyn, dvdyn, dtempdyn
    82 real, dimension(1)                :: dpsurf
    83 real, dimension(:,:), allocatable :: dq, dqdyn
     80real, dimension(nlayer)             :: du, dv, dtemp, dudyn, dvdyn, dtempdyn
     81real, dimension(1)                  :: dpsurf
     82real, dimension(:,:,:), allocatable :: dq, dqdyn
    8483
    8584! Various intermediate variables
     
    115114!call initcomgeomphy
    116115
    117 call init_testphys1d(.false.,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D,therestartfi, &
    118                      ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,q2,play,plev, &
    119                      latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
     116call init_testphys1d(.false.,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D, &
     117                     therestartfi,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,          &
     118                     play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
    120119
    121120! Write a "startfi" file
     
    171170        ! If atmospheric water is monitored
    172171            if (atm_wat_tau < 0.) then ! Prescribed atm_wat_profile: wet if >0, dry if =0
    173                 q(:,igcm_h2o_vap) = min(zqsat(:),atm_wat_profile*g/psurf)
    174                 q(:,igcm_h2o_ice) = 0. ! reset h2o ice
     172                q(1,:,igcm_h2o_vap) = min(zqsat(:),atm_wat_profile*g/psurf)
     173                q(1,:,igcm_h2o_ice) = 0. ! reset h2o ice
    175174            else ! Relaxation towards the value atm_wat_profile with relaxation time atm_wat_tau
    176                 q(:,igcm_h2o_vap) = atm_wat_profile*g/psurf + (q(:,igcm_h2o_vap) - atm_wat_profile*g/psurf)*dexp(-dttestphys/atm_wat_tau)
    177                 q(:,igcm_h2o_vap) = min(zqsat(:),q(:,igcm_h2o_vap))
    178                 q(:,igcm_h2o_ice) = 0. ! reset h2o ice
     175                q(1,:,igcm_h2o_vap) = atm_wat_profile*g/psurf + (q(1,:,igcm_h2o_vap) - atm_wat_profile*g/psurf)*dexp(-dttestphys/atm_wat_tau)
     176                q(1,:,igcm_h2o_vap) = min(zqsat(:),q(1,:,igcm_h2o_vap))
     177                q(1,:,igcm_h2o_ice) = 0. ! reset h2o ice
    179178            endif
    180179        endif
     
    195194    !enddo
    196195    ! For some tests: No coriolis force at equator
    197     !if(latitude(1) == 0.) then
     196    !if (latitude(1) == 0.) then
    198197    du(:) = du(:) + (gru - u(:))/1.e4
    199198    dv(:) = dv(:) + (grv - v(:))/1.e4
     
    222221
    223222    ! Increment tracers
    224     q(:,:) = q(:,:) + dttestphys*dq(:,:)
     223    q(1,:,:) = q(1,:,:) + dttestphys*dq(1,:,:)
    225224enddo ! End of time stepping loop (idt=1,ndt)
    226225
Note: See TracChangeset for help on using the changeset viewer.