Changeset 1577 for trunk/MESOSCALE/LMD_MM_MARS/SRC
- Timestamp:
- Aug 22, 2016, 11:03:18 AM (8 years ago)
- Location:
- trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys/Makefile
r94 r1577 9 9 module_physics_addtendc.o \ 10 10 module_physics_init.o \ 11 update_inputs_physiq_mod.o \ 12 update_outputs_physiq_mod.o \ 11 13 module_lmd_driver.o 12 14 -
trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F.new
r1411 r1577 58 58 USE module_model_constants 59 59 USE module_wrf_error 60 61 60 #ifndef NOPHYS 62 !! MODULES FROM LMD PHYSICS 63 use slope_mod, only: theta_sl, psi_sl 64 use surfdat_h, only: phisfi, albedodat, & 65 zmea, zstd, zsig, zgam, zthe, z0, & 66 emissiv,albedice,iceradius, & 67 emisice,dtemisice, & 68 z0_default, & 69 tsurf, co2ice, emis, qsurf 70 use comsoil_h, only: inertiedat,mlayer,layer, & 71 volcapa, tsoil 72 use planete_h, only: year_day,periheli,aphelie, & 73 peri_day,obliquit,emin_turb, & 74 lmixmin 75 use turb_mod, only: q2,wstar,ustar,sensibFlux,& 76 hfmax_th,zmax_th,turb_resolved 77 use dimradmars_mod, only: fluxrad 78 use tracer_mod, only: noms 79 use comcstfi_h, only: omeg,mugaz 80 use comgeomfi_h, only: ini_fillgeom 81 USE comm_wrf 61 USE update_inputs_physiq_mod !! to set inputs for physiq 62 USE update_outputs_physiq_mod !! to get outputs from physiq 63 USE comm_wrf !! to get fields to be written from physiq 82 64 #endif 83 65 … … 146 128 INTEGER :: i,j,k,its,ite,jts,jte,ij,kk 147 129 INTEGER :: subs,iii 148 REAL :: lay1,alpha149 130 150 131 … … 157 138 INTEGER :: ngrid,nlayer,nq,nsoil 158 139 REAL :: pday,ptime,MY 159 REAL :: aire_val,lat_val,lon_val 160 REAL :: phisfi_val,albedodat_val,inertiedat_val 161 REAL :: zmea_val,zstd_val,zsig_val,zgam_val,zthe_val 162 REAL :: theta_val, psi_val 140 REAL :: phisfi_val 163 141 LOGICAL :: firstcall,lastcall,tracerdyn 164 REAL,DIMENSION(:),ALLOCATABLE :: plon, plat, parea165 REAL,DIMENSION(:),ALLOCATABLE :: q2_val, qsurf_val, tsoil_val166 REAL :: wstar_val,fluxrad_val167 REAL,DIMENSION(:),ALLOCATABLE :: isoil_val, dsoil_val168 REAL :: z0_val169 142 ! ---------- 170 143 REAL,DIMENSION(:,:),ALLOCATABLE :: pplev,pplay,pphi,pu,pv,pt,pw … … 213 186 !!!IDEALIZED IDEALIZED 214 187 REAL :: lat_input, lon_input, ls_input, lct_input 188 LOGICAL :: isles 215 189 !!!IDEALIZED IDEALIZED 216 190 … … 225 199 !================================================================== 226 200 201 !! determine here if this is turbulence-resolving or not 227 202 IF (JULYR .ne. 9999) THEN 228 turb_resolved= .false. ! "True" LES is not available in this version203 isles = .false. ! "True" LES is not available in this version 229 204 PRINT *, '*** REAL-CASE SIMULATION ***' 230 205 ELSE … … 234 209 PRINT *, '*** diff_opt = 2 *** km_opt = 2' 235 210 PRINT *, '*** forcing is isfflx = ',isfflx 236 turb_resolved= .true.211 isles = .true. 237 212 !! SPECIAL LES 238 213 ELSE … … 240 215 PRINT *, '*** diff_opt = ',diff_opt 241 216 PRINT *, '*** km_opt = ',km_opt 242 turb_resolved= .false.217 isles = .false. 243 218 !! IDEALIZED, no LES 244 219 !! cependant, ne veut-on pas pouvoir … … 258 233 jte = j_end(num_tiles) 259 234 !! 260 IF ( turb_resolved.eqv. .false.) THEN235 IF (isles .eqv. .false.) THEN 261 236 relax=0 262 237 sponge_top=0 ! another value than 0 triggers instabilities … … 267 242 jps=jts 268 243 jpe=jte 269 IF ( turb_resolved.eqv. .false.) THEN244 IF (isles .eqv. .false.) THEN 270 245 IF (ips .eq. ids) ips=its+relax !! IF tests necesary for parallel runs 271 246 IF (ipe .eq. ide-1) ipe=ite-relax … … 274 249 ENDIF 275 250 kps=kts !! start at surface 276 IF ( turb_resolved.eqv. .false.) THEN251 IF (isles .eqv. .false.) THEN 277 252 kpe=kte-sponge_top 278 253 ELSE … … 375 350 ENDIF 376 351 377 !!!******!! 378 !!! TIME !! 379 !!!******!! 380 IF (JULYR .ne. 9999) THEN 381 ! 382 ! specified 383 ! 384 ptime = (GMT + elaps/3700.) !! universal time (0<ptime<1): ptime=0.5 at 12:00 UT 385 ptime = MODULO(ptime,24.) !! the two arguments of MODULO must be of the same type 386 ptime = ptime / 24. 387 pday = (JULDAY - 1 + INT((3700*GMT+elaps)/88800)) 388 pday = MODULO(int(pday),669) 389 MY = (JULYR-2000) + (88800.*(JULDAY - 1)+3700.*GMT+elaps)/59496000. 390 MY = INT(MY) 391 ELSE 392 ! 393 ! idealized 394 ! 352 !!!***********!! 353 !!! IDEALIZED !! 354 !!!***********!! 355 IF (JULYR .eq. 9999) THEN 395 356 PRINT *,'** Mars ** IDEALIZED SIMULATION' 396 357 PRINT *,'** Mars ** BEWARE: input_coord must be here' … … 402 363 read(14,*) lct_input 403 364 close(14) 404 ptime = lct_input - lon_input / 15. + elaps/3700. 405 ptime = MODULO(ptime,24.) 406 ptime = ptime / 24. 407 pday = floor(ls2sol(ls_input)) + INT((3700*(lct_input - lon_input / 15.) + elaps)/88800) 408 pday = MODULO(int(pday),669) 409 MY = 2024 410 !day_ini = floor(ls2sol(ls_input)) !! pday at firstcall is day_ini 411 ENDIF 412 print *,'** Mars ** TIME IS', pday, ptime*24. 413 365 ENDIF 414 366 415 367 !----------! 416 368 ! ALLOCATE ! 417 369 !----------! 370 !-------------------------------------------------------------------------------! 371 ! outputs: ! 372 ! pdu(ngrid,nlayermx) \ ! 373 ! pdv(ngrid,nlayermx) \ Temporal derivative of the corresponding ! 374 ! pdt(ngrid,nlayermx) / variables due to physical processes. ! 375 ! pdq(ngrid,nlayermx) / ! 376 ! pdpsrf(ngrid) / ! 377 ! tracerdyn call tracer in dynamical part of GCM ? ! 378 !-------------------------------------------------------------------------------! 418 379 ALLOCATE(pdpsrf(ngrid)) 419 380 ALLOCATE(pdu(ngrid,nlayer)) … … 450 411 CALL allocate_comm_wrf(ngrid,nlayer) 451 412 #endif 452 ALLOCATE(q2_val(nlayer+1))453 ALLOCATE(qsurf_val(nq))454 ALLOCATE(tsoil_val(nsoil))455 ALLOCATE(isoil_val(nsoil))456 ALLOCATE(dsoil_val(nsoil))457 413 ALLOCATE(pplev(ngrid,nlayer+1)) !!!!! 458 414 ALLOCATE(pplay(ngrid,nlayer)) !!!!! … … 481 437 !!!!!!!!!!!!!!!!!!!!!!!!!!!! 482 438 483 !! INITIALIZE AND ALLOCATE EVERYTHING !! 439 #ifndef NOPHYS 440 !! INITIALIZE AND ALLOCATE EVERYTHING !! here, only firstcall 484 441 allocation_firstcall: IF (firstcall .EQV. .true.) THEN 485 486 !! TRACERS 487 ALLOCATE(noms(nq)) !! est fait dans initracer normalement 488 !! tableau dans tracer_mod.F90 489 490 !!! name of tracers to mimic entries in tracer.def 491 !!! ----> IT IS IMPORTANT TO KEEP SAME ORDERING AS IN THE REGISTRY !!!! 492 !!! SAME NAMING AS IN THE LMD PHYSICS !!!! 493 SELECT CASE (MARS_MODE) 494 CASE(0,10) 495 noms(nq) = 'co2' 496 CASE(1) ! scalar:qh2o,qh2o_ice 497 noms(1) = 'h2o_vap' 498 noms(2) = 'h2o_ice' 499 CASE(2) ! scalar:qdust 500 noms(1) = 'dust01' 501 CASE(3) ! scalar:qdust,qdustn 502 noms(1) = 'dust_mass' 503 noms(2) = 'dust_number' 504 CASE(11) ! scalar:qh2o,qh2o_ice,qdust,qdustn 505 noms(1) = 'h2o_vap' 506 noms(2) = 'h2o_ice' 507 noms(3) = 'dust_mass' 508 noms(4) = 'dust_number' 509 CASE(12) 510 noms(1) = 'h2o_vap' 511 noms(2) = 'h2o_ice' 512 noms(3) = 'dust_mass' 513 noms(4) = 'dust_number' 514 noms(5) = 'ccn_mass' 515 noms(6) = 'ccn_number' 516 CASE(20) 517 noms(1) = 'qtrac1' 518 CASE(42) 519 noms(1) = 'co2' 520 noms(2) = 'co' 521 noms(3) = 'o' 522 noms(4) = 'o1d' 523 noms(5) = 'o2' 524 noms(6) = 'o3' 525 noms(7) = 'h' 526 noms(8) = 'h2' 527 noms(9) = 'oh' 528 noms(10) = 'ho2' 529 noms(11) = 'h2o2' 530 noms(12) = 'ch4' 531 noms(13) = 'n2' 532 noms(14) = 'ar' 533 noms(15) = 'h2o_ice' 534 noms(16) = 'h2o_vap' 535 noms(17) = 'dust_mass' 536 noms(18) = 'dust_number' 537 END SELECT 538 539 !!*******************************************!! 540 541 #ifndef NOPHYS 442 !! tracers' name 443 PRINT *,'** Mars ** TRACERS NAMES' 444 CALL update_inputs_physiq_tracers(nq,MARS_MODE) 542 445 !! PHYSICS VARIABLES (cf. iniphysiq in LMD GCM) 543 446 !! parameters are defined in the module_model_constants.F WRF routine … … 545 448 CALL phys_state_var_init(ngrid,nlayer,nq,& 546 449 wdaysec,ptimestep,1/reradius,g,r_d,cp) 547 548 450 !! Fill planetary parameters in modules 549 451 !! Values defined in the module_model_constants.F WRF routine 550 551 !! comcstfi_h 552 omeg = womeg 553 mugaz = wmugaz 554 print*,"check: omeg,mugaz" 555 print*,omeg,mugaz 556 !! planet_h 557 year_day = wyear_day 558 periheli = wperiheli 559 aphelie = waphelie 560 peri_day = wperi_day 561 obliquit = wobliquit 562 emin_turb = wemin_turb 563 lmixmin = wlmixmin 564 print*,"check: year_day,periheli,aphelie,peri_day,obliquit" 565 print*,year_day,periheli,aphelie,peri_day,obliquit 566 print*,"check: emin_turb,lmixmin" 567 print*,emin_turb,lmixmin 568 !! surfdat_h 569 emissiv = wemissiv 570 emisice(1) = wemissiceN 571 emisice(2) = wemissiceS 572 albedice(1) = walbediceN 573 albedice(2) = walbediceS 574 iceradius(1) = wiceradiusN 575 iceradius(2) = wiceradiusS 576 dtemisice(1) = wdtemisiceN 577 dtemisice(2) = wdtemisiceS 578 z0_default = wz0 579 print*,"check: z0def,emissiv,emisice,albedice,iceradius,dtemisice" 580 print*,z0_default,emissiv,emisice,albedice,iceradius,dtemisice 581 !! comsoil_h 582 volcapa = wvolcapa 583 print*,"check: volcapa",volcapa 584 452 CALL update_inputs_physiq_constants 585 453 !! Read callphys.def !! 586 454 call conf_phys(ngrid,nlayer,nq) 587 588 #endif589 590 455 ENDIF allocation_firstcall 456 #endif 591 457 592 458 !!*****************************!! … … 683 549 ENDDO 684 550 685 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!686 !!! ONE DOMAIN CASE687 !!! --> we simply need to initialize static and physics inputs688 !!! SEVERAL DOMAINS689 !!! --> we update static and physics inputs each time690 !!! to account for691 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!692 pass_interface: IF ( (firstcall .EQV. .true.) .or. (max_dom .GT. 1) ) THEN693 694 PRINT *,'** Mars ** PASS INTERFACE. EITHER FIRSTCALL or NESTED SIMULATION.'695 696 !!!!!!!!!!!!697 !!! GEOM !!!698 !!!!!!!!!!!!699 700 ALLOCATE(plon(ngrid))701 ALLOCATE(plat(ngrid))702 ALLOCATE(parea(ngrid))703 704 DO j = jps,jpe705 DO i = ips,ipe706 707 !-----------------------------------!708 ! 1D subscript for physics "cursor" !709 !-----------------------------------!710 subs = (j-jps)*(ipe-ips+1)+(i-ips+1)711 712 !----------------------------------------!713 ! Surface of each part of the grid (m^2) !714 !----------------------------------------!715 !parea(subs) = dx*dy !! 1. idealized cases - computational grid716 parea(subs) = (dx/msft(i,j))*(dy/msft(i,j)) !! 2. WRF map scale factors - assume that msfx=msfy (msf=covariance)717 !parea(subs)=dx*dy/msfu(i,j) !! 3. special for Mercator GCM-like simulations718 719 !---------------------------------------------!720 ! Mass-point latitude and longitude (radians) !721 !---------------------------------------------!722 IF (JULYR .ne. 9999) THEN723 plat(subs) = XLAT(i,j)*DEGRAD724 plon(subs) = XLONG(i,j)*DEGRAD725 ELSE726 !!! IDEALIZED CASE727 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION lat: ',lat_input728 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION lon: ',lon_input729 plat(subs) = lat_input*DEGRAD730 plon(subs) = lon_input*DEGRAD731 ENDIF732 733 ENDDO734 ENDDO735 736 !! FILL GEOMETRICAL ARRAYS !!737 call ini_fillgeom(ngrid,plat,plon,parea)738 739 DEALLOCATE(plon)740 DEALLOCATE(plat)741 DEALLOCATE(parea)742 743 !!*******************************************!!744 !!*******************************************!!745 746 DO j = jps,jpe747 DO i = ips,ipe748 749 !-----------------------------------!750 ! 1D subscript for physics "cursor" !751 !-----------------------------------!752 subs = (j-jps)*(ipe-ips+1)+(i-ips+1)753 754 !! **************755 !! use slope_mod756 !! **************757 !-------------------!758 ! Slope inclination !759 !-------------------!760 IF (JULYR .ne. 9999) THEN761 theta_val=atan(sqrt( (1000.*SLPX(i,j))**2 + (1000.*SLPY(i,j))**2 ))762 theta_val=theta_val/DEGRAD763 ELSE764 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION slope inclination is 0'765 theta_val=0.766 ENDIF767 !-------------------------------------------!768 ! Slope orientation; 0 is north, 90 is east !769 !-------------------------------------------!770 IF (JULYR .ne. 9999) THEN771 psi_val=-90.*DEGRAD-atan(SLPY(i,j)/SLPX(i,j))772 if (SLPX(i,j) .ge. 0.) then773 psi_val=psi_val-180.*DEGRAD774 endif775 psi_val=360.*DEGRAD+psi_val776 psi_val=psi_val/DEGRAD777 psi_val = MODULO(psi_val+180.,360.)778 ELSE779 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION slope orientation is 0 (well, whatever)'780 psi_val=0.781 ENDIF782 theta_sl(subs) = theta_val783 psi_sl(subs) = psi_val784 785 !! **************786 !! use surfdat_h787 !! **************788 551 !---------------------------------------------------------! 789 552 ! Ground geopotential ! … … 791 554 !---------------------------------------------------------! 792 555 phisfi_val=g*(z_prof(1)-dz8w_prof(1)/2.) !! NB: z_prof are half levels, so z_prof(1) is not the surface 793 !---------------------------------!794 ! Ground albedo & Thermal Inertia !795 !---------------------------------!796 IF (JULYR .ne. 9999) THEN797 IF (CST_AL == 0) THEN798 albedodat_val=M_ALBEDO(i,j)799 ELSE800 albedodat_val=CST_AL801 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** SET CONSTANT ALBEDO ', albedodat_val802 ENDIF803 ELSE804 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION albedo: ', CST_AL805 albedodat_val=CST_AL806 ENDIF807 !-----------------------------------------!808 ! Gravity wave parametrization !809 ! NB: usually 0 in mesoscale applications !810 !-----------------------------------------!811 IF (JULYR .ne. 9999) THEN812 zmea_val=M_GW(i,1,j)813 zstd_val=M_GW(i,2,j)814 zsig_val=M_GW(i,3,j)815 zgam_val=M_GW(i,4,j)816 zthe_val=M_GW(i,5,j)817 ELSE818 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION GWdrag OFF'819 zmea_val=0.820 zstd_val=0.821 zsig_val=0.822 zgam_val=0.823 zthe_val=0.824 ENDIF825 phisfi(subs) = phisfi_val826 albedodat(subs) = albedodat_val827 zmea(subs) = zmea_val828 zstd(subs) = zstd_val829 zsig(subs) = zsig_val830 zgam(subs) = zgam_val831 zthe(subs) = zthe_val832 !----------------------------!833 ! Variable surface roughness !834 !----------------------------!835 IF (JULYR .ne. 9999) THEN836 IF (CST_Z0 == 0) THEN837 z0_val = M_Z0(i,j)838 ELSE839 z0_val = CST_Z0840 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** SET CONSTANT SURF ROUGHNESS (m) ',CST_Z0841 ENDIF842 ELSE843 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION z0 (m) ', CST_Z0844 z0_val=CST_Z0845 ENDIF846 !!!! ADDITIONAL SECURITY. THIS MIGHT HAPPEN WITH OLD INIT FILES.847 IF (z0_val == 0.) THEN848 IF ( (i == ips) .AND. (j == jps) ) PRINT *, 'WELL, z0 is 0, this is no good. Setting to old defaults value 0.01 m'849 z0_val = 0.01850 ENDIF851 !!!! ADDITIONAL SECURITY. INTERP+SMOOTH IN GEOGRID MIGHT YIELD NEGATIVE Z0 !!!852 IF (z0_val < 0.) THEN853 PRINT *, 'WELL, z0 is NEGATIVE, this is impossible. better stop here.'854 PRINT *, 'advice --> correct interpolation / smoothing of z0 in WPS'855 PRINT *, ' -- or check the constant value set in namelist.input'856 STOP857 ENDIF858 z0(subs) = z0_val859 !-----------------------------------------------!860 ! Ground temperature, emissivity, CO2 ice cover !861 !-----------------------------------------------!862 tsurf(subs) = M_TSURF(i,j)863 emis(subs) = M_EMISS(i,j)864 co2ice(subs) = M_CO2ICE(i,j)865 !-------------------!866 ! Tracer at surface !867 !-------------------!868 qsurf_val(:)=0. ! default case869 SELECT CASE (MARS_MODE)870 CASE(1)871 qsurf_val(2)=M_H2OICE(i,j) !! logique avec noms(2) = 'h2o_ice' defini ci-dessus872 !! ----- retrocompatible ancienne physique873 !! ----- [H2O ice is last tracer in qsurf in LMD physics]874 CASE(2)875 qsurf_val(1)=0. !! not coupled with lifting for the moment [non remobilise]876 CASE(3)877 qsurf_val(1)=q_prof(1,1) !!! temporaire, a definir878 qsurf_val(2)=q_prof(1,2)879 CASE(11)880 qsurf_val(2)=M_H2OICE(i,j) !! logique avec noms(2) = 'h2o_ice' defini ci-dessus881 qsurf_val(3)=0. !! not coupled with lifting for the moment [non remobilise]882 CASE(12)883 qsurf_val(2)=M_H2OICE(i,j) !! logique avec noms(2) = 'h2o_ice' defini ci-dessus884 qsurf_val(3)=0. !! not coupled with lifting for the moment [non remobilise]885 END SELECT886 qsurf(subs,:) = qsurf_val(:)887 888 !! **************889 !! use comsoil_h890 !! **************891 !---------------------------------!892 ! Ground albedo & Thermal Inertia !893 !---------------------------------!894 IF (JULYR .ne. 9999) THEN895 IF (CST_TI == 0) THEN896 inertiedat_val=M_TI(i,j)897 ELSE898 inertiedat_val=CST_TI899 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** SET CONSTANT THERMAL INERTIA ', inertiedat_val900 ENDIF901 ELSE902 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION inertia: ',CST_TI903 inertiedat_val=CST_TI904 ENDIF905 !inertiedat(subs) = inertiedat_val906 !--pb de dimensions???!!???907 IF (JULYR .ne. 9999) THEN908 isoil_val(:)=M_ISOIL(i,:,j)909 dsoil_val(:)=M_DSOIL(i,:,j)910 ELSE911 IF ( nsoil .lt. 18 ) THEN912 PRINT *,'** Mars ** WRONG NUMBER OF SOIL LAYERS. SHOULD BE 18 AND IT IS ',nsoil913 STOP914 ENDIF915 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** IDEALIZED SIMULATION isoil and dsoil standard'916 do k=1,nsoil917 isoil_val(k) = inertiedat_val918 ! dsoil_val(k) = sqrt(887.75/3.14)*((2.**(k-0.5))-1.) * inertiedat_val / wvolcapa ! old setting919 dsoil_val(k) = 2.E-4 * (2.**(k-0.5-1.)) ! new gcm settings920 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** ISOIL DSOIL are ',isoil_val(k), dsoil_val(k)921 enddo922 ENDIF923 inertiedat(subs,:) = isoil_val(:)924 mlayer(0:nsoil-1)=dsoil_val(:)925 !!!!!!!!!!!!!!!!! DONE in soil_setting.F926 ! 1.5 Build layer(); following the same law as mlayer()927 ! Assuming layer distribution follows mid-layer law:928 ! layer(k)=lay1*alpha**(k-1)929 lay1=sqrt(mlayer(0)*mlayer(1))930 alpha=mlayer(1)/mlayer(0)931 do iii=1,nsoil932 layer(iii)=lay1*(alpha**(iii-1))933 enddo934 !------------------------!935 ! Deep soil temperatures !936 !------------------------!937 IF (M_TSOIL(i,1,j) .gt. 0. .and. JULYR .ne. 9999) THEN938 tsoil_val(:)=M_TSOIL(i,:,j)939 ELSE940 IF ( (i == ips) .AND. (j == jps) ) PRINT *,'** Mars ** no tsoil. set it to tsurf.'941 do k=1,nsoil942 tsoil_val(k) = M_TSURF(i,j)943 enddo944 ENDIF945 tsoil(subs,:) = tsoil_val(:)946 947 !! **************948 !! use turb_mod949 !! **************950 IF (.not. restart) THEN951 q2_val(:) = 1.E-6 !PBL wind variance952 wstar_val=0.953 ELSE954 q2_val(:)=M_Q2(i,:,j)955 wstar_val=M_WSTAR(i,j)956 ENDIF957 q2(subs,:) = q2_val(:)958 wstar(subs) = wstar_val959 960 !! ********************961 !! use dimradmars_mod962 !! ********************963 IF (.not. restart) THEN964 fluxrad_val=0.965 ELSE966 fluxrad_val=M_FLUXRAD(i,j)967 ENDIF968 fluxrad(subs) = fluxrad_val969 !! et fluxrad_sky ???!???970 971 ENDDO972 ENDDO973 974 !!---------------------!!975 !! OUTPUT FOR CHECKING !!976 !!---------------------!!977 print*,"check: theta_sl",theta_sl(1),theta_sl(ngrid)978 print*,"check: psi_sl",psi_sl(1),psi_sl(ngrid)979 print*,"check: phisfi",phisfi(1),phisfi(ngrid)980 print*,"check: albedodat",albedodat(1),albedodat(ngrid)981 print*,"check: zmea",zmea(1),zmea(ngrid)982 print*,"check: zstd",zstd(1),zstd(ngrid)983 print*,"check: zsig",zsig(1),zsig(ngrid)984 print*,"check: zgam",zgam(1),zgam(ngrid)985 print*,"check: zthe",zthe(1),zthe(ngrid)986 print*,"check: z0",z0(1),z0(ngrid)987 print*,"check: tsurf",tsurf(1),tsurf(ngrid)988 print*,"check: emis",emis(1),emis(ngrid)989 print*,"check: co2ice",co2ice(1),co2ice(ngrid)990 print*,"check: qsurf",qsurf(1,:),qsurf(ngrid,:)991 print*,"check: inertiedat",inertiedat(1,:),inertiedat(ngrid,:)992 print*,"check: mlayer",mlayer(:)993 print*,"check: layer",layer(:)994 print*,"check: q2",q2(1,:),q2(ngrid,:)995 print*,"check: wstar",wstar(1),wstar(ngrid)996 print*,"check: fluxrad",fluxrad(1),fluxrad(ngrid)997 print*,"check: tsoil",tsoil(1,:),tsoil(ngrid,:)998 print*,"check: noms",noms999 1000 ENDIF pass_interface1001 556 1002 557 !!*****************!! 1003 558 !! CLEAN THE PLACE !! 1004 559 !!*****************!! 1005 DEALLOCATE(q2_val)1006 DEALLOCATE(qsurf_val)1007 DEALLOCATE(tsoil_val)1008 DEALLOCATE(isoil_val)1009 DEALLOCATE(dsoil_val)1010 560 DEALLOCATE(dz8w_prof) 1011 561 DEALLOCATE(z_prof) … … 1018 568 DEALLOCATE(q_prof) 1019 569 570 571 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 572 !!! ONE DOMAIN CASE 573 !!! --> we simply need to initialize static and physics inputs 574 !!! SEVERAL DOMAINS 575 !!! --> we update static and physics inputs each time 576 !!! to account for domain change 577 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 578 pass_interface: IF ( (firstcall .EQV. .true.) .or. (max_dom .GT. 1) ) THEN 579 PRINT *,'** Mars ** PASS INTERFACE. EITHER FIRSTCALL or NESTED SIMULATION.' 580 !!*******************************************!! 581 !!*******************************************!! 582 CALL update_inputs_physiq_geom( & 583 ims,ime,jms,jme,& 584 ips,ipe,jps,jpe,& 585 JULYR,ngrid,& 586 DX,DY,MSFT,& 587 lat_input, lon_input,& 588 XLAT,XLONG) 589 !!! 590 CALL update_inputs_physiq_slope( & 591 ims,ime,jms,jme,& 592 ips,ipe,jps,jpe,& 593 JULYR,& 594 SLPX,SLPY) 595 !!! 596 CALL update_inputs_physiq_soil( & 597 ims,ime,jms,jme,& 598 ips,ipe,jps,jpe,& 599 JULYR,nsoil,& 600 M_TI,CST_TI,& 601 M_ISOIL,M_DSOIL,& 602 M_TSOIL,M_TSURF) 603 !!! 604 CALL update_inputs_physiq_surf( & 605 ims,ime,jms,jme,& 606 ips,ipe,jps,jpe,& 607 JULYR,MARS_MODE,& 608 M_ALBEDO,CST_AL,& 609 M_TSURF,M_EMISS,M_CO2ICE,& 610 M_GW,M_Z0,& 611 M_H2OICE,& 612 phisfi_val) 613 !!! 614 CALL update_inputs_physiq_turb( & 615 ims,ime,jms,jme,kms,kme,& 616 ips,ipe,jps,jpe,& 617 RESTART,isles,& 618 M_Q2,M_WSTAR) 619 !!! 620 CALL update_inputs_physiq_rad( & 621 ims,ime,jms,jme,& 622 ips,ipe,jps,jpe,& 623 RESTART,& 624 M_FLUXRAD) 625 !!! 626 ENDIF pass_interface 627 !!*******************************************!! 628 !!*******************************************!! 629 1020 630 !!!!!!!!!!!!!!!!!!!!!! 1021 631 !!!!!!!!!!!!!!!!!!!!!! … … 1025 635 1026 636 call_physics : IF (wappel_phys .ne. 0.) THEN 1027 1028 !-------------------------------------------------------------------------------! 1029 ! outputs: ! 1030 ! pdu(ngrid,nlayermx) \ ! 1031 ! pdv(ngrid,nlayermx) \ Temporal derivative of the corresponding ! 1032 ! pdt(ngrid,nlayermx) / variables due to physical processes. ! 1033 ! pdq(ngrid,nlayermx) / ! 1034 ! pdpsrf(ngrid) / ! 1035 ! tracerdyn call tracer in dynamical part of GCM ? ! 1036 !-------------------------------------------------------------------------------! 637 !!! initialize tendencies (security) 1037 638 pdpsrf(:)=0. 1038 639 pdu(:,:)=0. … … 1042 643 #ifndef NOPHYS 1043 644 print *, '** Mars ** CALL TO LMD PHYSICS' 645 !!! 646 CALL update_inputs_physiq_time(& 647 JULYR,JULDAY,GMT,& 648 elaps,& 649 lct_input,lon_input,ls_input,& 650 ptime,pday,MY) 651 !!! 1044 652 CALL physiq (ngrid,nlayer,nq, & 1045 653 firstcall,lastcall,pday,ptime,ptimestep, & … … 1083 691 1084 692 !! OUTPUT OUTPUT OUTPUT 693 !-------------------------------------------------------! 694 ! Save key variables for restart and output and nesting ! 695 !-------------------------------------------------------! 696 !!! 697 CALL update_outputs_physiq_surf( & 698 ims,ime,jms,jme,& 699 ips,ipe,jps,jpe,& 700 MARS_MODE,& 701 M_TSURF,M_CO2ICE,& 702 M_H2OICE) 703 !!! 704 CALL update_outputs_physiq_soil( & 705 ims,ime,jms,jme,& 706 ips,ipe,jps,jpe,& 707 nsoil,& 708 M_TSOIL) 709 !!! 710 CALL update_outputs_physiq_rad( & 711 ims,ime,jms,jme,& 712 ips,ipe,jps,jpe,& 713 M_FLUXRAD) 714 !!! 715 CALL update_outputs_physiq_turb( & 716 ims,ime,jms,jme,kms,kme,& 717 ips,ipe,jps,jpe,& 718 M_Q2,M_WSTAR,& 719 HFMAX,ZMAX,USTM,HFX) 720 1085 721 DO j = jps,jpe 1086 722 DO i = ips,ipe 1087 723 1088 724 subs = (j-jps)*(ipe-ips+1)+(i-ips+1) 1089 1090 !-------------------------------------------------------!1091 ! Save key variables for restart and output and nesting !1092 !-------------------------------------------------------!1093 M_TSOIL(i,:,j) = tsoil(subs,:)1094 M_CO2ICE(i,j) = co2ice(subs)1095 M_Q2(i,kps:kpe+1,j) = q2(subs,:)1096 M_TSURF(i,j) = tsurf(subs)1097 M_WSTAR(i,j) = wstar(subs)1098 M_FLUXRAD(i,j) = fluxrad(subs)1099 SELECT CASE (MARS_MODE)1100 CASE (1,11,12)1101 M_H2OICE(i,j) = qsurf(subs,2) !! see above Tracer at surface1102 END SELECT1103 1104 !! output only (arrays already in phys modules)1105 HFMAX(i,j) = HFMAX_TH(subs)1106 ZMAX(i,j) = ZMAX_TH(subs)1107 USTM(i,j) = ustar(subs)1108 HFX(i,j) = sensibFlux(subs)1109 725 1110 726 !! output only (cf comm_wrf) … … 1200 816 END SUBROUTINE lmd_driver 1201 817 1202 !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc1203 real function ls2sol(ls)1204 1205 !c Returns solar longitude, Ls (in deg.), from day number (in sol),1206 !c where sol=0=Ls=0 at the northern hemisphere spring equinox1207 1208 implicit none1209 1210 !c Arguments:1211 real ls1212 1213 !c Local:1214 double precision xref,zx0,zteta,zz1215 !c xref: mean anomaly, zteta: true anomaly, zx0: eccentric anomaly1216 double precision year_day1217 double precision peri_day,timeperi,e_elips1218 double precision pi,degrad1219 parameter (year_day=668.6d0) ! number of sols in a amartian year1220 !c data peri_day /485.0/1221 parameter (peri_day=485.35d0) ! date (in sols) of perihelion1222 !c timeperi: 2*pi*( 1 - Ls(perihelion)/ 360 ); Ls(perihelion)=250.991223 parameter (timeperi=1.90258341759902d0)1224 parameter (e_elips=0.0934d0) ! eccentricity of orbit1225 parameter (pi=3.14159265358979d0)1226 parameter (degrad=57.2957795130823d0)1227 1228 if (abs(ls).lt.1.0e-5) then1229 if (ls.ge.0.0) then1230 ls2sol = 0.01231 else1232 ls2sol = year_day1233 end if1234 return1235 end if1236 1237 zteta = ls/degrad + timeperi1238 zx0 = 2.0*datan(dtan(0.5*zteta)/dsqrt((1.+e_elips)/(1.-e_elips)))1239 xref = zx0-e_elips*dsin(zx0)1240 zz = xref/(2.*pi)1241 ls2sol = zz*year_day + peri_day1242 if (ls2sol.lt.0.0) ls2sol = ls2sol + year_day1243 if (ls2sol.ge.year_day) ls2sol = ls2sol - year_day1244 1245 return1246 end function ls2sol1247 !!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc1248 1249 818 END MODULE module_lmd_driver
Note: See TracChangeset
for help on using the changeset viewer.