Ignore:
Timestamp:
Jul 31, 2023, 5:49:13 PM (17 months ago)
Author:
jbclement
Message:

Mars PCM 1D:
Addition in 1D of relaxation towards a profile for atmospheric water. It needs the flag "atm_wat_tau" (real):

  • atm_wat_profile < 0. -> no relaxation (default);
  • atm_wat_profile >= 0. -> relaxation towards the value "atm_wat_profile" with relaxation time "atm_wat_tau".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F

    r3004 r3021  
    142142c   JN : Force atmospheric water profiles
    143143      REAL atm_wat_profile
     144      REAL atm_wat_tau
    144145      REAL,ALLOCATABLE :: zqsat(:) ! useful for (atm_wat_profile=2)
    145146
     
    813814c ---------------------------------------------------
    814815      ! Adding an option to force atmospheric water values JN
    815       atm_wat_profile=-1 ! Default: free atm wat profile
    816       print *,'Force atmospheric water vapor profile ?'
     816      atm_wat_profile = -1. ! Default: free atm wat profile
     817      print *,'Force atmospheric water vapor profile?'
    817818      call getin("atm_wat_profile",atm_wat_profile)
    818819      write(*,*) "atm_wat_profile = ", atm_wat_profile
    819       if (atm_wat_profile.EQ.-1) then
     820      if (abs(atm_wat_profile + 1.) < 1.e-15) then ! if == -1.
    820821        write(*,*) "Free atmospheric water vapor profile"
    821         write(*,*) "Total water is conserved on the column"
    822       else if (atm_wat_profile.EQ.0) then
     822        write(*,*) "Total water is conserved in the column"
     823      else if (abs(atm_wat_profile) < 1.e-15) then ! if == 0.
    823824        write(*,*) "Dry atmospheric water vapor profile"
    824       else if ((atm_wat_profile.GT.0).and.(atm_wat_profile.LE.1)) then
    825         write(*,*) "Prescribed atmospheric water vapor MMR profile"
     825      else if (0. < atm_wat_profile .and. atm_wat_profile <= 1.) then
     826        write(*,*) "Prescribed atmospheric water vapor profile"
    826827        write(*,*) "Unless it reaches saturation (maximal value)"
    827         write(*,*) "MMR chosen : ", atm_wat_profile
    828       endif
     828      else
     829        write(*,*) 'Water vapor profile value not correct!'
     830        stop
     831      endif
     832
     833! Check if the atmospheric water profile relaxation is specified
     834! --------------------------------------------------------------
     835      ! Adding an option to relax atmospheric water values JBC
     836      atm_wat_tau = -1. ! Default: no time relaxation
     837      print*, 'Relax atmospheric water vapor profile?'
     838      call getin("atm_wat_tau",atm_wat_tau)
     839      write(*,*) "atm_wat_tau = ", atm_wat_tau
     840      if (atm_wat_tau < 0.) then
     841        write(*,*) "Atmospheric water vapor profile is not relaxed"
     842      else
     843        if (0. <= atm_wat_profile .and. atm_wat_profile <= 1.) then
     844          write(*,*) "Relaxed atmospheric water vapor profile towards ",
     845     &    atm_wat_profile
     846          write(*,*) "Unless it reaches saturation (maximal value)"
     847        else
     848       write(*,*) 'Reference atmospheric water vapor profile not known!'
     849       write(*,*) 'Please, specify atm_wat_profile'
     850       stop
     851        endif
     852      endif
    829853
    830854c  Write a "startfi" file
     
    881905      ENDDO
    882906
    883 !       Force atmospheric water if asked
    884 !       Added "atm_wat_profile" flag (JN)
    885 !       -------------------------------------
     907!       Modify atmospheric water if asked
     908!       Added "atm_wat_profile" flag (JN + JBC)
     909!       ---------------------------------------
    886910        call watersat(nlayer,temp,play,zqsat)
    887911        if (0. <= atm_wat_profile .and. atm_wat_profile <= 1.) then
    888           q(:,igcm_h2o_vap) = min(zqsat(:),atm_wat_profile)
    889 !          write(*,*) "prescribed atm_wat_profile (wet if >0, dry if =0)"
    890           q(:,igcm_h2o_ice) = 0.
    891 !          write(*,*) "atm_wat_profile: reset h2o ice"
     912        ! If atmospheric water is monitored
     913          if (atm_wat_tau < 0.) then ! Prescribed atm_wat_profile
     914            ! Wet if >0, Dry if =0
     915            q(:,igcm_h2o_vap) = min(zqsat(:),atm_wat_profile*g/psurf)
     916            q(:,igcm_h2o_ice) = 0. ! reset h2o ice
     917          else ! Relaxation towards the value atm_wat_profile with relaxation time atm_wat_tau
     918        q(:,igcm_h2o_vap) = atm_wat_profile*g/psurf + (q(:,igcm_h2o_vap)
     919     &              - atm_wat_profile*g/psurf)*dexp(-dtphys/atm_wat_tau)
     920            q(:,igcm_h2o_vap) = min(zqsat(:),q(:,igcm_h2o_vap))
     921            q(:,igcm_h2o_ice) = 0. ! reset h2o ice
     922          endif
    892923        endif
    893 !        CALL write_output('qsat',
    894 !     &                         'qsat',
    895 !     &                         'kg/kg',zqsat)
    896 !        CALL write_output('qvap',
    897 !     &                         'qvap',
    898 !     &                         'kg/kg',q(:,igcm_h2o_vap))
    899 
    900924
    901925!      write(*,*) "testphys1d avant q", q(1,:)
     
    912936!      write(*,*) "testphys1d apres q", q(1,:)
    913937
    914 
    915938c       wind increment : specific for 1D
    916939c       --------------------------------
    917  
    918940c       The physics compute the tendencies on u and v,
    919941c       here we just add Coriolos effect
     
    931953          ENDDO
    932954c       end if
    933 c     
    934 c
     955
    935956c       Compute time for next time step
    936957c       ---------------------------------------
     
    953974c       compute pressure for next time step
    954975c       ----------------------------------------------------------
    955 
    956976           psurf=psurf+dtphys*dpsurf(1)   ! surface pressure change
    957977           DO ilevel=1,nlevel
     
    968988          ENDDO
    969989        ENDDO
    970 
    971990      ENDDO   ! of idt=1,ndt ! end of time stepping loop
    972      
     991
    973992      ! update the profiles files at the end of the run
    974993      write_prof=.false.
Note: See TracChangeset for help on using the changeset viewer.