Subroutine vom_save_dayyear

1904 : 
1905 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1906 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1907 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1908 : !*----- saving fluxes to a single matrix -------------------------------
1909 : 
1910 :      subroutine vom_save_dayyear ()
1911 :      !subroutine to create one single matrix with all daily output variables
1912 :      !The saved matrix will be needed to write txt-files containing results from 
1913 :      !all runs. 
1914 : 
1915 :       use vom_vegwat_mod
1916 :       use vom_sce_mod
1917 :       implicit none
1918 : 
1919 :       CHARACTER(60) :: dailyformat
1920 :       CHARACTER(3)  :: str
1921 :       REAL*8, dimension(:), allocatable        :: tmp
1922 :       !REAL*8, DIMENSION(21, c_maxday ), intent(inout)        :: output
1923 : 
1924 : !     * internal write to convert from number to string
1925 :       write(str,'(I3)') wlayer_
1926 : !     * includes a column for each sublayer
1927 :       dailyformat = '(I6,I6,I4,I7,'//str//'E14.6)'
1928 : 
1929 :        !transpiration
1930 :        output_mat(1, nday) = etmt_d
1931 : 
1932 :        !daily atmospheric vapour deficit
1933 :        output_mat(1, nday) = vd_d / 24.d0
1934 : 
1935 :        !daily soil evaporation rate
1936 :        output_mat(2, nday) = esoil_d
1937 : 
1938 :        ! Tree photosynthetic electron transport capacity at 25oC
1939 :        output_mat(3, nday) = jmax25t_d(2)
1940 : 
1941 :        ! Grass photosynthetic electron transport capacity at 25oC
1942 :        output_mat(4, nday) = jmax25g_d(2)
1943 : 
1944 :        ! Projected cover perennial vegetation plus actual cover seasonal vegetation 
1945 :        output_mat(5, nday) = o_cai + pcg_d(2)
1946 : 
1947 :        ! Daily tree plus grass leaf respiration
1948 :        output_mat(6, nday) = rlt_d + rlg_d
1949 : 
1950 :        ! Target dE/dA for calculating gstomt (tree)
1951 :        output_mat(7, nday) = lambdat_d
1952 : 
1953 :        ! Target dE/dA for calculating gstomt (grass)
1954 :        output_mat(8, nday) = lambdag_d
1955 : 
1956 :        ! Tree root respiration rate
1957 :        output_mat(9, nday) = rrt_d * 3600.d0 * 24.d0
1958 : 
1959 :        ! Grass root respiration rate
1960 :        output_mat(10, nday) = rrg_d * 3600.d0 * 24.d0
1961 : 
1962 :        ! Daily tree assimilation
1963 :        output_mat(11, nday) = asst_d(2,2)
1964 : 
1965 :        ! Daily grass assimilation
1966 :        output_mat(12, nday) = assg_d(2,2,2)
1967 : 
1968 :        ! Average soil moisture
1969 :        output_mat(13, nday) = SUM(su__(1:wlayer_)) / wlayer_
1970 : 
1971 :        ! Elevation of water table
1972 :        output_mat(14, nday) = zw_
1973 : 
1974 :        ! Total soil water storage
1975 :        output_mat(15, nday) = wsnew
1976 : 
1977 :        ! Daily seepage face flow
1978 :        output_mat(16, nday) = spgfcf_d
1979 : 
1980 :        ! Daily infiltration excess runoff
1981 :        output_mat(17, nday) = infx_d
1982 : 
1983 :        ! Daily transpiration rate (tree)
1984 :        output_mat(18, nday) = etmt_d
1985 : 
1986 :        ! Daily transpiration rate (grass)
1987 :        output_mat(19, nday) = etmg_d
1988 : 
1989 :        ! Soil saturation degree in first layer
1990 :        output_mat(20, nday) = su__(1)
1991 : 
1992 :        ! Optimal temperature in temperature response curve
1993 :        output_mat(21, nday) = topt_
1994 :  
1995 : 
1996 :     !write to file
1997 :     if(nday .eq. c_maxday) then
1998 : 
1999 : 
2000 :       if( vd_d_out .eqv. .TRUE.) then
2001 :        write(kfile_vd_d,*) output_mat(1,:)
2002 :       end if
2003 :       if( esoil_out .eqv. .TRUE.) then
2004 :        write(kfile_esoil,*) output_mat(2,:)
2005 :       end if
2006 :       if( jmax25t_out .eqv. .TRUE.) then
2007 :        write(kfile_jmax25t,*) output_mat(3,:)
2008 :       end if
2009 :       if( jmax25g_out .eqv. .TRUE.) then
2010 :        write(kfile_jmax25g,*) output_mat(4,:)
2011 :       end if
2012 :       if( vegcov_out .eqv. .TRUE.) then
2013 :        write(kfile_vegcov,*) output_mat(5,:)
2014 :       end if
2015 :       if( resp_out .eqv. .TRUE.) then
2016 :        write(kfile_resp,*) output_mat(6,:)
2017 :       end if
2018 :       if( lambdat_out .eqv. .TRUE.) then
2019 :        write(kfile_lambdat,*) output_mat(7,:)
2020 :       end if
2021 :       if( lambdag_out .eqv. .TRUE.) then
2022 :        write(kfile_lambdag,*) output_mat(8,:)
2023 :       end if
2024 :       if( rrt_out .eqv. .TRUE.) then
2025 :        write(kfile_rrt,*) output_mat(9,:)
2026 :       end if
2027 :       if( rrg_out .eqv. .TRUE.) then
2028 :        write(kfile_rrg,*) output_mat(10,:)
2029 :       end if
2030 :       if( asst_out .eqv. .TRUE.) then
2031 :        write(kfile_asst,*) output_mat(11,:)
2032 :       end if
2033 :       if( assg_out .eqv. .TRUE.) then
2034 :        write(kfile_assg,*) output_mat(12,:)
2035 :       end if
2036 :       if( su_av_out .eqv. .TRUE.) then
2037 :        write(kfile_su_av,*) output_mat(13,:)
2038 :       end if
2039 :       if( zw_out .eqv. .TRUE.) then
2040 :        write(kfile_zw,*) output_mat(14,:)
2041 :       end if
2042 :       if( wsnew_out .eqv. .TRUE.) then
2043 :        write(kfile_wsnew,*) output_mat(15,:)
2044 :       end if
2045 :       if( spgfcf_out .eqv. .TRUE.) then
2046 :        write(kfile_spgfcf,*) output_mat(16,:)
2047 :       end if
2048 :       if( infx_out .eqv. .TRUE.) then
2049 :        write(kfile_infx,*) output_mat(17,:)
2050 :       end if
2051 :       if( etmt_out .eqv. .TRUE.) then
2052 :        write(kfile_etmt,*) output_mat(18,:)
2053 :       end if
2054 :       if( etmg_out .eqv. .TRUE.) then
2055 :        write(kfile_etmg,*) output_mat(19,:)
2056 :       end if
2057 :       if( su1_out .eqv. .TRUE.) then
2058 :        write(kfile_su1,*) output_mat(20,:)
2059 :       end if
2060 :       if( topt_out .eqv. .TRUE.) then
2061 :        write(kfile_topt,*) output_mat(21,:)
2062 :       end if
2063 : 
2064 :     end if 
2065 : 
2066 :       return
2067 :       end subroutine vom_save_dayyear