- Timestamp:
- Oct 2, 2023, 2:30:47 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
r3060 r3065 5 5 contains 6 6 7 SUBROUTINE init_testphys1d( startfiles_1D,therestart1D,therestartfi,ngrid,nlayer,odpref,nq,ndt,ptif,pks,dttestphys, &8 q,zqsat,qsurf,dq,dqdyn,day0,day,time,psurf,tsurf,gru,grv,u,v,w,q2,play,plev,tsoil,temp,&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,qsurf,dq,dqdyn,day0,day,tsurf,gru,grv,w,q2,play,plev,tsoil, & 9 9 albedo,emis,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau) 10 10 … … 47 47 ! Arguments 48 48 !======================================================================= 49 logical, intent(in) :: startfiles_1D, therestart1D, therestartfi ! Use of "start1D.txt" and "startfi.nc" files 50 integer, intent(in) :: ngrid, nlayer 51 real, intent(in) :: odpref ! DOD reference pressure (Pa) 49 integer, intent(in) :: ngrid, nlayer 50 real, intent(in) :: odpref ! DOD reference pressure (Pa) 51 logical, intent(in) :: pem1d ! If initialization for the 1D PEM 52 52 53 53 integer, intent(inout) :: nq 54 54 55 real, dimension(:,:), allocatable, intent(out) :: q ! tracer mixing ratio (e.g. kg/kg) 56 real, intent(out) :: time ! time (0<time<1; time=0.5 at noon) 57 real, intent(out) :: psurf ! Surface pressure 58 real, dimension(nlayer), intent(out) :: u, v ! zonal, meridional wind 59 real, dimension(nlayer), intent(out) :: temp ! temperature at the middle of the layers 60 logical, intent(out) :: startfiles_1D, therestart1D, therestartfi ! Use of starting files for 1D 55 61 integer, intent(out) :: ndt 56 62 real, intent(out) :: ptif, pks 57 real, intent(out) :: dttestphys ! testphys1d timestep 58 real, dimension(:,:), allocatable, intent(out) :: q ! tracer mixing ratio (e.g. kg/kg) 59 real, dimension(:), allocatable, intent(out) :: zqsat ! useful for (atm_wat_profile=2) 60 real, dimension(:), allocatable, intent(out) :: qsurf ! tracer surface budget (e.g. kg.m-2) 61 real, dimension(:,:), allocatable, intent(out) :: dq, dqdyn ! Physical and dynamical tandencies 62 integer, intent(out) :: day0 ! initial (sol ; =0 at Ls=0) and final date 63 real, intent(out) :: day ! date during the run 64 real, intent(out) :: time ! time (0<time<1; time=0.5 at noon) 65 real, intent(out) :: psurf ! Surface pressure 66 real, dimension(1), intent(out) :: tsurf ! Surface temperature 67 real, intent(out) :: gru, grv ! prescribed "geostrophic" background wind 68 real, dimension(nlayer), intent(out) :: u, v, w ! zonal, meridional wind 69 real, dimension(nlayer + 1), intent(out) :: q2 ! Turbulent Kinetic Energy 70 real, dimension(nlayer), intent(out) :: play ! Pressure at the middle of the layers (Pa) 71 real, dimension(nlayer + 1), intent(out) :: plev ! intermediate pressure levels (pa) 72 real, dimension(nsoilmx), intent(out) :: tsoil ! subsurface soil temperature (K) 73 real, dimension(nlayer), intent(out) :: temp ! temperature at the middle of the layers 74 real, dimension(1,1), intent(out) :: albedo ! surface albedo 75 real, dimension(1), intent(out) :: emis ! surface layer 63 real, intent(out) :: dttestphys ! testphys1d timestep 64 real, dimension(:), allocatable, intent(out) :: zqsat ! useful for (atm_wat_profile=2) 65 real, dimension(:), allocatable, intent(out) :: qsurf ! tracer surface budget (e.g. kg.m-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, dimension(1), intent(out) :: tsurf ! Surface temperature 70 real, intent(out) :: gru, grv ! prescribed "geostrophic" background wind 71 real, dimension(nlayer), intent(out) :: w ! "Dummy wind" in 1D 72 real, dimension(nlayer + 1), intent(out) :: q2 ! Turbulent Kinetic Energy 73 real, dimension(nlayer), intent(out) :: play ! Pressure at the middle of the layers (Pa) 74 real, dimension(nlayer + 1), intent(out) :: plev ! intermediate pressure levels (pa) 75 real, dimension(nsoilmx), intent(out) :: tsoil ! subsurface soil temperature (K) 76 real, dimension(1,1), intent(out) :: albedo ! surface albedo 77 real, dimension(1), intent(out) :: emis ! surface layer 76 78 real, dimension(1), intent(out) :: latitude, longitude, cell_area 77 real, intent(out) :: atm_wat_profile, atm_wat_tau 79 real, intent(out) :: atm_wat_profile, atm_wat_tau ! Force atmospheric water profiles 78 80 79 81 !======================================================================= … … 89 91 real, dimension(:,:), allocatable :: psdyn 90 92 91 ! RV & JBC: Use of "start1D.txt" and "startfi.nc" files93 ! RV & JBC: Use of starting files for 1D 92 94 logical :: found 93 95 character(len = 30) :: header … … 102 104 integer :: ifils, ipere, generation, ierr0 103 105 character(len = 30), dimension(:), allocatable :: tnom_transp ! transporting fluid short name 104 character(len = 80) :: line ! to store a line of text106 character(len = 80) :: line ! to store a line of text 105 107 logical :: continu, there 106 108 … … 113 115 real :: flux_geo_tmp 114 116 117 ! JBC: To initialize the 1D PEM 118 character(:), allocatable :: start1Dname, startfiname ! Name of starting files for 1D 119 115 120 !======================================================================= 116 121 ! Code 117 122 !======================================================================= 123 if (.not. pem1d) then 124 start1Dname = 'start1D.txt' 125 startfiname = 'startfi.nc' 126 startfiles_1D = .false. 127 !------------------------------------------------------ 128 ! Loading run parameters from "run.def" file 129 !------------------------------------------------------ 130 ! check if 'run.def' file is around. Otherwise reading parameters 131 ! from callphys.def via getin() routine won't work. 132 inquire(file = 'run.def',exist = there) 133 if (.not. there) then 134 write(*,*) 'Cannot find required file "run.def"' 135 write(*,*) ' (which should contain some input parameters along with the following line: INCLUDEDEF=callphys.def)' 136 write(*,*) ' ... might as well stop here ...' 137 stop 138 endif 139 140 write(*,*)'Do you want to use starting files?' 141 call getin("startfiles_1D",startfiles_1D) 142 write(*,*) " startfiles_1D = ", startfiles_1D 143 else 144 start1dname = 'start1D_evol.txt' 145 startfiname = 'startfi_evol.nc' 146 startfiles_1D = .true. 147 endif 148 149 therestart1D = .false. 150 therestartfi = .false. 151 inquire(file = start1Dname,exist = therestart1D) 152 if (startfiles_1D .and. .not. therestart1D) then 153 write(*,*) 'There is no "'//start1Dname//'" file!' 154 if (.not. pem1d) then 155 write(*,*) 'Initialization is done with default values.' 156 else 157 write(*,*) 'Initialization cannot be done for the 1D PEM.' 158 stop 159 endif 160 endif 161 inquire(file = startfiname,exist = therestartfi) 162 if (.not. therestartfi) then 163 write(*,*) 'There is no "'//startfiname//'" file!' 164 if (.not. pem1d) then 165 write(*,*) 'Initialization is done with default values.' 166 else 167 write(*,*) 'Initialization cannot be done for the 1D PEM.' 168 stop 169 endif 170 endif 118 171 119 172 !------------------------------------------------------ … … 186 239 endif 187 240 endif 241 188 242 ! allocate arrays: 189 243 allocate(tname(nq),q(nlayer,nq),zqsat(nlayer),qsurf(nq)) … … 245 299 else 246 300 do iq = 1,nq 247 open(3,file = 'start1D.txt',status = "old",action = "read")301 open(3,file = start1Dname,status = "old",action = "read") 248 302 read(3,*) header, qsurf(iq),(q(ilayer,iq), ilayer = 1,nlayer) 249 303 if (trim(tname(iq)) /= trim(header)) then 250 write(*,*) 'Tracer names not compatible for initialization with " start1D.txt"!'304 write(*,*) 'Tracer names not compatible for initialization with "'//trim(start1Dname)//'"!' 251 305 stop 252 306 endif … … 254 308 endif 255 309 256 call init_physics_distribution(regular_lonlat,4,1,1,1,nlayer,COMM_LMDZ) 310 #ifdef CPP_XIOS 311 call init_physics_distribution(regular_lonlat,4,1,1,1,nlayer,COMM_LMDZ) 312 #else 313 call init_physics_distribution(regular_lonlat,4,1,1,1,nlayer,1) 314 #endif 257 315 258 316 ! Date and local time at beginning of run … … 261 319 ! Date (in sols since spring solstice) at beginning of run 262 320 day0 = 0 ! default value for day0 263 write(*,*) 'Initial date (in martian sols 321 write(*,*) 'Initial date (in martian sols; =0 at Ls=0)?' 264 322 call getin("day0",day0) 265 323 day = float(day0) … … 272 330 time = time/24. ! convert time (hours) to fraction of sol 273 331 else 274 call open_startphy( "startfi.nc")332 call open_startphy(startfiname) 275 333 call get_var("controle",tab_cntrl,found) 276 334 if (.not. found) then … … 545 603 zlay(:) = -200.*r*log(play(:)/plev(1))/g 546 604 547 548 605 ! Initialize temperature profile 549 606 ! ------------------------------
Note: See TracChangeset
for help on using the changeset viewer.