Ignore:
Timestamp:
04/20/11 12:08:00 (13 years ago)
Author:
mmaipsl
Message:

Enhancement : use ipslout number from errioipsl to redirect all prints of IOIPSL
in the local process when use with parallelization.
This variable ipslout can be modified with ipslnlf function of errioipsl module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • IOIPSL/trunk/src/histcom.f90

    r1028 r1378  
    1212  USE fliocom,  ONLY : flio_dom_file,flio_dom_att 
    1313  USE calendar 
    14   USE errioipsl, ONLY : ipslerr,ipsldbg 
     14  USE errioipsl, ONLY : ipslerr,ipsldbg,ipslout 
    1515!- 
    1616  IMPLICIT NONE 
     
    340340  ENDIF 
    341341!- 
    342   IF (l_dbg) WRITE(*,*) c_nam//" 0.0" 
     342  IF (l_dbg) WRITE(ipslout,*) c_nam//" 0.0" 
    343343!- 
    344344! Search for a free index 
     
    358358! 1.0 Transfering into the common for future use 
    359359!- 
    360   IF (l_dbg) WRITE(*,*) c_nam//" 1.0" 
     360  IF (l_dbg) WRITE(ipslout,*) c_nam//" 1.0" 
    361361!- 
    362362  W_F(idf)%itau0  = pitau0 
     
    366366! 2.0 Initializes all variables for this file 
    367367!- 
    368   IF (l_dbg) WRITE(*,*) c_nam//" 2.0" 
     368  IF (l_dbg) WRITE(ipslout,*) c_nam//" 2.0" 
    369369!- 
    370370  W_F(idf)%n_var = 0 
     
    383383! 3.0 Opening netcdf file and defining dimensions 
    384384!- 
    385   IF (l_dbg) WRITE(*,*) c_nam//" 3.0" 
     385  IF (l_dbg) WRITE(ipslout,*) c_nam//" 3.0" 
    386386!- 
    387387! Add DOMAIN number and ".nc" suffix in file name if needed 
     
    425425! 4.0 Declaring the geographical coordinates and other attributes 
    426426!- 
    427   IF (l_dbg) WRITE(*,*) c_nam//" 4.0" 
     427  IF (l_dbg) WRITE(ipslout,*) c_nam//" 4.0" 
    428428!- 
    429429  iret = NF90_PUT_ATT(nfid,NF90_GLOBAL,'Conventions','CF-1.1') 
     
    436436! 5.0 Saving some important information on this file in the common 
    437437!- 
    438   IF (l_dbg) WRITE(*,*) c_nam//" 5.0" 
     438  IF (l_dbg) WRITE(ipslout,*) c_nam//" 5.0" 
    439439!- 
    440440  IF (PRESENT(domain_id)) THEN 
     
    612612! 1.1 Create all the variables needed 
    613613!- 
    614   IF (l_dbg) WRITE(*,*) c_nam//" 1.0" 
     614  IF (l_dbg) WRITE(ipslout,*) c_nam//" 1.0" 
    615615!- 
    616616  nfid = W_F(idf)%ncfid 
     
    671671! 2.0 Longitude 
    672672!- 
    673   IF (l_dbg) WRITE(*,*) c_nam//" 2.0" 
     673  IF (l_dbg) WRITE(ipslout,*) c_nam//" 2.0" 
    674674!- 
    675675  i_s = 1; 
     
    702702! 3.0 Latitude 
    703703!- 
    704   IF (l_dbg) WRITE(*,*) c_nam//" 3.0" 
     704  IF (l_dbg) WRITE(ipslout,*) c_nam//" 3.0" 
    705705!- 
    706706  i_e = 2; 
     
    736736! 4.0 storing the geographical coordinates 
    737737!- 
    738   IF (l_dbg) WRITE(*,*) c_nam//" 4.0" 
     738  IF (l_dbg) WRITE(ipslout,*) c_nam//" 4.0" 
    739739!- 
    740740  IF ( (k_typ == 1).OR.(k_typ == 2) ) THEN 
     
    833833!    Is the name already in use ? 
    834834!- 
    835   IF (l_dbg) WRITE(*,*) "histvert : 1.0 Verifications", & 
     835  IF (l_dbg) WRITE(ipslout,*) "histvert : 1.0 Verifications", & 
    836836 &                      pzaxname,'---',pzaxunit,'---',pzaxtitle 
    837837!- 
     
    883883!- 
    884884  IF (l_dbg) & 
    885  &  WRITE(*,*) "histvert : 2.0 Add the information to the file" 
     885 &  WRITE(ipslout,*) "histvert : 2.0 Add the information to the file" 
    886886!- 
    887887  nfid = W_F(idf)%ncfid 
     
    918918!- 
    919919  IF (l_dbg) & 
    920   &  WRITE(*,*) "histvert : 3.0 add the information to the common" 
     920  &  WRITE(ipslout,*) "histvert : 3.0 add the information to the common" 
    921921!- 
    922922  W_F(idf)%n_zax = iv 
     
    10161016!     and verify that it does not already exist 
    10171017!- 
    1018   IF (l_dbg) WRITE(*,*) "histdef : 1.0" 
     1018  IF (l_dbg) WRITE(ipslout,*) "histdef : 1.0" 
    10191019!- 
    10201020  IF (iv > 1) THEN 
     
    10701070!- 
    10711071  IF (l_dbg) THEN 
    1072     WRITE(*,*) "histdef : 2.0",idf,iv,W_F(idf)%W_V(iv)%nbopp, & 
     1072    WRITE(ipslout,*) "histdef : 2.0",idf,iv,W_F(idf)%W_V(iv)%nbopp, & 
    10731073 &    W_F(idf)%W_V(iv)%sopp(1:W_F(idf)%W_V(iv)%nbopp), & 
    10741074 &    W_F(idf)%W_V(iv)%scal(1:W_F(idf)%W_V(iv)%nbopp) 
     
    11641164!- 
    11651165  IF (l_dbg) THEN 
    1166     WRITE(*,*) "histdef : 3.0" 
     1166    WRITE(ipslout,*) "histdef : 3.0" 
    11671167  ENDIF 
    11681168!- 
     
    11771177    W_F(idf)%W_V(iv)%t_bf(:) = 0. 
    11781178    IF (l_dbg) THEN 
    1179       WRITE(*,*) "histdef : 3.0 allocating time_buffer for", & 
     1179      WRITE(ipslout,*) "histdef : 3.0 allocating time_buffer for", & 
    11801180 &      " idf = ",idf," iv = ",iv," size = ",buff_sz 
    11811181    ENDIF 
     
    11871187!     The strategy is to bring it back to seconds for the tests 
    11881188!- 
    1189   IF (l_dbg) WRITE(*,*) "histdef : 4.0" 
     1189  IF (l_dbg) WRITE(ipslout,*) "histdef : 4.0" 
    11901190!- 
    11911191  W_F(idf)%W_V(iv)%freq_opp = pfreq_opp 
     
    12721272! 5.0 Initialize other variables of the common 
    12731273!- 
    1274   IF (l_dbg) WRITE(*,*) "histdef : 5.0" 
     1274  IF (l_dbg) WRITE(ipslout,*) "histdef : 5.0" 
    12751275!- 
    12761276  W_F(idf)%W_V(iv)%hist_wrt_rng = (PRESENT(var_range)) 
     
    12981298! 6.0 Get the time axis for this variable 
    12991299!- 
    1300   IF (l_dbg) WRITE(*,*) "histdef : 6.0" 
     1300  IF (l_dbg) WRITE(ipslout,*) "histdef : 6.0" 
    13011301!- 
    13021302! No time axis for once, l_max, l_min or never operation 
     
    13311331  ELSE 
    13321332    IF (l_dbg) THEN 
    1333       WRITE(*,*) "histdef : 7.0 ",TRIM(W_F(idf)%W_V(iv)%topp),'----' 
     1333      WRITE(ipslout,*) "histdef : 7.0 ",TRIM(W_F(idf)%W_V(iv)%topp),'----' 
    13341334    ENDIF 
    13351335    W_F(idf)%W_V(iv)%t_axid = -99 
     
    13851385! 1.0 Create the time axes 
    13861386!- 
    1387   IF (l_dbg) WRITE(*,*) "histend : 1.0" 
     1387  IF (l_dbg) WRITE(ipslout,*) "histend : 1.0" 
    13881388!- 
    13891389! 1.1 Define the time dimensions needed for this file 
     
    14731473! 2.0 declare the variables 
    14741474!- 
    1475   IF (l_dbg) WRITE(*,*) "histend : 2.0" 
     1475  IF (l_dbg) WRITE(ipslout,*) "histend : 2.0" 
    14761476!- 
    14771477  DO iv=1,W_F(idf)%n_var 
     
    15751575!- 
    15761576        IF (l_dbg) THEN 
    1577           WRITE(*,*) "histend : 2.0.n, freq_opp, freq_wrt", & 
     1577          WRITE(ipslout,*) "histend : 2.0.n, freq_opp, freq_wrt", & 
    15781578 &          W_F(idf)%W_V(iv)%freq_opp,W_F(idf)%W_V(iv)%freq_wrt 
    15791579        ENDIF 
     
    15961596! 3.0 Put the netcdf file into write mode 
    15971597!- 
    1598   IF (l_dbg) WRITE(*,*) "histend : 3.0" 
     1598  IF (l_dbg) WRITE(ipslout,*) "histend : 3.0" 
    15991599!- 
    16001600  iret = NF90_ENDDEF (nfid) 
     
    16021602! 4.0 Give some informations to the user 
    16031603!- 
    1604   IF (l_dbg) WRITE(*,*) "histend : 4.0" 
     1604  IF (l_dbg) WRITE(ipslout,*) "histend : 4.0" 
    16051605!- 
    16061606  WRITE(str70,'("All variables have been initialized on file :",I3)') idf 
     
    16821682!- 
    16831683  IF (l_dbg) THEN 
    1684     WRITE(*,*) "histwrite : ",c_nam 
     1684    WRITE(ipslout,*) "histwrite : ",c_nam 
    16851685  ENDIF 
    16861686!- 
     
    17911791    IF (.NOT.ALLOCATED(tbf_1)) THEN 
    17921792      IF (l_dbg) THEN 
    1793         WRITE(*,*) & 
     1793        WRITE(ipslout,*) & 
    17941794 &       c_nam//" : allocate tbf_1 for size = ", & 
    17951795 &       W_F(idf)%W_V(iv)%datasz_max 
     
    17981798    ELSE IF (W_F(idf)%W_V(iv)%datasz_max > SIZE(tbf_1)) THEN 
    17991799      IF (l_dbg) THEN 
    1800         WRITE(*,*) & 
     1800        WRITE(ipslout,*) & 
    18011801 &       c_nam//" : re-allocate tbf_1 for size = ", & 
    18021802 &       W_F(idf)%W_V(iv)%datasz_max 
     
    18711871!- 
    18721872  IF (l_dbg) THEN 
    1873     WRITE(*,*) "histwrite 0.0 : VAR : ",W_F(idf)%W_V(iv)%v_name 
    1874     WRITE(*,*) "histwrite 0.0 : nbindex :",nbindex 
    1875     WRITE(*,*) "histwrite 0.0 : nindex  :",nindex(1:MIN(3,nbindex)),'...' 
     1873    WRITE(ipslout,*) "histwrite 0.0 : VAR : ",W_F(idf)%W_V(iv)%v_name 
     1874    WRITE(ipslout,*) "histwrite 0.0 : nbindex :",nbindex 
     1875    WRITE(ipslout,*) "histwrite 0.0 : nindex  :",nindex(1:MIN(3,nbindex)),'...' 
    18761876  ENDIF 
    18771877!- 
     
    18881888  IF (.NOT.ALLOCATED(tbf_2)) THEN 
    18891889    IF (l_dbg) THEN 
    1890       WRITE(*,*) "histwrite_real 1.1 allocate tbf_2 ",SIZE(tbf_1) 
     1890      WRITE(ipslout,*) "histwrite_real 1.1 allocate tbf_2 ",SIZE(tbf_1) 
    18911891    ENDIF 
    18921892    ALLOCATE(tbf_2(W_F(idf)%W_V(iv)%datasz_max)) 
    18931893  ELSE IF (W_F(idf)%W_V(iv)%datasz_max > SIZE(tbf_2)) THEN 
    18941894    IF (l_dbg) THEN 
    1895       WRITE(*,*) "histwrite_real 1.2 re-allocate tbf_2 : ", & 
     1895      WRITE(ipslout,*) "histwrite_real 1.2 re-allocate tbf_2 : ", & 
    18961896     & SIZE(tbf_1)," instead of ",SIZE(tbf_2) 
    18971897    ENDIF 
     
    19061906!- 
    19071907  IF (l_dbg) THEN 
    1908     WRITE(*,*) "histwrite: 3.0",idf 
     1908    WRITE(ipslout,*) "histwrite: 3.0",idf 
    19091909  ENDIF 
    19101910!- 
     
    19241924 &      nbout,tbf_2) 
    19251925      IF (l_dbg) THEN 
    1926         WRITE(*,*) & 
     1926        WRITE(ipslout,*) & 
    19271927 &       "histwrite: 3.4a nbout : ",nbin,nbout,W_F(idf)%W_V(iv)%sopp(io) 
    19281928      ENDIF 
     
    19341934 &      nbout,tbf_1) 
    19351935      IF (l_dbg) THEN 
    1936         WRITE(*,*) & 
     1936        WRITE(ipslout,*) & 
    19371937 &     "histwrite: 3.4b nbout : ",nbin,nbout,W_F(idf)%W_V(iv)%sopp(io+1) 
    19381938      ENDIF 
     
    19421942!- 
    19431943    IF (l_dbg) THEN 
    1944       WRITE(*,*) & 
     1944      WRITE(ipslout,*) & 
    19451945 &     "histwrite: 3.5 size(tbf_1) : ",SIZE(tbf_1) 
    1946       WRITE(*,*) & 
     1946      WRITE(ipslout,*) & 
    19471947 &     "histwrite: 3.5 slab in X :", & 
    19481948 &     W_F(idf)%W_V(iv)%zorig(1),W_F(idf)%W_V(iv)%zsize(1) 
    1949       WRITE(*,*) & 
     1949      WRITE(ipslout,*) & 
    19501950 &     "histwrite: 3.5 slab in Y :", & 
    19511951 &     W_F(idf)%W_V(iv)%zorig(2),W_F(idf)%W_V(iv)%zsize(2) 
    1952       WRITE(*,*) & 
     1952      WRITE(ipslout,*) & 
    19531953 &     "histwrite: 3.5 slab in Z :", & 
    19541954 &     W_F(idf)%W_V(iv)%zorig(3),W_F(idf)%W_V(iv)%zsize(3) 
    1955       WRITE(*,*) & 
     1955      WRITE(ipslout,*) & 
    19561956 &     "histwrite: 3.5 slab of input:", & 
    19571957 &     W_F(idf)%W_V(iv)%scsize(1), & 
     
    19991999!- 
    20002000    IF (l_dbg) THEN 
    2001       WRITE(*,*) "histwrite: 4.0 tbf_1",idf,iv, & 
     2001      WRITE(ipslout,*) "histwrite: 4.0 tbf_1",idf,iv, & 
    20022002 &      TRIM(tmp_opp),' ---- ',LEN_TRIM(tmp_opp),nbindex 
    20032003    ENDIF 
     
    20162016!- 
    20172017    IF (l_dbg) THEN 
    2018       WRITE(*,*) "histwrite: 5.0 idf : ",idf," iv : ",iv," tsz : ",tsz 
     2018      WRITE(ipslout,*) "histwrite: 5.0 idf : ",idf," iv : ",iv," tsz : ",tsz 
    20192019    ENDIF 
    20202020!- 
     
    20322032! 6.0 Write to file if needed 
    20332033!- 
    2034   IF (l_dbg) WRITE(*,*) "histwrite: 6.0",idf 
     2034  IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.0",idf 
    20352035!- 
    20362036  IF (do_write) THEN 
     
    20412041!-- 6.1 Do the operations that are needed before writting 
    20422042!- 
    2043     IF (l_dbg) WRITE(*,*) "histwrite: 6.1",idf 
     2043    IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.1",idf 
    20442044!- 
    20452045    IF (     (TRIM(tmp_opp) /= "inst") & 
     
    20552055 &      .AND.(TRIM(tmp_opp) /= "once") ) THEN 
    20562056!- 
    2057       IF (l_dbg) WRITE(*,*) "histwrite: 6.2",idf 
     2057      IF (l_dbg) WRITE(ipslout,*) "histwrite: 6.2",idf 
    20582058!- 
    20592059      itax  = W_F(idf)%W_V(iv)%t_axid 
     
    20772077!- 
    20782078    IF (l_dbg) THEN 
    2079       WRITE(*,*) "histwrite: 6.3",idf,nfid,nvid,iv,itime 
     2079      WRITE(ipslout,*) "histwrite: 6.3",idf,nfid,nvid,iv,itime 
    20802080    ENDIF 
    20812081!- 
     
    21592159!- 
    21602160  IF (l_dbg) THEN 
    2161     WRITE(*,*) 'histvar_seq, start of the subroutine :',learning(idf) 
     2161    WRITE(ipslout,*) 'histvar_seq, start of the subroutine :',learning(idf) 
    21622162  ENDIF 
    21632163!- 
     
    22032203 &       'of your code. Thus if you wish to save time'// & 
    22042204 &       ' contact the IOIPSL team. ') 
    2205         WRITE(*,*) 'The sequence we have found up to now :' 
    2206         WRITE(*,*) varseq(idf,1:sp-1) 
     2205        WRITE(ipslout,*) 'The sequence we have found up to now :' 
     2206        WRITE(ipslout,*) varseq(idf,1:sp-1) 
    22072207        varseq_err(idf) = -1 
    22082208      ENDIF 
     
    22682268!- 
    22692269  IF (l_dbg) THEN 
    2270     WRITE(*,*) & 
     2270    WRITE(ipslout,*) & 
    22712271 &   'histvar_seq, end of the subroutine :',TRIM(pvarname),idv 
    22722272  ENDIF 
     
    22942294!- 
    22952295  IF (l_dbg) THEN 
    2296     WRITE(*,*) "->histsync" 
     2296    WRITE(ipslout,*) "->histsync" 
    22972297  ENDIF 
    22982298!- 
     
    23192319    IF (W_F(ifile)%ncfid > 0) THEN 
    23202320      IF (l_dbg) THEN 
    2321         WRITE(*,*) '  histsync - synchronising file number ',ifile 
     2321        WRITE(ipslout,*) '  histsync - synchronising file number ',ifile 
    23222322      ENDIF 
    23232323      iret = NF90_SYNC(W_F(ifile)%ncfid) 
     
    23262326!- 
    23272327  IF (l_dbg) THEN 
    2328     WRITE(*,*) "<-histsync" 
     2328    WRITE(ipslout,*) "<-histsync" 
    23292329  ENDIF 
    23302330!---------------------- 
     
    23492349!- 
    23502350  IF (l_dbg) THEN 
    2351     WRITE(*,*) "->histclo" 
     2351    WRITE(ipslout,*) "->histclo" 
    23522352  ENDIF 
    23532353!- 
     
    23742374    IF (W_F(ifile)%ncfid > 0) THEN 
    23752375      IF (l_dbg) THEN 
    2376         WRITE(*,*) '  histclo - closing specified file number :',ifile 
     2376        WRITE(ipslout,*) '  histclo - closing specified file number :',ifile 
    23772377      ENDIF 
    23782378      nfid = W_F(ifile)%ncfid 
     
    23822382!----- 
    23832383      IF (l_dbg) THEN 
    2384         WRITE(*,*) '  Entering loop on vars : ',W_F(ifile)%n_var 
     2384        WRITE(ipslout,*) '  Entering loop on vars : ',W_F(ifile)%n_var 
    23852385      ENDIF 
    23862386      DO iv=1,W_F(ifile)%n_var 
     
    23882388        IF (W_F(ifile)%W_V(iv)%hist_wrt_rng) THEN 
    23892389          IF (l_dbg) THEN 
    2390             WRITE(*,*) 'min value for file :',ifile,' var n. :',iv, & 
     2390            WRITE(ipslout,*) 'min value for file :',ifile,' var n. :',iv, & 
    23912391 &                     ' is : ',W_F(ifile)%W_V(iv)%hist_minmax(1) 
    2392             WRITE(*,*) 'max value for file :',ifile,' var n. :',iv, & 
     2392            WRITE(ipslout,*) 'max value for file :',ifile,' var n. :',iv, & 
    23932393 &                     ' is : ',W_F(ifile)%W_V(iv)%hist_minmax(2) 
    23942394          ENDIF 
     
    24202420!---- 2. Close the file 
    24212421!----- 
    2422       IF (l_dbg) WRITE(*,*) '  close file :',nfid 
     2422      IF (l_dbg) WRITE(ipslout,*) '  close file :',nfid 
    24232423      iret = NF90_CLOSE(nfid) 
    24242424      W_F(ifile)%ncfid = -1 
     
    24282428!- 
    24292429  IF (l_dbg) THEN 
    2430     WRITE(*,*) "<-histclo" 
     2430    WRITE(ipslout,*) "<-histclo" 
    24312431  ENDIF 
    24322432!--------------------- 
Note: See TracChangeset for help on using the changeset viewer.