Changeset 2924 for trunk/LMDZ.MARS
- Timestamp:
- Mar 30, 2023, 10:37:08 AM (20 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/README
r2922 r2924 3964 3964 Add illustrative execution job for spirit (aka MESOIPSL cluster) in deftank 3965 3965 3966 ==30/03/2023 == RV 3967 Add the possibility to start the 1d model from a startfi (option startfile_1D in run.def false by default). 3968 It will then write a restartfi at the end of the run. 3969 + Correction of r2919 for flux geo in 1D and initialize it to 0 by default. 3970 + Minor correction of iostart error message. 3971 -
trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F
r2919 r2924 6 6 use mod_grid_phy_lmdz, only : regular_lonlat 7 7 use infotrac, only: nqtot, tname, nqperes,nqfils 8 use comsoil_h, only: volcapa, layer, mlayer, inertiedat, nsoilmx,flux_geo 8 use comsoil_h, only: volcapa, layer, mlayer, inertiedat, nsoilmx, 9 & flux_geo 9 10 use comgeomfi_h, only: sinlat, ini_fillgeom 10 11 use surfdat_h, only: albedodat, z0_default, emissiv, emisice, … … 13 14 & watercaptag, watercap, hmons, summit, base 14 15 use slope_mod, only: theta_sl, psi_sl 15 use comslope_mod, only: def_slope,subslope_dist 16 use comslope_mod, only: def_slope,subslope_dist,def_slope_mean 16 17 use phyredem, only: physdem0,physdem1 17 18 use geometry_mod, only: init_geometry … … 36 37 USE read_profile_mod, ONLY: read_profile 37 38 use inichim_newstart_mod, only: inichim_newstart 39 use phyetat0_mod, only: phyetat0 40 USE netcdf, only: NF90_OPEN, NF90_NOERR, NF90_NOWRITE, 41 & nf90_strerror 42 use iostart, only: open_startphy,get_var, close_startphy 38 43 IMPLICIT NONE 39 44 … … 146 151 c LL: Subsurface geothermal flux 147 152 real :: flux_geo_tmp 153 154 c RV: Start from a startfi and not run.def 155 logical :: startfile_1D 156 REAL tab_cntrl(100) 157 LOGICAL :: found 158 REAL albedo_read(1,2,1) ! surface albedo 148 159 c======================================================================= 149 160 … … 156 167 ! call initcomgeomphy 157 168 169 170 c ------------------------------------------------------ 171 c Loading run parameters from "run.def" file 172 c ------------------------------------------------------ 173 174 175 ! check if 'run.def' file is around (otherwise reading parameters 176 ! from callphys.def via getin() routine won't work. 177 open(99,file='run.def',status='old',form='formatted', 178 & iostat=ierr) 179 if (ierr.ne.0) then 180 write(*,*) 'Cannot find required file "run.def"' 181 write(*,*) ' (which should contain some input parameters' 182 write(*,*) ' along with the following line:' 183 write(*,*) ' INCLUDEDEF=callphys.def' 184 write(*,*) ' )' 185 write(*,*) ' ... might as well stop here ...' 186 stop 187 else 188 close(99) 189 endif 190 191 write(*,*)'Do you want to start with a startfi and write 192 & a restartfi?' 193 startfile_1D=.false. 194 call getin("startfile_1D",startfile_1D) 195 write(*,*)" startfile_1D = ", startfile_1D 196 158 197 c ------------------------------------------------------ 159 198 c Prescribed constants to be set here 160 199 c ------------------------------------------------------ 200 201 c if(.not. startfile_1D ) then 161 202 162 203 pi=2.E+0*asin(1.E+0) … … 196 237 iceradius(2) = 100.e-6 ! mean scat radius of CO2 snow (south) 197 238 dtemisice(1) = 2. ! time scale for snow metamorphism (north) 198 dtemisice(2) = 2. ! time scale for snow metamorphism (south 239 dtemisice(2) = 2. ! time scale for snow metamorphism (south) 240 241 c endif ! .not. startfile_1D 199 242 200 243 c mesh surface (not a very usefull quantity in 1D) 201 244 c ---------------------------------------------------- 202 245 cell_area(1)=1.E+0 203 204 c ------------------------------------------------------205 c Loading run parameters from "run.def" file206 c ------------------------------------------------------207 208 209 ! check if 'run.def' file is around (otherwise reading parameters210 ! from callphys.def via getin() routine won't work.211 open(99,file='run.def',status='old',form='formatted',212 & iostat=ierr)213 if (ierr.ne.0) then214 write(*,*) 'Cannot find required file "run.def"'215 write(*,*) ' (which should contain some input parameters'216 write(*,*) ' along with the following line:'217 write(*,*) ' INCLUDEDEF=callphys.def'218 write(*,*) ' )'219 write(*,*) ' ... might as well stop here ...'220 stop221 else222 close(99)223 endif224 246 225 247 … … 320 342 call read_profile(nq, nlayer, qsurf, q) 321 343 344 call init_physics_distribution(regular_lonlat,4, 345 & 1,1,1,nlayer,1) 346 347 if(.not. startfile_1D ) then 348 322 349 c Date and local time at beginning of run 323 350 c --------------------------------------- … … 335 362 time=time/24.E+0 ! convert time (hours) to fraction of sol 336 363 364 else 365 call open_startphy("startfi.nc") 366 call get_var("controle",tab_cntrl,found) 367 if (.not.found) then 368 call abort_physic("open_startphy", 369 & "tabfi: Failed reading <controle> array",1) 370 else 371 write(*,*)'tabfi: tab_cntrl',tab_cntrl 372 endif 373 day0 = tab_cntrl(3) 374 day=float(day0) 375 376 call get_var("Time",time,found) 377 378 call close_startphy 379 380 endif !startfile_1D 381 337 382 c Discretization (Definition of grid and time steps) 338 383 c -------------- … … 360 405 c ------------------------------------ 361 406 c 407 362 408 psurf=610. ! default value for psurf 363 409 PRINT *,'Surface pressure (Pa) ?' 364 410 call getin("psurf",psurf) 365 411 write(*,*) " psurf = ",psurf 412 366 413 c Reference pressures 367 414 pa=20. ! transition pressure (for hybrid coord.) … … 377 424 c Orbital parameters 378 425 c ------------------ 426 427 if(.not. startfile_1D ) then 428 379 429 paleomars=.false. ! Default: no water ice reservoir 380 430 call getin("paleomars",paleomars) … … 417 467 write(*,*) " obliquit = ",obliquit 418 468 end if 469 470 endif !(.not. startfile_1D ) 419 471 420 472 c latitude/longitude … … 433 485 !Mars possible matter with dtphys in input and include!!! 434 486 ! Initializations below should mimick what is done in iniphysiq for 3D GCM 435 call init_physics_distribution(regular_lonlat,4,436 & 1,1,1,nlayer,1)437 487 call init_interface_dyn_phys 438 488 call init_regular_lonlat(1,1,longitude,latitude, … … 463 513 c ---------------------------------------- 464 514 c 515 516 if(.not. startfile_1D ) then 517 465 518 albedodat(1)=0.2 ! default value for albedodat 466 519 PRINT *,'Albedo of bare ground ?' … … 478 531 call getin("z0",z0(1)) 479 532 write(*,*) " z0 = ",z0(1) 533 534 endif !(.not. startfile_1D ) 480 535 481 536 ! Initialize local slope parameters (only matters if "callslope" … … 564 619 stop 565 620 endif 621 622 if(.not. startfile_1D ) then 566 623 qsurf(igcm_co2)=0.E+0 ! default value for co2ice 567 624 PRINT *,'Initial CO2 ice on the surface (kg.m-2)' 568 625 call getin("co2ice",qsurf(igcm_co2)) 569 626 write(*,*) " co2ice = ",qsurf(igcm_co2) 627 endif !(.not. startfile_1D ) 570 628 571 629 c 572 630 c emissivity 573 631 c ---------- 632 if(.not. startfile_1D ) then 574 633 emis=emissiv 575 634 IF (qsurf(igcm_co2).eq.1.E+0) THEN … … 577 636 IF(latitude(1).LT.0) emis=emisice(2) ! southern hemisphere 578 637 ENDIF 579 638 endif !(.not. startfile_1D ) 580 639 581 640 … … 632 691 ! ------------------------------------------ 633 692 volcapa=1.e6 ! volumetric heat capacity 693 if(.not. startfile_1D ) then 634 694 DO isoil=1,nsoil 635 695 inertiedat(1,isoil)=inertiedat(1,1) ! soil thermal inertia 636 696 tsoil(isoil)=tsurf(1) ! soil temperature 637 697 ENDDO 638 698 endif !(.not. startfile_1D ) 699 700 flux_geo_tmp=0. 639 701 call getin("flux_geo",flux_geo_tmp) 640 702 flux_geo(:,:) = flux_geo_tmp 641 703 642 643 644 645 flux_geo646 704 ! Initialize depths 647 705 ! ----------------- … … 681 739 c Check if the surface is a water ice reservoir 682 740 c -------------------------------------------------- 741 if(.not. startfile_1D ) then 683 742 watercap(1,:)=0 ! Initialize watercap 743 endif !(.not. startfile_1D ) 684 744 watercaptag(1)=.false. ! Default: no water ice reservoir 685 745 print *,'Water ice cap on ground ?' … … 723 783 c It is needed to transfert physics variables to "physiq"... 724 784 725 call physdem0("startfi.nc",longitude,latitude,nsoilmx,ngrid,llm, 726 & nq,dtphys,float(day0),0.,cell_area, 785 if(.not. startfile_1D ) then 786 787 call physdem0("startfi.nc",longitude,latitude,nsoilmx,ngrid, 788 & llm,nq,dtphys,float(day0),0.,cell_area, 727 789 & albedodat,inertiedat,def_slope,subslope_dist) 728 790 call physdem1("startfi.nc",nsoilmx,ngrid,llm,nq, … … 730 792 & tsurf,tsoil,albedo,emis,q2,qsurf,tauscaling, 731 793 & totcloudfrac,wstar,watercap) 794 else 795 CALL phyetat0 ("startfi.nc",0,0, 796 & nsoilmx,ngrid,nlayer,nq, 797 & day0,time, 798 & tsurf,tsoil,albedo_read,emis, 799 & q2,qsurf,tauscaling,totcloudfrac,wstar, 800 & watercap,def_slope,def_slope_mean,subslope_dist) 801 day=real(day0) 802 albedo(1,1)=albedo_read(1,1,1) 803 endif !(.not. startfile_1D ) 732 804 733 805 c======================================================================= … … 737 809 firstcall=.true. 738 810 lastcall=.false. 739 740 811 DO idt=1,ndt 741 cIF (idt.eq.ndt) lastcall=.true.742 IF (idt.eq.ndt-day_step-1) then !test743 lastcall=.true.744 call solarlong(day*1.0,zls)745 write(103,*) 'Ls=',zls*180./pi746 write(103,*) 'Lat=', latitude(1)*180./pi747 write(103,*) 'Tau=', tauvis/odpref*psurf748 write(103,*) 'RunEnd - Atmos. Temp. File'749 write(103,*) 'RunEnd - Atmos. Temp. File'750 write(104,*) 'Ls=',zls*180./pi751 write(104,*) 'Lat=', latitude(1)752 write(104,*) 'Tau=', tauvis/odpref*psurf753 write(104,*) 'RunEnd - Atmos. Temp. File'754 ENDIF812 IF (idt.eq.ndt) lastcall=.true. 813 c IF (idt.eq.ndt-day_step-1) then !test 814 c lastcall=.true. 815 c call solarlong(day*1.0,zls) 816 c write(103,*) 'Ls=',zls*180./pi 817 c write(103,*) 'Lat=', latitude(1)*180./pi 818 c write(103,*) 'Tau=', tauvis/odpref*psurf 819 c write(103,*) 'RunEnd - Atmos. Temp. File' 820 c write(103,*) 'RunEnd - Atmos. Temp. File' 821 c write(104,*) 'Ls=',zls*180./pi 822 c write(104,*) 'Lat=', latitude(1) 823 c write(104,*) 'Tau=', tauvis/odpref*psurf 824 c write(104,*) 'RunEnd - Atmos. Temp. File' 825 c ENDIF 755 826 756 827 c compute geopotential … … 879 950 CALL endg1d(1,nlayer,zlay/1000.,ndt) 880 951 952 c if(startfile_1D) then 953 c call physdem0("restartfi.nc",longitude,latitude,nsoilmx,ngrid, 954 c & llm,nq,dtphys,float(day0),0.,cell_area, 955 c & albedodat,inertiedat,def_slope,subslope_dist) 956 c call physdem1("restartfi.nc",nsoilmx,ngrid,llm,nq, 957 c & dtphys,time, 958 c & tsurf,tsoil,albedo,emis,q2,qsurf,tauscaling, 959 c & totcloudfrac,wstar,watercap) 960 c endif! startfile_1D 961 881 962 write(*,*) "testphys1d: Everything is cool." 882 963 -
trunk/LMDZ.MARS/libf/phymars/iostart.F90
r2913 r2924 424 424 425 425 ierr=NF90_INQ_VARID(nid_start,var_name,varid) 426 427 426 IF (ierr==NF90_NOERR) THEN 428 427 ierr=NF90_GET_VAR(nid_start,varid,var) … … 1049 1048 ierr=NF90_DEF_VAR(nid_restart,var_name,NF90_FLOAT,(/idim1d/),nvarid) 1050 1049 #endif 1050 1051 1051 ! Add a "title" attribute 1052 1052 IF (LEN_TRIM(title)>0) ierr=NF90_PUT_ATT(nid_restart,nvarid,"title",title) … … 1058 1058 write(*,*)'put_var_rgen: problem writing '//trim(var_name) 1059 1059 write(*,*)trim(nf90_strerror(ierr)) 1060 CALL abort_physic(" get_var_rgen","Failed writing variable",1)1060 CALL abort_physic("put_var_rgen","Failed writing variable",1) 1061 1061 ENDIF 1062 1062 ENDIF ! of IF (is_master) -
trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
r2916 r2924 109 109 & major_slope,compute_meshgridavg, 110 110 & ini_comslope_h 111 111 USE ioipsl_getincom, only: getin 112 112 IMPLICIT NONE 113 113 c======================================================================= … … 545 545 546 546 logical :: write_restart 547 logical,save :: startfile_1D 547 548 548 549 c======================================================================= … … 748 749 749 750 #ifndef MESOSCALE 750 751 if (ngrid.ne.1) then 751 startfile_1D=.false. 752 call getin("startfile_1D",startfile_1D) 753 if (ngrid.ne.1 .or. startfile_1D) then 752 754 ! no need to compute slopes when in 1D; it is an input 753 755 if (callslope) call getslopes(ngrid,phisfi) … … 2549 2551 c ---------------------------------------------------------- 2550 2552 2551 IF (ngrid.NE.1) THEN2553 IF (startfile_1D) THEN 2552 2554 2553 2555 #ifndef MESOSCALE … … 2610 2612 . emis,q2,qsurf,tauscaling,totcloudfrac,wstar, 2611 2613 . watercap) 2612 2613 ENDIF ! of IF (write_restart) 2614 ENDIF ! of IF (write_restart) 2615 2614 2616 #endif 2617 2618 ENDIF ! startfile_1D 2619 2620 IF (ngrid.NE.1) then 2615 2621 2616 2622 c -------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.