Changeset 4358
- Timestamp:
- Nov 30, 2022, 4:37:30 PM (19 months ago)
- Location:
- LMDZ6/trunk/libf
- Files:
-
- 12 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d/conf_gcm.F90
r4100 r4358 599 599 type_trac = 'lmdz' 600 600 CALL getin('type_trac',type_trac) 601 602 !Config Key = config_inca603 !Config Desc = Choix de configuration de INCA604 !Config Def = none605 !Config Help = Choix de configuration de INCA :606 !Config 'none' = sans INCA607 !Config 'chem' = INCA avec calcul de chemie608 !Config 'aero' = INCA avec calcul des aerosols609 config_inca = 'none'610 CALL getin('config_inca',config_inca)611 601 612 602 !Config Key = ok_dynzon … … 672 662 write(lunout,*)' offline = ', offline 673 663 write(lunout,*)' type_trac = ', type_trac 674 write(lunout,*)' config_inca = ', config_inca675 664 write(lunout,*)' ok_dynzon = ', ok_dynzon 676 665 write(lunout,*)' ok_dyn_ins = ', ok_dyn_ins … … 795 784 type_trac = 'lmdz' 796 785 CALL getin('type_trac',type_trac) 797 798 !Config Key = config_inca799 !Config Desc = Choix de configuration de INCA800 !Config Def = none801 !Config Help = Choix de configuration de INCA :802 !Config 'none' = sans INCA803 !Config 'chem' = INCA avec calcul de chemie804 !Config 'aero' = INCA avec calcul des aerosols805 config_inca = 'none'806 CALL getin('config_inca',config_inca)807 786 808 787 !Config Key = ok_dynzon … … 912 891 write(lunout,*)' offline = ', offline 913 892 write(lunout,*)' type_trac = ', type_trac 914 write(lunout,*)' config_inca = ', config_inca915 893 write(lunout,*)' ok_dynzon = ', ok_dynzon 916 894 write(lunout,*)' ok_dyn_ins = ', ok_dyn_ins -
LMDZ6/trunk/libf/dyn3d_common/control_mod.F90
r4146 r4358 29 29 INTEGER,SAVE :: ip_ebil_dyn 30 30 LOGICAL,SAVE :: offline 31 CHARACTER(len=4),SAVE :: config_inca32 31 CHARACTER(len=10),SAVE :: planet_type ! planet type ('earth','mars',...) 33 32 LOGICAL,SAVE :: output_grads_dyn ! output dynamics diagnostics in -
LMDZ6/trunk/libf/dyn3d_common/infotrac.F90
r4325 r4358 67 67 ! | phase | Phases list ("g"as / "l"iquid / "s"olid) | / | [g][l][s] | 68 68 ! | component | Name(s) of the merged/cumulated section(s) | / | coma-separated names | 69 ! | iadv | Advection scheme number | iadv | 1-20,30 exc. 3-9,15,19 |70 69 ! | iGeneration | Generation (>=1) | / | | 71 ! | isAdvected | advected tracers flag (.TRUE. if iadv >= 0) | / | nqtrue .TRUE. values |72 ! | isInPhysics | tracers not extracted from the main table in physics | / | nqtottr .TRUE. values |73 70 ! | iqParent | Index of the parent tracer | iqpere | 1:nqtot | 74 71 ! | iqDescen | Indexes of the childs (all generations) | iqfils | 1:nqtot | 75 72 ! | nqDescen | Number of the descendants (all generations) | nqdesc | 1:nqtot | 76 73 ! | nqChildren | Number of childs (1st generation only) | nqfils | 1:nqtot | 74 ! | keys | key/val pairs accessible with "getKey" routine | / | | 75 ! | iadv | Advection scheme number | iadv | 1,2,10-20(exc.15,19),30| 76 ! | isAdvected | advected tracers flag (.TRUE. if iadv >= 0) | / | nqtrue .TRUE. values | 77 ! | isInPhysics | tracers not extracted from the main table in physics | / | nqtottr .TRUE. values | 77 78 ! | iso_iGroup | Isotopes group index in isotopes(:) | / | 1:nbIso | 78 79 ! | iso_iName | Isotope name index in isotopes(iso_iGroup)%trac(:) | iso_indnum | 1:niso | 79 80 ! | iso_iZone | Isotope zone index in isotopes(iso_iGroup)%zone(:) | zone_num | 1:nzone | 80 81 ! | iso_iPhas | Isotope phase index in isotopes(iso_iGroup)%phas(:) | phase_num | 1:nphas | 81 ! | keys | key/val pairs accessible with "getKey" routine | / | |82 82 ! +-------------+------------------------------------------------------+-------------+------------------------+ 83 83 ! … … 114 114 115 115 SUBROUTINE init_infotrac 116 USE control_mod, ONLY: planet_type , config_inca116 USE control_mod, ONLY: planet_type 117 117 #ifdef REPROBUS 118 118 USE CHEM_REP, ONLY: Init_chem_rep_trac … … 182 182 msg1 = 'For type_trac = "'//TRIM(types_trac(it))//'":' 183 183 SELECT CASE(types_trac(it)) 184 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model , config_inca='//config_inca,modname)184 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model', modname) 185 185 CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle', modname) 186 186 CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model', modname) … … 191 191 END SELECT 192 192 193 !--- COHERENCE TEST BETWEEN "type_trac" AND "config_inca"194 IF(ANY(['inca', 'inco'] == types_trac(it)) .AND. ALL(['aero', 'aeNP', 'chem'] /= config_inca)) &195 CALL abort_gcm(modname, 'Incoherence between type_trac and config_inca. Please modify "run.def"',1)196 197 193 !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS 198 194 SELECT CASE(types_trac(it)) … … 214 210 END DO 215 211 !--------------------------------------------------------------------------------------------------------------------------- 216 217 !--- DISABLE "config_inca" OPTION FOR A RUN WITHOUT "INCA" IF IT DIFFERS FROM "none"218 IF(fmsg('Setting config_inca="none" as you do not couple with INCA model', &219 modname, ALL(types_trac /= 'inca') .AND. ALL(types_trac /= 'inco') .AND. config_inca /= 'none')) config_inca = 'none'220 212 221 213 nqCO2 = COUNT( [ANY(types_trac == 'inco') .OR. (ANY(types_trac == 'co2i') .AND. ANY(types_trac == 'inca'))] ) -
LMDZ6/trunk/libf/dyn3dmem/conf_gcm.F90
r4146 r4358 644 644 type_trac = 'lmdz' 645 645 CALL getin('type_trac',type_trac) 646 647 !Config Key = config_inca648 !Config Desc = Choix de configuration de INCA649 !Config Def = none650 !Config Help = Choix de configuration de INCA :651 !Config 'none' = sans INCA652 !Config 'chem' = INCA avec calcul de chemie653 !Config 'aero' = INCA avec calcul des aerosols654 config_inca = 'none'655 CALL getin('config_inca',config_inca)656 646 657 647 !Config Key = ok_dynzon … … 725 715 write(lunout,*)' offline = ', offline 726 716 write(lunout,*)' type_trac = ', type_trac 727 write(lunout,*)' config_inca = ', config_inca728 717 write(lunout,*)' ok_dynzon = ', ok_dynzon 729 718 write(lunout,*)' ok_dyn_ins = ', ok_dyn_ins … … 855 844 type_trac = 'lmdz' 856 845 CALL getin('type_trac',type_trac) 857 858 !Config Key = config_inca859 !Config Desc = Choix de configuration de INCA860 !Config Def = none861 !Config Help = Choix de configuration de INCA :862 !Config 'none' = sans INCA863 !Config 'chem' = INCA avec calcul de chemie864 !Config 'aero' = INCA avec calcul des aerosols865 config_inca = 'none'866 CALL getin('config_inca',config_inca)867 846 868 847 !Config Key = ok_dynzon … … 1006 985 write(lunout,*)' offline = ', offline 1007 986 write(lunout,*)' type_trac = ', type_trac 1008 write(lunout,*)' config_inca = ', config_inca1009 987 write(lunout,*)' ok_dynzon = ', ok_dynzon 1010 988 write(lunout,*)' ok_dyn_ins = ', ok_dyn_ins -
LMDZ6/trunk/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90
r4325 r4358 30 30 USE mod_phys_lmdz_omp_data, ONLY: klon_omp 31 31 #endif 32 USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq , config_inca32 USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq 33 33 USE inifis_mod, ONLY: inifis 34 34 USE time_phylmdz_mod, ONLY: init_time -
LMDZ6/trunk/libf/misc/readTracFiles_mod.f90
r4348 r4358 54 54 CHARACTER(LEN=maxlen) :: phase = 'g' !--- Phase ('g'as / 'l'iquid / 's'olid) 55 55 CHARACTER(LEN=maxlen) :: component = '' !--- Coma-separated list of components (Ex: lmdz,inca) 56 INTEGER :: iadv = 10 !--- Advection scheme used57 56 INTEGER :: iGeneration = -1 !--- Generation number (>=0) 58 LOGICAL :: isAdvected = .FALSE. !--- "true" tracers: iadv > 0. COUNT(isAdvected )=nqtrue59 LOGICAL :: isInPhysics = .TRUE. !--- "true" tracers: in tr_seri. COUNT(isInPhysics)=nqtottr60 57 INTEGER :: iqParent = 0 !--- Parent index 61 58 INTEGER, ALLOCATABLE :: iqDescen(:) !--- Descendants index (in growing generation order) 62 59 INTEGER :: nqDescen = 0 !--- Number of descendants (all generations) 63 60 INTEGER :: nqChildren = 0 !--- Number of children (first generation) 61 TYPE(keys_type) :: keys !--- <key>=<val> pairs vector 62 INTEGER :: iadv = 10 !--- Advection scheme used 63 LOGICAL :: isAdvected = .FALSE. !--- "true" tracers: iadv > 0. COUNT(isAdvected )=nqtrue 64 LOGICAL :: isInPhysics = .TRUE. !--- "true" tracers: in tr_seri. COUNT(isInPhysics)=nqtottr 64 65 INTEGER :: iso_iGroup = 0 !--- Isotopes group index in isotopes(:) 65 66 INTEGER :: iso_iName = 0 !--- Isotope name index in isotopes(iso_iGroup)%trac(:) 66 67 INTEGER :: iso_iZone = 0 !--- Isotope zone index in isotopes(iso_iGroup)%zone(:) 67 68 INTEGER :: iso_iPhase = 0 !--- Isotope phase index in isotopes(iso_iGroup)%phase 68 TYPE(keys_type) :: keys !--- <key>=<val> pairs vector69 69 END TYPE trac_type 70 70 !------------------------------------------------------------------------------------------------------------------------------ … … 1895 1895 ip = getiPhase(newName) !--- Phase index 1896 1896 IF(ip /= 0 .AND. PRESENT(iPhase)) iPhase = ip !--- Returning phase index 1897 ix = strIdx(newH2OIso, newName) !--- Index in the known H2O isotopes list 1898 IF(ix /= 0) oldName = 'H2O'//'_'//TRIM(oldH2OIso(ix)) !=== WATER ISOTOPE WITHOUT PHASE 1897 ix = strIdx(newH2OIso, strHead(newName, '_')) !--- Index in the known H2O isotopes list 1898 IF(ix /= 0) THEN 1899 oldName = 'H2O'//'_'//TRIM(oldH2OIso(ix)) !=== WATER ISOTOPE WITHOUT PHASE 1900 IF(newH2OIso(ix)/=newName) oldName=TRIM(oldName)//'_'//strTail(newName,'_')!=== WATER ISOTOPIC TAGGING TRACER WITHOUT PHASE 1901 END IF 1899 1902 IF(ix /= 0 .OR. ip == 0) RETURN 1900 1903 oldName = 'H2O'//old_phases(ip:ip) -
LMDZ6/trunk/libf/misc/strings_mod.F90
r4349 r4358 505 505 !=== Count the number of elements separated by "delimiter" in list "rawList". ================================================= 506 506 !============================================================================================================================== 507 LOGICAL FUNCTION strCount_11(rawList, delimiter, nb, lSc) RESULT( out)507 LOGICAL FUNCTION strCount_11(rawList, delimiter, nb, lSc) RESULT(lerr) 508 508 CHARACTER(LEN=*), INTENT(IN) :: rawList 509 509 CHARACTER(LEN=*), INTENT(IN) :: delimiter … … 513 513 LOGICAL :: ll 514 514 ll = .FALSE.; IF(PRESENT(lSc)) ll = lSc 515 out= strCount_1m(rawList, [delimiter], nb, ll)515 lerr = strCount_1m(rawList, [delimiter], nb, ll) 516 516 END FUNCTION strCount_11 517 517 !============================================================================================================================== 518 LOGICAL FUNCTION strCount_m1(rawList, delimiter, nb, lSc) RESULT( out)518 LOGICAL FUNCTION strCount_m1(rawList, delimiter, nb, lSc) RESULT(lerr) 519 519 CHARACTER(LEN=*), INTENT(IN) :: rawList(:) 520 520 CHARACTER(LEN=*), INTENT(IN) :: delimiter … … 525 525 INTEGER :: id 526 526 ll = .FALSE.; IF(PRESENT(lSc)) ll = lSc .AND. INDEX('+-', delimiter) /= 0 527 out= .TRUE.527 lerr = .TRUE. 528 528 ALLOCATE(nb(SIZE(rawList))) 529 529 DO id = 1, SIZE(rawList) 530 out = out.AND. strCount_1m(rawList(id), [delimiter], nb(id), ll)530 lerr = lerr .AND. strCount_1m(rawList(id), [delimiter], nb(id), ll) 531 531 END DO 532 532 END FUNCTION strCount_m1 -
LMDZ6/trunk/libf/phylmd/infotrac_phy.F90
r4328 r4358 76 76 ! | nqDescen | Number of the descendants (all generations) | nqdesc | 1:nqtot | 77 77 ! | nqChildren | Number of childs (1st generation only) | nqfils | 1:nqtot | 78 ! | keys | key/val pairs accessible with "getKey" routine | / | | 78 79 ! | iso_iGroup | Isotopes group index in isotopes(:) | / | 1:nbIso | 79 80 ! | iso_iName | Isotope name index in isotopes(iso_iGroup)%trac(:) | iso_indnum | 1:niso | 80 81 ! | iso_iZone | Isotope zone index in isotopes(iso_iGroup)%zone(:) | zone_num | 1:nzone | 81 82 ! | iso_iPhas | Isotope phase index in isotopes(iso_iGroup)%phas(:) | phase_num | 1:nphas | 82 ! | keys | key/val pairs accessible with "getKey" routine | / | |83 83 ! +-------------+------------------------------------------------------+-------------+------------------------+ 84 84 ! … … 123 123 124 124 SUBROUTINE init_infotrac_phy 125 USE control_mod, ONLY: planet_type, config_inca126 125 USE ioipsl_getin_p_mod, ONLY: getin_p 127 126 #ifdef REPROBUS 128 USE CHEM_REP, 127 USE CHEM_REP, ONLY: Init_chem_rep_trac 129 128 #endif 130 129 IMPLICIT NONE … … 200 199 msg1 = 'For type_trac = "'//TRIM(types_trac(it))//'":' 201 200 SELECT CASE(types_trac(it)) 202 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model , config_inca='//config_inca,modname)201 CASE('inca'); CALL msg(TRIM(msg1)//' coupling with INCA chemistry model', modname) 203 202 CASE('inco'); CALL msg(TRIM(msg1)//' coupling jointly with INCA and CO2 cycle', modname) 204 203 CASE('repr'); CALL msg(TRIM(msg1)//' coupling with REPROBUS chemistry model', modname) … … 209 208 END SELECT 210 209 211 !--- COHERENCE TEST BETWEEN "type_trac" AND "config_inca"212 IF(ANY(['inca', 'inco'] == types_trac(it)) .AND. ALL(['aero', 'aeNP', 'chem'] /= config_inca)) &213 CALL abort_gcm(modname, 'Incoherence between type_trac and config_inca. Please modify "run.def"',1)214 215 210 !--- COHERENCE TEST BETWEEN "type_trac" AND PREPROCESSING KEYS 216 211 SELECT CASE(types_trac(it)) … … 236 231 END IF 237 232 !############################################################################################################################## 238 239 !--- DISABLE "config_inca" OPTION FOR A RUN WITHOUT "INCA" IF IT DIFFERS FROM "none"240 IF(fmsg('Setting config_inca="none" as you do not couple with INCA model', &241 modname, ALL(types_trac /= 'inca') .AND. ALL(types_trac /= 'inco') .AND. config_inca /= 'none')) config_inca = 'none'242 233 243 234 nqCO2 = COUNT( [ANY(types_trac == 'inco') .OR. (ANY(types_trac == 'co2i') .AND. ANY(types_trac == 'inca'))] ) -
LMDZ6/trunk/libf/phylmd/phyetat0_mod.F90
r4357 r4358 1 1 ! $Id$ 2 3 MODULE phyetat0_mod 4 5 PRIVATE 6 PUBLIC :: phyetat0, phyetat0_get, phyetat0_srf 7 8 INTERFACE phyetat0_get 9 MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21 10 END INTERFACE phyetat0_get 11 INTERFACE phyetat0_srf 12 MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31 13 END INTERFACE phyetat0_srf 14 15 CONTAINS 2 16 3 17 SUBROUTINE phyetat0 (fichnom, clesphy0, tabcntr0) … … 24 38 USE iostart, ONLY: close_startphy, get_field, get_var, open_startphy 25 39 USE infotrac_phy, ONLY: nqtot, nbtr, type_trac, types_trac, tracers 40 USE readTracFiles_mod,ONLY: maxlen, new2oldH2O 26 41 USE traclmdz_mod, ONLY: traclmdz_from_restart 27 42 USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo … … 79 94 CHARACTER*7 str7 80 95 CHARACTER*2 str2 81 LOGICAL :: found ,phyetat0_get,phyetat0_srf96 LOGICAL :: found 82 97 REAL :: lon_startphy(klon), lat_startphy(klon) 98 CHARACTER(LEN=maxlen) :: tname, t(2) 83 99 84 100 ! FH1D … … 260 276 !=================================================================== 261 277 262 found=phyetat0_get( 1,ftsol(:,1),"TS","Surface temperature",283.)278 found=phyetat0_get(ftsol(:,1),"TS","Surface temperature",283.) 263 279 IF (found) THEN 264 280 DO nsrf=2,nbsrf … … 266 282 ENDDO 267 283 ELSE 268 found=phyetat0_srf( 1,ftsol,"TS","Surface temperature",283.)284 found=phyetat0_srf(ftsol,"TS","Surface temperature",283.) 269 285 ENDIF 270 286 … … 280 296 ENDIF 281 297 WRITE(str2, '(i2.2)') isw 282 found=phyetat0_srf( 1,falb_dir(:, isw,:),"A_dir_SW"//str2//"srf","Direct Albedo",0.2)283 found=phyetat0_srf( 1,falb_dif(:, isw,:),"A_dif_SW"//str2//"srf","Direct Albedo",0.2)298 found=phyetat0_srf(falb_dir(:, isw,:),"A_dir_SW"//str2//"srf","Direct Albedo",0.2) 299 found=phyetat0_srf(falb_dif(:, isw,:),"A_dif_SW"//str2//"srf","Direct Albedo",0.2) 284 300 ENDDO 285 301 ENDDO 286 302 287 found=phyetat0_srf( 1,u10m,"U10M","u a 10m",0.)288 found=phyetat0_srf( 1,v10m,"V10M","v a 10m",0.)303 found=phyetat0_srf(u10m,"U10M","u a 10m",0.) 304 found=phyetat0_srf(v10m,"V10M","v a 10m",0.) 289 305 290 306 !=================================================================== … … 298 314 ENDIF 299 315 WRITE(str2,'(i2.2)') isoil 300 found=phyetat0_srf( 1,tsoil(:, isoil,:),"Tsoil"//str2//"srf","Temp soil",0.)316 found=phyetat0_srf(tsoil(:, isoil,:),"Tsoil"//str2//"srf","Temp soil",0.) 301 317 IF (.NOT. found) THEN 302 318 PRINT*, "phyetat0: Le champ <Tsoil"//str7//"> est absent" … … 310 326 !======================================================================= 311 327 312 found=phyetat0_srf( 1,qsurf,"QS","Near surface hmidity",0.)313 found=phyetat0_get( 1,qsol,"QSOL","Surface hmidity / bucket",0.)314 found=phyetat0_srf( 1,snow,"SNOW","Surface snow",0.)315 found=phyetat0_srf( 1,fevap,"EVAP","evaporation",0.)316 found=phyetat0_get( 1,snow_fall,"snow_f","snow fall",0.)317 found=phyetat0_get( 1,rain_fall,"rain_f","rain fall",0.)328 found=phyetat0_srf(qsurf,"QS","Near surface hmidity",0.) 329 found=phyetat0_get(qsol,"QSOL","Surface hmidity / bucket",0.) 330 found=phyetat0_srf(snow,"SNOW","Surface snow",0.) 331 found=phyetat0_srf(fevap,"EVAP","evaporation",0.) 332 found=phyetat0_get(snow_fall,"snow_f","snow fall",0.) 333 found=phyetat0_get(rain_fall,"rain_f","rain fall",0.) 318 334 319 335 !======================================================================= … … 321 337 !======================================================================= 322 338 323 found=phyetat0_get( 1,solsw,"solsw","net SW radiation surf",0.)324 found=phyetat0_get( 1,solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.)325 found=phyetat0_get( 1,sollw,"sollw","net LW radiation surf",0.)326 found=phyetat0_get( 1,sollwdown,"sollwdown","down LW radiation surf",0.)339 found=phyetat0_get(solsw,"solsw","net SW radiation surf",0.) 340 found=phyetat0_get(solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.) 341 found=phyetat0_get(sollw,"sollw","net LW radiation surf",0.) 342 found=phyetat0_get(sollwdown,"sollwdown","down LW radiation surf",0.) 327 343 IF (.NOT. found) THEN 328 344 sollwdown(:) = 0. ; zts(:)=0. … … 333 349 ENDIF 334 350 335 found=phyetat0_get( 1,radsol,"RADS","Solar radiation",0.)336 found=phyetat0_get( 1,fder,"fder","Flux derivative",0.)351 found=phyetat0_get(radsol,"RADS","Solar radiation",0.) 352 found=phyetat0_get(fder,"fder","Flux derivative",0.) 337 353 338 354 339 355 ! Lecture de la longueur de rugosite 340 found=phyetat0_srf( 1,z0m,"RUG","Z0m ancien",0.001)356 found=phyetat0_srf(z0m,"RUG","Z0m ancien",0.001) 341 357 IF (found) THEN 342 358 z0h(:,1:nbsrf)=z0m(:,1:nbsrf) 343 359 ELSE 344 found=phyetat0_srf( 1,z0m,"Z0m","Roughness length, momentum ",0.001)345 found=phyetat0_srf( 1,z0h,"Z0h","Roughness length, enthalpy ",0.001)360 found=phyetat0_srf(z0m,"Z0m","Roughness length, momentum ",0.001) 361 found=phyetat0_srf(z0h,"Z0h","Roughness length, enthalpy ",0.001) 346 362 ENDIF 347 363 !FC … … 350 366 treedrg(:,1:klev,1:nbsrf)= 0.0 351 367 CALL get_field("treedrg_ter", drg_ter(:,:), found) 352 ! found=phyetat0_srf( 1,treedrg,"treedrg","drag from vegetation" , 0.)368 ! found=phyetat0_srf(treedrg,"treedrg","drag from vegetation" , 0.) 353 369 !lecture du profile de freinage des arbres 354 370 IF (.not. found ) THEN … … 356 372 ELSE 357 373 treedrg(:,1:klev,is_ter)= drg_ter(:,:) 358 ! found=phyetat0_ srf(klev,treedrg,"treedrg","freinage arbres",0.)374 ! found=phyetat0_get(treedrg,"treedrg","freinage arbres",0.) 359 375 ENDIF 360 376 ELSE … … 364 380 365 381 ! Lecture de l'age de la neige: 366 found=phyetat0_srf( 1,agesno,"AGESNO","SNOW AGE",0.001)382 found=phyetat0_srf(agesno,"AGESNO","SNOW AGE",0.001) 367 383 368 384 ancien_ok=.true. 369 ancien_ok=ancien_ok.AND.phyetat0_get( klev,t_ancien,"TANCIEN","TANCIEN",0.)370 ancien_ok=ancien_ok.AND.phyetat0_get( klev,q_ancien,"QANCIEN","QANCIEN",0.)371 ancien_ok=ancien_ok.AND.phyetat0_get( klev,ql_ancien,"QLANCIEN","QLANCIEN",0.)372 ancien_ok=ancien_ok.AND.phyetat0_get( klev,qs_ancien,"QSANCIEN","QSANCIEN",0.)373 ancien_ok=ancien_ok.AND.phyetat0_get( klev,rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.)374 ancien_ok=ancien_ok.AND.phyetat0_get( klev,u_ancien,"UANCIEN","UANCIEN",0.)375 ancien_ok=ancien_ok.AND.phyetat0_get( klev,v_ancien,"VANCIEN","VANCIEN",0.)376 ancien_ok=ancien_ok.AND.phyetat0_get( 1,prw_ancien,"PRWANCIEN","PRWANCIEN",0.)377 ancien_ok=ancien_ok.AND.phyetat0_get( 1,prlw_ancien,"PRLWANCIEN","PRLWANCIEN",0.)378 ancien_ok=ancien_ok.AND.phyetat0_get( 1,prsw_ancien,"PRSWANCIEN","PRSWANCIEN",0.)385 ancien_ok=ancien_ok.AND.phyetat0_get(t_ancien,"TANCIEN","TANCIEN",0.) 386 ancien_ok=ancien_ok.AND.phyetat0_get(q_ancien,"QANCIEN","QANCIEN",0.) 387 ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.) 388 ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.) 389 ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.) 390 ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.) 391 ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.) 392 ancien_ok=ancien_ok.AND.phyetat0_get(prw_ancien,"PRWANCIEN","PRWANCIEN",0.) 393 ancien_ok=ancien_ok.AND.phyetat0_get(prlw_ancien,"PRLWANCIEN","PRLWANCIEN",0.) 394 ancien_ok=ancien_ok.AND.phyetat0_get(prsw_ancien,"PRSWANCIEN","PRSWANCIEN",0.) 379 395 380 396 ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain … … 392 408 ENDIF 393 409 394 found=phyetat0_get( klev,clwcon,"CLWCON","CLWCON",0.)395 found=phyetat0_get( klev,rnebcon,"RNEBCON","RNEBCON",0.)396 found=phyetat0_get( klev,ratqs,"RATQS","RATQS",0.)397 398 found=phyetat0_get( 1,run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.)410 found=phyetat0_get(clwcon,"CLWCON","CLWCON",0.) 411 found=phyetat0_get(rnebcon,"RNEBCON","RNEBCON",0.) 412 found=phyetat0_get(ratqs,"RATQS","RATQS",0.) 413 414 found=phyetat0_get(run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.) 399 415 400 416 !================================== … … 403 419 ! 404 420 IF (iflag_pbl>1) then 405 found=phyetat0_srf( klev+1,pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8)421 found=phyetat0_srf(pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8) 406 422 ENDIF 407 423 408 424 IF (iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 ) then 409 found=phyetat0_srf( klev+1,wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.)410 !! found=phyetat0_srf( 1,delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.)411 found=phyetat0_srf( 1,delta_tsurf,"DELTATS","Delta Ts wk/env ",0.)412 !! found=phyetat0_srf( 1,beta_aridity,"BETA_S","Aridity factor ",1.)413 found=phyetat0_srf( 1,beta_aridity,"BETAS","Aridity factor ",1.)425 found=phyetat0_srf(wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.) 426 !! found=phyetat0_srf(delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.) 427 found=phyetat0_srf(delta_tsurf,"DELTATS","Delta Ts wk/env ",0.) 428 !! found=phyetat0_srf(beta_aridity,"BETA_S","Aridity factor ",1.) 429 found=phyetat0_srf(beta_aridity,"BETAS","Aridity factor ",1.) 414 430 ENDIF !(iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 ) 415 431 … … 419 435 420 436 ! Emanuel 421 found=phyetat0_get( klev,sig1,"sig1","sig1",0.)422 found=phyetat0_get( klev,w01,"w01","w01",0.)437 found=phyetat0_get(sig1,"sig1","sig1",0.) 438 found=phyetat0_get(w01,"w01","w01",0.) 423 439 424 440 ! Wake 425 found=phyetat0_get( klev,wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.)426 found=phyetat0_get( klev,wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.)427 found=phyetat0_get( 1,wake_s,"WAKE_S","Wake frac. area",0.)441 found=phyetat0_get(wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.) 442 found=phyetat0_get(wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.) 443 found=phyetat0_get(wake_s,"WAKE_S","Wake frac. area",0.) 428 444 !jyg< 429 445 ! Set wake_dens to -1000. when there is no restart so that the actual 430 446 ! initialization is made in calwake. 431 447 !! found=phyetat0_get(1,wake_dens,"WAKE_DENS","Wake num. /unit area",0.) 432 found=phyetat0_get( 1,wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.)433 found=phyetat0_get( 1,awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.)434 found=phyetat0_get( 1,cv_gen,"CV_GEN","CB birth rate",0.)448 found=phyetat0_get(wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.) 449 found=phyetat0_get(awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.) 450 found=phyetat0_get(cv_gen,"CV_GEN","CB birth rate",0.) 435 451 !>jyg 436 found=phyetat0_get( 1,wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.)437 found=phyetat0_get( 1,wake_pe,"WAKE_PE","WAKE_PE",0.)438 found=phyetat0_get( 1,wake_fip,"WAKE_FIP","WAKE_FIP",0.)452 found=phyetat0_get(wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.) 453 found=phyetat0_get(wake_pe,"WAKE_PE","WAKE_PE",0.) 454 found=phyetat0_get(wake_fip,"WAKE_FIP","WAKE_FIP",0.) 439 455 440 456 ! Thermiques 441 found=phyetat0_get( 1,zmax0,"ZMAX0","ZMAX0",40.)442 found=phyetat0_get( 1,f0,"F0","F0",1.e-5)443 found=phyetat0_get( klev+1,fm_therm,"FM_THERM","Thermals mass flux",0.)444 found=phyetat0_get( klev,entr_therm,"ENTR_THERM","Thermals Entrain.",0.)445 found=phyetat0_get( klev,detr_therm,"DETR_THERM","Thermals Detrain.",0.)457 found=phyetat0_get(zmax0,"ZMAX0","ZMAX0",40.) 458 found=phyetat0_get(f0,"F0","F0",1.e-5) 459 found=phyetat0_get(fm_therm,"FM_THERM","Thermals mass flux",0.) 460 found=phyetat0_get(entr_therm,"ENTR_THERM","Thermals Entrain.",0.) 461 found=phyetat0_get(detr_therm,"DETR_THERM","Thermals Detrain.",0.) 446 462 447 463 ! ALE/ALP 448 found=phyetat0_get( 1,ale_bl,"ALE_BL","ALE BL",0.)449 found=phyetat0_get( 1,ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.)450 found=phyetat0_get( 1,alp_bl,"ALP_BL","ALP BL",0.)451 found=phyetat0_get( 1,ale_wake,"ALE_WAKE","ALE_WAKE",0.)452 found=phyetat0_get( 1,ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.)464 found=phyetat0_get(ale_bl,"ALE_BL","ALE BL",0.) 465 found=phyetat0_get(ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.) 466 found=phyetat0_get(alp_bl,"ALP_BL","ALP BL",0.) 467 found=phyetat0_get(ale_wake,"ALE_WAKE","ALE_WAKE",0.) 468 found=phyetat0_get(ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.) 453 469 454 470 ! fisrtilp/Clouds 0.002 could be ratqsbas. But can stay like this as well 455 found=phyetat0_get( klev,ratqs_inter,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002)471 found=phyetat0_get(ratqs_inter,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002) 456 472 457 473 !=========================================== … … 464 480 ALLOCATE(co2_send(klon), stat=ierr) 465 481 IF (ierr /= 0) CALL abort_physic('phyetat0', 'pb allocation co2_send', 1) 466 !found=phyetat0_get(1,co2_send,"co2_send","co2 send",co2_ppm) 467 found=phyetat0_get(1,co2_send,"co2_send","co2 send",co2_ppm0) 482 found=phyetat0_get(co2_send,"co2_send","co2 send",co2_ppm0) 468 483 ENDIF 469 484 ELSE IF (type_trac == 'lmdz') THEN … … 472 487 IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE 473 488 it = it+1 474 found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iq)%name), & 475 "Surf trac"//TRIM(tracers(iq)%name),0.) 489 tname = tracers(iq)%name 490 t(1) = 'trs_'//TRIM(tname); t(2) = 'trs_'//TRIM(new2oldH2O(tname)) 491 found = phyetat0_get(trs(:,it), t(:), "Surf trac"//TRIM(tname), 0.) 476 492 END DO 477 493 CALL traclmdz_from_restart(trs) … … 485 501 ! ondes de gravite non orographiques 486 502 IF (ok_gwd_rando) found = & 487 phyetat0_get( klev,du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.)503 phyetat0_get(du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.) 488 504 IF (.NOT. ok_hines .AND. ok_gwd_rando) found & 489 = phyetat0_get( klev,du_gwd_front,"du_gwd_front","du_gwd_front",0.)505 = phyetat0_get(du_gwd_front,"du_gwd_front","du_gwd_front",0.) 490 506 491 507 ! prise en compte du relief sous-maille 492 found=phyetat0_get( 1,zmea,"ZMEA","sub grid orography",0.)493 found=phyetat0_get( 1,zstd,"ZSTD","sub grid orography",0.)494 found=phyetat0_get( 1,zsig,"ZSIG","sub grid orography",0.)495 found=phyetat0_get( 1,zgam,"ZGAM","sub grid orography",0.)496 found=phyetat0_get( 1,zthe,"ZTHE","sub grid orography",0.)497 found=phyetat0_get( 1,zpic,"ZPIC","sub grid orography",0.)498 found=phyetat0_get( 1,zval,"ZVAL","sub grid orography",0.)499 found=phyetat0_get( 1,zmea,"ZMEA","sub grid orography",0.)500 found=phyetat0_get( 1,rugoro,"RUGSREL","sub grid orography",0.)508 found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.) 509 found=phyetat0_get(zstd,"ZSTD","sub grid orography",0.) 510 found=phyetat0_get(zsig,"ZSIG","sub grid orography",0.) 511 found=phyetat0_get(zgam,"ZGAM","sub grid orography",0.) 512 found=phyetat0_get(zthe,"ZTHE","sub grid orography",0.) 513 found=phyetat0_get(zpic,"ZPIC","sub grid orography",0.) 514 found=phyetat0_get(zval,"ZVAL","sub grid orography",0.) 515 found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.) 516 found=phyetat0_get(rugoro,"RUGSREL","sub grid orography",0.) 501 517 502 518 !=========================================== … … 507 523 CALL ocean_slab_init(phys_tstep, pctsrf) 508 524 IF (nslay.EQ.1) THEN 509 found=phyetat0_get(1,tslab,"tslab01","tslab",0.) 510 IF (.NOT. found) THEN 511 found=phyetat0_get(1,tslab,"tslab","tslab",0.) 512 ENDIF 525 found=phyetat0_get(tslab,["tslab01","tslab "],"tslab",0.) 513 526 ELSE 514 527 DO i=1,nslay 515 528 WRITE(str2,'(i2.2)') i 516 found=phyetat0_get( 1,tslab(:,i),"tslab"//str2,"tslab",0.)529 found=phyetat0_get(tslab(:,i),"tslab"//str2,"tslab",0.) 517 530 ENDDO 518 531 ENDIF … … 527 540 ! Sea ice variables 528 541 IF (version_ocean == 'sicINT') THEN 529 found=phyetat0_get( 1,tice,"slab_tice","slab_tice",0.)542 found=phyetat0_get(tice,"slab_tice","slab_tice",0.) 530 543 IF (.NOT. found) THEN 531 544 PRINT*, "phyetat0: Le champ <tice> est absent" … … 533 546 tice(:)=ftsol(:,is_sic) 534 547 ENDIF 535 found=phyetat0_get( 1,seaice,"seaice","seaice",0.)548 found=phyetat0_get(seaice,"seaice","seaice",0.) 536 549 IF (.NOT. found) THEN 537 550 PRINT*, "phyetat0: Le champ <seaice> est absent" … … 547 560 if (activate_ocean_skin >= 1) then 548 561 if (activate_ocean_skin == 2 .and. type_ocean == 'couple') then 549 found = phyetat0_get( 1,delta_sal, "delta_sal", &562 found = phyetat0_get(delta_sal, "delta_sal", & 550 563 "ocean-air interface salinity minus bulk salinity", 0.) 551 found = phyetat0_get( 1,delta_sst, "delta_SST", &564 found = phyetat0_get(delta_sst, "delta_SST", & 552 565 "ocean-air interface temperature minus bulk SST", 0.) 553 566 end if 554 567 555 found = phyetat0_get( 1,ds_ns, "dS_ns", "delta salinity near surface", 0.)556 found = phyetat0_get( 1,dt_ns, "dT_ns", "delta temperature near surface", &568 found = phyetat0_get(ds_ns, "dS_ns", "delta salinity near surface", 0.) 569 found = phyetat0_get(dt_ns, "dT_ns", "delta temperature near surface", & 557 570 0.) 558 571 … … 584 597 END SUBROUTINE phyetat0 585 598 586 !=================================================================== 587 FUNCTION phyetat0_get(nlev,field,name,descr,default) 588 !=================================================================== 589 ! Lecture d'un champ avec contrôle 590 ! Function logique dont le resultat indique si la lecture 591 ! s'est bien passée 592 ! On donne une valeur par defaut dans le cas contraire 593 !=================================================================== 594 595 USE iostart, ONLY : get_field 596 USE dimphy, only: klon 597 USE print_control_mod, ONLY: lunout 598 599 IMPLICIT NONE 600 601 LOGICAL phyetat0_get 602 603 ! arguments 604 INTEGER,INTENT(IN) :: nlev 605 CHARACTER*(*),INTENT(IN) :: name,descr 606 REAL,INTENT(IN) :: default 607 REAL,DIMENSION(klon,nlev),INTENT(INOUT) :: field 608 609 ! Local variables 610 LOGICAL found 611 612 CALL get_field(name, field, found) 613 IF (.NOT. found) THEN 614 WRITE(lunout,*) "phyetat0: Le champ <",TRIM(name),"> est absent" 615 WRITE(lunout,*) "Depart legerement fausse. Mais je continue" 616 field(:,:)=default 617 ENDIF 618 WRITE(lunout,*) name, descr, MINval(field),MAXval(field) 619 phyetat0_get=found 620 621 RETURN 622 END FUNCTION phyetat0_get 623 624 !================================================================ 625 FUNCTION phyetat0_srf(nlev,field,name,descr,default) 626 !=================================================================== 627 ! Lecture d'un champ par sous-surface avec contrôle 628 ! Function logique dont le resultat indique si la lecture 629 ! s'est bien passée 630 ! On donne une valeur par defaut dans le cas contraire 631 !=================================================================== 632 633 USE iostart, ONLY : get_field 634 USE dimphy, only: klon 635 USE indice_sol_mod, only: nbsrf 636 USE print_control_mod, ONLY: lunout 637 638 IMPLICIT NONE 639 640 LOGICAL phyetat0_srf 641 ! arguments 642 INTEGER,INTENT(IN) :: nlev 643 CHARACTER*(*),INTENT(IN) :: name,descr 644 REAL,INTENT(IN) :: default 645 REAL,DIMENSION(klon,nlev,nbsrf),INTENT(INOUT) :: field 646 647 ! Local variables 648 LOGICAL found,phyetat0_get 649 INTEGER nsrf 650 CHARACTER*2 str2 651 652 IF (nbsrf.GT.99) THEN 653 WRITE(lunout,*) "Trop de sous-mailles" 654 call abort_physic("phyetat0", "", 1) 655 ENDIF 656 657 DO nsrf = 1, nbsrf 658 WRITE(str2, '(i2.2)') nsrf 659 found= phyetat0_get(nlev,field(:,:, nsrf), & 660 name//str2,descr//" srf:"//str2,default) 661 ENDDO 662 663 phyetat0_srf=found 664 665 RETURN 666 END FUNCTION phyetat0_srf 667 599 !============================================================================== 600 LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound) 601 ! Read a field. Check whether reading succeded and use default value if not. 602 IMPLICIT NONE 603 REAL, INTENT(INOUT) :: field(:) ! klon 604 CHARACTER(LEN=*), INTENT(IN) :: name 605 CHARACTER(LEN=*), INTENT(IN) :: descr 606 REAL, INTENT(IN) :: default 607 !------------------------------------------------------------------------------ 608 REAL :: fld(SIZE(field),1) 609 lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1) 610 END FUNCTION phyetat0_get10 611 !============================================================================== 612 LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound) 613 ! Same as phyetat0_get11, field on multiple levels. 614 IMPLICIT NONE 615 REAL, INTENT(INOUT) :: field(:,:) ! klon, nlev 616 CHARACTER(LEN=*), INTENT(IN) :: name 617 CHARACTER(LEN=*), INTENT(IN) :: descr 618 REAL, INTENT(IN) :: default 619 !----------------------------------------------------------------------------- 620 lFound = phyetat0_get21(field, [name], descr, default) 621 END FUNCTION phyetat0_get20 622 !============================================================================== 623 LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound) 624 ! Same as phyetat0_get11, multiple names. 625 IMPLICIT NONE 626 REAL, INTENT(INOUT) :: field(:) ! klon 627 CHARACTER(LEN=*), INTENT(IN) :: name(:) 628 CHARACTER(LEN=*), INTENT(IN) :: descr 629 REAL, INTENT(IN) :: default 630 !----------------------------------------------------------------------------- 631 REAL :: fld(SIZE(field),1) 632 lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1) 633 END FUNCTION phyetat0_get11 634 !============================================================================== 635 LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound) 636 ! Same as phyetat0_get11, field on multiple levels, multiple names. 637 USE iostart, ONLY: get_field 638 USE print_control_mod, ONLY: lunout 639 IMPLICIT NONE 640 REAL, INTENT(INOUT) :: field(:,:) ! klon, nlev 641 CHARACTER(LEN=*), INTENT(IN) :: name(:) 642 CHARACTER(LEN=*), INTENT(IN) :: descr 643 REAL, INTENT(IN) :: default 644 CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname 645 !----------------------------------------------------------------------------- 646 CHARACTER(LEN=LEN(name)) :: tnam 647 INTEGER :: i 648 DO i = 1, SIZE(name) 649 CALL get_field(TRIM(name(i)), field, lFound) 650 IF(lFound) EXIT 651 WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> " 652 END DO 653 IF(.NOT.lFound) THEN 654 WRITE(lunout,*) "Slightly distorted start ; continuing." 655 field(:,:) = default 656 tnam = name(1) 657 ELSE 658 tnam = name(i) 659 END IF 660 WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', & 661 MINval(field),' ',MAXval(field) 662 IF(PRESENT(tname)) tname = tnam 663 END FUNCTION phyetat0_get21 664 !============================================================================== 665 LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound) 666 ! Read a field per sub-surface. 667 ! Check whether reading succeded and use default value if not. 668 IMPLICIT NONE 669 REAL, INTENT(INOUT) :: field(:,:) 670 CHARACTER(LEN=*), INTENT(IN) :: name 671 CHARACTER(LEN=*), INTENT(IN) :: descr 672 REAL, INTENT(IN) :: default 673 !----------------------------------------------------------------------------- 674 REAL :: fld(SIZE(field,1),1,SIZE(field,2)) 675 lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:) 676 END FUNCTION phyetat0_srf20 677 678 !============================================================================== 679 LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound) 680 ! Same as phyetat0_sfr11, multiple names tested one after the other. 681 IMPLICIT NONE 682 REAL, INTENT(INOUT) :: field(:,:,:) 683 CHARACTER(LEN=*), INTENT(IN) :: name 684 CHARACTER(LEN=*), INTENT(IN) :: descr 685 REAL, INTENT(IN) :: default 686 !----------------------------------------------------------------------------- 687 lFound = phyetat0_srf31(field, [name], descr, default) 688 END FUNCTION phyetat0_srf30 689 690 !============================================================================== 691 LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound) 692 ! Same as phyetat0_sfr11, field on multiple levels. 693 IMPLICIT NONE 694 REAL, INTENT(INOUT) :: field(:,:) 695 CHARACTER(LEN=*), INTENT(IN) :: name(:) 696 CHARACTER(LEN=*), INTENT(IN) :: descr 697 REAL, INTENT(IN) :: default 698 !----------------------------------------------------------------------------- 699 REAL :: fld(SIZE(field,1),1,SIZE(field,2)) 700 lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:) 701 END FUNCTION phyetat0_srf21 702 703 !============================================================================== 704 LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound) 705 ! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other. 706 USE iostart, ONLY: get_field 707 USE print_control_mod, ONLY: lunout 708 USE strings_mod, ONLY: int2str, maxlen 709 IMPLICIT NONE 710 REAL, INTENT(INOUT) :: field(:,:,:) 711 CHARACTER(LEN=*), INTENT(IN) :: name(:) 712 CHARACTER(LEN=*), INTENT(IN) :: descr 713 REAL, INTENT(IN) :: default 714 !----------------------------------------------------------------------------- 715 INTEGER :: nsrf, i 716 CHARACTER(LEN=maxlen), ALLOCATABLE :: nam(:) 717 CHARACTER(LEN=maxlen) :: tname, des 718 IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1) 719 DO nsrf = 1, SIZE(field,3) 720 nam = [(TRIM(name(i))//TRIM(int2str(nsrf,2)), i=1, SIZE(name))] 721 des = TRIM(descr)//" srf:"//int2str(nsrf,2) 722 lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname) 723 END DO 724 WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', & 725 MINval(field),' ',MAXval(field) 726 END FUNCTION phyetat0_srf31 727 728 END MODULE phyetat0_mod 729 -
LMDZ6/trunk/libf/phylmd/physiq_mod.F90
r4352 r4358 54 54 USE pbl_surface_mod, ONLY : pbl_surface 55 55 USE phyaqua_mod, only: zenang_an 56 USE phyetat0_mod, only: phyetat0 56 57 USE phystokenc_mod, ONLY: offline, phystokenc 57 58 USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, & … … 802 803 !C EXTERNAL o3cm ! initialiser l'ozone 803 804 EXTERNAL orbite ! calculer l'orbite terrestre 804 EXTERNAL phyetat0 ! lire l'etat initial de la physique805 805 EXTERNAL phyredem ! ecrire l'etat de redemarrage de la physique 806 806 EXTERNAL suphel ! initialiser certaines constantes -
LMDZ6/trunk/libf/phylmd/tracinca_mod.F90
r2784 r4358 12 12 ! config_inca='chem' => INCA with chemistry 13 13 ! config_inca='aero' => INCA with aerosols 14 ! config_inca='aeNP' => INCA with aerosols NP (?) 14 15 CONTAINS 15 16 … … 17 18 ! This subroutine initialize some control varaibles. 18 19 19 USE infotrac_phy, ONLY: nbtr 20 USE ioipsl_getin_p_mod, ONLY: getin_p 20 USE infotrac_phy, ONLY: nbtr, types_trac 21 21 IMPLICIT NONE 22 22 … … 25 25 LOGICAL,INTENT(OUT) :: lessivage 26 26 27 28 27 ! Initialization 29 28 lessivage =.FALSE. 30 29 aerosol(:) = .FALSE. 30 31 !--- COHERENCE TEST BETWEEN "type_trac" AND "config_inca" 32 IF((ANY(types_trac == 'inca') .OR. ANY(types_trac == 'inco')) .AND. ALL(config_inca /= ['aero', 'aeNP', 'chem']))& 33 CALL abort_gcm('tracinca_init', 'INCA enabled, but unknown config_inca = "'//TRIM(config_inca)//'".' & 34 //'Please modify "run.def"', 1) 35 36 !--- PROBLEM IF "config_inca" DIFFERS FROM "none" AND INCA HAS NOT BEEN ACTIVATED 37 IF(ALL(types_trac /= 'inca') .AND. ALL(types_trac /= 'inco') .AND. config_inca /= 'none') & 38 CALL abort_gcm('tracinca_init', 'INCA disabled, but config_inca = "'//TRIM(config_inca)//'" should be "none".'& 39 //'Please modify "run.def"', 1) 31 40 32 41 END SUBROUTINE tracinca_init -
LMDZ6/trunk/libf/phylmdiso/isotopes_routines_mod.F90
r4325 r4358 16508 16508 end subroutine phyiso_etat0_dur 16509 16509 16510 subroutine phyiso_etat0_fichier( & 16511 & snow,run_off_lic_0, & 16512 & xtsnow,xtrun_off_lic_0, & 16513 & Rland_ice) 16514 USE dimphy, only: klon,klev 16515 !USE mod_grid_phy_lmdz 16516 !USE mod_phys_lmdz_para 16517 USE iophy 16518 USE phys_state_var_mod, ONLY: q_ancien,xt_ancien,wake_deltaq,wake_deltaxt, & 16519 #ifdef ISOVERIF 16520 rain_fall,snow_fall,fevap,qsol, & 16521 #endif 16522 xtrain_fall,xtsnow_fall,ql_ancien,xtl_ancien,qs_ancien,xts_ancien, & 16523 fxtevap,xtsol 16524 !USE iostart 16525 !USE write_field_phy 16526 USE indice_sol_mod, only: nbsrf 16527 USE isotopes_mod, ONLY: isoName,iso_HDO,iso_eau 16528 #ifdef ISOVERIF 16529 USE isotopes_verif_mod 16510 SUBROUTINE phyiso_etat0_fichier(snow, run_off_lic_0, xtsnow, xtrun_off_lic_0, Rland_ice) 16511 USE dimphy, ONLY: klon,klev 16512 USE iophy 16513 USE phys_state_var_mod, ONLY: q_ancien, xt_ancien, wake_deltaq, wake_deltaxt, & 16514 #ifdef ISOVERIF 16515 rain_fall, snow_fall, fevap,qsol, & 16516 #endif 16517 xtrain_fall, xtsnow_fall, ql_ancien, xtl_ancien, qs_ancien, xts_ancien, fxtevap, xtsol 16518 USE indice_sol_mod, ONLY: nbsrf 16519 USE isotopes_mod, ONLY: isoName,iso_HDO,iso_eau 16520 USE phyetat0_mod, ONLY: phyetat0_get, phyetat0_srf 16521 USE readTracFiles_mod, ONLY: new2oldH2O 16522 USE strings_mod, ONLY: strIdx, strHead, strTail, maxlen, msg, int2str 16523 #ifdef ISOVERIF 16524 USE isotopes_verif_mod 16530 16525 #endif 16531 16526 #ifdef ISOTRAC 16532 USE isotrac_mod, ONLY: strtrac,initialisation_isotrac,index_iso, & 16533 & index_zone,izone_init 16534 USE readTracFiles_mod, ONLY: newH2Oiso, oldH2Oiso 16535 USE strings_mod, ONLY: strIdx, strHead, strTail 16536 16537 #endif 16538 implicit none 16527 USE isotrac_mod, ONLY: strtrac, initialisation_isotrac, index_iso, index_zone, izone_init 16528 #endif 16529 IMPLICIT NONE 16539 16530 16540 16531 #include "netcdf.inc" 16541 16532 #include "dimsoil.h" 16542 16533 #include "clesphys.h" 16543 ! #include "thermcell.h"16544 16534 #include "compbl.h" 16545 16535 16546 ! inputs 16547 !REAL qsol(klon) 16548 REAL snow(klon,nbsrf) 16549 !REAL evap(klon,nbsrf) 16550 REAL run_off_lic_0(klon) 16551 ! outputs 16552 !REAL xtsol(niso,klon) 16553 REAL xtsnow(niso,klon,nbsrf) 16554 !REAL xtevap(ntraciso,klon,nbsrf) 16555 REAL xtrun_off_lic_0(niso,klon) 16556 REAL Rland_ice(niso,klon) 16557 16558 ! locals 16559 real iso_tmp(klon) 16560 real iso_tmp_lonlev(klon,klev) 16561 real iso_tmp_lonsrf(klon,nbsrf) 16562 INTEGER ierr 16563 integer i,ixt,k,nsrf 16564 INTEGER nid, nvarid 16565 CHARACTER*2 str2 16566 CHARACTER*5 str5 16567 real xmin,xmax 16568 CHARACTER*50 outiso, oldIso 16569 integer lnblnk 16570 LOGICAL :: found,phyetat0_get,phyetat0_srf 16571 16572 !#ifdef ISOVERIF 16573 ! integer iso_verif_egalite_nostop 16574 !#endif 16575 !#ifdef ISOVERIF 16576 ! real deltaD 16577 ! integer iso_verif_noNaN_nostop 16578 !#endif 16536 REAL, INTENT(IN) :: snow (klon,nbsrf) 16537 REAL, INTENT(IN) :: run_off_lic_0 (klon) 16538 REAL, INTENT(OUT) :: xtsnow(niso,klon,nbsrf) 16539 REAL, INTENT(OUT) :: xtrun_off_lic_0(niso,klon) 16540 REAL, INTENT(OUT) :: Rland_ice(niso,klon) 16541 16542 INTEGER :: ierr, i, ixt, k, nsrf, nid, nvarid, lnblnk 16543 CHARACTER(LEN=2) :: str2 16544 CHARACTER(LEN=5) :: str5 16545 CHARACTER(LEN=maxlen) :: outiso, oldIso, modname, nam(2) 16546 REAL :: xmin, xmax 16547 LOGICAL :: found 16579 16548 #ifdef ISOTRAC 16580 integer iiso,izone16581 #endif 16582 16583 16584 write(*,*) 'phyiso_etat0_fichier 3'16585 write(*,*) 'niso=',niso16586 write(*,*) 'isoName(1)='//TRIM(isoName(1))16587 16588 do ixt=1,ntraciso16549 INTEGER :: iiso, izone 16550 #endif 16551 16552 modname = 'phyiso_etat0_fichier' 16553 CALL msg('3', modname) 16554 CALL msg('niso = '//TRIM(int2str(niso)), modname) 16555 CALL msg('isoName(1) = '//TRIM(isoName(1)), modname) 16556 16557 DO ixt = 1, ntraciso 16589 16558 16590 16559 outiso = isoName(ixt) 16591 k = strIdx(newH2Oiso, strHead(outiso, '_')) 16592 oldIso = outiso; IF(k /= 0) oldIso = oldH2Oiso(k) 16593 IF(INDEX(outiso, '_') /= 0) THEN 16594 outiso = TRIM(outiso)//TRIM(strTail(outiso, '_')) 16595 oldIso = TRIM(oldIso)//TRIM(strTail(outiso, '_')) 16560 oldIso = strTail(new2oldH2O(outiso), '_', lFirst=.TRUE.) 16561 ! on lit seulement si ixt<=niso ou si on initialise les traceurs d'après fichier: 16562 #ifdef ISOTRAC 16563 IF(ixt <= niso .OR. initialisation_isotrac == 0) THEN 16564 #endif 16565 found = phyetat0iso_srf3(xtsnow, "XTSNOW", "Surface snow", 0.) 16566 if (.NOT.found) CALL abort_physic('isotopes_routines_mod', 'phyiso_etat0_fichier 16581: unfound isotopic variable',1) 16567 found = phyetat0iso_srf3(fxtevap, "XTEVAP", "evaporation", 0.) 16568 found = phyetat0iso_get2(xtrain_fall, "xtrain_f", "xrain fall", 0.) 16569 found = phyetat0iso_get2(xtrain_fall, "xtsnow_f", "xsnow fall", 0.) 16570 found = phyetat0iso_get3(xt_ancien, "XTANCIEN", "QANCIEN", 0.) 16571 found = phyetat0iso_get3(xtl_ancien, "XTLANCIEN", "QLANCIEN", 0.) 16572 found = phyetat0iso_get3(xts_ancien, "XTASNCIEN", "QSANCIEN", 0.) 16573 found = phyetat0iso_get2(xtrun_off_lic_0, "XTRUNOFFLIC0", "RUNOFFLIC0", 0.) 16574 found = phyetat0iso_get3(wake_deltaxt, "WAKE_DELTAXT", "Delta hum. wake/env", 0.) 16575 #ifdef ISOVERIF 16576 IF(ixt == iso_eau .AND. iso_eau > 0) THEN 16577 DO i=1,klon 16578 CALL iso_verif_egalite(xtrain_fall(iso_eau,i),rain_fall(i),TRIM(modname)//' 231a') 16579 CALL iso_verif_egalite(xtsnow_fall(iso_eau,i),snow_fall(i),TRIM(modname)//' 231b') 16580 DO nsrf = 1, nbsrf 16581 CALL iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf),TRIM(modname)//' 231c') 16582 CALL iso_verif_egalite( xtsnow(iso_eau,i,nsrf), snow(i,nsrf),TRIM(modname)//' 231d') 16583 END DO 16584 END DO 16596 16585 END IF 16597 16598 ! on lit seulement si ixt<=niso ou si on initialise les traceurs d'après 16599 ! fichier: 16586 IF(ixt == iso_HDO .AND. iso_HDO > 0) THEN 16587 DO k=1,klev 16588 DO i=1,klon 16589 IF(q_ancien(i,k) > 2e-3) & 16590 CALL iso_verif_aberrant(xt_ancien(iso_hdo,i,k)/q_ancien(i,k),TRIM(modname)//' 312') 16591 END DO 16592 END DO 16593 END IF 16594 IF(iso_eau > 0 .AND. ixt == iso_eau) THEN 16595 DO i=1,klon 16596 IF(iso_verif_egalite_nostop(run_off_lic_0(i),xtrun_off_lic_0(iso_eau,i),TRIM(modname)//' 326') == 1) THEN 16597 WRITE(*,*) 'i=',i 16598 STOP 16599 END IF 16600 END DO 16601 END IF 16602 #endif 16603 ! ces variables n'ont pas de traceurs: 16604 IF(ixt <= niso) THEN 16605 found = phyetat0iso_get2(xtsol, "XTSOL", "Surface humidity / bucket", 0.) 16606 found = phyetat0iso_get2(Rland_ice, "Rland_ice", "SR land ice", 0.) 16607 #ifdef ISOVERIF 16608 16609 DO i=1,klon 16610 IF(iso_verif_noNaN_nostop(xtsol(ixt,i),TRIM(modname)//' 95') == 1) THEN 16611 WRITE(*,*) 'ixt,i=',ixt,i 16612 STOP 16613 END IF 16614 END DO 16615 #endif 16616 END IF 16600 16617 #ifdef ISOTRAC 16601 if ((ixt.le.niso).or.(initialisation_isotrac.eq.0)) then 16602 #endif 16603 16604 found=phyetat0_srf(1,iso_tmp_lonsrf,"XTSNOW"//TRIM(outiso),"Surface snow",0.) 16605 if (.NOT.found.AND.k/=0) found=phyetat0_srf(1,iso_tmp_lonsrf,"XTSNOW"//TRIM(oldIso),"Surface snow",0.) 16606 if (.NOT.found) CALL abort_physic('isotopes_routines_mod', 'phyiso_etat0_fichier 16581: variable isotopique not found',1) 16607 xtsnow(ixt,:,:)=iso_tmp_lonsrf(:,:) 16608 16609 found=phyetat0_srf(1,iso_tmp_lonsrf,"XTEVAP"//TRIM(outiso),"evaporation",0.) 16610 if (.NOT.found.AND.k/=0) found=phyetat0_srf(1,iso_tmp_lonsrf,"XTEVAP"//TRIM(oldIso),"evaporation",0.) 16611 fxtevap(ixt,:,:)=iso_tmp_lonsrf(:,:) 16612 16613 found=phyetat0_get(1,iso_tmp,"xtrain_f"//TRIM(outiso),"xrain fall",0.) 16614 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp,"xtrain_f"//TRIM(oldIso),"xrain fall",0.) 16615 xtrain_fall(ixt,:)=iso_tmp(:) 16616 16617 found=phyetat0_get(1,iso_tmp,"xtsnow_f"//TRIM(outiso),"snow fall",0.) 16618 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp,"xtsnow_f"//TRIM(oldIso),"snow fall",0.) 16619 xtsnow_fall(ixt,:)=iso_tmp(:) 16620 16621 found=phyetat0_get(klev,iso_tmp_lonlev,"XTANCIEN"//TRIM(outiso),"QANCIEN",0.) 16622 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp_lonlev,"XTANCIEN"//TRIM(oldIso),"QANCIEN",0.) 16623 xt_ancien(ixt,:,:)=iso_tmp_lonlev(:,:) 16624 16625 found=phyetat0_get(klev,iso_tmp_lonlev,"XTLANCIEN"//TRIM(outiso),"QLANCIEN",0.) 16626 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp_lonlev,"XTLANCIEN"//TRIM(oldIso),"QLANCIEN",0.) 16627 xtl_ancien(ixt,:,:)=iso_tmp_lonlev(:,:) 16628 16629 found=phyetat0_get(klev,iso_tmp_lonlev,"XTSANCIEN"//TRIM(outiso),"QSANCIEN",0.) 16630 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp_lonlev,"XTSANCIEN"//TRIM(oldIso),"QSANCIEN",0.) 16631 xts_ancien(ixt,:,:)=iso_tmp_lonlev(:,:) 16632 16633 found=phyetat0_get(1,iso_tmp,"XTRUNOFFLIC0"//TRIM(outiso),"RUNOFFLIC0",0.) 16634 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp,"XTRUNOFFLIC0"//TRIM(oldIso),"RUNOFFLIC0",0.) 16635 xtrun_off_lic_0(ixt,:)=iso_tmp(:) 16636 16637 found=phyetat0_get(klev,iso_tmp_lonlev,"WAKE_DELTAXT"//TRIM(outiso),"Delta hum. wake/env",0.) 16638 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp_lonlev,"WAKE_DELTAXT"//TRIM(oldIso),"Delta hum. wake/env",0.) 16639 wake_deltaxt(ixt,:,:)=iso_tmp_lonlev(:,:) 16640 16641 #ifdef ISOVERIF 16642 if ((ixt.eq.iso_eau).and.(iso_eau.gt.0)) then 16643 do i=1,klon 16644 call iso_verif_egalite(xtrain_fall(iso_eau,i),rain_fall(i), & 16645 & 'phyisoetat0_fichier 231a') 16646 call iso_verif_egalite(xtsnow_fall(iso_eau,i),snow_fall(i), & 16647 & 'phyisoetat0_fichier 231b') 16648 DO nsrf = 1, nbsrf 16649 call iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf), & 16650 & 'phyisoetat0_fichier 231c') 16651 call iso_verif_egalite(xtsnow(iso_eau,i,nsrf),snow(i,nsrf), & 16652 & 'phyisoetat0_fichier 231d') 16653 enddo !DO nsrf = 1, nbsrf 16654 enddo !do i=1,klon 16655 endif !if (iso_eau.gt.0) then 16656 if ((iso_HDO.gt.0).and.(ixt.eq.iso_HDO)) then 16657 do k=1,klev 16658 do i=1,klon 16659 if (q_ancien(i,k).gt.2e-3) then 16660 call iso_verif_aberrant(xt_ancien(iso_hdo,i,k) & 16661 & /q_ancien(i,k),'phyisoetat0_fichier 312') 16662 endif !if (q_ancien(i,k).gt.2e-3) then 16663 enddo !do i=1,klon 16664 enddo !do k=1,klev 16665 endif !if ((iso_HDO.gt.0).and.(ixt.eq.iso_HDO)) then 16666 if (iso_eau.gt.0) then 16667 do i=1,klon 16668 if (iso_verif_egalite_nostop(run_off_lic_0(i), & 16669 & xtrun_off_lic_0(iso_eau,i), & 16670 & 'phyiso_etat0_fichier 326').eq.1) then 16671 write(*,*) 'i=',i 16672 stop 16673 endif !if (iso_verif_egalite_nostop(run_off_lic_0(i), 16674 enddo !do i=1,klon 16675 endif !if (iso_eau.gt.0) then 16676 #endif 16677 16678 ! ces variables n'ont pas de traceurs: 16679 if (ixt.le.niso) then 16680 found=phyetat0_get(1,iso_tmp,"XTSOL"//TRIM(outiso),"Surface hmidity / bucket",0.) 16681 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp,"XTSOL"//TRIM(oldIso),"Surface hmidity / bucket",0.) 16682 xtsol(ixt,:)=iso_tmp(:) 16683 16684 found=phyetat0_get(1,iso_tmp,"Rland_ice"//TRIM(outiso),"R land ice",0.) 16685 if (.NOT.found.AND.k/=0) found=phyetat0_get(1,iso_tmp,"Rland_ice"//TRIM(oldIso),"R land ice",0.) 16686 Rland_ice(ixt,:)=iso_tmp(:) 16687 16688 #ifdef ISOVERIF 16689 do i=1,klon 16690 if (iso_verif_noNaN_nostop(xtsol(ixt,i), & 16691 & 'phyiso_etat0_fichier 95').eq.1) then 16692 write(*,*) 'ixt,i=',ixt,i 16693 stop 16694 endif 16695 enddo !do i=1,klon 16696 #endif 16697 16698 endif 16618 END IF ! IF(ixt > niso .OR. initialisation_isotrac == 0)) 16619 #endif 16620 16621 END DO 16699 16622 16700 16623 #ifdef ISOTRAC 16701 endif !if ((ixt.le.niso).or.(initialisation_isotrac.eq.0)) then 16702 #endif 16703 16704 enddo !do ixt=1,ntraciso 16705 16706 #ifdef ISOTRAC 16707 if (initialisation_isotrac.ne.0) then 16708 ! on n'initialise pas d'après le fichier 16709 ! l'eau normale est mise dans la zone izone_init 16710 16711 do ixt=niso+1,ntraciso 16712 16713 iiso=index_iso(ixt) 16714 16715 if (index_zone(ixt).eq.izone_init) then 16716 do i=1,klon 16717 do nsrf = 1, nbsrf 16718 fxtevap(ixt,i,nsrf)=fxtevap(iiso,i,nsrf) 16719 enddo !do nsrf = 1, nbsrf 16720 xtsnow_fall(ixt,i)=xtsnow_fall(iiso,i) 16721 xtrain_fall(ixt,i)=xtrain_fall(iiso,i) 16722 do k=1,klev 16723 xt_ancien(ixt,i,k)=xt_ancien(iiso,i,k) 16724 xtl_ancien(ixt,i,k)=xtl_ancien(iiso,i,k) 16725 xts_ancien(ixt,i,k)=xts_ancien(iiso,i,k) 16726 wake_deltaxt(ixt,i,k)= wake_deltaxt(iiso,i,k) 16727 enddo 16728 enddo !do i=1,klon 16729 else !if (index_zone(ixt).eq.izone_init) then 16730 do i=1,klon 16731 do nsrf = 1, nbsrf 16732 fxtevap(ixt,i,nsrf)=0.0 16733 enddo !do nsrf = 1, nbsrf 16734 xtsnow_fall(ixt,i)=0.0 16735 xtrain_fall(ixt,i)=0.0 16736 do k=1,klev 16737 xt_ancien(ixt,i,k)=0.0 16738 xtl_ancien(ixt,i,k)=0.0 16739 xts_ancien(ixt,i,k)=0.0 16740 enddo 16741 enddo !do i=1,klon 16742 endif !if (index_zone(ixt).eq.izone_init) then 16743 16744 enddo !do ixt=1,niso 16745 endif !if (initialisation_isotrac.eq.0) then 16746 16747 16748 #ifdef ISOVERIF 16749 DO nsrf = 1, nbsrf 16750 do i=1,klon 16751 call iso_verif_traceur(fxtevap(1,i,nsrf), & 16752 & 'phyiso_etat0_fichier 426') 16753 enddo !do i=1,klon 16754 enddo !DO nsrf = 1, nbsrf 16755 do i=1,klon 16756 call iso_verif_traceur(xtrain_fall(1,i), & 16757 & 'phyiso_etat0_fichier 466') 16758 call iso_verif_traceur(xtsnow_fall(1,i), & 16759 & 'phyiso_etat0_fichier 468') 16760 enddo !do i=1,klon 16761 do k=1,klev 16762 do i=1,klon 16763 call iso_verif_traceur(xt_ancien(1,i,k), & 16764 & 'phyiso_etat0_fichier 591') 16765 enddo !do i=1,klon 16766 enddo !do k=1,klev 16624 IF(initialisation_isotrac /= 0) THEN 16625 ! On n'initialise pas d'apres le fichier. L'eau normale est mise dans la zone izone_init 16626 DO ixt=niso+1,ntraciso 16627 iiso=index_iso(ixt) 16628 IF(index_zone(ixt) == izone_init) THEN 16629 DO i = 1, klon 16630 fxtevap(ixt,i,1:nsrf) = fxtevap(iiso,i,1:nsrf) 16631 xtsnow_fall(ixt,i) = xtsnow_fall(iiso,i) 16632 xtrain_fall(ixt,i) = xtrain_fall(iiso,i) 16633 DO k = 1, klev 16634 xt_ancien (ixt,i,k) = xt_ancien (iiso,i,k) 16635 xtl_ancien (ixt,i,k) = xtl_ancien (iiso,i,k) 16636 xts_ancien (ixt,i,k) = xts_ancien (iiso,i,k) 16637 wake_deltaxt(ixt,i,k) = wake_deltaxt(iiso,i,k) 16638 END DO 16639 END DO 16640 ELSE 16641 DO i = 1, klon 16642 fxtevap(ixt,i,1:nbsrf)=0.0 16643 xtsnow_fall(ixt,i)=0.0 16644 xtrain_fall(ixt,i)=0.0 16645 xt_ancien (ixt,i,1:klev) = 0.0 16646 xtl_ancien(ixt,i,1:klev) = 0.0 16647 xts_ancien(ixt,i,1:klev) = 0.0 16648 END DO 16649 END IF 16650 END DO 16651 END IF 16652 16653 #ifdef ISOVERIF 16654 DO nsrf = 1, nbsrf 16655 DO i = 1, klon 16656 CALL iso_verif_traceur(fxtevap(1,i,nsrf), 'phyiso_etat0_fichier 426') 16657 END DO 16658 END DO 16659 DO i=1,klon 16660 CALL iso_verif_traceur(xtrain_fall(1,i), 'phyiso_etat0_fichier 466') 16661 CALL iso_verif_traceur(xtsnow_fall(1,i), 'phyiso_etat0_fichier 468') 16662 END DO 16663 DO k = 1, klev 16664 DO i = 1, klon 16665 CALL iso_verif_traceur(xt_ancien(1,i,k), 'phyiso_etat0_fichier 591') 16666 END DO 16667 END DO 16767 16668 #endif 16768 16669 ! endif ISOVERIF … … 16770 16671 ! endif ISOTRAC 16771 16672 16772 ! on ferme le fichier 16773 ! CALL close_startphy 16774 ! déjà fermé dans phyetat0 16673 CONTAINS 16674 16675 LOGICAL FUNCTION phyetat0iso_get2(field, pref, descr, default) RESULT(lFound) 16676 REAL, INTENT(INOUT) :: field(:,:) 16677 CHARACTER(LEN=*), INTENT(IN) :: pref, descr 16678 REAL, INTENT(IN) :: default 16679 REAL :: iso_tmp(klon) 16680 nam(1) = TRIM(pref)//TRIM(outiso) 16681 nam(2) = TRIM(pref)//TRIM(oldIso) 16682 lFound = phyetat0_get(iso_tmp, nam, descr, default) 16683 field(ixt,:) = iso_tmp 16684 END FUNCTION phyetat0iso_get2 16685 16686 16687 LOGICAL FUNCTION phyetat0iso_get3(field, pref, descr, default) RESULT(lFound) 16688 REAL, INTENT(INOUT) :: field(:,:,:) 16689 CHARACTER(LEN=*), INTENT(IN) :: pref, descr 16690 REAL, INTENT(IN) :: default 16691 REAL :: iso_tmp_lonlev(klon,klev) 16692 nam(1) = TRIM(pref)//TRIM(outiso) 16693 nam(2) = TRIM(pref)//TRIM(oldIso) 16694 lFound = phyetat0_get(iso_tmp_lonlev, nam, descr, default) 16695 field(ixt,:,:) = iso_tmp_lonlev(:,:) 16696 END FUNCTION phyetat0iso_get3 16697 16698 LOGICAL FUNCTION phyetat0iso_srf3(field, pref, descr, default) RESULT(lFound) 16699 REAL, INTENT(INOUT) :: field(:,:,:) 16700 CHARACTER(LEN=*), INTENT(IN) :: pref, descr 16701 REAL, INTENT(IN) :: default 16702 REAL :: iso_tmp_lonsrf(klon,nbsrf) 16703 nam(1) = TRIM(pref)//TRIM(outiso) 16704 nam(2) = TRIM(pref)//TRIM(oldIso) 16705 lFound = phyetat0_srf(iso_tmp_lonsrf, nam, descr, default) 16706 field(ixt,:,:) = iso_tmp_lonsrf 16707 END FUNCTION phyetat0iso_srf3 16775 16708 16776 16709 end subroutine phyiso_etat0_fichier 16710 16711 16777 16712 16778 16713 -
LMDZ6/trunk/libf/phylmdiso/phyetat0_mod.F90
r4357 r4358 1 1 ! $Id: phyetat0.F90 3890 2021-05-05 15:15:06Z jyg $ 2 3 MODULE phyetat0_mod 4 5 PRIVATE 6 PUBLIC :: phyetat0, phyetat0_get, phyetat0_srf 7 8 INTERFACE phyetat0_get 9 MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21 10 END INTERFACE phyetat0_get 11 INTERFACE phyetat0_srf 12 MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31 13 END INTERFACE phyetat0_srf 14 15 CONTAINS 2 16 3 17 SUBROUTINE phyetat0 (fichnom, clesphy0, tabcntr0) … … 17 31 du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, & 18 32 falb_dir, falb_dif, prw_ancien, prlw_ancien, prsw_ancien, & 19 ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, r adpas, radsol, rain_fall, ratqs, &33 ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, rneb_ancien, radpas, radsol, rain_fall, ratqs, & 20 34 rnebcon, rugoro, sig1, snow_fall, solaire_etat0, sollw, sollwdown, & 21 35 solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, & … … 31 45 USE geometry_mod, ONLY: longitude_deg, latitude_deg 32 46 USE iostart, ONLY: close_startphy, get_field, get_var, open_startphy 33 USE infotrac_phy, ONLY: nqtot, nbtr, types_trac, tracers 47 USE infotrac_phy, ONLY: nqtot, nbtr, type_trac, types_trac, tracers 48 USE readTracFiles_mod,ONLY: maxlen, new2oldH2O 34 49 USE traclmdz_mod, ONLY: traclmdz_from_restart 35 50 USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo … … 95 110 CHARACTER*7 str7 96 111 CHARACTER*2 str2 97 LOGICAL :: found ,phyetat0_get,phyetat0_srf112 LOGICAL :: found 98 113 REAL :: lon_startphy(klon), lat_startphy(klon) 114 CHARACTER(LEN=maxlen) :: tname, t(2) 99 115 100 116 #ifdef ISO … … 281 297 !=================================================================== 282 298 283 found=phyetat0_get( 1,ftsol(:,1),"TS","Surface temperature",283.)299 found=phyetat0_get(ftsol(:,1),"TS","Surface temperature",283.) 284 300 IF (found) THEN 285 301 DO nsrf=2,nbsrf … … 287 303 ENDDO 288 304 ELSE 289 found=phyetat0_srf( 1,ftsol,"TS","Surface temperature",283.)305 found=phyetat0_srf(ftsol,"TS","Surface temperature",283.) 290 306 ENDIF 291 307 … … 301 317 ENDIF 302 318 WRITE(str2, '(i2.2)') isw 303 found=phyetat0_srf( 1,falb_dir(:, isw,:),"A_dir_SW"//str2//"srf","Direct Albedo",0.2)304 found=phyetat0_srf( 1,falb_dif(:, isw,:),"A_dif_SW"//str2//"srf","Direct Albedo",0.2)319 found=phyetat0_srf(falb_dir(:, isw,:),"A_dir_SW"//str2//"srf","Direct Albedo",0.2) 320 found=phyetat0_srf(falb_dif(:, isw,:),"A_dif_SW"//str2//"srf","Direct Albedo",0.2) 305 321 ENDDO 306 322 ENDDO 307 323 308 found=phyetat0_srf( 1,u10m,"U10M","u a 10m",0.)309 found=phyetat0_srf( 1,v10m,"V10M","v a 10m",0.)324 found=phyetat0_srf(u10m,"U10M","u a 10m",0.) 325 found=phyetat0_srf(v10m,"V10M","v a 10m",0.) 310 326 311 327 !=================================================================== … … 319 335 ENDIF 320 336 WRITE(str2,'(i2.2)') isoil 321 found=phyetat0_srf( 1,tsoil(:, isoil,:),"Tsoil"//str2//"srf","Temp soil",0.)337 found=phyetat0_srf(tsoil(:, isoil,:),"Tsoil"//str2//"srf","Temp soil",0.) 322 338 IF (.NOT. found) THEN 323 339 PRINT*, "phyetat0: Le champ <Tsoil"//str7//"> est absent" … … 331 347 !======================================================================= 332 348 333 found=phyetat0_srf( 1,qsurf,"QS","Near surface hmidity",0.)334 found=phyetat0_get( 1,qsol,"QSOL","Surface hmidity / bucket",0.)335 found=phyetat0_srf( 1,snow,"SNOW","Surface snow",0.)336 found=phyetat0_srf( 1,fevap,"EVAP","evaporation",0.)337 found=phyetat0_get( 1,snow_fall,"snow_f","snow fall",0.)338 found=phyetat0_get( 1,rain_fall,"rain_f","rain fall",0.)349 found=phyetat0_srf(qsurf,"QS","Near surface hmidity",0.) 350 found=phyetat0_get(qsol,"QSOL","Surface hmidity / bucket",0.) 351 found=phyetat0_srf(snow,"SNOW","Surface snow",0.) 352 found=phyetat0_srf(fevap,"EVAP","evaporation",0.) 353 found=phyetat0_get(snow_fall,"snow_f","snow fall",0.) 354 found=phyetat0_get(rain_fall,"rain_f","rain fall",0.) 339 355 340 356 !======================================================================= … … 342 358 !======================================================================= 343 359 344 found=phyetat0_get( 1,solsw,"solsw","net SW radiation surf",0.)345 found=phyetat0_get( 1,solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.)346 found=phyetat0_get( 1,sollw,"sollw","net LW radiation surf",0.)347 found=phyetat0_get( 1,sollwdown,"sollwdown","down LW radiation surf",0.)360 found=phyetat0_get(solsw,"solsw","net SW radiation surf",0.) 361 found=phyetat0_get(solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.) 362 found=phyetat0_get(sollw,"sollw","net LW radiation surf",0.) 363 found=phyetat0_get(sollwdown,"sollwdown","down LW radiation surf",0.) 348 364 IF (.NOT. found) THEN 349 365 sollwdown(:) = 0. ; zts(:)=0. … … 354 370 ENDIF 355 371 356 found=phyetat0_get( 1,radsol,"RADS","Solar radiation",0.)357 found=phyetat0_get( 1,fder,"fder","Flux derivative",0.)372 found=phyetat0_get(radsol,"RADS","Solar radiation",0.) 373 found=phyetat0_get(fder,"fder","Flux derivative",0.) 358 374 359 375 360 376 ! Lecture de la longueur de rugosite 361 found=phyetat0_srf( 1,z0m,"RUG","Z0m ancien",0.001)377 found=phyetat0_srf(z0m,"RUG","Z0m ancien",0.001) 362 378 IF (found) THEN 363 379 z0h(:,1:nbsrf)=z0m(:,1:nbsrf) 364 380 ELSE 365 found=phyetat0_srf( 1,z0m,"Z0m","Roughness length, momentum ",0.001)366 found=phyetat0_srf( 1,z0h,"Z0h","Roughness length, enthalpy ",0.001)381 found=phyetat0_srf(z0m,"Z0m","Roughness length, momentum ",0.001) 382 found=phyetat0_srf(z0h,"Z0h","Roughness length, enthalpy ",0.001) 367 383 ENDIF 368 384 !FC … … 371 387 treedrg(:,1:klev,1:nbsrf)= 0.0 372 388 CALL get_field("treedrg_ter", drg_ter(:,:), found) 373 ! found=phyetat0_srf( 1,treedrg,"treedrg","drag from vegetation" , 0.)389 ! found=phyetat0_srf(treedrg,"treedrg","drag from vegetation" , 0.) 374 390 !lecture du profile de freinage des arbres 375 391 IF (.not. found ) THEN … … 377 393 ELSE 378 394 treedrg(:,1:klev,is_ter)= drg_ter(:,:) 379 ! found=phyetat0_ srf(klev,treedrg,"treedrg","freinage arbres",0.)395 ! found=phyetat0_get(treedrg,"treedrg","freinage arbres",0.) 380 396 ENDIF 381 397 ELSE … … 385 401 386 402 ! Lecture de l'age de la neige: 387 found=phyetat0_srf( 1,agesno,"AGESNO","SNOW AGE",0.001)403 found=phyetat0_srf(agesno,"AGESNO","SNOW AGE",0.001) 388 404 389 405 ancien_ok=.true. 390 ancien_ok=ancien_ok.AND.phyetat0_get(klev,t_ancien,"TANCIEN","TANCIEN",0.) 391 ancien_ok=ancien_ok.AND.phyetat0_get(klev,q_ancien,"QANCIEN","QANCIEN",0.) 392 ancien_ok=ancien_ok.AND.phyetat0_get(klev,ql_ancien,"QLANCIEN","QLANCIEN",0.) 393 ancien_ok=ancien_ok.AND.phyetat0_get(klev,qs_ancien,"QSANCIEN","QSANCIEN",0.) 394 ancien_ok=ancien_ok.AND.phyetat0_get(klev,u_ancien,"UANCIEN","UANCIEN",0.) 395 ancien_ok=ancien_ok.AND.phyetat0_get(klev,v_ancien,"VANCIEN","VANCIEN",0.) 396 ancien_ok=ancien_ok.AND.phyetat0_get(1,prw_ancien,"PRWANCIEN","PRWANCIEN",0.) 397 ancien_ok=ancien_ok.AND.phyetat0_get(1,prlw_ancien,"PRLWANCIEN","PRLWANCIEN",0.) 398 ancien_ok=ancien_ok.AND.phyetat0_get(1,prsw_ancien,"PRSWANCIEN","PRSWANCIEN",0.) 406 ancien_ok=ancien_ok.AND.phyetat0_get(t_ancien,"TANCIEN","TANCIEN",0.) 407 ancien_ok=ancien_ok.AND.phyetat0_get(q_ancien,"QANCIEN","QANCIEN",0.) 408 ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.) 409 ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.) 410 ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.) 411 ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.) 412 ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.) 413 ancien_ok=ancien_ok.AND.phyetat0_get(prw_ancien,"PRWANCIEN","PRWANCIEN",0.) 414 ancien_ok=ancien_ok.AND.phyetat0_get(prlw_ancien,"PRLWANCIEN","PRLWANCIEN",0.) 415 ancien_ok=ancien_ok.AND.phyetat0_get(prsw_ancien,"PRSWANCIEN","PRSWANCIEN",0.) 399 416 400 417 ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain … … 404 421 (maxval(ql_ancien).EQ.minval(ql_ancien)) .OR. & 405 422 (maxval(qs_ancien).EQ.minval(qs_ancien)) .OR. & 423 (maxval(rneb_ancien).EQ.minval(rneb_ancien)) .OR. & 406 424 (maxval(prw_ancien).EQ.minval(prw_ancien)) .OR. & 407 425 (maxval(prlw_ancien).EQ.minval(prlw_ancien)) .OR. & … … 411 429 ENDIF 412 430 413 found=phyetat0_get( klev,clwcon,"CLWCON","CLWCON",0.)414 found=phyetat0_get( klev,rnebcon,"RNEBCON","RNEBCON",0.)415 found=phyetat0_get( klev,ratqs,"RATQS","RATQS",0.)416 417 found=phyetat0_get( 1,run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.)431 found=phyetat0_get(clwcon,"CLWCON","CLWCON",0.) 432 found=phyetat0_get(rnebcon,"RNEBCON","RNEBCON",0.) 433 found=phyetat0_get(ratqs,"RATQS","RATQS",0.) 434 435 found=phyetat0_get(run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.) 418 436 419 437 !================================== … … 422 440 ! 423 441 IF (iflag_pbl>1) then 424 found=phyetat0_srf( klev+1,pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8)442 found=phyetat0_srf(pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8) 425 443 ENDIF 426 444 427 445 IF (iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 ) then 428 found=phyetat0_srf( klev+1,wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.)429 !! found=phyetat0_srf( 1,delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.)430 found=phyetat0_srf( 1,delta_tsurf,"DELTATS","Delta Ts wk/env ",0.)431 !! found=phyetat0_srf( 1,beta_aridity,"BETA_S","Aridity factor ",1.)432 found=phyetat0_srf( 1,beta_aridity,"BETAS","Aridity factor ",1.)446 found=phyetat0_srf(wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.) 447 !! found=phyetat0_srf(delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.) 448 found=phyetat0_srf(delta_tsurf,"DELTATS","Delta Ts wk/env ",0.) 449 !! found=phyetat0_srf(beta_aridity,"BETA_S","Aridity factor ",1.) 450 found=phyetat0_srf(beta_aridity,"BETAS","Aridity factor ",1.) 433 451 ENDIF !(iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 ) 434 452 … … 438 456 439 457 ! Emanuel 440 found=phyetat0_get( klev,sig1,"sig1","sig1",0.)441 found=phyetat0_get( klev,w01,"w01","w01",0.)458 found=phyetat0_get(sig1,"sig1","sig1",0.) 459 found=phyetat0_get(w01,"w01","w01",0.) 442 460 443 461 ! Wake 444 found=phyetat0_get( klev,wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.)445 found=phyetat0_get( klev,wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.)446 found=phyetat0_get( 1,wake_s,"WAKE_S","Wake frac. area",0.)462 found=phyetat0_get(wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.) 463 found=phyetat0_get(wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.) 464 found=phyetat0_get(wake_s,"WAKE_S","Wake frac. area",0.) 447 465 !jyg< 448 466 ! Set wake_dens to -1000. when there is no restart so that the actual 449 467 ! initialization is made in calwake. 450 468 !! found=phyetat0_get(1,wake_dens,"WAKE_DENS","Wake num. /unit area",0.) 451 found=phyetat0_get( 1,wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.)452 found=phyetat0_get( 1,awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.)453 found=phyetat0_get( 1,cv_gen,"CV_GEN","CB birth rate",0.)469 found=phyetat0_get(wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.) 470 found=phyetat0_get(awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.) 471 found=phyetat0_get(cv_gen,"CV_GEN","CB birth rate",0.) 454 472 !>jyg 455 found=phyetat0_get( 1,wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.)456 found=phyetat0_get( 1,wake_pe,"WAKE_PE","WAKE_PE",0.)457 found=phyetat0_get( 1,wake_fip,"WAKE_FIP","WAKE_FIP",0.)473 found=phyetat0_get(wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.) 474 found=phyetat0_get(wake_pe,"WAKE_PE","WAKE_PE",0.) 475 found=phyetat0_get(wake_fip,"WAKE_FIP","WAKE_FIP",0.) 458 476 459 477 ! Thermiques 460 found=phyetat0_get( 1,zmax0,"ZMAX0","ZMAX0",40.)461 found=phyetat0_get( 1,f0,"F0","F0",1.e-5)462 found=phyetat0_get( klev+1,fm_therm,"FM_THERM","Thermals mass flux",0.)463 found=phyetat0_get( klev,entr_therm,"ENTR_THERM","Thermals Entrain.",0.)464 found=phyetat0_get( klev,detr_therm,"DETR_THERM","Thermals Detrain.",0.)478 found=phyetat0_get(zmax0,"ZMAX0","ZMAX0",40.) 479 found=phyetat0_get(f0,"F0","F0",1.e-5) 480 found=phyetat0_get(fm_therm,"FM_THERM","Thermals mass flux",0.) 481 found=phyetat0_get(entr_therm,"ENTR_THERM","Thermals Entrain.",0.) 482 found=phyetat0_get(detr_therm,"DETR_THERM","Thermals Detrain.",0.) 465 483 466 484 ! ALE/ALP 467 found=phyetat0_get( 1,ale_bl,"ALE_BL","ALE BL",0.)468 found=phyetat0_get( 1,ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.)469 found=phyetat0_get( 1,alp_bl,"ALP_BL","ALP BL",0.)470 found=phyetat0_get( 1,ale_wake,"ALE_WAKE","ALE_WAKE",0.)471 found=phyetat0_get( 1,ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.)485 found=phyetat0_get(ale_bl,"ALE_BL","ALE BL",0.) 486 found=phyetat0_get(ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.) 487 found=phyetat0_get(alp_bl,"ALP_BL","ALP BL",0.) 488 found=phyetat0_get(ale_wake,"ALE_WAKE","ALE_WAKE",0.) 489 found=phyetat0_get(ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.) 472 490 473 491 ! fisrtilp/Clouds 0.002 could be ratqsbas. But can stay like this as well 474 found=phyetat0_get( klev,ratqs_inter,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002)492 found=phyetat0_get(ratqs_inter,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002) 475 493 476 494 !=========================================== … … 483 501 ALLOCATE(co2_send(klon), stat=ierr) 484 502 IF (ierr /= 0) CALL abort_physic('phyetat0', 'pb allocation co2_send', 1) 485 found=phyetat0_get( 1,co2_send,"co2_send","co2 send",co2_ppm0)503 found=phyetat0_get(co2_send,"co2_send","co2 send",co2_ppm0) 486 504 ENDIF 487 ELSE IF ( ANY(types_trac == 'lmdz')) THEN505 ELSE IF (type_trac == 'lmdz') THEN 488 506 it = 0 489 507 DO iq = 1, nqtot 490 508 IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE 491 509 it = it+1 492 found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iq)%name), & 493 "Surf trac"//TRIM(tracers(iq)%name),0.) 510 tname = tracers(iq)%name 511 t(1) = 'trs_'//TRIM(tname); t(2) = 'trs_'//TRIM(new2oldH2O(tname)) 512 found = phyetat0_get(trs(:,it), t(:), "Surf trac"//TRIM(tname), 0.) 494 513 END DO 495 514 CALL traclmdz_from_restart(trs) … … 523 542 ! ondes de gravite non orographiques 524 543 IF (ok_gwd_rando) found = & 525 phyetat0_get( klev,du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.)544 phyetat0_get(du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.) 526 545 IF (.NOT. ok_hines .AND. ok_gwd_rando) found & 527 = phyetat0_get( klev,du_gwd_front,"du_gwd_front","du_gwd_front",0.)546 = phyetat0_get(du_gwd_front,"du_gwd_front","du_gwd_front",0.) 528 547 529 548 ! prise en compte du relief sous-maille 530 found=phyetat0_get( 1,zmea,"ZMEA","sub grid orography",0.)531 found=phyetat0_get( 1,zstd,"ZSTD","sub grid orography",0.)532 found=phyetat0_get( 1,zsig,"ZSIG","sub grid orography",0.)533 found=phyetat0_get( 1,zgam,"ZGAM","sub grid orography",0.)534 found=phyetat0_get( 1,zthe,"ZTHE","sub grid orography",0.)535 found=phyetat0_get( 1,zpic,"ZPIC","sub grid orography",0.)536 found=phyetat0_get( 1,zval,"ZVAL","sub grid orography",0.)537 found=phyetat0_get( 1,zmea,"ZMEA","sub grid orography",0.)538 found=phyetat0_get( 1,rugoro,"RUGSREL","sub grid orography",0.)549 found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.) 550 found=phyetat0_get(zstd,"ZSTD","sub grid orography",0.) 551 found=phyetat0_get(zsig,"ZSIG","sub grid orography",0.) 552 found=phyetat0_get(zgam,"ZGAM","sub grid orography",0.) 553 found=phyetat0_get(zthe,"ZTHE","sub grid orography",0.) 554 found=phyetat0_get(zpic,"ZPIC","sub grid orography",0.) 555 found=phyetat0_get(zval,"ZVAL","sub grid orography",0.) 556 found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.) 557 found=phyetat0_get(rugoro,"RUGSREL","sub grid orography",0.) 539 558 540 559 !=========================================== … … 545 564 CALL ocean_slab_init(phys_tstep, pctsrf) 546 565 IF (nslay.EQ.1) THEN 547 found=phyetat0_get(1,tslab,"tslab01","tslab",0.) 548 IF (.NOT. found) THEN 549 found=phyetat0_get(1,tslab,"tslab","tslab",0.) 550 ENDIF 566 found=phyetat0_get(tslab,["tslab01","tslab "],"tslab",0.) 551 567 ELSE 552 568 DO i=1,nslay 553 569 WRITE(str2,'(i2.2)') i 554 found=phyetat0_get( 1,tslab(:,i),"tslab"//str2,"tslab",0.)570 found=phyetat0_get(tslab(:,i),"tslab"//str2,"tslab",0.) 555 571 ENDDO 556 572 ENDIF … … 565 581 ! Sea ice variables 566 582 IF (version_ocean == 'sicINT') THEN 567 found=phyetat0_get( 1,tice,"slab_tice","slab_tice",0.)583 found=phyetat0_get(tice,"slab_tice","slab_tice",0.) 568 584 IF (.NOT. found) THEN 569 585 PRINT*, "phyetat0: Le champ <tice> est absent" … … 571 587 tice(:)=ftsol(:,is_sic) 572 588 ENDIF 573 found=phyetat0_get( 1,seaice,"seaice","seaice",0.)589 found=phyetat0_get(seaice,"seaice","seaice",0.) 574 590 IF (.NOT. found) THEN 575 591 PRINT*, "phyetat0: Le champ <seaice> est absent" … … 585 601 if (activate_ocean_skin >= 1) then 586 602 if (activate_ocean_skin == 2 .and. type_ocean == 'couple') then 587 found = phyetat0_get( 1,delta_sal, "delta_sal", &603 found = phyetat0_get(delta_sal, "delta_sal", & 588 604 "ocean-air interface salinity minus bulk salinity", 0.) 589 found = phyetat0_get( 1,delta_sst, "delta_SST", &605 found = phyetat0_get(delta_sst, "delta_SST", & 590 606 "ocean-air interface temperature minus bulk SST", 0.) 591 607 end if 592 608 593 found = phyetat0_get( 1,ds_ns, "dS_ns", "delta salinity near surface", 0.)594 found = phyetat0_get( 1,dt_ns, "dT_ns", "delta temperature near surface", &609 found = phyetat0_get(ds_ns, "dS_ns", "delta salinity near surface", 0.) 610 found = phyetat0_get(dt_ns, "dT_ns", "delta temperature near surface", & 595 611 0.) 596 612 … … 633 649 END SUBROUTINE phyetat0 634 650 635 !=================================================================== 636 FUNCTION phyetat0_get(nlev,field,name,descr,default) 637 !=================================================================== 638 ! Lecture d'un champ avec contrôle 639 ! Function logique dont le resultat indique si la lecture 640 ! s'est bien passée 641 ! On donne une valeur par defaut dans le cas contraire 642 !=================================================================== 643 644 USE iostart, ONLY : get_field 645 USE dimphy, only: klon 646 USE print_control_mod, ONLY: lunout 647 648 IMPLICIT NONE 649 650 LOGICAL phyetat0_get 651 652 ! arguments 653 INTEGER,INTENT(IN) :: nlev 654 CHARACTER*(*),INTENT(IN) :: name,descr 655 REAL,INTENT(IN) :: default 656 REAL,DIMENSION(klon,nlev),INTENT(INOUT) :: field 657 658 ! Local variables 659 LOGICAL found 660 661 CALL get_field(name, field, found) 662 IF (.NOT. found) THEN 663 WRITE(lunout,*) "phyetat0: Le champ <",TRIM(name),"> est absent" 664 WRITE(lunout,*) "Depart legerement fausse. Mais je continue" 665 field(:,:)=default 666 ENDIF 667 WRITE(lunout,*) name, descr, MINval(field),MAXval(field) 668 phyetat0_get=found 669 670 RETURN 671 END FUNCTION phyetat0_get 672 673 !================================================================ 674 FUNCTION phyetat0_srf(nlev,field,name,descr,default) 675 !=================================================================== 676 ! Lecture d'un champ par sous-surface avec contrôle 677 ! Function logique dont le resultat indique si la lecture 678 ! s'est bien passée 679 ! On donne une valeur par defaut dans le cas contraire 680 !=================================================================== 681 682 USE iostart, ONLY : get_field 683 USE dimphy, only: klon 684 USE indice_sol_mod, only: nbsrf 685 USE print_control_mod, ONLY: lunout 686 687 IMPLICIT NONE 688 689 LOGICAL phyetat0_srf 690 ! arguments 691 INTEGER,INTENT(IN) :: nlev 692 CHARACTER*(*),INTENT(IN) :: name,descr 693 REAL,INTENT(IN) :: default 694 REAL,DIMENSION(klon,nlev,nbsrf),INTENT(INOUT) :: field 695 696 ! Local variables 697 LOGICAL found,phyetat0_get 698 INTEGER nsrf 699 CHARACTER*2 str2 700 701 IF (nbsrf.GT.99) THEN 702 WRITE(lunout,*) "Trop de sous-mailles" 703 call abort_physic("phyetat0", "", 1) 704 ENDIF 705 706 DO nsrf = 1, nbsrf 707 WRITE(str2, '(i2.2)') nsrf 708 found= phyetat0_get(nlev,field(:,:, nsrf), & 709 name//str2,descr//" srf:"//str2,default) 710 ENDDO 711 712 phyetat0_srf=found 713 714 RETURN 715 END FUNCTION phyetat0_srf 716 651 !============================================================================== 652 LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound) 653 ! Read a field. Check whether reading succeded and use default value if not. 654 IMPLICIT NONE 655 REAL, INTENT(INOUT) :: field(:) ! klon 656 CHARACTER(LEN=*), INTENT(IN) :: name 657 CHARACTER(LEN=*), INTENT(IN) :: descr 658 REAL, INTENT(IN) :: default 659 !------------------------------------------------------------------------------ 660 REAL :: fld(SIZE(field),1) 661 lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1) 662 END FUNCTION phyetat0_get10 663 !============================================================================== 664 LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound) 665 ! Same as phyetat0_get11, field on multiple levels. 666 IMPLICIT NONE 667 REAL, INTENT(INOUT) :: field(:,:) ! klon, nlev 668 CHARACTER(LEN=*), INTENT(IN) :: name 669 CHARACTER(LEN=*), INTENT(IN) :: descr 670 REAL, INTENT(IN) :: default 671 !----------------------------------------------------------------------------- 672 lFound = phyetat0_get21(field, [name], descr, default) 673 END FUNCTION phyetat0_get20 674 !============================================================================== 675 LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound) 676 ! Same as phyetat0_get11, multiple names. 677 IMPLICIT NONE 678 REAL, INTENT(INOUT) :: field(:) ! klon 679 CHARACTER(LEN=*), INTENT(IN) :: name(:) 680 CHARACTER(LEN=*), INTENT(IN) :: descr 681 REAL, INTENT(IN) :: default 682 !----------------------------------------------------------------------------- 683 REAL :: fld(SIZE(field),1) 684 lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1) 685 END FUNCTION phyetat0_get11 686 !============================================================================== 687 LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound) 688 ! Same as phyetat0_get11, field on multiple levels, multiple names. 689 USE iostart, ONLY: get_field 690 USE print_control_mod, ONLY: lunout 691 IMPLICIT NONE 692 REAL, INTENT(INOUT) :: field(:,:) ! klon, nlev 693 CHARACTER(LEN=*), INTENT(IN) :: name(:) 694 CHARACTER(LEN=*), INTENT(IN) :: descr 695 REAL, INTENT(IN) :: default 696 CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname 697 !----------------------------------------------------------------------------- 698 CHARACTER(LEN=LEN(name)) :: tnam 699 INTEGER :: i 700 DO i = 1, SIZE(name) 701 CALL get_field(TRIM(name(i)), field, lFound) 702 IF(lFound) EXIT 703 WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> " 704 END DO 705 IF(.NOT.lFound) THEN 706 WRITE(lunout,*) "Slightly distorted start ; continuing." 707 field(:,:) = default 708 tnam = name(1) 709 ELSE 710 tnam = name(i) 711 END IF 712 WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', & 713 MINval(field),' ',MAXval(field) 714 IF(PRESENT(tname)) tname = tnam 715 END FUNCTION phyetat0_get21 716 !============================================================================== 717 LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound) 718 ! Read a field per sub-surface. 719 ! Check whether reading succeded and use default value if not. 720 IMPLICIT NONE 721 REAL, INTENT(INOUT) :: field(:,:) 722 CHARACTER(LEN=*), INTENT(IN) :: name 723 CHARACTER(LEN=*), INTENT(IN) :: descr 724 REAL, INTENT(IN) :: default 725 !----------------------------------------------------------------------------- 726 REAL :: fld(SIZE(field,1),1,SIZE(field,2)) 727 lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:) 728 END FUNCTION phyetat0_srf20 729 730 !============================================================================== 731 LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound) 732 ! Same as phyetat0_sfr11, multiple names tested one after the other. 733 IMPLICIT NONE 734 REAL, INTENT(INOUT) :: field(:,:,:) 735 CHARACTER(LEN=*), INTENT(IN) :: name 736 CHARACTER(LEN=*), INTENT(IN) :: descr 737 REAL, INTENT(IN) :: default 738 !----------------------------------------------------------------------------- 739 lFound = phyetat0_srf31(field, [name], descr, default) 740 END FUNCTION phyetat0_srf30 741 742 !============================================================================== 743 LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound) 744 ! Same as phyetat0_sfr11, field on multiple levels. 745 IMPLICIT NONE 746 REAL, INTENT(INOUT) :: field(:,:) 747 CHARACTER(LEN=*), INTENT(IN) :: name(:) 748 CHARACTER(LEN=*), INTENT(IN) :: descr 749 REAL, INTENT(IN) :: default 750 !----------------------------------------------------------------------------- 751 REAL :: fld(SIZE(field,1),1,SIZE(field,2)) 752 lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:) 753 END FUNCTION phyetat0_srf21 754 755 !============================================================================== 756 LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound) 757 ! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other. 758 USE iostart, ONLY: get_field 759 USE print_control_mod, ONLY: lunout 760 USE strings_mod, ONLY: int2str, maxlen 761 IMPLICIT NONE 762 REAL, INTENT(INOUT) :: field(:,:,:) 763 CHARACTER(LEN=*), INTENT(IN) :: name(:) 764 CHARACTER(LEN=*), INTENT(IN) :: descr 765 REAL, INTENT(IN) :: default 766 !----------------------------------------------------------------------------- 767 INTEGER :: nsrf, i 768 CHARACTER(LEN=maxlen), ALLOCATABLE :: nam(:) 769 CHARACTER(LEN=maxlen) :: tname, des 770 IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1) 771 DO nsrf = 1, SIZE(field,3) 772 nam = [(TRIM(name(i))//TRIM(int2str(nsrf,2)), i=1, SIZE(name))] 773 des = TRIM(descr)//" srf:"//int2str(nsrf,2) 774 lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname) 775 END DO 776 WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', & 777 MINval(field),' ',MAXval(field) 778 END FUNCTION phyetat0_srf31 779 780 END MODULE phyetat0_mod 781 -
LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90
r4298 r4358 53 53 USE pbl_surface_mod, ONLY : pbl_surface 54 54 USE phyaqua_mod, only: zenang_an 55 USE phyetat0_mod, only: phyetat0 55 56 USE phystokenc_mod, ONLY: offline, phystokenc 56 57 USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, & … … 869 870 !C EXTERNAL o3cm ! initialiser l'ozone 870 871 EXTERNAL orbite ! calculer l'orbite terrestre 871 EXTERNAL phyetat0 ! lire l'etat initial de la physique872 872 EXTERNAL phyredem ! ecrire l'etat de redemarrage de la physique 873 873 EXTERNAL suphel ! initialiser certaines constantes
Note: See TracChangeset
for help on using the changeset viewer.