!*==erodin.spg processed by SPAG 6.70Rc at 15:33 on 10 Dec 2012 !*------------------ SPAG Configuration Options -------------------- !*--0323,76 000101,-1 000000102011332010100002000000210211210,136 10 -- !*--1100000011112111000000000000,10,10,10,10,10,10,900,100 200000000 -- !*--000000010000000000000,72,72 73,42,38,33 00011112110000100000000 -- !*---------------------------------------------------------------------- !$Author: joelevin $ !$Date: 2012-03-30 10:14:38 -0500 (Fri, 30 Mar 2012) $ !$Revision: 12163 $ !$HeadURL: https://eweru-dev1.eweru.ksu.edu/svn/code/weps1/branches/WEPS_F90_update/weps.src/src/sweep/erodin.for $ subroutine erodin(i_unit,o_unit,cmdebugflag,already_read_inputs) use i_p1werm use i_c1gen use i_p1const use i_m1sim use i_m1flag use i_m1subr use i_m1geo use i_b1glob use i_c1glob use i_d1glob use i_s1layr use i_s1phys use i_s1dbh use i_s1agg use i_s1surf use i_s1sgeo use i_h1db1 use i_w1wind use i_w1pavg use i_p1erode use c_flags use c_plot use s_getline implicit none !*--ERODIN37 ! !*** Start of declarations rewritten by SPAG ! ! PARAMETER definitions ! integer,parameter :: mrcl = 512 ! ! Dummy arguments ! integer :: already_read_inputs,cmdebugflag,i_unit,o_unit intent (in) already_read_inputs,cmdebugflag,o_unit ! ! Local variables ! integer :: a,b,h,i,j,k,l,s,wflg,x,xflag,y real,dimension(mntime) :: f,wu character(mrcl) :: line real :: step,w0k,wfcalm,wuc ! !*** End of declarations rewritten by SPAG ! ! +++ PURPOSE +++ ! Utility to read initial conditions and variables from ! input file (stdin or erod.in) for the standalone erosion submodel ! ! If "o_unit" == stdout (6) then input not echo'd ! ! +++ ARGUMENT DECLARATIONS +++ ! ! ! +++ ARGUMENT DEFINITIONS +++ ! ! ! +++ PARAMETERS +++ ! ! ! +++ ARGUMENT DECLARATIONS & +++ ! + + + GLOBAL COMMON BLOCKS + + + ! ! + + + LOCAL COMMON BLOCKS + + + ! ! ! ! +++ LOCAL VARIABLES +++ ! ! + + + LOCAL VARIABLE DEFINITIONS + + + ! i, j, k = do-loop indices ! x,y,s,b,a,l,h = do-loop indices ! wflg = flag to determine format of wind speed data (0 = Weibull, 1 = real) ! debugflg = flag to output debug data (0 = none, 1 = input, 2 = more, etc.) ! xplot = flag to put plot data in arrays ! (value>0 = no. indep input variable, 0= none) ! f(mntime) = cumulative frequency of wind at speeds slrr_max) write (0,*) 'slrr: ',aslrr(s),' < ', & & slrr_min !Lower and upper limits of grid cell aerodynamic roughness allowed !by erosion submodel (currently determined by equation used here) if (aslrr(s)<(wzzo_min/0.3)) then write (0,*) 'slrr: ',aslrr(s) write (0,*) 'wzzo < WZZO_MIN: ',aslrr(s)*0.3,' < ', & & wzzo_min else if (aslrr(s)>(wzzo_max/0.3)) then write (0,*) 'slrr: ',aslrr(s) write (0,*) 'wzzo > WZZO_MAX: ',aslrr(s)*0.3,' > ', & & wzzo_max end if ! Oriented Roughness (ridge ht, spacing, width, orientation) line = getline(i_unit) ! read (getline(i_unit),*) aszrgh(s), asxrgs(s), read (line,*) aszrgh(s),asxrgs(s),&asxrgw(s),asargo(s) ! Oriented Roughness ( spacing) line = getline(i_unit) read (line,*) asxdks(s) ! read (getline(i_unit),*) asxdkh(s), asxdks(s) ! +++ HYDROLOGY +++ ! h1db1.inc ! Snow depth line = getline(i_unit) read (line,*) ahzsnd(s) ! read (getline(i_unit),*) ahzsnd(s) ! Soil layer wilting point line = getline(i_unit) read (line,*) (ahrwcw(l,s),l=1,nslay(s)) ! read (getline(i_unit),*) (ahrwcw(l,s), l=1,nslay(s)) ! Soil layer water content line = getline(i_unit) read (line,*) (ahrwca(l,s),l=1,nslay(s)) ! read (getline(i_unit),*) (ahrwca(l,s), l=1,nslay(s)) ! Soil surface hourly water content line = getline(i_unit) read (line,*) (ahrwc0(h,s),h=1,12) ! read (getline(i_unit),*) (ahrwc0(h,s), h=1,12) line = getline(i_unit) read (line,*) (ahrwc0(h,s),h=13,24) ! read (getline(i_unit),*) (ahrwc0(h,s), h=13,24) end do ! +++ WEATHER +++ ! We need to check on the units for air density - w1pavg.inc says (kg/m^3) ! Also, we need to see why it currently isn't being used - LJH said it was ! Air density line = getline(i_unit) read (line,*) awdair ! read (getline(i_unit),*) awdair ! Wind Direction line = getline(i_unit) read (line,*) awadir ! read (getline(i_unit),*) awadir ! Number of "steps" during 24 hours (96 = 15 minute intervals) line = getline(i_unit) read (line,*) ntstep ! read (getline(i_unit),*) ntstep ! anemometer height, zo at anemom, and location (station or field) ! note if flag=1, at field, awwzo will be changed to field value line = getline(i_unit) read (line,*) anemht,awzzo,wzoflg ! Weibull wind flag (0 - read Weibull parms, 1 - read wind speeds) line = getline(i_unit) read (line,*) wflg ! read (getline(i_unit),*) wflg ! w1wind.inc ! wind data inputs as the Weibull paramters ! (wfcalm, wuc, w0k) is indicated by code ntstep = 99 if (wflg==0) then ! Weibull parms (fraction calm, c, k) line = getline(i_unit) read (line,*) wfcalm,wuc,w0k ! read (getline(i_unit),*) wfcalm, wuc, w0k ! calculate daily max wind speed (99% speed) ! awudmx = wuc*(-log((1.0-0.99)/(1-wfcalm)))**(1.0/w0k) ! calculate period wind speeds step = ntstep do i = 1,ntstep ! find center of each step and add empirical last term from file ntstep.mcd f(i) = (1.0/(2.0*step)) + ((i-1)/step) + 0.3/(step*w0k) ! to prevent out-of-range if (f(i)0) then write (o_unit,*) 'barrier dim (x1,y1) (x2,y2) ', & &&'and height, porosity, and width' do b = 1,nbr write (o_unit,1700) ((amxbr(x,y,b),x=1,2),y=1,2), & & &amzbr(b),ampbr(b),amxbrw(b) end do end if write (o_unit,*) write (o_unit,*) '+++ SUBREGIONS +++' write (o_unit,*) write (o_unit,*) 'nsubr - number of subregions' write (o_unit,*) nsubr write (o_unit,*) 'subregion dimensions (x1,y1) (x2,y2)' do s = 1,nsubr write (o_unit,1500) ((amxsr(i,j,s),i=1,2),j=1,2) end do do s = 1,nsubr write (o_unit,*) write (o_unit,*) write (o_unit,*) '*********************** Subregion ',s, & &&' ***********************' write (o_unit,*) write (o_unit,*) '+++ BIOMASS +++' write (o_unit,*) write (o_unit,*) 'Biomass ht, flat cover' write (o_unit,1200) abzht(s),abffcv(s) write (o_unit,*) write (o_unit,*) 'Crop height, SAI, LAI' write (o_unit,1300) aczht(s),acrsai(s),acrlai(s) write (o_unit,*) write (o_unit,*) 'Residue height, SAI, LAI' write (o_unit,1300) adzht_ave(s),adrsaitot(s),adrlaitot(s) write (o_unit,*) write (o_unit,*) '+++ SOIL +++ ' write (o_unit,*) write (o_unit,*) 'nslay - number of soil layers' write (o_unit,*) nslay(s) write (o_unit,*) write (o_unit,*) 'layer depth b.density ', & &&'vfsand sand silt clay rock vol' do l = 1,nslay(s) write (o_unit,2000) l,aszlyt(l,s),asdblk(l,s), & & &asfvfs(l,s),asfsan(l,s),asfsil(l,s),& & asfcla(l,s),asvroc(l,s) end do write (o_unit,*) write (o_unit,*) 'layer AgD AgS ', & &&' GMD GMDmn GMDmx GSD' do l = 1,nslay(s) write (o_unit,2000) l,asdagd(l,s),aseags(l,s), & & &aslagm(l,s),aslagn(l,s),aslagx(l,s),& & as0ags(l,s) end do write (o_unit,*) write (o_unit,*) 'Crust frac thick mass LOS frac.LOS, ', & &&'density stability' write (o_unit,1600) asfcr(s),aszcr(s),asmlos(s),asflos(s), & & &asdcr(s),asecr(s) write (o_unit,*) write (o_unit,*) ' RR, Rg ht, width, spacing, ', & &&'orient., dike spacing' write (o_unit,1700) aslrr(s),aszrgh(s),asxrgw(s),asxrgs(s), & & &asargo(s),asxdks(s) write (o_unit,*) write (o_unit,*) '+++ HYDROLOGY +++ ' write (o_unit,*) write (o_unit,*) 'Snow depth (mm)' write (o_unit,*) ahzsnd(s) write (o_unit,*) write (o_unit,*) 'layer wilting and actual water contents' do l = 1,nslay(s) write (o_unit,2000) l,ahrwcw(l,s),ahrwca(l,s) end do write (o_unit,*) 'Hourly water contents - ahrwc0' write (o_unit,1600) (ahrwc0(h,s),h=1,6) write (o_unit,1600) (ahrwc0(h,s),h=7,12) write (o_unit,1600) (ahrwc0(h,s),h=13,18) write (o_unit,1600) (ahrwc0(h,s),h=19,24) end do write (o_unit,*) write (o_unit,*) '+++ WEATHER +++' write (o_unit,*) write (o_unit,*) ' anemht awwzo wzoflg ' write (o_unit,*) anemht,awzzo,wzoflg write (o_unit,*) ' wind dir (deg) and max wind speed (m/s)' write (o_unit,1200) awadir,awudmx write (o_unit,*) write (o_unit,*) 'Wind speeds (m/s) - ',ntstep,' intervals' k = 6 j = 1 do if (k