! By Rex L. Baum, 1 April 2004, revised by H.X. Chen, 2014
module grids
	integer,allocatable:: pf2(:),sctrtrace(:),indx(:),nxt(:),nv(:),nvu(:),dir(:),road(:),catchment(:),mouthpoint(:),slopedeposittrace(:),debrisflowtrace(:),warninglevel(:),warninglevelave(:)
	integer,allocatable:: dsctr(:),dsc(:),zo(:),temp(:),group(:),maxelecell(:),finalcell(:)
	double precision,allocatable:: rikzero(:),stemp(:)
	double precision,allocatable:: rik(:),rik1(:),ri(:),rizero(:),pf1(:)
	double precision,allocatable:: ro(:),wf(:),ir(:),tfg(:)
	double precision,allocatable:: zmax(:),slo(:),depth(:),ele(:),ele1(:),finalvolume(:),finaldistance(:),finaldeltah(:),ltstar(:),lbstar(:),debrisdeposit(:)
	double precision,allocatable:: maxele(:),volume(:),slopedeposit(:),sloperoadrisk(:),cumurain(:),debrisroadrisk(:)
	double precision,allocatable:: maxindirisk(:),aveindirisk(:)
	double precision,allocatable:: pfmax(:,:)
	
	! parameters for whole processes of debris flow simulation
	integer, allocatable:: fp(:,:)
	double precision, allocatable:: fv(:,:),maxfv(:)
	double precision, allocatable:: rideb(:,:)
	double precision, allocatable:: inierodithick(:),debdepothick(:),fh(:),frho(:),maxfh(:)
	logical,allocatable:: outflow(:)
	
end module grids
