Ignore:
Timestamp:
Apr 28, 2025, 3:21:28 PM (3 months ago)
Author:
jbclement
Message:

Mars PCM:
Simplification and clarification for the prescription of the atmospheric water profile in 1D: the boolean 'prescribed_h2ovap' activates the option, the file "profile_prescribed_h2ovap" defines the prescribed profile and the value 'h2ovap_relax_time', if positive, activates the relaxation and gives the constant of time.
JBC

Location:
trunk/LMDZ.MARS/libf/phymars/dyn1d
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90

    r3739 r3741  
    77SUBROUTINE init_testphys1d(start1Dname,startfiname,therestart1D,therestartfi,ngrid,nlayer,odpref,               &
    88                           nq,q,time,psurf,u,v,temp,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,q_def_h2o_vap)
     9                           play,plev,latitude,longitude,cell_area,prescribed_h2ovap,h2ovap_relax_time,q_prescribed_h2o_vap)
    1010
    1111use ioipsl_getincom,          only: getin ! To use 'getin'
     
    8181real, dimension(nlayer + 1),         intent(out) :: plev                         ! intermediate pressure levels (pa)
    8282real, dimension(1),                  intent(out) :: latitude, longitude, cell_area
    83 real,                                intent(out) :: atm_wat_profile, atm_wat_tau ! Force atmospheric water profiles
    84 real, dimension(nlayer),             intent(out) :: q_def_h2o_vap                ! User-defined atmospheric water profile
     83logical,                             intent(out) :: prescribed_h2ovap            ! Prescribe atmospheric water profile
     84real,                                intent(out) :: h2ovap_relax_time            ! Relaxtion time towards the atmospheric water profile
     85real, dimension(nlayer),             intent(out) :: q_prescribed_h2o_vap         ! User-defined atmospheric water profile
    8586
    8687!=======================================================================
     
    778779if (.not. therestartfi .and. paleoclimate) perennial_co2ice = 0.
    779780
    780 ! Check if the atmospheric water profile is specified
    781 ! ---------------------------------------------------
    782 ! Adding an option to force atmospheric water values
    783 atm_wat_profile = -1. ! Default: free atmospheric water profile
    784 q_def_h2o_vap = 0. ! Default
     781! Prescription of atmospheric water profile
     782! -----------------------------------------
     783prescribed_h2ovap = .false. ! Default: free atmospheric water profile
     784h2ovap_relax_time = -1. ! Default: no time relaxation
     785q_prescribed_h2o_vap = 0. ! Default
    785786if (water) then
    786     write(*,*)'Force atmospheric water vapor profile (mixing ratio in kg/kg)?'
    787     call getin('atm_wat_profile',atm_wat_profile)
    788     write(*,*) 'atm_wat_profile = ', atm_wat_profile
    789     if (abs(atm_wat_profile + 1.) < 1.e-15) then ! if == -1.
     787    write(*,*)'Force atmospheric water profile (mixing ratio in kg/kg)?'
     788    call getin('prescribed_h2ovap',prescribed_h2ovap)
     789    write(*,*) 'prescribed_h2ovap = ', prescribed_h2ovap
     790    if (prescribed_h2ovap) then
     791        write(*,*) 'Atmospheric water profile is prescribed'
     792        write(*,*) 'Unless it reaches saturation (maximal value)'
     793        open(10,file = 'profile_prescribed_h2o_vap',status = 'old',form = 'formatted',action = 'read',iostat = ierr)
     794        if (ierr == 0) then
     795            do ilayer = 1,nlayer
     796                read(10,*) q_prescribed_h2o_vap(ilayer)
     797            enddo
     798        else
     799            error stop 'File "profile_prescribed_h2o_vap" was not found!'
     800        endif
     801        close(10)
     802
     803        write(*,*) 'Relax atmospheric water profile with time constant (s)?'
     804       
     805        call getin('h2ovap_relax_time',h2ovap_relax_time)
     806        write(*,*) 'h2ovap_relax_time = ', h2ovap_relax_time
     807        if (h2ovap_relax_time < 0.) then
     808            write(*,*) 'Atmospheric water vapor profile is not relaxed (forcing).'
     809        else
     810            write(*,*) 'Atmospheric water profile is relaxed towards the profile in "profile_prescribed_h2o_vap"'
     811            write(*,*) 'Unless it reaches saturation (maximal value)'
     812        endif
     813    else
    790814        write(*,*) 'Free atmospheric water vapor profile'
    791815        write(*,*) 'Total water is conserved in the column'
    792     else if (abs(atm_wat_profile) < 1.e-15) then ! if == 0.
    793         write(*,*) 'Dry atmospheric water vapor profile'
    794     else if (0. < atm_wat_profile .and. atm_wat_profile <= 1.) then ! if 0. <= and <= 1.
    795         write(*,*) 'Prescribed uniform atmospheric water vapor profile'
    796         write(*,*) 'Unless it reaches saturation (maximal value)'
    797     else if (abs(atm_wat_profile + 2.) < 1.e-15) then ! if == -2.
    798         write(*,*) 'Prescribed user-defined atmospheric water vapor profile'
    799         write(*,*) 'Unless it reaches saturation (maximal value)'
    800         open(10,file = 'profile_def_h2o_vap',status = 'old',form = 'formatted',action = 'read',iostat = ierr)
    801         if (ierr == 0) then
    802             do ilayer = 1,nlayer
    803                 read(10,*) q_def_h2o_vap(ilayer)
    804             enddo
    805         else
    806             error stop 'File "profile_def_h2o_vap" was not found!'
    807         endif
    808         close(10)
    809     else
    810         error stop 'Water vapor profile value is not correct!'
    811816    endif
    812817endif
    813818
    814 ! Check if the atmospheric water profile relaxation is specified
    815 ! --------------------------------------------------------------
    816 ! Adding an option to relax atmospheric water values
    817 atm_wat_tau = -1. ! Default: no time relaxation
    818 if (water) then
    819     write(*,*) 'Relax atmospheric water vapor profile with time constant (s)?'
    820     call getin('atm_wat_tau',atm_wat_tau)
    821     write(*,*) 'atm_wat_tau = ', atm_wat_tau
    822     if (atm_wat_tau < 0.) then
    823         write(*,*) 'Atmospheric water vapor profile is not relaxed (forcing).'
    824     else
    825         if (0. <= atm_wat_profile .and. atm_wat_profile <= 1. .or. abs(atm_wat_profile + 2.) < 1.e-15) then
    826             write(*,*) 'Relaxed atmospheric water vapor profile towards ', atm_wat_profile
    827             write(*,*) 'Unless it reaches saturation (maximal value)'
    828         else
    829             write(*,*) 'Reference atmospheric water vapor profile not known!'
    830             error stop 'Please, specify atm_wat_profile'
    831         endif
    832     endif
    833 endif
    834 
    835819END SUBROUTINE init_testphys1d
    836820
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90

    r3737 r3741  
    8484logical :: startfiles_1D, therestart1D, therestartfi, there
    8585
    86 ! Force atmospheric water profiles
    87 real                            :: atm_wat_profile, atm_wat_tau
    88 real, dimension(nlayer)         :: q_def_h2o_vap
     86! Prescription of atmospheric water profile
     87logical                         :: prescribed_h2ovap
     88real                            :: h2ovap_relax_time
     89real, dimension(nlayer)         :: q_prescribed_h2o_vap
    8990real, dimension(:), allocatable :: zqsat
    9091!=======================================================================
     
    150151call init_testphys1d('start1D.txt','startfi.nc',therestart1D,therestartfi,ngrid,nlayer,odpref,nq,q, &
    151152                     time,psurf,u,v,temp,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w, &
    152                      play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau,q_def_h2o_vap)
     153                     play,plev,latitude,longitude,cell_area,prescribed_h2ovap,h2ovap_relax_time,q_prescribed_h2o_vap)
    153154
    154155! Write a "startfi" file
     
    196197    enddo
    197198
    198     ! Modify atmospheric water if asked
    199     ! Added "atm_wat_profile" flag
    200     ! ----------------------------
     199    ! Prescription of atmospheric water if asked
     200    ! ------------------------------------------
    201201    if (water) then
    202202        call watersat(nlayer,temp,play,zqsat)
    203         if (0. <= atm_wat_profile .and. atm_wat_profile <= 1.) then ! If atmospheric water is monitored with a uniform value
    204             if (atm_wat_tau < 0.) then ! Case for prescribed atm_wat_profile: wet if >0, dry if =0
    205                 q(1,:,igcm_h2o_vap) = min(zqsat,atm_wat_profile)
    206             else ! Case for relaxation towards the value atm_wat_profile with relaxation time atm_wat_tau
    207                 q(1,:,igcm_h2o_vap) = atm_wat_profile + (q(1,:,igcm_h2o_vap) - atm_wat_profile)*dexp(-dttestphys/atm_wat_tau)
    208             endif
    209         else if (abs(atm_wat_profile + 2.) < 1.e-15) then ! If atmospheric water is monitored with a user-defined water profile (with file "profile_def_h2o_vap")
    210             if (atm_wat_tau < 0.) then ! Case for prescribed atm_wat_profile: wet if >0, dry if =0
    211                 q(1,:,igcm_h2o_vap) = min(zqsat(:),q_def_h2o_vap(:))
    212             else ! Case for relaxation towards the value atm_wat_profile with relaxation time atm_wat_tau
    213                 q(1,:,igcm_h2o_vap) = q_def_h2o_vap(:) + (q(1,:,igcm_h2o_vap) - q_def_h2o_vap(:))*dexp(-dttestphys/atm_wat_tau)
     203        if (prescribed_h2ovap) then ! If atmospheric water profile is prescribed
     204            if (h2ovap_relax_time < 0.) then ! Forcing
     205                q(1,:,igcm_h2o_vap) = min(zqsat(:),q_prescribed_h2o_vap(:))
     206            else ! Relaxation
     207                q(1,:,igcm_h2o_vap) = q_prescribed_h2o_vap(:) + (q(1,:,igcm_h2o_vap) - q_prescribed_h2o_vap(:))*dexp(-dttestphys/h2ovap_relax_time)
    214208            endif
    215209        endif
Note: See TracChangeset for help on using the changeset viewer.