Changeset 3109 for trunk/LMDZ.MARS/libf/phymars
- Timestamp:
- Nov 2, 2023, 10:23:18 AM (14 months ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90
r2952 r3109 3 3 implicit none 4 4 ! nsoilmx : number of subterranean layers 5 !EM: old soil routine: integer, parameter :: nsoilmx = 106 5 integer, parameter :: nsoilmx = 18 7 6 -
trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
r3098 r3109 476 476 ice_depth = -1 ! default value: no ice 477 477 call getin("subsurface_ice_depth",ice_depth) 478 478 write(*,*) " subsurface_ice_depth = ",ice_depth 479 479 480 480 z0(1) = z0_default ! default value for roughness … … 654 654 655 655 inertiesoil(1,:,1) = inertiedat(1,:) 656 657 656 tsoil(:,:,1) = tsurf(1,1) ! soil temperature 658 657 endif !(.not. startfiles_1D) -
trunk/LMDZ.MARS/libf/phymars/soil_settings.F
r2951 r3109 89 89 ! 1.1 Start by reading how many layers of soil there are 90 90 91 ! ierr=nf90_inq_dimid(nid,"subsurface_layers",dimid)92 ! if (ierr.ne.nf90_noerr) then93 ! write(*,*)'soil_settings: Problem reading <subsurface_layers>'94 ! write(*,*)trim(nf90_strerror(ierr))95 ! call abort96 ! endif97 98 ! ierr=nf90_inquire_dimension(nid,dimid,len=dimlen)99 ! if (ierr.ne.nf90_noerr) then100 ! write(*,*)'soil_settings: Problem getting <subsurface_layers>',101 ! & 'length'102 ! write(*,*)trim(nf90_strerror(ierr))103 ! call abort104 ! endif105 91 dimlen=inquire_dimension_length("subsurface_layers") 106 92 … … 124 110 ! 1.2 Find out the # of dimensions <inertiedat> was defined as using 125 111 ! (in ye old days, thermal inertia was only given at the "surface") 126 ! Look for thermal inertia data 127 ! ierr=nf90_inq_varid(nid,"inertiedat",nvarid) 128 ! if (ierr.NE.nf90_noerr) then 129 ! write(*,*)'soil_settings: Field <inertiedat> not found!' 130 ! write(*,*)trim(nf90_strerror(ierr)) 131 ! call abort 132 ! endif 133 ! 134 ! ! Read the # of dimensions <inertidat> was defined as using 135 ! ierr=nf90_inquire_variable(nid,nvarid,ndims=ndims) 136 ! ! if (ndims.eq.1) then we have the "old 2D-surface" format 112 137 113 ndims=inquire_field_ndims("inertiedat") 138 114 … … 148 124 enddo 149 125 else ! Look for depth 150 ! ierr=nf90_inq_varid(nid,"soildepth",nvarid)151 ! if (ierr.ne.nf90_noerr) then152 ! write(*,*)'soil_settings: Field <soildepth> not found!'153 ! write(*,*)trim(nf90_strerror(ierr))154 ! call abort155 ! endif156 126 ! read <depth> coordinate 157 127 if (interpol) then !put values in oldmlayer 158 ! ierr=nf90_get_var(nid,nvarid,oldmlayer)159 ! if (ierr.ne.nf90_noerr) then160 ! write(*,*)'soil_settings: Problem while reading <soildepth>'161 ! write(*,*)trim(nf90_strerror(ierr))162 ! call abort163 ! endif164 128 call get_var("soildepth",oldmlayer,found) 165 129 if (.not.found) then … … 167 131 endif 168 132 else ! put values in mlayer 169 ! ierr=nf90_get_var(nid,nvarid,mlayer)170 ! if (ierr.ne.nf90_noerr) then171 ! write(*,*)'soil_settings: Problem while reading <soildepth>'172 ! write(*,*)trim(nf90_strerror(ierr))173 ! call abort174 ! endif175 133 call get_var("soildepth",mlayer,found) 176 134 if (.not.found) then … … 184 142 ! default mlayer distribution, following a power law: 185 143 ! mlayer(k)=lay1*alpha**(k-1/2) 186 lay1=2.e-4187 188 do iloop=0,nsoil-1189 190 144 lay1=2.e-4 145 alpha=2 146 do iloop=0,nsoil-1 147 mlayer(iloop)=lay1*(alpha**(iloop-0.5)) 148 enddo 191 149 endif 192 150 … … 214 172 volcapa=default_volcapa 215 173 endif 216 ! Look for it 217 ! ierr=NF_INQ_VARID(nid,"volcapa",nvarid) 218 ! if (ierr.NE.nf90_noerr) then 219 ! write(*,*)'soil_settings: Field <volcapa> not found!' 220 ! write(*,*)'Initializing Volumetric heat capacity to ', 221 ! & default_volcapa 222 ! volcapa=default_volcapa 223 ! else 224 !#ifdef NC_DOUBLE 225 ! ierr = NF_GET_VAR_DOUBLE(nid,nvarid,volcapa) 226 !#else 227 ! ierr = NF_GET_VAR_REAL(nid,nvarid,volcapa) 228 !#endif 229 ! if (ierr.ne.nf90_noerr) then 230 ! write(*,*)'soil_settings: Problem while reading <volcapa>' 231 ! call abort 232 ! endif 233 ! endif 234 235 ! 3. Thermal inertia for presetend climate -inertiedat- (note: it is declared in comsoil_h) 174 175 ! 3. Thermal inertia for present day climate -inertiedat- & the one given by the pem -ineritesoil-(note: it is declared in comsoil_h) 236 176 ! ------------------ 237 238 ! 3.1 Look (again) for thermal inertia data (to reset nvarid) 239 ! ierr=nf90_inq_varid(nid,"inertiedat",nvarid) 240 ! if (ierr.NE.nf90_noerr) then 241 ! write(*,*)'soil_settings: Field <inertiedat> not found!' 242 ! write(*,*)trim(nf90_strerror(ierr)) 243 ! call abort 244 ! endif 245 246 ! 3.2 Knowing the # of dimensions <inertidat> was defined as using, 177 ! Knowing the # of dimensions <inertidat> was defined as using, 247 178 ! read/build thermal inertia 179 180 ! 3.1 Present day - inertiedat 248 181 249 182 if (ndims.eq.1) then ! "old 2D-surface" format … … 283 216 endif 284 217 endif ! of if (.not.allocated(oldinertiedat)) 285 ! ierr=nf90_get_var(nid,nvarid,oldinertiedat) 286 ! if (ierr.NE.nf90_noerr) then 287 ! write(*,*)'soil_settings: Problem while reading <inertiedat>' 288 ! write(*,*)trim(nf90_strerror(ierr)) 289 ! call abort 290 ! endif 218 291 219 call get_field("inertiedat",oldinertiedat,found) 292 220 if (.not.found) then … … 296 224 endif 297 225 else ! put values in therm_i 298 ! ierr=nf90_get_var(nid,nvarid,inertiedat)299 ! if (ierr.NE.nf90_noerr) then300 ! write(*,*)'soil_settings: Problem while reading <inertiedat>'301 ! write(*,*)trim(nf90_strerror(ierr))302 ! call abort303 226 call get_field("inertiedat",inertiedat,found) 304 227 if (.not.found) then … … 307 230 & "failed loading <inertiedat>",1) 308 231 endif 309 ! endif310 232 endif ! of if (interpol) 311 233 endif ! of if (ndims.eq.1) 312 234 313 314 ! 4. Read soil temperatures 315 ! ------------------------- 316 317 ! ierr=nf90_inq_varid(nid,"tsoil",nvarid) 235 ! 3.2 Inertie from the PEM 236 318 237 ok=inquire_field("inertiesoil") 319 ! if (ierr.ne.nf90_noerr) then 238 320 239 if (.not.ok) then 321 240 write(*,*)'soil_settings: Field <inertiesoil> not found!' … … 326 245 enddo 327 246 else ! <inertiesoil> found 328 if (interpol) then ! put values in old tsoil247 if (interpol) then ! put values in oldinertiesoil 329 248 if (.not.allocated(oldinertiesoil)) then 330 249 allocate(oldinertiesoil(ngrid,dimlen,nslope),stat=ierr) … … 336 255 endif 337 256 endif 338 ! ierr=nf90_get_var(nid,nvarid,oldtsoil) 339 ! if (ierr.ne.nf90_noerr) then 340 ! write(*,*)'soil_settings: Problem while reading <tsoil>' 341 ! write(*,*)trim(nf90_strerror(ierr)) 342 ! call abort 343 ! endif 257 344 258 call get_field("inertiesoil",oldinertiesoil,found) 345 259 if (.not.found) then … … 348 262 & "failed loading <inertiesoil>",1) 349 263 endif 350 else ! put values in tsoil 351 ! corner(1)=1 352 ! corner(2)=1 353 ! corner(3)=indextime 354 ! edges(1)=ngrid 355 ! edges(2)=nsoil 356 ! edges(3)=1 357 ! !ierr=nf90_get_var(nid,nvarid,tsoil,corner,edges) 358 ! ierr=nf90_get_var(nid,nvarid,tsoil) 359 ! if (ierr.ne.nf90_noerr) then 360 ! write(*,*)'soil_settings: Problem while reading <tsoil>' 361 ! write(*,*)trim(nf90_strerror(ierr)) 362 ! call abort 363 ! endif 264 else ! put values in inertiesoil 364 265 call get_field("inertiesoil",inertiesoil,found, 365 266 & timeindex=indextime) … … 373 274 374 275 375 376 377 378 ! 5. Read soil temperatures 276 277 ! 4. Read soil temperatures 379 278 ! ------------------------- 380 279 381 ! ierr=nf90_inq_varid(nid,"tsoil",nvarid)382 280 ok=inquire_field("tsoil") 383 ! if (ierr.ne.nf90_noerr) then 281 384 282 if (.not.ok) then 385 283 write(*,*)'soil_settings: Field <tsoil> not found!' … … 401 299 endif 402 300 endif 403 ! ierr=nf90_get_var(nid,nvarid,oldtsoil)404 ! if (ierr.ne.nf90_noerr) then405 ! write(*,*)'soil_settings: Problem while reading <tsoil>'406 ! write(*,*)trim(nf90_strerror(ierr))407 ! call abort408 ! endif409 301 call get_field("tsoil",oldtsoil,found) 410 302 if (.not.found) then … … 414 306 endif 415 307 else ! put values in tsoil 416 ! corner(1)=1417 ! corner(2)=1418 ! corner(3)=indextime419 ! edges(1)=ngrid420 ! edges(2)=nsoil421 ! edges(3)=1422 ! !ierr=nf90_get_var(nid,nvarid,tsoil,corner,edges)423 ! ierr=nf90_get_var(nid,nvarid,tsoil)424 ! if (ierr.ne.nf90_noerr) then425 ! write(*,*)'soil_settings: Problem while reading <tsoil>'426 ! write(*,*)trim(nf90_strerror(ierr))427 ! call abort428 ! endif429 308 call get_field("tsoil",tsoil,found,timeindex=indextime) 430 309 if (.not.found) then … … 436 315 endif! of if (.not.ok) 437 316 438 ! 6. If necessary, interpolate soil temperatures and thermal inertias 317 318 ! 5. If necessary, interpolate soil temperatures and thermal inertias 439 319 ! ------------------------------------------------------------------- 440 320 … … 474 354 endif 475 355 476 ! thermal inertia - present day 356 ! thermal inertia - present day (inertiedat) 477 357 do ig=1,ngrid 478 358 ! copy data 479 oldval(1:dimlen)=oldinertiedat(ig, dimlen)359 oldval(1:dimlen)=oldinertiedat(ig,1:dimlen) 480 360 ! interpolate 481 361 call interp_line(oldmlayer,oldval,dimlen,mlayer,newval,nsoil) 482 362 !copy result in inertiedat 483 363 inertiedat(ig,:)=newval(:) 484 enddo 485 ! thermal inertia - general case 486 do ig=1,ngrid 487 do islope=1,nslope 364 ! thermal inertia - general case with PEM (inertie soil) 365 do islope=1,nslope 488 366 ! copy data 489 oldval(1:dimlen)=oldinertiesoil(ig, dimlen,islope)367 oldval(1:dimlen)=oldinertiesoil(ig,1:dimlen,islope) 490 368 ! interpolate 491 369 call interp_line(oldmlayer,oldval,dimlen,mlayer,newval,nsoil) 492 370 !copy result in inertiedat 493 inertiesoil(ig,:,islope)=newval(:)494 enddo495 enddo371 inertiesoil(ig,:,islope)=newval(:) 372 enddo 373 enddo ! ig 496 374 497 375 … … 510 388 tsoil(ig,:,islope)=newval(:) 511 389 enddo 512 390 enddo 513 391 514 392 !cleanup 515 deallocate(oldgrid)393 deallocate(oldgrid) 516 394 deallocate(oldval) 517 395 deallocate(newval) … … 523 401 524 402 525 ! 7. Load Geothermal Flux403 ! 6. Load Geothermal Flux 526 404 ! ---------------------------------------------------------------------- 527 405 … … 536 414 537 415 538 ! 8. Report min and max values of soil temperatures and thermal inertias416 ! 7. Report min and max values of soil temperatures and thermal inertias 539 417 ! ---------------------------------------------------------------------- 540 418
Note: See TracChangeset
for help on using the changeset viewer.