Changeset 2355 for trunk/LMDZ.MARS/libf
- Timestamp:
- Jun 9, 2020, 4:05:02 PM (4 years ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars/dyn1d
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F
r2332 r2355 32 32 USE phys_state_var_init_mod, ONLY: phys_state_var_init 33 33 USE physiq_mod, ONLY: physiq 34 USE read_profile_mod, ONLY: read_profile 34 35 IMPLICIT NONE 35 36 … … 117 118 integer :: nq=1 ! number of tracers 118 119 real :: latitude(1), longitude(1), cell_area(1) 119 integer iqh2ovap120 integer iqh2oice121 120 122 121 character*2 str2 … … 307 306 ! initialize tracers here: 308 307 write(*,*) "testphys1d: initializing tracers" 309 q(:,:)=0 ! default, set everything to zero 310 qsurf(:)=0 311 ! "smarter" initialization of some tracers 312 ! (get values from "profile_*" files, if these are available) 313 do iq=1,nq 314 txt="" 315 write(txt,"(a)") tname(iq) 316 write(*,*)" tracer:",trim(txt) 317 ! CO2 318 if (txt.eq."co2") then 319 q(:,iq)=0.95 ! kg /kg of atmosphere 320 qsurf(iq)=0. ! kg/m2 (not used for CO2) 321 ! even better, look for a "profile_co2" input file 322 open(91,file='profile_co2',status='old', 323 & form='formatted',iostat=ierr) 324 if (ierr.eq.0) then 325 read(91,*) qsurf(iq) 326 do ilayer=1,nlayer 327 read(91,*) q(ilayer,iq) 328 enddo 329 endif 330 close(91) 331 endif ! of if (txt.eq."co2") 332 ! Allow for an initial profile of argon 333 ! Can also be used to introduce a decaying tracer 334 ! in the 1D (TBD) to study thermals 335 if (txt.eq."ar") then 336 !look for a "profile_ar" input file 337 open(91,file='profile_ar',status='old', 338 & form='formatted',iostat=ierr) 339 if (ierr.eq.0) then 340 read(91,*) qsurf(iq) 341 do ilayer=1,nlayer 342 read(91,*) q(ilayer,iq) 343 enddo 344 else 345 write(*,*) "No profile_ar file!" 346 endif 347 close(91) 348 endif ! of if (txt.eq."ar") 349 350 ! WATER VAPOUR 351 if (txt.eq."h2o_vap") then 352 iqh2ovap=iq !remember index for water vap 353 !look for a "profile_h2o_vap" input file 354 open(91,file='profile_h2o_vap',status='old', 355 & form='formatted',iostat=ierr) 356 if (ierr.eq.0) then 357 read(91,*) qsurf(iq) 358 do ilayer=1,nlayer 359 read(91,*) q(ilayer,iq) 360 enddo 361 else 362 write(*,*) "No profile_h2o_vap file!" 363 endif 364 close(91) 365 endif ! of if (txt.eq."h2o_ice") 366 ! WATER ICE 367 if (txt.eq."h2o_ice") then 368 iqh2oice = iq !remember index for water ice 369 !look for a "profile_h2o_vap" input file 370 open(91,file='profile_h2o_ice',status='old', 371 & form='formatted',iostat=ierr) 372 if (ierr.eq.0) then 373 read(91,*) qsurf(iq) 374 do ilayer=1,nlayer 375 read(91,*) q(ilayer,iq) 376 enddo 377 else 378 write(*,*) "No profile_h2o_ice file!" 379 endif 380 close(91) 381 endif ! of if (txt.eq."h2o_ice") 382 383 ! HDO VAPOUR 384 if (txt.eq."hdo_vap") then 385 !look for a "profile_hdo_vap" input file 386 open(91,file='profile_hdo_vap',status='old', 387 & form='formatted',iostat=ierr) 388 if (ierr.eq.0) then 389 read(91,*) qsurf(iq) 390 do ilayer=1,nlayer 391 read(91,*) q(ilayer,iq) 392 enddo 393 else 394 write(*,*) "No profile_hdo_vap file!" 395 do ilayer=1,nlayer 396 q(ilayer,iq) = q(ilayer,iqh2ovap)*2*155.76e-6*5 397 enddo 398 endif 399 close(91) 400 endif ! of if (txt.eq."hdo_ice") 401 ! HDO ICE 402 if (txt.eq."hdo_ice") then 403 !look for a "profile_hdo_vap" input file 404 open(91,file='profile_hdo_ice',status='old', 405 & form='formatted',iostat=ierr) 406 if (ierr.eq.0) then 407 read(91,*) qsurf(iq) 408 do ilayer=1,nlayer 409 read(91,*) q(ilayer,iq) 410 enddo 411 else 412 write(*,*) "No profile_hdo_ice file!" 413 qsurf(iq) = qsurf(iqh2oice) * 2*155.76e-6*5 414 do ilayer=1,nlayer 415 q(ilayer,iq) = q(ilayer,iqh2oice) * 2*155.76e-6*5 416 enddo 417 endif 418 close(91) 419 endif ! of if (txt.eq."hdo_ice") 420 421 422 ! DUST 423 !if (txt(1:4).eq."dust") then 424 ! q(:,iq)=0.4 ! kg/kg of atmosphere 425 ! qsurf(iq)=100 ! kg/m2 426 !endif 427 ! DUST MMR 428 if (txt.eq."dust_mass") then 429 !look for a "profile_dust_mass" input file 430 open(91,file='profile_dust_mass',status='old', 431 & form='formatted',iostat=ierr) 432 if (ierr.eq.0) then 433 read(91,*) qsurf(iq) 434 do ilayer=1,nlayer 435 read(91,*) q(ilayer,iq) 436 ! write(*,*) "l=",ilayer," q(ilayer,iq)=",q(ilayer,iq) 437 enddo 438 else 439 write(*,*) "No profile_dust_mass file!" 440 endif 441 close(91) 442 endif ! of if (txt.eq."dust_mass") 443 ! DUST NUMBER 444 if (txt.eq."dust_number") then 445 !look for a "profile_dust_number" input file 446 open(91,file='profile_dust_number',status='old', 447 & form='formatted',iostat=ierr) 448 if (ierr.eq.0) then 449 read(91,*) qsurf(iq) 450 do ilayer=1,nlayer 451 read(91,*) q(ilayer,iq) 452 enddo 453 else 454 write(*,*) "No profile_dust_number file!" 455 endif 456 close(91) 457 endif ! of if (txt.eq."dust_number") 458 ! NB: some more initializations (chemistry) is done later 459 ! CCN MASS 460 if (txt.eq."ccn_mass") then 461 !look for a "profile_ccn_mass" input file 462 open(91,file='profile_ccn_mass',status='old', 463 & form='formatted',iostat=ierr) 464 if (ierr.eq.0) then 465 read(91,*) qsurf(iq) 466 do ilayer=1,nlayer 467 read(91,*) q(ilayer,iq) 468 enddo 469 else 470 write(*,*) "No profile_ccn_mass file!" 471 endif 472 close(91) 473 endif ! of if (txt.eq."ccn_mass") 474 ! CCN NUMBER 475 if (txt.eq."ccn_number") then 476 !look for a "profile_ccn_number" input file 477 open(91,file='profile_ccn_number',status='old', 478 & form='formatted',iostat=ierr) 479 if (ierr.eq.0) then 480 read(91,*) qsurf(iq) 481 do ilayer=1,nlayer 482 read(91,*) q(ilayer,iq) 483 enddo 484 else 485 write(*,*) "No profile_ccn_number file!" 486 endif 487 close(91) 488 endif ! of if (txt.eq."ccn_number") 489 enddo ! of do iq=1,nq 490 308 call read_profile(nq, nlayer, qsurf, q) 491 309 else 492 310 ! we still need to set (dummy) tracer number and names for physdem1
Note: See TracChangeset
for help on using the changeset viewer.