Changeset 3741 for trunk/LMDZ.MARS/libf/phymars
- Timestamp:
- Apr 28, 2025, 3:21:28 PM (3 months ago)
- 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 7 7 SUBROUTINE init_testphys1d(start1Dname,startfiname,therestart1D,therestartfi,ngrid,nlayer,odpref, & 8 8 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) 10 10 11 11 use ioipsl_getincom, only: getin ! To use 'getin' … … 81 81 real, dimension(nlayer + 1), intent(out) :: plev ! intermediate pressure levels (pa) 82 82 real, 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 83 logical, intent(out) :: prescribed_h2ovap ! Prescribe atmospheric water profile 84 real, intent(out) :: h2ovap_relax_time ! Relaxtion time towards the atmospheric water profile 85 real, dimension(nlayer), intent(out) :: q_prescribed_h2o_vap ! User-defined atmospheric water profile 85 86 86 87 !======================================================================= … … 778 779 if (.not. therestartfi .and. paleoclimate) perennial_co2ice = 0. 779 780 780 ! Check if the atmospheric water profile is specified781 ! ----------------------------------------- ----------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. ! Default781 ! Prescription of atmospheric water profile 782 ! ----------------------------------------- 783 prescribed_h2ovap = .false. ! Default: free atmospheric water profile 784 h2ovap_relax_time = -1. ! Default: no time relaxation 785 q_prescribed_h2o_vap = 0. ! Default 785 786 if (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 790 814 write(*,*) 'Free atmospheric water vapor profile' 791 815 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) then802 do ilayer = 1,nlayer803 read(10,*) q_def_h2o_vap(ilayer)804 enddo805 else806 error stop 'File "profile_def_h2o_vap" was not found!'807 endif808 close(10)809 else810 error stop 'Water vapor profile value is not correct!'811 816 endif 812 817 endif 813 818 814 ! Check if the atmospheric water profile relaxation is specified815 ! --------------------------------------------------------------816 ! Adding an option to relax atmospheric water values817 atm_wat_tau = -1. ! Default: no time relaxation818 if (water) then819 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_tau822 if (atm_wat_tau < 0.) then823 write(*,*) 'Atmospheric water vapor profile is not relaxed (forcing).'824 else825 if (0. <= atm_wat_profile .and. atm_wat_profile <= 1. .or. abs(atm_wat_profile + 2.) < 1.e-15) then826 write(*,*) 'Relaxed atmospheric water vapor profile towards ', atm_wat_profile827 write(*,*) 'Unless it reaches saturation (maximal value)'828 else829 write(*,*) 'Reference atmospheric water vapor profile not known!'830 error stop 'Please, specify atm_wat_profile'831 endif832 endif833 endif834 835 819 END SUBROUTINE init_testphys1d 836 820 -
trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90
r3737 r3741 84 84 logical :: startfiles_1D, therestart1D, therestartfi, there 85 85 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 87 logical :: prescribed_h2ovap 88 real :: h2ovap_relax_time 89 real, dimension(nlayer) :: q_prescribed_h2o_vap 89 90 real, dimension(:), allocatable :: zqsat 90 91 !======================================================================= … … 150 151 call init_testphys1d('start1D.txt','startfi.nc',therestart1D,therestartfi,ngrid,nlayer,odpref,nq,q, & 151 152 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) 153 154 154 155 ! Write a "startfi" file … … 196 197 enddo 197 198 198 ! Modify atmospheric water if asked 199 ! Added "atm_wat_profile" flag 200 ! ---------------------------- 199 ! Prescription of atmospheric water if asked 200 ! ------------------------------------------ 201 201 if (water) then 202 202 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) 214 208 endif 215 209 endif
Note: See TracChangeset
for help on using the changeset viewer.