Changeset 7576 for branches/ORCHIDEE_2_2


Ignore:
Timestamp:
2022-04-14T10:01:23+02:00 (3 years ago)
Author:
josefine.ghattas
Message:

Integrate routing scheme "highres" developped by Jan Polcher, tested and integrated in ORCHIDEE_2_2 by Lucia Rinchiuso. This corresponds to the revision 7574 of perso/lucia.rinchiuso/myORCHIDEE_2_2_r7481. The developements of the routing scheme from branches/ORCHIDEE-ROUTING at revision 7545 are taken into account.

See also ticket #842

Location:
branches/ORCHIDEE_2_2/ORCHIDEE
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_parallel/ioipsl_para.f90

    r5811 r7576  
    4646  USE mod_orchidee_para_var 
    4747  USE mod_orchidee_transfert_para 
     48  USE constantes_var, ONLY: val_exp 
    4849!- 
    4950  IMPLICIT NONE 
     
    8687     MODULE PROCEDURE & 
    8788          restput_p_r3d, restput_p_r2d, restput_p_r1d, & 
    88           restput_p_opp_r2d, restput_p_opp_r1d 
     89          restput_p_opp_r2d, restput_p_opp_r1d, & 
     90          restput_p_nogrid_r_scal, restput_p_nogrid_i_scal 
    8991  END INTERFACE 
    9092!- 
     
    98100  !! \n 
    99101  !_ ================================================================================================================================ 
    100  INTERFACE restget_p 
     102  INTERFACE restget_p 
    101103     MODULE PROCEDURE & 
    102104          restget_p_r3d, restget_p_r2d, restget_p_r1d, & 
    103           restget_p_opp_r2d, restget_p_opp_r1d 
     105          restget_p_opp_r2d, restget_p_opp_r1d, & 
     106          restget_p_nogrid_r_scal, restget_p_nogrid_i_scal 
    104107  END INTERFACE 
    105108 
     
    971974  END SUBROUTINE histwrite_r3d_p 
    972975 
     976  !!  ============================================================================================================================= 
     977!! SUBROUTINE:   restput_p_nogrid_r_scal 
     978!! 
     979!>\BRIEF          save real scalar (non-grid) data into the restart file 
     980!! 
     981!! DESCRIPTION:  Need to be call by all process 
     982!! 
     983!! \n 
     984!_ ============================================================================================================================== 
     985  SUBROUTINE restput_p_nogrid_r_scal (fid,vname_q,itau,var) 
     986    IMPLICIT NONE 
     987!- 
     988    INTEGER :: fid 
     989    CHARACTER(LEN=*) :: vname_q 
     990    INTEGER :: itau 
     991    REAL :: var 
     992    !----------------------------- 
     993    REAL :: xtmp(1) 
     994 
     995    IF (is_root_prc) THEN 
     996       xtmp(1) = var 
     997       CALL restput (fid, vname_q, 1, 1, 1, itau, xtmp) 
     998    ENDIF 
     999 
     1000  END SUBROUTINE restput_p_nogrid_r_scal 
     1001 
     1002  !!  ============================================================================================================================= 
     1003!! SUBROUTINE:   restput_p_nogrid_i_scal 
     1004!! 
     1005!>\BRIEF          save integer scalar (non-grid) data into the restart file 
     1006!! 
     1007!! DESCRIPTION:  Need to be call by all process 
     1008!! 
     1009!! \n 
     1010!_ ============================================================================================================================== 
     1011  SUBROUTINE restput_p_nogrid_i_scal (fid,vname_q,itau,var) 
     1012    IMPLICIT NONE 
     1013!- 
     1014    INTEGER :: fid 
     1015    CHARACTER(LEN=*) :: vname_q 
     1016    INTEGER :: itau 
     1017    INTEGER :: var 
     1018    !----------------------------- 
     1019    REAL :: xtmp(1) 
     1020    REAL :: realvar 
     1021 
     1022    IF (is_root_prc) THEN 
     1023       realvar = REAL(var,r_std) 
     1024       xtmp(1) = realvar 
     1025       CALL restput (fid, vname_q, 1, 1, 1, itau, xtmp) 
     1026    ENDIF 
     1027 
     1028  END SUBROUTINE restput_p_nogrid_i_scal 
     1029 
     1030!!  ============================================================================================================================= 
     1031!! SUBROUTINE:   restget_p_nogrid_r_scal 
     1032!! 
     1033!>\BRIEF        Transform the data (real scalar) from the restart file onto the model grid 
     1034!! 
     1035!! DESCRIPTION:  
     1036!! \n 
     1037!_ ============================================================================================================================== 
     1038  SUBROUTINE restget_p_nogrid_r_scal & 
     1039  (fid,vname_q,itau,def_beha,def_val,var) 
     1040! 
     1041    IMPLICIT NONE 
     1042!- 
     1043    INTEGER, INTENT(in)             :: fid 
     1044    CHARACTER(LEN=*), INTENT(in)    :: vname_q 
     1045    INTEGER, INTENT(in)             :: itau 
     1046    LOGICAL, INTENT(in)             :: def_beha 
     1047    REAL, INTENT(in)                :: def_val 
     1048    REAL, INTENT(out) :: var 
     1049    !------------------------- 
     1050    REAL, DIMENSION(1) :: tmp 
     1051 
     1052    tmp(1) = var 
     1053    IF (is_root_prc) THEN 
     1054       var = val_exp 
     1055       CALL restget (fid, vname_q, 1 ,1  , 1, itau, def_beha, tmp) 
     1056       var = tmp(1) 
     1057       IF(var == val_exp) var = def_val 
     1058    ENDIF 
     1059    CALL bcast(var) 
     1060 
     1061  END SUBROUTINE restget_p_nogrid_r_scal 
     1062 
     1063  !!  ============================================================================================================================= 
     1064!! SUBROUTINE:   restget_p_nogrid_i_scal 
     1065!! 
     1066!>\BRIEF        Transform the data (integer scalar) from the restart file onto the model grid 
     1067!! 
     1068!! DESCRIPTION: 
     1069!! \n 
     1070!_ ============================================================================================================================== 
     1071  SUBROUTINE restget_p_nogrid_i_scal & 
     1072  (fid,vname_q,itau,def_beha,def_val,varint) 
     1073! 
     1074    IMPLICIT NONE 
     1075!- 
     1076    INTEGER, INTENT(in)             :: fid 
     1077    CHARACTER(LEN=*), INTENT(in)    :: vname_q 
     1078    INTEGER, INTENT(in)             :: itau 
     1079    LOGICAL, INTENT(in)             :: def_beha 
     1080    REAL, INTENT(in)                :: def_val 
     1081    INTEGER, INTENT(out) :: varint 
     1082    !------------------------- 
     1083    REAL :: tmp 
     1084 
     1085    CALL restget_p_nogrid_r_scal(fid, vname_q, itau, def_beha, def_val, tmp) 
     1086    varint = INT(tmp) 
     1087  END SUBROUTINE restget_p_nogrid_i_scal 
     1088 
    9731089 
    9741090END MODULE ioipsl_para 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_parallel/xios_orchidee.f90

    r7510 r7576  
    6262            xios_orchidee_close_definition, & 
    6363            xios_orchidee_send_field, xios_orchidee_recv_field, & 
    64             xios_orchidee_set_file_attr, xios_orchidee_set_field_attr, xios_orchidee_set_fieldgroup_attr, xios_orchidee_setvar 
     64            xios_orchidee_set_file_attr, xios_orchidee_set_field_attr, xios_orchidee_set_fieldgroup_attr, xios_orchidee_setvar, xios_orchidee_addaxis 
    6565 
    6666 
     
    302302           
    303303       ELSE IF (grid_type==regular_xy ) THEN 
    304          ! Global domain 
     304 
     305          ! Global domain 
    305306          CALL xios_set_domain_attr("domain_landpoints", ni_glo=iim_g, nj_glo=jjm_g) 
    306          ! Local MPI domain 
     307          ! Local MPI domain 
    307308          CALL xios_set_domain_attr("domain_landpoints",type="curvilinear", ibegin=0, ni=iim_g, jbegin=jj_begin-1, nj=jj_nb) 
    308309 
     
    387388          CALL xios_set_field_attr("riversret",enabled=.FALSE.) 
    388389          CALL xios_set_field_attr("hydrographs",enabled=.FALSE.) 
     390          CALL xios_set_field_attr("htuhgmon",enabled=.FALSE.) 
    389391          CALL xios_set_field_attr("fastr",enabled=.FALSE.) 
    390392          CALL xios_set_field_attr("slowr",enabled=.FALSE.) 
     
    414416       END IF 
    415417 
    416  
    417418       IF (.NOT. ok_freeze_cwrr) THEN 
    418419          CALL xios_set_field_attr("profil_froz_hydro",enabled=.FALSE.) 
     
    432433          CALL xios_set_field_attr("floodmap",enabled=.FALSE.) 
    433434          CALL xios_set_field_attr("floodh",enabled=.FALSE.)        
    434           CALL xios_set_field_attr("floodout",enabled=.FALSE.)        
     435          CALL xios_set_field_attr("floodout",enabled=.FALSE.) 
     436          CALL xios_set_field_attr("flood_frac",enabled=.FALSE.)        
    435437       END IF 
    436438 
     
    606608       !! 6. Close context 
    607609       ! 
    608        CALL xios_close_context_definition()       
     610       CALL xios_close_context_definition() 
     611       WRITE(numout,*) 'Done xios_orchidee_close_context'       
    609612 
    610613       ! 
     
    667670  END SUBROUTINE xios_orchidee_change_context 
    668671 
     672  !! 
     673  !! ============================================================================================================================== 
     674  !! SUBROUTINE   : xios_orchidee_addaxis 
     675  !! 
     676  !>\BRIEF         Use this subroutine to add axes, needed for nbasmon and nbasmax in routing_highres.f90 
     677  !! 
     678  !! 
     679  !! DESCRIPTION  :\n 
     680  !! 
     681  !! \n 
     682  !_ ================================================================================================================================ 
     683  SUBROUTINE xios_orchidee_addaxis(axname, axlen, axval) 
     684    ! 
     685    ! INPUT variables 
     686    CHARACTER(LEN=*), INTENT(IN)             :: axname 
     687    INTEGER(i_std), INTENT(IN)                :: axlen 
     688    REAL(r_std), DIMENSION(axlen), INTENT(IN) :: axval 
     689    ! 
     690    IF (xios_orchidee_ok .AND. is_omp_root) THEN 
     691       CALL xios_set_axis_attr(axname, n_glo=axlen, VALUE=axval) 
     692    ENDIF 
     693    ! 
     694  END SUBROUTINE xios_orchidee_addaxis 
     695  !! 
     696 
     697 
    669698  !! ============================================================================================================================== 
    670699  !! SUBROUTINE   : xios_orchidee_update_calendar 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing.f90

    r7500 r7576  
    5858  IMPLICIT NONE 
    5959  PRIVATE 
    60   PUBLIC :: routing_main, routing_initialize, routing_finalize, routing_clear, routing_names 
     60  PUBLIC :: routing_main, routing_initialize, routing_finalize, routing_clear, routing_names, routing_xios_initialize 
    6161 
    6262!! PARAMETERS 
     
    464464    !! This routine gives a diagnostic of the basins used. 
    465465    CALL routing_diagnostic_p(nbpt, index, lalo, resolution, contfrac, hist_id, hist2_id) 
    466      
     466 
    467467  END SUBROUTINE routing_initialize 
     468 
     469  !!  ============================================================================================================================= 
     470  !! SUBROUTINE:    routing_xios_initialize 
     471  !! 
     472  !>\BRIEF          Initialize xios dependant defintion before closing context defintion 
     473  !! 
     474  !! DESCRIPTION:   Initialize xios dependant defintion before closing context defintion. 
     475  !!                This subroutine is called before the xios context is closed.  
     476  !! 
     477  !! RECENT CHANGE(S): None 
     478  !! 
     479  !! REFERENCE(S): None 
     480  !!  
     481  !! FLOWCHART: None 
     482  !! \n 
     483  !_ ============================================================================================================================== 
     484 
     485  SUBROUTINE routing_xios_initialize 
     486    USE xios 
     487    IMPLICIT NONE 
     488 
     489    INTEGER(i_std) ::ib 
     490 
     491    ! Add axis for homogeneity between all routing schemes, these dimensions are currently not used in this scheme 
     492    CALL xios_orchidee_addaxis("nbhtu", nbasmax, (/(REAL(ib,r_std),ib=1,nbasmax)/)) 
     493    CALL xios_orchidee_addaxis("nbasmon", 1, (/(REAL(ib,r_std),ib=1,1)/)) 
     494 
     495  END SUBROUTINE routing_xios_initialize 
    468496 
    469497!! ================================================================================================================================ 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_simple.f90

    r7481 r7576  
    351351    IMPLICIT NONE      
    352352 
     353    INTEGER(i_std) ::ib 
     354 
    353355    !! 0 Variable and parameter description 
    354356    CHARACTER(LEN=60),ALLOCATABLE :: label(:) 
     
    363365       IF (file_exists) CALL xios_set_file_attr("routing_start", enabled=.TRUE.)   
    364366    ENDIF 
     367 
     368    !! Define XIOS axis size needed for the model output 
     369    ! Add axis for homogeneity between all routing schemes, these dimensions are currently not used in this scheme 
     370    CALL xios_orchidee_addaxis("nbhtu", nbasmax, (/(REAL(ib,r_std),ib=1,nbasmax)/)) 
     371    CALL xios_orchidee_addaxis("nbasmon", 1, (/(REAL(ib,r_std),ib=1,1)/)) 
    365372 
    366373  END SUBROUTINE routing_simple_xios_initialize 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_wrapper.f90

    r6102 r7576  
    1515!!                available routing modules:  
    1616!!                - ROUTING_METOD=standard for the standard routing scheme available in module routing.  
    17 !!                - ROUTING_METHOD=simple for the routing scheme in module routing_simple.  
     17!!                - ROUTING_METHOD=simple for the routing scheme in module routing_simple. 
     18!!                - ROUTING_METHOD=highres for the high resolution routing scheme in module routing_highres. 
    1819!! 
    1920!! REFERENCE(S) : None 
     
    3233  USE grid 
    3334  USE routing 
     35  USE routing_highres 
    3436  USE routing_simple 
    3537 
    3638  IMPLICIT NONE 
    3739 
    38   CHARACTER(LEN=255), SAVE :: routing_method                      !! 'standard' or 'simple': Character string used to switch between routing modules 
     40  CHARACTER(LEN=255), SAVE :: routing_method                      !! 'standard', 'highres' or 'simple': Character string used to switch between routing modules 
    3941  !$OMP THREADPRIVATE(routing_method)  
    4042 
     
    6769    routing_method='standard' 
    6870    CALL getin_p("ROUTING_METHOD",routing_method) 
    69     IF(routing_method=='simple') THEN   
     71    IF(routing_method=='standard') THEN 
     72       CALL routing_xios_initialize 
     73    ELSEIF(routing_method=='highres') THEN 
     74       CALL routing_highres_xios_initialize 
     75    ELSEIF(routing_method=='simple') THEN   
    7076       CALL routing_simple_xios_initialize 
    7177    ENDIF 
     
    144150 
    145151       CALL routing_initialize(  kjit,        nbpt,           index,                 & 
     152                                 rest_id,     hist_id,        hist2_id,   lalo,      & 
     153                                 neighbours,  resolution,     contfrac,   stempdiag, & 
     154                                 returnflow,  reinfiltration, irrigation, riverflow, & 
     155                                 coastalflow, flood_frac,     flood_res ) 
     156 
     157    ELSE IF (routing_method == 'highres') THEN 
     158 
     159       CALL routing_highres_initialize(  kjit,        nbpt,           index,                 & 
    146160                                 rest_id,     hist_id,        hist2_id,   lalo,      & 
    147161                                 neighbours,  resolution,     contfrac,   stempdiag, & 
     
    242256            stempdiag, reinf_slope, returnflow, reinfiltration, irrigation, riverflow, coastalflow, rest_id, hist_id, hist2_id) 
    243257 
     258    ELSE IF (routing_method=='highres') THEN 
     259 
     260       CALL routing_highres_main (kjit, nbpt, index, & 
     261            lalo, neighbours, resolution, contfrac, totfrac_nobio, veget_max, floodout, runoff, & 
     262            drainage, transpot, precip_rain, humrel, k_litt, flood_frac, flood_res, & 
     263            stempdiag, reinf_slope, returnflow, reinfiltration, irrigation, riverflow, coastalflow, rest_id, hist_id, hist2_id) 
     264 
    244265    ELSE IF(routing_method=='simple') THEN  
    245266 
     
    287308       CALL routing_finalize( kjit, nbpt, rest_id, flood_frac, flood_res ) 
    288309 
     310    ELSE IF (routing_method=='highres') THEN 
     311 
     312       CALL routing_highres_finalize( kjit, nbpt, rest_id, flood_frac, flood_res ) 
     313 
    289314    ELSE IF(routing_method=='simple') THEN  
    290315 
     
    316341       CALL routing_clear 
    317342 
     343    ELSE IF (routing_method=='highres') THEN 
     344 
     345       CALL routing_highres_clear 
     346 
    318347    ELSE IF(routing_method=='simple') THEN  
    319348 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_orchidee.xml

    r7510 r7576  
    5252      <reorder_domain invert_lat="true" shift_lon_fraction="0.5" min_lon="0" max_lon="360" /> 
    5353    </domain> 
    54      
     54 
    5555  </domain_definition> 
    5656 
     
    7272    <axis id="nscm" name="nscm" standard_name="model_level_number" long_name="Soil type" unit="1"/> 
    7373    <axis id="nsnow" name="snowlev" standard_name="model_level_number" long_name="Snow levels" unit="1"/> 
     74    <axis id="nbhtu" name="nbhtu" standard_name="model_level_number" long_name="HTU dimension for routing" unit="1"/> 
     75    <axis id="nbasmon" name="nbasmon" standard_name="model_level_number" long_name="HTU monitoring dimension" unit="1"/> 
    7476    <axis id="P10" standard_name="model_level_number" long_name="Pool 10 years" unit="1"/> 
    7577    <axis id="P100" standard_name="model_level_number" long_name="Pool 100 years" unit="1"/> 
     
    244246    </grid> 
    245247 
     248    <grid id="grid_nbhtu"> 
     249      <domain domain_ref="domain_landpoints" /> 
     250      <axis axis_ref="nbhtu" /> 
     251    </grid> 
     252    <grid id="grid_nbhtu_out"> 
     253      <domain domain_ref="domain_landpoints_out" /> 
     254      <axis axis_ref="nbhtu" /> 
     255    </grid> 
     256 
     257    <grid id="grid_nbasmon"> 
     258      <domain domain_ref="domain_landpoints" /> 
     259      <axis axis_ref="nbasmon" /> 
     260    </grid> 
     261    <grid id="grid_nbasmon_out"> 
     262      <domain domain_ref="domain_landpoints_out" /> 
     263      <axis axis_ref="nbasmon" /> 
     264    </grid> 
     265 
    246266 
    247267    <!-- Definition of grids with fields having two extra dimensions, 4D grids --> 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/field_def_orchidee.xml

    r7525 r7576  
    245245    <field id="irrigmap" name="irrigmap" long_name="Map of irrigated areas" unit="m^2" operation="once" freq_offset="0ts"/> 
    246246    <field id="floodmap" name="floodmap" long_name="Map of floodplains areas" unit="m^2" operation="once" freq_offset="0ts"/> 
     247    <field id="flood_frac" name="flood_frac" long_name="Flood Fraction" unit="1" /> 
    247248    <field id="mask_coast" name="mask_coast" long_name="Mask of coastal gridcell which can recieve coastalflow" unit="" operation="once" freq_offset="0ts"/> 
    248249    <field id="coastalflow" name="coastalflow" long_name="Diffuse coastal flow" unit="m^3/s"/> 
     
    251252    <field id="riverflow_cpl" name="riverflow_cpl" long_name="River flow to the oceans, variable distributed over a time period before sent to ocean." unit="m^3/s"/> 
    252253    <field id="hydrographs" name="hydrographs" long_name="Hydrographs of gridbox outflow" unit="m^3/s"/> 
     254    <field id="htuhgmon" name="htuhgmon" long_name="Hydrographs at monitored HTUs" unit="m^3/s" grid_ref="grid_nbasmon"/> 
    253255    <field id="fastr" name="fastr" long_name="Fast flow reservoir" unit="kg/m^2"/> 
    254256    <field id="slowr" name="slowr" long_name="Slow flow reservoir" unit="kg/m^2"/> 
     
    347349    <field id="mrro_lut" name="mrroLut" long_name="Total runoff from land use tile" unit="kg m-2 s-1" grid_ref="grid_nlut"/> 
    348350    <field id="gpplut" name="gppLut" long_name="Gross primary productivity on Landuse tiles" unit="kgC m-2 s-1" grid_ref="grid_nlut" /> 
     351 
    349352 
    350353    <!-- Varaibles interp_diag_xxx and interp_avail_xxx are written just after reading and interpolating from file and are used for validation --> 
  • branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/file_def_orchidee.xml

    r7525 r7576  
    7474    <field field_ref="riversret" level="2"/> 
    7575    <field field_ref="hydrographs" level="2"/> 
     76    <field field_ref="htuhgmon" name="HTUhydrographs" grid_ref="grid_nbasmon_out" level="2"/>  
    7677    <field field_ref="vevapnu" name="evapnu" level="0" unit="mm/d" > @vevapnu*86400  </field> 
    7778    <field field_ref="evap_bare_lim" level="2"/> 
     
    194195    <field field_ref="irrigmap" level="8"/> 
    195196    <field field_ref="floodmap" level="8"/> 
     197    <field field_ref="flood_frac" name="flood_frac" level="8"/> 
    196198    <field field_ref="floodh" level="8"/> 
    197199    <field field_ref="floodr" level="8"/> 
     
    463465    <field field_ref="irrigmap" level="8"/> 
    464466    <field field_ref="floodmap" level="8"/> 
     467    <field field_ref="flood_frac" name="flood_frac" level="8"/> 
    465468    <field field_ref="swampmap" level="8"/> 
    466469 
     
    616619    <field field_ref="irrigmap" name="IrrigationMap" level="1"/> 
    617620    <field field_ref="floodmap" name="FloodplainsMap" level="1"/> 
     621    <field field_ref="flood_frac" name="flood_frac" level="1"/> 
    618622    <field field_ref="swampmap" name="SwampMap" level="1"/> 
    619623    <field field_ref="hydrographs" name="Dis" level="1"/> 
     624    <field field_ref="htuhgmon" name="HTUDis" grid_ref="grid_nbasmon_out" level="1"/> 
    620625    <field field_ref="gpp" grid_ref="grid_nvm_out" name="GPP" level="1"/> 
    621626    <field field_ref="nee" grid_ref="grid_nvm_out" name="NEE" level="1"/> 
     
    687692    <field field_ref="irrigmap" name="IrrigationMap" level="1"/> 
    688693    <field field_ref="floodmap" name="FloodplainsMap" level="1"/> 
     694    <field field_ref="flood_frac" name="flood_frac" level="1"/> 
    689695    <field field_ref="swampmap" name="SwampMap" level="1"/> 
    690696    <field field_ref="hydrographs" name="Dis" level="1"/> 
Note: See TracChangeset for help on using the changeset viewer.